[med-svn] [libbpp-core] 02/06: Imported Upstream version 2.2.0

Andreas Tille tille at debian.org
Fri Apr 8 20:01:36 UTC 2016


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository libbpp-core.

commit 39df58f8491e1d4f5b3f7b2f393a2b78632c62d2
Author: Andreas Tille <tille at debian.org>
Date:   Fri Apr 8 21:44:46 2016 +0200

    Imported Upstream version 2.2.0
---
 CMakeLists.txt                                     |    5 +-
 ChangeLog                                          |   13 +
 Doxyfile                                           | 2531 ++++++++++++--------
 bpp-core.spec                                      |    7 +-
 debian/changelog                                   |    9 +
 debian/control                                     |    2 +-
 debian/copyright                                   |    6 +-
 debian/postinst                                    |   22 +-
 debian/postrm                                      |   26 +-
 debian/prerm                                       |   22 +-
 debian/rules                                       |    4 +-
 debian/postinst => genIncludes.sh                  |   10 +-
 src/Bpp/App/ApplicationTools.cpp                   |  126 +-
 src/Bpp/App/ApplicationTools.h                     |  185 +-
 src/Bpp/App/BppApplication.cpp                     |   11 +-
 src/Bpp/App/BppApplication.h                       |    3 +-
 src/Bpp/Exceptions.h                               |    1 +
 src/Bpp/Graph/BasicONode.cpp                       |    4 +-
 src/Bpp/Graph/BasicONode.h                         |    4 +-
 src/Bpp/Graph/BasicTNode.cpp                       |   22 +-
 src/Bpp/Graphics/AbstractGraphicDevice.h           |    2 +-
 src/Bpp/Graphics/ColorTools.cpp                    |   33 +-
 src/Bpp/Graphics/Fig/XFigGraphicDevice.cpp         |    2 +-
 src/Bpp/Graphics/Fig/XFigGraphicDevice.h           |    2 +-
 src/Bpp/Graphics/RgbColor.h                        |    8 +-
 src/Bpp/Io/BppOParametrizableFormat.cpp            |   76 +-
 src/Bpp/Io/FileTools.cpp                           |   12 +-
 src/Bpp/Io/OutputStream.h                          |   18 +-
 src/Bpp/Numeric/AbstractParameterAliasable.cpp     |  128 +-
 src/Bpp/Numeric/AbstractParameterAliasable.h       |  318 ++-
 src/Bpp/Numeric/AbstractParametrizable.h           |   17 +-
 .../Numeric/AdaptiveKernelDensityEstimation.cpp    |    2 +-
 src/Bpp/Numeric/Constraints.h                      |  108 +-
 src/Bpp/Numeric/DataTable.cpp                      |  504 ++--
 src/Bpp/Numeric/DataTable.h                        |  809 ++++---
 .../Function/ConjugateGradientMultiDimensions.cpp  |   10 +-
 .../Function/FivePointsNumericalDerivative.cpp     |   35 +-
 .../Function/FivePointsNumericalDerivative.h       |  149 +-
 src/Bpp/Numeric/Function/GoldenSectionSearch.cpp   |    8 +-
 src/Bpp/Numeric/Function/MetaOptimizer.h           |   22 +-
 .../Function/OneDimensionOptimizationTools.cpp     |  284 +--
 .../Function/OneDimensionOptimizationTools.h       |  230 +-
 .../Function/ReparametrizationFunctionWrapper.cpp  |    4 +-
 .../Function/ReparametrizationFunctionWrapper.h    |    2 +-
 .../Function/ThreePointsNumericalDerivative.cpp    |  180 +-
 .../Function/ThreePointsNumericalDerivative.h      |  143 +-
 .../Function/TwoPointsNumericalDerivative.cpp      |   32 +-
 .../Function/TwoPointsNumericalDerivative.h        |  150 +-
 .../Hmm/AbstractHmmTransitionMatrix.cpp}           |   60 +-
 src/Bpp/Numeric/Hmm/AbstractHmmTransitionMatrix.h  |  108 +
 .../Hmm/AutoCorrelationTransitionMatrix.cpp        |  113 +
 .../Numeric/Hmm/AutoCorrelationTransitionMatrix.h  |  118 +
 src/Bpp/Numeric/Hmm/FullHmmTransitionMatrix.cpp    |  155 ++
 src/Bpp/Numeric/Hmm/FullHmmTransitionMatrix.h      |  130 +
 src/Bpp/Numeric/Hmm/HmmEmissionProbabilities.h     |  133 +-
 src/Bpp/Numeric/Hmm/HmmLikelihood.cpp              |   90 +
 src/Bpp/Numeric/Hmm/HmmLikelihood.h                |  224 +-
 src/Bpp/Numeric/Hmm/HmmStateAlphabet.h             |  140 +-
 src/Bpp/Numeric/Hmm/HmmTransitionMatrix.h          |   73 +-
 src/Bpp/Numeric/Hmm/LogsumHmmLikelihood.cpp        |  325 ++-
 src/Bpp/Numeric/Hmm/LogsumHmmLikelihood.h          |  325 ++-
 .../Numeric/Hmm/LowMemoryRescaledHmmLikelihood.cpp |    7 +-
 .../Numeric/Hmm/LowMemoryRescaledHmmLikelihood.h   |   41 +-
 src/Bpp/Numeric/Hmm/RescaledHmmLikelihood.cpp      |  298 ++-
 src/Bpp/Numeric/Hmm/RescaledHmmLikelihood.h        |  324 ++-
 src/Bpp/Numeric/Matrix/EigenValue.h                |  364 +--
 src/Bpp/Numeric/Matrix/Matrix.h                    |  114 +-
 src/Bpp/Numeric/Matrix/MatrixTools.h               | 2032 ++++++++--------
 src/Bpp/Numeric/NumConstants.h                     |    2 +-
 src/Bpp/Numeric/Number.h                           |  144 +-
 src/Bpp/Numeric/Parameter.h                        |    1 -
 src/Bpp/Numeric/ParameterAliasable.h               |  118 +-
 src/Bpp/Numeric/ParameterList.cpp                  |   66 +-
 src/Bpp/Numeric/ParameterList.h                    |   21 +-
 src/Bpp/Numeric/ParametrizableCollection.h         |  356 +++
 .../Numeric/Prob/AbstractDiscreteDistribution.cpp  |    4 +-
 src/Bpp/Numeric/Prob/ConstantDistribution.cpp      |   12 +-
 src/Bpp/Numeric/Prob/ConstantDistribution.h        |    3 +-
 .../Prob/InvariantMixedDiscreteDistribution.h      |  256 +-
 .../Numeric/Prob/SimpleDiscreteDistribution.cpp    |    4 +-
 src/Bpp/Numeric/Prob/Simplex.cpp                   |  165 +-
 src/Bpp/Numeric/Prob/Simplex.h                     |  140 +-
 src/Bpp/Numeric/Random/RandomTools.cpp             |    9 +-
 src/Bpp/Numeric/Random/RandomTools.h               |   21 +-
 src/Bpp/Numeric/Range.h                            |    4 +-
 src/Bpp/Numeric/TransformedParameter.h             |   12 +-
 src/Bpp/Numeric/VectorTools.h                      |    1 +
 src/Bpp/Text/KeyvalTools.cpp                       |    2 +
 src/Bpp/Text/NestedStringTokenizer.cpp             |  110 +-
 src/Bpp/Text/NestedStringTokenizer.h               |  116 +-
 src/Bpp/Text/StringTokenizer.cpp                   |    2 +-
 src/Bpp/Text/StringTokenizer.h                     |  160 +-
 src/Bpp/Text/TextTools.cpp                         |   29 +-
 src/Bpp/Text/TextTools.h                           |    7 +-
 src/Bpp/Utils/AttributesTools.cpp                  |  229 +-
 src/Bpp/Utils/AttributesTools.h                    |  304 ++-
 src/CMakeLists.txt                                 |    8 +
 test/CMakeLists.txt                                |   12 +-
 test/test_derivative1.cpp                          |   12 +-
 test/test_reparametrization.cpp                    |   98 +
 test/test_simplex.cpp                              |  117 +
 101 files changed, 8948 insertions(+), 5072 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fb9b712..8950551 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,9 +67,9 @@ ENDIF (DOXYGEN_FOUND)
 # Packager
 SET(CPACK_PACKAGE_NAME "libbpp-core")
 SET(CPACK_PACKAGE_VENDOR "Bio++ Development Team")
-SET(CPACK_PACKAGE_VERSION "2.1.0")
+SET(CPACK_PACKAGE_VERSION "2.2.0")
 SET(CPACK_PACKAGE_VERSION_MAJOR "2")
-SET(CPACK_PACKAGE_VERSION_MINOR "1")
+SET(CPACK_PACKAGE_VERSION_MINOR "2")
 SET(CPACK_PACKAGE_VERSION_PATCH "0")
 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Bio++ Core library")
 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.txt")
@@ -87,7 +87,6 @@ SET(CPACK_SOURCE_IGNORE_FILES
  ".*\\\\.deb"
  ".*\\\\.rpm"
  ".*\\\\.dmg"
- ".*\\\\.sh"
  ".*\\\\..*\\\\.swp"
  "src/\\\\..*"
  "src/libbpp*"
diff --git a/ChangeLog b/ChangeLog
index 8c8ed8d..26b8901 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+17/09/14 -*- Version 2.2.0 -*-
+
+16/09/14 Julien Dutheil
+* Fixed bug in transformed parameters!
+  Derivative of tanh was incorrectly set to 1/cosh(x^2) instead of 1 / cosh^2(x) :s
+* Bug #88 fixed.
+
+12/06/14 Julien Dutheil
+* Added --warning argument to BppApplication + new gestion of warnings.
+
+14/04/14 Julien Dutheil
+* Added --seed argument to BppApplication to set random seed.
+
 04/03/13 -*- Version 2.1.0 -*-
 
 06/02/13 Julien Dutheil
diff --git a/Doxyfile b/Doxyfile
index 338c654..75bf108 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -1,339 +1,388 @@
-# Doxyfile 1.7.6.1
+# Doxyfile 1.8.6
 
 # This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
+# doxygen (www.doxygen.org) for a project.
 #
-# All text after a hash (#) is considered a comment and will be ignored
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single 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 (" ")
+# 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.
+# 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.
+# The default value is: UTF-8.
 
 DOXYFILE_ENCODING      = UTF-8
 
-# The PROJECT_NAME tag is a single word (or sequence of words) that should 
-# identify the project. Note that if you do not use Doxywizard you need 
-# to put quotes around the project name if it contains spaces.
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
 
 PROJECT_NAME           = bpp-core
 
-# 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.
+# 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         = 2.1.0
+PROJECT_NUMBER         = 2.2.0
 
-# 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.
+# 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.
+# 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.
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. 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.
+# 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 causes
+# performance problems for the file system.
+# The default value is: NO.
 
 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.
+# 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.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
 
 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.
+# If the BRIEF_MEMBER_DESC tag is set to YES 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.
+# The default value is: YES.
 
 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 
+# If the REPEAT_BRIEF tag is set to YES 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.
+# The default value is: YES.
 
 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"
+# 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 and the.
 
 ABBREVIATE_BRIEF       = 
 
-# 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 
+# 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.
+# The default value is: NO.
 
 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 
+# 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.
+# The default value is: NO.
 
 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.
+# If the FULL_PATH_NAMES tag is set to YES 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
+# The default value is: YES.
 
 FULL_PATH_NAMES        = YES
 
-# 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.
+# 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.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
 
 STRIP_FROM_PATH        = ./src/
 
-# 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.
+# 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 list of include paths that are normally passed to the compiler
+# using the -I flag.
 
 STRIP_FROM_INC_PATH    = ./src/
 
-# 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.
+# 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.
+# The default value is: NO.
 
 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.)
+# 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-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
 
 JAVADOC_AUTOBRIEF      = NO
 
-# 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.)
+# 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 Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
 
 QT_AUTOBRIEF           = NO
 
-# 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.
+# 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 behavior. 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 behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
 
 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.
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
 
 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.
+# 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.
+# The default value is: NO.
 
 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.
+# 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.
+# Minimum value: 1, maximum value: 16, default value: 4.
 
 TAB_SIZE               = 2
 
-# 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.
+# This tag can be used to specify a number of aliases that act 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                = 
 
-# This tag can be used to specify a number of word-keyword mappings (TCL only). 
-# A mapping has the form "name=value". For example adding 
-# "class=itcl::class" will allow you to use the command class in the 
-# itcl::class meaning.
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
 
 TCL_SUBST              = 
 
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
-# sources only. Doxygen will then generate output that is more tailored for C. 
-# For instance, some of the names that are used will be different. The list 
-# of all members will be omitted, etc.
+# 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.
+# The default value is: NO.
 
 OPTIMIZE_OUTPUT_FOR_C  = NO
 
-# 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.
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
 
 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.
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
 
 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.
+# 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.
+# The default value is: NO.
 
 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.
+# 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,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. 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 For files without extension you can use no_extension as a placeholder.
+#
+# 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 
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
 # diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
 
 BUILTIN_STL_SUPPORT    = YES
 
-# If you use Microsoft's C++/CLI language, you should set this option to YES to 
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
 # enable parsing support.
+# The default value is: NO.
 
 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.
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) 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.
+# The default value is: NO.
 
 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.
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES 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.
+# The default value is: YES.
 
 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 
+# 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.
+# The default value is: NO.
 
 DISTRIBUTE_GROUP_DOC   = NO
 
-# 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.
+# Set the SUBGROUPING tag to YES 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.
+# The default value is: YES.
 
 SUBGROUPING            = YES
 
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and 
-# unions are shown inside the group in which they are included (e.g. using 
-# @ingroup) instead of on a separate page (for HTML and Man pages) or 
-# section (for LaTeX and RTF).
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
 
 INLINE_GROUPED_CLASSES = NO
 
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and 
-# unions with only public data fields will be shown inline in the documentation 
-# of the scope in which they are defined (i.e. file, namespace, or group 
-# documentation), provided this scope is documented. If set to NO (the default), 
-# structs, classes, and unions are shown on a separate page (for HTML and Man 
-# pages) or section (for LaTeX and RTF).
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
 
 INLINE_SIMPLE_STRUCTS  = NO
 
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
-# is documented as struct, union, or enum with the name of the typedef. So 
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
-# 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 
+# When TYPEDEF_HIDES_STRUCT tag 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.
+# The default value is: NO.
 
 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
-
-# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be 
-# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given 
-# their name and scope. Since this can be an expensive process and often the 
-# same symbol appear multiple times in the code, doxygen keeps a cache of 
-# pre-resolved symbols. If the cache is too small doxygen will become slower. 
-# If the cache is too large, memory is wasted. The cache size is given by this 
-# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, 
-# corresponding to a cache size of 2^16 = 65536 symbols.
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
 
 LOOKUP_CACHE_SIZE      = 0
 
@@ -341,1110 +390,1492 @@ LOOKUP_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
+# 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 respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
 
 EXTRACT_ALL            = YES
 
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
-# will be included in the documentation.
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
 
 EXTRACT_PRIVATE        = YES
 
-# If the EXTRACT_STATIC tag is set to YES all static members of a file 
-# will be included in the documentation.
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
 
 EXTRACT_STATIC         = YES
 
-# 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.
+# 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. Does not have any effect
+# for Java sources.
+# The default value is: YES.
 
 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.
+# 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 only methods in the interface are
+# included.
+# The default value is: NO.
 
 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 namespaces are hidden.
+# 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.
+# The default value is: NO.
 
 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.
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO 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.
+# The default value is: NO.
 
 HIDE_UNDOC_MEMBERS     = NO
 
-# 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.
+# 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 these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
 
 HIDE_UNDOC_CLASSES     = NO
 
-# 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.
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
 
 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.
+# 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 these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
 
 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.
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
 
 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 
+# 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.
+# The default value is: system dependent.
 
 CASE_SENSE_NAMES       = YES
 
-# 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.
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
 
 HIDE_SCOPE_NAMES       = NO
 
-# 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.
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
 
 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.
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = NO
+
+# 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.
+# The default value is: NO.
 
 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.
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
 
 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.
+# If the SORT_MEMBER_DOCS tag is set to YES 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.
+# The default value is: YES.
 
 SORT_MEMBER_DOCS       = YES
 
-# 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.
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
 
 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.
+# 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 constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: 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.
+# 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 group names will
+# appear in their defined order.
+# The default value is: NO.
 
 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.
+# 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 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.
+# The default value is: NO.
 
 SORT_BY_SCOPE_NAME     = NO
 
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to 
-# do proper type resolution of all parameters of a function it will reject a 
-# match between the prototype and the implementation of a member function even 
-# if there is only one candidate or it is obvious which candidate to choose 
-# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen 
-# will still accept a match between prototype and implementation in such cases.
+# 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.
+# The default value is: NO.
 
 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.
+# 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.
+# The default value is: YES.
 
 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.
+# 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.
+# The default value is: YES.
 
 GENERATE_TESTLIST      = NO
 
-# 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.
+# 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.
+# The default value is: YES.
 
 GENERATE_BUGLIST       = NO
 
-# 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.
+# 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.
+# The default value is: YES.
 
 GENERATE_DEPRECATEDLIST= YES
 
-# The ENABLED_SECTIONS tag can be used to enable conditional 
-# documentation sections, marked by \if sectionname ... \endif.
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
 
 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.
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have 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 value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
 
 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.
+# 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.
+# The default value is: YES.
 
 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.
+# 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 value 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.
+# 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 value 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.
+# 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. For an example see the documentation.
 
 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.
+# 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. To 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.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
 
 LAYOUT_FILE            = 
 
-# The CITE_BIB_FILES tag can be used to specify one or more bib files 
-# containing the references data. This must be a list of .bib files. The 
-# .bib extension is automatically appended if omitted. Using this command 
-# requires the bibtex tool to be installed. See also 
-# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style 
-# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this 
-# feature you need bibtex and perl available in the search path.
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
 
 CITE_BIB_FILES         = 
 
 #---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
+# 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.
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
 
 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.
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
 
 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.
+# If the WARN_IF_UNDOCUMENTED tag 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.
+# The default value is: YES.
 
 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.
+# If the WARN_IF_DOC_ERROR tag 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.
+# The default value is: YES.
 
 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.
+# This 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 doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
 
 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)
+# 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)
+# The default value is: $file:$line: $text.
 
 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.
+# 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 standard
+# error (stderr).
 
 WARN_LOGFILE           = 
 
 #---------------------------------------------------------------------------
-# configuration options related to the input files
+# 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.
+# The INPUT tag is 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.
+# Note: If this tag is empty the current directory is searched.
 
 INPUT                  = src
 
-# 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.
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
 
 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++ *.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
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (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, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
 
 FILE_PATTERNS          = *.h \
                          *.cpp
 
-# 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.
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
 
 RECURSIVE              = YES
 
-# The EXCLUDE tag can be used to specify files and/or directories that should be 
-# excluded from the INPUT source files. This way you can easily exclude a 
-# subdirectory from a directory tree whose root is specified with the INPUT tag. 
-# Note that relative paths are relative to the directory from which doxygen is 
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
 # run.
 
 EXCLUDE                = 
 
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or 
-# directories that are symbolic links (a Unix file system feature) are excluded 
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
 # from the input.
+# The default value is: NO.
 
 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/*
+# 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       = 
 
-# 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, 
+# 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
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */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).
+# 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.
+# 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       = 
 
-# 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.
+# 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.
+# The default value is: NO.
 
 EXAMPLE_RECURSIVE      = NO
 
-# 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).
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be 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.
+# 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.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
 
 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.
+# 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 information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none 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).
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
 
 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.
+# 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 tag requires that the tag FILTER_SOURCE_FILES is set to YES.
 
 FILTER_SOURCE_PATTERNS = 
 
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE = 
+
 #---------------------------------------------------------------------------
-# configuration options related to source browsing
+# 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.
+# 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 that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
 
 SOURCE_BROWSER         = YES
 
-# Setting the INLINE_SOURCES tag to YES will include the body 
-# of functions and classes directly in the documentation.
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
 
 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.
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
 
 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.
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
 
 REFERENCED_BY_RELATION = YES
 
-# 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.
+# 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.
+# The default value is: NO.
 
 REFERENCES_RELATION    = YES
 
-# 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.
+# If the REFERENCES_LINK_SOURCE tag is set to YES 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.
+# The default value is: YES.
 
 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.
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = 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.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
 
 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.
+# If the VERBATIM_HEADERS tag is set the YES 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.
+# See also: Section \class.
+# The default value is: YES.
 
 VERBATIM_HEADERS       = YES
 
 #---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
+# 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.
+# 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.
+# The default value is: YES.
 
 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])
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
 
 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.
+# 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 a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
 
 IGNORE_PREFIX          = 
 
 #---------------------------------------------------------------------------
-# configuration options related to the HTML output
+# Configuration options related to the HTML output
 #---------------------------------------------------------------------------
 
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
-# generate HTML output.
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
 
 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.
+# 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.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 HTML_OUTPUT            = 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.
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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. Note that when using a custom header you are responsible  
-# for the proper inclusion of any scripts and style sheets that doxygen 
-# needs, which is dependent on the configuration options used. 
-# It is advised to generate a default header using "doxygen -w html 
-# header.html footer.html stylesheet.css YourConfigFile" and then modify 
-# that header. Note that the header is subject to change so you typically 
-# have to redo this when upgrading to a newer version of doxygen or when 
-# changing the value of configuration settings such as GENERATE_TREEVIEW!
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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 
-# style sheet in the HTML output directory as well, or it will be erased!
+# 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 left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 HTML_STYLESHEET        = 
 
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or 
-# other source files which should be copied to the HTML output directory. Note 
-# that these files will be copied to the base HTML output directory. Use the 
-# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these 
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that 
-# the files will be copied as-is; there are no commands or markers available.
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  = 
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 HTML_EXTRA_FILES       = 
 
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. 
-# Doxygen will adjust the colors in the style sheet and background images 
-# according to this color. Hue is specified as an angle on a colorwheel, 
-# see http://en.wikipedia.org/wiki/Hue for more information. 
-# For instance the value 0 represents red, 60 is yellow, 120 is green, 
-# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. 
-# The allowed range is 0 to 359.
+# 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.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# 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.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# 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.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# 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.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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).
+# 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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 
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# 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 (see: http://developer.apple.com/tools/xcode/), 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 GENERATE_DOCSET        = YES
 
-# 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.
+# This tag determines the name of the docset 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.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
 
 DOCSET_FEEDNAME        = "Bio++ Core Library"
 
-# 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.
+# 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.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
 
 DOCSET_BUNDLE_ID       = bpp.core
 
-# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify 
-# the documentation publisher. This should be a reverse domain-name style 
+# The DOCSET_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.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
 
 DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
 
-# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
 
 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.
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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 
+# 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.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
 
 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.
+# 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.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
 
 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).
+# 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).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
 
 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.
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
 
 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.
+# 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
 
 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.
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
 
 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.
+# 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# 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.
+# This tag requires that the tag GENERATE_QHP is set to YES.
 
 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
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
 
 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
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
 
 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
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
 
 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>.
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
 
 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>.
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
 
 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.
+# 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.
+# This tag requires that the tag GENERATE_QHP is set to YES.
 
 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.
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# 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. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
 
 ECLIPSE_DOC_ID         = org.doxygen.Project
 
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) 
-# at top of each HTML page. The value NO (the default) enables the index and 
-# the value YES disables it. Since the tabs have the same information as the 
-# navigation tree you can set this option to NO if you already set 
-# GENERATE_TREEVIEW to YES.
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 DISABLE_INDEX          = NO
 
-# 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. 
-# Since the tree basically has the same information as the tab index you 
-# could consider to set DISABLE_INDEX to NO when enabling this option.
+# 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. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 GENERATE_TREEVIEW      = YES
 
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values 
-# (range [0,1..20]) that doxygen will group on one line in the generated HTML 
-# documentation. Note that a value of 0 will completely suppress the enum 
-# values from appearing in the overview section.
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values 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.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 ENUM_VALUES_PER_LINE   = 4
 
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, 
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-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.
+# 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.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. 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.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# 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 directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 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.
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
 
 MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
 
-# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension 
-# names that should be enabled during MathJax rendering.
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
 
 MATHJAX_EXTENSIONS     = 
 
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box 
-# for the HTML output. The underlying search engine uses javascript 
-# and DHTML and should work on any modern browser. Note that when using 
-# 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.
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       = 
+
+# 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. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
 
 SEARCHENGINE           = YES
 
-# 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.
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
 
 SERVER_BASED_SEARCH    = NO
 
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       = 
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     = 
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  = 
+
 #---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
+# Configuration options related to the LaTeX output
 #---------------------------------------------------------------------------
 
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
-# generate Latex output.
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
 
 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.
+# 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.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 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.
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# 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.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 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.
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 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.
+# 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 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.
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 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.
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 EXTRA_PACKAGES         = 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!
+# 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. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 LATEX_HEADER           = 
 
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for 
-# the generated latex document. The footer should contain everything after 
-# the last chapter. If it is left blank doxygen will generate a 
-# standard footer. Notice: only use this tag if you know what you are doing!
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 LATEX_FOOTER           = 
 
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
-# contain links (just like the HTML output) instead of page references 
-# This makes the output suitable for online browsing using a pdf viewer.
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). 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.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 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 
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
 # higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 USE_PDFLATEX           = YES
 
-# 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.
+# 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 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.
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 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.
+# If the LATEX_SOURCE_CODE tag 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 LATEX_SOURCE_CODE      = NO
 
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the 
-# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See 
-# http://en.wikipedia.org/wiki/BibTeX for more info.
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
 
 LATEX_BIB_STYLE        = plain
 
 #---------------------------------------------------------------------------
-# configuration options related to the RTF output
+# 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.
+# 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 too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
 
 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.
+# 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.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
 
 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.
+# 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
 
 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.
+# 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 some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
 
 RTF_HYPERLINKS         = NO
 
-# Load style sheet definitions from file. Syntax is similar to doxygen's 
-# config file, i.e. a series of assignments. You only have to provide 
-# replacements, missing definitions are set to their default value.
+# 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.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
 
 RTF_STYLESHEET_FILE    = 
 
-# Set optional variables used in the generation of an rtf document. 
-# Syntax is similar to doxygen's config file.
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
 
 RTF_EXTENSIONS_FILE    = 
 
 #---------------------------------------------------------------------------
-# configuration options related to the man page output
+# Configuration options related to the man page output
 #---------------------------------------------------------------------------
 
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
-# generate man pages
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
 
 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.
+# 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. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
 
 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)
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
 
 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.
+# 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 value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
 
 MAN_LINKS              = NO
 
 #---------------------------------------------------------------------------
-# configuration options related to the XML output
+# 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.
+# 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.
+# The default value is: NO.
 
 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.
+# 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.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
 
 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.
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
 
 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.
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
 
 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.
+# 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.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
 
 XML_PROGRAMLISTING     = YES
 
 #---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
+# Configuration options related to the DOCBOOK 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.
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://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.
+# The default value is: NO.
 
 GENERATE_AUTOGEN_DEF   = NO
 
 #---------------------------------------------------------------------------
-# configuration options related to the Perl module output
+# 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.
+# 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.
+# The default value is: NO.
 
 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.
+# 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.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
 
 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.
+# 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.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
 
 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.
+# 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.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
 
 PERLMOD_MAKEVAR_PREFIX = 
 
@@ -1452,108 +1883,128 @@ 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.
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
 
 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.
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set 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.
+# 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.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
 EXPAND_ONLY_PREDEF     = NO
 
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
-# pointed to by INCLUDE_PATH will be searched when a #include is found.
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
 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.
+# 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.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
 
 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.
+# 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.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
 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.
+# 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 e.g.
+# 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.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
 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.
+# 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.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
 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.
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to 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.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
 SKIP_FUNCTION_MACROS   = YES
 
 #---------------------------------------------------------------------------
-# Configuration::additions related to external references
+# Configuration options 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.
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an 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.
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
 
 GENERATE_TAGFILE       = BppCore.tag
 
-# 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.
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
 
 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.
+# 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.
+# The default value is: YES.
 
 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').
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
 
 PERL_PATH              = /usr/bin/perl
 
@@ -1561,213 +2012,293 @@ 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 also works with HAVE_DOT disabled, but it is recommended to 
-# install and use dot, since it yields more powerful graphs.
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML 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.
+# The default value is: YES.
 
 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 
+# 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.
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_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.
+# The default value is: YES.
 
 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)
+# 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 (see:
+# http://www.graphviz.org/), 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 value is: NO.
 
 HAVE_DOT               = YES
 
-# 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.
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 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.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 DOT_NUM_THREADS        = 0
 
-# By default doxygen will use the Helvetica font for all dot files that 
-# doxygen generates. When you want a differently looking font you can specify 
-# the font name using DOT_FONTNAME. You need to make sure dot is able to find 
-# the font, which can be done by putting it in a standard location or by setting 
-# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the 
-# directory containing the font.
+# When you want a differently looking font n the dot files that doxygen
+# generates 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.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
-DOT_FONTNAME           = FreeSans
+DOT_FONTNAME           = Helvetica
 
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. 
-# The default size is 10pt.
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 DOT_FONTSIZE           = 10
 
-# By default doxygen will tell dot to use the Helvetica font. 
-# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to 
-# set the path where dot can find it.
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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 
-# CLASS_DIAGRAMS tag to NO.
+# If the CLASS_GRAPH tag is 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 CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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.
+# If the COLLABORATION_GRAPH tag is 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.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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 
+# 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.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 UML_LOOK               = NO
 
-# If set to YES, the inheritance and collaboration graphs will show the 
-# relations between templates and their instances.
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 TEMPLATE_RELATIONS     = YES
 
-# 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.
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES 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.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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.
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES 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.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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.
+# If the CALL_GRAPH tag is 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.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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.
+# If the CALLER_GRAPH tag is 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.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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.
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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.
+# If the DIRECTORY_GRAPH tag is 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.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 DIRECTORY_GRAPH        = YES
 
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
-# generated by dot. Possible values are svg, png, jpg, or gif. 
-# If left blank png will be used. If you choose svg you need to set 
-# HTML_FILE_EXTENSION to xhtml in order to make the SVG files 
-# visible in IE 9+ (other browsers do not have this requirement).
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 DOT_IMAGE_FORMAT       = png
 
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to 
-# enable generation of interactive SVG images that allow zooming and panning. 
-# Note that this requires a modern browser other than Internet Explorer. 
-# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you 
-# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files 
-# visible. Older versions of IE do not have SVG support.
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 INTERACTIVE_SVG        = NO
 
-# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# The DOT_PATH tag 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.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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).
+# 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).
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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).
+# 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.
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_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.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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 
+# 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.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 MAX_DOT_GRAPH_DEPTH    = 0
 
-# 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).
+# 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).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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.
+# 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.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 DOT_MULTI_TARGETS      = YES
 
-# 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.
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 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.
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
 
 DOT_CLEANUP            = YES
diff --git a/bpp-core.spec b/bpp-core.spec
index 06e8efd..38b3761 100644
--- a/bpp-core.spec
+++ b/bpp-core.spec
@@ -1,5 +1,5 @@
 %define _basename bpp-core
-%define _version 2.1.0
+%define _version 2.2.0
 %define _release 1
 %define _prefix /usr
 
@@ -166,6 +166,11 @@ exit 0
 %{_prefix}/include/*
 
 %changelog
+* Wed Sep 17 2014 Julien Dutheil <julien.dutheil at univ-montp2.fr> 2.2.0-1
+- Reparametrization wrapper debugged
+- Improved and rationalized display of warning messages
+- Possibility to set random seed in applications
+- Code checked for compilation with CLang.
 * Mon Mar 04 2013 Julien Dutheil <julien.dutheil at univ-montp2.fr> 2.1.0-1
 - Extended range classes
 - Improved initialization of static members
diff --git a/debian/changelog b/debian/changelog
index fb0eee0..d84c97f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+libbpp-core (2.2.0-1) unstable; urgency=low
+
+  * Reparametrization wrapper debugged
+  * Improved and rationalized display of warning messages
+  * Possibility to set random seed in applications
+  * Code checked for compilation with CLang.
+
+ -- Julien Dutheil <julien.dutheil at univ-montp2.fr>  Wed, 17 Sep 2014 14:00:00 +0100
+
 libbpp-core (2.1.0-1) unstable; urgency=low
 
   * Extended range classes
diff --git a/debian/control b/debian/control
index bc0ed01..8d6aa49 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Loic Dachary <loic at dachary.org>
 Uploaders: Julien Dutheil <julien.dutheil at univ-montp2.fr>
 Build-Depends: debhelper (>= 5), cmake (>= 2.6)
-Standards-Version: 3.9.1
+Standards-Version: 3.9.4
 
 Package: libbpp-core-dev
 Section: libdevel
diff --git a/debian/copyright b/debian/copyright
index 597cf01..c9da444 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,5 +1,5 @@
 This package was debianized by Julien Dutheil <julien.dutheil at univ-montp2.fr> on
-Mon, 04 Mar 2013 14:30:00 +0100.
+Wed, 17 Sep 2014 14:00:00 +0100.
 
 It was downloaded from <http://biopp.univ-montp2.fr/Repositories/sources>
 
@@ -9,7 +9,7 @@ Upstream Author:
 
 Copyright: 
 
-    Copyright (C) 2013 Bio++ Development Team
+    Copyright (C) 2014 Bio++ Development Team
 
 License:
 
@@ -30,7 +30,7 @@ License:
 On Debian systems, the complete text of the GNU General
 Public License can be found in `/usr/share/common-licenses/GPL'.
 
-The Debian packaging is (C) 2013, Julien Dutheil <julien.dutheil at univ-montp2.fr> and
+The Debian packaging is (C) 2014, Julien Dutheil <julien.dutheil at univ-montp2.fr> and
 is licensed under the GPL, see above.
 
 The provided software is distributed under the CeCILL license:
diff --git a/debian/postinst b/debian/postinst
index cf9e925..cff89b1 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -35,9 +35,23 @@ createGeneric() {
   done;
 }
 
-if [ "$1" = "configure" ]; then
-  # Actualize .all files
-  createGeneric /usr/include/Bpp
-fi
+case "$1" in
+  configure)
+    # Actualize .all files
+    createGeneric /usr/include/Bpp
+  ;;
+  abort-upgrade|abort-remove|abort-deconfigure)
+    echo "$1"
+  ;;
+  *)
+    echo "postinst called with unknown argument \`\$1'" >&2
+    exit 0
+  ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
 
 exit 0
diff --git a/debian/postrm b/debian/postrm
index 3931669..744f8b1 100755
--- a/debian/postrm
+++ b/debian/postrm
@@ -35,11 +35,25 @@ createGeneric() {
   done;
 }
 
-if [ "$1" = "remove" ]; then
-  # Automatically added by dh_makeshlibs
-  ldconfig
-  # Actualize .all files
-  createGeneric /usr/include/Bpp
-fi
+case "$1" in
+  remove)
+    # Automatically added by dh_makeshlibs
+    ldconfig
+    # Actualize .all files
+    createGeneric /usr/include/Bpp
+  ;;
+  purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    echo $1
+  ;;
+  *)
+    echo "postrm called with unknown argument \`\$1'" >&2
+    exit 0
+  ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
 
 exit 0
diff --git a/debian/prerm b/debian/prerm
index 5aefd24..8fab52e 100755
--- a/debian/prerm
+++ b/debian/prerm
@@ -19,9 +19,23 @@ removeGeneric() {
   done
 }
 
-if [ "$1" = "remove" ]; then
-  # Actualize .all files
-  removeGeneric /usr/include/Bpp
-fi
+case "$1" in
+  remove|upgrade|deconfigure)
+    # Actualize .all files
+    removeGeneric /usr/include/Bpp
+  ;;
+  failed-upgrade)
+    echo "$1"
+  ;;
+  *)
+    echo "prerm called with unknown argument \`$1'" >&2
+    exit 1
+  ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
 
 exit 0
diff --git a/debian/rules b/debian/rules
index 92c389e..34313ef 100755
--- a/debian/rules
+++ b/debian/rules
@@ -38,7 +38,9 @@ configure:
 config.status: configure
 	dh_testdir
 
-build: build-stamp
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep: build-stamp
 build-stamp:  config.status
 	dh_testdir
 
diff --git a/debian/postinst b/genIncludes.sh
similarity index 80%
copy from debian/postinst
copy to genIncludes.sh
index cf9e925..56710e9 100755
--- a/debian/postinst
+++ b/genIncludes.sh
@@ -1,8 +1,5 @@
 #! /bin/bash
 
-# Abort if any command returns an error value
-set -e
-
 createGeneric() {
   echo "-- Creating generic include file: $1.all"
   #Make sure we run into subdirectories first:
@@ -35,9 +32,4 @@ createGeneric() {
   done;
 }
 
-if [ "$1" = "configure" ]; then
-  # Actualize .all files
-  createGeneric /usr/include/Bpp
-fi
-
-exit 0
+createGeneric $1
diff --git a/src/Bpp/App/ApplicationTools.cpp b/src/Bpp/App/ApplicationTools.cpp
index d449a53..3480e15 100644
--- a/src/Bpp/App/ApplicationTools.cpp
+++ b/src/Bpp/App/ApplicationTools.cpp
@@ -56,6 +56,7 @@ time_t ApplicationTools::startTime;
 size_t ApplicationTools::terminalWidth = 80;
 float ApplicationTools::terminalSplit = 0.5;
 bool ApplicationTools::interactive = true;
+int ApplicationTools::warningLevel = 0;
 
 /******************************************************************************/
 
@@ -65,18 +66,102 @@ bool ApplicationTools::parameterExists(
 {
   return (params.find(parameterName) != params.end() && !TextTools::isEmpty(params[parameterName]));
 }
+
+bool ApplicationTools::parameterExists(
+  const std::string & parameterName,
+  std::vector<std::string>& params)
+{
+  for (size_t i = 0; i < params.size(); ++i)
+    if (params[i] == parameterName)
+      return true;
+
+  return false;
+}
+
+/******************************************************************************/
   
+std::vector<std::string> ApplicationTools::matchingParameters(const std::string& pattern, std::map<std::string, std::string>& params)
+{
+  vector<string> retv;
+
+  map<string, string>::iterator it;
+  for (it=params.begin(); it!=params.end(); it++)
+  {
+    StringTokenizer stj(pattern, "*", true, false);
+    size_t pos1, pos2;
+    string parn = it->first;
+    bool flag(true);
+    string g = stj.nextToken();
+    pos1 = parn.find(g);
+    if (pos1 != 0)
+      flag = false;
+    pos1 += g.length();
+    while (flag && stj.hasMoreToken())
+      {
+        g = stj.nextToken();
+        pos2 = parn.find(g, pos1);
+        if (pos2 == string::npos)
+          {
+            flag = false;
+            break;
+          }
+        pos1 = pos2 + g.length();
+      }
+    if (flag &&
+        ((g.length() == 0) || (pos1 == parn.length()) || (parn.rfind(g) == parn.length() - g.length())))
+      retv.push_back(parn);
+  }
+
+  return retv;
+}
+
+std::vector<std::string> ApplicationTools::matchingParameters(const std::string& pattern, std::vector<std::string>& params)
+{
+  vector<string> retv;
+
+  for (size_t i=0;i<params.size();i++)
+  {
+    StringTokenizer stj(pattern, "*", true, false);
+    size_t pos1, pos2;
+    string parn = params[i];
+    bool flag(true);
+    string g = stj.nextToken();
+    pos1 = parn.find(g);
+    if (pos1 != 0)
+      flag = false;
+    pos1 += g.length();
+    while (flag && stj.hasMoreToken())
+    {
+      g = stj.nextToken();
+      pos2 = parn.find(g, pos1);
+      if (pos2 == string::npos)
+      {
+        flag = false;
+        break;
+      }
+      pos1 = pos2 + g.length();
+    }
+    if (flag &&
+        ((g.length() == 0) || (pos1 == parn.length()) || (parn.rfind(g) == parn.length() - g.length())))
+      retv.push_back(parn);
+  }
+
+  return retv;
+}
+
 /******************************************************************************/
 
-std::string ApplicationTools::getAFilePath(
-  const std::string& parameter,
-  std::map<std::string, std::string>& params,
+string ApplicationTools::getAFilePath(
+  const string& parameter,
+  map<string, string>& params,
   bool isRequired,
   bool mustExist,
-  const std::string& suffix,
-  bool suffixIsOptional) throw (Exception)
+  const string& suffix,
+  bool suffixIsOptional,
+  const string& defaultPath, 
+  int warn) throw (Exception)
 {
-  string filePath = getStringParameter(parameter, params, "none", suffix, suffixIsOptional, false);
+  string filePath = getStringParameter(parameter, params, defaultPath, suffix, suffixIsOptional, warn);
   if (filePath == "") filePath = "none";
   if (filePath == "none" && isRequired)
   {
@@ -93,12 +178,12 @@ std::string ApplicationTools::getAFilePath(
 /******************************************************************************/
 
 double ApplicationTools::getDoubleParameter(
-  const std::string & parameterName,
-  std::map<std::string, std::string> & params,
+  const std::string& parameterName,
+  std::map<std::string, std::string>& params,
   double defaultValue,
-  const std::string & suffix,
+  const std::string& suffix,
   bool suffixIsOptional,
-  bool warn)
+  int warn)
 {
   double dParam = defaultValue;
   if (parameterExists(parameterName + suffix, params))
@@ -109,7 +194,7 @@ double ApplicationTools::getDoubleParameter(
   {
     dParam = TextTools::toDouble(params[parameterName]);
   }
-  else if(warn)
+  else if(warn <= warningLevel)
   {
     displayWarning("Parameter " + parameterName + suffix + " not specified. Default used instead: " + TextTools::toString(defaultValue));
   }
@@ -124,14 +209,14 @@ int ApplicationTools::getIntParameter(
   int defaultValue,
   const std::string & suffix,
   bool suffixIsOptional,
-  bool warn)
+  int warn)
 {
   int iParam = defaultValue;
   if (parameterExists(parameterName + suffix, params)) {
     iParam = TextTools::toInt(params[parameterName + suffix]);
   } else if(suffixIsOptional && parameterExists(parameterName, params)) {
     iParam = TextTools::toInt(params[parameterName]);
-  } else if (warn) {
+  } else if (warn <= warningLevel) {
     displayWarning("Parameter " + parameterName + suffix + " not specified. Default used instead: " + TextTools::toString(defaultValue));
   }
   return iParam;
@@ -145,14 +230,14 @@ std::string ApplicationTools::getStringParameter(
   const std::string& defaultValue,
   const std::string& suffix,
   bool suffixIsOptional,
-  bool warn)
+  int warn)
 {
   string sParam = defaultValue;
   if (parameterExists(parameterName + suffix, params)) {
     sParam = params[parameterName + suffix];
   } else if (suffixIsOptional && parameterExists(parameterName, params)) {
     sParam = params[parameterName];
-  } else if (warn) {
+  } else if (warn <= warningLevel) {
     displayWarning("Parameter " + parameterName + " not specified. Default used instead: " + defaultValue);
   }
   return sParam;
@@ -166,7 +251,7 @@ bool ApplicationTools::getBooleanParameter(
   bool defaultValue,
   const std::string& suffix,
   bool suffixIsOptional,
-  bool warn)
+  int warn)
 {
   string sParam;
   bool bParam = defaultValue;
@@ -179,7 +264,7 @@ bool ApplicationTools::getBooleanParameter(
     sParam = params[parameterName];
   }
   else {
-    if (warn)
+    if (warn <= warningLevel)
     {
       displayWarning("Parameter " + parameterName + " not specified. Default used instead: " + TextTools::toString(defaultValue));
     }
@@ -239,14 +324,15 @@ void ApplicationTools::displayGauge(size_t iter, size_t total, char symbol, cons
   size_t width = static_cast<size_t>(static_cast<float>(terminalWidth) * terminalSplit - 2);
   string gauge = string(static_cast<size_t>((1. * static_cast<double>(iter) / static_cast<double>(total)) * static_cast<double>(width)), symbol);
   string info = mes;
+  size_t step = static_cast<size_t>(ceil(1. * static_cast<double>(total) / static_cast<double>(width)));
+  size_t x = iter % step;
   if (interactive)
   {
     string fill = string(width - gauge.length(), ' ');
     gauge = "[" + gauge + fill + "] " + TextTools::resizeLeft(TextTools::toString(100 * iter / total), 3) + "%";
     if (mes.size() > terminalWidth - gauge.size())
       info = TextTools::resizeRight(mes, terminalWidth - gauge.size());
-    *message << '\r' + info + gauge;
-    message->flush();
+    if (x == 0 || iter == total) { *message << '\r' + info + gauge; message->flush(); }
   }
   else
   {
@@ -256,7 +342,6 @@ void ApplicationTools::displayGauge(size_t iter, size_t total, char symbol, cons
       message->flush();
       return;
     }
-    size_t step = static_cast<size_t>(ceil(1. * static_cast<double>(total) / static_cast<double>(width)));
     if (iter >= total)
     {
       size_t fill = static_cast<size_t>(static_cast<float>(terminalWidth) * terminalSplit) - (total - 1) / step - 1;
@@ -264,7 +349,6 @@ void ApplicationTools::displayGauge(size_t iter, size_t total, char symbol, cons
       message->flush();
       return;
     }
-    size_t x = iter % step;
     if (x == 0) { *message << symbol; message->flush(); }
   }
 }
diff --git a/src/Bpp/App/ApplicationTools.h b/src/Bpp/App/ApplicationTools.h
index 272ca85..a9b40af 100644
--- a/src/Bpp/App/ApplicationTools.h
+++ b/src/Bpp/App/ApplicationTools.h
@@ -6,36 +6,36 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide basal and 
-utilitary classes. This file belongs to the Bio++ Project.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+  This software is a computer program whose purpose is to provide basal and 
+  utilitary classes. This file belongs to the Bio++ Project.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _APPLICATIONTOOLS_H_
@@ -47,6 +47,8 @@ knowledge of the CeCILL license and that you accept its terms.
 #include "../Text/StringTokenizer.h"
 #include "../Text/NestedStringTokenizer.h"
 
+#include "../Numeric/Matrix/Matrix.h"
+
 // From the STL:
 #include <map>
 #include <vector>
@@ -87,8 +89,8 @@ namespace bpp
  * containing the parameters (names are the keys of the map, and values are... the values of the map!).
  * These map objects may be obtained from the AttributesTools utilitary class.
  */
-class ApplicationTools
-{
+  class ApplicationTools
+  {
   public:
     
     /**
@@ -123,7 +125,12 @@ class ApplicationTools
      * @brief Tell if the program is interactive (typically run in foreground). Default to yes.
      */
     static bool interactive;
-  
+ 
+    /**
+     * @brief Specify the amount of warning to display.
+     */
+    static int warningLevel;
+
   public:
     ApplicationTools() {}
     virtual ~ApplicationTools() {}
@@ -138,7 +145,22 @@ class ApplicationTools
      * @return True is the parameter of specified name is in the list.
      */
     static bool parameterExists(const std::string& parameterName, std::map<std::string, std::string>& params);
-  
+
+    static bool parameterExists(const std::string& parameterName, std::vector<std::string>& params);
+
+    /**
+     * @brief Returns a vector of parameter names that match a given pattern.
+     *
+     * Only "*" wildcard is implemented now.
+     *
+     * @param pattern The pattern.
+     * @param params  The parameter list.
+     * @return a vector of matching names.
+     */  
+    static std::vector<std::string> matchingParameters(const std::string& pattern, std::map<std::string, std::string>& params);
+
+    static std::vector<std::string> matchingParameters(const std::string& pattern, std::vector<std::string>& params);
+
     /**
      * @brief Get a double parameter.
      *
@@ -156,7 +178,7 @@ class ApplicationTools
       double defaultValue,
       const std::string& suffix = "",
       bool suffixIsOptional = true,
-      bool warn = true);
+      int warn = 0);
   
     /**
      * @brief Get an integer parameter.
@@ -175,7 +197,7 @@ class ApplicationTools
       int defaultValue,
       const std::string& suffix = "",
       bool suffixIsOptional = true,
-      bool warn = true);
+      int warn = 0);
   
     /**
      * @brief Get a string parameter.
@@ -194,7 +216,7 @@ class ApplicationTools
       const std::string& defaultValue,
       const std::string& suffix = "",
       bool suffixIsOptional = true,
-      bool warn = true);
+      int warn = 0);
 
     /**
      * @brief Get a boolean parameter.
@@ -213,7 +235,7 @@ class ApplicationTools
       bool defaultValue,
       const std::string& suffix = "",
       bool suffixIsOptional = true,
-      bool warn = true);
+      int warn = 0);
 
     /**
      * @brief Get a parameter.
@@ -232,17 +254,18 @@ class ApplicationTools
       T defaultValue,
       const std::string& suffix = "",
       bool suffixIsOptional = true,
-      bool warn = true)
+      int warn = 0)
     {
       T tParam = defaultValue;
-      if(parameterExists(parameterName + suffix, params))
+      if (parameterExists(parameterName + suffix, params))
       {
         tParam = TextTools::to<T>(params[parameterName + suffix]);
       }
-      else if(suffixIsOptional && parameterExists(parameterName, params))
+      else if (suffixIsOptional && parameterExists(parameterName, params))
       {
         tParam = TextTools::to<T>(params[parameterName]);
-      } else if(warn)
+      }
+      else if (warn <= warningLevel)
       {
         displayWarning("Parameter " + parameterName + suffix + " not specified. Default used instead: " + TextTools::toString(defaultValue));
       }
@@ -261,6 +284,8 @@ class ApplicationTools
      * @param mustExist        Tell if the corresponding file must already exist.
      * @param suffix           A suffix to be applied to the parameter name.
      * @param suffixIsOptional Tell if the suffix is absolutely required.
+     * @param defaultPath      Path to use if no argument is provided.
+     * @param warn             Tell if a warning must be sent in case the parameter is not found.
      * @throw Exception        If no file path is specified and isRequired is
      *                         true, or the file does not exist and mustExist
      *                         is set to true.
@@ -271,7 +296,9 @@ class ApplicationTools
       bool isRequired = true,
       bool mustExist = true,
       const std::string& suffix = "",
-      bool suffixIsOptional = false) throw (Exception);
+      bool suffixIsOptional = false,
+      const std::string& defaultPath = "none", 
+      int warn = 0) throw (Exception);
 
     /**
      * @brief Get a vector.
@@ -292,7 +319,7 @@ class ApplicationTools
       const std::string& defaultValue,
       const std::string& suffix = "",
       bool suffixIsOptional = true,
-      bool warn = true)
+      int warn = 0)
     {
       std::string s = getStringParameter(parameterName, params, defaultValue, suffix, suffixIsOptional, warn);
       if (TextTools::isEmpty(s)) return std::vector<T>(0);
@@ -338,6 +365,11 @@ class ApplicationTools
       bool warn = true)
     {
       std::string s = getStringParameter(parameterName, params, defaultValue, suffix, suffixIsOptional, warn);
+      if (s[0] == '(' && s[s.size() - 1] == ')') {
+        //This is a delimited vector:
+        s = s.substr(1, s.size() - 2);
+        if (TextTools::isEmpty(s)) return std::vector<T>(0);
+      }
       StringTokenizer st(s, TextTools::toString(separator));
       size_t n = st.numberOfRemainingTokens();
       std::vector<T> v;
@@ -360,7 +392,68 @@ class ApplicationTools
       }
       return v;
     }
-   
+
+    /**
+     * @brief Get a RowMatrix. The input is made of embedded
+     * parenthesis, such as ((1,2),(3,4)), where the matrix is filled by
+     * lines. Here, the matrix would be:
+     * \f[
+     * \begin{pmatrix}
+     * 1 & 2 \\
+     * 3 & 4 \\
+     * \end{pmatrix}
+     * \f]
+     *
+     * @param parameterName    The name of the corresponding parameter.
+     * @param params           The attribute map where options may be found.
+     * @param separator        The character used to delimit values.
+     * @param defaultValue     The default value to use if the parameter is not found.
+     * @param suffix           A suffix to be applied to the parameter name.
+     * @param suffixIsOptional Tell if the suffix is absolutely required.
+     * @param warn             Tell if a warning must be sent in case the parameter is not found.
+     * @return The corresponding value.
+     */
+
+    template<class T> static RowMatrix<T> getMatrixParameter(
+      const std::string& parameterName,
+      std::map<std::string, std::string>& params,
+      char separator,
+      const std::string& defaultValue,
+      const std::string& suffix = "",
+      bool suffixIsOptional = true,
+      bool warn = true)
+    {
+      RowMatrix<T> mat;
+
+      std::string s = getStringParameter(parameterName, params, defaultValue, suffix, suffixIsOptional, warn);
+      if (TextTools::isEmpty(s)) return RowMatrix<T>(0,0);
+      if (s[0] == '(' && s[s.size() - 1] == ')') {
+        //This is a delimited vector:
+        s = s.substr(1, s.size() - 2);
+        if (TextTools::isEmpty(s)) return RowMatrix<T>(0,0);
+      }
+    
+      StringTokenizer st1(s, "()");
+    
+      while (st1.hasMoreToken())
+      {
+        std::string si=st1.nextToken();
+        StringTokenizer st2(si, TextTools::toString(separator));
+        size_t n = st2.numberOfRemainingTokens();
+
+        std::vector<T> v(n);
+        for (size_t i = 0; i < n; i++)
+        {
+          v[i] = TextTools::fromString<T>(st2.nextToken());
+        }
+      
+        if (v.size()!=0)
+          mat.addRow(v);
+      }
+      return mat;
+    }
+
+
     /**
      * @name Output methods.
      *
@@ -506,7 +599,7 @@ class ApplicationTools
      * @return The number of seconds from when timer was started.
      */
     static double getTime();
-};
+  };
 
 } //end of namespace bpp.
 
diff --git a/src/Bpp/App/BppApplication.cpp b/src/Bpp/App/BppApplication.cpp
index 5d10750..dfbc988 100644
--- a/src/Bpp/App/BppApplication.cpp
+++ b/src/Bpp/App/BppApplication.cpp
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
+Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
 
 This software is a computer program whose purpose is to provide basal and 
 utilitary classes. This file belongs to the Bio++ Project.
@@ -39,6 +39,7 @@ knowledge of the CeCILL license and that you accept its terms.
 
 #include "BppApplication.h"
 #include "../Utils/AttributesTools.h"
+#include "../Numeric/Random/RandomTools.h"
 #include "ApplicationTools.h"
 
 // From the STL:
@@ -51,8 +52,14 @@ BppApplication::BppApplication(int argc, char* argv[], const std::string& name):
 {
   cout << "Parsing options:" << endl;  
   params_ = AttributesTools::parseOptions(argc, argv);
-  bool noint = ApplicationTools::getBooleanParameter("--noninteractive", params_, false, "", true, false);
+  ApplicationTools::warningLevel = ApplicationTools::getIntParameter("--warning", params_, 0, "", true, 3);
+  bool noint = ApplicationTools::getBooleanParameter("--noninteractive", params_, false, "", true, 3);
   ApplicationTools::interactive = !noint;
+  long seed = ApplicationTools::getParameter<long>("--seed", params_, -1, "", true, 3);
+  if (seed >= 0) {
+    RandomTools::setSeed(seed);
+    ApplicationTools::displayResult("Random seed set to", seed);
+  }
 }
 
 void BppApplication::startTimer()
diff --git a/src/Bpp/App/BppApplication.h b/src/Bpp/App/BppApplication.h
index 8798f17..78286f0 100644
--- a/src/Bpp/App/BppApplication.h
+++ b/src/Bpp/App/BppApplication.h
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
+Copyright or © or Copr. Development Team, (November 17, 2004)
 
 This software is a computer program whose purpose is to provide basal and 
 utilitary classes. This file belongs to the Bio++ Project.
@@ -72,6 +72,7 @@ namespace bpp
       }
       
       std::string& getParam(const std::string& name) { return params_[name]; }
+
   };
 
 } //end of namespace bpp;
diff --git a/src/Bpp/Exceptions.h b/src/Bpp/Exceptions.h
index 2ac2c53..ce62920 100644
--- a/src/Bpp/Exceptions.h
+++ b/src/Bpp/Exceptions.h
@@ -44,6 +44,7 @@ knowledge of the CeCILL license and that you accept its terms.
 
 #include <stdexcept>
 #include <vector>
+#include <string>
 
 namespace bpp
 {
diff --git a/src/Bpp/Graph/BasicONode.cpp b/src/Bpp/Graph/BasicONode.cpp
index 97e0ec9..1ab3f09 100644
--- a/src/Bpp/Graph/BasicONode.cpp
+++ b/src/Bpp/Graph/BasicONode.cpp
@@ -5,7 +5,7 @@
 // 
 
 /*
-Copyright or © or Copr. CNRS, (January 12, 2011)
+Copyright or © or Copr. Bio++ Development Team, (January 12, 2011)
 
 This software is a computer program whose purpose is to provide utilitary
 classes. This file belongs to the Bio++ Project.
@@ -41,3 +41,5 @@ knowledge of the CeCILL license and that you accept its terms.
 
 using namespace bpp;
 
+BasicONode::BasicONode() {}
+
diff --git a/src/Bpp/Graph/BasicONode.h b/src/Bpp/Graph/BasicONode.h
index 535fd6a..2cf8bfb 100644
--- a/src/Bpp/Graph/BasicONode.h
+++ b/src/Bpp/Graph/BasicONode.h
@@ -5,7 +5,7 @@
 // 
 
 /*
-Copyright or © or Copr. CNRS, (January 12, 2011)
+Copyright or © or Copr. Bio++ Development Team, (January 12, 2011)
 
 This software is a computer program whose purpose is to provide utilitary
 classes. This file belongs to the Bio++ Project.
@@ -53,6 +53,8 @@ namespace bpp {
    * @author Sylvain Gaillard
    */
   class BasicONode: public ONode {
+    public:
+      BasicONode();
   };
 }
 
diff --git a/src/Bpp/Graph/BasicTNode.cpp b/src/Bpp/Graph/BasicTNode.cpp
index 7033b40..0872f54 100644
--- a/src/Bpp/Graph/BasicTNode.cpp
+++ b/src/Bpp/Graph/BasicTNode.cpp
@@ -5,7 +5,7 @@
 // 
 
 /*
-Copyright or © or Copr. CNRS, (January 12, 2011)
+Copyright or © or Copr. Bio++ Development Team, (January 12, 2011)
 
 This software is a computer program whose purpose is to provide utilitary
 classes. This file belongs to the Bio++ Project.
@@ -41,6 +41,10 @@ knowledge of the CeCILL license and that you accept its terms.
 
 using namespace bpp;
 
+#include <cstddef>
+
+using namespace std;
+
 BasicTNode::~BasicTNode() {
   if (father_) {
     father_->removeSon(this);
@@ -65,7 +69,7 @@ BasicTNode& BasicTNode::operator=(const BasicTNode& node) {
 
 const BasicTNode* BasicTNode::getNeighbor(int pos) const {
   if (pos < 0 || pos > static_cast<int>(sons_.size())) {
-    throw IndexOutOfBoundsException("BasicTNode::getNeighbor() pos is out of bounds", pos, 0, static_cast<int>(sons_.size()));
+    throw IndexOutOfBoundsException("BasicTNode::getNeighbor() pos is out of bounds", static_cast<size_t>(pos), 0, sons_.size());
   }
   if (pos == 0)
     return father_;
@@ -75,7 +79,7 @@ const BasicTNode* BasicTNode::getNeighbor(int pos) const {
 
 BasicTNode* BasicTNode::getNeighbor(int pos) {
   if (pos < 0 || pos > static_cast<int>(sons_.size())) {
-    throw IndexOutOfBoundsException("BasicTNode::getNeighbor() pos is out of bounds", pos, 0, static_cast<int>(sons_.size()));
+    throw IndexOutOfBoundsException("BasicTNode::getNeighbor() pos is out of bounds", static_cast<size_t>(pos), 0, sons_.size());
   }
   if (pos == 0)
     return father_;
@@ -103,14 +107,14 @@ BasicTNode* BasicTNode::operator[](int i) {
 
 const BasicTNode* BasicTNode::getFather(int pos) const {
   if (pos != 0) {
-    throw IndexOutOfBoundsException("BasicTNode::getFather() pos must be 0 for TNode", pos, 0, 0);
+    throw IndexOutOfBoundsException("BasicTNode::getFather() pos must be 0 for TNode", static_cast<size_t>(pos), 0, 0);
   }
   return getFather();
 }
 
 BasicTNode* BasicTNode::getFather(int pos) {
   if (pos != 0) {
-    throw IndexOutOfBoundsException("BasicTNode::getFather() pos must be 0 for TNode", pos, 0, 0);
+    throw IndexOutOfBoundsException("BasicTNode::getFather() pos must be 0 for TNode", static_cast<size_t>(pos), 0, 0);
   }
   return getFather();
 }
@@ -154,14 +158,14 @@ BasicTNode* BasicTNode::removeFather() {
 
 const BasicTNode* BasicTNode::getSon(int pos) const {
   if (pos < 0 || pos > static_cast<int>(sons_.size()) - 1) {
-    throw IndexOutOfBoundsException("BasicTNode::getSon() pos out of range", pos, 0, sons_.size() - 1);
+    throw IndexOutOfBoundsException("BasicTNode::getSon() pos out of range", static_cast<size_t>(pos), 0, sons_.size() - 1);
   }
   return sons_[static_cast<size_t>(pos)];
 }
 
 BasicTNode* BasicTNode::getSon(int pos) {
   if (pos < 0 || pos > static_cast<int>(sons_.size()) - 1) {
-    throw IndexOutOfBoundsException("BasicTNode::getSon() pos out of range", pos, 0, sons_.size() - 1);
+    throw IndexOutOfBoundsException("BasicTNode::getSon() pos out of range", static_cast<size_t>(pos), 0, sons_.size() - 1);
   }
   return sons_[static_cast<size_t>(pos)];
 }
@@ -188,7 +192,7 @@ void BasicTNode::removeSon(BasicTNode* node) {
     throw NullPointerException("BasicTNode::removeSon() Empty node given as input.");
   for (size_t i = 0 ; i < sons_.size() ; i++) {
     if (sons_[i] == node) {
-      sons_.erase(sons_.begin() + i);
+      sons_.erase(sons_.begin() + static_cast<ptrdiff_t>(i));
       node->removeFather();
     }
   }
@@ -196,7 +200,7 @@ void BasicTNode::removeSon(BasicTNode* node) {
 
 BasicTNode* BasicTNode::removeSon(int pos) {
   if (pos < 0 || pos > static_cast<int>(sons_.size() - 1))
-    throw IndexOutOfBoundsException("BasicTNode::removeSon() pos out of bound", pos, 0, sons_.size() - 1);
+    throw IndexOutOfBoundsException("BasicTNode::removeSon() pos out of bound", static_cast<size_t>(pos), 0, sons_.size() - 1);
   BasicTNode* node = sons_[static_cast<size_t>(pos)];
   sons_.erase(sons_.begin() + pos);
   node->removeFather();
diff --git a/src/Bpp/Graphics/AbstractGraphicDevice.h b/src/Bpp/Graphics/AbstractGraphicDevice.h
index 961945f..6f2e629 100644
--- a/src/Bpp/Graphics/AbstractGraphicDevice.h
+++ b/src/Bpp/Graphics/AbstractGraphicDevice.h
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 16, 2006)
+Copyright or © or Copr. Bio++ Development Team, (November 16, 2006)
 
 This software is a computer program whose purpose is to provide utilitary
 classes. This file belongs to the Bio++ Project.
diff --git a/src/Bpp/Graphics/ColorTools.cpp b/src/Bpp/Graphics/ColorTools.cpp
index 19ef7b7..87cb73a 100644
--- a/src/Bpp/Graphics/ColorTools.cpp
+++ b/src/Bpp/Graphics/ColorTools.cpp
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
+Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
 
 This software is a computer program whose purpose is to provide utilitary
 classes. This file belongs to the Bio++ Project.
@@ -54,14 +54,29 @@ const RGBColor ColorTools::ORANGE = RGBColor(255,127,0);
 
 /******************************************************************************/
 
-std::vector<RGBColor> ColorTools::gradient(unsigned int n, const RGBColor & low, const RGBColor & high) 
+std::vector<RGBColor> ColorTools::gradient(unsigned int n, const RGBColor& low, const RGBColor& high) 
 {
   vector<RGBColor> colors(n);
-  for(unsigned int i = 0; i < n-1; i++)
+  for (unsigned int i = 0; i < n - 1; ++i)
   {
-    colors[i][0] = low[0] + (int)floor((double)i*(double)((int)high[0] - (int)low[0])/(double)(n-1));
-    colors[i][1] = low[1] + (int)floor((double)i*(double)((int)high[1] - (int)low[1])/(double)(n-1));
-    colors[i][2] = low[2] + (int)floor((double)i*(double)((int)high[2] - (int)low[2])/(double)(n-1));
+    colors[i][0] = low[0] + static_cast<unsigned int>(
+        floor(
+          static_cast<double>(i) * static_cast<double>(static_cast<int>(high[0]) - static_cast<int>(low[0]))
+          / static_cast<double>(n - 1)
+          )
+        );
+    colors[i][1] = low[1] + static_cast<unsigned int>(
+        floor(
+          static_cast<double>(i) * static_cast<double>(static_cast<int>(high[1]) - static_cast<int>(low[1]))
+          / static_cast<double>(n - 1)
+          )
+        );
+    colors[i][2] = low[2] + static_cast<unsigned int>(
+        floor(
+          static_cast<double>(i) * static_cast<double>(static_cast<int>(high[2]) - static_cast<int>(low[2]))
+          / static_cast<double>(n - 1)
+          )
+        );
   }
   colors[n-1] = high;
   return colors;
@@ -71,11 +86,11 @@ std::vector<RGBColor> ColorTools::gradient(unsigned int n, const RGBColor & low,
 
 std::vector<RGBColor> ColorTools::gradient(unsigned int n, const RGBColor & low, const RGBColor & mid, const RGBColor & high)
 {
-  unsigned int lower = n/2;
+  unsigned int lower = n / 2;
   unsigned int upper = n - lower;
   vector<RGBColor> colors1 = gradient(lower, low, mid);
-  vector<RGBColor> colors2 = gradient(upper+1, mid, high);
-  for(unsigned int i = 1; i < colors2.size(); i++)
+  vector<RGBColor> colors2 = gradient(upper + 1, mid, high);
+  for (size_t i = 1; i < colors2.size(); i++)
   {
     colors1.push_back(colors2[i]);
   }
diff --git a/src/Bpp/Graphics/Fig/XFigGraphicDevice.cpp b/src/Bpp/Graphics/Fig/XFigGraphicDevice.cpp
index c1c062c..fc0ce44 100644
--- a/src/Bpp/Graphics/Fig/XFigGraphicDevice.cpp
+++ b/src/Bpp/Graphics/Fig/XFigGraphicDevice.cpp
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
+Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
 
 This software is a computer program whose purpose is to provide utilitary
 classes. This file belongs to the Bio++ Project.
diff --git a/src/Bpp/Graphics/Fig/XFigGraphicDevice.h b/src/Bpp/Graphics/Fig/XFigGraphicDevice.h
index dd70748..de91f69 100644
--- a/src/Bpp/Graphics/Fig/XFigGraphicDevice.h
+++ b/src/Bpp/Graphics/Fig/XFigGraphicDevice.h
@@ -69,7 +69,7 @@ class XFigGraphicDevice:
     int fontCode_; 
     unsigned int fontSize_;
     unsigned int fontFlag_;
-    unsigned int lineTypeCode_;
+    short lineTypeCode_;
 
   public:
     XFigGraphicDevice(std::ostream& out):
diff --git a/src/Bpp/Graphics/RgbColor.h b/src/Bpp/Graphics/RgbColor.h
index faeac00..5e0fdfd 100644
--- a/src/Bpp/Graphics/RgbColor.h
+++ b/src/Bpp/Graphics/RgbColor.h
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
+Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
 
 This software is a computer program whose purpose is to provide utilitary
 classes. This file belongs to the Bio++ Project.
@@ -140,12 +140,12 @@ class RGBColor:
       std::string hex = "";
       while (dec > 15)
       {
-        unsigned int tmp = dec - (int)floor((double)dec/16.)*16;
+        unsigned int tmp = dec - static_cast<unsigned int>(floor(static_cast<double>(dec)/16.)*16);
         hex = hexa[tmp] + hex;
-        dec=(int)floor((double)dec/16.);
+        dec = static_cast<unsigned int>(floor(static_cast<double>(dec)/16.));
       }
       hex = hexa[dec] + hex;
-      if(hex.size() == 1) hex = "0" + hex;
+      if (hex.size() == 1) hex = "0" + hex;
       return hex;
     }
 
diff --git a/src/Bpp/Io/BppOParametrizableFormat.cpp b/src/Bpp/Io/BppOParametrizableFormat.cpp
index c5f9587..10fb470 100644
--- a/src/Bpp/Io/BppOParametrizableFormat.cpp
+++ b/src/Bpp/Io/BppOParametrizableFormat.cpp
@@ -54,22 +54,23 @@ void BppOParametrizableFormat::write(const Parametrizable* parametrizable,
                                      bool printComma) const
 {
   ParameterList pl = parametrizable->getParameters();
-  unsigned int p = out.getPrecision();
+  int p = out.getPrecision();
   out.setPrecision(12);
-  bool flag=printComma;
-  for (unsigned int i = 0; i < pl.size(); i++)
+  bool flag = printComma;
+  for (size_t i = 0; i < pl.size(); ++i)
+  {
+    if (find(writtenNames.begin(), writtenNames.end(), pl[i].getName()) == writtenNames.end())
     {
-      if (find(writtenNames.begin(),writtenNames.end(),pl[i].getName())==writtenNames.end()){
-        if (flag)
-          out << ",";
-        else
-          flag=true;
-        string pname = parametrizable->getParameterNameWithoutNamespace(pl[i].getName());
+      if (flag)
+        out << ",";
+      else
+        flag = true;
+      string pname = parametrizable->getParameterNameWithoutNamespace(pl[i].getName());
         
-        (out << pname << "=").enableScientificNotation(false) << pl[i].getValue();
+      (out << pname << "=").enableScientificNotation(false) << pl[i].getValue();
         
-      }
     }
+  }
   out.setPrecision(p);
 }
 
@@ -82,37 +83,38 @@ void BppOParametrizableFormat::write(const ParameterAliasable* parametrizable,
                                      bool printComma) const
 {
   ParameterList pl = parametrizable->getIndependentParameters().subList(names);
-  unsigned int p = out.getPrecision();
+  int p = out.getPrecision();
   out.setPrecision(12);
-  bool flag=printComma;
-  for (unsigned int i = 0; i < pl.size(); i++)
+  bool flag = printComma;
+  for (size_t i = 0; i < pl.size(); ++i)
+  {
+    if (find(writtenNames.begin(), writtenNames.end(), pl[i].getName()) == writtenNames.end())
     {
-      if (find(writtenNames.begin(),writtenNames.end(),pl[i].getName())==writtenNames.end()){
-        if (flag)
-          out << ",";
-        else
-          flag=true;
-        string pname = parametrizable->getParameterNameWithoutNamespace(pl[i].getName());
+      if (flag)
+        out << ",";
+      else
+        flag = true;
+      string pname = parametrizable->getParameterNameWithoutNamespace(pl[i].getName());
       
-        // Check for global aliases:
-        if (globalAliases.find(pl[i].getName()) == globalAliases.end())
-          {
-            (out << pname << "=").enableScientificNotation(false) << pl[i].getValue();
-          }
-        else
-          out << pname << "=" << globalAliases[pl[i].getName()];
+      // Check for global aliases:
+      if (globalAliases.find(pl[i].getName()) == globalAliases.end())
+      {
+        (out << pname << "=").enableScientificNotation(false) << pl[i].getValue();
+      }
+      else
+        out << pname << "=" << globalAliases[pl[i].getName()];
       
-        // Now check for local aliases:
-        if (printLocalAliases)
-          {
-            vector<string> aliases = parametrizable->getAlias(pname);
-            for (unsigned int j = 0; aliases.size(); j++)
-              {
-                out << ", " << aliases[j] << "=" << pname;
-              }
-          }
-        writtenNames.push_back(pl[i].getName());
+      // Now check for local aliases:
+      if (printLocalAliases)
+      {
+        vector<string> aliases = parametrizable->getAlias(pname);
+        for (size_t j = 0; j < aliases.size(); ++j)
+        {
+          out << ", " << aliases[j] << "=" << pname;
+        }
       }
+      writtenNames.push_back(pl[i].getName());
     }
+  }
   out.setPrecision(p);
 }
diff --git a/src/Bpp/Io/FileTools.cpp b/src/Bpp/Io/FileTools.cpp
index c6392f3..9dbf2f9 100644
--- a/src/Bpp/Io/FileTools.cpp
+++ b/src/Bpp/Io/FileTools.cpp
@@ -54,7 +54,7 @@ char FileTools::DIR_SEP = '/';
 bool FileTools::fileExists(const std::string& filename)
 {
   ifstream file(filename.c_str());
-  bool test = file;
+  bool test = file ? true : false; //needed for CLang.
   file.close();
   return test;
 }
@@ -64,7 +64,7 @@ bool FileTools::fileExists(const std::string& filename)
 bool FileTools::directoryExists(const std::string& path)
 {
   ifstream file(path.c_str());
-  bool test = file;
+  bool test = file ? true : false; //needed for CLang.
   file.close();
   return test;
 }
@@ -73,8 +73,8 @@ bool FileTools::directoryExists(const std::string& path)
 
 std::string FileTools::getFileName(const std::string& path, char dirSep)
 {
-  size_t end = path.find_last_of(".");
-  size_t begin = path.find_last_of(dirSep) + 1;
+  ptrdiff_t end = static_cast<ptrdiff_t>(path.find_last_of("."));
+  ptrdiff_t begin = static_cast<ptrdiff_t>(path.find_last_of(dirSep) + 1);
 
   // Return an empty string if specified string isn't a path
   if (begin > end) return "";
@@ -105,7 +105,7 @@ streampos FileTools::getFileSize(const std::string& filename)
 std::string FileTools::getParent(const std::string& path, char dirSep)
 {
   // Position of file name:
-  size_t begin = path.find_last_of(dirSep);
+  ptrdiff_t begin = static_cast<ptrdiff_t>(path.find_last_of(dirSep));
 
   // Copy string and delte filename:
   string result(path);
@@ -120,7 +120,7 @@ std::string FileTools::getParent(const std::string& path, char dirSep)
 std::string FileTools::getExtension(const std::string& path)
 {
   size_t end = path.find_last_of(".");
-  return path.substr(end+1);
+  return path.substr(end + 1);
 }
 
 /******************************************************************************/
diff --git a/src/Bpp/Io/OutputStream.h b/src/Bpp/Io/OutputStream.h
index 452bb07..5c6d363 100644
--- a/src/Bpp/Io/OutputStream.h
+++ b/src/Bpp/Io/OutputStream.h
@@ -1,5 +1,5 @@
 //
-// File: BppStream.h
+// File: OutputStream.h
 // Created by: Julien Dutheil
 // Created on: Mon Jan 25 17:41 2010
 //
@@ -37,8 +37,8 @@ The fact that you are presently reading this means that you have had
 knowledge of the CeCILL license and that you accept its terms.
 */
 
-#ifndef _BPPSTREAM_H_
-#define _BPPSTREAM_H_
+#ifndef _OUTPUTSTREAM_H_
+#define _OUTPUTSTREAM_H_
 
 #include "../Clonable.h"
 
@@ -77,8 +77,8 @@ public:
   virtual OutputStream& operator<<(const bool& message) = 0;
   virtual OutputStream& endLine() = 0;
   virtual OutputStream& flush() = 0;
-  virtual OutputStream& setPrecision(unsigned int digit) = 0;
-  virtual unsigned int getPrecision() const = 0;
+  virtual OutputStream& setPrecision(int digit) = 0;
+  virtual int getPrecision() const = 0;
   virtual OutputStream& enableScientificNotation(bool yn) = 0;
   virtual bool isScientificNotationEnabled() const = 0;
 
@@ -105,19 +105,19 @@ class AbstractOutputStream :
   public virtual OutputStream
 {
 private:
-  unsigned int precision_;
+  int precision_;
   bool scienceNotation_;
 
 public:
   AbstractOutputStream() : precision_(6), scienceNotation_(false) {}
 
 public:
-  OutputStream& setPrecision(unsigned int digit)
+  OutputStream& setPrecision(int digit)
   {
     precision_ = digit;
     return *this;
   }
-  unsigned int getPrecision() const { return precision_; }
+  int getPrecision() const { return precision_; }
 
   virtual OutputStream& enableScientificNotation(bool yn) { scienceNotation_ = yn; return *this; }
   virtual bool isScientificNotationEnabled() const { return scienceNotation_; }
@@ -350,5 +350,5 @@ public:
 
 } // end of namespace bpp;
 
-#endif //_BPPSTREAM_H_
+#endif //_OUTPUTSTREAM_H_
 
diff --git a/src/Bpp/Numeric/AbstractParameterAliasable.cpp b/src/Bpp/Numeric/AbstractParameterAliasable.cpp
index 98157bd..353cf8c 100644
--- a/src/Bpp/Numeric/AbstractParameterAliasable.cpp
+++ b/src/Bpp/Numeric/AbstractParameterAliasable.cpp
@@ -116,10 +116,12 @@ throw (ParameterNotFoundException, Exception)
 
   string id = "__alias_" + p2 + "_to_" + p1;
   string idCheck = "__alias_" + p1 + "_to_" + p2;
+
   if (aliasListenersRegister_.find(idCheck) != aliasListenersRegister_.end())
     throw Exception("AbstractParameterAliasable::aliasParameters. Trying to alias parameter " + p2 + " to " + p1 + ", but parameter " + p1 + " is already aliased to parameter " + p2 + ".");
   Parameter* param1 = &getParameter_(p1);
   Parameter* param2 = &getParameter_(p2);
+
   if (!param1->hasConstraint())
   {
     if (param2->hasConstraint())
@@ -127,19 +129,72 @@ throw (ParameterNotFoundException, Exception)
   }
   else
   // We use a small trick here, we test the constraints on the basis of their string description (C++ does not provide a default operator==() :( ).
-  if (param2->hasConstraint() && (param1->getConstraint()->getDescription() != param2->getConstraint()->getDescription()))
-    throw Exception("AbstractParameterAliasable::aliasParameters. Cannot alias parameter " + p2 + " to " + p1 + ", because the constraints attached to these two parameters are different.");
+    if (param2->hasConstraint() && (param1->getConstraint()->getDescription() != param2->getConstraint()->getDescription()))
+      throw Exception("AbstractParameterAliasable::aliasParameters. Cannot alias parameter " + p2 + " to " + p1 + ", because the constraints attached to these two parameters are different.");
 
   // Every thing seems ok, let's create the listener and register it:
-  AliasParameterListener* aliasListener = new AliasParameterListener(id, getParameters().whichParameterHasName(getNamespace() + p2), &getParameters_());
+
+  AliasParameterListener* aliasListener = new AliasParameterListener(id, getParameters().whichParameterHasName(getNamespace() + p2), &getParameters_(), p1);
+
+  ParameterList pl=getParameters_();
+  
   aliasListenersRegister_[id] = aliasListener;
+
   // Now we add it to the appropriate parameter, that is p1.
   // The parameter will not own the listener, the bookkeeping being achieved by the register:
   param1->addParameterListener(aliasListener, false);
   // Finally we remove p2 from the list of independent parameters:
   independentParameters_.deleteParameter(getNamespace() + p2);
+
+}
+
+void AbstractParameterAliasable::aliasParameters(map<string, string>& unparsedParams, bool verbose)
+{
+  ParameterList plpars, pl=getParameters();
+    
+  for (size_t i=0; i< pl.size(); i++)
+  {
+    if (unparsedParams.find(pl[i].getName())==unparsedParams.end())
+      plpars.addParameter(*pl[i].clone());
+  }
+
+  size_t unp_s=unparsedParams.size();  
+  while (unp_s!=0)
+  {
+    map<string, string>::iterator it;
+    for (it=unparsedParams.begin(); it!=unparsedParams.end(); it++)
+    {
+      Parameter* pp=0;
+      try {
+        pp=&plpars.getParameter(it->second);
+      }
+      catch (ParameterNotFoundException& e){
+        if (!pl.hasParameter(it->second))
+          throw ParameterNotFoundException("Unknown aliasing parameter", it->second);
+        continue;
+      }
+      auto_ptr<Parameter> p2(pp->clone());
+      p2->setName(it->first);
+      plpars.addParameter(p2.release());
+      plpars.getParameter(it->first);
+      aliasParameters(it->second, it->first);
+      if (verbose)
+        ApplicationTools::displayResult("Parameter alias found", it->first + " -> " + it->second + " = " + TextTools::toString(pp->getValue()));
+      unparsedParams.erase(it);
+    }
+
+    if (unparsedParams.size()==unp_s)
+      throw Exception("Error, there is a cycle in aliasing");
+    else
+      unp_s=unparsedParams.size();
+  }
+
+  matchParametersValues(plpars);
 }
 
+  
+
+
 void AbstractParameterAliasable::unaliasParameters(const std::string& p1, const std::string& p2)
 throw (ParameterNotFoundException, Exception)
 {
@@ -190,18 +245,79 @@ void AbstractParameterAliasable::setNamespace(const std::string& prefix)
 vector<string> AbstractParameterAliasable::getAlias(const string& name) const
 {
   vector<string> aliases;
+
   for (map<string, AliasParameterListener*>::const_iterator it = aliasListenersRegister_.begin();
        it != aliasListenersRegister_.end();
        it++)
   {
-    if (it->second->getName() == name)
+    if (it->second->getFrom() == name)
     {
       string alias = it->second->getAlias();
       aliases.push_back(alias);
-      vector<string> chainAliases = getAlias(alias);
-      VectorTools::append(aliases, chainAliases);
+      if (alias!=name){
+        vector<string> chainAliases = getAlias(alias);
+        VectorTools::append(aliases, chainAliases);
+      }
     }
   }
   return aliases;
 }
 
+ParameterList AbstractParameterAliasable::getAliasedParameters(const ParameterList& pl) const
+{
+  ParameterList aliases;
+  bool b=false;
+  
+  for (map<string, AliasParameterListener*>::const_iterator it = aliasListenersRegister_.begin();
+       it != aliasListenersRegister_.end();
+       it++)
+  {
+    if ((pl.hasParameter(it->second->getFrom()) ||
+         aliases.hasParameter(it->second->getFrom()))
+        && ! (aliases.hasParameter(it->second->getAlias()) ||
+              pl.hasParameter(it->second->getAlias())))
+    {
+      b=true;
+      aliases.addParameter(getParameter(it->second->getAlias()));
+    }
+  }
+  
+  while (b)
+  {
+    b=false;
+    
+    for (map<string, AliasParameterListener*>::const_iterator it = aliasListenersRegister_.begin();
+         it != aliasListenersRegister_.end();
+         it++)
+    {
+      if (aliases.hasParameter(it->second->getFrom())
+          && ! (aliases.hasParameter(it->second->getAlias()) ||
+                pl.hasParameter(it->second->getAlias())))
+      {
+        b=true;
+        aliases.addParameter(getParameter(it->second->getAlias()));
+      }
+    }
+  }
+  
+  return aliases;
+}
+
+string AbstractParameterAliasable::getFrom(const string& name) const
+{
+  string from="";
+  
+  for (map<string, AliasParameterListener*>::const_iterator it = aliasListenersRegister_.begin();
+       it != aliasListenersRegister_.end();
+       it++)
+    {
+      if (it->second->getName() == name)
+        {
+          from = it->second->getFrom();
+          break;
+        }
+    }
+
+  return from;
+}
+
diff --git a/src/Bpp/Numeric/AbstractParameterAliasable.h b/src/Bpp/Numeric/AbstractParameterAliasable.h
index 623161a..1fc4157 100644
--- a/src/Bpp/Numeric/AbstractParameterAliasable.h
+++ b/src/Bpp/Numeric/AbstractParameterAliasable.h
@@ -5,36 +5,36 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 19, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for numerical calculus.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. Bio++ Development Team, (November 19, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for numerical calculus.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _ABSTRACTPARAMETERALIASABLE_H_
@@ -55,61 +55,67 @@ namespace bpp
   class AliasParameterListener:
     public ParameterListener
   {
-    private:
-      std::string id_;
-      size_t alias_;
-      ParameterList *pl_;
-      std::string name_;
-
-    public:
-      AliasParameterListener(const std::string& id, size_t alias, ParameterList* pl):
-        id_(id),
-        alias_(alias),
-        pl_(pl),
-        name_()
-      {
-        //This allow us to check if the parameter position have changed at some point...
-        name_ = (*pl_)[alias].getName();
-      }
-
-      AliasParameterListener(const AliasParameterListener& apl):
-        id_(apl.id_),
-        alias_(apl.alias_),
-        pl_(apl.pl_),
-        name_(apl.name_)
-      {}
-
-      AliasParameterListener& operator=(const AliasParameterListener& apl)
-      {
-        id_    = apl.id_;
-        alias_ = apl.alias_;
-        pl_    = apl.pl_;
-        name_  = apl.name_;
-        return *this;
-      }
-
-      AliasParameterListener* clone() const { return new AliasParameterListener(*this); }
-
-    public:
-      const std::string& getId() const { return id_; }
-
-      void setParameterList(ParameterList* pl) { pl_ = pl; }
+  private:
+    std::string id_;
+    size_t alias_;
+    ParameterList *pl_;
+    std::string name_;
+    std::string from_;
+
+  public:
+    AliasParameterListener(const std::string& id, size_t alias, ParameterList* pl, const std::string& from):
+      id_(id),
+      alias_(alias),
+      pl_(pl),
+      name_(),
+      from_(from)
+    {
+      //This allow us to check if the parameter position have changed at some point...
+      name_ = (*pl_)[alias].getName();
+    }
+
+    AliasParameterListener(const AliasParameterListener& apl):
+    id_(apl.id_),
+    alias_(apl.alias_),
+    pl_(apl.pl_),
+    name_(apl.name_),
+    from_(apl.from_)
+    {}
+
+    AliasParameterListener& operator=(const AliasParameterListener& apl)
+    {
+      id_    = apl.id_;
+      alias_ = apl.alias_;
+      pl_    = apl.pl_;
+      name_  = apl.name_;
+      from_  = apl.from_;
+      return *this;
+    }
+
+    AliasParameterListener* clone() const { return new AliasParameterListener(*this); }
+
+  public:
+    const std::string& getId() const { return id_; }
+
+    const std::string& getFrom() const { return from_; }
+    
+    void setParameterList(ParameterList* pl) { pl_ = pl; }
 
-      void parameterNameChanged(ParameterEvent& event) throw (Exception) {}
+    void parameterNameChanged(ParameterEvent& event) throw (Exception) {}
     
-      void parameterValueChanged(ParameterEvent& event) throw (Exception)
-      {
-        Parameter* p = &(*pl_)[alias_];
-        if (p->getName() != name_)
-          throw Exception("AbstractParameterAliasable::AliasParameterListener::parameterValueChanged. Error, aliased parameter have change, maybe because it was renamed, or a parameter was removed?");
-        p->setValue(event.getParameter()->getValue());
-      }
+    void parameterValueChanged(ParameterEvent& event) throw (Exception)
+    {
+      Parameter* p = &(*pl_)[alias_];
+      if (p->getName() != name_)
+        throw Exception("AbstractParameterAliasable::AliasParameterListener::parameterValueChanged. Error, aliased parameter have change, maybe because it was renamed, or a parameter was removed?");
+      p->setValue(event.getParameter()->getValue());
+    }
 
-      const std::string& getName() const { return name_; }
+    const std::string& getName() const { return name_; }
 
-      void rename(const std::string& name) { name_ = name; }
+    void rename(const std::string& name) { name_ = name; }
 
-      const std::string& getAlias() const { return (*pl_)[alias_].getName(); }
+    const std::string& getAlias() const { return (*pl_)[alias_].getName(); }
       
   };
 
@@ -127,78 +133,124 @@ namespace bpp
     public AbstractParametrizable,
     public virtual ParameterAliasable
   {
-    private:
+  private:
 
-      mutable ParameterList independentParameters_;
+    mutable ParameterList independentParameters_;
 
-      /**
-       * Contains all parameter listeners for maintening alias relationships.
-       * The registry will be updated appropriately upon cloning and deleting.
-       */
-      std::map<std::string, AliasParameterListener *> aliasListenersRegister_;
+    /**
+     * Contains all parameter listeners for maintening alias relationships.
+     * The registry will be updated appropriately upon cloning and deleting.
+     */
+    std::map<std::string, AliasParameterListener *> aliasListenersRegister_;
   
-    public:
-      AbstractParameterAliasable(const std::string& prefix) :
-        AbstractParametrizable(prefix),
-        independentParameters_(),
-        aliasListenersRegister_()
-      {}
-
-      AbstractParameterAliasable(const AbstractParameterAliasable& ap);
+  public:
+    AbstractParameterAliasable(const std::string& prefix) :
+      AbstractParametrizable(prefix),
+      independentParameters_(),
+      aliasListenersRegister_()
+    {}
+
+    AbstractParameterAliasable(const AbstractParameterAliasable& ap);
     
-      AbstractParameterAliasable& operator=(const AbstractParameterAliasable& ap);
+    AbstractParameterAliasable& operator=(const AbstractParameterAliasable& ap);
 
-      virtual ~AbstractParameterAliasable();
+    virtual ~AbstractParameterAliasable();
 
-    public:
-      void setNamespace(const std::string& prefix);
+  public:
+    void setNamespace(const std::string& prefix);
  
-      const ParameterList& getIndependentParameters() const { return independentParameters_; }
+    const ParameterList& getIndependentParameters() const { return independentParameters_; }
     
-      size_t getNumberOfIndependentParameters() const { return independentParameters_.size(); }
+    size_t getNumberOfIndependentParameters() const { return independentParameters_.size(); }
 
-      void aliasParameters(const std::string& p1, const std::string& p2) throw (ParameterNotFoundException, Exception);
+    void aliasParameters(const std::string& p1, const std::string& p2) throw (ParameterNotFoundException, Exception);
 
-      void unaliasParameters(const std::string& p1, const std::string& p2) throw (ParameterNotFoundException, Exception);
+    void unaliasParameters(const std::string& p1, const std::string& p2) throw (ParameterNotFoundException, Exception);
 
-      /**
-       * @return The list of names of the parameters that are aliased with a given parameter.
-       * The implementation is recursive, which means that in the case of A->B->C, getalias(C) will return both A and B.
-       * @param name The name of the parameter to look for.
-       */
-      std::vector<std::string> getAlias(const std::string& name) const;
+    /**
+     * @brief alias the parameters following the links described in a
+     * map, and update the object accordingly. Cycles in aliasing are
+     * detected and forbidden.
+     *
+     * @param unparsedParams the map of the links : <A,B> matches for A->B aliasing.
+     * @param verbose verbosity
+     *
+     **/
+    
+    void aliasParameters(std::map<std::string, std::string>& unparsedParams, bool verbose);
 
-      void fireParameterChanged(const ParameterList& parameters)
-      {
-        independentParameters_.matchParametersValues(getParameters());
-      }
+    /**
+     * @brief Return the list of the names of the parameters that are
+     * aliased (directly or not) to one of the parameters of the list.
+     *
+     */
+    
+    ParameterList getAliasedParameters(const ParameterList& pl) const;
+    
+    
+    /**
+     * @return The list of names of the parameters that are aliased with a given parameter.
+     * The implementation is recursive, which means that in the case of A->B->C, getalias(C) will return both A and B.
+     * @param name The name of the parameter to look for.
+     */
+    
+    std::vector<std::string> getAlias(const std::string& name) const;
 
-    protected:
-      void addParameter_(Parameter* parameter)
-      {
-        AbstractParametrizable::addParameter_(parameter);
-        independentParameters_.addParameter(parameter->clone());
-      }
+    /**
+     * @return The name of the parameter from which a given parameter is aliased.
+     * @param name The name of the parameter to look for.
+     */
 
-      void addParameters_(const ParameterList& parameters)
-      {
-        AbstractParametrizable::addParameters_(parameters);
-        independentParameters_.addParameters(parameters);
-      }
+    std::string getFrom(const std::string& name) const;
+      
+    void fireParameterChanged(const ParameterList& parameters)
+    {
+      independentParameters_.matchParametersValues(getParameters());
+    }
+
+  protected:
+    void addParameter_(Parameter* parameter)
+    {
+      AbstractParametrizable::addParameter_(parameter);
+      independentParameters_.addParameter(parameter->clone());
+    }
+
+    void addParameters_(const ParameterList& parameters)
+    {
+      AbstractParametrizable::addParameters_(parameters);
+      independentParameters_.addParameters(parameters);
+    }
+
+    void deleteParameter_(size_t index) throw (IndexOutOfBoundsException)
+    {
+      std::string name = getParameter_(index).getName();
+      AbstractParametrizable::deleteParameter_(index);
+      if (independentParameters_.hasParameter(name))
+        independentParameters_.deleteParameter(name);
+    }
 
-      void deleteParameter_(size_t index) throw (IndexOutOfBoundsException)
-      {
-        std::string name = getParameter_(index).getName();
-        AbstractParametrizable::deleteParameter_(index);
-        if (independentParameters_.hasParameter(name))
+    void deleteParameter_(std::string& name) throw (IndexOutOfBoundsException)
+    {
+      AbstractParametrizable::deleteParameter_(name);
+      if (independentParameters_.hasParameter(name))
         independentParameters_.deleteParameter(name);
-      }
+    }
 
-      void resetParameters_()
+    void deleteParameters_(const std::vector<std::string>& names)
+    {
+      std::string x;
+      for (size_t i=0; i<names.size(); i++)
       {
-        AbstractParametrizable::resetParameters_();
-        independentParameters_.reset();
+        x=names[i];
+        deleteParameter_(x);
       }
+    }
+
+    void resetParameters_()
+    {
+      AbstractParametrizable::resetParameters_();
+      independentParameters_.reset();
+    }
 
   };
 
diff --git a/src/Bpp/Numeric/AbstractParametrizable.h b/src/Bpp/Numeric/AbstractParametrizable.h
index ba52630..a023d83 100644
--- a/src/Bpp/Numeric/AbstractParametrizable.h
+++ b/src/Bpp/Numeric/AbstractParametrizable.h
@@ -111,9 +111,10 @@ class AbstractParametrizable:
     bool matchParametersValues(const ParameterList& parameters)
       throw (ConstraintException)
     {
-      bool test = parameters_.matchParametersValues(parameters);
+      std::auto_ptr< std::vector<size_t> >updatedParameters(new std::vector<size_t>());
+      bool test = parameters_.matchParametersValues(parameters, updatedParameters.get());
       if (test) 
-        fireParameterChanged(parameters);
+        fireParameterChanged(parameters.subList(*updatedParameters));
       return test;
     }
 
@@ -144,13 +145,23 @@ class AbstractParametrizable:
       parameters_.addParameters(parameters);
     }
 
-    void deleteParameter_(size_t index) throw (IndexOutOfBoundsException)
+  void deleteParameter_(size_t index) throw (IndexOutOfBoundsException)
     {
       if (index >= parameters_.size())
         throw IndexOutOfBoundsException("AbstractParametrizable::deleteParameter_.", index, 0, parameters_.size() - 1);
       parameters_.deleteParameter(index);
     }
 
+  void deleteParameter_(std::string& name)
+  {
+    parameters_.deleteParameter(name);
+  }
+
+  void deleteParameters_(const std::vector<std::string>& names)
+  {
+     parameters_.deleteParameters(names);
+  }
+
     void resetParameters_()
     {
       parameters_.reset();
diff --git a/src/Bpp/Numeric/AdaptiveKernelDensityEstimation.cpp b/src/Bpp/Numeric/AdaptiveKernelDensityEstimation.cpp
index c3fde70..86608e1 100644
--- a/src/Bpp/Numeric/AdaptiveKernelDensityEstimation.cpp
+++ b/src/Bpp/Numeric/AdaptiveKernelDensityEstimation.cpp
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
+Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
 
 This software is a computer program whose purpose is to provide classes
 for numerical calculus. This file is part of the Bio++ project.
diff --git a/src/Bpp/Numeric/Constraints.h b/src/Bpp/Numeric/Constraints.h
index 187ec4c..0202cbe 100644
--- a/src/Bpp/Numeric/Constraints.h
+++ b/src/Bpp/Numeric/Constraints.h
@@ -43,10 +43,12 @@
 // From the STL:
 #include <string>
 #include <iostream>
+#include <typeinfo>
 
 // From Utils:
 #include "../Clonable.h"
 #include "../Text/TextTools.h"
+#include "../Exceptions.h"
 
 #include "NumConstants.h"
 
@@ -115,6 +117,12 @@ public:
    * @return the intersection
    */
   virtual Constraint* operator&(const Constraint& c) const = 0;
+
+  /**
+   * @brief Tells if this constraints defines an empty set
+   */
+  
+  virtual bool isEmpty() const = 0;
 };
 
 /**
@@ -170,13 +178,30 @@ public:
    * @param incl Tell if the finite bound is included or not.
    * @param precision Parameter precision.
    */
+
   IntervalConstraint(bool isPositive, double bound, bool incl, double precision = NumConstants::TINY()) :
     lowerBound_(isPositive ? bound : NumConstants::MINF()),
     upperBound_(isPositive ? NumConstants::PINF() : bound),
     inclLowerBound_(isPositive ? incl : false),
     inclUpperBound_(isPositive ? false : incl),
     precision_(precision) {}
- 
+
+  /**
+   * @brief Create an interval from a string description, using
+   * readDescription method.
+   *
+   **/
+
+  IntervalConstraint(std::string& desc) :
+    lowerBound_(NumConstants::MINF()),
+    upperBound_(NumConstants::PINF()),
+    inclLowerBound_(true),
+    inclUpperBound_(true),
+    precision_(NumConstants::TINY())
+  {
+    readDescription(desc);
+  }
+  
   virtual ~IntervalConstraint() {}
 
   IntervalConstraint* clone() const { return new IntervalConstraint(*this); }
@@ -249,12 +274,41 @@ public:
   {
     return (inclLowerBound_ ? "[ " : "]")
            + (finiteLowerBound() ? TextTools::toString(lowerBound_) : "-inf")
-           + ", "
+           + "; "
            + (finiteUpperBound() ? TextTools::toString(upperBound_) : "+inf")
            + (inclUpperBound_ ? "] " : "[");
   }
 
   /**
+   *
+   * @brief Sets the bounds of the interval from a string.
+   *
+   * @param desc the description in interval-like syntax, with signs
+   * "[", ";", "]" as well as floats and "-inf" and "inf".
+   *
+   **/
+  
+  void readDescription(std::string& desc)
+  {
+    size_t pdp=desc.find(";");
+    size_t dc=desc.find_first_of("[]",1);
+
+    if (dc==std::string::npos || pdp==std::string::npos ||
+        (desc[0]!=']' && desc[0]!='[') || (pdp >=dc))
+      throw Exception("Constraints::readDescription. Wrong description:" + desc);
+
+    std::string deb=desc.substr(1,pdp-1);
+    std::string fin=desc.substr(pdp+1, dc-pdp-1);
+
+    inclLowerBound_=(desc[0]=='[');
+    inclUpperBound_=(desc[dc]==']');
+
+    lowerBound_ =  (deb=="-inf")?NumConstants::MINF():TextTools::toDouble(deb);
+    upperBound_ =  ((fin=="+inf") || (fin=="inf"))?NumConstants::PINF():TextTools::toDouble(fin);
+    
+  }
+  
+  /**
    * @brief Intersect this IntervalConstraint with another one
    *
    * @param c the intersected IntervalConstraint
@@ -298,43 +352,31 @@ public:
   }
 
   /**
-   * @brief Intersect this IntervalConstraint with another one
+   * @brief Intersect this IntervalConstraint with another constraint
    *
-   * @param c the intersected IntervalConstraint
+   * @param c the intersected constraint
    * @return this IntervalConstraint modified, or not modified if c is not an
    * IntervalConstraint. The precision is set to the maximum of bith precisions.
    */
-  
   IntervalConstraint& operator&=(const Constraint& c)
   {
-    const IntervalConstraint* pi = dynamic_cast<const IntervalConstraint*>(&c);
+    try {
+      const IntervalConstraint& pi = dynamic_cast<const IntervalConstraint&>(c);
 
-    if (pi)
-    {
-      if (lowerBound_ <= pi->lowerBound_)
-      {
-        lowerBound_ = pi->lowerBound_;
-        inclLowerBound_ = pi->inclLowerBound_;
-      }
-      else
+      if (lowerBound_ <= pi.lowerBound_)
       {
-        lowerBound_ = lowerBound_;
-        inclLowerBound_ = inclLowerBound_;
+        lowerBound_ = pi.lowerBound_;
+        inclLowerBound_ = pi.inclLowerBound_;
       }
 
-      if (upperBound_ >= pi->upperBound_)
-      {
-        upperBound_ = pi->upperBound_;
-        inclUpperBound_ = pi->inclUpperBound_;
-      }
-      else
+      if (upperBound_ >= pi.upperBound_)
       {
-        upperBound_ = upperBound_;
-        inclUpperBound_ = inclUpperBound_;
+        upperBound_ = pi.upperBound_;
+        inclUpperBound_ = pi.inclUpperBound_;
       }
-      if (pi->getPrecision()>precision_)
-        precision_=pi->getPrecision();
-    }
+      if (pi.getPrecision() > precision_)
+        precision_ = pi.getPrecision();
+    } catch(std::bad_cast&) {}
 
     return *this;
   }
@@ -375,6 +417,18 @@ public:
     return lowerBound_ >= i.lowerBound_
            && upperBound_ <= i.upperBound_;
   }
+
+  /**
+   * @brief Tells if this interval is empty 
+   */
+  
+  bool isEmpty() const
+  {
+    return ((lowerBound_ > upperBound_) ||
+            ((lowerBound_ > upperBound_) &&
+             inclUpperBound_ && inclLowerBound_));
+  }
+
 };
 
 
diff --git a/src/Bpp/Numeric/DataTable.cpp b/src/Bpp/Numeric/DataTable.cpp
index 7c0d8a8..5049655 100644
--- a/src/Bpp/Numeric/DataTable.cpp
+++ b/src/Bpp/Numeric/DataTable.cpp
@@ -5,37 +5,37 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for numerical calculus.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide classes
+   for numerical calculus.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 #include "DataTable.h"
 #include "VectorTools.h"
@@ -49,42 +49,65 @@ using namespace std;
 /******************************************************************************/
 
 DataTable::DataTable(size_t nRow, size_t nCol) :
-  nRow_(nRow), nCol_(nCol), data_(nCol), rowNames_(0), colNames_(0)
+  nRow_(nRow),
+  nCol_(nCol),
+  data_(nCol),
+  rowNames_(0),
+  colNames_(0)
 {
-  for(size_t i = 0; i < nCol; i++)
+  for (size_t i = 0; i < nCol; i++)
+  {
     data_[i].resize(nRow);
+  }
 }
-  
+
 DataTable::DataTable(size_t nCol) :
-  nRow_(0), nCol_(nCol), data_(nCol), rowNames_(0), colNames_(0)
-{
-}
-  
+  nRow_(0),
+  nCol_(nCol),
+  data_(nCol),
+  rowNames_(0),
+  colNames_(0)
+{}
+
 DataTable::DataTable(const std::vector<std::string>& colNames) throw (DuplicatedTableColumnNameException) :
-  nRow_(0), nCol_(colNames.size()), data_(colNames.size()), rowNames_(0), colNames_(0)
+  nRow_(0),
+  nCol_(colNames.size()),
+  data_(colNames.size()),
+  rowNames_(0),
+  colNames_(0)
 
 {
-  setColumnNames(colNames); //May throw an exception.  
+  setColumnNames(colNames); // May throw an exception.
 }
-  
+
 DataTable::DataTable(const DataTable& table) :
-  nRow_(table.nRow_), nCol_(table.nCol_), data_(table.data_), rowNames_(0), colNames_(0)
+  nRow_(table.nRow_),
+  nCol_(table.nCol_),
+  data_(table.data_),
+  rowNames_(0),
+  colNames_(0)
 {
-  if(table.rowNames_) rowNames_ = new vector<string>(*table.rowNames_);
-  if(table.colNames_) colNames_ = new vector<string>(*table.colNames_);
+  if (table.rowNames_)
+    rowNames_ = new vector<string>(*table.rowNames_);
+  if (table.colNames_)
+    colNames_ = new vector<string>(*table.colNames_);
 }
 
-DataTable& DataTable::operator=(const DataTable & table)
+DataTable& DataTable::operator=(const DataTable& table)
 {
   nRow_ = table.nRow_;
   nCol_ = table.nCol_;
   data_ = table.data_;
-  if(rowNames_) delete rowNames_;
-  if(colNames_) delete colNames_;
+  if (rowNames_)
+    delete rowNames_;
+  if (colNames_)
+    delete colNames_;
   rowNames_ = 0;
   colNames_ = 0;
-  if(table.rowNames_) rowNames_ = new vector<string>(*table.rowNames_);
-  if(table.colNames_) colNames_ = new vector<string>(*table.colNames_);
+  if (table.rowNames_)
+    rowNames_ = new vector<string>(*table.rowNames_);
+  if (table.colNames_)
+    colNames_ = new vector<string>(*table.colNames_);
   return *this;
 }
 
@@ -92,93 +115,107 @@ DataTable& DataTable::operator=(const DataTable & table)
 
 DataTable::~DataTable()
 {
-  if(rowNames_ != NULL) delete rowNames_;
-  if(colNames_ != NULL) delete colNames_;
+  if (rowNames_ != NULL)
+    delete rowNames_;
+  if (colNames_ != NULL)
+    delete colNames_;
 }
 
 /******************************************************************************/
 /*                             Cell access                                    */
 /******************************************************************************/
 
-string & DataTable::operator()(size_t rowIndex, size_t colIndex) throw (IndexOutOfBoundsException)
+string& DataTable::operator()(size_t rowIndex, size_t colIndex) throw (IndexOutOfBoundsException)
 {
-  if(colIndex >= nCol_) throw IndexOutOfBoundsException("DataTable::operator(size_t, size_t).", colIndex, 0, nCol_ - 1);
-  if(rowIndex >= data_[colIndex].size()) throw IndexOutOfBoundsException("DataTable::operator(size_t, size_t).", rowIndex, 0, data_[colIndex].size() - 1);
+  if (colIndex >= nCol_)
+    throw IndexOutOfBoundsException("DataTable::operator(size_t, size_t).", colIndex, 0, nCol_ - 1);
+  if (rowIndex >= data_[colIndex].size())
+    throw IndexOutOfBoundsException("DataTable::operator(size_t, size_t).", rowIndex, 0, data_[colIndex].size() - 1);
   return data_[colIndex][rowIndex];
 }
 
-const string & DataTable::operator()(size_t rowIndex, size_t colIndex) const throw (IndexOutOfBoundsException)
+const string& DataTable::operator()(size_t rowIndex, size_t colIndex) const throw (IndexOutOfBoundsException)
 {
-  if(colIndex >= nCol_) throw IndexOutOfBoundsException("DataTable::operator(size_t, size_t).", colIndex, 0, nCol_ - 1);
-  if(rowIndex >= data_[colIndex].size()) throw IndexOutOfBoundsException("DataTable::operator(size_t, size_t).", rowIndex, 0, data_[colIndex].size() - 1);
+  if (colIndex >= nCol_)
+    throw IndexOutOfBoundsException("DataTable::operator(size_t, size_t).", colIndex, 0, nCol_ - 1);
+  if (rowIndex >= data_[colIndex].size())
+    throw IndexOutOfBoundsException("DataTable::operator(size_t, size_t).", rowIndex, 0, data_[colIndex].size() - 1);
   return data_[colIndex][rowIndex];
 }
 
 /******************************************************************************/
 
-string & DataTable::operator()(const string & rowName, const string & colName)
+string& DataTable::operator()(const string& rowName, const string& colName)
 throw (NoTableRowNamesException, NoTableColumnNamesException, TableNameNotFoundException)
 {
-  if(rowNames_ == NULL) throw NoTableRowNamesException("DataTable::operator(const string &, const string &).");
-  if(colNames_ == NULL) throw NoTableColumnNamesException("DataTable::operator(const string &, const string &).");
+  if (rowNames_ == NULL)
+    throw NoTableRowNamesException("DataTable::operator(const string &, const string &).");
+  if (colNames_ == NULL)
+    throw NoTableColumnNamesException("DataTable::operator(const string &, const string &).");
   try
   {
     size_t rowIndex = VectorTools::which(*rowNames_, rowName);
     size_t colIndex = VectorTools::which(*colNames_, colName);
     return (*this)(rowIndex, colIndex);
   }
-  catch(ElementNotFoundException<string> & ex)
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableNameNotFoundException("DataTable::operator(const string &, const string &).", *ex.getElement());
   }
 }
 
-const string & DataTable::operator()(const string & rowName, const string & colName) const
+const string& DataTable::operator()(const string& rowName, const string& colName) const
 throw (NoTableRowNamesException, NoTableColumnNamesException, TableNameNotFoundException)
 {
-  if(rowNames_ == NULL) throw NoTableRowNamesException("DataTable::operator(const string &, const string &).");
-  if(colNames_ == NULL) throw NoTableColumnNamesException("DataTable::operator(const string &, const string &).");
+  if (rowNames_ == NULL)
+    throw NoTableRowNamesException("DataTable::operator(const string &, const string &).");
+  if (colNames_ == NULL)
+    throw NoTableColumnNamesException("DataTable::operator(const string &, const string &).");
   try
   {
     size_t rowIndex = VectorTools::which(*rowNames_, rowName);
     size_t colIndex = VectorTools::which(*colNames_, colName);
     return (*this)(rowIndex, colIndex);
   }
-  catch(ElementNotFoundException<string> & ex) 
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableNameNotFoundException("DataTable::operator(const string &, const string &).", *ex.getElement());
   }
 }
-    
+
 /******************************************************************************/
 
-string & DataTable::operator()(const string & rowName, size_t colIndex)
+string& DataTable::operator()(const string& rowName, size_t colIndex)
 throw (NoTableRowNamesException, TableNameNotFoundException, IndexOutOfBoundsException)
 {
-  if(rowNames_ == NULL) throw NoTableRowNamesException("DataTable::operator(const string &, size_t).");
-  if(colIndex >= nCol_) throw IndexOutOfBoundsException("DataTable::operator(const string &, size_t).", colIndex, 0, nCol_ - 1);
+  if (rowNames_ == NULL)
+    throw NoTableRowNamesException("DataTable::operator(const string &, size_t).");
+  if (colIndex >= nCol_)
+    throw IndexOutOfBoundsException("DataTable::operator(const string &, size_t).", colIndex, 0, nCol_ - 1);
   try
   {
     size_t rowIndex = VectorTools::which(*rowNames_, rowName);
     return (*this)(rowIndex, colIndex);
   }
-  catch(ElementNotFoundException<string> & ex)
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableNameNotFoundException("DataTable::operator(const string &, size_t).", *ex.getElement());
   }
 }
 
-const string & DataTable::operator()(const string & rowName, size_t colIndex) const
+const string& DataTable::operator()(const string& rowName, size_t colIndex) const
 throw (NoTableRowNamesException, TableNameNotFoundException, IndexOutOfBoundsException)
 {
-  if(rowNames_ == NULL) throw NoTableRowNamesException("DataTable::operator(const string &, size_t).");
-  if(colIndex >= nCol_) throw IndexOutOfBoundsException("DataTable::operator(const string &, size_t).", colIndex, 0, nCol_ - 1);
+  if (rowNames_ == NULL)
+    throw NoTableRowNamesException("DataTable::operator(const string &, size_t).");
+  if (colIndex >= nCol_)
+    throw IndexOutOfBoundsException("DataTable::operator(const string &, size_t).", colIndex, 0, nCol_ - 1);
   try
   {
     size_t rowIndex = VectorTools::which(*rowNames_, rowName);
     return (*this)(rowIndex, colIndex);
   }
-  catch(ElementNotFoundException<string> & ex)
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableNameNotFoundException("DataTable::operator(const string &, size_t).", *ex.getElement());
   }
@@ -186,33 +223,37 @@ throw (NoTableRowNamesException, TableNameNotFoundException, IndexOutOfBoundsExc
 
 /******************************************************************************/
 
-string & DataTable::operator()(size_t rowIndex, const string & colName)
+string& DataTable::operator()(size_t rowIndex, const string& colName)
 throw (IndexOutOfBoundsException, NoTableColumnNamesException, TableNameNotFoundException)
 {
-  if(colNames_ == NULL) throw NoTableColumnNamesException("DataTable::operator(size_t, const string &).");
+  if (colNames_ == NULL)
+    throw NoTableColumnNamesException("DataTable::operator(size_t, const string &).");
   try
   {
     size_t colIndex = VectorTools::which(*colNames_, colName);
-    if(rowIndex >= data_[colIndex].size()) throw IndexOutOfBoundsException("DataTable::operator(size_t, const string &).", rowIndex, 0, data_[colIndex].size() - 1);
+    if (rowIndex >= data_[colIndex].size())
+      throw IndexOutOfBoundsException("DataTable::operator(size_t, const string &).", rowIndex, 0, data_[colIndex].size() - 1);
     return (*this)(rowIndex, colIndex);
   }
-  catch(ElementNotFoundException<string> & ex)
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableNameNotFoundException("DataTable::operator(const string &, const string &).", *ex.getElement());
   }
 }
 
-const string & DataTable::operator()(size_t rowIndex, const string & colName) const
+const string& DataTable::operator()(size_t rowIndex, const string& colName) const
 throw (IndexOutOfBoundsException, NoTableColumnNamesException, TableNameNotFoundException)
 {
-  if(colNames_ == NULL) throw NoTableColumnNamesException("DataTable::operator(size_t, const string &).");
+  if (colNames_ == NULL)
+    throw NoTableColumnNamesException("DataTable::operator(size_t, const string &).");
   try
   {
     size_t colIndex = VectorTools::which(*colNames_, colName);
-    if(rowIndex >= data_[colIndex].size()) throw IndexOutOfBoundsException("DataTable::operator(size_t, const string &).", rowIndex, 0, data_[colIndex].size() - 1);
+    if (rowIndex >= data_[colIndex].size())
+      throw IndexOutOfBoundsException("DataTable::operator(size_t, const string &).", rowIndex, 0, data_[colIndex].size() - 1);
     return (*this)(rowIndex, colIndex);
   }
-  catch(ElementNotFoundException<string> & ex)
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableNameNotFoundException("DataTable::operator(const string &, const string &).", *ex.getElement());
   }
@@ -222,145 +263,167 @@ throw (IndexOutOfBoundsException, NoTableColumnNamesException, TableNameNotFound
 /*                             Work with names                                */
 /******************************************************************************/
 
-void DataTable::setRowNames(const vector<string> & rowNames)
+void DataTable::setRowNames(const vector<string>& rowNames)
 throw (DimensionException, DuplicatedTableRowNameException)
 {
   if (!VectorTools::isUnique(rowNames))
   {
     throw DuplicatedTableRowNameException("DataTable::setRowNames(...). Row names must be unique.");
   }
-  if (rowNames.size() != nRow_) throw DimensionException("DataTable::setRowNames.", rowNames.size(), nRow_);
+  if (rowNames.size() != nRow_)
+    throw DimensionException("DataTable::setRowNames.", rowNames.size(), nRow_);
   else
   {
-    if(rowNames_ != NULL) delete rowNames_;
+    if (rowNames_ != NULL)
+      delete rowNames_;
     rowNames_ = new vector<string>(rowNames.begin(), rowNames.end());
   }
 }
 
 vector<string> DataTable::getRowNames() const throw (NoTableRowNamesException)
 {
-  if(rowNames_ == NULL) throw NoTableRowNamesException("DataTable::getRowNames().");
-  return * rowNames_;
+  if (rowNames_ == NULL)
+    throw NoTableRowNamesException("DataTable::getRowNames().");
+  return *rowNames_;
 }
 
 string DataTable::getRowName(size_t index) const throw (NoTableRowNamesException, IndexOutOfBoundsException)
 {
-  if(rowNames_ == NULL) throw NoTableRowNamesException("DataTable::getRowName(size_t).");
-  if(index >= nRow_)    throw IndexOutOfBoundsException("DataTable::getRowName(size_t).", index, 0, nRow_ - 1);
-  return (* rowNames_)[index];
+  if (rowNames_ == NULL)
+    throw NoTableRowNamesException("DataTable::getRowName(size_t).");
+  if (index >= nRow_)
+    throw IndexOutOfBoundsException("DataTable::getRowName(size_t).", index, 0, nRow_ - 1);
+  return (*rowNames_)[index];
 }
 
 /******************************************************************************/
 
-void DataTable::setColumnNames(const vector<string> & colNames)
+void DataTable::setColumnNames(const vector<string>& colNames)
 throw (DimensionException, DuplicatedTableColumnNameException)
 {
-  if(!VectorTools::isUnique(colNames)) throw DuplicatedTableColumnNameException("DataTable::setColumnNames(...). Column names must be unique.");
-  if(colNames.size() != nCol_) throw DimensionException("DataTable::setColumnNames.", colNames.size(), nCol_);
+  if (!VectorTools::isUnique(colNames))
+    throw DuplicatedTableColumnNameException("DataTable::setColumnNames(...). Column names must be unique.");
+  if (colNames.size() != nCol_)
+    throw DimensionException("DataTable::setColumnNames.", colNames.size(), nCol_);
   else
   {
-    if(colNames_ != NULL) delete colNames_;
+    if (colNames_ != NULL)
+      delete colNames_;
     colNames_ = new vector<string>(colNames.begin(), colNames.end());
   }
 }
 
 vector<string> DataTable::getColumnNames() const throw (NoTableColumnNamesException)
 {
-  if(colNames_ == NULL) throw NoTableColumnNamesException("DataTable::getColumnNames().");
+  if (colNames_ == NULL)
+    throw NoTableColumnNamesException("DataTable::getColumnNames().");
   return *colNames_;
 }
 
 string DataTable::getColumnName(size_t index) const throw (NoTableColumnNamesException, IndexOutOfBoundsException)
 {
-  if(colNames_ == NULL) throw NoTableColumnNamesException("DataTable::getColumnName(size_t).");
-  if(index >= nCol_)    throw IndexOutOfBoundsException("DataTable::getColumnName(size_t).", index, 0, nCol_ - 1);
-  return (* colNames_)[index];
+  if (colNames_ == NULL)
+    throw NoTableColumnNamesException("DataTable::getColumnName(size_t).");
+  if (index >= nCol_)
+    throw IndexOutOfBoundsException("DataTable::getColumnName(size_t).", index, 0, nCol_ - 1);
+  return (*colNames_)[index];
 }
 
 /******************************************************************************/
 /*                               Work on columns                              */
 /******************************************************************************/
 
-vector<string> & DataTable::getColumn(size_t index)
-  throw (IndexOutOfBoundsException)
+vector<string>& DataTable::getColumn(size_t index)
+throw (IndexOutOfBoundsException)
 {
-  if(index >= nCol_) throw IndexOutOfBoundsException("DataTable::getColumn(size_t).", index, 0, nCol_ - 1);
+  if (index >= nCol_)
+    throw IndexOutOfBoundsException("DataTable::getColumn(size_t).", index, 0, nCol_ - 1);
   return data_[index];
 }
 
-const vector<string> & DataTable::getColumn(size_t index) const
-  throw (IndexOutOfBoundsException)
+const vector<string>& DataTable::getColumn(size_t index) const
+throw (IndexOutOfBoundsException)
 {
-  if(index >= nCol_) throw IndexOutOfBoundsException("DataTable::getColumn(size_t).", index, 0, nCol_ - 1);
+  if (index >= nCol_)
+    throw IndexOutOfBoundsException("DataTable::getColumn(size_t).", index, 0, nCol_ - 1);
   return data_[index];
-}  
+}
 
-vector<string> & DataTable::getColumn(const string & colName)
-  throw (NoTableColumnNamesException, TableColumnNameNotFoundException)
+vector<string>& DataTable::getColumn(const string& colName)
+throw (NoTableColumnNamesException, TableColumnNameNotFoundException)
 {
-  if(colNames_ == NULL) throw NoTableColumnNamesException("DataTable::getColumn(const string &).");
+  if (colNames_ == NULL)
+    throw NoTableColumnNamesException("DataTable::getColumn(const string &).");
   try
   {
     size_t colIndex = VectorTools::which(*colNames_, colName);
     return data_[colIndex];
   }
-  catch(ElementNotFoundException<string> & ex)
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableColumnNameNotFoundException("DataTable::getColumn(const string &).", colName);
   }
 }
 
-const vector<string> & DataTable::getColumn(const string & colName) const
-  throw (NoTableColumnNamesException, TableColumnNameNotFoundException)
+const vector<string>& DataTable::getColumn(const string& colName) const
+throw (NoTableColumnNamesException, TableColumnNameNotFoundException)
 {
-  if(colNames_ == NULL) throw NoTableColumnNamesException("DataTable::getColumn(const string &).");
+  if (colNames_ == NULL)
+    throw NoTableColumnNamesException("DataTable::getColumn(const string &).");
   try
   {
     size_t colIndex = VectorTools::which(*colNames_, colName);
     return data_[colIndex];
   }
-  catch(ElementNotFoundException<string> & ex)
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableColumnNameNotFoundException("DataTable::getColumn(const string &).", colName);
   }
 }
 
-bool DataTable::hasColumn(const string & colName) const
-{ 
-  if(colNames_ == NULL) return false;
-  for(size_t i = 0; i < colNames_->size(); i++)
-    if((* colNames_)[i] == colName) return true;
+bool DataTable::hasColumn(const string& colName) const
+{
+  if (colNames_ == NULL)
+    return false;
+  for (size_t i = 0; i < colNames_->size(); i++)
+  {
+    if ((*colNames_)[i] == colName)
+      return true;
+  }
   return false;
 }
 
 void DataTable::deleteColumn(size_t index)
-  throw (IndexOutOfBoundsException)
+throw (IndexOutOfBoundsException)
 {
-  if(index >= nCol_) throw IndexOutOfBoundsException("DataTable::deleteColumn(size_t).", index, 0, nCol_ - 1);
-  data_.erase(data_.begin() + index);
-  if(colNames_ != NULL) colNames_->erase(colNames_->begin()+index);
+  if (index >= nCol_)
+    throw IndexOutOfBoundsException("DataTable::deleteColumn(size_t).", index, 0, nCol_ - 1);
+  data_.erase(data_.begin() + static_cast<ptrdiff_t>(index));
+  if (colNames_)
+    colNames_->erase(colNames_->begin() + static_cast<ptrdiff_t>(index));
   nCol_--;
 }
 
-void DataTable::deleteColumn(const string & colName)
-  throw (NoTableColumnNamesException, TableColumnNameNotFoundException)
+void DataTable::deleteColumn(const string& colName)
+throw (NoTableColumnNamesException, TableColumnNameNotFoundException)
 {
-  if(colNames_ == NULL) throw NoTableColumnNamesException("DataTable::deleteColumn(const string &).");
+  if (!colNames_)
+    throw NoTableColumnNamesException("DataTable::deleteColumn(const string &).");
   try
   {
     size_t colIndex = VectorTools::which(*colNames_, colName);
-    data_.erase(data_.begin() + colIndex);
-    colNames_->erase(colNames_->begin() + colIndex);
+    data_.erase(data_.begin() + static_cast<ptrdiff_t>(colIndex));
+    colNames_->erase(colNames_->begin() + static_cast<ptrdiff_t>(colIndex));
     nCol_--;
   }
-  catch(ElementNotFoundException<string> & ex)
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableColumnNameNotFoundException("DataTable::deleteColumn(const string &).", colName);
   }
 }
 
 void DataTable::addColumn(const vector<string>& newColumn)
-  throw (DimensionException, TableColumnNamesException)
+throw (DimensionException, TableColumnNamesException)
 {
   if (colNames_)
     throw TableColumnNamesException("DataTable::addColumn. Table has column names.");
@@ -371,12 +434,14 @@ void DataTable::addColumn(const vector<string>& newColumn)
 }
 
 void DataTable::addColumn(const string& colName, const vector<string>& newColumn)
-  throw (DimensionException, NoTableColumnNamesException, DuplicatedTableColumnNameException)
+throw (DimensionException, NoTableColumnNamesException, DuplicatedTableColumnNameException)
 {
-  if(!colNames_)
+  if (!colNames_)
   {
-    if (nCol_ == 0) colNames_ = new vector<string>();
-    else throw NoTableColumnNamesException("DataTable::addColumn. Table has column names.");
+    if (nCol_ == 0)
+      colNames_ = new vector<string>();
+    else
+      throw NoTableColumnNamesException("DataTable::addColumn. Table has column names.");
   }
   if (newColumn.size() != nRow_)
     throw DimensionException("DataTable::addColumn.", newColumn.size(), nRow_);
@@ -392,101 +457,121 @@ void DataTable::addColumn(const string& colName, const vector<string>& newColumn
 /******************************************************************************/
 
 vector<string> DataTable::getRow(size_t index) const
-  throw (IndexOutOfBoundsException)
+throw (IndexOutOfBoundsException)
 {
-  if(index >= nRow_) throw IndexOutOfBoundsException("DataTable::getRow(size_t).", index, 0, nRow_ - 1);
+  if (index >= nRow_)
+    throw IndexOutOfBoundsException("DataTable::getRow(size_t).", index, 0, nRow_ - 1);
   vector<string> row;
-  for (size_t i = 0 ; i < nCol_ ; i++)
+  for (size_t i = 0; i < nCol_; i++)
+  {
     row.push_back(data_[i][index]);
+  }
   return row;
 }
 
 vector<string> DataTable::getRow(const string& rowName) const
-  throw (NoTableRowNamesException, TableRowNameNotFoundException)
+throw (NoTableRowNamesException, TableRowNameNotFoundException)
 {
-  if (!rowNames_) throw NoTableRowNamesException("DataTable::getRow(const string &).");
+  if (!rowNames_)
+    throw NoTableRowNamesException("DataTable::getRow(const string &).");
   try
   {
     size_t rowIndex = VectorTools::which(*rowNames_, rowName);
     vector<string> row;
-    for (size_t i = 0 ; i < nCol_ ; i++)
+    for (size_t i = 0; i < nCol_; i++)
+    {
       row.push_back(data_[i][rowIndex]);
+    }
     return row;
   }
-  catch(ElementNotFoundException<string> & ex)
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableRowNameNotFoundException("DataTable::getRow(const string &).", rowName);
   }
 }
 
-bool DataTable::hasRow(const string & rowName) const
-{ 
-  if(rowNames_ == NULL) return false;
-  for(size_t i = 0; i < rowNames_->size(); i++)
+bool DataTable::hasRow(const string& rowName) const
+{
+  if (rowNames_ == NULL)
+    return false;
+  for (size_t i = 0; i < rowNames_->size(); i++)
   {
-    if((* rowNames_)[i] == rowName) return true;
+    if ((*rowNames_)[i] == rowName)
+      return true;
   }
   return false;
 }
 
 void DataTable::deleteRow(size_t index)
-  throw (IndexOutOfBoundsException)
+throw (IndexOutOfBoundsException)
 {
-  for(size_t j = 0; j < nCol_; j++)
+  for (size_t j = 0; j < nCol_; j++)
   {
-    vector<string> * column = & data_[j];
-    if(index >= column->size()) throw IndexOutOfBoundsException("DataTable::deleteRow(size_t).", index, 0, column->size() - 1);
-    column->erase(column->begin()+index);
+    vector<string>* column = &data_[j];
+    if (index >= column->size())
+      throw IndexOutOfBoundsException("DataTable::deleteRow(size_t).", index, 0, column->size() - 1);
+    column->erase(column->begin() + static_cast<ptrdiff_t>(index));
   }
-  if(rowNames_ != NULL) rowNames_->erase(rowNames_->begin()+index);
+  if (rowNames_)
+    rowNames_->erase(rowNames_->begin() + static_cast<ptrdiff_t>(index));
   nRow_--;
 }
 
 void DataTable::deleteRow(const string& rowName)
-  throw (NoTableRowNamesException, TableRowNameNotFoundException)
+throw (NoTableRowNamesException, TableRowNameNotFoundException)
 {
-  if(rowNames_ == NULL) throw NoTableRowNamesException("DataTable::deleteRow(const string &).");
+  if (!rowNames_)
+    throw NoTableRowNamesException("DataTable::deleteRow(const string &).");
   try
   {
     size_t rowIndex = VectorTools::which(*rowNames_, rowName);
-    for(size_t j = 0; j < nCol_; j++)
+    for (size_t j = 0; j < nCol_; j++)
     {
-      vector<string> * column = & data_[j];
-      column->erase(column->begin()+rowIndex);
+      vector<string>* column = &data_[j];
+      column->erase(column->begin() + static_cast<ptrdiff_t>(rowIndex));
     }
-    rowNames_->erase(rowNames_->begin()+rowIndex);
+    rowNames_->erase(rowNames_->begin() + static_cast<ptrdiff_t>(rowIndex));
     nRow_--;
   }
-  catch(ElementNotFoundException<string> & ex)
+  catch (ElementNotFoundException<string>& ex)
   {
     throw TableRowNameNotFoundException("DataTable::deleteRow(const string &).", rowName);
   }
 }
 
 void DataTable::addRow(const vector<string>& newRow)
-  throw (DimensionException, TableRowNamesException)
+throw (DimensionException, TableRowNamesException)
 {
-  if (rowNames_) throw TableRowNamesException("DataTable::addRow. Table has row names.");
-  if (newRow.size() != nCol_) throw DimensionException("DataTable::addRow.", newRow.size(), nCol_);
+  if (rowNames_)
+    throw TableRowNamesException("DataTable::addRow. Table has row names.");
+  if (newRow.size() != nCol_)
+    throw DimensionException("DataTable::addRow.", newRow.size(), nCol_);
   for (size_t j = 0; j < nCol_; j++)
+  {
     data_[j].push_back(newRow[j]);
+  }
   nRow_++;
 }
 
 void DataTable::addRow(const string& rowName, const vector<string>& newRow)
-  throw (DimensionException, NoTableRowNamesException, DuplicatedTableRowNameException)
+throw (DimensionException, NoTableRowNamesException, DuplicatedTableRowNameException)
 {
   if (!rowNames_)
   {
-    if (nRow_ == 0) rowNames_ = new vector<string>();
-    else throw NoTableRowNamesException("DataTable::addRow. Table has row names.");
+    if (nRow_ == 0)
+      rowNames_ = new vector<string>();
+    else
+      throw NoTableRowNamesException("DataTable::addRow. Table has row names.");
   }
-  if (newRow.size() != nCol_) throw DimensionException("DataTable::addRow.", newRow.size(), nCol_);
+  if (newRow.size() != nCol_)
+    throw DimensionException("DataTable::addRow.", newRow.size(), nCol_);
   if (nRow_ > 0 && find(rowNames_->begin(), rowNames_->end(), rowName) != rowNames_->end())
     throw DuplicatedTableRowNameException("DataTable::addRow(const string &, const vector<string> &). Row names must be unique.");
   rowNames_->push_back(rowName);
   for (size_t j = 0; j < nCol_; j++)
+  {
     data_[j].push_back(newRow[j]);
+  }
   nRow_++;
 }
 
@@ -495,7 +580,7 @@ void DataTable::addRow(const string& rowName, const vector<string>& newRow)
 /******************************************************************************/
 
 DataTable* DataTable::read(istream& in, const string& sep, bool header, int rowNames)
-  throw (DimensionException, IndexOutOfBoundsException, DuplicatedTableRowNameException)
+throw (DimensionException, IndexOutOfBoundsException, DuplicatedTableRowNameException)
 {
   string firstLine  = FileTools::getNextLine(in);
   StringTokenizer st1(firstLine, sep, false, true);
@@ -505,12 +590,12 @@ DataTable* DataTable::read(istream& in, const string& sep, bool header, int rowN
   vector<string> row2(st2.getTokens().begin(), st2.getTokens().end());
   size_t nCol = row1.size();
   bool hasRowNames;
-  DataTable * dt;
-  if(row1.size() == row2.size())
+  DataTable* dt;
+  if (row1.size() == row2.size())
   {
     dt = new DataTable(nCol);
-    if(header)
-    { //Use first line as header.
+    if (header)
+    { // Use first line as header.
       dt->setColumnNames(row1);
     }
     else
@@ -520,25 +605,26 @@ DataTable* DataTable::read(istream& in, const string& sep, bool header, int rowN
     dt->addRow(row2);
     hasRowNames = false;
   }
-  else if(row1.size() == row2.size() - 1)
+  else if (row1.size() == row2.size() - 1)
   {
     dt = new DataTable(nCol);
     dt->setColumnNames(row1);
     string rowName = *row2.begin();
-    dt->addRow(rowName, vector<string>(row2.begin()+1, row2.end()));
+    dt->addRow(rowName, vector<string>(row2.begin() + 1, row2.end()));
     hasRowNames = true;
   }
-  else throw DimensionException("DataTable::read(...). Row 2 has not the correct number of columns.", row2.size(), nCol);
+  else
+    throw DimensionException("DataTable::read(...). Row 2 has not the correct number of columns.", row2.size(), nCol);
 
   // Now read each line:
   string line = FileTools::getNextLine(in);
-  while(!TextTools::isEmpty(line))
+  while (!TextTools::isEmpty(line))
   {
     StringTokenizer st(line, sep, false, true);
-    if(hasRowNames)
+    if (hasRowNames)
     {
       string rowName = *st.getTokens().begin();
-      vector<string> row(st.getTokens().begin()+1, st.getTokens().end());
+      vector<string> row(st.getTokens().begin() + 1, st.getTokens().end());
       dt->addRow(rowName, row);
     }
     else
@@ -550,15 +636,16 @@ DataTable* DataTable::read(istream& in, const string& sep, bool header, int rowN
   }
 
   // Row names:
-  if(rowNames > -1)
+  if (rowNames > -1)
   {
-    if((size_t)rowNames >= nCol) throw IndexOutOfBoundsException("DataTable::read(...). Invalid column specified for row names.", rowNames, 0, nCol-1);
-    vector<string> col = dt->getColumn((size_t)rowNames);
+    if (static_cast<size_t>(rowNames) >= nCol)
+      throw IndexOutOfBoundsException("DataTable::read(...). Invalid column specified for row names.", static_cast<size_t>(rowNames), 0, nCol - 1);
+    vector<string> col = dt->getColumn(static_cast<size_t>(rowNames));
     dt->setRowNames(col);
-    dt->deleteColumn(rowNames);
+    dt->deleteColumn(static_cast<size_t>(rowNames));
   }
-  
-  return(dt);
+
+  return dt;
 }
 
 /******************************************************************************/
@@ -566,23 +653,27 @@ DataTable* DataTable::read(istream& in, const string& sep, bool header, int rowN
 void DataTable::write(const DataTable& data, ostream& out, const string& sep, bool alignHeaders)
 {
   size_t n = data.getNumberOfColumns();
-  if(n == 0) return;
-  if(data.hasColumnNames())
-  { //Write header
+  if (n == 0)
+    return;
+  if (data.hasColumnNames())
+  { // Write header
     vector<string> colNames = data.getColumnNames();
-    if (alignHeaders && data.hasRowNames()) out << sep;
+    if (alignHeaders && data.hasRowNames())
+      out << sep;
     out << colNames[0];
-    for(size_t i = 1; i < n; i++) {
+    for (size_t i = 1; i < n; i++)
+    {
       out << sep << colNames[i];
     }
     out << endl;
   }
-  //Now write each row:
-  for(size_t i = 0; i < data.getNumberOfRows(); i++)
+  // Now write each row:
+  for (size_t i = 0; i < data.getNumberOfRows(); i++)
   {
-    if(data.hasRowNames()) out << data.getRowName(i) << sep;
+    if (data.hasRowNames())
+      out << data.getRowName(i) << sep;
     out << data(i, 0);
-    for(size_t j = 1; j < n; j++)
+    for (size_t j = 1; j < n; j++)
     {
       out << sep << data(i, j);
     }
@@ -590,5 +681,36 @@ void DataTable::write(const DataTable& data, ostream& out, const string& sep, bo
   }
 }
 
+void DataTable::write(const DataTable& data, bpp::OutputStream& out, const string& sep, bool alignHeaders)
+{
+  size_t n = data.getNumberOfColumns();
+  if (n == 0)
+    return;
+  if (data.hasColumnNames())
+  { // Write header
+    vector<string> colNames = data.getColumnNames();
+    if (alignHeaders && data.hasRowNames())
+      out << sep;
+    out << colNames[0];
+    for (size_t i = 1; i < n; i++)
+    {
+      out << sep << colNames[i];
+    }
+    out.endLine();
+  }
+  // Now write each row:
+  for (size_t i = 0; i < data.getNumberOfRows(); i++)
+  {
+    if (data.hasRowNames())
+      out << data.getRowName(i) << sep;
+    out << data(i, 0);
+    for (size_t j = 1; j < n; j++)
+    {
+      out << sep << data(i, j);
+    }
+    out.endLine();
+  }
+}
+
 /******************************************************************************/
 
diff --git a/src/Bpp/Numeric/DataTable.h b/src/Bpp/Numeric/DataTable.h
index b720ccf..b9f55c8 100644
--- a/src/Bpp/Numeric/DataTable.h
+++ b/src/Bpp/Numeric/DataTable.h
@@ -5,37 +5,37 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for numerical calculus.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide classes
+   for numerical calculus.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 #ifndef _DataTable_H_
 #define _DataTable_H_
@@ -48,12 +48,11 @@ knowledge of the CeCILL license and that you accept its terms.
 
 // From the STL:
 #include <string>
-#include<vector>
+#include <vector>
 #include <map>
 
 namespace bpp
 {
-
 /**
  * @brief This class corresponds to a 'dataset', <i>i.e.</i> a table with data by rows
  * and variable by columns.
@@ -62,382 +61,378 @@ namespace bpp
  * A DataTable object is hence similar to a ColMatrix<string>.object.
  * (NB: actually, ColMatrix does not exist yet...)
  */
-class DataTable:
+class DataTable :
   public Clonable
 {
-  
-  protected:
-    size_t nRow_, nCol_;
-    std::vector< std::vector<std::string> > data_;
-    std::vector<std::string>* rowNames_;
-    std::vector<std::string>* colNames_;
-
-  public:
-    
-    /**
-     * @brief Build a new void DataTable object with nRow rows and nCol columns.
-     *
-     * @param nRow The number of rows of the DataTable.
-     * @param nCol The number of columns of the DataTable.
-     */
-    DataTable(size_t nRow, size_t nCol);
-    
-    /**
-     * @brief Build a new void DataTable object with nCol columns.
-     *
-     * @param nCol The number of columns of the DataTable.
-     */
-    DataTable(size_t nCol);
-
-    /**
-     * @brief Build a new void DataTable object with named columns.
-     *
-     * @param colNames The names of the columns of the DataTable.
-     * @throw DuplicatedTableColumnNameException If colnames contains identical names.
-     */
-    DataTable(const std::vector<std::string>& colNames) throw (DuplicatedTableColumnNameException);
-
-    DataTable(const DataTable& table);
-
-    DataTable& operator=(const DataTable& table);
-
-    DataTable* clone() const { return new DataTable(*this); }
-
-    virtual ~DataTable();
-
-  public:
-
-    /**
-     * @return The element at a given position.
-     * @param rowIndex Row number.
-     * @param colIndex Column number.
-     * @throw IndexOutOfBoundsException If one of the index is greater or equal to the corresponding number of columns/rows. 
-     */
-    std::string& operator()(size_t rowIndex, size_t colIndex) throw (IndexOutOfBoundsException);
-    
-    /**
-     * @return The element at a given position.
-     * @param rowIndex Row number.
-     * @param colIndex Column number.
-     * @throw IndexOutOfBoundsException If one of the index is greater or equal to the corresponding number of columns/rows. 
-     */
-    const std::string& operator()(size_t rowIndex, size_t colIndex) const throw (IndexOutOfBoundsException);
-    
-    /**
-     * @return The element at a given position.
-     * @param rowName Row name.
-     * @param colName Column name.
-     * @throw NoTableRowNamesException If the table does not have names associated to rows. 
-     * @throw NoTableColumnNamesException If the table does not have names associated to columns. 
-     * @throw TableNameNotFoundException If one of rowName or colName do not match existing names. 
-     */
-    std::string& operator()(const std::string& rowName, const std::string& colName)
-            throw (NoTableRowNamesException, NoTableColumnNamesException, TableNameNotFoundException);
-    
-    /**
-     * @return The element at a given position.
-     * @param rowName Row name.
-     * @param colName Column name.
-     * @throw NoTableRowNamesException If the table does not have names associated to rows. 
-     * @throw NoTableColumnNamesException If the table does not have names associated to columns. 
-     * @throw TableNameNotFoundException If one of rowName or colName do not match existing names. 
-     */
-    const std::string& operator()(const std::string& rowName, const std::string& colName) const
-            throw (NoTableRowNamesException, NoTableColumnNamesException, TableNameNotFoundException);
-    
-    /**
-     * @return The element at a given position.
-     * @param rowName Row name.
-     * @param colIndex Column number.
-     * @throw NoTableRowNamesException If the table does not have names associated to rows. 
-     * @throw IndexOutOfBoundsException If the index is greater or equal to the number of columns. 
-     * @throw TableNameNotFoundException If rowName do not match existing names. 
-     */
-    std::string& operator()(const std::string& rowName, size_t colIndex)
-            throw (NoTableRowNamesException, TableNameNotFoundException, IndexOutOfBoundsException);
-    
-    /**
-     * @return The element at a given position.
-     * @param rowName Row name.
-     * @param colIndex Column number.
-     * @throw NoTableRowNamesException If the table does not have names associated to rows. 
-     * @throw IndexOutOfBoundsException If the index is greater or equal to the number of columns. 
-     * @throw TableNameNotFoundException If rowName do not match existing names. 
-     */
-    const std::string& operator()(const std::string& rowName, size_t colIndex) const
-            throw (NoTableRowNamesException, TableNameNotFoundException, IndexOutOfBoundsException);
-
-    /**
-     * @return The element at a given position.
-     * @param rowIndex Row number.
-     * @param colName Column name.
-     * @throw IndexOutOfBoundsException If the index is greater or equal to the number of rows. 
-     * @throw NoTableColumnNamesException If the table does not have names associated to columns. 
-     * @throw TableNameNotFoundException If colName do not match existing names. 
-     */
-    std::string& operator()(size_t rowIndex, const std::string& colName)
-            throw (IndexOutOfBoundsException, NoTableColumnNamesException, TableNameNotFoundException);
-    
-    /**
-     * @return The element at a given position.
-     * @param rowIndex Row number.
-     * @param colName Column name.
-     * @throw IndexOutOfBoundsException If the index is greater or equal to the number of rows. 
-     * @throw NoTableColumnNamesException If the table does not have names associated to columns. 
-     * @throw TableNameNotFoundException If colName do not match existing names. 
-     */
-    const std::string& operator()(size_t rowIndex, const std::string& colName) const
-            throw (IndexOutOfBoundsException, NoTableColumnNamesException, TableNameNotFoundException);
-    
-    /**
-     * @name Work on columns.
-     *
-     * @{
-     */
-
-    /**
-     * @return The number of columns in this table.
-     */
-    size_t getNumberOfColumns() const { return nCol_; }
-
-    /**
-     * @brief Set the column names of this table.
-     * 
-     * @param colNames The row names.
-     * @throw DimensionException If the number of names do not match the number of columns in the table.
-     * @throw DuplicatedTableColumnNameException If names are not unique.
-     */
-    void setColumnNames(const std::vector<std::string>& colNames) throw (DimensionException, DuplicatedTableColumnNameException);
-    /**
-     * @brief Get the column names of this table.
-     * 
-     * @return The column names of this table.
-     * @throw NoTableColumnNamesException If no column names are associated to this table.
-     */
-    std::vector<std::string> getColumnNames() const throw (NoTableColumnNamesException);
-    /**
-     * @brief Get a given column name.
-     * 
-     * @param index The index of the column.
-     * @return The column name associated to the given column.
-     * @throw NoTableColumnNamesException If no column names are associated to this table.
-     * @throw IndexOutOfBoundsException If index is >= number of columns.
-     */
-    std::string getColumnName(size_t index) const throw (NoTableColumnNamesException, IndexOutOfBoundsException);
-    
-    /**
-     * @return true If column names are associated to this table.
-     */
-    bool hasColumnNames() const { return colNames_!= 0; }
-
-    /**
-     * @return The values in the given column.
-     * @param index The index of the column.
-     * @throw IndexOutOfBoundsException If index is >= number of columns.
-     */
-    std::vector<std::string>& getColumn(size_t index) throw (IndexOutOfBoundsException);
-    /**
-     * @return The values in the given column.
-     * @param index The index of the column.
-     * @throw IndexOutOfBoundsException If index is >= number of columns.
-     */
-    const std::vector<std::string>& getColumn(size_t index) const throw (IndexOutOfBoundsException);
-    
-    /**
-     * @return The values in the given column.
-     * @param colName The name of the column.
-     * @throw NoTableColumnNamesException If no column names are associated to this table.
-     * @throw TableColumnNameNotFoundException If colName do not match existing column names. 
-     */
-    std::vector<std::string>& getColumn(const std::string& colName) throw (NoTableColumnNamesException, TableColumnNameNotFoundException);
-    /**
-     * @return The values in the given column.
-     * @param colName The name of the column.
-     * @throw NoTableColumnNamesException If no column names are associated to this table.
-     * @throw TableColumnNameNotFoundException If colName do not match existing column names. 
-     */
-    const std::vector<std::string>& getColumn(const std::string& colName) const throw (NoTableColumnNamesException, TableColumnNameNotFoundException);
-
-    /**
-     * @brief Tell is a given column exists.
-     *
-     * @param colName The name of the column to look for.
-     * @return true if the column was found, false if not or if there are no column names.
-     */
-    bool hasColumn(const std::string& colName) const;
-
-    /**
-     * @brief Delete the given column.
-     * 
-     * @param index The index of the column.
-     * @throw IndexOutOfBoundsException If index is >= number of columns.
-     */
-    void deleteColumn(size_t index) throw (IndexOutOfBoundsException);
-    
-    /**
-     * @brief Delete the given column.
-     * 
-     * @param colName The name of the column.
-     * @throw NoTableColumnNamesException If no column names are associated to this table.
-     * @throw TableColumnNameNotFoundException If colName do not match existing column names. 
-     */
-    void deleteColumn(const std::string& colName) throw (NoTableColumnNamesException, TableColumnNameNotFoundException);
-  
-    /**
-     * @brief Add a new column.
-     *
-     * @param newColumn The new column values.
-     * @throw DimensionException If the number of values does not match the number of rows.
-     * @throw TableColumnNamesException If the table has row names.
-     */
-    void addColumn(const std::vector<std::string>& newColumn) throw (DimensionException, TableColumnNamesException);
-    /**
-     * @brief Add a new column.
-     *
-     * @param colName   The name of the column.
-     * @param newColumn The new column values.
-     * @throw DimensionException If the number of values does not match the number of rows.
-     * @throw NoTableColumnNamesException If the table does not have row names.
-     * @throw DuplicatedTableColumnNameException If colName is already used.
-     */
-    void addColumn(const std::string& colName, const std::vector<std::string>& newColumn) throw (DimensionException, NoTableColumnNamesException, DuplicatedTableColumnNameException);
-    /** @} */
-    
-    /**
-     * @name Work on rows.
-     *
-     * @{
-     */
-    
-    /**
-     * @return The number of rows in this table.
-     */
-    size_t getNumberOfRows() const { return nRow_; }
-
-    /**
-     * @brief Set the row names of this table.
-     * 
-     * @param rowNames The row names.
-     * @throw DimensionException If the number of names do not match the number of rows in the table.
-     * @throw DuplicatedTableRowNameException If names are not unique.
-     */
-    void setRowNames(const std::vector<std::string>& rowNames) throw (DimensionException, DuplicatedTableRowNameException);
-
-    /**
-     * @brief Get the row names of this table.
-     * 
-     * @return The row names of this table.
-     * @throw NoTableRowNamesException If no row names are associated to this table.
-     */
-    std::vector<std::string> getRowNames() const throw (NoTableRowNamesException);
-
-    /**
-     * @brief Tell is a given row exists.
-     *
-     * @param rowName The name of the row to look for.
-     * @return true if the row was found, false if not or if there are no row names.
-     */
-    bool hasRow(const std::string& rowName) const;
-
-    /**
-     * @brief Get a given row name.
-     * 
-     * @param index The index of the row.
-     * @return The row name associated to the given row.
-     * @throw NoTableRowNamesException If no row names are associated to this table.
-     * @throw IndexOutOfBoundsException If index is >= number of rows.
-     */
-    std::string getRowName(size_t index) const throw (NoTableRowNamesException, IndexOutOfBoundsException);
-
-    /**
-     * @return true If row names are associated to this table.
-     */
-    bool hasRowNames() const { return rowNames_!= 0; }
-
-    /**
-     * @return A vector which contains a copy  in the given row.
-     * @param index The index of the row.
-     * @throw IndexOutOfBoundsException If index is >= number of rows.
-     */
-    std::vector<std::string> getRow(size_t index) const throw (IndexOutOfBoundsException);
-
-    /**
-     * @return A vector which contains a copy  in the given row.
-     * @param rowName The name of the row.
-     * @throw NoTableRowNamesException If no row names are associated to this table.
-     * @throw TableRowNameNotFoundException If rowName do not match existing row names.
-     */
-    std::vector<std::string> getRow(const std::string& rowName) const throw (NoTableRowNamesException, TableRowNameNotFoundException);
-
-    /**
-     * @brief Delete the given row.
-     * 
-     * @param index The index of the row.
-     * @throw IndexOutOfBoundsException If index is >= number of row.
-     */
-    void deleteRow(size_t index) throw (IndexOutOfBoundsException);
-
-    /**
-     * @brief Delete the given row.
-     * 
-     * @param rowName The name of the row.
-     * @throw NoTableRowNamesException If no row names are associated to this table.
-     * @throw TableRowNameNotFoundException If rowName do not match existing column names. 
-     */
-    void deleteRow(const std::string& rowName) throw (NoTableRowNamesException, TableRowNameNotFoundException);
-    
-    /**
-     * @brief Add a new row.
-     *
-     * @param newRow The new row values.
-     * @throw DimensionException If the number of values does not match the number of columns.
-     * @throw TableRowNamesException If the table has column names.
-     */
-    void addRow(const std::vector<std::string>& newRow) throw (DimensionException, TableRowNamesException);
-    /**
-     * @brief Add a new row.
-     *
-     * @param rowName   The name of the row.
-     * @param newRow    The new row values.
-     * @throw DimensionException If the number of values does not match the number of columns.
-     * @throw NoTableRowNamesException If the table does not have column names.
-     * @throw DuplicatedTableRowNameException If rowName is already used.
-     */
-    void addRow(const std::string& rowName, const std::vector<std::string>& newRow) throw (DimensionException, NoTableRowNamesException, DuplicatedTableRowNameException);
-    /** @} */
-
-  public:
-
-    /**
-     * @brief Read a table form a stream in CSV-like format.
-     *
-     * The number of rows is given by the second line in the file.
-     * By default, if the first line as one column less than the second one,
-     * the first line is taken as column names, and the first column as row names.
-     * Otherwise, no column names and no row names are specified, unless
-     * explicitely precised by the user.
-     * 
-     * @param in       The input stream.
-     * @param sep      The column delimiter.
-     * @param header   Tell if the first line must be used as column names, otherwise use default.
-     * @param rowNames Use a column as rowNames. If positive, use the specified column to compute rownames, otherwise use default;
-     * @return         A pointer toward a new DataTable object.
-     */
-    static DataTable* read(std::istream& in, const std::string& sep = "\t", bool header = true, int rowNames = -1)
-      throw (DimensionException, IndexOutOfBoundsException, DuplicatedTableRowNameException);
-
-    /**
-     * @brief Write a DataTable object to stream in CVS-like format.
-     * 
-     * @param data         The table to write.
-     * @param out          The output stream.
-     * @param sep          The column delimiter.
-     * @param alignHeaders If true, add a delimiter before the first column header if there is row names.
-     */
-    static void write(const DataTable& data, std::ostream& out, const std::string& sep = "\t", bool alignHeaders = false);
+protected:
+  size_t nRow_, nCol_;
+  std::vector< std::vector<std::string> > data_;
+  std::vector<std::string>* rowNames_;
+  std::vector<std::string>* colNames_;
+
+public:
+  /**
+   * @brief Build a new void DataTable object with nRow rows and nCol columns.
+   *
+   * @param nRow The number of rows of the DataTable.
+   * @param nCol The number of columns of the DataTable.
+   */
+  DataTable(size_t nRow, size_t nCol);
+
+  /**
+   * @brief Build a new void DataTable object with nCol columns.
+   *
+   * @param nCol The number of columns of the DataTable.
+   */
+  DataTable(size_t nCol);
+
+  /**
+   * @brief Build a new void DataTable object with named columns.
+   *
+   * @param colNames The names of the columns of the DataTable.
+   * @throw DuplicatedTableColumnNameException If colnames contains identical names.
+   */
+  DataTable(const std::vector<std::string>& colNames) throw (DuplicatedTableColumnNameException);
+
+  DataTable(const DataTable& table);
+
+  DataTable& operator=(const DataTable& table);
+
+  DataTable* clone() const { return new DataTable(*this); }
+
+  virtual ~DataTable();
+
+public:
+  /**
+   * @return The element at a given position.
+   * @param rowIndex Row number.
+   * @param colIndex Column number.
+   * @throw IndexOutOfBoundsException If one of the index is greater or equal to the corresponding number of columns/rows.
+   */
+  std::string& operator()(size_t rowIndex, size_t colIndex) throw (IndexOutOfBoundsException);
+
+  /**
+   * @return The element at a given position.
+   * @param rowIndex Row number.
+   * @param colIndex Column number.
+   * @throw IndexOutOfBoundsException If one of the index is greater or equal to the corresponding number of columns/rows.
+   */
+  const std::string& operator()(size_t rowIndex, size_t colIndex) const throw (IndexOutOfBoundsException);
+
+  /**
+   * @return The element at a given position.
+   * @param rowName Row name.
+   * @param colName Column name.
+   * @throw NoTableRowNamesException If the table does not have names associated to rows.
+   * @throw NoTableColumnNamesException If the table does not have names associated to columns.
+   * @throw TableNameNotFoundException If one of rowName or colName do not match existing names.
+   */
+  std::string& operator()(const std::string& rowName, const std::string& colName)
+  throw (NoTableRowNamesException, NoTableColumnNamesException, TableNameNotFoundException);
+
+  /**
+   * @return The element at a given position.
+   * @param rowName Row name.
+   * @param colName Column name.
+   * @throw NoTableRowNamesException If the table does not have names associated to rows.
+   * @throw NoTableColumnNamesException If the table does not have names associated to columns.
+   * @throw TableNameNotFoundException If one of rowName or colName do not match existing names.
+   */
+  const std::string& operator()(const std::string& rowName, const std::string& colName) const
+  throw (NoTableRowNamesException, NoTableColumnNamesException, TableNameNotFoundException);
+
+  /**
+   * @return The element at a given position.
+   * @param rowName Row name.
+   * @param colIndex Column number.
+   * @throw NoTableRowNamesException If the table does not have names associated to rows.
+   * @throw IndexOutOfBoundsException If the index is greater or equal to the number of columns.
+   * @throw TableNameNotFoundException If rowName do not match existing names.
+   */
+  std::string& operator()(const std::string& rowName, size_t colIndex)
+  throw (NoTableRowNamesException, TableNameNotFoundException, IndexOutOfBoundsException);
+
+  /**
+   * @return The element at a given position.
+   * @param rowName Row name.
+   * @param colIndex Column number.
+   * @throw NoTableRowNamesException If the table does not have names associated to rows.
+   * @throw IndexOutOfBoundsException If the index is greater or equal to the number of columns.
+   * @throw TableNameNotFoundException If rowName do not match existing names.
+   */
+  const std::string& operator()(const std::string& rowName, size_t colIndex) const
+  throw (NoTableRowNamesException, TableNameNotFoundException, IndexOutOfBoundsException);
+
+  /**
+   * @return The element at a given position.
+   * @param rowIndex Row number.
+   * @param colName Column name.
+   * @throw IndexOutOfBoundsException If the index is greater or equal to the number of rows.
+   * @throw NoTableColumnNamesException If the table does not have names associated to columns.
+   * @throw TableNameNotFoundException If colName do not match existing names.
+   */
+  std::string& operator()(size_t rowIndex, const std::string& colName)
+  throw (IndexOutOfBoundsException, NoTableColumnNamesException, TableNameNotFoundException);
+
+  /**
+   * @return The element at a given position.
+   * @param rowIndex Row number.
+   * @param colName Column name.
+   * @throw IndexOutOfBoundsException If the index is greater or equal to the number of rows.
+   * @throw NoTableColumnNamesException If the table does not have names associated to columns.
+   * @throw TableNameNotFoundException If colName do not match existing names.
+   */
+  const std::string& operator()(size_t rowIndex, const std::string& colName) const
+  throw (IndexOutOfBoundsException, NoTableColumnNamesException, TableNameNotFoundException);
+
+  /**
+   * @name Work on columns.
+   *
+   * @{
+   */
+
+  /**
+   * @return The number of columns in this table.
+   */
+  size_t getNumberOfColumns() const { return nCol_; }
+
+  /**
+   * @brief Set the column names of this table.
+   *
+   * @param colNames The row names.
+   * @throw DimensionException If the number of names do not match the number of columns in the table.
+   * @throw DuplicatedTableColumnNameException If names are not unique.
+   */
+  void setColumnNames(const std::vector<std::string>& colNames) throw (DimensionException, DuplicatedTableColumnNameException);
+  /**
+   * @brief Get the column names of this table.
+   *
+   * @return The column names of this table.
+   * @throw NoTableColumnNamesException If no column names are associated to this table.
+   */
+  std::vector<std::string> getColumnNames() const throw (NoTableColumnNamesException);
+  /**
+   * @brief Get a given column name.
+   *
+   * @param index The index of the column.
+   * @return The column name associated to the given column.
+   * @throw NoTableColumnNamesException If no column names are associated to this table.
+   * @throw IndexOutOfBoundsException If index is >= number of columns.
+   */
+  std::string getColumnName(size_t index) const throw (NoTableColumnNamesException, IndexOutOfBoundsException);
+
+  /**
+   * @return true If column names are associated to this table.
+   */
+  bool hasColumnNames() const { return colNames_ != 0; }
+
+  /**
+   * @return The values in the given column.
+   * @param index The index of the column.
+   * @throw IndexOutOfBoundsException If index is >= number of columns.
+   */
+  std::vector<std::string>& getColumn(size_t index) throw (IndexOutOfBoundsException);
+  /**
+   * @return The values in the given column.
+   * @param index The index of the column.
+   * @throw IndexOutOfBoundsException If index is >= number of columns.
+   */
+  const std::vector<std::string>& getColumn(size_t index) const throw (IndexOutOfBoundsException);
+
+  /**
+   * @return The values in the given column.
+   * @param colName The name of the column.
+   * @throw NoTableColumnNamesException If no column names are associated to this table.
+   * @throw TableColumnNameNotFoundException If colName do not match existing column names.
+   */
+  std::vector<std::string>& getColumn(const std::string& colName) throw (NoTableColumnNamesException, TableColumnNameNotFoundException);
+  /**
+   * @return The values in the given column.
+   * @param colName The name of the column.
+   * @throw NoTableColumnNamesException If no column names are associated to this table.
+   * @throw TableColumnNameNotFoundException If colName do not match existing column names.
+   */
+  const std::vector<std::string>& getColumn(const std::string& colName) const throw (NoTableColumnNamesException, TableColumnNameNotFoundException);
+
+  /**
+   * @brief Tell is a given column exists.
+   *
+   * @param colName The name of the column to look for.
+   * @return true if the column was found, false if not or if there are no column names.
+   */
+  bool hasColumn(const std::string& colName) const;
+
+  /**
+   * @brief Delete the given column.
+   *
+   * @param index The index of the column.
+   * @throw IndexOutOfBoundsException If index is >= number of columns.
+   */
+  void deleteColumn(size_t index) throw (IndexOutOfBoundsException);
+
+  /**
+   * @brief Delete the given column.
+   *
+   * @param colName The name of the column.
+   * @throw NoTableColumnNamesException If no column names are associated to this table.
+   * @throw TableColumnNameNotFoundException If colName do not match existing column names.
+   */
+  void deleteColumn(const std::string& colName) throw (NoTableColumnNamesException, TableColumnNameNotFoundException);
+
+  /**
+   * @brief Add a new column.
+   *
+   * @param newColumn The new column values.
+   * @throw DimensionException If the number of values does not match the number of rows.
+   * @throw TableColumnNamesException If the table has row names.
+   */
+  void addColumn(const std::vector<std::string>& newColumn) throw (DimensionException, TableColumnNamesException);
+  /**
+   * @brief Add a new column.
+   *
+   * @param colName   The name of the column.
+   * @param newColumn The new column values.
+   * @throw DimensionException If the number of values does not match the number of rows.
+   * @throw NoTableColumnNamesException If the table does not have row names.
+   * @throw DuplicatedTableColumnNameException If colName is already used.
+   */
+  void addColumn(const std::string& colName, const std::vector<std::string>& newColumn) throw (DimensionException, NoTableColumnNamesException, DuplicatedTableColumnNameException);
+  /** @} */
+
+  /**
+   * @name Work on rows.
+   *
+   * @{
+   */
+
+  /**
+   * @return The number of rows in this table.
+   */
+  size_t getNumberOfRows() const { return nRow_; }
+
+  /**
+   * @brief Set the row names of this table.
+   *
+   * @param rowNames The row names.
+   * @throw DimensionException If the number of names do not match the number of rows in the table.
+   * @throw DuplicatedTableRowNameException If names are not unique.
+   */
+  void setRowNames(const std::vector<std::string>& rowNames) throw (DimensionException, DuplicatedTableRowNameException);
+
+  /**
+   * @brief Get the row names of this table.
+   *
+   * @return The row names of this table.
+   * @throw NoTableRowNamesException If no row names are associated to this table.
+   */
+  std::vector<std::string> getRowNames() const throw (NoTableRowNamesException);
+
+  /**
+   * @brief Tell is a given row exists.
+   *
+   * @param rowName The name of the row to look for.
+   * @return true if the row was found, false if not or if there are no row names.
+   */
+  bool hasRow(const std::string& rowName) const;
+
+  /**
+   * @brief Get a given row name.
+   *
+   * @param index The index of the row.
+   * @return The row name associated to the given row.
+   * @throw NoTableRowNamesException If no row names are associated to this table.
+   * @throw IndexOutOfBoundsException If index is >= number of rows.
+   */
+  std::string getRowName(size_t index) const throw (NoTableRowNamesException, IndexOutOfBoundsException);
+
+  /**
+   * @return true If row names are associated to this table.
+   */
+  bool hasRowNames() const { return rowNames_ != 0; }
+
+  /**
+   * @return A vector which contains a copy  in the given row.
+   * @param index The index of the row.
+   * @throw IndexOutOfBoundsException If index is >= number of rows.
+   */
+  std::vector<std::string> getRow(size_t index) const throw (IndexOutOfBoundsException);
+
+  /**
+   * @return A vector which contains a copy  in the given row.
+   * @param rowName The name of the row.
+   * @throw NoTableRowNamesException If no row names are associated to this table.
+   * @throw TableRowNameNotFoundException If rowName do not match existing row names.
+   */
+  std::vector<std::string> getRow(const std::string& rowName) const throw (NoTableRowNamesException, TableRowNameNotFoundException);
+
+  /**
+   * @brief Delete the given row.
+   *
+   * @param index The index of the row.
+   * @throw IndexOutOfBoundsException If index is >= number of row.
+   */
+  void deleteRow(size_t index) throw (IndexOutOfBoundsException);
+
+  /**
+   * @brief Delete the given row.
+   *
+   * @param rowName The name of the row.
+   * @throw NoTableRowNamesException If no row names are associated to this table.
+   * @throw TableRowNameNotFoundException If rowName do not match existing column names.
+   */
+  void deleteRow(const std::string& rowName) throw (NoTableRowNamesException, TableRowNameNotFoundException);
+
+  /**
+   * @brief Add a new row.
+   *
+   * @param newRow The new row values.
+   * @throw DimensionException If the number of values does not match the number of columns.
+   * @throw TableRowNamesException If the table has column names.
+   */
+  void addRow(const std::vector<std::string>& newRow) throw (DimensionException, TableRowNamesException);
+  /**
+   * @brief Add a new row.
+   *
+   * @param rowName   The name of the row.
+   * @param newRow    The new row values.
+   * @throw DimensionException If the number of values does not match the number of columns.
+   * @throw NoTableRowNamesException If the table does not have column names.
+   * @throw DuplicatedTableRowNameException If rowName is already used.
+   */
+  void addRow(const std::string& rowName, const std::vector<std::string>& newRow) throw (DimensionException, NoTableRowNamesException, DuplicatedTableRowNameException);
+  /** @} */
+
+public:
+  /**
+   * @brief Read a table form a stream in CSV-like format.
+   *
+   * The number of rows is given by the second line in the file.
+   * By default, if the first line as one column less than the second one,
+   * the first line is taken as column names, and the first column as row names.
+   * Otherwise, no column names and no row names are specified, unless
+   * explicitely precised by the user.
+   *
+   * @param in       The input stream.
+   * @param sep      The column delimiter.
+   * @param header   Tell if the first line must be used as column names, otherwise use default.
+   * @param rowNames Use a column as rowNames. If positive, use the specified column to compute rownames, otherwise use default;
+   * @return         A pointer toward a new DataTable object.
+   */
+  static DataTable* read(std::istream& in, const std::string& sep = "\t", bool header = true, int rowNames = -1)
+  throw (DimensionException, IndexOutOfBoundsException, DuplicatedTableRowNameException);
+
+  /**
+   * @brief Write a DataTable object to stream in CVS-like format.
+   *
+   * @param data         The table to write.
+   * @param out          The output stream.
+   * @param sep          The column delimiter.
+   * @param alignHeaders If true, add a delimiter before the first column header if there is row names.
+   */
+  static void write(const DataTable& data, std::ostream& out, const std::string& sep = "\t", bool alignHeaders = false);
+  static void write(const DataTable& data, bpp::OutputStream& out, const std::string& sep = "\t", bool alignHeaders = false);
 };
+} // end of namespace bpp.
 
-} //end of namespace bpp.
-
-#endif //_DataTable_H_
+#endif // _DataTable_H_
 
diff --git a/src/Bpp/Numeric/Function/ConjugateGradientMultiDimensions.cpp b/src/Bpp/Numeric/Function/ConjugateGradientMultiDimensions.cpp
index 7e455ac..adc339e 100644
--- a/src/Bpp/Numeric/Function/ConjugateGradientMultiDimensions.cpp
+++ b/src/Bpp/Numeric/Function/ConjugateGradientMultiDimensions.cpp
@@ -101,10 +101,14 @@ double ConjugateGradientMultiDimensions::doStep() throw (Exception)
     return f;
   }
   gam = dgg / gg;
-  for(unsigned int j = 0; j < n; j++)
+
+  if (!(std::isnan(gam) || std::isinf(gam)))
   {
-    g_[j] = -xi_[j];
-    xi_[j] = h_[j] = g_[j] + gam * h_[j];
+    for(unsigned int j = 0; j < n; j++)
+    {
+      g_[j] = -xi_[j];
+      xi_[j] = h_[j] = g_[j] + gam * h_[j];
+    }
   }
   
   return f;
diff --git a/src/Bpp/Numeric/Function/FivePointsNumericalDerivative.cpp b/src/Bpp/Numeric/Function/FivePointsNumericalDerivative.cpp
index 647ac90..ab6c02f 100644
--- a/src/Bpp/Numeric/Function/FivePointsNumericalDerivative.cpp
+++ b/src/Bpp/Numeric/Function/FivePointsNumericalDerivative.cpp
@@ -46,8 +46,10 @@ throw (ParameterNotFoundException, ConstraintException)
 {
   if (computeD1_ && variables_.size() > 0)
   {
-    if (function1_) function1_->enableFirstOrderDerivatives(false);
-    if (function2_) function2_->enableSecondOrderDerivatives(false);
+    if (function1_)
+      function1_->enableFirstOrderDerivatives(false);
+    if (function2_)
+      function2_->enableSecondOrderDerivatives(false);
     function_->setParameters(parameters);
     f3_ = function_->getValue();
     string lastVar;
@@ -57,7 +59,8 @@ throw (ParameterNotFoundException, ConstraintException)
     for (unsigned int i = 0; i < variables_.size(); i++)
     {
       string var = variables_[i];
-      if (!parameters.hasParameter(var)) continue;
+      if (!parameters.hasParameter(var))
+        continue;
       if (!start)
       {
         vector<string> vars(2);
@@ -74,7 +77,7 @@ throw (ParameterNotFoundException, ConstraintException)
       functionChanged = true;
       double value = function_->getParameterValue(var);
       double h = (1. + std::abs(value)) * h_;
-      //Compute four other points:
+      // Compute four other points:
       try
       {
         p[0].setValue(value - 2 * h);
@@ -85,7 +88,7 @@ throw (ParameterNotFoundException, ConstraintException)
           p[0].setValue(value + 2 * h);
           function_->setParameters(p);
           f5_ = function_->getValue();
-          //No limit raised, use central approximation:
+          // No limit raised, use central approximation:
           p[0].setValue(value - h);
           function_->setParameters(p);
           f2_ = function_->getValue();
@@ -97,7 +100,7 @@ throw (ParameterNotFoundException, ConstraintException)
         }
         catch (ConstraintException& ce)
         {
-          //Right limit raised, use backward approximation:
+          // Right limit raised, use backward approximation:
           p[0].setValue(value - h);
           function_->setParameters(p);
           f2_ = function_->getValue();
@@ -110,7 +113,7 @@ throw (ParameterNotFoundException, ConstraintException)
       }
       catch (ConstraintException& ce)
       {
-        //Left limit raised, use forward approximation:
+        // Left limit raised, use forward approximation:
         p[0].setValue(value + h);
         function_->setParameters(p);
         f4_ = function_->getValue();
@@ -121,19 +124,23 @@ throw (ParameterNotFoundException, ConstraintException)
         der2_[i] = (f5_ - 2. * f4_ + f3_) / (h * h);
       }
     }
-    //Reset last parameter and compute analytical derivatives if any.
-    if (function1_) function1_->enableFirstOrderDerivatives(computeD1_);
-    if (function2_) function2_->enableSecondOrderDerivatives(computeD2_);
+    // Reset last parameter and compute analytical derivatives if any.
+    if (function1_)
+      function1_->enableFirstOrderDerivatives(computeD1_);
+    if (function2_)
+      function2_->enableSecondOrderDerivatives(computeD2_);
     if (functionChanged)
       function_->setParameters(parameters.subList(lastVar));
   }
   else
   {
-    //Reset initial value and compute analytical derivatives if any.
-    if (function1_) function1_->enableFirstOrderDerivatives(computeD1_);
-    if (function2_) function2_->enableSecondOrderDerivatives(computeD2_);
+    // Reset initial value and compute analytical derivatives if any.
+    if (function1_)
+      function1_->enableFirstOrderDerivatives(computeD1_);
+    if (function2_)
+      function2_->enableSecondOrderDerivatives(computeD2_);
     function_->setParameters(parameters);
-    //Just in  case derivatives are not computed:
+    // Just in  case derivatives are not computed:
     f3_ = function_->getValue();
   }
 }
diff --git a/src/Bpp/Numeric/Function/FivePointsNumericalDerivative.h b/src/Bpp/Numeric/Function/FivePointsNumericalDerivative.h
index 77cb6f1..30c8388 100644
--- a/src/Bpp/Numeric/Function/FivePointsNumericalDerivative.h
+++ b/src/Bpp/Numeric/Function/FivePointsNumericalDerivative.h
@@ -5,37 +5,37 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for numerical calculus.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. CNRS, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide classes
+   for numerical calculus.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 #ifndef _FIVEPOINTSNUMERICALDERIVATIVE_H_
 #define _FIVEPOINTSNUMERICALDERIVATIVE_H_
@@ -43,14 +43,13 @@ knowledge of the CeCILL license and that you accept its terms.
 #include "Functions.h"
 #include "AbstractNumericalDerivative.h"
 
-//From the STL:
+// From the STL:
 #include <map>
 #include <vector>
 #include <string>
 
 namespace bpp
 {
-
 /**
  * @brief Five points numerical derivative function wrapper.
  *
@@ -62,7 +61,7 @@ namespace bpp
  * \dfrac{\partial   f}{\partial x  } &=& \dfrac{f_{-2}-8f_{-1}+8f_{+1}-f_{+2}}{12h}\\
  * \dfrac{\partial^2 f}{\partial x^2} &=& \dfrac{-f_{-2}+16f_{-1}-30f_0+16f_{+1}-f_{+2}}{12h^2}\\
  * @f}
- * In case of border limit (when @f$x_{-2}@f$ or @f$x_{+2}@f$ are not computable), 
+ * In case of border limit (when @f$x_{-2}@f$ or @f$x_{+2}@f$ are not computable),
  * the foreward and backward three points computations are performed, respectively:
  * @f{eqnarray*}
  * \dfrac{\partial   f}{\partial x  } &=& \dfrac{f_{+1}-f_0}{h}\\
@@ -83,43 +82,55 @@ namespace bpp
  * @warning cross second order derivatives are not implemented with the five points method.
  * @see AbstractNumericalDerivative
  */
-class FivePointsNumericalDerivative:
+class FivePointsNumericalDerivative :
   public AbstractNumericalDerivative
 {
-  private:
-    double f1_, f2_, f3_, f4_, f5_;
-    
-  public:
-    FivePointsNumericalDerivative(Function* function) :
-      AbstractNumericalDerivative(function), f1_(), f2_(), f3_(), f4_(), f5_() {}
-    FivePointsNumericalDerivative(DerivableFirstOrder* function) :
-      AbstractNumericalDerivative(function), f1_(), f2_(), f3_(), f4_(), f5_() {}
-    FivePointsNumericalDerivative(DerivableSecondOrder* function) :
-      AbstractNumericalDerivative(function), f1_(), f2_(), f3_(), f4_(), f5_() {}
-    virtual ~FivePointsNumericalDerivative() {}
-
-    FivePointsNumericalDerivative* clone() const { return new FivePointsNumericalDerivative(*this); }
-
-  public:
-    
-    double getValue() const throw (Exception)
-    {
-      return f3_;
-    }
-
-    double getSecondOrderDerivative(const std::string& variable1, const std::string& variable2) const
-      throw (Exception)
-    {
-      throw Exception("Unimplemented cross derivative.");
-    }
-  
-  protected:
-    void updateDerivatives(const ParameterList parameters)
-      throw (ParameterNotFoundException, ConstraintException);
-    
+private:
+  double f1_, f2_, f3_, f4_, f5_;
+
+public:
+  FivePointsNumericalDerivative(Function* function) :
+    AbstractNumericalDerivative(function),
+    f1_(),
+    f2_(),
+    f3_(),
+    f4_(),
+    f5_() {}
+  FivePointsNumericalDerivative(DerivableFirstOrder* function) :
+    AbstractNumericalDerivative(function),
+    f1_(),
+    f2_(),
+    f3_(),
+    f4_(),
+    f5_() {}
+  FivePointsNumericalDerivative(DerivableSecondOrder* function) :
+    AbstractNumericalDerivative(function),
+    f1_(),
+    f2_(),
+    f3_(),
+    f4_(),
+    f5_() {}
+  virtual ~FivePointsNumericalDerivative() {}
+
+  FivePointsNumericalDerivative* clone() const { return new FivePointsNumericalDerivative(*this); }
+
+public:
+  double getValue() const throw (Exception)
+  {
+    return f3_;
+  }
+
+  double getSecondOrderDerivative(const std::string& variable1, const std::string& variable2) const
+  throw (Exception)
+  {
+    throw Exception("Unimplemented cross derivative.");
+  }
+
+protected:
+  void updateDerivatives(const ParameterList parameters)
+  throw (ParameterNotFoundException, ConstraintException);
 };
+} // end of namespace bpp.
 
-} //end of namespace bpp.
-
-#endif //_FIVEPOINTSNUMERICALDERIVATIVE_H_
+#endif // _FIVEPOINTSNUMERICALDERIVATIVE_H_
 
diff --git a/src/Bpp/Numeric/Function/GoldenSectionSearch.cpp b/src/Bpp/Numeric/Function/GoldenSectionSearch.cpp
index 840d48a..5ef7070 100644
--- a/src/Bpp/Numeric/Function/GoldenSectionSearch.cpp
+++ b/src/Bpp/Numeric/Function/GoldenSectionSearch.cpp
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
+Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
 
 This software is a computer program whose purpose is to provide classes
 for numerical calculus.
@@ -60,11 +60,7 @@ double GoldenSectionSearch::GSSStopCondition::getCurrentTolerance() const
 {
   // NRC Test for done:
   const GoldenSectionSearch* gss = dynamic_cast<const GoldenSectionSearch*>(optimizer_);
-  double x0 = gss->x0;
-  double x1 = gss->x1;
-  double x2 = gss->x2;
-  double x3 = gss->x3;
-  return NumTools::abs(x3 - x0) / (NumTools::abs(x1) + NumTools::abs(x2));
+  return NumTools::abs(gss->x3 - gss->x0) / (NumTools::abs(gss->x1) + NumTools::abs(gss->x2));
 }
   
 /******************************************************************************/
diff --git a/src/Bpp/Numeric/Function/MetaOptimizer.h b/src/Bpp/Numeric/Function/MetaOptimizer.h
index 228c769..c776911 100644
--- a/src/Bpp/Numeric/Function/MetaOptimizer.h
+++ b/src/Bpp/Numeric/Function/MetaOptimizer.h
@@ -8,7 +8,7 @@
 //
 
 /*
-  Copyright or © or Copr. CNRS, (November 17, 2004)
+  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
 
   This software is a computer program whose purpose is to provide classes
   for phylogenetic data analysis.
@@ -116,7 +116,7 @@ namespace bpp
      * @param derivatives 0, 1 or 2: does this parameter use no, first order or second order derivatives?
      * @param type For each optimization step, shall we perform a full optimization with this optimizer or only one step?
      */
-    virtual void addOptimizer(const std::string & name, Optimizer * optimizer, const std::vector<std::string> & params, const short derivatives = 0, const std::string & type = IT_TYPE_STEP)
+    virtual void addOptimizer(const std::string & name, Optimizer * optimizer, const std::vector<std::string> & params, unsigned short derivatives = 0, const std::string & type = IT_TYPE_STEP)
     {
       names_.push_back(name);
       optimizers_.push_back(optimizer);
@@ -128,43 +128,43 @@ namespace bpp
     /**
      * @return The display name of the ith optimizer in the set.
      */
-    virtual const std::string& getName(unsigned int i) const { return names_[i]; }
+    virtual const std::string& getName(size_t i) const { return names_[i]; }
     
     /**
      * @return The ith optimizer in the set.
      */
-    virtual Optimizer* getOptimizer(unsigned int i) { return optimizers_[i]; }
+    virtual Optimizer* getOptimizer(size_t i) { return optimizers_[i]; }
     /**
      * @return The ith optimizer in the set.
      */
-    virtual const Optimizer* getOptimizer(unsigned int i) const { return optimizers_[i]; }
+    virtual const Optimizer* getOptimizer(size_t i) const { return optimizers_[i]; }
 
     /**
      * @return The parameter names associated to the ith optimizer in the set.
      */
-    virtual std::vector<std::string>& getParameterNames(unsigned int i) { return parameterNames_[i]; }
+    virtual std::vector<std::string>& getParameterNames(size_t i) { return parameterNames_[i]; }
     /**
      * @return The parameter names associated to the ith optimizer in the set.
      */
-    virtual const std::vector<std::string>& getParameterNames(unsigned int i) const { return parameterNames_[i]; }
+    virtual const std::vector<std::string>& getParameterNames(size_t i) const { return parameterNames_[i]; }
 
     /**
      * @return The type of iteration to perform for the ith optimizer in the set.
      */
-    virtual std::string& getIterationType(unsigned int i) { return itTypes_[i]; }
+    virtual std::string& getIterationType(size_t i) { return itTypes_[i]; }
     /**
      * @return The type of iteration to perform for the ith optimizer in the set.
      */
-    virtual const std::string& getIterationType(unsigned int i) const { return itTypes_[i]; }
+    virtual const std::string& getIterationType(size_t i) const { return itTypes_[i]; }
 
     /**
      * @return True if the ith optimizer in the set requires first order derivatives.
      */
-    virtual bool requiresFirstOrderDerivatives(unsigned int i) const { return derivatives_[i] > 0; }  
+    virtual bool requiresFirstOrderDerivatives(size_t i) const { return derivatives_[i] > 0; }  
     /**
      * @return True if the ith optimizer in the set requires second order derivatives.
      */
-    virtual bool requiresSecondOrderDerivatives(unsigned int i) const { return derivatives_[i] > 1; }  
+    virtual bool requiresSecondOrderDerivatives(size_t i) const { return derivatives_[i] > 1; }  
 
     /**
      * @return The number of optimizers in the set.
diff --git a/src/Bpp/Numeric/Function/OneDimensionOptimizationTools.cpp b/src/Bpp/Numeric/Function/OneDimensionOptimizationTools.cpp
index ac707cb..238fe64 100644
--- a/src/Bpp/Numeric/Function/OneDimensionOptimizationTools.cpp
+++ b/src/Bpp/Numeric/Function/OneDimensionOptimizationTools.cpp
@@ -5,37 +5,37 @@
 //
 
 /*
-  Copyright or © or Copr. CNRS, (November 17, 2004)
-
-  This software is a computer program whose purpose is to provide classes
-  for numerical calculus. This file is part of the Bio++ project.
-
-  This software is governed by the CeCILL  license under French law and
-  abiding by the rules of distribution of free software.  You can  use, 
-  modify and/ or redistribute the software under the terms of the CeCILL
-  license as circulated by CEA, CNRS and INRIA at the following URL
-  "http://www.cecill.info". 
-
-  As a counterpart to the access to the source code and  rights to copy,
-  modify and redistribute granted by the license, users are provided only
-  with a limited warranty  and the software's author,  the holder of the
-  economic rights,  and the successive licensors  have only  limited
-  liability. 
-
-  In this respect, the user's attention is drawn to the risks associated
-  with loading,  using,  modifying and/or developing or reproducing the
-  software by the user in light of its specific status of free software,
-  that may mean  that it is complicated to manipulate,  and  that  also
-  therefore means  that it is reserved for developers  and  experienced
-  professionals having in-depth computer knowledge. Users are therefore
-  encouraged to load and test the software's suitability as regards their
-  requirements in conditions enabling the security of their systems and/or 
-  data to be ensured and,  more generally, to use and operate it in the 
-  same conditions as regards security. 
-
-  The fact that you are presently reading this means that you have had
-  knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide classes
+   for numerical calculus. This file is part of the Bio++ project.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 #include "NewtonBacktrackOneDimension.h"
 #include "BrentOneDimension.h"
@@ -47,26 +47,24 @@ using namespace bpp;
 using namespace std;
 
 /******************************************************************************
- *                              The Point class                               *
- ******************************************************************************/
- 
-inline void BracketPoint::set(double xval, double fval) { this->x = xval; this->f = fval; }	
+*                              The Point class                               *
+******************************************************************************/
+inline void BracketPoint::set(double xval, double fval) { this->x = xval; this->f = fval; }
 
 /******************************************************************************
- *                             The Bracket class                              *
- ******************************************************************************/
- 
+*                             The Bracket class                              *
+******************************************************************************/
 inline void Bracket::setA(double xa, double fa) { a.set(xa, fa); }
 inline void Bracket::setB(double xb, double fb) { b.set(xb, fb); }
 inline void Bracket::setC(double xc, double fc) { c.set(xc, fc); }
 
 /******************************************************************************/
-	
+
 Bracket OneDimensionOptimizationTools::bracketMinimum(
-                                                      double a,
-                                                      double b,
-                                                      Function * function,
-                                                      ParameterList parameters)
+  double a,
+  double b,
+  Function* function,
+  ParameterList parameters)
 {
   Bracket bracket;
   // Copy the parameter to use.
@@ -75,96 +73,96 @@ Bracket OneDimensionOptimizationTools::bracketMinimum(
   bracket.b.x = b;
   parameters[0].setValue(bracket.b.x); bracket.b.f = function->f(parameters);
   if (bracket.b.f > bracket.a.f)
-    {		
-      // Switch roles of first and second point so that we can go downhill
-      // in the direction from a to b.
-      NumTools::swap<double>(bracket.a.x, bracket.b.x);
-      NumTools::swap<double>(bracket.a.f, bracket.b.f);
-    }
-	
+  {
+    // Switch roles of first and second point so that we can go downhill
+    // in the direction from a to b.
+    NumTools::swap<double>(bracket.a.x, bracket.b.x);
+    NumTools::swap<double>(bracket.a.f, bracket.b.f);
+  }
+
   // First guess for third point:
   bracket.c.x = bracket.b.x + NumConstants::GOLDEN_RATIO_PHI() * (bracket.b.x - bracket.a.x);
   parameters[0].setValue(bracket.c.x); bracket.c.f = function->f(parameters);
-	
+
   // Keep returning here until we bracket:
   while (bracket.b.f > bracket.c.f)
+  {
+    // Compute xu by parabolic extrapolation from a, b, c. TINY is used to prevent
+    // any possible division by 0.
+    double r = (bracket.b.x - bracket.a.x) * (bracket.b.f - bracket.c.f);
+    double q = (bracket.b.x - bracket.c.x) * (bracket.b.f - bracket.a.f);
+
+    double xu = bracket.b.x - ((bracket.b.x - bracket.c.x) * q - (bracket.b.x - bracket.a.x) * r) /
+                (2.0 * NumTools::sign(NumTools::max(NumTools::abs(q - r), NumConstants::VERY_TINY()), q - r));
+    double xulim = (bracket.b.x) + GLIMIT * (bracket.c.x - bracket.b.x);
+    double fu;
+
+    // We don't go farther than this.
+    // Test various possibilities:
+    if ((bracket.b.x - xu) * (xu - bracket.c.x) > 0.0)
+    {
+      parameters[0].setValue(xu); fu = function->f(parameters);
+      if (fu < bracket.c.f)
+      {
+        bracket.setA(bracket.b.x, bracket.b.f);
+        bracket.setB(xu, fu);
+        return bracket;
+      }
+      else if (fu > bracket.b.f)
+      {
+        bracket.setC(xu, fu);
+        return bracket;
+      }
+      // Parabolic fit was no use.
+      // Use default magnification.
+      xu = bracket.c.x + NumConstants::GOLDEN_RATIO_PHI() * (bracket.c.x - bracket.b.x);
+      parameters[0].setValue(xu); fu = function->f(parameters);
+    }
+    else if ((bracket.c.x - xu) * (xu - xulim) > 0.0)
+    {
+      // Parabolic fit is between point 3 and its allowed limit.
+      parameters[0].setValue(xu); fu = function->f(parameters);
+      if (fu < bracket.c.f)
+      {
+        NumTools::shift<double>(bracket.b.x, bracket.c.x, xu, bracket.c.x + NumConstants::GOLDEN_RATIO_PHI() * (bracket.c.x - bracket.b.x));
+        parameters[0].setValue(xu);
+        NumTools::shift<double>(bracket.b.f, bracket.c.f, fu, function->f(parameters));
+      }
+    }
+    else if ((xu - xulim) * (xulim - bracket.c.x) >= 0.0)
     {
-      // Compute xu by parabolic extrapolation from a, b, c. TINY is used to prevent
-      // any possible division by 0.
-      double r = (bracket.b.x - bracket.a.x) * (bracket.b.f - bracket.c.f);
-      double q = (bracket.b.x - bracket.c.x) * (bracket.b.f - bracket.a.f);
-		
-      double xu = bracket.b.x - ((bracket.b.x - bracket.c.x) * q - (bracket.b.x - bracket.a.x) * r) /
-        (2.0 * NumTools::sign(NumTools::max(NumTools::abs(q - r), NumConstants::VERY_TINY()), q - r));
-      double xulim = (bracket.b.x) + GLIMIT * (bracket.c.x - bracket.b.x);
-      double fu;
-		
-      // We don't go farther than this.
-      // Test various possibilities:
-      if ((bracket.b.x - xu) * (xu - bracket.c.x) > 0.0)
-        {
-          parameters[0].setValue(xu); fu = function->f(parameters);
-          if (fu < bracket.c.f)
-            {
-              bracket.setA(bracket.b.x, bracket.b.f);
-              bracket.setB(xu, fu);
-              return bracket;
-            }
-          else if (fu > bracket.b.f)
-            {
-              bracket.setC(xu, fu);
-              return bracket;
-            }
-          // Parabolic fit was no use.
-          // Use default magnification.
-          xu = bracket.c.x + NumConstants::GOLDEN_RATIO_PHI() * (bracket.c.x - bracket.b.x);
-          parameters[0].setValue(xu); fu = function->f(parameters);
-        }
-      else if ((bracket.c.x - xu) * (xu - xulim) > 0.0)
-        {
-          // Parabolic fit is between point 3 and its allowed limit.
-          parameters[0].setValue(xu); fu = function->f(parameters);
-          if (fu < bracket.c.f)
-            {
-              NumTools::shift<double>(bracket.b.x, bracket.c.x, xu, bracket.c.x + NumConstants::GOLDEN_RATIO_PHI() * (bracket.c.x - bracket.b.x));
-              parameters[0].setValue(xu);
-              NumTools::shift<double>(bracket.b.f, bracket.c.f, fu, function->f(parameters));
-            }
-        }
-      else if ((xu - xulim) * (xulim - bracket.c.x) >= 0.0)
-        {
-          // Limit parabolic xu to maximum allowed value.
-          xu = xulim;
-          parameters[0].setValue(xu); fu = function->f(parameters);
-        }
-      else
-        {
-          // Reject parabolic xu, use default magnification.
-          xu = bracket.c.x + NumConstants::GOLDEN_RATIO_PHI() * (bracket.c.x - bracket.b.x);
-          parameters[0].setValue(xu); fu = function->f(parameters);
-        }
-      // Eliminate oldest point and continue.
-      NumTools::shift<double>(bracket.a.x, bracket.b.x, bracket.c.x, xu);
-      NumTools::shift<double>(bracket.a.f, bracket.b.f, bracket.c.f, fu);
+      // Limit parabolic xu to maximum allowed value.
+      xu = xulim;
+      parameters[0].setValue(xu); fu = function->f(parameters);
     }
+    else
+    {
+      // Reject parabolic xu, use default magnification.
+      xu = bracket.c.x + NumConstants::GOLDEN_RATIO_PHI() * (bracket.c.x - bracket.b.x);
+      parameters[0].setValue(xu); fu = function->f(parameters);
+    }
+    // Eliminate oldest point and continue.
+    NumTools::shift<double>(bracket.a.x, bracket.b.x, bracket.c.x, xu);
+    NumTools::shift<double>(bracket.a.f, bracket.b.f, bracket.c.f, fu);
+  }
   return bracket;
 }
 
 /******************************************************************************/
 
 unsigned int OneDimensionOptimizationTools::lineMinimization(
-                                                             DirectionFunction& f1dim,
-                                                             ParameterList& parameters,
-                                                             std::vector<double>& xi,
-                                                             double tolerance,
-                                                             OutputStream* profiler,
-                                                             OutputStream* messenger,
-                                                             int verbose)
+  DirectionFunction& f1dim,
+  ParameterList& parameters,
+  std::vector<double>& xi,
+  double tolerance,
+  OutputStream* profiler,
+  OutputStream* messenger,
+  unsigned int verbose)
 {
   // Initial guess for brackets:
   double ax = 0.;
   double xx = 0.01;
-  
+
   f1dim.setConstraintPolicy(AutoParameter::CONSTRAINTS_AUTO);
   f1dim.setMessageHandler(messenger);
   f1dim.init(parameters, xi);
@@ -180,11 +178,11 @@ unsigned int OneDimensionOptimizationTools::lineMinimization(
   singleParameter.addParameter(Parameter("x", 0.0));
   bod.init(singleParameter);
   bod.optimize();
-  //Update parameters:
-  //parameters.matchParametersValues(f1dim.getFunction()->getParameters());
-  
+  // Update parameters:
+  // parameters.matchParametersValues(f1dim.getFunction()->getParameters());
+
   double xmin = f1dim.getParameters()[0].getValue();
-  for(size_t j = 0; j < parameters.size(); j++)
+  for (size_t j = 0; j < parameters.size(); j++)
   {
     xi[j] *= xmin;
     parameters[j].setValue(parameters[j].getValue() + xi[j]);
@@ -200,29 +198,32 @@ unsigned int OneDimensionOptimizationTools::lineSearch(DirectionFunction& f1dim,
                                                        std::vector<double>& gradient,
                                                        OutputStream* profiler,
                                                        OutputStream* messenger,
-                                                       int verbose)
+                                                       unsigned int verbose)
 {
   size_t size = xi.size();
-  
+
   f1dim.setConstraintPolicy(AutoParameter::CONSTRAINTS_AUTO);
   f1dim.setMessageHandler(messenger);
   f1dim.init(parameters, xi);
 
-  double slope=0;
-  for (unsigned int i=0;i<size;i++)
-    slope+=xi[i]*gradient[i];
+  double slope = 0;
+  for (size_t i = 0; i < size; i++)
+  {
+    slope += xi[i] * gradient[i];
+  }
 
   //  if (slope>=0)
   //  throw Exception("Slope problem in OneDimensionOptimizationTools::lineSearch. Slope="+TextTools::toString(slope));
 
-  double x, temp, test=0;
-  for (unsigned int i=0;i<size;i++){
-    x=abs(parameters[i].getValue());
-    temp=abs(xi[i]);
-    if (x>1.0)
-      temp/=x;
-    if (temp>test)
-      test=temp;
+  double x, temp, test = 0;
+  for (size_t i = 0; i < size; ++i)
+  {
+    x = abs(parameters[i].getValue());
+    temp = abs(xi[i]);
+    if (x > 1.0)
+      temp /= x;
+    if (temp > test)
+      test = temp;
   }
 
   NewtonBacktrackOneDimension nbod(&f1dim, slope, test);
@@ -238,15 +239,15 @@ unsigned int OneDimensionOptimizationTools::lineSearch(DirectionFunction& f1dim,
   singleParameter.addParameter(Parameter("x", 0.0));
   nbod.init(singleParameter);
   nbod.optimize();
-  //Update parameters:
-  //parameters.matchParametersValues(f1dim.getFunction()->getParameters());
-  
+  // Update parameters:
+  // parameters.matchParametersValues(f1dim.getFunction()->getParameters());
+
   double xmin = f1dim.getParameters()[0].getValue();
-  for(unsigned int j = 0; j < parameters.size(); j++)
-    {
-      xi[j] *= xmin;
-      parameters[j].setValue(parameters[j].getValue() + xi[j]);
-    }
+  for (unsigned int j = 0; j < parameters.size(); j++)
+  {
+    xi[j] *= xmin;
+    parameters[j].setValue(parameters[j].getValue() + xi[j]);
+  }
 
   return nbod.getNumberOfEvaluations();
 }
@@ -256,4 +257,3 @@ unsigned int OneDimensionOptimizationTools::lineSearch(DirectionFunction& f1dim,
 double OneDimensionOptimizationTools::GLIMIT = 100.0;
 
 /******************************************************************************/
-
diff --git a/src/Bpp/Numeric/Function/OneDimensionOptimizationTools.h b/src/Bpp/Numeric/Function/OneDimensionOptimizationTools.h
index 75ab4aa..a064853 100644
--- a/src/Bpp/Numeric/Function/OneDimensionOptimizationTools.h
+++ b/src/Bpp/Numeric/Function/OneDimensionOptimizationTools.h
@@ -5,37 +5,37 @@
 //
 
 /*
-  Copyright or © or Copr. CNRS, (November 17, 2004)
-
-  This software is a computer program whose purpose is to provide classes
-  for numerical calculus. This file is part of the Bio++ project.
-
-  This software is governed by the CeCILL  license under French law and
-  abiding by the rules of distribution of free software.  You can  use, 
-  modify and/ or redistribute the software under the terms of the CeCILL
-  license as circulated by CEA, CNRS and INRIA at the following URL
-  "http://www.cecill.info". 
-
-  As a counterpart to the access to the source code and  rights to copy,
-  modify and redistribute granted by the license, users are provided only
-  with a limited warranty  and the software's author,  the holder of the
-  economic rights,  and the successive licensors  have only  limited
-  liability. 
-
-  In this respect, the user's attention is drawn to the risks associated
-  with loading,  using,  modifying and/or developing or reproducing the
-  software by the user in light of its specific status of free software,
-  that may mean  that it is complicated to manipulate,  and  that  also
-  therefore means  that it is reserved for developers  and  experienced
-  professionals having in-depth computer knowledge. Users are therefore
-  encouraged to load and test the software's suitability as regards their
-  requirements in conditions enabling the security of their systems and/or 
-  data to be ensured and,  more generally, to use and operate it in the 
-  same conditions as regards security. 
-
-  The fact that you are presently reading this means that you have had
-  knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide classes
+   for numerical calculus. This file is part of the Bio++ project.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 #ifndef _ONEDIMENSIONOPTIMIZATIONTOOLS_H_
 #define _ONEDIMENSIONOPTIMIZATIONTOOLS_H_
@@ -46,93 +46,93 @@
 
 namespace bpp
 {
+class BracketPoint
+{
+public:
+  double x;
+  double f;
+
+public:
+  // Constructor and destructor:
+  BracketPoint() : x(0),
+    f(0) {}
+  BracketPoint(double xval, double fval) : x(xval),
+    f(fval) {}
+  virtual ~BracketPoint() {}
+
+public:
+  void set(double x, double f);
+};
+
+class Bracket
+{
+public:
+  // Constructor and destructor::
+  Bracket() : a(),
+    b(),
+    c() {}
+  virtual ~Bracket() {}
+
+public:
+  // Methods:
+  void setA(double xa, double fa);
+  void setB(double xb, double fb);
+  void setC(double xc, double fc);
+
+public:
+  BracketPoint a, b, c;
+};
+
+/**
+ * @brief Tools of one parameter-functions optimizations.
+ *
+ * For now, contains only one method to bracket a minimum.
+ */
+class OneDimensionOptimizationTools
+{
+public:
+  OneDimensionOptimizationTools() {}
+  virtual ~OneDimensionOptimizationTools() {}
 
-  class BracketPoint
-  {		
-  public:
-    double x;
-    double f;
-
-  public: // Constructor and destructor:
-    BracketPoint(): x(0), f(0) {}
-    BracketPoint(double xval, double fval): x(xval), f(fval) {}
-    virtual ~BracketPoint() {}
-		
-  public:
-    void set(double x, double f);
-		
-  };
-		
-  class Bracket
-  {	
-  public: // Constructor and destructor::
-    Bracket(): a(), b(), c() {}
-    virtual ~Bracket() {}
-			
-  public: // Methods:
-    void setA(double xa, double fa);
-    void setB(double xb, double fb);
-    void setC(double xc, double fc);
-			
-  public:
-    BracketPoint a, b, c;
-  };
+public:
+  /**
+   * @brief Bracket a minimum.
+   *
+   * Given a function func, and given distinct initial points x1 and x2,
+   * this routine searches in the downhill direction (defined by the function as
+   * evaluated at the initial points) and returns a Bracket object with new points
+   * a.x, b.x and c.x that bracket a minimum of the function. Also returned are the
+   * function values at the three points, a.f, b.f and c.f.
+   *
+   * @param a, b       Two initial values for the parameter.
+   * @param function   The function to bracket.
+   * @param parameters The parameter to use as a variable.
+   * @return           A bracket object.
+   */
+  static Bracket bracketMinimum(double a, double b, Function* function, ParameterList parameters);
+
+  static unsigned int lineMinimization(DirectionFunction& f1dim, ParameterList& parameters, std::vector<double>& xi, double tolerance, OutputStream* profiler = 0, OutputStream* messenger = 0, unsigned int verbose = 2);
 
   /**
-   * @brief Tools of one parameter-functions optimizations.
+   * @brief Search a 'sufficiently low' value for a function in a given direction.
+   *
+   * This function performs a similar computation as the lnsrch function defined at page 385 of
+   *
+   * <pre>
+   * NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING
+   * (ISBN 0-521-43108-5)
+   * </pre>
    *
-   * For now, contains only one method to bracket a minimum.
+   * without the stpmax argument, since the steps are bounded in another way.
+   */
+  static unsigned int lineSearch(DirectionFunction& f1dim, ParameterList& parameters, std::vector<double>& xi, std::vector<double>& gradient, OutputStream* profiler = 0, OutputStream* messenger = 0, unsigned int verbose = 2);
+
+public:
+  /**
+   * @brief Maximum magnification allowed for a parabolic-fit step.
    */
-  class OneDimensionOptimizationTools
-  {
-  public:
-    OneDimensionOptimizationTools() {}
-    virtual ~OneDimensionOptimizationTools() {}
-
-  public:
-		
-    /**
-     * @brief Bracket a minimum.
-     *
-     * Given a function func, and given distinct initial points x1 and x2,
-     * this routine searches in the downhill direction (defined by the function as
-     * evaluated at the initial points) and returns a Bracket object with new points
-     * a.x, b.x and c.x that bracket a minimum of the function. Also returned are the
-     * function values at the three points, a.f, b.f and c.f.
-     *
-     * @param a, b       Two initial values for the parameter.
-     * @param function   The function to bracket.
-     * @param parameters The parameter to use as a variable.
-     * @return           A bracket object.
-     */
-    static Bracket bracketMinimum(double a, double b, Function* function, ParameterList parameters);
-	
-    static unsigned int lineMinimization(DirectionFunction& f1dim, ParameterList& parameters, std::vector<double>& xi, double tolerance, OutputStream* profiler = 0, OutputStream* messenger = 0, int verbose = 2);
-
-    /**
-     * @brief Search a 'sufficiently low' value for a function in a given direction.
-     *
-     * This function performs a similar computation as the lnsrch function defined at page 385 of
-     *
-     * <pre>
-     * NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING
-     * (ISBN 0-521-43108-5)
-     * </pre>
-     * 
-     * without the stpmax argument, since the steps are bounded in another way.
-     */ 
-    static unsigned int lineSearch(DirectionFunction& f1dim, ParameterList& parameters, std::vector<double>& xi, std::vector<double>& gradient, OutputStream* profiler = 0, OutputStream* messenger = 0, int verbose = 2);
-                                 
-  public:
-		
-    /**
-     * @brief Maximum magnification allowed for a parabolic-fit step.
-     */
-    static double GLIMIT;
-	
-  };
-
-} //end of namespace bpp.
-
-#endif	//_ONEDIMENSIONOPTIMIZATIONTOOLS_H_
+  static double GLIMIT;
+};
+} // end of namespace bpp.
 
+#endif  // _ONEDIMENSIONOPTIMIZATIONTOOLS_H_
diff --git a/src/Bpp/Numeric/Function/ReparametrizationFunctionWrapper.cpp b/src/Bpp/Numeric/Function/ReparametrizationFunctionWrapper.cpp
index 620da3d..4b8753d 100644
--- a/src/Bpp/Numeric/Function/ReparametrizationFunctionWrapper.cpp
+++ b/src/Bpp/Numeric/Function/ReparametrizationFunctionWrapper.cpp
@@ -45,7 +45,7 @@ using namespace std;
 
 void ReparametrizationFunctionWrapper::init_(bool verbose)
 {
-  for (unsigned int i = 0; i < functionParameters_.size(); i++)
+  for (size_t i = 0; i < functionParameters_.size(); i++)
   {
     Parameter& p = functionParameters_[i];
     Constraint* constraint = p.getConstraint();
@@ -177,7 +177,7 @@ void ReparametrizationFunctionWrapper::fireParameterChanged(const ParameterList&
   // but that would implied a quick sort on parameter names (nlog(n))
   // whereas using a loop over the set is in o(n). It should hence be
   // more efficient in most cases.
-  for (unsigned int i = 0; i < getNumberOfParameters(); i++)
+  for (size_t i = 0; i < getNumberOfParameters(); ++i)
   {
     double x = dynamic_cast<TransformedParameter&>(getParameter_(i)).getOriginalValue();
     try
diff --git a/src/Bpp/Numeric/Function/ReparametrizationFunctionWrapper.h b/src/Bpp/Numeric/Function/ReparametrizationFunctionWrapper.h
index cc6ac1d..323b794 100644
--- a/src/Bpp/Numeric/Function/ReparametrizationFunctionWrapper.h
+++ b/src/Bpp/Numeric/Function/ReparametrizationFunctionWrapper.h
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
+Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
 
 This software is a computer program whose purpose is to provide classes
 for numerical calculus.
diff --git a/src/Bpp/Numeric/Function/ThreePointsNumericalDerivative.cpp b/src/Bpp/Numeric/Function/ThreePointsNumericalDerivative.cpp
index 732f9fd..341864c 100644
--- a/src/Bpp/Numeric/Function/ThreePointsNumericalDerivative.cpp
+++ b/src/Bpp/Numeric/Function/ThreePointsNumericalDerivative.cpp
@@ -47,26 +47,31 @@ throw (ParameterNotFoundException, ConstraintException)
 {
   if (computeD1_ && variables_.size() > 0)
   {
-    if (function1_) function1_->enableFirstOrderDerivatives(false);
-    if (function2_) function2_->enableSecondOrderDerivatives(false);
+    if (function1_)
+      function1_->enableFirstOrderDerivatives(false);
+    if (function2_)
+      function2_->enableSecondOrderDerivatives(false);
     function_->setParameters(parameters);
     f2_ = function_->getValue();
-    if ((abs(f2_) >= NumConstants::VERY_BIG()) || isnan(f2_)){
-      for (unsigned int i = 0; i < variables_.size(); i++){
-        der1_[i]=log(-1);
-        der2_[i]=log(-1);
+    if ((abs(f2_) >= NumConstants::VERY_BIG()) || isnan(f2_))
+    {
+      for (size_t i = 0; i < variables_.size(); ++i)
+      {
+        der1_[i] = log(-1);
+        der2_[i] = log(-1);
       }
       return;
     }
-      
+
     string lastVar;
     bool functionChanged = false;
     ParameterList p;
     bool start = true;
-    for (unsigned int i = 0; i < variables_.size(); i++)
+    for (size_t i = 0; i < variables_.size(); ++i)
     {
       string var = variables_[i];
-      if (!parameters.hasParameter(var)) continue;
+      if (!parameters.hasParameter(var))
+        continue;
       if (!start)
       {
         vector<string> vars(2);
@@ -83,91 +88,93 @@ throw (ParameterNotFoundException, ConstraintException)
       functionChanged = true;
       double value = function_->getParameterValue(var);
       double h = -(1. + std::abs(value)) * h_;
-      if (abs(h)<p[0].getPrecision())
-        h=h<0?-p[0].getPrecision():p[0].getPrecision();
+      if (abs(h) < p[0].getPrecision())
+        h = h < 0 ? -p[0].getPrecision() : p[0].getPrecision();
       double hf1(0), hf3(0);
-      unsigned int nbtry=0;
-      
-      //Compute f1_
-      while (hf1==0){
+      unsigned int nbtry = 0;
+
+      // Compute f1_
+      while (hf1 == 0)
+      {
         try
+        {
+          p[0].setValue(value + h);
+          function_->setParameters(p); // also reset previous parameter...
+
+          p = p.subList(0);
+          f1_ = function_->getValue();
+          if ((abs(f1_) >= NumConstants::VERY_BIG()) || isnan(f1_))
+            throw ConstraintException("f1_ too large", &p[0], f1_);
+          else
+            hf1 = h;
+        }
+        catch (ConstraintException& ce)
+        {
+          if (++nbtry == 10) // no possibility to compute derivatives
+            break;
+          else if (h < 0)
+            h = -h;  // try on the right
+          else
+            h /= -2;  // try again on the left with smaller interval
+        }
+      }
+
+      if (hf1 != 0)
+      {
+        // Compute f3_
+        if (h < 0)
+          h = -h;  // on the right
+        else
+          h /= 2;  //  on the left with smaller interval
+
+        nbtry = 0;
+        while (hf3 == 0)
+        {
+          try
           {
             p[0].setValue(value + h);
-            function_->setParameters(p); //also reset previous parameter...
-            
+            function_->setParameters(p); // also reset previous parameter...
+
             p = p.subList(0);
-            f1_ = function_->getValue();
-            if ((abs(f1_) >= NumConstants::VERY_BIG()) || isnan(f1_))
-              throw ConstraintException("f1_ too large", &p[0], f1_);
+            f3_ = function_->getValue();
+            if ((abs(f3_) >= NumConstants::VERY_BIG()) || isnan(f3_))
+              throw ConstraintException("f3_ too large", &p[0], f3_);
             else
-              hf1=h;
+              hf3 = h;
           }
-        catch (ConstraintException& ce)
+          catch (ConstraintException& ce)
           {
-            if (++nbtry==10) // no possibility to compute derivatives
+            if (++nbtry == 10) // no possibility to compute derivatives
               break;
+            else if (h < 0)
+              h = -h;  // try on the right
             else
-              if (h<0)
-                h=-h;  // try on the right
-              else
-                h/=-2; // try again on the left with smaller interval
+              h /= -2;  // try again on the left with smaller interval
           }
-      }
-
-      if (hf1!=0){
-        //Compute f3_ 
-        if (h<0)
-          h=-h;  // on the right 
-        else
-          h/=2; //  on the left with smaller interval
-
-        nbtry=0;
-        while (hf3==0){
-          try
-            {
-              p[0].setValue(value + h);
-              function_->setParameters(p); //also reset previous parameter...
-            
-              p = p.subList(0);
-              f3_ = function_->getValue();
-              if ((abs(f3_) >= NumConstants::VERY_BIG()) || isnan(f3_))
-                throw ConstraintException("f3_ too large", &p[0], f3_);
-              else
-                hf3=h;
-            }
-          catch (ConstraintException& ce)
-            {
-              if (++nbtry==10) // no possibility to compute derivatives
-                break;
-              else
-                if (h<0)
-                  h=-h;  // try on the right
-                else
-                  h/=-2; // try again on the left with smaller interval
-            }
         }
       }
-      
-      if (hf3==0){
-          der1_[i]=log(-1);
-          der2_[i]=log(-1);
+
+      if (hf3 == 0)
+      {
+        der1_[i] = log(-1);
+        der2_[i] = log(-1);
       }
-      else {
-        der1_[i] = (f1_ - f3_) / (hf1-hf3);
-        der2_[i] = ((f1_ - f2_)/hf1 - (f3_ - f2_)/hf3)*2/(hf1-hf3);
+      else
+      {
+        der1_[i] = (f1_ - f3_) / (hf1 - hf3);
+        der2_[i] = ((f1_ - f2_) / hf1 - (f3_ - f2_) / hf3) * 2 / (hf1 - hf3);
       }
     }
 
 
-    
-    
     if (computeCrossD2_)
     {
       string lastVar1, lastVar2;
       for (unsigned int i = 0; i < variables_.size(); i++)
       {
         string var1 = variables_[i];
-        if (!parameters.hasParameter(var1)) continue;
+        if (!parameters.hasParameter(var1))
+          continue;
         for (unsigned int j = 0; j < variables_.size(); j++)
         {
           if (j == i)
@@ -176,15 +183,18 @@ throw (ParameterNotFoundException, ConstraintException)
             continue;
           }
           string var2 = variables_[j];
-          if (!parameters.hasParameter(var2)) continue;
+          if (!parameters.hasParameter(var2))
+            continue;
 
           vector<string> vars(2);
           vars[0] = var1;
           vars[1] = var2;
           if (i > 0 && j > 0)
           {
-            if (lastVar1 != var1 && lastVar1 != var2) vars.push_back(lastVar1);
-            if (lastVar2 != var1 && lastVar2 != var2) vars.push_back(lastVar2);
+            if (lastVar1 != var1 && lastVar1 != var2)
+              vars.push_back(lastVar1);
+            if (lastVar2 != var1 && lastVar2 != var2)
+              vars.push_back(lastVar2);
           }
           p = parameters.subList(vars);
 
@@ -193,16 +203,16 @@ throw (ParameterNotFoundException, ConstraintException)
           double h1 = (1. + std::abs(value1)) * h_;
           double h2 = (1. + std::abs(value2)) * h_;
 
-          //Compute 4 additional points:
+          // Compute 4 additional points:
           try
           {
             p[0].setValue(value1 - h1);
             p[1].setValue(value2 - h2);
-            function_->setParameters(p); //also reset previous parameter...
+            function_->setParameters(p); // also reset previous parameter...
             vector<size_t> tmp(2);
             tmp[0] = 0;
             tmp[1] = 1;
-            p = p.subList(tmp); //removed the previous parameters.
+            p = p.subList(tmp); // removed the previous parameters.
             f11_ = function_->getValue();
 
             p[1].setValue(value2 + h2);
@@ -230,19 +240,23 @@ throw (ParameterNotFoundException, ConstraintException)
       }
     }
 
-    //Reset last parameter and compute analytical derivatives if any.
-    if (function1_) function1_->enableFirstOrderDerivatives(computeD1_);
-    if (function2_) function2_->enableSecondOrderDerivatives(computeD2_);
+    // Reset last parameter and compute analytical derivatives if any.
+    if (function1_)
+      function1_->enableFirstOrderDerivatives(computeD1_);
+    if (function2_)
+      function2_->enableSecondOrderDerivatives(computeD2_);
     if (functionChanged)
       function_->setParameters(parameters.subList(lastVar));
   }
   else
   {
-    //Reset initial value and compute analytical derivatives if any.
-    if (function1_) function1_->enableFirstOrderDerivatives(computeD1_);
-    if (function2_) function2_->enableSecondOrderDerivatives(computeD2_);
+    // Reset initial value and compute analytical derivatives if any.
+    if (function1_)
+      function1_->enableFirstOrderDerivatives(computeD1_);
+    if (function2_)
+      function2_->enableSecondOrderDerivatives(computeD2_);
     function_->setParameters(parameters);
-    //Just in case derivatives are not computed:
+    // Just in case derivatives are not computed:
     f2_ = function_->getValue();
   }
 }
diff --git a/src/Bpp/Numeric/Function/ThreePointsNumericalDerivative.h b/src/Bpp/Numeric/Function/ThreePointsNumericalDerivative.h
index 80a2bc1..e413494 100644
--- a/src/Bpp/Numeric/Function/ThreePointsNumericalDerivative.h
+++ b/src/Bpp/Numeric/Function/ThreePointsNumericalDerivative.h
@@ -5,37 +5,37 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for numerical calculus.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. CNRS, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide classes
+   for numerical calculus.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 #ifndef _THREEPOINTSNUMERICALDERIVATIVE_H_
 #define _THREEPOINTSNUMERICALDERIVATIVE_H_
@@ -43,14 +43,13 @@ knowledge of the CeCILL license and that you accept its terms.
 #include "Functions.h"
 #include "AbstractNumericalDerivative.h"
 
-//From the STL:
+// From the STL:
 #include <map>
 #include <vector>
 #include <string>
 
 namespace bpp
 {
-
 /**
  * @brief Three points numerical derivative function wrapper.
  *
@@ -62,7 +61,7 @@ namespace bpp
  * \dfrac{\partial   f}{\partial x  } &=& \dfrac{f_{+1}-f_{-1}}{2h}\\
  * \dfrac{\partial^2 f}{\partial x^2} &=& \dfrac{f_{+1}-2f_0+f_{-1}}{h^2}\\
  * @f}
- * In case of border limit (when @f$x_{-1}@f$ or @f$x_{+1}@f$ are not computable), 
+ * In case of border limit (when @f$x_{-1}@f$ or @f$x_{+1}@f$ are not computable),
  * the foreward and backward computations are performed, respectively:
  * @f{eqnarray*}
  * \dfrac{\partial   f}{\partial x  } &=& \dfrac{f_{+1}-f_0}{h}\\
@@ -82,37 +81,55 @@ namespace bpp
  *
  * @see AbstractNumericalDerivative
  */
-class ThreePointsNumericalDerivative:
+class ThreePointsNumericalDerivative :
   public AbstractNumericalDerivative
 {
-  private:
-    double f1_, f2_, f3_, f11_, f22_, f12_, f21_;
-    
-  public:
-    ThreePointsNumericalDerivative (Function* function) :
-      AbstractNumericalDerivative(function), f1_(), f2_(), f3_(), f11_(), f22_(), f12_(), f21_() {}
-    ThreePointsNumericalDerivative (DerivableFirstOrder * function) :
-      AbstractNumericalDerivative(function), f1_(), f2_(), f3_(), f11_(), f22_(), f12_(), f21_() {}
-    ThreePointsNumericalDerivative (DerivableSecondOrder * function) :
-      AbstractNumericalDerivative(function), f1_(), f2_(), f3_(), f11_(), f22_(), f12_(), f21_() {}
-    virtual ~ThreePointsNumericalDerivative() {}
-
-    ThreePointsNumericalDerivative* clone() const { return new ThreePointsNumericalDerivative(*this); }
-
-  public:
-    
-    double getValue() const throw (Exception)
-    {
-      return f2_;
-    }
-    
-  protected:
-    void updateDerivatives(const ParameterList parameters)
-      throw (ParameterNotFoundException, ConstraintException);
-    
+private:
+  double f1_, f2_, f3_, f11_, f22_, f12_, f21_;
+
+public:
+  ThreePointsNumericalDerivative (Function* function) :
+    AbstractNumericalDerivative(function),
+    f1_(),
+    f2_(),
+    f3_(),
+    f11_(),
+    f22_(),
+    f12_(),
+    f21_() {}
+  ThreePointsNumericalDerivative (DerivableFirstOrder* function) :
+    AbstractNumericalDerivative(function),
+    f1_(),
+    f2_(),
+    f3_(),
+    f11_(),
+    f22_(),
+    f12_(),
+    f21_() {}
+  ThreePointsNumericalDerivative (DerivableSecondOrder* function) :
+    AbstractNumericalDerivative(function),
+    f1_(),
+    f2_(),
+    f3_(),
+    f11_(),
+    f22_(),
+    f12_(),
+    f21_() {}
+  virtual ~ThreePointsNumericalDerivative() {}
+
+  ThreePointsNumericalDerivative* clone() const { return new ThreePointsNumericalDerivative(*this); }
+
+public:
+  double getValue() const throw (Exception)
+  {
+    return f2_;
+  }
+
+protected:
+  void updateDerivatives(const ParameterList parameters)
+  throw (ParameterNotFoundException, ConstraintException);
 };
+} // end of namespace bpp.
 
-} //end of namespace bpp.
-
-#endif //_THREEPOINTSNUMERICALDERIVATIVE_H_
+#endif // _THREEPOINTSNUMERICALDERIVATIVE_H_
 
diff --git a/src/Bpp/Numeric/Function/TwoPointsNumericalDerivative.cpp b/src/Bpp/Numeric/Function/TwoPointsNumericalDerivative.cpp
index 8970e59..295b7d7 100644
--- a/src/Bpp/Numeric/Function/TwoPointsNumericalDerivative.cpp
+++ b/src/Bpp/Numeric/Function/TwoPointsNumericalDerivative.cpp
@@ -47,8 +47,10 @@ throw (ParameterNotFoundException, ConstraintException)
 {
   if (computeD1_ && variables_.size() > 0)
   {
-    if (function1_) function1_->enableFirstOrderDerivatives(false);
-    if (function2_) function2_->enableSecondOrderDerivatives(false);
+    if (function1_)
+      function1_->enableFirstOrderDerivatives(false);
+    if (function2_)
+      function2_->enableSecondOrderDerivatives(false);
     function_->setParameters(parameters);
     f1_ = function_->getValue();
     string lastVar;
@@ -57,7 +59,8 @@ throw (ParameterNotFoundException, ConstraintException)
     for (unsigned int i = 0; i < variables_.size(); i++)
     {
       string var = variables_[i];
-      if (!parameters.hasParameter(var)) continue;
+      if (!parameters.hasParameter(var))
+        continue;
       ParameterList p;
       if (!start)
       {
@@ -77,7 +80,7 @@ throw (ParameterNotFoundException, ConstraintException)
       }
       double value = function_->getParameterValue(var);
       double h = (1 + std::abs(value)) * h_;
-      //Compute one other point:
+      // Compute one other point:
       try
       {
         p[0].setValue(value + h);
@@ -86,7 +89,7 @@ throw (ParameterNotFoundException, ConstraintException)
       }
       catch (ConstraintException& ce1)
       {
-        //Right limit raised, use backward approximation:
+        // Right limit raised, use backward approximation:
         try
         {
           p[0].setValue(value - h);
@@ -96,24 +99,27 @@ throw (ParameterNotFoundException, ConstraintException)
         }
         catch (ConstraintException& ce2)
         {
-          //PB: can't compute derivative, because of a two narrow interval (lower than h)
+          // PB: can't compute derivative, because of a two narrow interval (lower than h)
           throw ce2;
         }
       }
-      //No limit raised, use forward approximation:
+      // No limit raised, use forward approximation:
       der1_[i] = (f2_ - f1_) / h;
     }
-    //Reset last parameter and compute analytical derivatives if any:
-    if (function1_) function1_->enableFirstOrderDerivatives(computeD1_);
+    // Reset last parameter and compute analytical derivatives if any:
+    if (function1_)
+      function1_->enableFirstOrderDerivatives(computeD1_);
     if (functionChanged)
       function_->setParameters(parameters.subList(lastVar));
   }
   else
   {
-    //Reset initial value and compute analytical derivatives if any.
-    if (function1_) function1_->enableFirstOrderDerivatives(computeD1_);
-    if (function2_) function2_->enableSecondOrderDerivatives(computeD2_);
-    //Just in case derivatives are not computed:
+    // Reset initial value and compute analytical derivatives if any.
+    if (function1_)
+      function1_->enableFirstOrderDerivatives(computeD1_);
+    if (function2_)
+      function2_->enableSecondOrderDerivatives(computeD2_);
+    // Just in case derivatives are not computed:
     function_->setParameters(parameters);
     f1_ = function_->getValue();
   }
diff --git a/src/Bpp/Numeric/Function/TwoPointsNumericalDerivative.h b/src/Bpp/Numeric/Function/TwoPointsNumericalDerivative.h
index 9b236bc..c871606 100644
--- a/src/Bpp/Numeric/Function/TwoPointsNumericalDerivative.h
+++ b/src/Bpp/Numeric/Function/TwoPointsNumericalDerivative.h
@@ -5,37 +5,37 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for numerical calculus.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. CNRS, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide classes
+   for numerical calculus.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 #ifndef _TWOPOINTSNUMERICALDERIVATIVE_H_
 #define _TWOPOINTSNUMERICALDERIVATIVE_H_
@@ -43,14 +43,13 @@ knowledge of the CeCILL license and that you accept its terms.
 #include "Functions.h"
 #include "AbstractNumericalDerivative.h"
 
-//From the STL:
+// From the STL:
 #include <map>
 #include <vector>
 #include <string>
 
 namespace bpp
 {
-
 /**
  * @brief Two points numerical derivative function wrapper.
  *
@@ -72,50 +71,51 @@ namespace bpp
  *
  * @see AbstractNumericalDerivative, ThreePointsNumericalDerivative, FivePointsNumericalDerivative
  */
-class TwoPointsNumericalDerivative:
+class TwoPointsNumericalDerivative :
   public AbstractNumericalDerivative
 {
-  private:
-    double f1_, f2_;
-    
-  public:
-    TwoPointsNumericalDerivative(Function* function) :
-      AbstractNumericalDerivative(function), f1_(), f2_() {}
-    TwoPointsNumericalDerivative(DerivableFirstOrder* function) :
-      AbstractNumericalDerivative(function), f1_(), f2_() {}
-    virtual ~TwoPointsNumericalDerivative() {}
-
-    TwoPointsNumericalDerivative* clone() const { return new TwoPointsNumericalDerivative(*this); }
-
-  public:
-    
-    double getValue() const throw (Exception) { return f1_; }
-
-    /**
-     * @name The DerivableSecondOrder interface
-     *
-     * @{
-     */
-    double getSecondOrderDerivative(const std::string & variable) const
-      throw (Exception)
-    {
-      throw Exception("Second order derivative not avalaible with two points method."); 
-    }
-
-    double getSecondOrderDerivative(const std::string & variable1, const std::string & variable2) const
-      throw (Exception)
-    {
-      throw Exception("Unimplemented cross derivative.");
-    }
-    /** @} */
-    
-  protected:
-    void updateDerivatives(const ParameterList parameters)
-      throw (ParameterNotFoundException, ConstraintException);
-    
+private:
+  double f1_, f2_;
+
+public:
+  TwoPointsNumericalDerivative(Function* function) :
+    AbstractNumericalDerivative(function),
+    f1_(),
+    f2_() {}
+  TwoPointsNumericalDerivative(DerivableFirstOrder* function) :
+    AbstractNumericalDerivative(function),
+    f1_(),
+    f2_() {}
+  virtual ~TwoPointsNumericalDerivative() {}
+
+  TwoPointsNumericalDerivative* clone() const { return new TwoPointsNumericalDerivative(*this); }
+
+public:
+  double getValue() const throw (Exception) { return f1_; }
+
+  /**
+   * @name The DerivableSecondOrder interface
+   *
+   * @{
+   */
+  double getSecondOrderDerivative(const std::string& variable) const
+  throw (Exception)
+  {
+    throw Exception("Second order derivative not avalaible with two points method.");
+  }
+
+  double getSecondOrderDerivative(const std::string& variable1, const std::string& variable2) const
+  throw (Exception)
+  {
+    throw Exception("Unimplemented cross derivative.");
+  }
+  /** @} */
+
+protected:
+  void updateDerivatives(const ParameterList parameters)
+  throw (ParameterNotFoundException, ConstraintException);
 };
+} // end of namespace bpp.
 
-} //end of namespace bpp.
-
-#endif //_TWOPOINTSNUMERICALDERIVATIVE_H_
+#endif // _TWOPOINTSNUMERICALDERIVATIVE_H_
 
diff --git a/src/Bpp/App/BppApplication.cpp b/src/Bpp/Numeric/Hmm/AbstractHmmTransitionMatrix.cpp
similarity index 51%
copy from src/Bpp/App/BppApplication.cpp
copy to src/Bpp/Numeric/Hmm/AbstractHmmTransitionMatrix.cpp
index 5d10750..8362d12 100644
--- a/src/Bpp/App/BppApplication.cpp
+++ b/src/Bpp/Numeric/Hmm/AbstractHmmTransitionMatrix.cpp
@@ -1,14 +1,14 @@
 //
-// File: BppApplication.cpp
-// Created by: Julien Dutheil
-// Created on: Sat Aug 08 08:21 2009
+// File: AbstractHmmTransitionMatrix.cpp
+// Created by: Laurent Guéguen
+// Created on: lundi 10 février 2014, à 10h 59
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
+Copyright or © or Copr. Bio++Development Team, (November 16, 2004)
 
-This software is a computer program whose purpose is to provide basal and 
-utilitary classes. This file belongs to the Bio++ Project.
+This software is a computer program whose purpose is to provide classes
+for phylogenetic data analysis.
 
 This software is governed by the CeCILL  license under French law and
 abiding by the rules of distribution of free software.  You can  use, 
@@ -37,34 +37,48 @@ The fact that you are presently reading this means that you have had
 knowledge of the CeCILL license and that you accept its terms.
 */
 
-#include "BppApplication.h"
-#include "../Utils/AttributesTools.h"
-#include "ApplicationTools.h"
+#include "AbstractHmmTransitionMatrix.h"
 
-// From the STL:
-#include <iostream>
+#include "../Matrix/MatrixTools.h"
+#include "../VectorTools.h"
 
 using namespace bpp;
 using namespace std;
 
-BppApplication::BppApplication(int argc, char* argv[], const std::string& name): appName_(name), params_(), timerStarted_(false)
+AbstractHmmTransitionMatrix::AbstractHmmTransitionMatrix(const HmmStateAlphabet* alph, const string& prefix) :
+  alph_(alph),
+  pij_((size_t)alph->getNumberOfStates(), (size_t)alph->getNumberOfStates()),
+  tmpmat_((size_t)alph->getNumberOfStates(), (size_t)alph->getNumberOfStates()),
+  eqFreq_((size_t)alph->getNumberOfStates()),
+  upToDate_(false)
 {
-  cout << "Parsing options:" << endl;  
-  params_ = AttributesTools::parseOptions(argc, argv);
-  bool noint = ApplicationTools::getBooleanParameter("--noninteractive", params_, false, "", true, false);
-  ApplicationTools::interactive = !noint;
 }
 
-void BppApplication::startTimer()
+AbstractHmmTransitionMatrix::AbstractHmmTransitionMatrix(const AbstractHmmTransitionMatrix& hptm) :
+  alph_(hptm.alph_),
+  pij_(hptm.pij_),
+  tmpmat_(hptm.tmpmat_),
+  eqFreq_(hptm.eqFreq_),
+  upToDate_(hptm.upToDate_)
 {
-  ApplicationTools::startTimer();
-  timerStarted_ = true;
 }
 
-void BppApplication::done()
+AbstractHmmTransitionMatrix& AbstractHmmTransitionMatrix::operator=(const AbstractHmmTransitionMatrix& hptm)
 {
-  cout << appName_ << "'s done. Bye." << endl;
-  if (timerStarted_)
-    ApplicationTools::displayTime("Total execution time:");
+  alph_=hptm.alph_;
+  pij_=hptm.pij_;
+  tmpmat_=hptm.tmpmat_;
+  eqFreq_=hptm.eqFreq_;
+  upToDate_=hptm.upToDate_;
+  
+  return *this;
+}
+
+void AbstractHmmTransitionMatrix::setHmmStateAlphabet(const HmmStateAlphabet* stateAlphabet) throw (HmmUnvalidAlphabetException)
+{
+  if (stateAlphabet==NULL)
+    throw HmmUnvalidAlphabetException("Null alphabet in AbstractHmmTransitionMatrix::setHmmStateAlphabet");
+
+  alph_=stateAlphabet;
 }
 
diff --git a/src/Bpp/Numeric/Hmm/AbstractHmmTransitionMatrix.h b/src/Bpp/Numeric/Hmm/AbstractHmmTransitionMatrix.h
new file mode 100644
index 0000000..9e6dee3
--- /dev/null
+++ b/src/Bpp/Numeric/Hmm/AbstractHmmTransitionMatrix.h
@@ -0,0 +1,108 @@
+//
+// File: AbstractHmmTransitionMatrix.h
+// Created by: Laurent Guéguen
+// Created on: lundi 10 février 2014, à 10h 55
+//
+
+/*
+Copyright or © or Copr. Bio++Development Team, (November 16, 2004)
+
+This software is a computer program whose purpose is to provide classes
+for phylogenetic data analysis.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+*/
+
+#ifndef _ABSTRACTHMMTRANSITIONMATRIX_H_
+#define _ABSTRACTHMMTRANSITIONMATRIX_H_
+
+#include "HmmStateAlphabet.h"
+#include "HmmTransitionMatrix.h"
+
+#include "../VectorTools.h"
+
+namespace bpp
+{
+
+/**
+ * @brief Partial implementation of HmmTransitionMatrix.
+ *
+ */
+  
+class AbstractHmmTransitionMatrix:
+  public virtual HmmTransitionMatrix
+{
+private:
+  const HmmStateAlphabet* alph_;
+
+protected:
+  mutable RowMatrix<double> pij_, tmpmat_;
+
+  mutable Vdouble eqFreq_;
+
+  mutable bool upToDate_;
+  
+public:
+
+  AbstractHmmTransitionMatrix(const HmmStateAlphabet* alph, const std::string& prefix = "");
+
+  AbstractHmmTransitionMatrix(const AbstractHmmTransitionMatrix& hptm);
+
+  AbstractHmmTransitionMatrix& operator=(const AbstractHmmTransitionMatrix& hptm);
+
+  /**
+   * @return The hidden alphabet associated to this model.
+   */
+
+  const HmmStateAlphabet* getHmmStateAlphabet() const
+  {
+    return alph_;
+  }
+
+  /**
+   * @brief Set the new hidden state alphabet
+   * @param stateAlphabet The new state alphabet
+   * @throw UnvalidStateAlphabetException if the new alphabet is uncorrect (for instance is NULL pointer).
+   */
+  
+  void setHmmStateAlphabet(const HmmStateAlphabet* stateAlphabet) throw (HmmUnvalidAlphabetException);
+   
+  /**
+   * @return The number of states in the model.
+   */
+
+  size_t getNumberOfStates() const
+  {
+    return alph_->getNumberOfStates();
+  }
+
+};
+
+} //end of namespace bpp
+
+#endif //_ABSTRACTHMMTRANSITIONMATRIX_H_
+
diff --git a/src/Bpp/Numeric/Hmm/AutoCorrelationTransitionMatrix.cpp b/src/Bpp/Numeric/Hmm/AutoCorrelationTransitionMatrix.cpp
new file mode 100644
index 0000000..134eeb3
--- /dev/null
+++ b/src/Bpp/Numeric/Hmm/AutoCorrelationTransitionMatrix.cpp
@@ -0,0 +1,113 @@
+//
+// File: AutoCorrelationTransitionMatrix.cpp
+// Created by: Laurent Guéguen
+// Created on: lundi 10 février 2014, à 09h 56
+//
+
+/*
+Copyright or © or Copr. Bio++Development Team, (November 16, 2004)
+
+This software is a computer program whose purpose is to provide classes
+for phylogenetic data analysis.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+*/
+
+#include "AutoCorrelationTransitionMatrix.h"
+
+#include "../../Text/TextTools.h"
+
+#include "../Matrix/MatrixTools.h"
+#include "../VectorTools.h"
+
+using namespace bpp;
+using namespace std;
+
+AutoCorrelationTransitionMatrix::AutoCorrelationTransitionMatrix(const HmmStateAlphabet* alph, const string& prefix) :
+  AbstractHmmTransitionMatrix(alph),
+  AbstractParametrizable(prefix),
+  vAutocorrel_()
+{
+  size_t size=(size_t)getNumberOfStates();
+
+  for (size_t i=0; i<size; i++)
+    {
+      vAutocorrel_.push_back(1./(double)size);
+      addParameter_(new Parameter("lambda"+TextTools::toString(i+1), 1./(double)size, &Parameter::PROP_CONSTRAINT_EX));
+    }
+
+  for (size_t i = 0; i < size; i++)
+    eqFreq_[i] = 1./(double)size;
+}
+
+
+AutoCorrelationTransitionMatrix::AutoCorrelationTransitionMatrix(const AutoCorrelationTransitionMatrix& aptm) :
+  AbstractHmmTransitionMatrix(aptm),
+  AbstractParametrizable(aptm),
+  vAutocorrel_(aptm.vAutocorrel_)
+{
+}
+
+AutoCorrelationTransitionMatrix& AutoCorrelationTransitionMatrix::operator=(const AutoCorrelationTransitionMatrix& aptm)
+{
+  AbstractHmmTransitionMatrix::operator=(aptm);
+  AbstractParametrizable::operator=(aptm);
+  
+  vAutocorrel_=aptm.vAutocorrel_;
+  
+  return *this;
+}
+
+const Matrix<double>& AutoCorrelationTransitionMatrix::getPij() const
+ {
+   if (!upToDate_){
+     for (size_t i = 0; i < vAutocorrel_.size(); ++i)
+       for (size_t j = 0; j < vAutocorrel_.size(); ++j)
+         pij_(i,j) = (i==j) ? vAutocorrel_[i] : (1 - vAutocorrel_[i]) / static_cast<double>(getNumberOfStates()-1);
+
+     upToDate_ = true;
+   }
+   
+   return pij_;
+ }
+
+const std::vector<double>& AutoCorrelationTransitionMatrix::getEquilibriumFrequencies() const
+{
+  return eqFreq_;
+}
+
+void AutoCorrelationTransitionMatrix::fireParameterChanged(const ParameterList& parameters)
+{
+  size_t salph=getNumberOfStates();
+
+  for (size_t i=0; i< salph; i++)
+    vAutocorrel_[i]=getParameterValue("lambda"+TextTools::toString(i+1));
+  
+  upToDate_=false;
+}
+
+
diff --git a/src/Bpp/Numeric/Hmm/AutoCorrelationTransitionMatrix.h b/src/Bpp/Numeric/Hmm/AutoCorrelationTransitionMatrix.h
new file mode 100644
index 0000000..cb3ec80
--- /dev/null
+++ b/src/Bpp/Numeric/Hmm/AutoCorrelationTransitionMatrix.h
@@ -0,0 +1,118 @@
+//
+// File: AutoCorrelationTransitionMatrix.h
+// Created by: Laurent Guéguen
+// Created on: lundi 10 février 2014, à 09h 56
+//
+
+/*
+Copyright or © or Copr. Bio++Development Team, (November 16, 2004)
+
+This software is a computer program whose purpose is to provide classes
+for phylogenetic data analysis.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+*/
+
+#ifndef _AUTOCORRELATIONTRANSITIONMATRIX_H_
+#define _AUTOCORRELATIONTRANSITIONMATRIX_H_
+
+#include "AbstractHmmTransitionMatrix.h"
+
+#include "../AbstractParameterAliasable.h"
+
+namespace bpp
+{
+
+/**
+ * @brief Describe the auto-correlation probabilities inside hidden
+ *  states of a Hidden Markov Model. 
+ *
+ *  This modelling behaves like a HMM in which, from a given state,
+ * all transition probabilities to the other states are equal.
+ *
+ * The parameters are the within states transition probabilities,
+ * denoted as \c "lambaN" with N the number of the state (1 is the
+ * first).
+ */
+  
+class AutoCorrelationTransitionMatrix:
+  public virtual AbstractHmmTransitionMatrix,
+  public AbstractParametrizable
+{
+private:
+  std::vector<double> vAutocorrel_;
+
+public:
+
+  AutoCorrelationTransitionMatrix(const HmmStateAlphabet* alph, const std::string& prefix = "");
+
+  AutoCorrelationTransitionMatrix(const AutoCorrelationTransitionMatrix& hptm);
+
+  AutoCorrelationTransitionMatrix& operator=(const AutoCorrelationTransitionMatrix& hptm);
+
+  AutoCorrelationTransitionMatrix* clone() const { return new AutoCorrelationTransitionMatrix(*this);}
+
+  /**
+   * @brief Get the transition probability between two states.
+   *
+   * @param i initial state.
+   * @param j final state.
+   * @return the transition probability between the two states.
+   */
+  double Pij(size_t i, size_t j) const
+  {
+    return (i == j) ? vAutocorrel_[i] : (1 - vAutocorrel_[i]) / static_cast<double>(getNumberOfStates() - 1);
+  }
+
+  /**
+   * @brief Get all transition probabilities as a matrix.
+   *
+   * @return A n*n matrix will all transition probabilities (n being the number of hidden states).
+   */
+
+  const Matrix<double>& getPij() const;
+
+  /**
+   * @return The vector of equilibrium frequencies of the Markov chain described by the matrix.
+   */
+
+  const std::vector<double>& getEquilibriumFrequencies() const;
+
+
+  /*
+   * @brief From AbstractParametrizable interface
+   *
+   */
+
+  void fireParameterChanged(const ParameterList& parameters);
+  
+};
+
+} //end of namespace bpp
+
+#endif //_AUTOCORRELATIONTRANSITIONMATRIX_H_
+
diff --git a/src/Bpp/Numeric/Hmm/FullHmmTransitionMatrix.cpp b/src/Bpp/Numeric/Hmm/FullHmmTransitionMatrix.cpp
new file mode 100644
index 0000000..23f057c
--- /dev/null
+++ b/src/Bpp/Numeric/Hmm/FullHmmTransitionMatrix.cpp
@@ -0,0 +1,155 @@
+//
+// File: FullHmmTransitionMatrix.cpp
+// Created by: Laurent Guéguen
+// Created on: samedi 21 septembre 2013, à 14h 43
+//
+
+/*
+Copyright or © or Copr. Bio++Development Team, (November 16, 2004)
+
+This software is a computer program whose purpose is to provide classes
+for phylogenetic data analysis.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+*/
+
+#include "FullHmmTransitionMatrix.h"
+
+#include "../../Text/TextTools.h"
+
+#include "../Matrix/MatrixTools.h"
+#include "../VectorTools.h"
+
+using namespace bpp;
+using namespace std;
+
+FullHmmTransitionMatrix::FullHmmTransitionMatrix(const HmmStateAlphabet* alph, const string& prefix) :
+  AbstractHmmTransitionMatrix(alph),
+  AbstractParametrizable(prefix),
+  vSimplex_()
+{
+  size_t size=(size_t)getNumberOfStates();
+
+  for (size_t i=0; i<size; i++)
+    {
+      vSimplex_.push_back(Simplex(size,1));
+      ParameterList pl=vSimplex_[i].getParameters();
+      for (size_t j=0; j<pl.size(); j++)
+        {
+          Parameter* p=pl[j].clone();
+          p->setName(TextTools::toString(i+1)+"."+p->getName());
+          addParameter_(p);
+        }
+    }
+}
+
+FullHmmTransitionMatrix::FullHmmTransitionMatrix(const FullHmmTransitionMatrix& hptm) :
+  AbstractHmmTransitionMatrix(hptm),
+  AbstractParametrizable(hptm),
+  vSimplex_(hptm.vSimplex_)
+{
+}
+
+FullHmmTransitionMatrix& FullHmmTransitionMatrix::operator=(const FullHmmTransitionMatrix& hptm)
+{
+  AbstractHmmTransitionMatrix::operator=(hptm);
+  AbstractParametrizable::operator=(hptm);
+  
+  return *this;
+}
+
+void FullHmmTransitionMatrix::setTransitionProbabilities(const Matrix<double>& mat)
+{
+  if (mat.getNumberOfRows()!=vSimplex_.size())
+    throw BadSizeException("FullHmmTransitionMatrix::setTransitionProbabilities: Wrong number of rows in given Matrix", mat.getNumberOfRows(), vSimplex_.size());
+  
+  ParameterList pl;
+  
+  for (size_t i=0; i<mat.getNumberOfRows();i++)
+  {
+    vSimplex_[i].setFrequencies(mat.row(i));
+    ParameterList pls=vSimplex_[i].getParameters();
+    for (size_t j=0; j<pls.size(); j++)
+    {
+      Parameter* p=pls[j].clone();
+      p->setName(TextTools::toString(i+1)+"."+p->getName());
+      pl.addParameter(p);
+    }
+  }
+  
+  matchParametersValues(pl);
+}
+
+
+const Matrix<double>& FullHmmTransitionMatrix::getPij() const
+ {
+   if (!upToDate_){
+     for (size_t i=0; i<vSimplex_.size(); i++)
+       for (size_t j=0; j<vSimplex_[i].dimension(); j++)
+         pij_(i,j)=vSimplex_[i].prob(j);
+     upToDate_=true;
+   }
+   
+   return pij_;
+ }
+
+const std::vector<double>& FullHmmTransitionMatrix::getEquilibriumFrequencies() const
+{
+  size_t salph=getNumberOfStates();
+  
+  if (!upToDate_){
+    pij_=getPij();
+
+    MatrixTools::pow(pij_, 256, tmpmat_);
+
+    for (size_t i = 0; i < salph; i++)
+      eqFreq_[i] = tmpmat_(0,i);
+    
+    upToDate_=true;
+  }
+
+  return eqFreq_;
+}
+
+void FullHmmTransitionMatrix::fireParameterChanged(const ParameterList& parameters)
+{
+  size_t salph=getNumberOfStates();
+
+  for (size_t i=0; i< salph; i++)
+  {
+    ParameterList pl=vSimplex_[i].getParameters();
+
+    for (size_t j=0; j<pl.size(); j++)
+      pl[j].setValue(getParameterValue(TextTools::toString(i+1)+"."+pl[j].getName()));
+
+    vSimplex_[i].matchParametersValues(pl);
+  }
+  
+  upToDate_=false;
+}
+
+
diff --git a/src/Bpp/Numeric/Hmm/FullHmmTransitionMatrix.h b/src/Bpp/Numeric/Hmm/FullHmmTransitionMatrix.h
new file mode 100644
index 0000000..f0d4aca
--- /dev/null
+++ b/src/Bpp/Numeric/Hmm/FullHmmTransitionMatrix.h
@@ -0,0 +1,130 @@
+//
+// File: FullHmmTransitionMatrix.h
+// Created by: Laurent Guéguen
+// Created on: samedi 21 septembre 2013, à 00h 41
+//
+
+/*
+Copyright or © or Copr. Bio++Development Team, (November 16, 2004)
+
+This software is a computer program whose purpose is to provide classes
+for phylogenetic data analysis.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+*/
+
+#ifndef _FULLHMMTRANSITIONMATRIX_H_
+#define _FULLHMMTRANSITIONMATRIX_H_
+
+#include "../Prob/Simplex.h"
+
+#include "AbstractHmmTransitionMatrix.h"
+
+#include "../AbstractParameterAliasable.h"
+
+namespace bpp
+{
+
+/**
+ * @brief Describe the transition probabilities between hidden states of a Hidden Markov Model.
+ *
+ *
+ * Transition probabilities are described through simplexes.
+ *
+ *
+ * Parameters are denoted \c "I.Simplex.thetaJ" where \c I is the line number
+ * of the transition matrix, and \c "thetaJ" is the matching parameter
+ * in the Ith Simplex. 
+ *
+ * @see Simplex
+ */
+  
+class FullHmmTransitionMatrix:
+  public virtual AbstractHmmTransitionMatrix,
+  public AbstractParametrizable
+{
+private:
+  std::vector<Simplex> vSimplex_;
+
+public:
+
+  FullHmmTransitionMatrix(const HmmStateAlphabet* alph, const std::string& prefix = "");
+
+  FullHmmTransitionMatrix(const FullHmmTransitionMatrix& hptm);
+
+  FullHmmTransitionMatrix& operator=(const FullHmmTransitionMatrix& hptm);
+
+  FullHmmTransitionMatrix* clone() const { return new FullHmmTransitionMatrix(*this);}
+
+  /**
+   * @brief Set the matrix of the transition probabilities.
+   *
+   */
+  
+  void setTransitionProbabilities(const Matrix<double>& mat);
+  
+  /**
+   * @brief Get the transition probability between two states.
+   *
+   * @param i initial state.
+   * @param j final state.
+   * @return the transition probability between the two states.
+   */
+
+  double Pij(size_t i, size_t j) const
+  {
+    return vSimplex_[i].prob(j);
+  }
+
+  /**
+   * @brief Get all transition probabilities as a matrix.
+   *
+   * @return A n*n matrix will all transition probabilities (n being the number of hidden states).
+   */
+
+  const Matrix<double>& getPij() const;
+
+  /**
+   * @return The vector of equilibrium frequencies of the Markov chain described by the matrix.
+   */
+
+  const std::vector<double>& getEquilibriumFrequencies() const;
+
+
+  /*
+   * @brief From AbstractParametrizable interface
+   *
+   */
+
+  void fireParameterChanged(const ParameterList& parameters);
+  
+};
+
+} //end of namespace bpp
+
+#endif //_FULLHMMTRANSITIONMATRIX_H_
+
diff --git a/src/Bpp/Numeric/Hmm/HmmEmissionProbabilities.h b/src/Bpp/Numeric/Hmm/HmmEmissionProbabilities.h
index 5f8efeb..970c662 100644
--- a/src/Bpp/Numeric/Hmm/HmmEmissionProbabilities.h
+++ b/src/Bpp/Numeric/Hmm/HmmEmissionProbabilities.h
@@ -5,36 +5,36 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for phylogenetic data analysis.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for phylogenetic data analysis.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _HMMEMISSIONPROBABILITIES_H_
@@ -61,9 +61,9 @@ namespace bpp
  * @see HmmStateAlphabet
  * @see HmmTransitionMatrix
  */
-class HmmEmissionProbabilities:
-  public virtual Parametrizable
-{
+  class HmmEmissionProbabilities:
+    public virtual Parametrizable
+  {
   public:
     virtual HmmEmissionProbabilities* clone() const = 0;
 
@@ -77,31 +77,6 @@ class HmmEmissionProbabilities:
     virtual void setHmmStateAlphabet(const HmmStateAlphabet* stateAlphabet) throw (HmmUnvalidAlphabetException) = 0;
 
     /**
-     * @name Access emission probabilities per site.
-     *
-     * This functions are handy, but might not be the most efficient way to retrieve the probabilities.
-     * @{
-     */
-   
-    /**
-     * @param pos The position of the sequential data to consider.
-     * @param stateIndex The index of the hidden state to consider, as defined by the HmmStateAlphabet object associated to this class.
-     */
-    virtual double getEmissionProbability(size_t pos, size_t stateIndex) const throw (Exception) = 0;
-    virtual void getEmissionProbabilities(size_t pos, std::vector<double>& probs) const throw (Exception) = 0;
-    virtual void getEmissionProbabilitiesForEachPosition(std::vector< std::vector<double> >& probs, bool append) const throw (Exception) = 0;
-    
-    /**
-     * @param pos The position of the sequential data to consider.
-     * @param stateIndex The index of the hidden state to consider, as defined by the HmmStateAlphabet object associated to this class.
-     */
-    virtual double getLogEmissionProbability(size_t pos, size_t stateIndex) const throw (Exception) = 0;
-    virtual void getLogEmissionProbabilities(size_t pos, std::vector<double>& probs) const throw (Exception) = 0;
-    virtual void getLogEmissionProbabilitiesForEachPosition(std::vector< std::vector<double> >& probs, bool append) const throw (Exception) = 0;
-
-    /**@} */
-
-    /**
      * @brief Operator access to the emission probabilities.
      *
      * This is the fastest way to get the values, but no checking is performed on the indices.
@@ -110,8 +85,29 @@ class HmmEmissionProbabilities:
      * @param pos The position of the sequential data to consider.
      * @param state The index of the hidden state to consider, as defined by the HmmStateAlphabet object associated to this class.
      */
+  
     virtual double operator()(size_t pos, size_t state) const = 0;
 
+    virtual void computeDEmissionProbabilities(std::string& variable) const
+    {
+      throw (NotImplementedException("HmmEmissionProbabilities::computeDEmissionProbabilities is not overdefined."));
+    }
+  
+    virtual void computeD2EmissionProbabilities(std::string& variable) const
+    {
+      throw (NotImplementedException("HmmEmissionProbabilities::computeD2EmissionProbabilities is not overdefined."));
+    }
+  
+    virtual const std::vector<double>& getDEmissionProbabilities(size_t pos) const
+    {
+      throw (NotImplementedException("HmmEmissionProbabilities::getDEmissionProbability is not overdefined."));
+    }
+  
+    virtual const std::vector<double>& getD2EmissionProbabilities(size_t pos) const
+    {
+      throw (NotImplementedException("HmmEmissionProbabilities::getD2EmissionProbability is not overdefined."));
+    }
+  
     /**
      * @brief Operator access to the emission probabilities.
      *
@@ -127,26 +123,7 @@ class HmmEmissionProbabilities:
      * @return The number of positions in the data.
      */
     virtual size_t getNumberOfPositions() const = 0;
-
-    /**
-     * @brief Get the index of a given state in the list of observed states.
-     * The indexing if up to the implementation of this interface.
-     * 
-     * @param pos The position of the observed state in the original sequence.
-     * @return The index of the observed state in the list.
-     */
-    virtual size_t getObservedStateIndex(size_t pos) const = 0;
-    
-    /**
-     * @brief Get all emission probabilities, in a compressed form.
-     *
-     * @return a 2-dimensions array E[i,j], where i is the index of the observed states (@see getObservedStateIndex), and j in the index of the hidden state.
-     * @param probs a 2-dimensional array which is going to be resized and filled with the emission probabilities.
-     */
-    virtual void getEmissionProbabilities(std::vector< std::vector<double> >& probs) const = 0;
-
-
-};
+  };
 
 } //end of namespace bpp.
 
diff --git a/src/Bpp/Numeric/Hmm/HmmLikelihood.cpp b/src/Bpp/Numeric/Hmm/HmmLikelihood.cpp
new file mode 100644
index 0000000..da9acb7
--- /dev/null
+++ b/src/Bpp/Numeric/Hmm/HmmLikelihood.cpp
@@ -0,0 +1,90 @@
+//
+// File: HmmLikelihood.cpp
+// Created by: Laurent Guéguen
+// Created on: jeudi 26 septembre 2013, à 13h 55
+//
+
+/*
+  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for phylogenetic data analysis.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
+*/
+
+#include "HmmLikelihood.h"
+
+using namespace bpp;
+using namespace std;
+
+AbstractHmmLikelihood::AbstractHmmLikelihood() :
+  dLogLik_(0),
+  dVariable_(""),
+  d2LogLik_(0),
+  d2Variable_("") {}
+
+AbstractHmmLikelihood::AbstractHmmLikelihood(const AbstractHmmLikelihood& adhlik) :
+  dLogLik_(adhlik.dLogLik_),
+  dVariable_(adhlik.dVariable_),
+  d2LogLik_(adhlik.d2LogLik_),
+  d2Variable_(adhlik.d2Variable_)
+{}
+
+AbstractHmmLikelihood& AbstractHmmLikelihood::operator=(const AbstractHmmLikelihood& adhlik)
+{
+  dLogLik_=adhlik.dLogLik_;
+  dVariable_=adhlik.dVariable_;
+  d2LogLik_=adhlik.d2LogLik_;
+  d2Variable_=adhlik.d2Variable_;
+
+  return *this;
+}
+
+double AbstractHmmLikelihood::getFirstOrderDerivative(const std::string& variable) const throw (Exception)
+{
+  if (variable!=dVariable_){
+    dVariable_=variable;
+    
+    getHmmEmissionProbabilities().computeDEmissionProbabilities(dVariable_);
+    computeDLikelihood_();
+  }
+  return -dLogLik_;
+  
+}
+    
+double AbstractHmmLikelihood::getSecondOrderDerivative(const std::string& variable) const throw (Exception)
+{
+  if (variable!=d2Variable_){
+    d2Variable_=variable;
+
+    getHmmEmissionProbabilities().computeD2EmissionProbabilities(d2Variable_);
+    computeD2Likelihood_();
+  }
+  return -d2LogLik_;
+}
+
diff --git a/src/Bpp/Numeric/Hmm/HmmLikelihood.h b/src/Bpp/Numeric/Hmm/HmmLikelihood.h
index 20bf4a1..7306ecc 100644
--- a/src/Bpp/Numeric/Hmm/HmmLikelihood.h
+++ b/src/Bpp/Numeric/Hmm/HmmLikelihood.h
@@ -5,36 +5,36 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for phylogenetic data analysis.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for phylogenetic data analysis.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _HMMLIKELIHOOD_H_
@@ -43,6 +43,8 @@ knowledge of the CeCILL license and that you accept its terms.
 
 // From NumCalc:
 #include "../Function/Functions.h"
+#include "../VectorTools.h"
+
 #include "HmmStateAlphabet.h"
 #include "HmmTransitionMatrix.h"
 #include "HmmEmissionProbabilities.h"
@@ -50,30 +52,31 @@ knowledge of the CeCILL license and that you accept its terms.
 namespace bpp
 {
 
-/**
- * @brief Basal interface for Hidden Markov Models likelihood computation.
- *
- * HmmLikelihood classes compute the probability of data according to parameters (likelihood),
- * using the so-called forward recursion:
- *
- * - Initialisation: @f[ f_0({\cal A}_0), \ldots, f_0({\cal A}_n) @f] The initial frequencies, set to the equilibrium frequencies of the chain.
- * - Recursion (for i=1 to l, the length of the sequence data): @f[ f_i({\cal A}_y) = e_y(D_i) \sum_{x=1}^n f_{i-1}({\cal A}_x) \cdot p_{x,y} @f]
- * - Termination: @f[ \Pr(D) = \sum_{x=1}^n f_l({\cal A}_x) @f]
- * where @f$ {\cal A}_{1..n} @f$ denotes the hidden states of the alphabet, @f$ e_y(D_i) @f$ the
- * probability of the data at position i conditioned on hidden state y (emission probabilities)
- * and @f$ p_{x,y} @f$ is the probability of havving hidden state y at state i+1 knowing there
- * is hidden state x at position i (transition probabilities). These essential elements are given
- * respectively by the HmmEmissionProbabilities and HmmTransitionMatrix object associated to this
- * class. Both objects have to share the same HmmStateAlphabet instance, which describes all
- * allowed hidden states.
- *
- * The HmmLikelihood interface provides essentially two major methods:
- * - A method to retrieve the likelihood value (parameter estimation)
- * - Two methods to retrieve the posterio probabilities of each state using the forward and backward conditionnal likelihoods (posterior decoding).
- */
-class HmmLikelihood:
-  public virtual Function
-{
+  /**
+   * @brief Basal interface for Hidden Markov Models likelihood computation.
+   *
+   * HmmLikelihood classes compute the probability of data according to parameters (likelihood),
+   * using the so-called forward recursion:
+   *
+   * - Initialisation: @f[ f_0({\cal A}_0), \ldots, f_0({\cal A}_n) @f] The initial frequencies, set to the equilibrium frequencies of the chain.
+   * - Recursion (for i=1 to l, the length of the sequence data): @f[ f_i({\cal A}_y) = e_y(D_i) \sum_{x=1}^n f_{i-1}({\cal A}_x) \cdot p_{x,y} @f]
+   * - Termination: @f[ \Pr(D) = \sum_{x=1}^n f_l({\cal A}_x) @f]
+   * where @f$ {\cal A}_{1..n} @f$ denotes the hidden states of the alphabet, @f$ e_y(D_i) @f$ the
+   * probability of the data at position i conditioned on hidden state y (emission probabilities)
+   * and @f$ p_{x,y} @f$ is the probability of havving hidden state y at state i+1 knowing there
+   * is hidden state x at position i (transition probabilities). These essential elements are given
+   * respectively by the HmmEmissionProbabilities and HmmTransitionMatrix object associated to this
+   * class. Both objects have to share the same HmmStateAlphabet instance, which describes all
+   * allowed hidden states.
+   *
+   * The HmmLikelihood interface provides essentially two major methods:
+   * - A method to retrieve the likelihood value (parameter estimation)
+   * - Two methods to retrieve the posterio probabilities of each state using the forward and backward conditionnal likelihoods (posterior decoding).
+   */
+  
+  class HmmLikelihood:
+    public virtual DerivableSecondOrder
+  {
   public:
 
 #ifndef NO_VIRTUAL_COV
@@ -90,13 +93,118 @@ class HmmLikelihood:
     virtual HmmEmissionProbabilities& getHmmEmissionProbabilities() = 0;
 
     virtual void getHiddenStatesPosteriorProbabilities(std::vector< std::vector<double> >& probs, bool append) const throw (Exception) = 0;
-    
+
+    virtual Vdouble getHiddenStatesPosteriorProbabilitiesForASite(size_t site) const = 0;
+
     virtual double getLogLikelihood() const = 0;
-    
+
+    virtual double getDLogLikelihood() const = 0;
+
+    virtual double getD2LogLikelihood() const = 0;
+
+  /**
+     * @brief Get the likelihood for a site.
+     *
+     * @param site The site index to analyse.
+     * @return The likelihood for site <i>site</i>.
+     */
+  
+    virtual double getLikelihoodForASite(size_t site) const = 0;
+
+    /**
+     * @brief Get the likelihood for each site.
+     *
+     * @return A vector with all likelihoods for each site.
+     */
+    virtual Vdouble getLikelihoodForEachSite() const = 0;
+
     virtual const std::vector<size_t>& getBreakPoints() const = 0;
+
     virtual void setBreakPoints(const std::vector<size_t>& breakPoints) = 0;
-     
-};
+
+  protected:
+
+    virtual void computeDLikelihood_() const = 0;
+
+    virtual void computeD2Likelihood_() const = 0;
+
+  };
+
+
+  /*
+   * @brief partial impmementation of Hmm Likelihoods.
+   *
+   */
+  
+  class AbstractHmmLikelihood:
+    public virtual HmmLikelihood
+  {
+  protected:
+    
+    mutable double dLogLik_;
+    mutable std::string dVariable_;
+
+    mutable double d2LogLik_;
+    mutable std::string d2Variable_;
+
+  public:
+    AbstractHmmLikelihood();
+    
+    AbstractHmmLikelihood(const AbstractHmmLikelihood& adhlik);
+
+    AbstractHmmLikelihood& operator=(const AbstractHmmLikelihood& adhlik);
+
+    /* @{
+     *
+     * @brief From FirstOrder:
+     *
+     */
+
+    void enableFirstOrderDerivatives(bool yn) {};
+    
+    bool enableFirstOrderDerivatives() const { return true;}
+
+    double getFirstOrderDerivative(const std::string& variable) const throw (Exception);
+
+    double getDLogLikelihood() const
+    {
+      return dLogLik_;
+    }
+
+    /*
+     * @}
+     *
+     */
+
+    /* @{
+     *
+     * @brief From SecondOrder:
+     *
+     */
+
+    void enableSecondOrderDerivatives(bool yn) {};
+    
+    bool enableSecondOrderDerivatives() const {return true;}
+
+    double getSecondOrderDerivative(const std::string& variable) const throw (Exception);
+  
+    double getD2LogLikelihood() const
+    {
+      return d2LogLik_;
+    }
+
+    double getSecondOrderDerivative(const std::string& variable1, const std::string& variable2) const throw (Exception) {
+      throw (NotImplementedException("AbstractHmmLikelihood::getSecondOrderDerivative is not defined for 2 variables."));
+    }
+    
+    /*
+     * @}
+     *
+     */
+
+  
+  };
+
 
 } //end of namespace bpp.
 
diff --git a/src/Bpp/Numeric/Hmm/HmmStateAlphabet.h b/src/Bpp/Numeric/Hmm/HmmStateAlphabet.h
index 15e30f9..40442a6 100644
--- a/src/Bpp/Numeric/Hmm/HmmStateAlphabet.h
+++ b/src/Bpp/Numeric/Hmm/HmmStateAlphabet.h
@@ -5,36 +5,36 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 16, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for phylogenetic data analysis.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for phylogenetic data analysis.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _HMMSTATEALPHABET_H_
@@ -62,64 +62,58 @@ namespace bpp {
   class HmmStateAlphabet:
     public virtual Parametrizable
   {
-    public:
-      HmmStateAlphabet() {}
-      virtual ~HmmStateAlphabet() {}
-
-    public:
-      /**
-       * @param stateIndex The index of a hidden state.
-       * @return The corresponding hidden state.
-       * @see getNumberOfStates
-       */
-      virtual const Clonable& getState(unsigned int stateIndex) const throw (HmmBadStateException) = 0;
-
-      /**
-       * @param stateIndex The index of a hidden state.
-       * @return The corresponding hidden state.
-       * @see getNumberOfStates
-       */
-      virtual Clonable& getState(unsigned int stateIndex) throw (HmmBadStateException) = 0;
-
-      virtual unsigned int getNumberOfStates() const = 0;
-
-      /**
-       * @brief Tell if this instance can work with the instance of alphabet given as input.
-       *
-       * In many case, this will return true is the pointer provided as argument refers to this object.
-       *
-       * @param stateAlphabet The alphabet to check.
-       * @return true if the matrix is compatible with the given alphabet.
-       */
-      virtual bool worksWith(const HmmStateAlphabet* stateAlphabet) const = 0;
+  public:
+    HmmStateAlphabet() {}
+    virtual ~HmmStateAlphabet() {}
+
+  public:
+    /**
+     * @param stateIndex The index of a hidden state.
+     * @return The corresponding hidden state.
+     * @see getNumberOfStates
+     */
+    virtual const Clonable& getState(size_t stateIndex) const throw (HmmBadStateException) = 0;
+
+
+    virtual size_t getNumberOfStates() const = 0;
+
+    /**
+     * @brief Tell if this instance can work with the instance of alphabet given as input.
+     *
+     * In many case, this will return true is the pointer provided as argument refers to this object.
+     *
+     * @param stateAlphabet The alphabet to check.
+     * @return true if the matrix is compatible with the given alphabet.
+     */
+    virtual bool worksWith(const HmmStateAlphabet* stateAlphabet) const = 0;
  
   };
 
   class StateListener
   {
-    public:
-      StateListener() {}
-      virtual ~StateListener() {}
+  public:
+    StateListener() {}
+    virtual ~StateListener() {}
 
-    public:
-      virtual void stateChanged(StateChangedEvent& event) = 0;
+  public:
+    virtual void stateChanged(StateChangedEvent& event) = 0;
   };
 
   class StateChangedEvent
   {
-    protected:
-      std::vector<unsigned int> states_;
+  protected:
+    std::vector<unsigned int> states_;
 
-    public:
-      StateChangedEvent(unsigned int stateIndex): states_(1)
+  public:
+    StateChangedEvent(unsigned int stateIndex): states_(1)
     {
       states_[0] = stateIndex;
     }
-      StateChangedEvent(std::vector<unsigned int>& states): states_(states) {}
+    StateChangedEvent(std::vector<unsigned int>& states): states_(states) {}
 
-    public:
-      const std::vector<unsigned int>& getStates() const { return states_; }
-      std::vector<unsigned int>& getStates() { return states_; }
+  public:
+    const std::vector<unsigned int>& getStates() const { return states_; }
+    std::vector<unsigned int>& getStates() { return states_; }
 
   };
 
diff --git a/src/Bpp/Numeric/Hmm/HmmTransitionMatrix.h b/src/Bpp/Numeric/Hmm/HmmTransitionMatrix.h
index 72ddd80..34ab889 100644
--- a/src/Bpp/Numeric/Hmm/HmmTransitionMatrix.h
+++ b/src/Bpp/Numeric/Hmm/HmmTransitionMatrix.h
@@ -5,36 +5,36 @@
 //
 
 /*
-Copyright or © or Copr. Bio++Development Team, (November 16, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for phylogenetic data analysis.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. Bio++Development Team, (November 16, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for phylogenetic data analysis.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _HMMTRANSITIONMATRIX_H_
@@ -56,14 +56,15 @@ namespace bpp
  *
  * This class is part of the HMM framework.
  */
-class HmmTransitionMatrix:
-  public virtual Parametrizable
-{
+  class HmmTransitionMatrix:
+    public virtual Parametrizable
+  {
   public:
 
     /**
      * @return The hidden alphabet associated to this model.
      */
+
     virtual const HmmStateAlphabet* getHmmStateAlphabet() const = 0;
 
     /**
@@ -76,7 +77,7 @@ class HmmTransitionMatrix:
     /**
      * @return The number of states in the model.
      */
-    virtual unsigned int getNumberOfStates() const = 0;
+    virtual size_t getNumberOfStates() const = 0;
 
     /**
      * @brief Get the transition probability between two states.
@@ -85,7 +86,7 @@ class HmmTransitionMatrix:
      * @param j final state.
      * @return the transition probability between the two states.
      */
-    virtual double Pij(unsigned int i, unsigned int j) const = 0;
+    virtual double Pij(size_t i, size_t j) const = 0;
 
     /**
      * @brief Get all transition probabilities as a matrix.
@@ -99,7 +100,7 @@ class HmmTransitionMatrix:
      */
     virtual const std::vector<double>& getEquilibriumFrequencies() const = 0;
 
-};
+  };
 
 } //end of namespace bpp
 
diff --git a/src/Bpp/Numeric/Hmm/LogsumHmmLikelihood.cpp b/src/Bpp/Numeric/Hmm/LogsumHmmLikelihood.cpp
index a8aa7fd..3540f34 100644
--- a/src/Bpp/Numeric/Hmm/LogsumHmmLikelihood.cpp
+++ b/src/Bpp/Numeric/Hmm/LogsumHmmLikelihood.cpp
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 16, 2004)
+Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
 
 This software is a computer program whose purpose is to provide classes
 for phylogenetic data analysis.
@@ -50,6 +50,7 @@ LogsumHmmLikelihood::LogsumHmmLikelihood(
     HmmTransitionMatrix* transitionMatrix,
     HmmEmissionProbabilities* emissionProbabilities,
     const std::string& prefix) throw (Exception):
+  AbstractHmmLikelihood(),
   AbstractParametrizable(prefix),
   hiddenAlphabet_(hiddenAlphabet),
   transitionMatrix_(transitionMatrix),
@@ -57,6 +58,12 @@ LogsumHmmLikelihood::LogsumHmmLikelihood(
   logLikelihood_(),
   partialLogLikelihoods_(),
   logLik_(),
+  dLogLikelihood_(),
+  partialDLogLikelihoods_(),
+  d2LogLikelihood_(),
+  partialD2LogLikelihoods_(),
+  backLogLikelihood_(),
+  backLogLikelihoodUpToDate_(false),
   breakPoints_(),
   nbStates_(),
   nbSites_()
@@ -85,6 +92,9 @@ LogsumHmmLikelihood::LogsumHmmLikelihood(
 
 void LogsumHmmLikelihood::fireParameterChanged(const ParameterList& pl)
 {
+  dVariable_="";
+  d2Variable_="";
+
   bool alphabetChanged    = hiddenAlphabet_->matchParametersValues(pl);
   bool transitionsChanged = transitionMatrix_->matchParametersValues(pl);
   bool emissionChanged    = emissionProbabilities_->matchParametersValues(pl);
@@ -95,6 +105,7 @@ void LogsumHmmLikelihood::fireParameterChanged(const ParameterList& pl)
   if (alphabetChanged && !emissionChanged) emissionProbabilities_->setParametersValues(emissionProbabilities_->getParameters());
   
   computeForward_();
+  backLogLikelihoodUpToDate_=false;
 }
 
 /***************************************************************************************************************************/
@@ -109,15 +120,17 @@ void LogsumHmmLikelihood::computeForward_()
   {
     size_t ii = i * nbStates_;
     for (size_t j = 0; j < nbStates_; j++)
-      logTrans[ii + j] = log(transitionMatrix_->Pij(static_cast<int>(j), static_cast<int>(i)));
+      logTrans[ii + j] = log(transitionMatrix_->Pij(j, i));
   }
 
   //Initialisation:
   const vector<double>* emissions = &(*emissionProbabilities_)(0);
+  
   for (size_t j = 0; j < nbStates_; j++)
   {
     size_t jj = j * nbStates_;
     x = logTrans[jj] + log(transitionMatrix_->getEquilibriumFrequencies()[0]);
+    
     for (size_t k = 1; k < nbStates_; k++)
     {
       a = logTrans[k + jj] + log(transitionMatrix_->getEquilibriumFrequencies()[k]);
@@ -175,9 +188,10 @@ void LogsumHmmLikelihood::computeForward_()
       else nextBrkPt = nbSites_;
     }
   }
+
   //Termination:
   double tmpLog = logLikelihood_[(nbSites_ - 1) * nbStates_];
-  for (unsigned int k = 1; k < nbStates_; k++)
+  for (size_t k = 1; k < nbStates_; k++)
     tmpLog = NumTools::logsum(tmpLog, logLikelihood_[(nbSites_ - 1) * nbStates_ + k]);
   partialLogLikelihoods_.push_back(tmpLog);
   
@@ -191,13 +205,15 @@ void LogsumHmmLikelihood::computeForward_()
 
 /***************************************************************************************************************************/
 
-void LogsumHmmLikelihood::computeBackward_(std::vector< std::vector<double> >& b) const
+void LogsumHmmLikelihood::computeBackward_() const
 {
-  b.resize(nbSites_);
-  for (size_t i = 0; i < nbSites_; i++)
+  if (backLogLikelihood_.size()==0)
   {
-    b[i].resize(nbStates_);
+    backLogLikelihood_.resize(nbSites_);
+    for (size_t i=0;i<nbSites_;i++)
+      backLogLikelihood_[i].resize(nbStates_);
   }
+  
   double x;
 
   //Transition probabilities:
@@ -206,7 +222,7 @@ void LogsumHmmLikelihood::computeBackward_(std::vector< std::vector<double> >& b
   {
     size_t ii = i * nbStates_;
     for (size_t j = 0; j < nbStates_; j++)
-      logTrans[ii + j] = log(transitionMatrix_->Pij(static_cast<int>(i), static_cast<int>(j)));
+      logTrans[ii + j] = log(transitionMatrix_->Pij(i, j));
   }
 
 
@@ -218,7 +234,7 @@ void LogsumHmmLikelihood::computeBackward_(std::vector< std::vector<double> >& b
   
   for (size_t k = 0; k < nbStates_; k++)
   {
-    b[nbSites_ - 1][k] = 0.;
+    backLogLikelihood_[nbSites_ - 1][k] = 0.;
   }
 
   //Recursion:
@@ -230,29 +246,87 @@ void LogsumHmmLikelihood::computeBackward_(std::vector< std::vector<double> >& b
       for (size_t j = 0; j < nbStates_; j++)
       {
         size_t jj = j * nbStates_;
-        x = log((*emissions)[0]) + logTrans[jj] + b[i][0];
+        x = log((*emissions)[0]) + logTrans[jj] + backLogLikelihood_[i][0];
         for (size_t k = 1; k < nbStates_; k++)
         {
-          x = NumTools::logsum(x, log((*emissions)[k]) + logTrans[jj + k] + b[i][k]);
+          x = NumTools::logsum(x, log((*emissions)[k]) + logTrans[jj + k] + backLogLikelihood_[i][k]);
         }
-        b[i - 1][j] = x;
+        backLogLikelihood_[i - 1][j] = x;
       }    
     }
     else //Reset markov chain
     {
       for (unsigned int j = 0; j < nbStates_; j++)
       {
-        b[i - 1][j] = 0.;
+        backLogLikelihood_[i - 1][j] = 0.;
       }    
       bpIt++;
       if (bpIt != breakPoints_.rend()) nextBrkPt = *bpIt;
       else nextBrkPt = 0;
     }
   }
+
+  backLogLikelihoodUpToDate_=true;
 }
 
+
 /***************************************************************************************************************************/
 
+double LogsumHmmLikelihood::getLikelihoodForASite(size_t site) const
+{
+  Vdouble probs=getHiddenStatesPosteriorProbabilitiesForASite(site);
+  double x=0;
+  for (size_t i=0;i<nbStates_;i++)
+    x+=probs[i]*(*emissionProbabilities_)(site,i);
+
+  return x;
+}
+
+Vdouble LogsumHmmLikelihood::getLikelihoodForEachSite() const
+{
+  std::vector< std::vector<double> > vv;
+  getHiddenStatesPosteriorProbabilities(vv);
+
+  Vdouble ret(nbSites_);
+  for (size_t i=0;i<nbSites_;i++)
+  {
+    ret[i]=0;
+    for (size_t j=0;j<nbStates_;j++)
+      ret[i]+=vv[i][j]*(*emissionProbabilities_)(i,j);
+  }
+
+  return ret;
+}
+
+
+/***************************************************************************************************************************/
+
+Vdouble LogsumHmmLikelihood::getHiddenStatesPosteriorProbabilitiesForASite(size_t site) const
+{
+  if (!backLogLikelihoodUpToDate_)
+    computeBackward_();
+
+  Vdouble probs(nbStates_);
+  
+  vector<size_t>::const_iterator bpIt = breakPoints_.begin();
+  vector<double>::const_iterator logLikIt = partialLogLikelihoods_.begin();
+  while (bpIt != breakPoints_.end())
+  {
+    if (site>=(*bpIt))
+      logLikIt++;
+    else
+      break;
+    bpIt++;
+  }
+
+  for (size_t j = 0; j < nbStates_; j++)
+  {
+    probs[j] = exp(logLikelihood_[site * nbStates_ + j] + backLogLikelihood_[site][j] - *logLikIt);
+  }
+
+  return probs;
+}
+
 void LogsumHmmLikelihood::getHiddenStatesPosteriorProbabilities(std::vector< std::vector<double> >& probs, bool append) const throw (Exception)
 {
   size_t offset = append ? probs.size() : 0;
@@ -262,8 +336,8 @@ void LogsumHmmLikelihood::getHiddenStatesPosteriorProbabilities(std::vector< std
     probs[offset + i].resize(nbStates_);
   }
 
-  vector< vector<double> > logB;
-  computeBackward_(logB);
+  if (!backLogLikelihoodUpToDate_)
+    computeBackward_();
  
   size_t nextBrkPt = nbSites_; //next break point
   vector<size_t>::const_iterator bpIt = breakPoints_.begin();
@@ -282,10 +356,229 @@ void LogsumHmmLikelihood::getHiddenStatesPosteriorProbabilities(std::vector< std
     size_t ii = i * nbStates_;
     for (size_t j = 0; j < nbStates_; j++)
     {
-      probs[offset + i][j] = exp(logLikelihood_[ii + j] + logB[i][j] - *logLikIt);
+      probs[offset + i][j] = exp(logLikelihood_[ii + j] + backLogLikelihood_[i][j] - *logLikIt);
+    }
+  }
+}
+
+/***************************************************************************************************************************/
+
+void LogsumHmmLikelihood::computeDForward_() const
+{
+  //Init arrays:
+  if (dLogLikelihood_.size()==0){
+    dLogLikelihood_.resize(nbSites_);
+    for (size_t i=0;i<nbSites_;i++)
+      dLogLikelihood_[i].resize(nbStates_);
+  }
+
+  partialDLogLikelihoods_.clear();
+
+  double x;
+
+  vector<double> num(nbStates_);
+
+  //Transition probabilities:
+  const ColMatrix<double> trans(transitionMatrix_->getPij());
+
+  //Initialisation:
+  const vector<double>* emissions = &(*emissionProbabilities_)(0);
+  const vector<double>* dEmissions = &emissionProbabilities_->getDEmissionProbabilities(0);
+  
+  for (size_t j = 0; j < nbStates_; j++)
+    dLogLikelihood_[0][j] = (*dEmissions)[j] / (*emissions)[j];
+
+  //Recursion:
+  size_t nextBrkPt = nbSites_; //next break point
+  vector<size_t>::const_iterator bpIt = breakPoints_.begin();
+  if (bpIt != breakPoints_.end()) nextBrkPt = *bpIt;
+  partialDLogLikelihoods_.clear();
+ 
+  for (size_t i = 1; i < nbSites_; i++)
+  {
+    size_t iip = (i - 1) * nbStates_;
+
+    emissions = &(*emissionProbabilities_)(i);
+    dEmissions = &emissionProbabilities_->getDEmissionProbabilities(i);
+
+    if (i < nextBrkPt)
+    {
+      for (size_t j = 0; j < nbStates_; j++)
+      {
+        x=(*dEmissions)[j]/(*emissions)[j];
+
+        for (size_t k = 0; k < nbStates_; k++)
+        {
+          for (size_t kp = 0; kp < nbStates_; kp++)
+            num[kp]=logLikelihood_[iip+kp]-logLikelihood_[iip+k];
+
+          x+=dLogLikelihood_[i-1][k]*trans(k,j)/VectorTools::sumExp(num,trans.getCol(j));
+        }
+        
+        dLogLikelihood_[i][j] = x;
+      }
+    }      
+    else //Reset markov chain:
+    {
+      //Termination of previous segment
+      x = 0;
+      for (size_t k = 0; k < nbStates_; k++)
+      {
+        for (size_t kp = 0; kp < nbStates_; kp++)
+          num[kp]=logLikelihood_[iip+kp]-logLikelihood_[iip+k];
+        
+        x += dLogLikelihood_[i-1][k] / VectorTools::sumExp(num);
+      }
+          
+      partialDLogLikelihoods_.push_back(x);
+
+      for (size_t j = 0; j < nbStates_; j++)
+        dLogLikelihood_[i][j] = (*dEmissions)[j] / (*emissions)[j];
+      
+      bpIt++;
+      if (bpIt != breakPoints_.end())
+        nextBrkPt = *bpIt;
+      else
+        nextBrkPt = nbSites_;
     }
   }
+  
+  //Termination:
+  x=0;
+  for (size_t k = 0; k < nbStates_; k++)
+  {
+    for (size_t kp = 0; kp < nbStates_; kp++)
+      num[kp]=logLikelihood_[nbStates_*(nbSites_-1)+kp]-logLikelihood_[nbStates_*(nbSites_-1)+k];
+            
+    x += dLogLikelihood_[nbSites_-1][k] / VectorTools::sumExp(num);
+  }
+          
+  partialDLogLikelihoods_.push_back(x);
+  
+  //Compute dLogLikelihood
+  
+  dLogLik_ = 0;
+  vector<double> copy = partialDLogLikelihoods_; //We need to keep the original order for posterior decoding.
+  sort(copy.begin(), copy.end());
+  for (size_t i = copy.size(); i > 0; --i)
+    dLogLik_ += copy[i - 1];
 }
 
 /***************************************************************************************************************************/
 
+void LogsumHmmLikelihood::computeD2Forward_() const
+{
+  // Make sure that Dlikelihoods are correctly computed
+  getFirstOrderDerivative(d2Variable_);
+  
+  //Init arrays:
+  if (d2LogLikelihood_.size()==0){
+    d2LogLikelihood_.resize(nbSites_);
+    for (size_t i=0;i<nbSites_;i++)
+      d2LogLikelihood_[i].resize(nbStates_);
+  }
+
+  partialD2LogLikelihoods_.clear();
+  
+  double x, z, snum;
+
+  vector<double> num(nbStates_);
+  
+  //Transition probabilities:
+  const ColMatrix<double> trans(transitionMatrix_->getPij());
+  
+  //Initialisation:
+  const vector<double>* emissions = &(*emissionProbabilities_)(0);
+  const vector<double>* dEmissions = &emissionProbabilities_->getDEmissionProbabilities(0);
+  const vector<double>* d2Emissions = &emissionProbabilities_->getD2EmissionProbabilities(0);
+  
+  for (size_t j = 0; j < nbStates_; j++)
+    d2LogLikelihood_[0][j] = (*d2Emissions)[j] / (*emissions)[j] - pow((*dEmissions)[j] / (*emissions)[j],2);
+
+  //Recursion:
+  size_t nextBrkPt = nbSites_; //next break point
+  vector<size_t>::const_iterator bpIt = breakPoints_.begin();
+  if (bpIt != breakPoints_.end()) nextBrkPt = *bpIt;
+  partialDLogLikelihoods_.clear();
+ 
+  for (size_t i = 1; i < nbSites_; i++)
+  {
+    size_t iip = (i - 1) * nbStates_;
+
+    emissions = &(*emissionProbabilities_)(i);
+    dEmissions = &emissionProbabilities_->getDEmissionProbabilities(i);
+    d2Emissions = &emissionProbabilities_->getD2EmissionProbabilities(i);
+
+    if (i < nextBrkPt)
+    {
+      for (size_t j = 0; j < nbStates_; j++)
+      {
+        x=(*d2Emissions)[j] / (*emissions)[j] - pow((*dEmissions)[j] / (*emissions)[j],2);
+
+        for (size_t k = 0; k < nbStates_; k++)
+        {
+          for (size_t kp = 0; kp < nbStates_; kp++)
+            num[kp]=logLikelihood_[iip+kp]-logLikelihood_[iip+k];
+          snum=VectorTools::sumExp(num,trans.getCol(j));
+
+          
+          z=d2LogLikelihood_[i-1][k]+pow(dLogLikelihood_[i-1][k],2)
+            - dLogLikelihood_[i-1][k] * VectorTools::sumExp(num, trans.getCol(j) * dLogLikelihood_[i-1])/snum;
+
+          x += z * trans(k,j) / snum;
+        }
+
+        d2LogLikelihood_[i][j] = x;
+      }
+    }
+    else //Reset markov chain:
+    {
+      x=0;
+      
+      //Termination of previous segment:
+      for (size_t k = 1; k < nbStates_; k++)
+      {
+        for (size_t kp = 0; kp < nbStates_; kp++)
+          num[kp]=logLikelihood_[iip+kp]-logLikelihood_[iip+k];
+        
+        snum=VectorTools::sumExp(num);
+        
+        x += (d2LogLikelihood_[i-1][k]+pow(dLogLikelihood_[i-1][k],2)
+              - dLogLikelihood_[i-1][k] * VectorTools::sumExp(num, dLogLikelihood_[i-1])/snum)/snum;
+      }
+      
+      partialD2LogLikelihoods_.push_back(x);
+      
+      for (size_t j = 0; j < nbStates_; j++)
+        d2LogLikelihood_[i][j] = (*d2Emissions)[j] / (*emissions)[j] - pow((*dEmissions)[j] / (*emissions)[j],2);
+
+      
+      bpIt++;
+      if (bpIt != breakPoints_.end()) nextBrkPt = *bpIt;
+      else nextBrkPt = nbSites_;
+    }
+  }  
+
+  //Termination:
+  x=0;
+  for (size_t k = 0; k < nbStates_; k++)
+  {
+    for (size_t kp = 0; kp < nbStates_; kp++)
+      num[kp]=logLikelihood_[nbStates_*(nbSites_-1)+kp]-logLikelihood_[nbStates_*(nbSites_-1)+k];
+    
+    snum=VectorTools::sumExp(num);
+    
+    x += (d2LogLikelihood_[nbSites_-1][k]+pow(dLogLikelihood_[nbSites_-1][k],2)
+          - dLogLikelihood_[nbSites_-1][k] * VectorTools::sumExp(num, dLogLikelihood_[nbSites_-1])/snum)/snum;
+  }
+
+  partialD2LogLikelihoods_.push_back(x);
+  
+  //Compute dLogLikelihood
+  
+  d2LogLik_ = 0;
+  vector<double> copy = partialD2LogLikelihoods_; //We need to keep the original order for posterior decoding.
+  sort(copy.begin(), copy.end());
+  for (size_t i = copy.size(); i > 0; --i)
+    d2LogLik_ += copy[i - 1];
+}
diff --git a/src/Bpp/Numeric/Hmm/LogsumHmmLikelihood.h b/src/Bpp/Numeric/Hmm/LogsumHmmLikelihood.h
index 5501d85..b896044 100644
--- a/src/Bpp/Numeric/Hmm/LogsumHmmLikelihood.h
+++ b/src/Bpp/Numeric/Hmm/LogsumHmmLikelihood.h
@@ -5,36 +5,36 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for phylogenetic data analysis.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. Bio++ Development Team, (November 16, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for phylogenetic data analysis.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _LOGSUMHMMLIKELIHOOD_H_
@@ -63,124 +63,187 @@ namespace bpp {
    * @see RescaledHmmLikelihood
    */
   class LogsumHmmLikelihood:
-    public virtual HmmLikelihood,
+    public virtual AbstractHmmLikelihood,
     public AbstractParametrizable
   {
-    private:
-      /**
-       * @brief The alphabet describing the hidden states.
-       */
-      std::auto_ptr<HmmStateAlphabet> hiddenAlphabet_;
-      std::auto_ptr<HmmTransitionMatrix> transitionMatrix_;
-      std::auto_ptr<HmmEmissionProbabilities> emissionProbabilities_;
-
-      /**
-       * @brief The likelihood array.
-       *
-       * logLikelihood_[i * nbStates_ + j] corresponds to Pr(x1...xi, yi=j),
-       * where the x are the observed states, and y the hidden states.
-       */
-      std::vector<double> logLikelihood_;
-      std::vector<double> partialLogLikelihoods_;
-      double logLik_;
-
-      std::vector<size_t> breakPoints_;
-
-      size_t nbStates_, nbSites_;
-
-    public:
-      /**
-       * @brief Build a new LogsumHmmLikelihood object.
-       *
-       * @warning the HmmTransitionMatrix and HmmEmissionProbabilities object passed as argument must be non-null
-       * and point toward the same HmmStateAlphabet instance. The three object will be copied if needed, and
-       * deleted when the hmm likelihood objet is deleted. You should secure a copy before if you don't want them to
-       * be destroyed with this object.
-       */
-      LogsumHmmLikelihood(
-          HmmStateAlphabet* hiddenAlphabet,
-          HmmTransitionMatrix* transitionMatrix,
-          HmmEmissionProbabilities* emissionProbabilities,
-          const std::string& prefix) throw (Exception);
-
-      LogsumHmmLikelihood(const LogsumHmmLikelihood& lik):
-        AbstractParametrizable(lik),
-        hiddenAlphabet_(dynamic_cast<HmmStateAlphabet*>(lik.hiddenAlphabet_->clone())),
-        transitionMatrix_(dynamic_cast<HmmTransitionMatrix*>(lik.transitionMatrix_->clone())),
-        emissionProbabilities_(dynamic_cast<HmmEmissionProbabilities*>(lik.emissionProbabilities_->clone())),
-        logLikelihood_(lik.logLikelihood_),
-        partialLogLikelihoods_(lik.partialLogLikelihoods_),
-        logLik_(lik.logLik_),
-        breakPoints_(lik.breakPoints_),
-        nbStates_(lik.nbStates_),
-        nbSites_(lik.nbSites_)
-      {
-        // Now adjust pointers:
-        transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_.get());
-        emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_.get());
-      }
-
-      LogsumHmmLikelihood& operator=(const LogsumHmmLikelihood& lik)
-      {
-        AbstractParametrizable::operator =(lik);
-        hiddenAlphabet_        = std::auto_ptr<HmmStateAlphabet>(dynamic_cast<HmmStateAlphabet*>(lik.hiddenAlphabet_->clone()));
-        transitionMatrix_      = std::auto_ptr<HmmTransitionMatrix>(dynamic_cast<HmmTransitionMatrix*>(lik.transitionMatrix_->clone()));
-        emissionProbabilities_ = std::auto_ptr<HmmEmissionProbabilities>(dynamic_cast<HmmEmissionProbabilities*>(lik.emissionProbabilities_->clone()));
-        logLikelihood_         = lik.logLikelihood_;
-        partialLogLikelihoods_ = lik.partialLogLikelihoods_;
-        logLik_                = lik.logLik_;
-        breakPoints_           = lik.breakPoints_;
-        nbStates_              = lik.nbStates_;
-        nbSites_               = lik.nbSites_;
-
-        // Now adjust pointers:
-        transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_.get());
-        emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_.get());
-        return *this;
-      }
-
-      virtual ~LogsumHmmLikelihood() {}
+  protected:
+    /**
+     * @brief The alphabet describing the hidden states.
+     */
+    std::auto_ptr<HmmStateAlphabet> hiddenAlphabet_;
+    std::auto_ptr<HmmTransitionMatrix> transitionMatrix_;
+    std::auto_ptr<HmmEmissionProbabilities> emissionProbabilities_;
+
+    /**
+     * @brief The likelihood array.
+     *
+     * logLikelihood_[i * nbStates_ + j] corresponds to log(Pr(x1...xi, yi=j)),
+     * where the x are the observed states, and y the hidden states.
+     */
+    std::vector<double> logLikelihood_;
+    std::vector<double> partialLogLikelihoods_;
+    double logLik_;
+
+    /**
+     * @brief The DLogLikelihood arrays.
+     *
+     * dLogLikelihood_[i][j] corresponds to d(log(Pr(x1...xi, yi=j))),
+     * where the x are the observed states, and y the hidden states.
+     *
+     * d2LogLikelihood_[i][j] corresponds to d2(log(Pr(x1...xi, yi=j))),
+     * where the x are the observed states, and y the hidden states.
+     *
+     */
+
+    mutable std::vector< std::vector<double> > dLogLikelihood_;
+    mutable std::vector<double> partialDLogLikelihoods_;
+
+    mutable std::vector< std::vector<double> > d2LogLikelihood_;
+    mutable std::vector<double> partialD2LogLikelihoods_;
+
+    /**
+     * @brief backward logLikelihood
+     *
+     * backLogLikelihood_[i][j] corresponds to log(Pr(x_i+1...x_n | yi=j)),
+     * where the x are the observed states, and y the hidden states.
+     */
+
+    mutable std::vector<std::vector<double> > backLogLikelihood_;
+    mutable bool backLogLikelihoodUpToDate_;
+
+    std::vector<size_t> breakPoints_;
+
+    size_t nbStates_, nbSites_;
+
+  public:
+    /**
+     * @brief Build a new LogsumHmmLikelihood object.
+     *
+     * @warning the HmmTransitionMatrix and HmmEmissionProbabilities object passed as argument must be non-null
+     * and point toward the same HmmStateAlphabet instance. The three object will be copied if needed, and
+     * deleted when the hmm likelihood objet is deleted. You should secure a copy before if you don't want them to
+     * be destroyed with this object.
+     */
+    LogsumHmmLikelihood(
+                        HmmStateAlphabet* hiddenAlphabet,
+                        HmmTransitionMatrix* transitionMatrix,
+                        HmmEmissionProbabilities* emissionProbabilities,
+                        const std::string& prefix) throw (Exception);
+
+    LogsumHmmLikelihood(const LogsumHmmLikelihood& lik):
+    AbstractHmmLikelihood(lik),
+    AbstractParametrizable(lik),
+    hiddenAlphabet_(dynamic_cast<HmmStateAlphabet*>(lik.hiddenAlphabet_->clone())),
+    transitionMatrix_(dynamic_cast<HmmTransitionMatrix*>(lik.transitionMatrix_->clone())),
+    emissionProbabilities_(dynamic_cast<HmmEmissionProbabilities*>(lik.emissionProbabilities_->clone())),
+    logLikelihood_(lik.logLikelihood_),
+    partialLogLikelihoods_(lik.partialLogLikelihoods_),
+    logLik_(lik.logLik_),
+    dLogLikelihood_(lik.dLogLikelihood_),
+    partialDLogLikelihoods_(lik.partialDLogLikelihoods_),
+    d2LogLikelihood_(lik.d2LogLikelihood_),
+    partialD2LogLikelihoods_(lik.partialD2LogLikelihoods_),
+    backLogLikelihood_(lik.backLogLikelihood_),
+    backLogLikelihoodUpToDate_(lik.backLogLikelihoodUpToDate_),
+    breakPoints_(lik.breakPoints_),
+    nbStates_(lik.nbStates_),
+    nbSites_(lik.nbSites_)
+    {
+      // Now adjust pointers:
+      transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_.get());
+      emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_.get());
+    }
+
+    LogsumHmmLikelihood& operator=(const LogsumHmmLikelihood& lik)
+    {
+      AbstractHmmLikelihood::operator=(lik);
+      AbstractParametrizable::operator =(lik);
+      hiddenAlphabet_        = std::auto_ptr<HmmStateAlphabet>(dynamic_cast<HmmStateAlphabet*>(lik.hiddenAlphabet_->clone()));
+      transitionMatrix_      = std::auto_ptr<HmmTransitionMatrix>(dynamic_cast<HmmTransitionMatrix*>(lik.transitionMatrix_->clone()));
+      emissionProbabilities_ = std::auto_ptr<HmmEmissionProbabilities>(dynamic_cast<HmmEmissionProbabilities*>(lik.emissionProbabilities_->clone()));
+      logLikelihood_         = lik.logLikelihood_;
+      partialLogLikelihoods_ = lik.partialLogLikelihoods_;
+      dLogLikelihood_        = lik.dLogLikelihood_;
+      partialDLogLikelihoods_= lik.partialDLogLikelihoods_;
+      d2LogLikelihood_       = lik.d2LogLikelihood_;      
+      partialD2LogLikelihoods_  = lik.partialD2LogLikelihoods_;
+      backLogLikelihood_     = lik.backLogLikelihood_;
+      backLogLikelihoodUpToDate_= lik.backLogLikelihoodUpToDate_;
+      logLik_                = lik.logLik_;
+      breakPoints_           = lik.breakPoints_;
+      nbStates_              = lik.nbStates_;
+      nbSites_               = lik.nbSites_;
+
+      // Now adjust pointers:
+      transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_.get());
+      emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_.get());
+      return *this;
+    }
+
+    virtual ~LogsumHmmLikelihood() {}
 
 #ifndef NO_VIRTUAL_COV
-      LogsumHmmLikelihood*
+    LogsumHmmLikelihood*
 #else
-      Clonable*
+    Clonable*
 #endif
-      clone() const { return new LogsumHmmLikelihood(*this); }
+    clone() const { return new LogsumHmmLikelihood(*this); }
 
-    public:
-      const HmmStateAlphabet& getHmmStateAlphabet() const { return *hiddenAlphabet_; }
-      HmmStateAlphabet& getHmmStateAlphabet() { return *hiddenAlphabet_; }
+  public:
+    const HmmStateAlphabet& getHmmStateAlphabet() const { return *hiddenAlphabet_; }
+    HmmStateAlphabet& getHmmStateAlphabet() { return *hiddenAlphabet_; }
 
-      const HmmTransitionMatrix& getHmmTransitionMatrix() const { return *transitionMatrix_; }
-      HmmTransitionMatrix& getHmmTransitionMatrix() { return *transitionMatrix_; }
+    const HmmTransitionMatrix& getHmmTransitionMatrix() const { return *transitionMatrix_; }
+    HmmTransitionMatrix& getHmmTransitionMatrix() { return *transitionMatrix_; }
 
-      const HmmEmissionProbabilities& getHmmEmissionProbabilities() const { return *emissionProbabilities_; }
-      HmmEmissionProbabilities& getHmmEmissionProbabilities() { return *emissionProbabilities_; }
+    const HmmEmissionProbabilities& getHmmEmissionProbabilities() const { return *emissionProbabilities_; }
+    HmmEmissionProbabilities& getHmmEmissionProbabilities() { return *emissionProbabilities_; }
 
-      void setBreakPoints(const std::vector<size_t>& breakPoints) {
-        breakPoints_ = breakPoints;
-        computeForward_();
-      }
+    void setBreakPoints(const std::vector<size_t>& breakPoints) {
+      breakPoints_ = breakPoints;
+      computeForward_();
+      backLogLikelihoodUpToDate_=false;
+    }
 
-      const std::vector<size_t>& getBreakPoints() const { return breakPoints_; }
+    const std::vector<size_t>& getBreakPoints() const { return breakPoints_; }
 
-      void setParameters(const ParameterList& pl) throw (Exception)
-      {
-        setParametersValues(pl);
-      }
+    void setParameters(const ParameterList& pl) throw (Exception)
+    {
+      setParametersValues(pl);
+    }
 
-      double getValue() const throw (Exception) { return -logLik_; }
+    double getValue() const throw (Exception) { return -logLik_; }
 
-      double getLogLikelihood() const { return logLik_; }
+    double getLogLikelihood() const { return logLik_; }
 
-      void fireParameterChanged(const ParameterList& pl);
+    double getLikelihoodForASite(size_t site) const;
 
-      void getHiddenStatesPosteriorProbabilities(std::vector< std::vector<double> >& probs, bool append = false) const throw (Exception);
+    Vdouble getLikelihoodForEachSite() const;
 
-    protected:
-      void computeForward_();
-      void computeBackward_(std::vector< std::vector<double> >& b) const;
+    virtual void fireParameterChanged(const ParameterList& pl);
+    
+    Vdouble getHiddenStatesPosteriorProbabilitiesForASite(size_t site) const;
+
+    void getHiddenStatesPosteriorProbabilities(std::vector< std::vector<double> >& probs, bool append = false) const throw (Exception);
+
+  protected:
+    void computeForward_();
+    void computeBackward_() const;
+
+    void computeDLikelihood_() const
+    {
+      computeDForward_();
+    }
+
+    void computeD2Likelihood_() const
+    {
+      computeD2Forward_();
+    }
+    
+    void computeDForward_() const;
+    
+    void computeD2Forward_() const;
+    
 
   };
 
diff --git a/src/Bpp/Numeric/Hmm/LowMemoryRescaledHmmLikelihood.cpp b/src/Bpp/Numeric/Hmm/LowMemoryRescaledHmmLikelihood.cpp
index 6caf388..21639b8 100644
--- a/src/Bpp/Numeric/Hmm/LowMemoryRescaledHmmLikelihood.cpp
+++ b/src/Bpp/Numeric/Hmm/LowMemoryRescaledHmmLikelihood.cpp
@@ -51,6 +51,7 @@ LowMemoryRescaledHmmLikelihood::LowMemoryRescaledHmmLikelihood(
   HmmEmissionProbabilities* emissionProbabilities,
   const std::string& prefix,
   size_t maxSize) throw (Exception) :
+  AbstractHmmLikelihood(),
   AbstractParametrizable(prefix),
   hiddenAlphabet_(hiddenAlphabet),
   transitionMatrix_(transitionMatrix),
@@ -115,7 +116,7 @@ void LowMemoryRescaledHmmLikelihood::computeForward_()
    size_t ii = i * nbStates_;
     for (size_t j = 0; j < nbStates_; j++)
     {
-      trans[ii + j] = transitionMatrix_->Pij(static_cast<int>(j), static_cast<int>(i));
+      trans[ii + j] = transitionMatrix_->Pij(j, i);
     }
   }
 
@@ -124,7 +125,7 @@ void LowMemoryRescaledHmmLikelihood::computeForward_()
   const vector<double>* emissions = &(*emissionProbabilities_)(0);
   for (size_t j = 0; j < nbStates_; j++)
   {
-   size_t jj = j * nbStates_;
+    size_t jj = j * nbStates_;
     x = 0;
     for (size_t k = 0; k < nbStates_; k++)
     {
@@ -233,7 +234,7 @@ void LowMemoryRescaledHmmLikelihood::computeForward_()
       offset += maxSize_;
     }
   }
-  sort(lScales.begin(), lScales.begin() + nbSites_ - offset, cmp);
+  sort(lScales.begin(), lScales.begin() + static_cast<ptrdiff_t>(nbSites_ - offset), cmp);
   double partialLogLik = 0;
   for (size_t i = 0; i < nbSites_ - offset; ++i)
   {
diff --git a/src/Bpp/Numeric/Hmm/LowMemoryRescaledHmmLikelihood.h b/src/Bpp/Numeric/Hmm/LowMemoryRescaledHmmLikelihood.h
index 06d49ad..a9e797a 100644
--- a/src/Bpp/Numeric/Hmm/LowMemoryRescaledHmmLikelihood.h
+++ b/src/Bpp/Numeric/Hmm/LowMemoryRescaledHmmLikelihood.h
@@ -56,11 +56,15 @@ namespace bpp
  * This implementation is similar to the one used in the RescaledHmmLikelihood class,
  * but does not store the full likelihood array. The benefit of it is a significantly reduced
  * memory usage, allowing to compute likelihood for very large data sets.
- * The drawback is that this class can't compute posterior probabilities, and can hence only
- * be used to estimate parameters.
+ *
+ * The drawback is that this class can't compute posterior
+ * probabilities, neither derivatives of the likelihoods, and can
+ * hence only be used to compute likelihoods.
+ *
  */
+  
 class LowMemoryRescaledHmmLikelihood :
-  public virtual HmmLikelihood,
+  public AbstractHmmLikelihood,
   public AbstractParametrizable
 {
 private:
@@ -109,6 +113,7 @@ public:
     size_t maxSize = 1000000) throw (Exception);
 
   LowMemoryRescaledHmmLikelihood(const LowMemoryRescaledHmmLikelihood& lik) :
+    AbstractHmmLikelihood(lik),
     AbstractParametrizable(lik),
     hiddenAlphabet_(dynamic_cast<HmmStateAlphabet*>(lik.hiddenAlphabet_->clone())),
     transitionMatrix_(dynamic_cast<HmmTransitionMatrix*>(lik.transitionMatrix_->clone())),
@@ -128,6 +133,7 @@ public:
 
   LowMemoryRescaledHmmLikelihood& operator=(const LowMemoryRescaledHmmLikelihood& lik)
   {
+    AbstractHmmLikelihood::operator=(lik);
     AbstractParametrizable::operator=(lik);
     hiddenAlphabet_        = std::auto_ptr<HmmStateAlphabet>(dynamic_cast<HmmStateAlphabet*>(lik.hiddenAlphabet_->clone()));
     transitionMatrix_      = std::auto_ptr<HmmTransitionMatrix>(dynamic_cast<HmmTransitionMatrix*>(lik.transitionMatrix_->clone()));
@@ -183,6 +189,23 @@ public:
 
   void fireParameterChanged(const ParameterList& pl);
 
+
+  double getLikelihoodForASite(size_t site) const
+  {
+    throw (NotImplementedException("LowMemoryRescaledHmmLikelihood::getLikelihoodForASite. This class can't compute posterior probabilities, use RescaledHmmLikelihood instead."));    
+  }
+
+
+  Vdouble getLikelihoodForEachSite() const
+  {
+    throw (NotImplementedException("LowMemoryRescaledHmmLikelihood::getLikelihoodForEachSite. This class can't compute posterior probabilities, use RescaledHmmLikelihood instead."));    
+  }
+
+  Vdouble getHiddenStatesPosteriorProbabilitiesForASite(size_t site) const
+  {
+    throw (NotImplementedException("LowMemoryRescaledHmmLikelihood::getHiddenStatesPosteriorProbabilitiesForASite. This class can't compute posterior probabilities, use RescaledHmmLikelihood instead."));    
+  }
+
   void getHiddenStatesPosteriorProbabilities(std::vector< std::vector<double> >& probs, bool append = false) const throw (NotImplementedException)
   {
     throw (NotImplementedException("LowMemoryRescaledHmmLikelihood::getHiddenStatesPosteriorProbabilities. This class can't compute posterior probabilities, use RescaledHmmLikelihood instead."));    
@@ -190,9 +213,19 @@ public:
 
 protected:
   void computeForward_();
+
+  void computeDLikelihood_() const
+  {
+    //    computeDForward_();
+  }
+
+  void computeD2Likelihood_() const
+  {
+    //    computeD2Forward_();
+  }
 };
 
 }
 
-#endif // _RESCALEDHMMLIKELIHOOD_H_
+#endif // _LOWMEMORYRESCALEDHMMLIKELIHOOD_H_
 
diff --git a/src/Bpp/Numeric/Hmm/RescaledHmmLikelihood.cpp b/src/Bpp/Numeric/Hmm/RescaledHmmLikelihood.cpp
index cc7350f..5cb884d 100644
--- a/src/Bpp/Numeric/Hmm/RescaledHmmLikelihood.cpp
+++ b/src/Bpp/Numeric/Hmm/RescaledHmmLikelihood.cpp
@@ -52,12 +52,19 @@ RescaledHmmLikelihood::RescaledHmmLikelihood(
     HmmTransitionMatrix* transitionMatrix,
     HmmEmissionProbabilities* emissionProbabilities,
     const std::string& prefix) throw (Exception):
+  AbstractHmmLikelihood(),
   AbstractParametrizable(prefix),
   hiddenAlphabet_(hiddenAlphabet),
   transitionMatrix_(transitionMatrix),
   emissionProbabilities_(emissionProbabilities),
   likelihood_(),
+  dLikelihood_(),
+  d2Likelihood_(),
+  backLikelihood_(),
+  backLikelihoodUpToDate_(false),
   scales_(),
+  dScales_(),
+  d2Scales_(),
   logLik_(),
   breakPoints_(),
   nbStates_(),
@@ -80,6 +87,7 @@ RescaledHmmLikelihood::RescaledHmmLikelihood(
 
   //Init arrays:
   likelihood_.resize(nbSites_ * nbStates_);
+  
   scales_.resize(nbSites_);
   
   //Compute:
@@ -98,6 +106,7 @@ void RescaledHmmLikelihood::fireParameterChanged(const ParameterList& pl)
   if (alphabetChanged && !emissionChanged) emissionProbabilities_->setParametersValues(emissionProbabilities_->getParameters());
   
   computeForward_();
+  backLikelihoodUpToDate_=false;
 }
 
 /***************************************************************************************************************************/
@@ -114,7 +123,7 @@ void RescaledHmmLikelihood::computeForward_()
   {
     size_t ii = i * nbStates_;
     for (size_t j = 0; j < nbStates_; j++) {
-      trans[ii + j] = transitionMatrix_->Pij(static_cast<int>(j), static_cast<int>(i));
+      trans[ii + j] = transitionMatrix_->Pij(j, i);
       if (isnan(trans[ii + j]))
         throw Exception("RescaledHmmLikelihood::computeForward_. NaN transition probability");
       if (trans[ii + j] < 0)
@@ -228,13 +237,15 @@ void RescaledHmmLikelihood::computeForward_()
 
 /***************************************************************************************************************************/
 
-void RescaledHmmLikelihood::computeBackward_(std::vector< std::vector<double> >& b) const
+void RescaledHmmLikelihood::computeBackward_() const
 {
-  b.resize(nbSites_);
-  for (size_t i = 0; i < nbSites_; i++)
-  {
-    b[i].resize(nbStates_);
-  }
+  if (backLikelihood_.size()==0)
+    {
+      backLikelihood_.resize(nbSites_);
+      for (size_t i=0;i<nbSites_;i++)
+        backLikelihood_[i].resize(nbStates_);
+    }
+
   double x;
 
   //Transition probabilities:
@@ -243,7 +254,7 @@ void RescaledHmmLikelihood::computeBackward_(std::vector< std::vector<double> >&
   {
     size_t ii = i * nbStates_;
     for (size_t j = 0; j < nbStates_; j++)
-      trans[ii + j] = transitionMatrix_->Pij(static_cast<int>(i), static_cast<int>(j));
+      trans[ii + j] = transitionMatrix_->Pij(i, j);
   }
 
 
@@ -256,7 +267,7 @@ void RescaledHmmLikelihood::computeBackward_(std::vector< std::vector<double> >&
   for (size_t j = 0; j < nbStates_; j++)
   {
     x = 0;
-    b[nbSites_ - 1][j] = 1.;
+    backLikelihood_[nbSites_ - 1][j] = 1.;
   }
 
   //Recursion:
@@ -271,47 +282,296 @@ void RescaledHmmLikelihood::computeBackward_(std::vector< std::vector<double> >&
         size_t jj = j * nbStates_;
         for (size_t k = 0; k < nbStates_; k++)
         {
-          x += (*emissions)[k] * trans[jj + k] * b[i][k];
+          x += (*emissions)[k] * trans[jj + k] * backLikelihood_[i][k];
         }
-        b[i-1][j] = x / scales_[i];
+        backLikelihood_[i-1][j] = x / scales_[i];
       }    
     }
     else //Reset markov chain
     {
       for (size_t j = 0; j < nbStates_; j++)
       {
-        b[i-1][j] = 1.;
+        backLikelihood_[i-1][j] = 1.;
       }    
       bpIt++;
       if (bpIt != breakPoints_.rend()) nextBrkPt = *bpIt;
       else nextBrkPt = 0;
     }
   }
+
+  backLikelihoodUpToDate_=true;
+}
+
+/***************************************************************************************************************************/
+
+double RescaledHmmLikelihood::getLikelihoodForASite(size_t site) const
+{
+  Vdouble probs=getHiddenStatesPosteriorProbabilitiesForASite(site);
+  double x=0;
+  for (size_t i=0;i<nbStates_;i++)
+    x+=probs[i]*(*emissionProbabilities_)(site,i);
+
+  return x;
+}
+
+Vdouble RescaledHmmLikelihood::getLikelihoodForEachSite() const
+{
+  std::vector< std::vector<double> > vv;
+  getHiddenStatesPosteriorProbabilities(vv);
+
+  Vdouble ret(nbSites_);
+  for (size_t i=0;i<nbSites_;i++)
+    {
+      ret[i]=0;
+      for (size_t j=0;j<nbStates_;j++)
+        ret[i]+=vv[i][j]*(*emissionProbabilities_)(i,j);
+    }
+
+  return ret;
 }
 
 /***************************************************************************************************************************/
 
+Vdouble RescaledHmmLikelihood::getHiddenStatesPosteriorProbabilitiesForASite(size_t site) const
+{
+  if (!backLikelihoodUpToDate_)
+    computeBackward_();
+
+  Vdouble probs(nbStates_);
+  
+  for (size_t j = 0; j < nbStates_; j++)
+  {
+    probs[j] = likelihood_[site * nbStates_ + j] * backLikelihood_[site][j];
+  }
+
+  return probs;
+}
+
+
 void RescaledHmmLikelihood::getHiddenStatesPosteriorProbabilities(std::vector< std::vector<double> >& probs, bool append) const throw (Exception)
 {
   size_t offset = append ? probs.size() : 0;
   probs.resize(offset + nbSites_);
   for (size_t i = 0; i < nbSites_; i++)
+    {
+      probs[offset + i].resize(nbStates_);
+    }
+
+  if (!backLikelihoodUpToDate_)
+    computeBackward_();
+  
+  for (size_t i = 0; i < nbSites_; i++)
+    {
+      size_t ii = i * nbStates_;
+      for (size_t j = 0; j < nbStates_; j++)
+        {
+          probs[offset + i][j] = likelihood_[ii + j] * backLikelihood_[i][j];
+        }
+    }
+}
+
+/***************************************************************************************************************************/
+
+void RescaledHmmLikelihood::computeDForward_() const
+{
+  //Init arrays:
+  if (dLikelihood_.size()==0){
+    dLikelihood_.resize(nbSites_);
+    for (size_t i=0;i<nbSites_;i++)
+      dLikelihood_[i].resize(nbStates_);
+  }
+  if (dScales_.size()==0)
+    dScales_.resize(nbSites_);
+  
+  double x;
+  vector<double> tmp(nbStates_), dTmp(nbStates_);
+  vector<double> dLScales(nbSites_);
+  
+  //Transition probabilities:
+  const ColMatrix<double> trans(transitionMatrix_->getPij());
+
+  //Initialisation:
+  dScales_[0] = 0;
+  const vector<double>* emissions = &(*emissionProbabilities_)(0);
+  const vector<double>* dEmissions = &emissionProbabilities_->getDEmissionProbabilities(0);
+
+  for (size_t j = 0; j < nbStates_; j++)
   {
-    probs[offset + i].resize(nbStates_);
+    dTmp[j] = (*dEmissions)[j] * transitionMatrix_->getEquilibriumFrequencies()[j];
+    tmp[j] = (*emissions)[j] * transitionMatrix_->getEquilibriumFrequencies()[j];
+
+    dScales_[0] += dTmp[j];
   }
 
-  vector< vector<double> > b;
-  computeBackward_(b);
+  dLScales[0]=dScales_[0]/scales_[0];
+
   
-  for (size_t i = 0; i < nbSites_; i++)
+  for (size_t j = 0; j < nbStates_; j++)
+    dLikelihood_[0][j] = (dTmp[j] * scales_[0] - tmp[j] * dScales_[0]) / pow(scales_[0],2);
+ 
+  //Recursion:
+
+  size_t nextBrkPt = nbSites_; //next break point
+  vector<size_t>::const_iterator bpIt = breakPoints_.begin();
+  if (bpIt != breakPoints_.end()) nextBrkPt = *bpIt;
+  
+  for (size_t i = 1; i < nbSites_; i++)
   {
-    size_t ii = i * nbStates_;
-    for (size_t j = 0; j < nbStates_; j++)
+    size_t iip = (i - 1) * nbStates_;
+
+    dScales_[i] = 0 ;
+
+    emissions = &(*emissionProbabilities_)(i);
+    dEmissions = &emissionProbabilities_->getDEmissionProbabilities(i);
+    
+    if (i < nextBrkPt)
     {
-      probs[offset + i][j] = likelihood_[ii + j] * b[i][j];
+      for (size_t j = 0; j < nbStates_; j++)
+      {
+        x = 0;
+        for (size_t k = 0; k < nbStates_; k++)
+          x += trans(k,j) * likelihood_[iip + k];
+
+        tmp[j] = (*emissions)[j] * x;
+        dTmp[j] = (*dEmissions)[j] * x + (*emissions)[j] * VectorTools::sum(trans.getCol(j) * dLikelihood_[i-1]);
+          
+        dScales_[i] += dTmp[j];
+      }
+    }
+    else //Reset markov chain:
+    {
+      for (size_t j = 0; j < nbStates_; j++)
+      {
+        dTmp[j] = (*dEmissions)[j] * transitionMatrix_->getEquilibriumFrequencies()[j];
+        tmp[j] = (*emissions)[j] * transitionMatrix_->getEquilibriumFrequencies()[j];
+        
+        dScales_[i] += dTmp[j];
+      }
+      
+      bpIt++;
+      if (bpIt != breakPoints_.end()) nextBrkPt = *bpIt;
+      else nextBrkPt = nbSites_;
     }
+
+    dLScales[i]=dScales_[i]/scales_[i];
+
+    for (size_t j = 0; j < nbStates_; j++)
+      dLikelihood_[i][j] = (dTmp[j] * scales_[i] - tmp[j] * dScales_[i]) / pow(scales_[i],2);
+  }
+  
+  greater<double> cmp;
+  sort(dLScales.begin(), dLScales.end(), cmp);
+  dLogLik_ = 0;
+  for (size_t i = 0; i < nbSites_; ++i)
+  {
+    dLogLik_ += dLScales[i];
   }
 }
 
 /***************************************************************************************************************************/
 
+
+void RescaledHmmLikelihood::computeD2Forward_() const
+{
+  //Init arrays:
+  if (d2Likelihood_.size()==0){
+    d2Likelihood_.resize(nbSites_);
+    for (size_t i=0;i<nbSites_;i++)
+      d2Likelihood_[i].resize(nbStates_);
+  }
+  if (d2Scales_.size()==0)
+    d2Scales_.resize(nbSites_);
+  
+  double x;
+  vector<double> tmp(nbStates_), dTmp(nbStates_), d2Tmp(nbStates_);
+  vector<double> d2LScales(nbSites_);
+  
+  //Transition probabilities:
+  const ColMatrix<double> trans(transitionMatrix_->getPij());
+
+  //Initialisation:
+  d2Scales_[0] = 0;
+  const vector<double>* emissions = &(*emissionProbabilities_)(0);
+  const vector<double>* dEmissions = &emissionProbabilities_->getDEmissionProbabilities(0);
+  const vector<double>* d2Emissions = &emissionProbabilities_->getD2EmissionProbabilities(0);
+
+  for (size_t j = 0; j < nbStates_; j++)
+  {
+    tmp[j] = (*emissions)[j] * transitionMatrix_->getEquilibriumFrequencies()[j];
+    dTmp[j] = (*dEmissions)[j] * transitionMatrix_->getEquilibriumFrequencies()[j];
+    d2Tmp[j] = (*d2Emissions)[j] * transitionMatrix_->getEquilibriumFrequencies()[j];
+
+    d2Scales_[0] += d2Tmp[j];
+  }
+
+  d2LScales[0]=d2Scales_[0]/scales_[0]-pow(dScales_[0]/scales_[0],2);
+  
+  for (size_t j = 0; j < nbStates_; j++)
+    d2Likelihood_[0][j] = d2Tmp[j] / scales_[0] - (d2Scales_[0] * tmp[j] + 2 * dScales_[0] * dTmp[j]) / pow(scales_[0],2)
+      +  2 * pow(dScales_[0],2) * tmp[j] / pow(scales_[0],3);
+   
+  //Recursion:
+
+  size_t nextBrkPt = nbSites_; //next break point
+  vector<size_t>::const_iterator bpIt = breakPoints_.begin();
+  if (bpIt != breakPoints_.end()) nextBrkPt = *bpIt;
+  
+  for (size_t i = 1; i < nbSites_; i++)
+  {
+    dScales_[i] = 0 ;
+
+    emissions = &(*emissionProbabilities_)(i);
+    dEmissions = &emissionProbabilities_->getDEmissionProbabilities(i);
+    d2Emissions = &emissionProbabilities_->getD2EmissionProbabilities(i);
+    
+    if (i < nextBrkPt)
+    {
+      size_t iip = (i - 1) * nbStates_;
+
+      for (size_t j = 0; j < nbStates_; j++)
+      {
+        x = 0;
+        for (size_t k = 0; k < nbStates_; k++)
+          x += trans(k,j) * likelihood_[iip + k];
+
+        tmp[j] = (*emissions)[j] * x;
+        dTmp[j] = (*dEmissions)[j] * x + (*emissions)[j] * VectorTools::sum(trans.getCol(j) * dLikelihood_[i-1]);
+        d2Tmp[j] = (*d2Emissions)[j] * x + 2 * (*dEmissions)[j] * VectorTools::sum(trans.getCol(j) * dLikelihood_[i-1])
+          + (*emissions)[j] * VectorTools::sum(trans.getCol(j) * d2Likelihood_[i-1]);
+          
+        d2Scales_[i] += d2Tmp[j];
+      }
+    }
+    else //Reset markov chain:
+    {
+      for (size_t j = 0; j < nbStates_; j++)
+      {
+        tmp[j] = (*emissions)[j] * transitionMatrix_->getEquilibriumFrequencies()[j];
+        dTmp[j] = (*dEmissions)[j] * transitionMatrix_->getEquilibriumFrequencies()[j];
+        d2Tmp[j] = (*d2Emissions)[j] * transitionMatrix_->getEquilibriumFrequencies()[j];
+        
+        d2Scales_[i] += d2Tmp[j];
+      }
+      
+      bpIt++;
+      if (bpIt != breakPoints_.end()) nextBrkPt = *bpIt;
+      else nextBrkPt = nbSites_;
+    }
+
+    d2LScales[i]=d2Scales_[i]/scales_[i]-pow(dScales_[i]/scales_[i],2);
+  
+    for (size_t j = 0; j < nbStates_; j++)
+      d2Likelihood_[i][j] = d2Tmp[j] / scales_[i] - (d2Scales_[i] * tmp[j] + 2 * dScales_[i] * dTmp[j]) / pow(scales_[i],2)
+        +  2 * pow(dScales_[i],2) * tmp[j] / pow(scales_[i],3);
+  }
+  
+  greater<double> cmp;
+  sort(d2LScales.begin(), d2LScales.end(), cmp);
+  dLogLik_ = 0;
+  for (size_t i = 0; i < nbSites_; ++i)
+  {
+    d2LogLik_ += d2LScales[i];
+  }
+}
+
+/***************************************************************************************************************************/
diff --git a/src/Bpp/Numeric/Hmm/RescaledHmmLikelihood.h b/src/Bpp/Numeric/Hmm/RescaledHmmLikelihood.h
index c775c5b..93f6ea9 100644
--- a/src/Bpp/Numeric/Hmm/RescaledHmmLikelihood.h
+++ b/src/Bpp/Numeric/Hmm/RescaledHmmLikelihood.h
@@ -5,36 +5,36 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 16, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for phylogenetic data analysis.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. CNRS, (November 16, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for phylogenetic data analysis.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _RESCALEDHMMLIKELIHOOD_H_
@@ -57,125 +57,199 @@ namespace bpp {
    * It also offer the possibility to specify "breakpoints", where the chain will be reset to the equilibrium frequencies.
    */
   class RescaledHmmLikelihood:
-    public virtual HmmLikelihood,
+    public virtual AbstractHmmLikelihood,
     public AbstractParametrizable
   {
-    private:
-      /**
-       * @brief The alphabet describing the hidden states.
-       */
-      std::auto_ptr<HmmStateAlphabet> hiddenAlphabet_;
-      std::auto_ptr<HmmTransitionMatrix> transitionMatrix_;
-      std::auto_ptr<HmmEmissionProbabilities> emissionProbabilities_;
-
-      /**
-       * @brief The likelihood array.
-       *
-       * likelihood_[i * nbStates_ + j] corresponds to Pr(x1...xi, yi=j),
-       * where the x are the observed states, and y the hidden states.
-       */
-      std::vector<double> likelihood_;
-      std::vector<double> scales_;
-      double logLik_;
-
-      std::vector<size_t> breakPoints_;
-
-      size_t nbStates_, nbSites_;
-
-    public:
-      /**
-       * @brief Build a new RescaledHmmLikelihood object.
-       *
-       * @warning the HmmTransitionMatrix and HmmEmissionProbabilities object passed as argument must be non-null
-       * and point toward the same HmmStateAlphabet instance. The three object will be copied if needed, and
-       * deleted when the hmm likelihood objet is deleted. You should secure a copy before if you don't want them to
-       * be destroyed with this object.
-       */
-      RescaledHmmLikelihood(
-          HmmStateAlphabet* hiddenAlphabet,
-          HmmTransitionMatrix* transitionMatrix,
-          HmmEmissionProbabilities* emissionProbabilities,
-          const std::string& prefix) throw (Exception);
-
-      RescaledHmmLikelihood(const RescaledHmmLikelihood& lik):
-        AbstractParametrizable(lik),
-        hiddenAlphabet_(dynamic_cast<HmmStateAlphabet*>(lik.hiddenAlphabet_->clone())),
-        transitionMatrix_(dynamic_cast<HmmTransitionMatrix*>(lik.transitionMatrix_->clone())),
-        emissionProbabilities_(dynamic_cast<HmmEmissionProbabilities*>(lik.emissionProbabilities_->clone())),
-        likelihood_(lik.likelihood_),
-        scales_(lik.scales_),
-        logLik_(lik.logLik_),
-        breakPoints_(lik.breakPoints_),
-        nbStates_(lik.nbStates_),
-        nbSites_(lik.nbSites_)
+  private:
+    /**
+     * @brief The alphabet describing the hidden states.
+     */
+    std::auto_ptr<HmmStateAlphabet> hiddenAlphabet_;
+    std::auto_ptr<HmmTransitionMatrix> transitionMatrix_;
+    std::auto_ptr<HmmEmissionProbabilities> emissionProbabilities_;
+
+    /**
+     * @brief The likelihood arrays.
+     *
+     */
+
+    /**
+     * @brief forward likelihood
+     *
+     * likelihood_[i * nbStates_ + j] corresponds to Pr(x_1...x_i, y_i=j)/Pr(x_1...x_i),
+     * where the x are the observed states, and y the hidden states.
+     */
+
+    std::vector<double> likelihood_;
+
+    /**
+     * @brief derivatec of forward likelihood
+     *
+     * dlikelihood_[i][j] corresponds to d(Pr(x_1...x_i, y_i=j))/Pr(x_1...x_i)),
+     * where the x are the observed states, and y the hidden states.
+     */
+
+    mutable std::vector<std::vector<double> > dLikelihood_;
+    mutable std::vector<std::vector<double> > d2Likelihood_;
+
+    /**
+     * @brief backward likelihood
+     *
+     * backLikelihood_[i][j] corresponds to Pr(x_i+1...x_n | yi=j),
+     * where the x are the observed states, and y the hidden states.
+     */
+
+    mutable std::vector<std::vector<double> > backLikelihood_;
+    mutable bool backLikelihoodUpToDate_;
+    
+    /**
+     * @brief scales for likelihood computing
+     *
+     * scales_[i * nbStates_ + j] corresponds to Pr(x_1...x_i)/Pr(x_1...x_{i-1})
+     * where the x are the observed states.
+     */
+    
+    std::vector<double> scales_;
+    
+    mutable std::vector<double> dScales_;
+    mutable std::vector<double> d2Scales_;
+    double logLik_;
+
+    std::vector<size_t> breakPoints_;
+
+    size_t nbStates_, nbSites_;
+
+  public:
+    /**
+     * @brief Build a new RescaledHmmLikelihood object.
+     *
+     * @warning the HmmTransitionMatrix and HmmEmissionProbabilities object passed as argument must be non-null
+     * and point toward the same HmmStateAlphabet instance. The three object will be copied if needed, and
+     * deleted when the hmm likelihood objet is deleted. You should secure a copy before if you don't want them to
+     * be destroyed with this object.
+     */
+    RescaledHmmLikelihood(
+                          HmmStateAlphabet* hiddenAlphabet,
+                          HmmTransitionMatrix* transitionMatrix,
+                          HmmEmissionProbabilities* emissionProbabilities,
+                          const std::string& prefix) throw (Exception);
+    
+    RescaledHmmLikelihood(const RescaledHmmLikelihood& lik):
+    AbstractHmmLikelihood(lik),
+    AbstractParametrizable(lik),
+    hiddenAlphabet_(dynamic_cast<HmmStateAlphabet*>(lik.hiddenAlphabet_->clone())),
+    transitionMatrix_(dynamic_cast<HmmTransitionMatrix*>(lik.transitionMatrix_->clone())),
+    emissionProbabilities_(dynamic_cast<HmmEmissionProbabilities*>(lik.emissionProbabilities_->clone())),
+    likelihood_(lik.likelihood_),
+    dLikelihood_(lik.dLikelihood_),
+    d2Likelihood_(lik.d2Likelihood_),
+    backLikelihood_(lik.backLikelihood_),
+    backLikelihoodUpToDate_(lik.backLikelihoodUpToDate_),
+    scales_(lik.scales_),
+    dScales_(lik.dScales_),
+    d2Scales_(lik.d2Scales_),
+    logLik_(lik.logLik_),
+    breakPoints_(lik.breakPoints_),
+    nbStates_(lik.nbStates_),
+    nbSites_(lik.nbSites_)
     {
       // Now adjust pointers:
       transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_.get());
       emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_.get());
     }
 
-      RescaledHmmLikelihood& operator=(const RescaledHmmLikelihood& lik)
-      {
-        AbstractParametrizable::operator =(lik);
-        hiddenAlphabet_        = std::auto_ptr<HmmStateAlphabet>(dynamic_cast<HmmStateAlphabet*>(lik.hiddenAlphabet_->clone()));
-        transitionMatrix_      = std::auto_ptr<HmmTransitionMatrix>(dynamic_cast<HmmTransitionMatrix*>(lik.transitionMatrix_->clone()));
-        emissionProbabilities_ = std::auto_ptr<HmmEmissionProbabilities>(dynamic_cast<HmmEmissionProbabilities*>(lik.emissionProbabilities_->clone()));
-        likelihood_            = lik.likelihood_;
-        scales_                = lik.scales_;
-        logLik_                = lik.logLik_;
-        breakPoints_           = lik.breakPoints_;
-        nbStates_              = lik.nbStates_;
-        nbSites_               = lik.nbSites_;
-
-        // Now adjust pointers:
-        transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_.get());
-        emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_.get());
-        return *this;
-      }
-
-      virtual ~RescaledHmmLikelihood() {}
+    RescaledHmmLikelihood& operator=(const RescaledHmmLikelihood& lik)
+    {
+      AbstractHmmLikelihood::operator=(lik);
+      AbstractParametrizable::operator=(lik);
+      hiddenAlphabet_        = std::auto_ptr<HmmStateAlphabet>(dynamic_cast<HmmStateAlphabet*>(lik.hiddenAlphabet_->clone()));
+      transitionMatrix_      = std::auto_ptr<HmmTransitionMatrix>(dynamic_cast<HmmTransitionMatrix*>(lik.transitionMatrix_->clone()));
+      emissionProbabilities_ = std::auto_ptr<HmmEmissionProbabilities>(dynamic_cast<HmmEmissionProbabilities*>(lik.emissionProbabilities_->clone()));
+      likelihood_            = lik.likelihood_;
+      dLikelihood_           = lik.dLikelihood_;
+      d2Likelihood_          = lik.d2Likelihood_;
+      backLikelihood_        = lik.backLikelihood_;
+      backLikelihoodUpToDate_= lik.backLikelihoodUpToDate_;
+      scales_                = lik.scales_;
+      dScales_               = lik.dScales_;
+      d2Scales_              = lik.d2Scales_;
+      logLik_                = lik.logLik_;
+      breakPoints_           = lik.breakPoints_;
+      nbStates_              = lik.nbStates_;
+      nbSites_               = lik.nbSites_;
+
+      // Now adjust pointers:
+      transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_.get());
+      emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_.get());
+      return *this;
+    }
+
+    virtual ~RescaledHmmLikelihood() {}
 
 #ifndef NO_VIRTUAL_COV
-      RescaledHmmLikelihood*
+    RescaledHmmLikelihood*
 #else
-        Clonable*
+    Clonable*
 #endif
-        clone() const { return new RescaledHmmLikelihood(*this); }
+    clone() const { return new RescaledHmmLikelihood(*this); }
 
-    public:
-      const HmmStateAlphabet& getHmmStateAlphabet() const { return *hiddenAlphabet_; }
-      HmmStateAlphabet& getHmmStateAlphabet() { return *hiddenAlphabet_; }
+  public:
+    const HmmStateAlphabet& getHmmStateAlphabet() const { return *hiddenAlphabet_; }
+    HmmStateAlphabet& getHmmStateAlphabet() { return *hiddenAlphabet_; }
 
-      const HmmTransitionMatrix& getHmmTransitionMatrix() const { return *transitionMatrix_; }
-      HmmTransitionMatrix& getHmmTransitionMatrix() { return *transitionMatrix_; }
+    const HmmTransitionMatrix& getHmmTransitionMatrix() const { return *transitionMatrix_; }
+    HmmTransitionMatrix& getHmmTransitionMatrix() { return *transitionMatrix_; }
 
-      const HmmEmissionProbabilities& getHmmEmissionProbabilities() const { return *emissionProbabilities_; }
-      HmmEmissionProbabilities& getHmmEmissionProbabilities() { return *emissionProbabilities_; }
+    const HmmEmissionProbabilities& getHmmEmissionProbabilities() const { return *emissionProbabilities_; }
+    HmmEmissionProbabilities& getHmmEmissionProbabilities() { return *emissionProbabilities_; }
 
-      void setBreakPoints(const std::vector<size_t>& breakPoints) {
-        breakPoints_ = breakPoints;
-        computeForward_();
-      }
+    void setBreakPoints(const std::vector<size_t>& breakPoints) {
+      breakPoints_ = breakPoints;
+      computeForward_();
+      backLikelihoodUpToDate_=false;
+    }
 
-      const std::vector<size_t>& getBreakPoints() const { return breakPoints_; }
+    const std::vector<size_t>& getBreakPoints() const { return breakPoints_; }
 
-      void setParameters(const ParameterList& pl) throw (Exception)
-      {
-        setParametersValues(pl);
-      }
+    void setParameters(const ParameterList& pl) throw (Exception)
+    {
+      setParametersValues(pl);
+    }
 
-      double getValue() const throw (Exception) { return -logLik_; }
+    double getValue() const throw (Exception) { return -logLik_; }
 
-      double getLogLikelihood() const { return logLik_; }
+    double getLogLikelihood() const { return logLik_; }
 
-      void fireParameterChanged(const ParameterList& pl);
+    double getLikelihoodForASite(size_t site) const;
 
-      void getHiddenStatesPosteriorProbabilities(std::vector< std::vector<double> >& probs, bool append = false) const throw (Exception);
+    Vdouble getLikelihoodForEachSite() const;
 
-    protected:
-      void computeForward_();
-      void computeBackward_(std::vector< std::vector<double> >& b) const;
+    void fireParameterChanged(const ParameterList& pl);
+
+    Vdouble getHiddenStatesPosteriorProbabilitiesForASite(size_t site) const;
+
+    void getHiddenStatesPosteriorProbabilities(std::vector< std::vector<double> >& probs, bool append = false) const throw (Exception);
+
+    
+  protected:
+    void computeForward_();
+    void computeBackward_() const;
+
+    
+    void computeDLikelihood_() const
+    {
+      computeDForward_();
+    }
+
+    void computeD2Likelihood_() const
+    {
+      computeD2Forward_();
+    }
 
+    void computeDForward_() const;
+    
+    void computeD2Forward_() const;
+    
   };
 
 }
diff --git a/src/Bpp/Numeric/Matrix/EigenValue.h b/src/Bpp/Numeric/Matrix/EigenValue.h
index 17050c1..c294761 100644
--- a/src/Bpp/Numeric/Matrix/EigenValue.h
+++ b/src/Bpp/Numeric/Matrix/EigenValue.h
@@ -41,6 +41,7 @@ knowledge of the CeCILL license and that you accept its terms.
 
 #ifndef _EIGENVALUE_H_
 #define _EIGENVALUE_H_
+#define TOST(i) static_cast<size_t>(i)
 
 #include <algorithm>
 // for min(), max() below
@@ -168,36 +169,36 @@ class EigenValue
 
      // Householder reduction to tridiagonal form.
    
-     for (int i = static_cast<int>(n_)-1; i > 0; i--)
+     for (size_t i = n_-1; i > 0; i--)
      {
        // Scale to avoid under/overflow.
    
        Real scale = 0.0;
        Real h = 0.0;
-       for (int k = 0; k < i; k++)
+       for (size_t k = 0; k < i; ++k)
        {
          scale = scale + NumTools::abs<Real>(d_[k]);
        }
        if (scale == 0.0)
        {
          e_[i] = d_[i-1];
-         for (int j = 0; j < i; j++)
+         for (size_t j = 0; j < i; ++j)
          {
-           d_[j] = V_(i-1,j);
-           V_(i,j) = 0.0;
-           V_(j,i) = 0.0;
+           d_[j] = V_(i - 1, j);
+           V_(i, j) = 0.0;
+           V_(j, i) = 0.0;
          }
        }
        else
        {
          // Generate Householder vector.
    
-         for (int k = 0; k < i; k++)
+         for (size_t k = 0; k < i; ++k)
          {
            d_[k] /= scale;
            h += d_[k] * d_[k];
          }
-         Real f = d_[i-1];
+         Real f = d_[i - 1];
          Real g = sqrt(h);
          if (f > 0)
          {
@@ -206,19 +207,19 @@ class EigenValue
          e_[i] = scale * g;
          h = h - f * g;
          d_[i-1] = f - g;
-         for (int j = 0; j < i; j++)
+         for (size_t j = 0; j < i; ++j)
          {
            e_[j] = 0.0;
          }
    
          // Apply similarity transformation to remaining columns.
    
-         for (int j = 0; j < i; j++)
+         for (size_t j = 0; j < i; ++j)
          {
            f = d_[j];
            V_(j,i) = f;
            g = e_[j] + V_(j,j) * f;
-           for (int k = j+1; k <= i-1; k++)
+           for (size_t k = j + 1; k <= i - 1; k++)
            {
              g += V_(k,j) * d_[k];
              e_[k] += V_(k,j) * f;
@@ -226,21 +227,21 @@ class EigenValue
            e_[j] = g;
          }
          f = 0.0;
-         for (int j = 0; j < i; j++)
+         for (size_t j = 0; j < i; ++j)
          {
            e_[j] /= h;
            f += e_[j] * d_[j];
          }
          Real hh = f / (h + h);
-         for (int j = 0; j < i; j++)
+         for (size_t j = 0; j < i; ++j)
          {
            e_[j] -= hh * d_[j];
          }
-         for (int j = 0; j < i; j++)
+         for (size_t j = 0; j < i; ++j)
          {
            f = d_[j];
            g = e_[j];
-           for (int k = j; k <= i-1; k++)
+           for (size_t k = j; k <= i-1; ++k)
            {
              V_(k,j) -= (f * e_[k] + g * d_[k]);
            }
@@ -303,22 +304,22 @@ class EigenValue
    {
      for (size_t i = 1; i < n_; i++)
      {
-       e_[i-1] = e_[i];
+       e_[i - 1] = e_[i];
      }
-     e_[n_-1] = 0.0;
+     e_[n_ - 1] = 0.0;
    
      Real f = 0.0;
      Real tst1 = 0.0;
      Real eps = pow(2.0,-52.0);
-     for (int l = 0; l < static_cast<int>(n_); l++)
+     for (size_t l = 0; l < n_; ++l)
      {
        // Find small subdiagonal element
    
        tst1 = std::max(tst1, NumTools::abs<Real>(d_[l]) + NumTools::abs<Real>(e_[l]));
-       int m = l;
+       size_t m = l;
 
        // Original while-loop from Java code
-       while (m < static_cast<int>(n_))
+       while (m < n_)
        {
          if (NumTools::abs<Real>(e_[m]) <= eps*tst1)
          {
@@ -340,17 +341,17 @@ class EigenValue
            // Compute implicit shift
    
            Real g = d_[l];
-           Real p = (d_[l+1] - g) / (2.0 * e_[l]);
+           Real p = (d_[l + 1] - g) / (2.0 * e_[l]);
            Real r = hypot(p,1.0);
            if (p < 0)
            {
              r = -r;
            }
            d_[l] = e_[l] / (p + r);
-           d_[l+1] = e_[l] * (p + r);
-           Real dl1 = d_[l+1];
+           d_[l + 1] = e_[l] * (p + r);
+           Real dl1 = d_[l + 1];
            Real h = g - d_[l];
-           for (size_t i = l+2; i < n_; i++)
+           for (size_t i = l + 2; i < n_; ++i)
            {
              d_[i] -= h;
            }
@@ -362,30 +363,32 @@ class EigenValue
            Real c = 1.0;
            Real c2 = c;
            Real c3 = c;
-           Real el1 = e_[l+1];
+           Real el1 = e_[l + 1];
            Real s = 0.0;
            Real s2 = 0.0;
-           for (int i = m-1; i >= l; i--)
+           //for (size_t i = m - 1; i >= l; --i)
+           for (size_t ii = m; ii > l; --ii)
            {
+             size_t i = ii - 1; //to avoid infinite loop!
              c3 = c2;
              c2 = c;
              s2 = s;
              g = c * e_[i];
              h = c * p;
-             r = hypot(p,e_[i]);
-             e_[i+1] = s * r;
+             r = hypot(p, e_[i]);
+             e_[i + 1] = s * r;
              s = e_[i] / r;
              c = p / r;
              p = c * d_[i] - s * g;
-             d_[i+1] = h + s * (c * g + s * d_[i]);
+             d_[i + 1] = h + s * (c * g + s * d_[i]);
    
              // Accumulate transformation.
    
              for (size_t k = 0; k < n_; k++)
              {
-               h = V_(k,i+1);
-               V_(k,i+1) = s * V_(k,i) + c * h;
-               V_(k,i) = c * V_(k,i) - s * h;
+               h = V_(k, i + 1);
+               V_(k, i + 1) = s * V_(k, i) + c * h;
+               V_(k, i) = c * V_(k, i) - s * h;
              }
            }
            p = -s * s2 * c3 * el1 * e_[l] / dl1;
@@ -394,7 +397,7 @@ class EigenValue
    
            // Check for convergence.
    
-         } while (NumTools::abs<Real>(e_[l]) > eps*tst1);
+         } while (NumTools::abs<Real>(e_[l]) > eps * tst1);
        }
        d_[l] = d_[l] + f;
        e_[l] = 0.0;
@@ -420,8 +423,8 @@ class EigenValue
          d_[i] = p;
          for (size_t j = 0; j < n_; j++)
          {
-           p = V_(j,i);
-           V_(j,i) = V_(j,k);
+           p = V_(j, i);
+           V_(j,i) = V_(j, k);
            V_(j,k) = p;
          }
        }
@@ -436,28 +439,29 @@ class EigenValue
     * Vol.ii-Linear Algebra, and the corresponding
     * Fortran subroutines in EISPACK.
     */
-   void orthes ()
+   void orthes()
    {
-     int low = 0;
-     int high = static_cast<int>(n_)-1;
+     if (n_ == 0) return;
+     size_t low = 0;
+     size_t high = n_-1;
    
-     for (int m = low+1; m <= high-1; m++)
+     for (size_t m = low + 1; m <= high - 1; ++m)
      {
        // Scale column.
    
        Real scale = 0.0;
-       for (int i = m; i <= high; i++)
+       for (size_t i = m; i <= high; ++i)
        {
-         scale = scale + NumTools::abs<Real>(H_(i,m-1));
+         scale = scale + NumTools::abs<Real>(H_(i, m - 1));
        }
        if (scale != 0.0)
        {
          // Compute Householder transformation.
    
          Real h = 0.0;
-         for (int i = high; i >= m; i--)
+         for (size_t i = high; i >= m; --i)
          {
-           ort_[i] = H_(i,m-1)/scale;
+           ort_[i] = H_(i, m - 1)/scale;
            h += ort_[i] * ort_[i];
          }
          Real g = sqrt(h);
@@ -471,35 +475,35 @@ class EigenValue
          // Apply Householder similarity transformation
          // H = (I-u*u'/h)*H*(I-u*u')/h)
    
-         for (int j = m; j < static_cast<int>(n_); j++)
+         for (size_t j = m; j < n_; ++j)
          {
            Real f = 0.0;
-           for (int i = high; i >= m; i--)
+           for (size_t i = high; i >= m; --i)
            {
-             f += ort_[i]*H_(i,j);
+             f += ort_[i] * H_(i, j);
            }
            f = f/h;
-           for (int i = m; i <= high; i++)
+           for (size_t i = m; i <= high; ++i)
            {
              H_(i,j) -= f*ort_[i];
            }
          }
    
-         for (int i = 0; i <= high; i++)
+         for (size_t i = 0; i <= high; ++i)
          {
            Real f = 0.0;
-           for (int j = high; j >= m; j--)
+           for (size_t j = high; j >= m; --j)
            {
-             f += ort_[j]*H_(i,j);
+             f += ort_[j] * H_(i, j);
            }
            f = f/h;
-           for (int j = m; j <= high; j++)
+           for (size_t j = m; j <= high; ++j)
            {
-             H_(i,j) -= f*ort_[j];
+             H_(i,j) -= f * ort_[j];
            }
          }
-         ort_[m] = scale*ort_[m];
-         H_(m,m-1) = scale*g;
+         ort_[m] = scale * ort_[m];
+         H_(m, m - 1) = scale * g;
        }
      }
    
@@ -513,26 +517,26 @@ class EigenValue
        }
      }
 
-     for (int m = high-1; m >= low+1; m--)
+     for (size_t m = high - 1; m >= low + 1; --m)
      {
-       if (H_(m,m-1) != 0.0)
+       if (H_(m, m - 1) != 0.0)
        {
-         for (int i = m+1; i <= high; i++)
+         for (size_t i = m + 1; i <= high; ++i)
          {
-           ort_[i] = H_(i,m-1);
+           ort_[i] = H_(i, m - 1);
          }
-         for (int j = m; j <= high; j++)
+         for (size_t j = m; j <= high; ++j)
          {
            Real g = 0.0;
-           for (int i = m; i <= high; i++)
+           for (size_t i = m; i <= high; i++)
            {
-             g += ort_[i] * V_(i,j);
+             g += ort_[i] * V_(i, j);
            }
            // Double division avoids possible underflow
-           g = (g / ort_[m]) / H_(m,m-1);
-           for (int i = m; i <= high; i++)
+           g = (g / ort_[m]) / H_(m, m - 1);
+           for (size_t i = m; i <= high; ++i)
            {
-             V_(i,j) += g * ort_[i];
+             V_(i, j) += g * ort_[i];
            }
          }
        }
@@ -589,12 +593,12 @@ class EigenValue
     {
       if ((i < low) || (i > high))
       {
-        d_[i] = H_(i,i);
-        e_[i] = 0.0;
+        d_[TOST(i)] = H_(TOST(i),TOST(i));
+        e_[TOST(i)] = 0.0;
       }
       for (int j = std::max(i-1,0); j < nn; j++)
       {
-        norm = norm + NumTools::abs<Real>(H_(i,j));
+        norm = norm + NumTools::abs<Real>(H_(TOST(i),TOST(j)));
       }
     }
    
@@ -608,12 +612,12 @@ class EigenValue
       int l = n;
       while (l > low)
       {
-        s = NumTools::abs<Real>(H_(l-1,l-1)) + NumTools::abs<Real>(H_(l,l));
+        s = NumTools::abs<Real>(H_(TOST(l-1),TOST(l-1))) + NumTools::abs<Real>(H_(TOST(l),TOST(l)));
         if (s == 0.0)
         {
           s = norm;
         }
-        if (NumTools::abs<Real>(H_(l,l-1)) < eps * s)
+        if (NumTools::abs<Real>(H_(TOST(l),TOST(l-1))) < eps * s)
         {
           break;
         }
@@ -625,9 +629,9 @@ class EigenValue
   
       if (l == n)
       {
-        H_(n,n) = H_(n,n) + exshift;
-        d_[n] = H_(n,n);
-        e_[n] = 0.0;
+        H_(TOST(n),TOST(n)) = H_(TOST(n),TOST(n)) + exshift;
+        d_[TOST(n)] = H_(TOST(n),TOST(n));
+        e_[TOST(n)] = 0.0;
         n--;
         iter = 0;
   
@@ -636,13 +640,13 @@ class EigenValue
       }
       else if (l == n-1)
       {
-        w = H_(n,n-1) * H_(n-1,n);
-        p = (H_(n-1,n-1) - H_(n,n)) / 2.0;
+        w = H_(TOST(n),TOST(n-1)) * H_(TOST(n-1),TOST(n));
+        p = (H_(TOST(n-1),TOST(n-1)) - H_(TOST(n),TOST(n))) / 2.0;
         q = p * p + w;
         z = sqrt(NumTools::abs<Real>(q));
-        H_(n,n) = H_(n,n) + exshift;
-        H_(n-1,n-1) = H_(n-1,n-1) + exshift;
-        x = H_(n,n);
+        H_(TOST(n),TOST(n)) = H_(TOST(n),TOST(n)) + exshift;
+        H_(TOST(n-1),TOST(n-1)) = H_(TOST(n-1),TOST(n-1)) + exshift;
+        x = H_(TOST(n),TOST(n));
   
         // Real pair
   
@@ -656,15 +660,15 @@ class EigenValue
           {
             z = p - z;
           }
-          d_[n-1] = x + z;
-          d_[n] = d_[n-1];
+          d_[TOST(n - 1)] = x + z;
+          d_[TOST(n)] = d_[TOST(n - 1)];
           if (z != 0.0)
           {
-            d_[n] = x - w / z;
+            d_[TOST(n)] = x - w / z;
           }
-          e_[n-1] = 0.0;
-          e_[n] = 0.0;
-          x = H_(n,n-1);
+          e_[TOST(n - 1)] = 0.0;
+          e_[TOST(n)] = 0.0;
+          x = H_(TOST(n),TOST(n-1));
           s = NumTools::abs<Real>(x) + NumTools::abs<Real>(z);
           p = x / s;
           q = z / s;
@@ -676,27 +680,27 @@ class EigenValue
   
           for (int j = n-1; j < nn; j++)
           {
-            z = H_(n-1,j);
-            H_(n-1,j) = q * z + p * H_(n,j);
-            H_(n,j) = q * H_(n,j) - p * z;
+            z = H_(TOST(n-1),TOST(j));
+            H_(TOST(n-1),TOST(j)) = q * z + p * H_(TOST(n),TOST(j));
+            H_(TOST(n),TOST(j)) = q * H_(TOST(n),TOST(j)) - p * z;
           }
   
           // Column modification
   
           for (int i = 0; i <= n; i++)
           {
-            z = H_(i,n-1);
-            H_(i,n-1) = q * z + p * H_(i,n);
-            H_(i,n) = q * H_(i,n) - p * z;
+            z = H_(TOST(i),TOST(n-1));
+            H_(TOST(i),TOST(n-1)) = q * z + p * H_(TOST(i),TOST(n));
+            H_(TOST(i),TOST(n)) = q * H_(TOST(i),TOST(n)) - p * z;
           }
   
           // Accumulate transformations
   
           for (int i = low; i <= high; i++)
           {
-            z = V_(i,n-1);
-            V_(i,n-1) = q * z + p * V_(i,n);
-            V_(i,n) = q * V_(i,n) - p * z;
+            z = V_(TOST(i),TOST(n-1));
+            V_(TOST(i),TOST(n-1)) = q * z + p * V_(TOST(i),TOST(n));
+            V_(TOST(i),TOST(n)) = q * V_(TOST(i),TOST(n)) - p * z;
           }
    
           // Complex pair
@@ -704,10 +708,10 @@ class EigenValue
         }
         else
         {
-          d_[n-1] = x + p;
-          d_[n] = x + p;
-          e_[n-1] = z;
-          e_[n] = -z;
+          d_[TOST(n - 1)] = x + p;
+          d_[TOST(n)] = x + p;
+          e_[TOST(n-1)] = z;
+          e_[TOST(n)] = -z;
         }
         n = n - 2;
         iter = 0;
@@ -719,13 +723,13 @@ class EigenValue
       {
         // Form shift
   
-        x = H_(n,n);
+        x = H_(TOST(n),TOST(n));
         y = 0.0;
         w = 0.0;
         if (l < n)
         {
-          y = H_(n-1,n-1);
-          w = H_(n,n-1) * H_(n-1,n);
+          y = H_(TOST(n-1),TOST(n-1));
+          w = H_(TOST(n),TOST(n-1)) * H_(TOST(n-1),TOST(n));
         }
   
         // Wilkinson's original ad hoc shift
@@ -735,9 +739,9 @@ class EigenValue
           exshift += x;
           for (int i = low; i <= n; i++)
           {
-            H_(i,i) -= x;
+            H_(TOST(i),TOST(i)) -= x;
           }
-          s = NumTools::abs<Real>(H_(n,n-1)) + NumTools::abs<Real>(H_(n-1,n-2));
+          s = NumTools::abs<Real>(H_(TOST(n),TOST(n-1))) + NumTools::abs<Real>(H_(TOST(n-1),TOST(n-2)));
           x = y = 0.75 * s;
           w = -0.4375 * s * s;
         }
@@ -757,7 +761,7 @@ class EigenValue
             s = x - w / ((y - x) / 2.0 + s);
             for (int i = low; i <= n; i++)
             {
-              H_(i,i) -= s;
+              H_(TOST(i),TOST(i)) -= s;
             }
             exshift += s;
             x = y = w = 0.964;
@@ -771,12 +775,12 @@ class EigenValue
         int m = n-2;
         while (m >= l)
         {
-          z = H_(m,m);
+          z = H_(TOST(m),TOST(m));
           r = x - z;
           s = y - z;
-          p = (r * s - w) / H_(m+1,m) + H_(m,m+1);
-          q = H_(m+1,m+1) - z - r - s;
-          r = H_(m+2,m+1);
+          p = (r * s - w) / H_(TOST(m+1),TOST(m)) + H_(TOST(m),TOST(m+1));
+          q = H_(TOST(m+1),TOST(m+1)) - z - r - s;
+          r = H_(TOST(m+2),TOST(m+1));
           s = NumTools::abs<Real>(p) + NumTools::abs<Real>(q) + NumTools::abs<Real>(r);
           p = p / s;
           q = q / s;
@@ -785,9 +789,9 @@ class EigenValue
           {
             break;
           }
-          if (NumTools::abs<Real>(H_(m,m-1)) * (NumTools::abs<Real>(q) + NumTools::abs<Real>(r)) <
-               eps * (NumTools::abs<Real>(p) * (NumTools::abs<Real>(H_(m-1,m-1)) + NumTools::abs<Real>(z) +
-               NumTools::abs<Real>(H_(m+1,m+1)))))
+          if (NumTools::abs<Real>(H_(TOST(m),TOST(m-1))) * (NumTools::abs<Real>(q) + NumTools::abs<Real>(r)) <
+               eps * (NumTools::abs<Real>(p) * (NumTools::abs<Real>(H_(TOST(m-1),TOST(m-1))) + NumTools::abs<Real>(z) +
+               NumTools::abs<Real>(H_(TOST(m+1),TOST(m+1))))))
           {
             break;
           }
@@ -796,10 +800,10 @@ class EigenValue
   
         for (int i = m+2; i <= n; i++)
         {
-          H_(i,i-2) = 0.0;
+          H_(TOST(i),TOST(i-2)) = 0.0;
           if (i > m+2)
           {
-            H_(i,i-3) = 0.0;
+            H_(TOST(i),TOST(i-3)) = 0.0;
           }
         }
  
@@ -810,9 +814,9 @@ class EigenValue
           int notlast = (k != n-1);
           if (k != m)
           {
-            p = H_(k,k-1);
-            q = H_(k+1,k-1);
-            r = (notlast ? H_(k+2,k-1) : 0.0);
+            p = H_(TOST(k),TOST(k-1));
+            q = H_(TOST(k+1),TOST(k-1));
+            r = (notlast ? H_(TOST(k+2),TOST(k-1)) : 0.0);
             x = NumTools::abs<Real>(p) + NumTools::abs<Real>(q) + NumTools::abs<Real>(r);
             if (x != 0.0)
             {
@@ -834,11 +838,11 @@ class EigenValue
           {
             if (k != m)
             {
-              H_(k,k-1) = -s * x;
+              H_(TOST(k),TOST(k-1)) = -s * x;
             }
             else if (l != m)
             {
-              H_(k,k-1) = -H_(k,k-1);
+              H_(TOST(k),TOST(k-1)) = -H_(TOST(k),TOST(k-1));
             }
             p = p + s;
             x = p / s;
@@ -851,42 +855,42 @@ class EigenValue
    
             for (int j = k; j < nn; j++)
             {
-              p = H_(k,j) + q * H_(k+1,j);
+              p = H_(TOST(k),TOST(j)) + q * H_(TOST(k+1),TOST(j));
               if (notlast)
               {
-                p = p + r * H_(k+2,j);
-                H_(k+2,j) = H_(k+2,j) - p * z;
+                p = p + r * H_(TOST(k+2),TOST(j));
+                H_(TOST(k+2),TOST(j)) = H_(TOST(k+2),TOST(j)) - p * z;
               }
-              H_(k,j) = H_(k,j) - p * x;
-              H_(k+1,j) = H_(k+1,j) - p * y;
+              H_(TOST(k),TOST(j)) = H_(TOST(k),TOST(j)) - p * x;
+              H_(TOST(k+1),TOST(j)) = H_(TOST(k+1),TOST(j)) - p * y;
             }
    
             // Column modification
    
             for (int i = 0; i <= std::min(n,k+3); i++)
             {
-              p = x * H_(i,k) + y * H_(i,k+1);
+              p = x * H_(TOST(i),TOST(k)) + y * H_(TOST(i),TOST(k+1));
               if (notlast)
               {
-                p = p + z * H_(i,k+2);
-                H_(i,k+2) = H_(i,k+2) - p * r;
+                p = p + z * H_(TOST(i),TOST(k+2));
+                H_(TOST(i),TOST(k+2)) = H_(TOST(i),TOST(k+2)) - p * r;
               }
-              H_(i,k) = H_(i,k) - p;
-              H_(i,k+1) = H_(i,k+1) - p * q;
+              H_(TOST(i),TOST(k)) = H_(TOST(i),TOST(k)) - p;
+              H_(TOST(i),TOST(k+1)) = H_(TOST(i),TOST(k+1)) - p * q;
             }
    
             // Accumulate transformations
    
             for (int i = low; i <= high; i++)
             {
-              p = x * V_(i,k) + y * V_(i,k+1);
+              p = x * V_(TOST(i),TOST(k)) + y * V_(TOST(i),TOST(k+1));
               if (notlast)
               {
-                p = p + z * V_(i,k+2);
-                V_(i,k+2) = V_(i,k+2) - p * r;
+                p = p + z * V_(TOST(i),TOST(k+2));
+                V_(TOST(i),TOST(k+2)) = V_(TOST(i),TOST(k+2)) - p * r;
               }
-              V_(i,k) = V_(i,k) - p;
-              V_(i,k+1) = V_(i,k+1) - p * q;
+              V_(TOST(i),TOST(k)) = V_(TOST(i),TOST(k)) - p;
+              V_(TOST(i),TOST(k+1)) = V_(TOST(i),TOST(k+1)) - p * q;
             }
           }  // (s != 0)
         }  // k loop
@@ -902,24 +906,24 @@ class EigenValue
    
     for (n = nn-1; n >= 0; n--)
     {
-      p = d_[n];
-      q = e_[n];
+      p = d_[TOST(n)];
+      q = e_[TOST(n)];
    
       // Real vector
    
       if (q == 0)
       {
         int l = n;
-        H_(n,n) = 1.0;
+        H_(TOST(n),TOST(n)) = 1.0;
         for (int i = n-1; i >= 0; i--)
         {
-          w = H_(i,i) - p;
+          w = H_(TOST(i),TOST(i)) - p;
           r = 0.0;
           for (int j = l; j <= n; j++)
           {
-            r = r + H_(i,j) * H_(j,n);
+            r = r + H_(TOST(i),TOST(j)) * H_(TOST(j),TOST(n));
           }
-          if (e_[i] < 0.0)
+          if (e_[TOST(i)] < 0.0)
           {
             z = w;
             s = r;
@@ -927,15 +931,15 @@ class EigenValue
           else
           {
             l = i;
-            if (e_[i] == 0.0)
+            if (e_[TOST(i)] == 0.0)
             {
               if (w != 0.0)
               {
-                H_(i,n) = -r / w;
+                H_(TOST(i),TOST(n)) = -r / w;
               }
               else
               {
-                H_(i,n) = -r / (eps * norm);
+                H_(TOST(i),TOST(n)) = -r / (eps * norm);
               }
    
               // Solve real equations
@@ -943,29 +947,29 @@ class EigenValue
             }
             else
             {
-              x = H_(i,i+1);
-              y = H_(i+1,i);
-              q = (d_[i] - p) * (d_[i] - p) + e_[i] * e_[i];
+              x = H_(TOST(i),TOST(i+1));
+              y = H_(TOST(i+1),TOST(i));
+              q = (d_[TOST(i)] - p) * (d_[TOST(i)] - p) + e_[TOST(i)] * e_[TOST(i)];
               t = (x * s - z * r) / q;
-              H_(i,n) = t;
+              H_(TOST(i),TOST(n)) = t;
               if (NumTools::abs<Real>(x) > NumTools::abs<Real>(z))
               {
-                H_(i+1,n) = (-r - w * t) / x;
+                H_(TOST(i+1),TOST(n)) = (-r - w * t) / x;
               }
               else
               {
-                H_(i+1,n) = (-s - y * t) / z;
+                H_(TOST(i+1),TOST(n)) = (-s - y * t) / z;
               }
             }
    
             // Overflow control
    
-            t = NumTools::abs<Real>(H_(i,n));
+            t = NumTools::abs<Real>(H_(TOST(i),TOST(n)));
             if ((eps * t) * t > 1)
             {
               for (int j = i; j <= n; j++)
               {
-                H_(j,n) = H_(j,n) / t;
+                H_(TOST(j),TOST(n)) = H_(TOST(j),TOST(n)) / t;
               }
             }
           }
@@ -980,19 +984,19 @@ class EigenValue
 
         // Last vector component imaginary so matrix is triangular
    
-        if (NumTools::abs<Real>(H_(n,n-1)) > NumTools::abs<Real>(H_(n-1,n)))
+        if (NumTools::abs<Real>(H_(TOST(n),TOST(n-1))) > NumTools::abs<Real>(H_(TOST(n-1),TOST(n))))
         {
-          H_(n-1,n-1) = q / H_(n,n-1);
-          H_(n-1,n) = -(H_(n,n) - p) / H_(n,n-1);
+          H_(TOST(n-1),TOST(n-1)) = q / H_(TOST(n),TOST(n-1));
+          H_(TOST(n-1),TOST(n)) = -(H_(TOST(n),TOST(n)) - p) / H_(TOST(n),TOST(n-1));
         }
         else
         {
-          cdiv(0.0,-H_(n-1,n),H_(n-1,n-1)-p,q);
-          H_(n-1,n-1) = cdivr;
-          H_(n-1,n) = cdivi;
+          cdiv(0.0,-H_(TOST(n-1),TOST(n)),H_(TOST(n-1),TOST(n-1))-p,q);
+          H_(TOST(n-1),TOST(n-1)) = cdivr;
+          H_(TOST(n-1),TOST(n)) = cdivi;
         }
-        H_(n,n-1) = 0.0;
-        H_(n,n) = 1.0;
+        H_(TOST(n),TOST(n-1)) = 0.0;
+        H_(TOST(n),TOST(n)) = 1.0;
         for (int i = n-2; i >= 0; i--)
         {
           Real ra,sa,vr,vi;
@@ -1000,12 +1004,12 @@ class EigenValue
           sa = 0.0;
           for (int j = l; j <= n; j++)
           {
-            ra = ra + H_(i,j) * H_(j,n-1);
-            sa = sa + H_(i,j) * H_(j,n);
+            ra = ra + H_(TOST(i),TOST(j)) * H_(TOST(j),TOST(n-1));
+            sa = sa + H_(TOST(i),TOST(j)) * H_(TOST(j),TOST(n));
           }
-          w = H_(i,i) - p;
+          w = H_(TOST(i),TOST(i)) - p;
    
-          if (e_[i] < 0.0)
+          if (e_[TOST(i)] < 0.0)
           {
             z = w;
             r = ra;
@@ -1014,49 +1018,49 @@ class EigenValue
           else
           {
             l = i;
-            if (e_[i] == 0)
+            if (e_[TOST(i)] == 0)
             {
               cdiv(-ra,-sa,w,q);
-              H_(i,n-1) = cdivr;
-              H_(i,n) = cdivi;
+              H_(TOST(i),TOST(n-1)) = cdivr;
+              H_(TOST(i),TOST(n)) = cdivi;
             }
             else
             {
               // Solve complex equations
  
-              x = H_(i,i+1);
-              y = H_(i+1,i);
-              vr = (d_[i] - p) * (d_[i] - p) + e_[i] * e_[i] - q * q;
-              vi = (d_[i] - p) * 2.0 * q;
+              x = H_(TOST(i),TOST(i+1));
+              y = H_(TOST(i+1),TOST(i));
+              vr = (d_[TOST(i)] - p) * (d_[TOST(i)] - p) + e_[TOST(i)] * e_[TOST(i)] - q * q;
+              vi = (d_[TOST(i)] - p) * 2.0 * q;
               if ((vr == 0.0) && (vi == 0.0))
               {
                 vr = eps * norm * (NumTools::abs<Real>(w) + NumTools::abs<Real>(q) +
                 NumTools::abs<Real>(x) + NumTools::abs<Real>(y) + NumTools::abs<Real>(z));
               }
               cdiv(x*r-z*ra+q*sa,x*s-z*sa-q*ra,vr,vi);
-              H_(i,n-1) = cdivr;
-              H_(i,n) = cdivi;
+              H_(TOST(i),TOST(n-1)) = cdivr;
+              H_(TOST(i),TOST(n)) = cdivi;
               if (NumTools::abs<Real>(x) > (NumTools::abs<Real>(z) + NumTools::abs<Real>(q)))
               {
-                H_(i+1,n-1) = (-ra - w * H_(i,n-1) + q * H_(i,n)) / x;
-                H_(i+1,n) = (-sa - w * H_(i,n) - q * H_(i,n-1)) / x;
+                H_(TOST(i+1),TOST(n-1)) = (-ra - w * H_(TOST(i),TOST(n-1)) + q * H_(TOST(i),TOST(n))) / x;
+                H_(TOST(i+1),TOST(n)) = (-sa - w * H_(TOST(i),TOST(n)) - q * H_(TOST(i),TOST(n-1))) / x;
               }
               else
               {
-                cdiv(-r-y*H_(i,n-1),-s-y*H_(i,n),z,q);
-                H_(i+1,n-1) = cdivr;
-                H_(i+1,n) = cdivi;
+                cdiv(-r-y*H_(TOST(i),TOST(n-1)),-s-y*H_(TOST(i),TOST(n)),z,q);
+                H_(TOST(i+1),TOST(n-1)) = cdivr;
+                H_(TOST(i+1),TOST(n)) = cdivi;
               }
             }
  
             // Overflow control
-            t = std::max(NumTools::abs<Real>(H_(i,n-1)),NumTools::abs<Real>(H_(i,n)));
+            t = std::max(NumTools::abs<Real>(H_(TOST(i),TOST(n-1))),NumTools::abs<Real>(H_(TOST(i),TOST(n))));
             if ((eps * t) * t > 1)
             {
               for (int j = i; j <= n; j++)
               {
-                H_(j,n-1) = H_(j,n-1) / t;
-                H_(j,n) = H_(j,n) / t;
+                H_(TOST(j),TOST(n-1)) = H_(TOST(j),TOST(n-1)) / t;
+                H_(TOST(j),TOST(n)) = H_(TOST(j),TOST(n)) / t;
               }
             }
           }
@@ -1072,7 +1076,7 @@ class EigenValue
       {
         for (int j = i; j < nn; j++)
         {
-          V_(i,j) = H_(i,j);
+          V_(TOST(i),TOST(j)) = H_(TOST(i),TOST(j));
         }
       }
     }
@@ -1086,9 +1090,9 @@ class EigenValue
         z = 0.0;
         for (int k = low; k <= std::min(j,high); k++)
         {
-          z = z + V_(i,k) * H_(k,j);
+          z = z + V_(TOST(i),TOST(k)) * H_(TOST(k),TOST(j));
         }
-        V_(i,j) = z;
+        V_(TOST(i),TOST(j)) = z;
       }
     }
   }
diff --git a/src/Bpp/Numeric/Matrix/Matrix.h b/src/Bpp/Numeric/Matrix/Matrix.h
index 42d2f32..dac0a53 100644
--- a/src/Bpp/Numeric/Matrix/Matrix.h
+++ b/src/Bpp/Numeric/Matrix/Matrix.h
@@ -63,12 +63,14 @@ public:
   virtual ~Matrix() {}
 
 public:
+
   /**
    * @return \f$m_{i,j}\f$.
    * @param i row index.
    * @param j column index.
    */
   virtual const Scalar& operator()(size_t i, size_t j) const = 0;
+  
   /**
    * @return \f$m_{i,j}\f$.
    * @param i row index.
@@ -116,6 +118,7 @@ public:
   virtual void resize(size_t nRows, size_t nCols) = 0;
 };
 
+
 /**
  * @brief Matrix storage by row.
  *
@@ -190,6 +193,11 @@ public:
     return r;
   }
 
+  const std::vector<Scalar>& getRow(size_t i) const
+  {
+    return m_[i];
+  }
+
   std::vector<Scalar> col(size_t j) const
   {
     std::vector<Scalar> c(getNumberOfRows());
@@ -208,12 +216,116 @@ public:
 
   void addRow(const std::vector<Scalar>& newRow) throw (DimensionException)
   {
-    if (newRow.size() != getNumberOfColumns()) throw DimensionException("RowMatrix::addRow: invalid row dimension", newRow.size(), getNumberOfColumns());
+    if (getNumberOfColumns()!=0 && newRow.size() != getNumberOfColumns())
+      throw DimensionException("RowMatrix::addRow: invalid row dimension", newRow.size(), getNumberOfColumns());
     m_.push_back(newRow);
   }
 };
 
 /**
+ * @brief Matrix storage by column.
+ *
+ * This matrix is a vector of vector of Scalar.
+ * Column access is in \f$O(1)\f$ while row access is in \f$O(nCol)\f$.
+ */
+  template<class Scalar>
+  class ColMatrix :
+    public Matrix<Scalar>
+  {
+  private:
+    std::vector< std::vector<Scalar> > m_;
+
+  public:
+    ColMatrix() : m_() {}
+
+    ColMatrix(size_t nRow, size_t nCol) : m_(nCol)
+    {
+      for (size_t i = 0; i < nCol; i++)
+      {
+        m_[i].resize(nRow);
+      }
+    }
+
+    ColMatrix(const Matrix<Scalar>& m) : m_(m.getNumberOfColumns())
+    {
+      size_t nr = m.getNumberOfRows();
+      size_t nc = m.getNumberOfColumns();
+      for (size_t i = 0; i < nc; i++)
+      {
+        m_[i].resize(nr);
+        for (size_t j = 0; j < nr; j++)
+        {
+          m_[i][j] = m(j, i);
+        }
+      }
+    }
+
+    ColMatrix& operator=(const Matrix<Scalar>& m)
+    {
+      size_t nc = m.getNumberOfColumns();
+      m_.resize(nc);
+      size_t nr = m.getNumberOfRows();
+      for (size_t i = 0; i < nc; i++)
+      {
+        m_[i].resize(nr);
+        for (size_t j = 0; j < nr; j++)
+        {
+          m_[i][j] = m(j, i);
+        }
+      }
+      return *this;
+    }
+
+    virtual ~ColMatrix() {}
+
+  public:
+    ColMatrix* clone() const { return new ColMatrix(*this); }
+
+    const Scalar& operator()(size_t i, size_t j) const { return m_[j][i]; }
+
+    Scalar& operator()(size_t i, size_t j) { return m_[j][i]; }
+
+    size_t getNumberOfColumns() const { return m_.size(); }
+
+    size_t getNumberOfRows() const { return m_.size() == 0 ? 0 : m_[0].size(); }
+
+    std::vector<Scalar> row(size_t i) const
+    {
+      std::vector<Scalar> r(getNumberOfColumns());
+      for (size_t j = 0; j < getNumberOfColumns(); j++) { r[j] = operator()(i, j); }
+      return r;
+    }
+
+    const std::vector<Scalar>& getCol(size_t i) const
+    {
+      return m_[i];
+    }
+
+    std::vector<Scalar> col(size_t j) const
+    {
+      std::vector<Scalar> c(getNumberOfRows());
+      for (size_t i = 0; i < getNumberOfRows(); i++) { c[i] = operator()(i, j); }
+      return c;
+    }
+
+    void resize(size_t nRows, size_t nCols)
+    {
+      m_.resize(nCols);
+      for (size_t i = 0; i < nCols; i++)
+      {
+        m_[i].resize(nRows);
+      }
+    }
+
+    void addCol(const std::vector<Scalar>& newCol) throw (DimensionException)
+    {
+      if (getNumberOfRows()!=0 && newCol.size() != getNumberOfRows())
+        throw DimensionException("ColMatrix::addCol: invalid column dimension", newCol.size(), getNumberOfRows());
+      m_.push_back(newCol);
+    }
+  };
+
+/**
  * @brief Matrix storage in one vector.
  *
  * This Matrix is a simple vector of Scalar of size n x m.
diff --git a/src/Bpp/Numeric/Matrix/MatrixTools.h b/src/Bpp/Numeric/Matrix/MatrixTools.h
index b1a62e8..c988f29 100644
--- a/src/Bpp/Numeric/Matrix/MatrixTools.h
+++ b/src/Bpp/Numeric/Matrix/MatrixTools.h
@@ -5,37 +5,37 @@
 //
 
 /*
-   Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
-
-   This software is a computer program whose purpose is to provide classes
-   for numerical calculus. This file is part of the Bio++ project.
-
-   This software is governed by the CeCILL  license under French law and
-   abiding by the rules of distribution of free software.  You can  use,
-   modify and/ or redistribute the software under the terms of the CeCILL
-   license as circulated by CEA, CNRS and INRIA at the following URL
-   "http://www.cecill.info".
-
-   As a counterpart to the access to the source code and  rights to copy,
-   modify and redistribute granted by the license, users are provided only
-   with a limited warranty  and the software's author,  the holder of the
-   economic rights,  and the successive licensors  have only  limited
-   liability.
-
-   In this respect, the user's attention is drawn to the risks associated
-   with loading,  using,  modifying and/or developing or reproducing the
-   software by the user in light of its specific status of free software,
-   that may mean  that it is complicated to manipulate,  and  that  also
-   therefore means  that it is reserved for developers  and  experienced
-   professionals having in-depth computer knowledge. Users are therefore
-   encouraged to load and test the software's suitability as regards their
-   requirements in conditions enabling the security of their systems and/or
-   data to be ensured and,  more generally, to use and operate it in the
-   same conditions as regards security.
-
-   The fact that you are presently reading this means that you have had
-   knowledge of the CeCILL license and that you accept its terms.
- */
+  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for numerical calculus. This file is part of the Bio++ project.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use,
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info".
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability.
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or
+  data to be ensured and,  more generally, to use and operate it in the
+  same conditions as regards security.
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
+*/
 
 #ifndef _MATRIXTOOLS_H_
 #define _MATRIXTOOLS_H_
@@ -44,6 +44,7 @@
 #include "Matrix.h"
 #include "LUDecomposition.h"
 #include "EigenValue.h"
+#include "../../Io/OutputStream.h"
 
 #include <cstdio>
 #include <iostream>
@@ -53,1162 +54,1191 @@ namespace bpp
 /**
  * @brief Functions dealing with matrices.
  */
-class MatrixTools
-{
-public:
-  MatrixTools() {}
-  ~MatrixTools() {}
-
-public:
-  /**
-   * @brief Copy operation. This function supplies the lack of inheritence of the assigment operator :D .
-   *
-   * @param A [in] Original matrix.
-   * @param O [out] A copy of the given matrix.
-   */
-  template<class MatrixA, class MatrixO>
-  static void copy(const MatrixA& A, MatrixO& O)
+  class MatrixTools
   {
-    O.resize(A.getNumberOfRows(), A.getNumberOfColumns());
-    for (size_t i = 0; i < A.getNumberOfRows(); i++)
+  public:
+    MatrixTools() {}
+    ~MatrixTools() {}
+
+  public:
+    /**
+     * @brief Copy operation. This function supplies the lack of inheritence of the assigment operator :D .
+     *
+     * @param A [in] Original matrix.
+     * @param O [out] A copy of the given matrix.
+     */
+    template<class MatrixA, class MatrixO>
+    static void copy(const MatrixA& A, MatrixO& O)
     {
-      for (size_t j = 0; j < A.getNumberOfColumns(); j++)
+      O.resize(A.getNumberOfRows(), A.getNumberOfColumns());
+      for (size_t i = 0; i < A.getNumberOfRows(); i++)
       {
-        O(i, j) = A(i, j);
+        for (size_t j = 0; j < A.getNumberOfColumns(); j++)
+        {
+          O(i, j) = A(i, j);
+        }
       }
     }
-  }
-
-  /**
-   * @brief Get a identity matrix of a given size.
-   *
-   * @param n the size of the matrix.
-   * @param O [out] A identity matrix of size n.
-   */
-  template<class Matrix>
-  static void getId(size_t n, Matrix& O)
-  {
-    O.resize(n, n);
-    for (size_t i = 0; i < n; i++)
+
+    /**
+     * @brief Get a identity matrix of a given size.
+     *
+     * @param n the size of the matrix.
+     * @param O [out] A identity matrix of size n.
+     */
+    template<class Matrix>
+    static void getId(size_t n, Matrix& O)
     {
-      for (size_t j = 0; j < n; j++) {
-        O(i, j) = (i == j) ? 1 : 0;
+      O.resize(n, n);
+      for (size_t i = 0; i < n; i++)
+      {
+        for (size_t j = 0; j < n; j++) {
+          O(i, j) = (i == j) ? 1 : 0;
+        }
       }
     }
-  }
-
-  /**
-   * @param D [in] A vector of diagonal elements.
-   * @param O [out] A diagonal matrix with diagonal elements taken from a vector.
-   */
-  template<class Scalar>
-  static void diag(const std::vector<Scalar>& D, Matrix<Scalar>& O)
-  {
-    size_t n = D.size();
-    O.resize(n, n);
-    for (size_t i = 0; i < n; i++)
+
+    /**
+     * @param D [in] A vector of diagonal elements.
+     * @param O [out] A diagonal matrix with diagonal elements taken from a vector.
+     */
+    template<class Scalar>
+    static void diag(const std::vector<Scalar>& D, Matrix<Scalar>& O)
     {
-      for (size_t j = 0; j < n; j++) { O(i, j) = (i == j) ? D[i] : 0;}
+      size_t n = D.size();
+      O.resize(n, n);
+      for (size_t i = 0; i < n; i++)
+      {
+        for (size_t j = 0; j < n; j++) { O(i, j) = (i == j) ? D[i] : 0;}
+      }
     }
-  }
-
-  /**
-   * @param x [in] A scalar
-   * @param n [in] the dimension of the output matrix
-   * @param O [out] A diagonal matrix with diagonal elements equal to x
-   */
-  template<class Scalar>
-  static void diag(const Scalar x, size_t n, Matrix<Scalar>& O)
-  {
-    O.resize(n, n);
-    for (size_t i = 0; i < n; i++)
+
+    /**
+     * @param x [in] A scalar
+     * @param n [in] the dimension of the output matrix
+     * @param O [out] A diagonal matrix with diagonal elements equal to x
+     */
+    template<class Scalar>
+    static void diag(const Scalar x, size_t n, Matrix<Scalar>& O)
+    {
+      O.resize(n, n);
+      for (size_t i = 0; i < n; i++)
       {
         for (size_t j = 0; j < n; j++) { O(i, j) = (i == j) ? x : 0;}
       }
-  }
-
-  /**
-   * @param M [in] The matrix.
-   * @param O [out] The diagonal elements of a square matrix as a vector.
-   * @throw DimensionException If M is not a square matrix.
-   */
-  template<class Scalar>
-  static void diag(const Matrix<Scalar>& M, std::vector<Scalar>& O) throw (DimensionException)
-  {
-    size_t nc = M.getNumberOfColumns();
-    size_t nr = M.getNumberOfRows();
-    if (nc != nr) throw DimensionException("MatrixTools::diag(). M must be a square matrix.", nr, nc);
-    O.resize(nc);
-    for (size_t i = 0; i < nc; i++) { O[i] = M(i, i);}
-  }
-
-  /**
-   * @brief Set all elements in M to value x.
-   * @param M A matrix.
-   * @param x The value to use.
-   */
-  template<class Matrix, class Scalar>
-  static void fill(Matrix& M, Scalar x)
-  {
-    for (size_t i = 0; i < M.getNumberOfRows(); i++)
+    }
+
+    /**
+     * @param M [in] The matrix.
+     * @param O [out] The diagonal elements of a square matrix as a vector.
+     * @throw DimensionException If M is not a square matrix.
+     */
+    template<class Scalar>
+    static void diag(const Matrix<Scalar>& M, std::vector<Scalar>& O) throw (DimensionException)
     {
-      for (size_t j = 0; j < M.getNumberOfColumns(); j++)
+      size_t nc = M.getNumberOfColumns();
+      size_t nr = M.getNumberOfRows();
+      if (nc != nr) throw DimensionException("MatrixTools::diag(). M must be a square matrix.", nr, nc);
+      O.resize(nc);
+      for (size_t i = 0; i < nc; i++) { O[i] = M(i, i);}
+    }
+
+    /**
+     * @brief Set all elements in M to value x.
+     * @param M A matrix.
+     * @param x The value to use.
+     */
+    template<class Matrix, class Scalar>
+    static void fill(Matrix& M, Scalar x)
+    {
+      for (size_t i = 0; i < M.getNumberOfRows(); i++)
       {
-        M(i, j) = x;
+        for (size_t j = 0; j < M.getNumberOfColumns(); j++)
+        {
+          M(i, j) = x;
+        }
       }
     }
-  }
-
-  /**
-   * @brief Multiply all elements of a matrix by a given value, and add a constant.
-   *
-   * Performs \f$\forall i \forall j m_{i,j} = a.m_{i,j}+b\f$.
-   *
-   * @param A A matrix.
-   * @param a Multiplicator.
-   * @param b Constant.
-   */
-  template<class Matrix, class Scalar>
-  static void scale(Matrix& A, Scalar a, Scalar b = 0)
-  {
-    for (size_t i = 0; i < A.getNumberOfRows(); i++)
+
+    /**
+     * @brief Multiply all elements of a matrix by a given value, and add a constant.
+     *
+     * Performs \f$\forall i \forall j m_{i,j} = a.m_{i,j}+b\f$.
+     *
+     * @param A A matrix.
+     * @param a Multiplicator.
+     * @param b Constant.
+     */
+    template<class Matrix, class Scalar>
+    static void scale(Matrix& A, Scalar a, Scalar b = 0)
     {
-      for (size_t j = 0; j < A.getNumberOfColumns(); j++)
+      for (size_t i = 0; i < A.getNumberOfRows(); i++)
       {
-        A(i, j) = a * A(i, j) + b;
+        for (size_t j = 0; j < A.getNumberOfColumns(); j++)
+        {
+          A(i, j) = a * A(i, j) + b;
+        }
       }
     }
-  }
-
-  /**
-   * @param A [in] First matrix.
-   * @param B [in] Second matrix.
-   * @param O [out] The dot product of two matrices.
-   */
-  template<class Scalar>
-  static void mult(const Matrix<Scalar>& A, const Matrix<Scalar>& B, Matrix<Scalar>& O) throw (DimensionException)
-  {
-    size_t ncA = A.getNumberOfColumns();
-    size_t nrA = A.getNumberOfRows();
-    size_t nrB = B.getNumberOfRows();
-    size_t ncB = B.getNumberOfColumns();
-    if (ncA != nrB) throw DimensionException("MatrixTools::mult(). nrows B != ncols A.", nrB, ncA);
-    O.resize(nrA, ncB);
-    for (size_t i = 0; i < nrA; i++)
+
+    /**
+     * @param A [in] First matrix.
+     * @param B [in] Second matrix.
+     * @param O [out] The dot product of two matrices.
+     */
+    template<class Scalar>
+    static void mult(const Matrix<Scalar>& A, const Matrix<Scalar>& B, Matrix<Scalar>& O) throw (DimensionException)
     {
-      for (size_t j = 0; j < ncB; j++)
+      size_t ncA = A.getNumberOfColumns();
+      size_t nrA = A.getNumberOfRows();
+      size_t nrB = B.getNumberOfRows();
+      size_t ncB = B.getNumberOfColumns();
+      if (ncA != nrB) throw DimensionException("MatrixTools::mult(). nrows B != ncols A.", nrB, ncA);
+      O.resize(nrA, ncB);
+      for (size_t i = 0; i < nrA; i++)
       {
-        O(i, j) = 0;
-        for (size_t k = 0; k < ncA; k++)
+        for (size_t j = 0; j < ncB; j++)
         {
-          O(i, j) += A(i, k) * B(k, j);
+          O(i, j) = 0;
+          for (size_t k = 0; k < ncA; k++)
+          {
+            O(i, j) += A(i, k) * B(k, j);
+          }
         }
       }
     }
-  }
-
-  /**
-   * @brief Compute A . D . B where D is a diagonal matrix in O(n^3).
-   *
-   * Since D is a diagonal matrix, this function is more efficient than doing
-   * mult(mult(A, diag(D)), B), which involves two 0(n^3) operations.
-   *
-   * @param A [in] The first matrix.
-   * @param D [in] The diagonal matrix (only diagonal elements in a vector)
-   * @param B [in] The second matrix.
-   * @param O [out] The result matrix.
-   * @throw DimensionException If matrices have not the appropriate size.
-   */
-  template<class Scalar>
-  static void mult(const Matrix<Scalar>& A, const std::vector<Scalar>& D, const Matrix<Scalar>& B, Matrix<Scalar>& O) throw (DimensionException)
-  {
-    size_t ncA = A.getNumberOfColumns();
-    size_t nrA = A.getNumberOfRows();
-    size_t nrB = B.getNumberOfRows();
-    size_t ncB = B.getNumberOfColumns();
-    if (ncA != nrB) throw DimensionException("MatrixTools::mult(). nrows B != ncols A.", nrB, ncA);
-    if (ncA != D.size()) throw DimensionException("MatrixTools::mult(). Vector size is not equal to matrix size.", D.size(), ncA);
-    O.resize(nrA, ncB);
-    for (size_t i = 0; i < nrA; i++)
+
+    /**
+     * @brief Compute A . D . B where D is a diagonal matrix in O(n^3).
+     *
+     * Since D is a diagonal matrix, this function is more efficient than doing
+     * mult(mult(A, diag(D)), B), which involves two 0(n^3) operations.
+     *
+     * @param A [in] The first matrix.
+     * @param D [in] The diagonal matrix (only diagonal elements in a vector)
+     * @param B [in] The second matrix.
+     * @param O [out] The result matrix.
+     * @throw DimensionException If matrices have not the appropriate size.
+     */
+    template<class Scalar>
+    static void mult(const Matrix<Scalar>& A, const std::vector<Scalar>& D, const Matrix<Scalar>& B, Matrix<Scalar>& O) throw (DimensionException)
     {
-      for (size_t j = 0; j < ncB; j++)
+      size_t ncA = A.getNumberOfColumns();
+      size_t nrA = A.getNumberOfRows();
+      size_t nrB = B.getNumberOfRows();
+      size_t ncB = B.getNumberOfColumns();
+      if (ncA != nrB) throw DimensionException("MatrixTools::mult(). nrows B != ncols A.", nrB, ncA);
+      if (ncA != D.size()) throw DimensionException("MatrixTools::mult(). Vector size is not equal to matrix size.", D.size(), ncA);
+      O.resize(nrA, ncB);
+      for (size_t i = 0; i < nrA; i++)
       {
-        O(i, j) = 0;
-        for (size_t k = 0; k < ncA; k++)
+        for (size_t j = 0; j < ncB; j++)
         {
-          O(i, j) += A(i, k) * B(k, j) * D[k];
+          O(i, j) = 0;
+          for (size_t k = 0; k < ncA; k++)
+          {
+            O(i, j) += A(i, k) * B(k, j) * D[k];
+          }
         }
       }
     }
-  }
-
-  /**
-   * @brief Compute A . (U+D+L) . B where D is a diagonal matrix, U
-   * (resp. L) is a matrix in which the only non-zero terms are on the
-   * diagonal that is over (resp. under) the main diagonal, in O(n^3).
-   *
-   * Since D is a diagonal matrix, this function is more efficient than doing
-   * mult(mult(A, diag(D)), B), which involves two 0(n^3) operations.
-   *
-   * @param A [in] The first matrix.
-   * @param D [in] The diagonal matrix (only diagonal elements in a vector)
-   * @param U [in] The upper diagonal matrix (only upper diagonal elements in a vector)
-   * @param L [in] The lower diagonal matrix (only lower diagonal elements in a vector)
-   * @param B [in] The second matrix.
-   * @param O [out] The result matrix.
-   * @throw DimensionException If matrices have not the appropriate size.
-   */
-  template<class Scalar>
-  static void mult(const Matrix<Scalar>& A, const std::vector<Scalar>& D, const std::vector<Scalar>& U, const std::vector<Scalar>& L, const Matrix<Scalar>& B, Matrix<Scalar>& O) throw (DimensionException)
-  {
-    size_t ncA = A.getNumberOfColumns();
-    size_t nrA = A.getNumberOfRows();
-    size_t nrB = B.getNumberOfRows();
-    size_t ncB = B.getNumberOfColumns();
-    if (ncA != nrB) throw DimensionException("MatrixTools::mult(). nrows B != ncols A.", nrB, ncA);
-    if (ncA != D.size()) throw DimensionException("MatrixTools::mult(). Vector size is not equal to matrix size.", D.size(), ncA);
-    if (ncA != U.size()+1) throw DimensionException("MatrixTools::mult(). Vector size is not equal to matrix size-1.", U.size(), ncA);
-    if (ncA != L.size()+1) throw DimensionException("MatrixTools::mult(). Vector size is not equal to matrix size-1.", L.size(), ncA);
-    O.resize(nrA, ncB);
-    for (size_t i = 0; i < nrA; i++)
+
+    /**
+     * @brief Compute A . (U+D+L) . B where D is a diagonal matrix, U
+     * (resp. L) is a matrix in which the only non-zero terms are on the
+     * diagonal that is over (resp. under) the main diagonal, in O(n^3).
+     *
+     * Since D is a diagonal matrix, this function is more efficient than doing
+     * mult(mult(A, diag(D)), B), which involves two 0(n^3) operations.
+     *
+     * @param A [in] The first matrix.
+     * @param D [in] The diagonal matrix (only diagonal elements in a vector)
+     * @param U [in] The upper diagonal matrix (only upper diagonal elements in a vector)
+     * @param L [in] The lower diagonal matrix (only lower diagonal elements in a vector)
+     * @param B [in] The second matrix.
+     * @param O [out] The result matrix.
+     * @throw DimensionException If matrices have not the appropriate size.
+     */
+    template<class Scalar>
+    static void mult(const Matrix<Scalar>& A, const std::vector<Scalar>& D, const std::vector<Scalar>& U, const std::vector<Scalar>& L, const Matrix<Scalar>& B, Matrix<Scalar>& O) throw (DimensionException)
+    {
+      size_t ncA = A.getNumberOfColumns();
+      size_t nrA = A.getNumberOfRows();
+      size_t nrB = B.getNumberOfRows();
+      size_t ncB = B.getNumberOfColumns();
+      if (ncA != nrB) throw DimensionException("MatrixTools::mult(). nrows B != ncols A.", nrB, ncA);
+      if (ncA != D.size()) throw DimensionException("MatrixTools::mult(). Vector size is not equal to matrix size.", D.size(), ncA);
+      if (ncA != U.size()+1) throw DimensionException("MatrixTools::mult(). Vector size is not equal to matrix size-1.", U.size(), ncA);
+      if (ncA != L.size()+1) throw DimensionException("MatrixTools::mult(). Vector size is not equal to matrix size-1.", L.size(), ncA);
+      O.resize(nrA, ncB);
+      for (size_t i = 0; i < nrA; i++)
       {
         for (size_t j = 0; j < ncB; j++)
+        {
+          O(i, j) = A(i, 0) * D[0] * B(0, j);
+          if (nrB>1)
+            O(i, j) += A(i,0) * U[0] * B(1,j);
+          for (size_t k = 1; k < ncA-1; k++)
           {
-            O(i, j) = A(i, 0) * D[0] * B(0, j);
-            if (nrB>1)
-              O(i, j) += A(i,0) * U[0] * B(1,j);
-            for (size_t k = 1; k < ncA-1; k++)
-              {
-                O(i, j) += A(i, k) * (L[k-1] * B(k-1, j) + D[k] * B(k, j) + U[k] * B(k+1,j));
-              }
-            if (ncA>=2)
-              O(i, j) += A(i, ncA-1) * L[ncA-2] * B(ncA-2, j);
-            O(i,j) += A(i, ncA-1) * D[ncA-1] * B(ncA-1, j);
+            O(i, j) += A(i, k) * (L[k-1] * B(k-1, j) + D[k] * B(k, j) + U[k] * B(k+1,j));
           }
+          if (ncA>=2)
+            O(i, j) += A(i, ncA-1) * L[ncA-2] * B(ncA-2, j);
+          O(i,j) += A(i, ncA-1) * D[ncA-1] * B(ncA-1, j);
+        }
       }
-  }
-
-  /**
-   * @brief Add matrix B to matrix A.
-   *
-   * @param A [in] Matrix A
-   * @param B [in] Matrix B
-   * @throw DimensionException If A and B have note the same size.
-   */
-  template<class MatrixA, class MatrixB>
-  static void add(MatrixA& A, const MatrixB& B) throw (DimensionException)
-  {
-    size_t ncA = A.getNumberOfColumns();
-    size_t nrA = A.getNumberOfRows();
-    size_t nrB = B.getNumberOfRows();
-    size_t ncB = B.getNumberOfColumns();
-    if (ncA != ncB) throw DimensionException("MatrixTools::operator+(). A and B must have the same number of colums.", ncB, ncA);
-    if (nrA != nrB) throw DimensionException("MatrixTools::operator+(). A and B must have the same number of rows.", nrB, nrA);
-    for (size_t i = 0; i < A.getNumberOfRows(); i++)
+    }
+
+    /**
+     * @brief Add matrix B to matrix A.
+     *
+     * @param A [in] Matrix A
+     * @param B [in] Matrix B
+     * @throw DimensionException If A and B have note the same size.
+     */
+    template<class MatrixA, class MatrixB>
+    static void add(MatrixA& A, const MatrixB& B) throw (DimensionException)
     {
-      for (size_t j = 0; j < A.getNumberOfColumns(); j++)
+      size_t ncA = A.getNumberOfColumns();
+      size_t nrA = A.getNumberOfRows();
+      size_t nrB = B.getNumberOfRows();
+      size_t ncB = B.getNumberOfColumns();
+      if (ncA != ncB) throw DimensionException("MatrixTools::operator+(). A and B must have the same number of colums.", ncB, ncA);
+      if (nrA != nrB) throw DimensionException("MatrixTools::operator+(). A and B must have the same number of rows.", nrB, nrA);
+      for (size_t i = 0; i < A.getNumberOfRows(); i++)
       {
-        A(i, j) += B(i, j);
+        for (size_t j = 0; j < A.getNumberOfColumns(); j++)
+        {
+          A(i, j) += B(i, j);
+        }
       }
     }
-  }
-
-  /**
-   * @brief Add matrix x.B to matrix A.
-   *
-   * @param A [in,out] Matrix A
-   * @param x [in] Scalar x
-   * @param B [in] Matrix B
-   * @throw DimensionException If A and B have note the same size.
-   */
-  template<class MatrixA, class MatrixB, class Scalar>
-  static void add(MatrixA& A, Scalar& x, const MatrixB& B) throw (DimensionException)
-  {
-    size_t ncA = A.getNumberOfColumns();
-    size_t nrA = A.getNumberOfRows();
-    size_t nrB = B.getNumberOfRows();
-    size_t ncB = B.getNumberOfColumns();
-    if (ncA != ncB) throw DimensionException("MatrixTools::operator+(). A and B must have the same number of colums.", ncB, ncA);
-    if (nrA != nrB) throw DimensionException("MatrixTools::operator+(). A and B must have the same number of rows.", nrB, nrA);
-    for (size_t i = 0; i < A.getNumberOfRows(); i++)
+
+    /**
+     * @brief Add matrix x.B to matrix A.
+     *
+     * @param A [in,out] Matrix A
+     * @param x [in] Scalar x
+     * @param B [in] Matrix B
+     * @throw DimensionException If A and B have note the same size.
+     */
+    template<class MatrixA, class MatrixB, class Scalar>
+    static void add(MatrixA& A, Scalar& x, const MatrixB& B) throw (DimensionException)
+    {
+      size_t ncA = A.getNumberOfColumns();
+      size_t nrA = A.getNumberOfRows();
+      size_t nrB = B.getNumberOfRows();
+      size_t ncB = B.getNumberOfColumns();
+      if (ncA != ncB) throw DimensionException("MatrixTools::operator+(). A and B must have the same number of colums.", ncB, ncA);
+      if (nrA != nrB) throw DimensionException("MatrixTools::operator+(). A and B must have the same number of rows.", nrB, nrA);
+      for (size_t i = 0; i < A.getNumberOfRows(); i++)
       {
         for (size_t j = 0; j < A.getNumberOfColumns(); j++)
-          {
-            A(i, j) += x*B(i, j);
-          }
-      }
-  }
-
-  /**
-   * @brief Compute the power of a given matrix.
-   *
-   * @param A [in] The matrix.
-   * @param p The number of multiplications.
-   * @param O [out]\f$  A^p \f$ computed recursively:
-   *               \f$ A^{2n} = (A^n)^2 \f$
-   *               \f$ A^{2n+1} = A*(A^n)^2 \f$   
-   * If p = 0, sends the identity matrix.
-   * @throw DimensionException If m is not a square matrix.
-   */
-  template<class Matrix>
-  static void pow(const Matrix& A, size_t p, Matrix& O) throw (DimensionException)
-  {
-    size_t n = A.getNumberOfRows();
-    if (n != A.getNumberOfColumns()) throw DimensionException("MatrixTools::pow(). nrows != ncols.", A.getNumberOfColumns(), A.getNumberOfRows());
-    switch(p){
-    case 0:
-      getId<Matrix>(n, O);
-      break;
-    case 1:
-      copy(A,O);
-      break;
-    case 2:
-      mult(A,A,O);
-      break;
-    default:
-      Matrix tmp;
-      if (p%2){
-        pow(A,p/2,tmp);
-        pow(tmp,2,O);
+        {
+          A(i, j) += x*B(i, j);
+        }
       }
-      else{
-        pow(A,(p-1)/2,tmp);
-        pow(tmp,2,O);
-        mult(A,O,tmp);
-        copy(tmp,O);
+    }
+
+    /**
+     * @brief Compute the power of a given matrix.
+     *
+     * @param A [in] The matrix.
+     * @param p The number of multiplications.
+     * @param O [out]\f$  A^p \f$ computed recursively:
+     *               \f$ A^{2n} = (A^n)^2 \f$
+     *               \f$ A^{2n+1} = A*(A^n)^2 \f$   
+     * If p = 0, sends the identity matrix.
+     * @throw DimensionException If m is not a square matrix.
+     */
+    template<class Matrix>
+    static void pow(const Matrix& A, size_t p, Matrix& O) throw (DimensionException)
+    {
+      size_t n = A.getNumberOfRows();
+      if (n != A.getNumberOfColumns()) throw DimensionException("MatrixTools::pow(). nrows != ncols.", A.getNumberOfColumns(), A.getNumberOfRows());
+      switch(p){
+      case 0:
+        getId<Matrix>(n, O);
+        break;
+      case 1:
+        copy(A,O);
+        break;
+      case 2:
+        mult(A,A,O);
+        break;
+      default:
+        Matrix tmp;
+        if (p%2){
+          pow(A,p/2,tmp);
+          pow(tmp,2,O);
+        }
+        else{
+          pow(A,(p-1)/2,tmp);
+          pow(tmp,2,O);
+          mult(A,O,tmp);
+          copy(tmp,O);
+        }
       }
     }
-  }
-
-  /**
-   * @brief Compute the power of a given matrix, using eigen value decomposition.
-   *
-   * @param A [in] The matrix.
-   * @param p The power of the matrix.
-   * @param O [out]\f$\prod_{i=1}^p m\f$.
-   * If p = 0, sends the identity matrix.
-   * @throw DimensionException If m is not a square matrix.
-   */
-  template<class Scalar>
-  static void pow(const Matrix<Scalar>& A, double p, Matrix<Scalar>& O) throw (DimensionException)
-  {
-    size_t n = A.getNumberOfRows();
-    if (n != A.getNumberOfColumns()) throw DimensionException("MatrixTools::pow(). nrows != ncols.", A.getNumberOfColumns(), A.getNumberOfRows());
-    EigenValue<Scalar> eigen(A);
-    RowMatrix<Scalar> rightEV, leftEV;
-    rightEV = eigen.getV();
-    inv(rightEV, leftEV);
-    mult(rightEV, VectorTools::pow(eigen.getRealEigenValues(), p), leftEV, O);
-  }
-
-  /**
-   * @brief Perform matrix exponentiation using diagonalization.
-   *
-   * @warning This method currently relies only on diagonalization, so it won't work if your matrix is not diagonalizable.
-   * The function may be extended later to deal with other cases.
-   *
-   * @param A [in] The matrix.
-   * @param O [out]\f$\prod_{i=1}^p m\f$.
-   * @throw DimensionException If m is not a square matrix.
-   */
-  template<class Scalar>
-  static void exp(const Matrix<Scalar>& A, Matrix<Scalar>& O) throw (DimensionException)
-  {
-    size_t n = A.getNumberOfRows();
-    if (n != A.getNumberOfColumns()) throw DimensionException("MatrixTools::exp(). nrows != ncols.", A.getNumberOfColumns(), A.getNumberOfRows());
-    EigenValue<Scalar> eigen(A);
-    RowMatrix<Scalar> rightEV, leftEV;
-    rightEV = eigen.getV();
-    inv(rightEV, leftEV);
-    mult(rightEV, VectorTools::exp(eigen.getRealEigenValues()), leftEV, O);
-  }
-
-  /**
-   * @brief Compute a vector of the first powers of a given matrix.
-   *
-   * @param A [in] The matrix.
-   * @param p The number of powers.
-   * @param vO [out] the vector of the powers (from 0 to p)
-   *
-   * @throw DimensionException If m is not a square matrix.
-   */
+
+    /**
+     * @brief Compute the power of a given matrix, using eigen value decomposition.
+     *
+     * @param A [in] The matrix.
+     * @param p The power of the matrix.
+     * @param O [out]\f$\prod_{i=1}^p m\f$.
+     * If p = 0, sends the identity matrix.
+     * @throw DimensionException If m is not a square matrix.
+     */
+    template<class Scalar>
+    static void pow(const Matrix<Scalar>& A, double p, Matrix<Scalar>& O) throw (DimensionException)
+    {
+      size_t n = A.getNumberOfRows();
+      if (n != A.getNumberOfColumns()) throw DimensionException("MatrixTools::pow(). nrows != ncols.", A.getNumberOfColumns(), A.getNumberOfRows());
+      EigenValue<Scalar> eigen(A);
+      RowMatrix<Scalar> rightEV, leftEV;
+      rightEV = eigen.getV();
+      inv(rightEV, leftEV);
+      mult(rightEV, VectorTools::pow(eigen.getRealEigenValues(), p), leftEV, O);
+    }
+
+    /**
+     * @brief Perform matrix exponentiation using diagonalization.
+     *
+     * @warning This method currently relies only on diagonalization, so it won't work if your matrix is not diagonalizable.
+     * The function may be extended later to deal with other cases.
+     *
+     * @param A [in] The matrix.
+     * @param O [out]\f$\prod_{i=1}^p m\f$.
+     * @throw DimensionException If m is not a square matrix.
+     */
+    template<class Scalar>
+    static void exp(const Matrix<Scalar>& A, Matrix<Scalar>& O) throw (DimensionException)
+    {
+      size_t n = A.getNumberOfRows();
+      if (n != A.getNumberOfColumns()) throw DimensionException("MatrixTools::exp(). nrows != ncols.", A.getNumberOfColumns(), A.getNumberOfRows());
+      EigenValue<Scalar> eigen(A);
+      RowMatrix<Scalar> rightEV, leftEV;
+      rightEV = eigen.getV();
+      inv(rightEV, leftEV);
+      mult(rightEV, VectorTools::exp(eigen.getRealEigenValues()), leftEV, O);
+    }
+
+    /**
+     * @brief Compute a vector of the first powers of a given matrix.
+     *
+     * @param A [in] The matrix.
+     * @param p The number of powers.
+     * @param vO [out] the vector of the powers (from 0 to p)
+     *
+     * @throw DimensionException If m is not a square matrix.
+     */
   
-  template<class Matrix, class Scalar>
-  static void Taylor(const Matrix& A, size_t p, std::vector< RowMatrix<Scalar> > & vO) throw (DimensionException)
-  {
-    size_t n = A.getNumberOfRows();
-    if (n != A.getNumberOfColumns())
-      throw DimensionException("MatrixTools::pow(). nrows != ncols.", A.getNumberOfColumns(), A.getNumberOfRows());
-    vO.resize(p+1);
-    getId<Matrix>(n, vO[0]);
-    copy(A,vO[1]);
+    template<class Matrix, class Scalar>
+    static void Taylor(const Matrix& A, size_t p, std::vector< RowMatrix<Scalar> > & vO) throw (DimensionException)
+    {
+      size_t n = A.getNumberOfRows();
+      if (n != A.getNumberOfColumns())
+        throw DimensionException("MatrixTools::pow(). nrows != ncols.", A.getNumberOfColumns(), A.getNumberOfRows());
+      vO.resize(p+1);
+      getId<Matrix>(n, vO[0]);
+      copy(A,vO[1]);
     
-    for (size_t i = 1; i < p; i++)
+      for (size_t i = 1; i < p; i++)
       {
         mult(vO[i], A, vO[i+1]);
       }
-  }
-
-  /**
-   * @return The position of the maximum value in the matrix.
-   * @param m The matrix.
-   */
-  template<class Matrix>
-  static std::vector<size_t> whichMax(const Matrix& m)
-  {
-    size_t nrows = m.getNumberOfRows();
-    size_t ncols = m.getNumberOfColumns();
-    std::vector<size_t> pos(2);
-    size_t imax = 0;
-    size_t jmax = 0;
-    double currentMax = log(0.);
-    for (size_t i = 0; i < nrows; i++)
+    }
+
+    /**
+     * @return The position of the maximum value in the matrix.
+     * @param m The matrix.
+     */
+    template<class Matrix>
+    static std::vector<size_t> whichMax(const Matrix& m)
     {
-      for (size_t j = 0; j < ncols; j++)
+      size_t nrows = m.getNumberOfRows();
+      size_t ncols = m.getNumberOfColumns();
+      std::vector<size_t> pos(2);
+      size_t imax = 0;
+      size_t jmax = 0;
+      double currentMax = log(0.);
+      for (size_t i = 0; i < nrows; i++)
       {
-        double currentValue = m(i, j);
-        // cout << currentValue << "\t" << (currentValue > currentMax) << endl;
-        if (currentValue > currentMax)
+        for (size_t j = 0; j < ncols; j++)
         {
-          imax = i;
-          jmax = j;
-          currentMax = currentValue;
+          double currentValue = m(i, j);
+          // cout << currentValue << "\t" << (currentValue > currentMax) << endl;
+          if (currentValue > currentMax)
+          {
+            imax = i;
+            jmax = j;
+            currentMax = currentValue;
+          }
         }
       }
+      pos[0] = imax;
+      pos[1] = jmax;
+      return pos;
     }
-    pos[0] = imax;
-    pos[1] = jmax;
-    return pos;
-  }
-
-  /**
-   * @return The position of the minimum value in the matrix.
-   * @param m The matrix.
-   */
-  template<class Matrix>
-  static std::vector<size_t> whichMin(const Matrix& m)
-  {
-    size_t nrows = m.getNumberOfRows();
-    size_t ncols = m.getNumberOfColumns();
-    std::vector<size_t> pos(2);
-    size_t imin = 0;
-    size_t jmin = 0;
-    double currentMin = -log(0.);
-    for (size_t i = 0; i < nrows; i++)
+
+    /**
+     * @return The position of the minimum value in the matrix.
+     * @param m The matrix.
+     */
+    template<class Matrix>
+    static std::vector<size_t> whichMin(const Matrix& m)
     {
-      for (size_t j = 0; j < ncols; j++)
+      size_t nrows = m.getNumberOfRows();
+      size_t ncols = m.getNumberOfColumns();
+      std::vector<size_t> pos(2);
+      size_t imin = 0;
+      size_t jmin = 0;
+      double currentMin = -log(0.);
+      for (size_t i = 0; i < nrows; i++)
       {
-        double currentValue = m(i, j);
-        if (currentValue < currentMin)
+        for (size_t j = 0; j < ncols; j++)
         {
-          imin = i;
-          jmin = j;
-          currentMin = currentValue;
+          double currentValue = m(i, j);
+          if (currentValue < currentMin)
+          {
+            imin = i;
+            jmin = j;
+            currentMin = currentValue;
+          }
         }
       }
+      pos[0] = imin;
+      pos[1] = jmin;
+      return pos;
     }
-    pos[0] = imin;
-    pos[1] = jmin;
-    return pos;
-  }
-
-  /**
-   * @return The maximum value in the matrix.
-   * @param m The matrix.
-   */
-  template<class Real>
-  static Real max(const Matrix<Real>& m)
-  {
-    size_t nrows = m.getNumberOfRows();
-    size_t ncols = m.getNumberOfColumns();
-    Real currentMax = log(0.);
-    for (size_t i = 0; i < nrows; i++)
+
+    /**
+     * @return The maximum value in the matrix.
+     * @param m The matrix.
+     */
+    template<class Real>
+    static Real max(const Matrix<Real>& m)
     {
-      for (size_t j = 0; j < ncols; j++)
+      size_t nrows = m.getNumberOfRows();
+      size_t ncols = m.getNumberOfColumns();
+      Real currentMax = log(0.);
+      for (size_t i = 0; i < nrows; i++)
       {
-        Real currentValue = m(i, j);
-        // cout << currentValue << "\t" << (currentValue > currentMax) << endl;
-        if (currentValue > currentMax)
+        for (size_t j = 0; j < ncols; j++)
         {
-          currentMax = currentValue;
+          Real currentValue = m(i, j);
+          // cout << currentValue << "\t" << (currentValue > currentMax) << endl;
+          if (currentValue > currentMax)
+          {
+            currentMax = currentValue;
+          }
         }
       }
+      return currentMax;
     }
-    return currentMax;
-  }
 
 
-  /**
-   * @return The minimum value in the matrix.
-   * @param m The matrix.
-   */
-  template<class Real>
-  static Real min(const Matrix<Real>& m)
-  {
-    size_t nrows = m.getNumberOfRows();
-    size_t ncols = m.getNumberOfColumns();
-    Real currentMin = -log(0.);
-    for (size_t i = 0; i < nrows; i++)
+    /**
+     * @return The minimum value in the matrix.
+     * @param m The matrix.
+     */
+    template<class Real>
+    static Real min(const Matrix<Real>& m)
     {
-      for (size_t j = 0; j < ncols; j++)
+      size_t nrows = m.getNumberOfRows();
+      size_t ncols = m.getNumberOfColumns();
+      Real currentMin = -log(0.);
+      for (size_t i = 0; i < nrows; i++)
       {
-        Real currentValue = m(i, j);
-        if (currentValue < currentMin)
+        for (size_t j = 0; j < ncols; j++)
         {
-          currentMin = currentValue;
+          Real currentValue = m(i, j);
+          if (currentValue < currentMin)
+          {
+            currentMin = currentValue;
+          }
         }
       }
+      return currentMin;
     }
-    return currentMin;
-  }
-
-  /**
-   * @brief Print a matrix to a stream.
-   *
-   * @param m The matrix to print.
-   * @param out The stream to use.
-   */
-  template<class Matrix>
-  static void print(const Matrix& m, std::ostream& out = std::cout)
-  {
-    out << m.getNumberOfRows() << "x" << m.getNumberOfColumns() << std::endl;
-    out << "[" << std::endl;
-    for (size_t i = 0; i < m.getNumberOfRows(); i++)
+
+    /**
+     * @brief Print a matrix to a stream.
+     *
+     * @param m The matrix to print.
+     * @param out The stream to use.
+     */
+    template<class Matrix>
+    static void print(const Matrix& m, std::ostream& out = std::cout)
     {
-      out << "[";
-      for (size_t j = 0; j < m.getNumberOfColumns() - 1; j++)
+      out << m.getNumberOfRows() << "x" << m.getNumberOfColumns() << std::endl;
+      out << "[" << std::endl;
+      for (size_t i = 0; i < m.getNumberOfRows(); i++)
       {
-        out << m(i, j) << ", ";
+        out << "[";
+        for (size_t j = 0; j < m.getNumberOfColumns() - 1; j++)
+        {
+          out << m(i, j) << ", ";
+        }
+        if (m.getNumberOfColumns() > 0) out << m(i, m.getNumberOfColumns() - 1) << "]" << std::endl;
       }
-      if (m.getNumberOfColumns() > 0) out << m(i, m.getNumberOfColumns() - 1) << "]" << std::endl;
+      out << "]" << std::endl;
     }
-    out << "]" << std::endl;
-  }
-
-  /**
-   * @brief Print a matrix to a stream, so that it is read by R.
-   *
-   * @param m The matrix to print.
-   * @param variableName The name of the R variable handeling the matrix
-   * @param out The stream to use.
-   */
-  template<class Matrix>
-  static void printForR(const Matrix& m, const std::string& variableName = "x", std::ostream& out = std::cout)
-  {
-    out.precision(12);
-    out << variableName << "<-matrix(c(";
-    for (size_t i = 0; i < m.getNumberOfRows(); i++)
+
+    /**
+     * @brief Print a matrix to a stream.
+     *
+     * @param m The matrix to print.
+     * @param out The stream to use.
+     * @param pIn left delimiter (default: "(")
+     * @param pOut right delimiter (default: ")")
+     */
+    template<class Matrix>
+    static void print(const Matrix& m, bpp::OutputStream& out, char pIn = '(', char pOut = ')')
     {
-      for (size_t j = 0; j < m.getNumberOfColumns(); j++)
+      out << pIn;
+    
+      for (size_t i = 0; i < m.getNumberOfRows(); i++)
       {
-        if (i > 0 || j > 0)
-          out << ", ";
-        out << m(i, j);
+        if (i!=0)
+          out << ",";
+      
+        out << pIn;
+        for (size_t j = 0; j < m.getNumberOfColumns() - 1; j++)
+        {
+          out << m(i, j) << ", ";
+        }
+        if (m.getNumberOfColumns() > 0) out << m(i, m.getNumberOfColumns() - 1) << pOut;
       }
+      out << pOut;
     }
-    out << "), nrow=" << m.getNumberOfRows() << ", byrow=TRUE)" << std::endl;
-  }
-
-
-  /**
-   * @brief Print a vector to a stream.
-   *
-   * @param v The vector to print.
-   * @param out The stream to use.
-   */
-  template<class Real>
-  static void print(const std::vector<Real>& v, std::ostream& out = std::cout)
-  {
-    out << v.size() << std::endl;
-    out << "[";
-    for (size_t i = 0; i < v.size() - 1; i++)
-    {
-      out << v[i] << ", ";
-    }
-    if (v.size() > 0) out << v[v.size() - 1];
-    out << "]" << std::endl;
-  }
-
-  /**
-   * @return True if the matrix is a square matrix.
-   * @param A A matrix.
-   */
-  template<class Matrix>
-  static bool isSquare(const Matrix& A) { return A.getNumberOfRows() == A.getNumberOfColumns(); }
-
-  /**
-   * @param A [in] The matrix to inverse.
-   * @param O [out] The inverse matrix of A.
-   * @return x the minimum absolute value of the diagonal of the LU decomposition
-   * @throw DimensionException If A is not a square matrix.
-   */
-  template<class Scalar>
-  static Scalar inv(const Matrix<Scalar>& A, Matrix<Scalar>& O) throw (DimensionException, ZeroDivisionException)
-  {
-    if (!isSquare(A)) throw DimensionException("MatrixTools::inv(). Matrix A is not a square matrix.", A.getNumberOfRows(), A.getNumberOfColumns());
-    LUDecomposition<Scalar> lu(A);
-    RowMatrix<Scalar> I;
-    getId(A.getNumberOfRows(), I);
-    return lu.solve(I, O);
-  }
-
-  /**
-   * @brief Get determinant of a square matrix.
-   *
-   * This implementation is in @f$o(n^3)@f$ and uses the LU decomposition method.
-   *
-   * @param A [in] The input matrix.
-   * @return The determinant of A.
-   * @throw DimensionException If A is not a square matrix.
-   */
-  template<class Scalar>
-  static double det(const Matrix<Scalar>& A) throw (DimensionException)
-  {
-    if (!isSquare(A)) throw DimensionException("MatrixTools::det(). Matrix A is not a square matrix.", A.getNumberOfRows(), A.getNumberOfColumns());
-    LUDecomposition<Scalar> lu(A);
-    return lu.det();
-  }
-
-  /**
-   * @param A [in] The matrix to transpose.
-   * @param O [out] The transposition of A.
-   */
-  template<class MatrixA, class MatrixO>
-  static void transpose(const MatrixA& A, MatrixO& O)
-  {
-    O.resize(A.getNumberOfColumns(), A.getNumberOfRows());
-    for (size_t i = 0; i < A.getNumberOfColumns(); i++)
+
+    /**
+     * @brief Print a matrix to a stream, so that it is read by R.
+     *
+     * @param m The matrix to print.
+     * @param variableName The name of the R variable handeling the matrix
+     * @param out The stream to use.
+     */
+    template<class Matrix>
+    static void printForR(const Matrix& m, const std::string& variableName = "x", std::ostream& out = std::cout)
     {
-      for (size_t j = 0; j < A.getNumberOfRows(); j++)
+      out.precision(12);
+      out << variableName << "<-matrix(c(";
+      for (size_t i = 0; i < m.getNumberOfRows(); i++)
       {
-        O(i, j) = A(j, i);
+        for (size_t j = 0; j < m.getNumberOfColumns(); j++)
+        {
+          if (i > 0 || j > 0)
+            out << ", ";
+          out << m(i, j);
+        }
       }
+      out << "), nrow=" << m.getNumberOfRows() << ", byrow=TRUE)" << std::endl;
     }
-  }
-
-  /**
-   * @brief Compute the variance-covariance matrix of an input matrix.
-   *
-   * The input matrix represent a n-sample of a random vector of dimension r.
-   * It is assumed to have r rows and n columns.
-   * The variance matrix is then computed as @f[ V = A\cdot A^T - \mu\cdot\mu^T at f],
-   * where @f$\mu at f$ is the mean vector of the sample.
-   * the output matrix is a square matrix of size r.
-   *
-   * @param A [in] The intput matrix.
-   * @param O [out] The resulting variance covariance matrix.
-   */
-  template<class Scalar>
-  static void covar(const Matrix<Scalar>& A, Matrix<Scalar>& O)
-  {
-    size_t r = A.getNumberOfRows();
-    size_t n = A.getNumberOfColumns();
-    O.resize(r, r);
-    RowMatrix<Scalar> tA;
-    transpose(A, tA);
-    mult(A, tA, O);
-    scale(O, 1. / static_cast<double>(n));
-    RowMatrix<Scalar> mean(r, 1);
-    for (size_t i = 0; i < r; i++)
+
+
+    /**
+     * @brief Print a vector to a stream.
+     *
+     * @param v The vector to print.
+     * @param out The stream to use.
+     */
+    template<class Real>
+    static void print(const std::vector<Real>& v, std::ostream& out = std::cout)
     {
-      for (size_t j = 0; j < n; j++)
+      out << v.size() << std::endl;
+      out << "[";
+      for (size_t i = 0; i < v.size() - 1; i++)
       {
-        mean(i, 0) += A(i, j);
+        out << v[i] << ", ";
       }
-      mean(i, 0) /= static_cast<double>(n);
+      if (v.size() > 0) out << v[v.size() - 1];
+      out << "]" << std::endl;
     }
-    RowMatrix<Scalar> tMean;
-    transpose(mean, tMean);
-    RowMatrix<Scalar> meanMat;
-    mult(mean, tMean, meanMat);
-    scale(meanMat, -1.);
-    add(O, meanMat);
-  }
-
-  /**
-   * @brief Compute the Kronecker product of two row matrices.
-   *
-   * @param A [in] The first row matrix.
-   * @param B [in] The second row matrix.
-   * @param O [out] The product \f$A \otimes B\f$.
-   */
-  template<class Scalar>
-  static void kroneckerMult(const Matrix<Scalar>& A, const Matrix<Scalar>& B, Matrix<Scalar>& O)
-  {
-    size_t ncA = A.getNumberOfColumns();
-    size_t nrA = A.getNumberOfRows();
-    size_t nrB = B.getNumberOfRows();
-    size_t ncB = B.getNumberOfColumns();
-    O.resize(nrA * nrB, ncA * ncB);
-    for (size_t ia = 0; ia < nrA; ia++)
+
+    /**
+     * @return True if the matrix is a square matrix.
+     * @param A A matrix.
+     */
+    template<class Matrix>
+    static bool isSquare(const Matrix& A) { return A.getNumberOfRows() == A.getNumberOfColumns(); }
+
+    /**
+     * @param A [in] The matrix to inverse.
+     * @param O [out] The inverse matrix of A.
+     * @return x the minimum absolute value of the diagonal of the LU decomposition
+     * @throw DimensionException If A is not a square matrix.
+     */
+    template<class Scalar>
+    static Scalar inv(const Matrix<Scalar>& A, Matrix<Scalar>& O) throw (DimensionException, ZeroDivisionException)
+    {
+      if (!isSquare(A)) throw DimensionException("MatrixTools::inv(). Matrix A is not a square matrix.", A.getNumberOfRows(), A.getNumberOfColumns());
+      LUDecomposition<Scalar> lu(A);
+      RowMatrix<Scalar> I;
+      getId(A.getNumberOfRows(), I);
+      return lu.solve(I, O);
+    }
+
+    /**
+     * @brief Get determinant of a square matrix.
+     *
+     * This implementation is in @f$o(n^3)@f$ and uses the LU decomposition method.
+     *
+     * @param A [in] The input matrix.
+     * @return The determinant of A.
+     * @throw DimensionException If A is not a square matrix.
+     */
+    template<class Scalar>
+    static double det(const Matrix<Scalar>& A) throw (DimensionException)
     {
-      for (size_t ja = 0; ja < ncA; ja++)
+      if (!isSquare(A)) throw DimensionException("MatrixTools::det(). Matrix A is not a square matrix.", A.getNumberOfRows(), A.getNumberOfColumns());
+      LUDecomposition<Scalar> lu(A);
+      return lu.det();
+    }
+
+    /**
+     * @param A [in] The matrix to transpose.
+     * @param O [out] The transposition of A.
+     */
+    template<class MatrixA, class MatrixO>
+    static void transpose(const MatrixA& A, MatrixO& O)
+    {
+      O.resize(A.getNumberOfColumns(), A.getNumberOfRows());
+      for (size_t i = 0; i < A.getNumberOfColumns(); i++)
       {
-        Scalar aij = A(ia, ja);
-        for (size_t ib = 0; ib < nrB; ib++)
+        for (size_t j = 0; j < A.getNumberOfRows(); j++)
         {
-          for (size_t jb = 0; jb < ncB; jb++)
-          {
-            O(ia * nrB + ib, ja * ncB + jb) = aij * B(ib, jb);
-          }
+          O(i, j) = A(j, i);
         }
       }
     }
-  }
-
-  /**
-   * @brief Compute the Hadamard product of two row matrices with same dimensions.
-   *
-   * @param A [in] The first row matrix.
-   * @param B [in] The second row matrix.
-   * @param O [out] The Hadamard product.
-   */
-  template<class Scalar>
-  static void hadamardMult(const Matrix<Scalar>& A, const Matrix<Scalar>& B, Matrix<Scalar>& O)
-  {
-    size_t ncA = A.getNumberOfColumns();
-    size_t nrA = A.getNumberOfRows();
-    size_t nrB = B.getNumberOfRows();
-    size_t ncB = B.getNumberOfColumns();
-    if (nrA != nrB) throw DimensionException("MatrixTools::hadamardMult(). nrows A != nrows B.", nrA, nrB);
-    if (ncA != ncB) throw DimensionException("MatrixTools::hadamardMult(). ncols A != ncols B.", ncA, ncB);
-    O.resize(nrA, ncA);
-    for (size_t i = 0; i < nrA; i++)
+
+    /**
+     * @brief Compute the variance-covariance matrix of an input matrix.
+     *
+     * The input matrix represent a n-sample of a random vector of dimension r.
+     * It is assumed to have r rows and n columns.
+     * The variance matrix is then computed as @f[ V = A\cdot A^T - \mu\cdot\mu^T at f],
+     * where @f$\mu at f$ is the mean vector of the sample.
+     * the output matrix is a square matrix of size r.
+     *
+     * @param A [in] The intput matrix.
+     * @param O [out] The resulting variance covariance matrix.
+     */
+    template<class Scalar>
+    static void covar(const Matrix<Scalar>& A, Matrix<Scalar>& O)
     {
-      for (size_t j = 0; j < ncA; j++)
+      size_t r = A.getNumberOfRows();
+      size_t n = A.getNumberOfColumns();
+      O.resize(r, r);
+      RowMatrix<Scalar> tA;
+      transpose(A, tA);
+      mult(A, tA, O);
+      scale(O, 1. / static_cast<double>(n));
+      RowMatrix<Scalar> mean(r, 1);
+      for (size_t i = 0; i < r; i++)
       {
-        O(i, j) = A(i, j) * B(i, j);
+        for (size_t j = 0; j < n; j++)
+        {
+          mean(i, 0) += A(i, j);
+        }
+        mean(i, 0) /= static_cast<double>(n);
       }
+      RowMatrix<Scalar> tMean;
+      transpose(mean, tMean);
+      RowMatrix<Scalar> meanMat;
+      mult(mean, tMean, meanMat);
+      scale(meanMat, -1.);
+      add(O, meanMat);
     }
-  }
-
-  /**
-   * @brief Compute the "Hadamard" product of a row matrix and a vector containing weights, according to rows or columns.
-   *
-   * @param A [in] The row matrix.
-   * @param B [in] The vector of row or column weights.
-   * @param O [out] The 'Hadamard' product.
-   * @param row Boolean. If row is set to 'true', the vector contains weights for rows. Otherwise the vector contains weights for columns.
-   */
-  template<class Scalar>
-  static void hadamardMult(const Matrix<Scalar>& A, const std::vector<Scalar>& B, Matrix<Scalar>& O, bool row = true)
-  {
-    size_t ncA = A.getNumberOfColumns();
-    size_t nrA = A.getNumberOfRows();
-    size_t sB = B.size();
-    if (row == true && nrA != sB) throw DimensionException("MatrixTools::hadamardMult(). nrows A != size of B.", nrA, sB);
-    if (row == false && ncA != sB) throw DimensionException("MatrixTools::hadamardMult(). ncols A != size of B.", ncA, sB);
-    O.resize(nrA, ncA);
-    if (row)
+
+    /**
+     * @brief Compute the Kronecker product of two row matrices.
+     *
+     * @param A [in] The first row matrix.
+     * @param B [in] The second row matrix.
+     * @param O [out] The product \f$A \otimes B\f$.
+     */
+    template<class Scalar>
+    static void kroneckerMult(const Matrix<Scalar>& A, const Matrix<Scalar>& B, Matrix<Scalar>& O)
     {
-      for (size_t i = 0; i < nrA; i++)
+      size_t ncA = A.getNumberOfColumns();
+      size_t nrA = A.getNumberOfRows();
+      size_t nrB = B.getNumberOfRows();
+      size_t ncB = B.getNumberOfColumns();
+      O.resize(nrA * nrB, ncA * ncB);
+      for (size_t ia = 0; ia < nrA; ia++)
       {
-        for (size_t j = 0; j < ncA; j++)
+        for (size_t ja = 0; ja < ncA; ja++)
         {
-          O(i, j) = A(i, j) * B[i];
+          Scalar aij = A(ia, ja);
+          for (size_t ib = 0; ib < nrB; ib++)
+          {
+            for (size_t jb = 0; jb < ncB; jb++)
+            {
+              O(ia * nrB + ib, ja * ncB + jb) = aij * B(ib, jb);
+            }
+          }
         }
       }
     }
-    else
+
+    /**
+     * @brief Compute the Hadamard product of two row matrices with same dimensions.
+     *
+     * @param A [in] The first row matrix.
+     * @param B [in] The second row matrix.
+     * @param O [out] The Hadamard product.
+     */
+    template<class Scalar>
+    static void hadamardMult(const Matrix<Scalar>& A, const Matrix<Scalar>& B, Matrix<Scalar>& O)
     {
+      size_t ncA = A.getNumberOfColumns();
+      size_t nrA = A.getNumberOfRows();
+      size_t nrB = B.getNumberOfRows();
+      size_t ncB = B.getNumberOfColumns();
+      if (nrA != nrB) throw DimensionException("MatrixTools::hadamardMult(). nrows A != nrows B.", nrA, nrB);
+      if (ncA != ncB) throw DimensionException("MatrixTools::hadamardMult(). ncols A != ncols B.", ncA, ncB);
+      O.resize(nrA, ncA);
       for (size_t i = 0; i < nrA; i++)
       {
         for (size_t j = 0; j < ncA; j++)
         {
-          O(i, j) = A(i, j) * B[j];
+          O(i, j) = A(i, j) * B(i, j);
         }
       }
     }
-  }
-
-  /**
-   * @brief Compute the Kronecker sum of two row matrices.
-   *
-   * @param A [in] The first row matrix.
-   * @param B [in] The second row matrix.
-   * @param O [out] The product \f$A \oplus B\f$.
-   */
-  template<class Scalar>
-  static void kroneckerSum(const Matrix<Scalar>& A, const Matrix<Scalar>& B, Matrix<Scalar>& O)
-  {
-    size_t ncA = A.getNumberOfColumns();
-    size_t nrA = A.getNumberOfRows();
-    size_t nrB = B.getNumberOfRows();
-    size_t ncB = B.getNumberOfColumns();
-    O.resize(nrA + nrB, ncA + ncB);
-    for (size_t ia = 0; ia < nrA; ia++)
+
+    /**
+     * @brief Compute the "Hadamard" product of a row matrix and a vector containing weights, according to rows or columns.
+     *
+     * @param A [in] The row matrix.
+     * @param B [in] The vector of row or column weights.
+     * @param O [out] The 'Hadamard' product.
+     * @param row Boolean. If row is set to 'true', the vector contains weights for rows. Otherwise the vector contains weights for columns.
+     */
+    template<class Scalar>
+    static void hadamardMult(const Matrix<Scalar>& A, const std::vector<Scalar>& B, Matrix<Scalar>& O, bool row = true)
     {
-      for (size_t ja = 0; ja < ncA; ja++)
+      size_t ncA = A.getNumberOfColumns();
+      size_t nrA = A.getNumberOfRows();
+      size_t sB = B.size();
+      if (row == true && nrA != sB) throw DimensionException("MatrixTools::hadamardMult(). nrows A != size of B.", nrA, sB);
+      if (row == false && ncA != sB) throw DimensionException("MatrixTools::hadamardMult(). ncols A != size of B.", ncA, sB);
+      O.resize(nrA, ncA);
+      if (row)
       {
-        O(ia, ja) = A(ia, ja);
+        for (size_t i = 0; i < nrA; i++)
+        {
+          for (size_t j = 0; j < ncA; j++)
+          {
+            O(i, j) = A(i, j) * B[i];
+          }
+        }
       }
-    }
-    for (size_t ib = 0; ib < nrB; ib++)
-    {
-      for (size_t jb = 0; jb < nrB; jb++)
+      else
       {
-        O(nrA + ib, ncA + jb) = B(ib, jb);
+        for (size_t i = 0; i < nrA; i++)
+        {
+          for (size_t j = 0; j < ncA; j++)
+          {
+            O(i, j) = A(i, j) * B[j];
+          }
+        }
       }
     }
-  }
-
-  /**
-   * @brief Compute the Kronecker sum of n row matrices.
-   *
-   * @param vA [in] A vector of row matrices of any size.
-   * @param O [out] The product \f$\bigoplus_i A_i\f$.
-   */
-  template<class Scalar>
-  static void kroneckerSum(const std::vector< Matrix<Scalar>*>& vA, Matrix<Scalar>& O)
-  {
-    size_t nr = 0;
-    size_t nc = 0;
-    for (size_t k = 0; k < vA.size(); k++)
-    {
-      nr += vA[k]->getNumberOfRows();
-      nc += vA[k]->getNumberOfColumns();
-    }
-    O.resize(nr, nc);
-    size_t rk = 0; // Row counter
-    size_t ck = 0; // Col counter
-    for (size_t k = 0; k < vA.size(); k++)
+
+    /**
+     * @brief Compute the Kronecker sum of two row matrices.
+     *
+     * @param A [in] The first row matrix.
+     * @param B [in] The second row matrix.
+     * @param O [out] The product \f$A \oplus B\f$.
+     */
+    template<class Scalar>
+    static void kroneckerSum(const Matrix<Scalar>& A, const Matrix<Scalar>& B, Matrix<Scalar>& O)
     {
-      const Matrix<Scalar>* Ak = vA[k];
-      for (size_t i = 0; i < Ak->getNumberOfRows(); i++)
+      size_t ncA = A.getNumberOfColumns();
+      size_t nrA = A.getNumberOfRows();
+      size_t nrB = B.getNumberOfRows();
+      size_t ncB = B.getNumberOfColumns();
+      O.resize(nrA + nrB, ncA + ncB);
+      for (size_t ia = 0; ia < nrA; ia++)
       {
-        for (size_t j = 0; j < Ak->getNumberOfColumns(); j++)
+        for (size_t ja = 0; ja < ncA; ja++)
         {
-          O(rk + i, ck + j) = (*Ak)(i, j);
+          O(ia, ja) = A(ia, ja);
         }
       }
-      rk += Ak->getNumberOfRows();
-      ck += Ak->getNumberOfColumns();
-    }
-  }
-
-  /**
-   * @brief Convert to a vector of vector.
-   *
-   * @param M [in] A matrix object.
-   * @param vO [out] The output vector of vector (will be resized accordingly).
-   */
-  template<class Scalar>
-  static void toVVdouble(const Matrix<Scalar>& M, std::vector< std::vector<Scalar> >& vO)
-  {
-    size_t n = M.getNumberOfRows();
-    size_t m = M.getNumberOfColumns();
-    vO.resize(n);
-    for (size_t i = 0; i < n; i++)
-    {
-      vO[i].resize(m);
-      for (size_t j = 0; j < m; j++)
+      for (size_t ib = 0; ib < nrB; ib++)
       {
-        vO[i][j] = M(i, j);
+        for (size_t jb = 0; jb < nrB; jb++)
+        {
+          O(nrA + ib, ncA + jb) = B(ib, jb);
+        }
       }
     }
-  }
-
-  /**
-   * @brief Sum all elements in M.
-   * @param M A matrix.
-   * @return The sum of all elements.
-   */
-  template<class Scalar>
-  static Scalar sumElements(const Matrix<Scalar>& M)
-  {
-    Scalar sum = 0;
-    for (size_t i = 0; i < M.getNumberOfRows(); i++)
+
+    /**
+     * @brief Compute the Kronecker sum of n row matrices.
+     *
+     * @param vA [in] A vector of row matrices of any size.
+     * @param O [out] The product \f$\bigoplus_i A_i\f$.
+     */
+    template<class Scalar>
+    static void kroneckerSum(const std::vector< Matrix<Scalar>*>& vA, Matrix<Scalar>& O)
     {
-      for (size_t j = 0; j < M.getNumberOfColumns(); j++)
+      size_t nr = 0;
+      size_t nc = 0;
+      for (size_t k = 0; k < vA.size(); k++)
       {
-        sum += M(i, j);
+        nr += vA[k]->getNumberOfRows();
+        nc += vA[k]->getNumberOfColumns();
       }
-    }
-    return sum;
-  }
-
-
-  
-  /**
-   * @brief Linear Assignment Problem
-   *
-   * The algorithm coded here is described in 
-   * * A Shortest Augmenting Path Algorithm for Dense and Sparse Linear Assignment Problems, Computing 38, 325-340, 1987
-   * by R. Jonker and A. Volgenant, University of Amsterdam.
-   *
-   * @param assignCost [input/output] Cost matrix
-   * @param rowSol     [output] Column assigned to row in solution
-   * @param colSol     [output] Row assigned to column in solution
-   * @param u          [output] Dual variables, row reduction numbers
-   * @param v          [output] Dual variables, column reduction numbers
-   * @return The optimal cost.
-   */
-  template<class Scalar>
-  static Scalar lap(Matrix<Scalar>& assignCost,
-      std::vector<int> &rowSol, 
-      std::vector<int> &colSol, 
-      std::vector<Scalar> &u, 
-      std::vector<Scalar> &v) throw (Exception)
-  {
-    size_t dim = assignCost.getNumberOfRows();
-    if (assignCost.getNumberOfColumns() != dim)
-      throw Exception("MatrixTools::lap. Cost matrix should be scare.");
-  
-    bool unassignedFound;
-    size_t i, iMin;
-    size_t numFree = 0, previousNumFree, f, i0, k, freeRow;
-    std::vector<size_t> free(dim); // list of unassigned rows.
-    std::vector<size_t> pred(dim); // row-predecessor of column in augmenting/alternating path.
-    size_t j, j1, j2, endOfPath, last, low, up;
-    std::vector<size_t> colList(dim); // list of columns to be scanned in various ways.
-    std::vector<short int> matches(dim, 0); // counts how many times a row could be assigned.
-    Scalar min;
-    Scalar h;
-    size_t uMin, uSubMin;
-    Scalar v2;
-    std::vector<Scalar> d(dim); // 'cost-distance' in augmenting path calculation.
-
-    // Column reduction
-    for (j = dim; j > 0; j--)    // reverse order gives better results.
-    {
-      // find minimum cost over rows.
-      min = assignCost(0, j - 1); 
-      iMin = 0;
-      for (i = 1; i < dim; ++i) { 
-        if (assignCost(i, j - 1) < min) 
-        { 
-          min = assignCost(i, j - 1); 
-          iMin = i;
+      O.resize(nr, nc);
+      size_t rk = 0; // Row counter
+      size_t ck = 0; // Col counter
+      for (size_t k = 0; k < vA.size(); k++)
+      {
+        const Matrix<Scalar>* Ak = vA[k];
+        for (size_t i = 0; i < Ak->getNumberOfRows(); i++)
+        {
+          for (size_t j = 0; j < Ak->getNumberOfColumns(); j++)
+          {
+            O(rk + i, ck + j) = (*Ak)(i, j);
+          }
         }
+        rk += Ak->getNumberOfRows();
+        ck += Ak->getNumberOfColumns();
       }
-      v[j - 1] = min; 
-
-      if (++matches[iMin] == 1) 
-      { 
-        // init assignment if minimum row assigned for first time.
-        rowSol[iMin] = j - 1; 
-        colSol[j - 1] = iMin; 
-      }
-      else
-        colSol[j - 1] = -1;        // row already assigned, column not assigned.
     }
 
-    // Reduction tranfer
-    for (i = 0; i < dim; i++) { 
-      if (matches[i] == 0)     // fill list of unassigned 'free' rows.
-        free[numFree++] = i;
-      else {
-        if (matches[i] == 1)   // transfer reduction from rows that are assigned once.
+    /**
+     * @brief Convert to a vector of vector.
+     *
+     * @param M [in] A matrix object.
+     * @param vO [out] The output vector of vector (will be resized accordingly).
+     */
+    template<class Scalar>
+    static void toVVdouble(const Matrix<Scalar>& M, std::vector< std::vector<Scalar> >& vO)
+    {
+      size_t n = M.getNumberOfRows();
+      size_t m = M.getNumberOfColumns();
+      vO.resize(n);
+      for (size_t i = 0; i < n; i++)
+      {
+        vO[i].resize(m);
+        for (size_t j = 0; j < m; j++)
         {
-          j1 = rowSol[i]; 
-          min = -log(0);
-          for (j = 0; j < dim; j++)  
-            if (j != j1)
-              if (assignCost(i, j - 1) - v[j] < min) 
-                min = assignCost(i, j - 1) - v[j - 1];
-          v[j1] = v[j1] - min;
+          vO[i][j] = M(i, j);
         }
       }
     }
 
-    // Augmenting row reduction 
-    short loopcnt = 0;           // do-loop to be done twice.
-    do
+    /**
+     * @brief Sum all elements in M.
+     * @param M A matrix.
+     * @return The sum of all elements.
+     */
+    template<class Scalar>
+    static Scalar sumElements(const Matrix<Scalar>& M)
     {
-      loopcnt++;
-
-      // scan all free rows.
-      // in some cases, a free row may be replaced with another one to be scanned next.
-      k = 0; 
-      previousNumFree = numFree; 
-      numFree = 0;             // start list of rows still free after augmenting row reduction.
-      while (k < previousNumFree)
+      Scalar sum = 0;
+      for (size_t i = 0; i < M.getNumberOfRows(); i++)
       {
-        i = free[k]; 
-        k++;
-
-        // find minimum and second minimum reduced cost over columns.
-        uMin = assignCost(i, 0) - v[0]; 
-        j1 = 0; 
-        uSubMin = -log(0);
-        for (j = 1; j < dim; j++) 
+        for (size_t j = 0; j < M.getNumberOfColumns(); j++)
         {
-          h = assignCost(i, j) - v[j];
-          if (h < uSubMin) {
-            if (h >= uMin) 
-            { 
-              uSubMin = h; 
-              j2 = j;
-            }
-            else 
-            { 
-              uSubMin = uMin; 
-              uMin = h; 
-              j2 = j1; 
-              j1 = j;
-            }
-          }
+          sum += M(i, j);
         }
+      }
+      return sum;
+    }
 
-        i0 = colSol[j1];
-        if (uMin < uSubMin) {
-          // change the reduction of the minimum column to increase the minimum
-          // reduced cost in the row to the subminimum.
-          v[j1] = v[j1] - (uSubMin - uMin);
-        } else {                  // minimum and subminimum equal.
-          if (i0 >= 0)         // minimum column j1 is assigned.
+
+  
+    /**
+     * @brief Linear Assignment Problem
+     *
+     * The algorithm coded here is described in 
+     * * A Shortest Augmenting Path Algorithm for Dense and Sparse Linear Assignment Problems, Computing 38, 325-340, 1987
+     * by R. Jonker and A. Volgenant, University of Amsterdam.
+     *
+     * @param assignCost [input/output] Cost matrix
+     * @param rowSol     [output] Column assigned to row in solution
+     * @param colSol     [output] Row assigned to column in solution
+     * @param u          [output] Dual variables, row reduction numbers
+     * @param v          [output] Dual variables, column reduction numbers
+     * @return The optimal cost.
+     */
+    template<class Scalar>
+    static Scalar lap(Matrix<Scalar>& assignCost,
+                      std::vector<int> &rowSol, 
+                      std::vector<int> &colSol, 
+                      std::vector<Scalar> &u, 
+                      std::vector<Scalar> &v) throw (Exception)
+    {
+      size_t dim = assignCost.getNumberOfRows();
+      if (assignCost.getNumberOfColumns() != dim)
+        throw Exception("MatrixTools::lap. Cost matrix should be scare.");
+  
+      bool unassignedFound;
+      size_t i, iMin;
+      size_t numFree = 0, previousNumFree, f, k, freeRow;
+      int i0;
+      std::vector<size_t> free(dim); // list of unassigned rows.
+      std::vector<size_t> pred(dim); // row-predecessor of column in augmenting/alternating path.
+      size_t j, j1, j2, endOfPath, last, low, up;
+      std::vector<size_t> colList(dim); // list of columns to be scanned in various ways.
+      std::vector<short int> matches(dim, 0); // counts how many times a row could be assigned.
+      Scalar min;
+      Scalar h;
+      size_t uMin, uSubMin;
+      Scalar v2;
+      std::vector<Scalar> d(dim); // 'cost-distance' in augmenting path calculation.
+
+      // Column reduction
+      for (j = dim; j > 0; j--)    // reverse order gives better results.
+      {
+        // find minimum cost over rows.
+        min = assignCost(0, j - 1); 
+        iMin = 0;
+        for (i = 1; i < dim; ++i) { 
+          if (assignCost(i, j - 1) < min) 
           { 
-            // swap columns j1 and j2, as j2 may be unassigned.
-            j1 = j2; 
-            i0 = colSol[j2];
+            min = assignCost(i, j - 1); 
+            iMin = i;
           }
         }
+        v[j - 1] = min; 
 
-        // (re-)assign i to j1, possibly de-assigning an i0.
-        rowSol[i] = j1; 
-        colSol[j1] = i;
-
-        if (i0 >= 0) {          // minimum column j1 assigned earlier.
-          if (uMin < uSubMin) {
-            // put in current k, and go back to that k.
-            // continue augmenting path i - j1 with i0.
-            free[--k] = i0; 
-          } else { 
-            // no further augmenting reduction possible.
-            // store i0 in list of free rows for next phase.
-            free[numFree++] = i0; 
-          }
+        if (++matches[iMin] == 1) 
+        { 
+          // init assignment if minimum row assigned for first time.
+          rowSol[iMin] = static_cast<int>(j - 1); 
+          colSol[j - 1] = static_cast<int>(iMin); 
         }
+        else
+          colSol[j - 1] = -1;        // row already assigned, column not assigned.
       }
-    }
-    while (loopcnt < 2);       // repeat once.
 
-    // Augment solution for each free row.
-    for (f = 0; f < numFree; f++) 
-    {
-      freeRow = free[f];       // start row of augmenting path.
-
-      // Dijkstra shortest path algorithm.
-      // runs until unassigned column added to shortest path tree.
-      for (j = 0; j < dim; j++)  
-      { 
-        d[j] = assignCost(freeRow, j) - v[j]; 
-        pred[j] = freeRow;
-        colList[j] = j;        // init column list.
+      // Reduction tranfer
+      for (i = 0; i < dim; i++) { 
+        if (matches[i] == 0)     // fill list of unassigned 'free' rows.
+          free[numFree++] = i;
+        else {
+          if (matches[i] == 1)   // transfer reduction from rows that are assigned once.
+          {
+            j1 = static_cast<size_t>(rowSol[i]); //rowSol[i] is >= 0 here 
+            min = -log(0);
+            for (j = 0; j < dim; j++)  
+              if (j != j1)
+                if (assignCost(i, j - 1) - v[j] < min) 
+                  min = assignCost(i, j - 1) - v[j - 1];
+            v[j1] = v[j1] - min;
+          }
+        }
       }
 
-      low = 0; // columns in 0..low-1 are ready, now none.
-      up = 0;  // columns in low..up-1 are to be scanned for current minimum, now none.
-               // columns in up..dim-1 are to be considered later to find new minimum, 
-               // at this stage the list simply contains all columns 
-      unassignedFound = false;
+      // Augmenting row reduction 
+      short loopcnt = 0;           // do-loop to be done twice.
       do
       {
-        if (up == low)         // no more columns to be scanned for current minimum.
+        loopcnt++;
+
+        // scan all free rows.
+        // in some cases, a free row may be replaced with another one to be scanned next.
+        k = 0; 
+        previousNumFree = numFree; 
+        numFree = 0;             // start list of rows still free after augmenting row reduction.
+        while (k < previousNumFree)
         {
-          last = low - 1; 
-
-          // scan columns for up..dim-1 to find all indices for which new minimum occurs.
-          // store these indices between low..up-1 (increasing up). 
-          min = d[colList[up++]]; 
-          for (k = up; k < dim; k++) 
+          i = free[k]; 
+          k++;
+
+          // find minimum and second minimum reduced cost over columns.
+          uMin = assignCost(i, 0) - v[0]; 
+          j1 = 0; 
+          uSubMin = static_cast<size_t>(-log(0));
+          for (j = 1; j < dim; j++) 
           {
-            j = colList[k]; 
-            h = d[j];
-            if (h <= min)
-            {
-              if (h < min)     // new minimum.
+            h = assignCost(i, j) - v[j];
+            if (h < uSubMin) {
+              if (h >= uMin) 
               { 
-                up = low;      // restart list at index low.
-                min = h;
+                uSubMin = h; 
+                j2 = j;
+              }
+              else 
+              { 
+                uSubMin = uMin; 
+                uMin = h; 
+                j2 = j1; 
+                j1 = j;
               }
-              // new index with same minimum, put on undex up, and extend list.
-              colList[k] = colList[up]; 
-              colList[up++] = j; 
             }
           }
 
-          // check if any of the minimum columns happens to be unassigned.
-          // if so, we have an augmenting path right away.
-          for (k = low; k < up; k++) { 
-            if (colSol[colList[k]] < 0) 
-            {
-              endOfPath = colList[k];
-              unassignedFound = true;
-              break;
+          i0 = colSol[j1];
+          if (uMin < uSubMin) {
+            // change the reduction of the minimum column to increase the minimum
+            // reduced cost in the row to the subminimum.
+            v[j1] = v[j1] - (uSubMin - uMin);
+          } else {                  // minimum and subminimum equal.
+            if (i0 >= 0)         // minimum column j1 is assigned.
+            { 
+              // swap columns j1 and j2, as j2 may be unassigned.
+              j1 = j2; 
+              i0 = colSol[j2];
+            }
+          }
+
+          // (re-)assign i to j1, possibly de-assigning an i0.
+          rowSol[i] = static_cast<int>(j1); 
+          colSol[j1] = static_cast<int>(i);
+
+          if (i0 >= 0) {          // minimum column j1 assigned earlier.
+            if (uMin < uSubMin) {
+              // put in current k, and go back to that k.
+              // continue augmenting path i - j1 with i0.
+              free[--k] = static_cast<size_t>(i0); 
+            } else { 
+              // no further augmenting reduction possible.
+              // store i0 in list of free rows for next phase.
+              free[numFree++] = static_cast<size_t>(i0); 
             }
           }
         }
+      }
+      while (loopcnt < 2);       // repeat once.
 
-        if (!unassignedFound) 
-        {
-          // update 'distances' between freerow and all unscanned columns, via next scanned column.
-          j1 = colList[low]; 
-          low++; 
-          i = colSol[j1]; 
-          h = assignCost(i, j1) - v[j1] - min;
+      // Augment solution for each free row.
+      for (f = 0; f < numFree; f++) 
+      {
+        freeRow = free[f];       // start row of augmenting path.
 
-          for (k = up; k < dim; k++) 
+        // Dijkstra shortest path algorithm.
+        // runs until unassigned column added to shortest path tree.
+        for (j = 0; j < dim; j++)  
+        { 
+          d[j] = assignCost(freeRow, j) - v[j]; 
+          pred[j] = freeRow;
+          colList[j] = j;        // init column list.
+        }
+
+        low = 0; // columns in 0..low-1 are ready, now none.
+        up = 0;  // columns in low..up-1 are to be scanned for current minimum, now none.
+        // columns in up..dim-1 are to be considered later to find new minimum, 
+        // at this stage the list simply contains all columns 
+        unassignedFound = false;
+        do
+        {
+          if (up == low)         // no more columns to be scanned for current minimum.
           {
-            j = colList[k]; 
-            v2 = assignCost(i, j) - v[j] - h;
-            if (v2 < d[j])
+            last = low - 1; 
+
+            // scan columns for up..dim-1 to find all indices for which new minimum occurs.
+            // store these indices between low..up-1 (increasing up). 
+            min = d[colList[up++]]; 
+            for (k = up; k < dim; k++) 
             {
-              pred[j] = i;
-              if (v2 == min) {  // new column found at same minimum value
-                if (colSol[j] < 0) 
-                {
-                  // if unassigned, shortest augmenting path is complete.
-                  endOfPath = j;
-                  unassignedFound = true;
-                  break;
-                }
-                // else add to list to be scanned right away.
-                else 
+              j = colList[k]; 
+              h = d[j];
+              if (h <= min)
+              {
+                if (h < min)     // new minimum.
                 { 
-                  colList[k] = colList[up]; 
-                  colList[up++] = j; 
+                  up = low;      // restart list at index low.
+                  min = h;
                 }
+                // new index with same minimum, put on undex up, and extend list.
+                colList[k] = colList[up]; 
+                colList[up++] = j; 
+              }
+            }
+
+            // check if any of the minimum columns happens to be unassigned.
+            // if so, we have an augmenting path right away.
+            for (k = low; k < up; k++) { 
+              if (colSol[colList[k]] < 0) 
+              {
+                endOfPath = colList[k];
+                unassignedFound = true;
+                break;
               }
-              d[j] = v2;
             }
           }
-        } 
-      }
-      while (!unassignedFound);
 
-      // update column prices.
-      for (k = 0; k <= last; k++)  
-      { 
-        j1 = colList[k]; 
-        v[j1] = v[j1] + d[j1] - min;
+          if (!unassignedFound) 
+          {
+            // update 'distances' between freerow and all unscanned columns, via next scanned column.
+            j1 = colList[low]; 
+            low++; 
+            i = static_cast<size_t>(colSol[j1]); 
+            h = assignCost(i, j1) - v[j1] - min;
+
+            for (k = up; k < dim; k++) 
+            {
+              j = colList[k]; 
+              v2 = assignCost(i, j) - v[j] - h;
+              if (v2 < d[j])
+              {
+                pred[j] = i;
+                if (v2 == min) {  // new column found at same minimum value
+                  if (colSol[j] < 0) 
+                  {
+                    // if unassigned, shortest augmenting path is complete.
+                    endOfPath = j;
+                    unassignedFound = true;
+                    break;
+                  }
+                  // else add to list to be scanned right away.
+                  else 
+                  { 
+                    colList[k] = colList[up]; 
+                    colList[up++] = j; 
+                  }
+                }
+                d[j] = v2;
+              }
+            }
+          } 
+        }
+        while (!unassignedFound);
+
+        // update column prices.
+        for (k = 0; k <= last; k++)  
+        { 
+          j1 = colList[k]; 
+          v[j1] = v[j1] + d[j1] - min;
+        }
+
+        // reset row and column assignments along the alternating path.
+        do
+        {
+          i = pred[endOfPath]; 
+          colSol[endOfPath] = static_cast<int>(i); 
+          j1 = endOfPath; 
+          endOfPath = static_cast<size_t>(rowSol[i]); 
+          rowSol[i] = static_cast<int>(j1);
+        }
+        while (i != freeRow);
       }
 
-      // reset row and column assignments along the alternating path.
-      do
+      // calculate optimal cost.
+      Scalar lapCost = 0;
+      for (i = 0; i < dim; i++)  
       {
-        i = pred[endOfPath]; 
-        colSol[endOfPath] = i; 
-        j1 = endOfPath; 
-        endOfPath = rowSol[i]; 
-        rowSol[i] = j1;
+        j = static_cast<size_t>(rowSol[i]);
+        u[i] = assignCost(i, j) - v[j];
+        lapCost = lapCost + assignCost(i, j); 
       }
-      while (i != freeRow);
-    }
 
-    // calculate optimal cost.
-    Scalar lapCost = 0;
-    for (i = 0; i < dim; i++)  
-    {
-      j = rowSol[i];
-      u[i] = assignCost(i, j) - v[j];
-      lapCost = lapCost + assignCost(i, j); 
+      return lapCost;
     }
 
-    return lapCost;
-  }
-
-};
+  };
 
 /* DEPRECATED
    namespace MatrixOperators {
@@ -1274,7 +1304,7 @@ public:
    }
 
    };
- */
+*/
 } // end of namespace bpp.
 
 #endif  // _MATRIXTOOLS_H_
diff --git a/src/Bpp/Numeric/NumConstants.h b/src/Bpp/Numeric/NumConstants.h
index fd8c809..18d95a2 100644
--- a/src/Bpp/Numeric/NumConstants.h
+++ b/src/Bpp/Numeric/NumConstants.h
@@ -90,7 +90,7 @@ namespace bpp {
     static double INF() { return std::numeric_limits<double>::has_infinity ? -log(0) : std::numeric_limits<double>::max(); }
     static double PINF() { return std::numeric_limits<double>::has_infinity ? -log(0) : std::numeric_limits<double>::max(); }
     static double MINF() { return std::numeric_limits<double>::has_infinity ? log(0) : std::numeric_limits<double>::min(); }
-    static double NaN() { return 3./0.; }
+    static double NaN() { return NAN; }
     /** @} */
 
     static double PI() { return 3.141593; }
diff --git a/src/Bpp/Numeric/Number.h b/src/Bpp/Numeric/Number.h
index dbd3906..7078d11 100644
--- a/src/Bpp/Numeric/Number.h
+++ b/src/Bpp/Numeric/Number.h
@@ -6,7 +6,7 @@
 
 
 /*
-Copyright or © or Copr. CNRS, (November 17, 2004)
+Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
 
 This software is a computer program whose purpose is to provide utilitary
 classes. This file belongs to the Bio++ Project.
@@ -43,19 +43,63 @@ knowledge of the CeCILL license and that you accept its terms.
 
 #include "../Clonable.h"
 
+#include <string>
+
 namespace bpp
 {
+/**
+ * @brief The Number interface.
+ *
+ * This template class may be used to deal with number in an object way.
+ */
+class BppNumberI: public Clonable
+{
+	public:
+		
+		BppNumberI() {}
+			
+		virtual ~BppNumberI() {}
+
+	public:
+	
+		virtual BppNumberI* clone() const = 0;
+	
+	public:
+		
+    virtual std::string toString() const = 0;
+
+};
+
+
+class BppNotANumber: public virtual BppNumberI
+{
+	public:
+		
+		BppNotANumber() {}
+			
+		virtual ~BppNotANumber() {}
+
+	public:
+	
+		virtual BppNotANumber* clone() const { return new BppNotANumber(); }
+	
+	public:
+		
+    virtual std::string toString() const { return "NaN"; }
+
+};
+
 
 /**
  * @brief The Number object template class.
  *
  * This template class may be used to deal with number in an object way.
  */
-template<class T> class Number: public Clonable
+template<class T> class Number: public virtual BppNumberI
 {
 	protected:
 		/** @brief The value of this parameter. */
-		T _value;
+		T value_;
 	
 	public:
 		
@@ -64,13 +108,13 @@ template<class T> class Number: public Clonable
 		 *
 		 * @param value The value that the Number must have.
 		 */
-		Number(const T & value = 0): _value(value) {}
+		Number(const T& value = 0): value_(value) {}
 			
 		virtual ~Number() {}
 
     Number<T> & operator=(const T & t)
     { 
-      _value = t;
+      value_ = t;
       return *this;
     }
 	
@@ -81,7 +125,7 @@ template<class T> class Number: public Clonable
 		 *
 		 * @{
 		 */
-		Number<T> * clone() const { return new Number<T>(_value); }
+		Number<T>* clone() const { return new Number<T>(value_); }
 		/** @} */
 	
 	public:
@@ -91,7 +135,93 @@ template<class T> class Number: public Clonable
 		 *
 		 * @return The value of this number.
 		 */
-		T getValue() const { return _value; }
+		T getValue() const { return value_; }
+
+    std::string toString() const { return TextTools::toString(value_); }
+};
+
+/**
+ * @brief An object wrapper for double values.
+ */
+class BppDouble: public virtual Number<double>
+{
+ 	public:
+		
+		/**
+		 * @brief Build a new BppDouble number object with a specific value.
+		 *
+		 * @param value The value that the Number must have.
+		 */
+		BppDouble(double value = 0): Number<double>(value) {}
+			
+		virtual ~BppDouble() {}
+
+	public:
+	
+		/**
+		 * @name The Clonable interface.
+		 *
+		 * @{
+		 */
+		BppDouble* clone() const { return new BppDouble(*this); }
+		/** @} */
+	
+};
+
+/**
+ * @brief An object wrapper for integer values.
+ */
+class BppInteger: public virtual Number<int>
+{
+ 	public:
+		
+		/**
+		 * @brief Build a new BppInteger number object with a specific value.
+		 *
+		 * @param value The value that the Number must have.
+		 */
+		BppInteger(int value = 0): Number<int>(value) {}
+			
+		virtual ~BppInteger() {}
+
+	public:
+	
+		/**
+		 * @name The Clonable interface.
+		 *
+		 * @{
+		 */
+		BppInteger* clone() const { return new BppInteger(*this); }
+		/** @} */
+	
+};
+
+/**
+ * @brief An object wrapper for unsigned integer values.
+ */
+class BppUnsignedInteger: public virtual Number<unsigned int>
+{
+ 	public:
+		
+		/**
+		 * @brief Build a new BppUnsignedInteger number object with a specific value.
+		 *
+		 * @param value The value that the Number must have.
+		 */
+		BppUnsignedInteger(unsigned int value = 0): Number<unsigned int>(value) {}
+			
+		virtual ~BppUnsignedInteger() {}
+
+	public:
+	
+		/**
+		 * @name The Clonable interface.
+		 *
+		 * @{
+		 */
+		BppUnsignedInteger* clone() const { return new BppUnsignedInteger(*this); }
+		/** @} */
+	
 };
 
 } //end of namespace bpp.
diff --git a/src/Bpp/Numeric/Parameter.h b/src/Bpp/Numeric/Parameter.h
index 1b0b74f..1ed95d2 100644
--- a/src/Bpp/Numeric/Parameter.h
+++ b/src/Bpp/Numeric/Parameter.h
@@ -282,7 +282,6 @@ namespace bpp
      *
      * @param constraint a pointer to the constraint (may be null)
      * @param attach says if the constraint is attached to the Parameter (default: false).
-     * @return A pointer toward the formerly used contraint.
      */
     
     virtual void setConstraint(Constraint* constraint, bool attach = false);
diff --git a/src/Bpp/Numeric/ParameterAliasable.h b/src/Bpp/Numeric/ParameterAliasable.h
index 2ba444a..c634f96 100644
--- a/src/Bpp/Numeric/ParameterAliasable.h
+++ b/src/Bpp/Numeric/ParameterAliasable.h
@@ -5,36 +5,36 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for numerical calculus.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for numerical calculus.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _PARAMETERALIASABLE_H_
@@ -46,6 +46,7 @@ knowledge of the CeCILL license and that you accept its terms.
 
 //From the STL:
 #include <string>
+#include <map>
 
 namespace bpp
 {
@@ -79,9 +80,9 @@ namespace bpp
  * @endcode
  * is equivallent to the previous example.
  */
-class ParameterAliasable :
-  public virtual Parametrizable
-{
+  class ParameterAliasable :
+    public virtual Parametrizable
+  {
   public:
     ParameterAliasable() {}
     virtual ~ParameterAliasable() {}
@@ -108,6 +109,19 @@ class ParameterAliasable :
     virtual void aliasParameters(const std::string & p1, const std::string & p2) throw (ParameterNotFoundException, Exception) = 0; 
 
     /**
+     * @brief alias the parameters following the links described in a
+     * map, and update the object accordingly. Cycles in aliasing are
+     * detected and forbidden.
+     *
+     * @param unparsedParams the map of the links : <A,B> matches for A->B aliasing.
+     * @param verbose verbosity
+     *
+     **/
+    
+    virtual void aliasParameters(std::map<std::string, std::string>& unparsedParams, bool verbose) = 0;
+  
+
+    /**
      * @brief Detach two parameters previously set as 'aliased'.
      *
      * The values of the two parameters will now be independent.
@@ -115,7 +129,7 @@ class ParameterAliasable :
      * @param p2 Aliased parameter.
      * @throw ParameterNotFoundException if p1 or p2 do not correspond to existing parameters.
      * @throw Exception when trying to perform non-valid dissociation.
-      */
+     */
     virtual void unaliasParameters(const std::string & p1, const std::string & p2) throw (ParameterNotFoundException, Exception)  = 0;
 
     /**
@@ -133,7 +147,7 @@ class ParameterAliasable :
      * @param name The name of the parameter to look for.
      */
     virtual std::vector<std::string> getAlias(const std::string& name) const = 0;
-};
+  };
 
 
 
@@ -143,28 +157,28 @@ class ParameterAliasable :
  *
  * @see Parameter, ParameterList, ParameterAliasable
  */
-class ParameterAliasableAdapter:
-  public ParametrizableAdapter
-{
-	public:
-		ParameterAliasableAdapter() {}
-		virtual ~ParameterAliasableAdapter() {}
-
-	public:
-
-		/**
-		 * @name The ParameterAliasable interface.
-		 *
-		 * @{
-		 */
-		const ParameterList & getIndependentParameters() const { return getParameters(); }
+  class ParameterAliasableAdapter:
+    public ParametrizableAdapter
+  {
+  public:
+    ParameterAliasableAdapter() {}
+    virtual ~ParameterAliasableAdapter() {}
+
+  public:
+
+    /**
+     * @name The ParameterAliasable interface.
+     *
+     * @{
+     */
+    const ParameterList & getIndependentParameters() const { return getParameters(); }
     void aliasParameters(const std::string & p1, const std::string & p2) throw (ParameterNotFoundException, Exception) {}
     void unaliasParameters(const std::string & p1, const std::string & p2) throw (ParameterNotFoundException, Exception) {}
     unsigned int getNumberOfIndependentParameters() const{ return 0; }
     std::vector<std::string> getAlias(const std::string& name) const { return std::vector<std::string>(); }
-		/** @} */
+    /** @} */
 
-};
+  };
 
 } // end of namespace bpp.
 
diff --git a/src/Bpp/Numeric/ParameterList.cpp b/src/Bpp/Numeric/ParameterList.cpp
index 27651aa..0143376 100644
--- a/src/Bpp/Numeric/ParameterList.cpp
+++ b/src/Bpp/Numeric/ParameterList.cpp
@@ -5,7 +5,7 @@
 //
 
 /*
-   Copyright or © or Copr. Julien Dutheil, (November 19, 2004)
+   Copyright or © or Copr. Bio++ Development Team, (November 19, 2004)
 
    This software is a computer program whose purpose is to provide classes
    for numerical calculus.
@@ -38,6 +38,7 @@
  */
 
 #include "ParameterList.h"
+#include "../Text/StringTokenizer.h"
 
 using namespace bpp;
 
@@ -184,6 +185,40 @@ std::vector<std::string> ParameterList::getParameterNames() const
   return pNames;
 }
 
+/****************************************************************************/
+
+vector<string> ParameterList::getMatchingParameterNames(const string& pattern) const
+{
+  vector<string> pNames;
+  for (unsigned int i = 0; i < size(); i++)
+    {
+      string name = parameters_[i]->getName();
+
+      StringTokenizer stj(pattern, "*", true, false);
+      size_t pos1, pos2;
+      bool flag(true);
+      string g=stj.nextToken();
+      pos1=name.find(g);
+      if (pos1!=0)
+        flag=false;
+      pos1+=g.length();
+      while (flag && stj.hasMoreToken()){
+        g=stj.nextToken();
+        pos2=name.find(g,pos1);
+        if (pos2 == string::npos){
+          flag=false;
+          break;
+        }
+        pos1=pos2+g.length();
+      }
+      if (flag &&
+          ((g.length()==0) || (pos1==name.length()) || (name.rfind(g)==name.length()-g.length())))
+        pNames.push_back(name);
+    }
+
+  return pNames;
+}
+
 /******************************************************************************/
 
 void ParameterList::addParameter(const Parameter& param) throw (ParameterException)
@@ -325,7 +360,7 @@ bool ParameterList::testParametersValues(const ParameterList& params) const
 
 /******************************************************************************/
 
-bool ParameterList::matchParametersValues(const ParameterList& params)
+bool ParameterList::matchParametersValues(const ParameterList& params, vector<size_t>* updatedParameters)
 throw (ConstraintException)
 {
   // First we check if all values are correct:
@@ -342,15 +377,20 @@ throw (ConstraintException)
   // If all values are ok, we set them:
   bool ch = 0;
 
+  size_t pos = 0;
   for (vector<Parameter*>::const_iterator it = params.parameters_.begin(); it < params.parameters_.end(); it++)
   {
     if (hasParameter((*it)->getName()))
     {
       Parameter* p = &getParameter((*it)->getName());
-      if (p->getValue() != (*it)->getValue())
+      if (p->getValue() != (*it)->getValue()) {
         ch |= 1;
-      p->setValue((*it)->getValue());
+        p->setValue((*it)->getValue());
+        if (updatedParameters)
+          updatedParameters->push_back(pos);
+      }
     }
+    pos++;
   }
   return ch;
 }
@@ -419,11 +459,21 @@ void ParameterList::deleteParameter(const std::string& name) throw (ParameterNot
 }
 
 /******************************************************************************/
-void ParameterList::deleteParameters(const std::vector<std::string>& names) throw (ParameterNotFoundException)
+void ParameterList::deleteParameters(const std::vector<std::string>& names, bool mustExist) throw (ParameterNotFoundException)
 {
   for (unsigned int i = 0; i < names.size(); i++)
   {
-    deleteParameter(names[i]);
+    try
+    {
+      deleteParameter(names[i]);
+    }
+    catch (ParameterNotFoundException& e)
+    {
+      if (mustExist)
+        throw ParameterNotFoundException(e);
+      else
+        continue;
+    }
   }
 }
 
@@ -433,7 +483,7 @@ void ParameterList::deleteParameter(size_t index) throw (IndexOutOfBoundsExcepti
   if (index >= size()) throw IndexOutOfBoundsException("ParameterList::deleteParameter.", index, 0, size());
   Parameter* p = parameters_[index];
   delete p;
-  parameters_.erase(parameters_.begin() + index);
+  parameters_.erase(parameters_.begin() + static_cast<ptrdiff_t>(index));
 }
 
 /******************************************************************************/
@@ -447,7 +497,7 @@ void ParameterList::deleteParameters(const std::vector<size_t>& indices) throw (
     if (index >= size()) throw IndexOutOfBoundsException("ParameterList::deleteParameter.", index, 0, size());
     Parameter* p = parameters_[index];
     delete p;
-    parameters_.erase(parameters_.begin() + index);
+    parameters_.erase(parameters_.begin() + static_cast<ptrdiff_t>(index));
   }
 }
 
diff --git a/src/Bpp/Numeric/ParameterList.h b/src/Bpp/Numeric/ParameterList.h
index da93029..57c6086 100644
--- a/src/Bpp/Numeric/ParameterList.h
+++ b/src/Bpp/Numeric/ParameterList.h
@@ -174,6 +174,16 @@ public:
   virtual std::vector<std::string> getParameterNames() const;
 
   /**
+   * @brief Get all parameter names matching with the given name. Up
+   * to now, only "*" jokers are available.
+   *
+   * @param pattern a pattern of name
+   * @return A vector of matching names
+   */
+  
+  virtual std::vector<std::string> getMatchingParameterNames(const std::string& pattern) const;
+
+  /**
    * @brief Add a new parameter at the end of the list.
    *
    * @param param The parameter to add to the list.
@@ -274,10 +284,14 @@ public:
    * Only common parameters with <i>params</i> will be updated.
    *
    * @param params A list of parameters.
+   * @param updatedParameters An optional pointer toward a vector which will
+   * store the indices of parameters for which a value has changed.
+   * Indices are relative on the input parameter list "params".
    * @return true iff a least one parameter value has been changed.
    * @see setParameters(), setAllParameters()
    */
-  virtual bool matchParametersValues(const ParameterList& params)
+
+  virtual bool matchParametersValues(const ParameterList& params, std::vector<size_t>* updatedParameters = 0)
     throw (ConstraintException);
 
   /**
@@ -324,8 +338,11 @@ public:
    * @brief Delete several parameters from the list.
    *
    * @param names The names of the parameters to delete from the list.
+   * @param mustExist If true, an exception is thrown if a name does
+   *                    not match an extant parameter.
    */
-  virtual void deleteParameters(const std::vector<std::string>& names) throw (ParameterNotFoundException);
+  
+  virtual void deleteParameters(const std::vector<std::string>& names, bool mustExist = true) throw (ParameterNotFoundException);
 
   /**
    * @brief Delete a parameter from the list.
diff --git a/src/Bpp/Numeric/ParametrizableCollection.h b/src/Bpp/Numeric/ParametrizableCollection.h
new file mode 100644
index 0000000..e677d7b
--- /dev/null
+++ b/src/Bpp/Numeric/ParametrizableCollection.h
@@ -0,0 +1,356 @@
+//
+// File: ParametrizableCollection.h
+// Created by: Laurent Guéguen
+// Created on: mercredi 12 juin 2013, à 14h 24
+//
+
+/*
+  Copyright or (c) or Copr. Bio++ Development Team, (November 16, 2004)
+
+  This software is a computer program whose purpose is to provide classes
+  for phylogenetic data analysis.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use,
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info".
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability.
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or
+  data to be ensured and,  more generally, to use and operate it in the
+  same conditions as regards security.
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
+*/
+
+#ifndef _PARAMETRIZABLECOLLECTION_H_
+#define _PARAMETRIZABLECOLLECTION_H_
+
+#include "Parametrizable.h"
+#include "AbstractParameterAliasable.h"
+
+// From the STL:
+#include <map>
+#include <memory>
+
+namespace bpp
+{
+  /**
+   * @brief Plain collection of  parametrizable objects
+   *
+   * The collection is a map from unsigned integers to Parametrizables.
+   *
+   * The access to the parameters of the objects will be done through
+   * this collection.
+   *
+   */
+  
+  template <class N>
+  class ParametrizableCollection :
+    public AbstractParameterAliasable
+  {
+  protected:
+    /**
+     * @brief Contains all objects used.
+     */
+    
+    std::map<size_t, N* > objectsSet_;
+
+    /**
+     * @brief A vector of the numbers of objects that have changed
+     * during the last fireParameterChanged.
+     *
+     */
+
+    std::vector<size_t> vChanged_;
+    
+  public:
+    /**
+     * @brief Create an empty object set.
+     *
+     */
+  
+    ParametrizableCollection():
+      AbstractParameterAliasable(""),
+      objectsSet_(),
+      vChanged_()
+    {
+    }
+
+    ParametrizableCollection(const ParametrizableCollection<N>& set) :
+      AbstractParameterAliasable(set),
+      objectsSet_(),
+      vChanged_(set.vChanged_)
+    {
+      // Duplicate all objects:
+      typename std::map<size_t, N* >::const_iterator it;
+      for (it=set.objectsSet_.begin(); it!=set.objectsSet_.end(); it++)
+        objectsSet_[it->first]=it->second->clone();
+    }
+
+    ParametrizableCollection<N>& operator=(const ParametrizableCollection<N>& set)
+    {
+      clear();
+
+      AbstractParameterAliasable::operator=(set);
+      vChanged_ = set.vChanged_;
+      
+      // Duplicate all objects:
+      typename std::map<size_t, N* >::const_iterator it;
+      for (it=set.objectsSet_.begin(); it!=set.objectsSet_.end(); it++)
+        objectsSet_[it->first]=it->second->clone();
+
+      return *this;
+    }
+
+    /**
+     * @brief Resets all the information contained in this object.
+     *
+     */
+   
+    void clear()
+    {
+      resetParameters_();
+      
+      typename std::map<size_t, N*>::const_iterator it;
+      for (it=objectsSet_.begin(); it!=objectsSet_.end(); it++)
+        delete it->second;
+      objectsSet_.clear();
+      vChanged_.empty();
+    }
+
+    ~ParametrizableCollection()
+    {
+      clear();
+    }
+
+    ParametrizableCollection<N>* clone() const { return new ParametrizableCollection<N>(*this); }
+
+  public:
+    /**
+     * To be called when a parameter has changed.
+     * Depending on parameters, this will actualize the corresponding objects in the set.
+     * @param parameters The modified parameters.
+     */
+  
+    void fireParameterChanged(const ParameterList& parameters)
+    {
+      vChanged_.clear();
+      
+      std::vector<size_t> vCh;
+
+      std::map<size_t, ParameterList > mNumPl;
+      
+      for (size_t i=0; i<parameters.size(); i++)
+        {
+          std::string n=parameters[i].getName();
+          size_t t=n.rfind("_");
+          if (t==std::string::npos)
+            continue;
+          size_t num=(size_t)atoi(n.substr(t+1).c_str());
+          mNumPl[num].addParameter(Parameter(n.substr(0,t),parameters[i].getValue()));
+        }
+
+      std::map<size_t, ParameterList >::iterator it;
+      
+      // Then we update all objects in the set:
+      for (it=mNumPl.begin(); it!=mNumPl.end(); it++){
+        if (hasObject(it->first) && objectsSet_[it->first]->matchParametersValues(it->second))
+          vChanged_.push_back(it->first);
+      }
+    }
+
+    std::vector<size_t> hasChanged() const
+    {
+      return vChanged_;
+    }
+
+    void clearChanged()
+    {
+      vChanged_.clear();
+    }
+
+    /**
+     * @return The current number of distinct discrete objects in this set.
+     */
+  
+    size_t getNumberOfObjects() const { return objectsSet_.size(); }
+
+    /**
+     * @brief Says if there is a object with a given index.
+     *
+     * @param objectIndex Index of the object in the set.
+     * @return true or false.
+     */
+  
+    const bool hasObject(size_t objectIndex) const
+    {
+      return (objectsSet_.find(objectIndex)!=objectsSet_.end());
+    }
+
+    /**
+     * @brief Returns the keys of the set.
+     *
+     */
+  
+    const std::vector<size_t> keys() const
+    {
+      std::vector<size_t> vkeys;
+      typename std::map<size_t, N*>::const_iterator it;
+
+      for (it=objectsSet_.begin(); it!=objectsSet_.end(); it++)
+        vkeys.push_back(it->first);
+            
+      return vkeys;
+    }
+
+  
+    /**
+     * @brief Get one object from the set knowing its index.
+     *
+     * @param objectIndex Index of the object in the set.
+     * @return A pointer toward the corresponding object.
+     */
+  
+    const N* operator[](size_t objectIndex) const
+    {
+      typename std::map<size_t, N*>::const_iterator it=objectsSet_.find(objectIndex);
+      if (it==objectsSet_.end())
+        throw BadIntegerException("ParametrizableCollection::getObject().", (int)objectIndex);
+    
+      return dynamic_cast<const N*>(it->second);
+    }
+
+    N* operator[](size_t objectIndex)
+    {
+      typename std::map<size_t, N*>::iterator it=objectsSet_.find(objectIndex);
+      if (it==objectsSet_.end())
+        throw BadIntegerException("ParametrizableCollection::getObject().", (int)objectIndex);
+    
+      return it->second;
+    }
+  
+    /**
+     * @brief Add a new object to the set with a given number.
+     *
+     * @throw Exception if the number is already used. See replace function instead.
+     *
+     * @param object A pointer toward an object, that will added to the set.
+     * 
+     * WARNING! The set will now be the owner of the pointer, and will destroy it if needed!
+     * Copy the object first if you don't want it to be lost!
+     *
+     * @param objectIndex The number of the object in the Collection
+     * 
+     */
+
+    void addObject(N* object, size_t objectIndex)
+    {
+      typename std::map<size_t, N*>::iterator it=objectsSet_.find(objectIndex);
+      if (it!=objectsSet_.end())
+        throw BadIntegerException("ParametrizableCollection<N>::addObject. Object objectIndex already used", (int)objectIndex);
+
+      objectsSet_[objectIndex]=object;
+
+      // Associate parameters:
+      std::string pname;
+      std::vector<std::string> nplm;
+      nplm=object->getParameters().getParameterNames();
+
+      for (size_t i  = 0; i < nplm.size(); i++)
+        {
+          pname = nplm[i];
+          Parameter* p = new Parameter(object->getParameters().getParameter(pname));
+          p->setName(pname + "_" + TextTools::toString(objectIndex));
+          addParameter_(p);
+        }
+
+      if (dynamic_cast<ParameterAliasable*>(object)){
+        ParameterAliasable* ppa=dynamic_cast<ParameterAliasable*>(object);
+        for (size_t i  = 0; i < nplm.size(); i++)
+          {
+            std::vector<std::string> va=ppa->getAlias(nplm[i]);
+            for (size_t j=0;j<va.size();j++)
+              aliasParameters(nplm[i] + "_" + TextTools::toString(objectIndex), va[j] + "_" + TextTools::toString(objectIndex));
+          }
+      }
+    }
+
+    /**
+     * @brief Remove a object from the set, and all corresponding
+     * parameters. 
+     *
+     * @param objectIndex The index of the object in the set.
+     * @return the removed N*. 
+     */
+  
+    N* removeObject(size_t objectIndex)
+    {
+      if (objectsSet_.find(objectIndex)==objectsSet_.end())
+        throw BadIntegerException("ParametrizableCollection<N>::removeObject. None Object at this objectIndex", (int)objectIndex);
+
+      N* pm=objectsSet_[objectIndex];
+      objectsSet_.erase(objectIndex);
+      
+      // Erase all parameter references to this object and translate other indices...
+      
+      ParameterList pl=getParameters();
+      
+      for (size_t i = pl.size(); i>0; i--)
+        {
+          std::string pn=pl[i-1].getName();
+          
+          size_t pu=pn.rfind("_");
+          int nm=atoi(pn.substr(pu+1).c_str());
+          if (nm==(int)objectIndex){
+            std::vector<std::string> alpn=getAlias(pn);
+            for (unsigned j=0; j<alpn.size(); j++)
+              try {
+                unaliasParameters(alpn[j],pn);
+              }
+              catch (Exception& e)
+                {
+                  continue;
+                }
+            deleteParameter_(i-1);
+          }
+        }
+      
+      return pm;
+    }
+
+    /**
+     * @brief Replace a object in the set, and returns the replaced one.
+     *
+     * @param objectIndex The index of the object to be replaced in the set.
+     * @param object the replacing N
+     * @return the replaced N*. 
+     */
+
+    N* replaceObject(N* object, size_t objectIndex)
+    {
+      N* pm=removeObject(objectIndex);
+      addObject(object, objectIndex);
+      return pm;
+    }
+
+
+  };
+} // end of namespace bpp.
+
+#endif // _PARAMETRIZABLECOLLECTION_H_
+
diff --git a/src/Bpp/Numeric/Prob/AbstractDiscreteDistribution.cpp b/src/Bpp/Numeric/Prob/AbstractDiscreteDistribution.cpp
index 3d25976..1dc4c40 100644
--- a/src/Bpp/Numeric/Prob/AbstractDiscreteDistribution.cpp
+++ b/src/Bpp/Numeric/Prob/AbstractDiscreteDistribution.cpp
@@ -158,7 +158,7 @@ Vdouble AbstractDiscreteDistribution::getCategories() const
 Vdouble AbstractDiscreteDistribution::getProbabilities() const
 {
   Vdouble result(distribution_.size());
-  int i = 0;
+  size_t i = 0;
   for (map<double, double>::const_iterator it = distribution_.begin();
        it != distribution_.end();
        it++)
@@ -425,7 +425,7 @@ void AbstractDiscreteDistribution::discretize()
   {
     if (distribution_.find(values[i]) != distribution_.end())
     {
-      unsigned int j = 1;
+      int j = 1;
       int f = ((values[i] + NumConstants::TINY()) >= intMinMax_.getUpperBound()) ? -1 : 1;
       while (distribution_.find(values[i] + f * j * precision()) != distribution_.end())
       {
diff --git a/src/Bpp/Numeric/Prob/ConstantDistribution.cpp b/src/Bpp/Numeric/Prob/ConstantDistribution.cpp
index 5dc0cd5..600f19b 100644
--- a/src/Bpp/Numeric/Prob/ConstantDistribution.cpp
+++ b/src/Bpp/Numeric/Prob/ConstantDistribution.cpp
@@ -76,12 +76,10 @@ ConstantDistribution& ConstantDistribution::operator=(const ConstantDistribution
 void ConstantDistribution::fireParameterChanged(const ParameterList& parameters) 
 {
   AbstractDiscreteDistribution::fireParameterChanged(parameters);
-  
-  if (hasParameter("value")) {
-    value_=getParameterValue("value");
-    distribution_.clear();
-    distribution_[value_] = 1; //One single class of rate 1 with probability 1.
-  }
+
+  value_=getParameterValue("value");
+  distribution_.clear();
+  distribution_[value_] = 1; //One single class of rate 1 with probability 1.
 }
 
 /******************************************************************************/
@@ -102,4 +100,4 @@ void ConstantDistribution::restrictToConstraint(const Constraint& c)
 
   Parameter& p=getParameter_("value");
   p.setConstraint(intMinMax_.clone(),true);
-}
+ }
diff --git a/src/Bpp/Numeric/Prob/ConstantDistribution.h b/src/Bpp/Numeric/Prob/ConstantDistribution.h
index aa7cbcc..75d9e9b 100644
--- a/src/Bpp/Numeric/Prob/ConstantDistribution.h
+++ b/src/Bpp/Numeric/Prob/ConstantDistribution.h
@@ -56,7 +56,7 @@ namespace bpp
   
   private:
     double value_;
-  
+    
   public:
     /**
      * @brief Builds a new ConstantDistribution object from a
@@ -65,6 +65,7 @@ namespace bpp
      * @param value The value of the distribution.
      *
      */
+    
     ConstantDistribution(double value);
 
     ConstantDistribution(const ConstantDistribution&);
diff --git a/src/Bpp/Numeric/Prob/InvariantMixedDiscreteDistribution.h b/src/Bpp/Numeric/Prob/InvariantMixedDiscreteDistribution.h
index f807a0f..7742ac1 100644
--- a/src/Bpp/Numeric/Prob/InvariantMixedDiscreteDistribution.h
+++ b/src/Bpp/Numeric/Prob/InvariantMixedDiscreteDistribution.h
@@ -5,37 +5,37 @@
 //
 
 /*
-  Copyright or © or Copr. CNRS, (November 17, 2004)
-
-  This software is a computer program whose purpose is to provide classes
-  for numerical calculus.
-
-  This software is governed by the CeCILL  license under French law and
-  abiding by the rules of distribution of free software.  You can  use, 
-  modify and/ or redistribute the software under the terms of the CeCILL
-  license as circulated by CEA, CNRS and INRIA at the following URL
-  "http://www.cecill.info". 
-
-  As a counterpart to the access to the source code and  rights to copy,
-  modify and redistribute granted by the license, users are provided only
-  with a limited warranty  and the software's author,  the holder of the
-  economic rights,  and the successive licensors  have only  limited
-  liability. 
-
-  In this respect, the user's attention is drawn to the risks associated
-  with loading,  using,  modifying and/or developing or reproducing the
-  software by the user in light of its specific status of free software,
-  that may mean  that it is complicated to manipulate,  and  that  also
-  therefore means  that it is reserved for developers  and  experienced
-  professionals having in-depth computer knowledge. Users are therefore
-  encouraged to load and test the software's suitability as regards their
-  requirements in conditions enabling the security of their systems and/or 
-  data to be ensured and,  more generally, to use and operate it in the 
-  same conditions as regards security. 
-
-  The fact that you are presently reading this means that you have had
-  knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide classes
+   for numerical calculus.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 #ifndef _INVARIANTMIXEDDISCRETEDISTRIBUTION_H_
 #define _INVARIANTMIXEDDISCRETEDISTRIBUTION_H_
@@ -44,119 +44,119 @@
 
 namespace bpp
 {
+/**
+ * @brief Discrete mixed distribution, with a one-category fixed value (called "invariant") and a user-specified multi-categories distribution.
+ *
+ * The term "invariant" comes from the use of such distributions in phylogenetics:
+ * the fixed category corresponds to a value of 0 and describes invariant positions in an alignment.
+ */
+class InvariantMixedDiscreteDistribution :
+  public AbstractDiscreteDistribution
+{
+private:
+  DiscreteDistribution* dist_;
+  double invariant_, p_;
+  std::string nestedPrefix_;
 
+public:
   /**
-   * @brief Discrete mixed distribution, with a one-category fixed value (called "invariant") and a user-specified multi-categories distribution.
+   * @brief Build a new InvariantMixedDiscreteDistribution object.
    *
-   * The term "invariant" comes from the use of such distributions in phylogenetics:
-   * the fixed category corresponds to a value of 0 and describes invariant positions in an alignment.
+   * @param dist            The distribution to use. The mixed distribution will "own" this distribution object.
+   * This means that the distribution will be cloned in case of copy of this instance, and will be
+   * deleted with this instance.
+   * @param p               The probability of being in the invariant category.
+   * @param invariant       The value of the invariant category (typically 0, but other values may be specified).
    */
-  class InvariantMixedDiscreteDistribution:
-    public AbstractDiscreteDistribution
+  InvariantMixedDiscreteDistribution(DiscreteDistribution* dist, double p, double invariant = 0.);
+
+  virtual ~InvariantMixedDiscreteDistribution()
   {
-  private:
-    DiscreteDistribution* dist_;
-    double invariant_, p_;
-    std::string nestedPrefix_;
-
-  public:
-    /**
-     * @brief Build a new InvariantMixedDiscreteDistribution object.
-     *
-     * @param dist            The distribution to use. The mixed distribution will "own" this distribution object.
-     * This means that the distribution will be cloned in case of copy of this instance, and will be
-     * deleted with this instance.
-     * @param p               The probability of being in the invariant category.
-     * @param invariant       The value of the invariant category (typically 0, but other values may be specified). 
-     */
-    InvariantMixedDiscreteDistribution(DiscreteDistribution* dist, double p, double invariant = 0.);
-    
-    virtual ~InvariantMixedDiscreteDistribution()
-    {
-      delete dist_;
-    }
-    
-    InvariantMixedDiscreteDistribution(const InvariantMixedDiscreteDistribution& imdd):
-      AbstractParameterAliasable(imdd),
-      AbstractDiscreteDistribution(imdd),
-      dist_(dynamic_cast<DiscreteDistribution *>(imdd.dist_->clone())),
-      invariant_(imdd.invariant_), p_(imdd.p_),
-      nestedPrefix_(imdd.nestedPrefix_)
-    {}
-    
-    InvariantMixedDiscreteDistribution& operator=(const InvariantMixedDiscreteDistribution& imdd)
-    {
-      AbstractParameterAliasable::operator=(imdd);
-      AbstractDiscreteDistribution::operator=(imdd);
-      dist_         = dynamic_cast<DiscreteDistribution *>(imdd.dist_->clone());
-      invariant_    = imdd.invariant_;
-      p_            = imdd.p_;
-      nestedPrefix_ = imdd.nestedPrefix_;
-      return *this;
-    }
+    delete dist_;
+  }
+
+  InvariantMixedDiscreteDistribution(const InvariantMixedDiscreteDistribution& imdd) :
+    AbstractParameterAliasable(imdd),
+    AbstractDiscreteDistribution(imdd),
+    dist_(dynamic_cast<DiscreteDistribution*>(imdd.dist_->clone())),
+    invariant_(imdd.invariant_),
+    p_(imdd.p_),
+    nestedPrefix_(imdd.nestedPrefix_)
+  {}
+
+  InvariantMixedDiscreteDistribution& operator=(const InvariantMixedDiscreteDistribution& imdd)
+  {
+    AbstractParameterAliasable::operator=(imdd);
+    AbstractDiscreteDistribution::operator=(imdd);
+    dist_         = dynamic_cast<DiscreteDistribution*>(imdd.dist_->clone());
+    invariant_    = imdd.invariant_;
+    p_            = imdd.p_;
+    nestedPrefix_ = imdd.nestedPrefix_;
+    return *this;
+  }
 
-    InvariantMixedDiscreteDistribution* clone() const { return new InvariantMixedDiscreteDistribution(*this); }
+  InvariantMixedDiscreteDistribution* clone() const { return new InvariantMixedDiscreteDistribution(*this); }
 
-  public:
+public:
+  std::string getName() const {return "Invariant"; }
 
-    std::string getName() const {return("Invariant");}
+  void fireParameterChanged(const ParameterList& parameters);
 
-    void fireParameterChanged(const ParameterList & parameters);
+  void setNamespace(const std::string& prefix);
 
-    void setNamespace(const std::string& prefix);
+  /**
+   * @ brief Sets the number of categories of the embedded
+   * distribution. The number of categories of this class equals this
+   * plus one if the invariant_ is not in the embedded distribution
+   * values.
+   */
+  void setNumberOfCategories(size_t nbClasses)
+  {
+    dist_->setNumberOfCategories(nbClasses);
+    updateDistribution();
+  }
 
-    /*
-     *@ brief Sets the number of categories of the embedded
-     *distribution. The number of categories of this class equals this
-     *plus one if the invariant_ is not in the embedded distribution
-     *values.
-     *
-     */
-    
-    void setNumberOfCategories(unsigned int nbClasses) {
-      dist_->setNumberOfCategories(nbClasses);
-      updateDistribution();
-    }
-    
-    /**
-     * @return The nested, conditional, sub-distribution.
-     */
-    const DiscreteDistribution * getVariableSubDistribution() const { return dist_; }
-
-    double qProb(double x) const{
-      return (x>=p_+(1-p_)*dist_->pProb(invariant_))?dist_->qProb((x-p_)/(1-p_)):dist_->qProb(x/(1-p_));
-    }
-     
-    double pProb(double x) const{
-      return (1-p_)*dist_->pProb(x)+(x<invariant_)?0:p_;
-    }
-                                
-    double Expectation(double a) const{
-      return (1-p_)*dist_->Expectation(a)+(a<invariant_?0:p_);
-    }
+  /**
+   * @return The nested, conditional, sub-distribution.
+   */
+  const DiscreteDistribution* getVariableSubDistribution() const { return dist_; }
 
-    void setMedian(bool median){
-      if (median_!=median){
-        median_=median;
-        dist_->setMedian(median);
-        updateDistribution();
-      }
-    }
-  
-    void discretize(){
-      dist_->discretize();
-      updateDistribution();
-    }
+  double qProb(double x) const
+  {
+    return (x >= p_ + (1 - p_) * dist_->pProb(invariant_)) ? dist_->qProb((x - p_) / (1 - p_)) : dist_->qProb(x / (1 - p_));
+  }
 
-    void restrictToConstraint(const Constraint& c);
+  double pProb(double x) const
+  {
+    return (1 - p_) * dist_->pProb(x) + (x < invariant_ ? 0 : p_);
+  }
 
-  protected:
-    void updateDistribution();
+  double Expectation(double a) const
+  {
+    return (1 - p_) * dist_->Expectation(a) + (a < invariant_ ? 0 : p_);
+  }
 
+  void setMedian(bool median)
+  {
+    if (median_ != median)
+    {
+      median_ = median;
+      dist_->setMedian(median);
+      updateDistribution();
+    }
+  }
 
-  };
+  void discretize()
+  {
+    dist_->discretize();
+    updateDistribution();
+  }
 
-} //end of namespace bpp.
+  void restrictToConstraint(const Constraint& c);
 
-#endif //_INVARIANTMIXEDDISCRETEDISTRIBUTION_H_
+protected:
+  void updateDistribution();
+};
+} // end of namespace bpp.
 
+#endif // _INVARIANTMIXEDDISCRETEDISTRIBUTION_H_
diff --git a/src/Bpp/Numeric/Prob/SimpleDiscreteDistribution.cpp b/src/Bpp/Numeric/Prob/SimpleDiscreteDistribution.cpp
index f7faf38..8fc0145 100644
--- a/src/Bpp/Numeric/Prob/SimpleDiscreteDistribution.cpp
+++ b/src/Bpp/Numeric/Prob/SimpleDiscreteDistribution.cpp
@@ -222,7 +222,7 @@ void SimpleDiscreteDistribution::fireParameterChanged(const ParameterList& param
       v = getParameterValue("V" + TextTools::toString(i + 1));
       if (distribution_.find(v) != distribution_.end())
       {
-        unsigned int j = 1;
+        int j = 1;
         int f = ((v + precision()) >= intMinMax_.getUpperBound()) ? -1 : 1;
         while (distribution_.find(v + f * j * precision()) != distribution_.end())
         {
@@ -240,7 +240,7 @@ void SimpleDiscreteDistribution::fireParameterChanged(const ParameterList& param
     v = getParameterValue("V" + TextTools::toString(size));
     if (distribution_.find(v) != distribution_.end())
     {
-      unsigned int j = 1;
+      int j = 1;
       int f = ((v + precision()) >= intMinMax_.getUpperBound()) ? -1 : 1;
       while (distribution_.find(v + f * j * precision()) != distribution_.end())
       {
diff --git a/src/Bpp/Numeric/Prob/Simplex.cpp b/src/Bpp/Numeric/Prob/Simplex.cpp
index 29bb5f5..b07591f 100644
--- a/src/Bpp/Numeric/Prob/Simplex.cpp
+++ b/src/Bpp/Numeric/Prob/Simplex.cpp
@@ -45,81 +45,131 @@
 using namespace bpp;
 using namespace std;
 
-Simplex::Simplex(const std::vector<double>& probas, unsigned short method, const std::string& name) : AbstractParameterAliasable(name),
+Simplex::Simplex(const std::vector<double>& probas, unsigned short method, bool allowNull, const std::string& name) : AbstractParameterAliasable(name),
   dim_(probas.size()),
   method_(method),
   vProb_(),
   valpha_()
 {
+  if  (dim_==0)
+    return;
+
   double sum = VectorTools::sum(probas);
   if (fabs(1. - sum) > NumConstants::SMALL())
     throw Exception("Simplex. Probabilities must equal 1 (sum =" + TextTools::toString(sum) + ").");
 
+  const Constraint* pc = (allowNull ? &Parameter::PROP_CONSTRAINT_IN : &Parameter::PROP_CONSTRAINT_EX);
+
   for (unsigned int i = 0; i < dim_; i++)
   {
     vProb_.push_back(probas[i]);
   }
 
+  double y = 1;
   switch (method_)
   {
+  case 1:
+    for (unsigned int i = 0; i < dim_ - 1; i++)
+    {
+      addParameter_(new Parameter(name + "theta" + TextTools::toString(i + 1), vProb_[i] / y, pc));
+      y -= vProb_[i];
+    }
+    break;
   case 2:
     for (unsigned int i = 0; i < dim_ - 1; i++)
     {
-      addParameter_(new Parameter(name + "theta" + TextTools::toString(i + 1), vProb_[i] / (vProb_[i] + vProb_[i + 1]), &Parameter::PROP_CONSTRAINT_IN));
+      addParameter_(new Parameter(name + "theta" + TextTools::toString(i + 1), vProb_[i] / (vProb_[i] + vProb_[i + 1]), pc));
     }
     for (unsigned int i = 0; i < dim_ - 1; i++)
     {
       valpha_.push_back(vProb_[i + 1] / vProb_[i]);
     }
     break;
-  case 1:
-    double y = 1;
-    for (unsigned int i = 0; i < dim_ - 1; i++)
+  case 3:
+    for (size_t i = 1; i < dim_; i++)
     {
-      addParameter_(new Parameter(name + "theta" + TextTools::toString(i + 1), vProb_[i] / y, &Parameter::PROP_CONSTRAINT_IN));
-      y -= vProb_[i];
+      size_t o = i;
+      size_t li2 = 0; // rank of the strongest bit
+      while (o)
+      {
+        li2++;
+        o = o >> 1;
+      }
+
+      double i1 = 0, i0 = 0;
+      size_t j = 0;
+      size_t pi = i &  ~(1 << (li2 - 1));
+      while (j < dim_)
+      {
+        size_t t = (j << li2) + pi;
+        if (t >= dim_)
+          break;
+        else
+          i0 += vProb_[t];
+        t += (1 << (li2 - 1));
+        if (t < dim_)
+          i1 += vProb_[t];
+        j++;
+      }
+      addParameter_(new Parameter(name + "theta" + TextTools::toString(i), i1 / (i0 + i1), pc));
     }
     break;
   }
 }
 
-Simplex::Simplex(size_t dim, unsigned short method, const std::string& name) :
+Simplex::Simplex(size_t dim, unsigned short method, bool allowNull, const std::string& name) :
   AbstractParameterAliasable(name),
   dim_(dim),
   method_(method),
   vProb_(),
   valpha_()
 {
+  if  (dim_==0)
+    return;
+  
   for (size_t i = 0; i < dim_; i++)
   {
     vProb_.push_back(1. / static_cast<double>(dim_));
   }
 
+  const Constraint* pc = (allowNull ? &Parameter::PROP_CONSTRAINT_IN : &Parameter::PROP_CONSTRAINT_EX);
+
+  double y = 1;
   switch (method_)
   {
+  case 1:
+    for (unsigned int i = 0; i < dim_ - 1; i++)
+    {
+      addParameter_(new Parameter(name + "theta" + TextTools::toString(i + 1), vProb_[i] / y, pc));
+      y -= vProb_[i];
+    }
+    break;
   case 2:
     for (unsigned int i = 0; i < dim_ - 1; i++)
     {
-      addParameter_(new Parameter(name+ "theta" + TextTools::toString(i + 1), 0.5, &Parameter::PROP_CONSTRAINT_IN));
+      addParameter_(new Parameter(name + "theta" + TextTools::toString(i + 1), 0.5, pc));
     }
     for (unsigned int i = 0; i < dim_ - 1; i++)
     {
       valpha_.push_back(1.);
     }
     break;
-  case 1:
-    double y = 1;
+  case 3:
     for (unsigned int i = 0; i < dim_ - 1; i++)
     {
-      addParameter_(new Parameter(name+"theta" + TextTools::toString(i + 1), vProb_[i] / y, &Parameter::PROP_CONSTRAINT_IN));
-      y -= vProb_[i];
+      addParameter_(new Parameter(name + "theta" + TextTools::toString(i + 1), 0.5, pc));
     }
+    setFrequencies(vProb_);
+    
     break;
   }
 }
 
 void Simplex::fireParameterChanged(const ParameterList& parameters)
 {
+  if  (dim_==0)
+    return;
+
   AbstractParameterAliasable::fireParameterChanged(parameters);
 
   double x = 1.0;
@@ -151,15 +201,47 @@ void Simplex::fireParameterChanged(const ParameterList& parameters)
       x += vProb_[i + 1];
     }
     for (unsigned int i = 0; i < dim_; i++)
+    {
       vProb_[i] /= x;
+    }
 
     break;
+  case 3:
+    size_t o = dim_;
+    size_t ld2 = 0; // rank of the strongest bit
+    while (o)
+    {
+      ld2++;
+      o = o >> 1;
+    }
+    for (size_t i = 0; i < dim_; i++)
+    {
+      x = 1;
+      size_t ld = ld2;
+      size_t k = i;
+      while (ld)
+      {
+        if (k >> (ld - 1))
+          x *= getParameterValue("theta" + TextTools::toString(k));
+        else
+        {
+          if ((k + (1 << (ld - 1))) < dim_)
+            x *= 1 - getParameterValue("theta" + TextTools::toString(k + (1 << (ld - 1))));
+        }
+        k &= ~(1 << (--ld));
+      }
+      vProb_[i] = x;
+    }
+    break;
   }
 }
 
 
 void Simplex::setFrequencies(const std::vector<double>& probas)
 {
+  if  (dim_==0)
+    return;
+
   double sum = VectorTools::sum(probas);
   if (fabs(1. - sum) > NumConstants::SMALL())
     throw Exception("Simplex::setFrequencies. Probabilities must equal 1 (sum =" + TextTools::toString(sum) + ").");
@@ -168,22 +250,51 @@ void Simplex::setFrequencies(const std::vector<double>& probas)
 
   ParameterList pl;
   switch (method_)
+  {
+  case 1:
+    for (unsigned int i = 0; i < dim_ - 1; i++)
     {
-    case 1:
-      for (unsigned int i = 0; i < dim_ - 1; i++)
-        {
-          pl.addParameter(Parameter(getNamespace()+"theta" + TextTools::toString(i + 1), probas[i] / y));
-          y -= probas[i];
-        }
-      break;
-    case 2:
-      for (unsigned int i = 0; i < dim_ - 1; i++)
-        {
-          pl.addParameter(Parameter(getNamespace()+"theta" + TextTools::toString(i + 1), probas[i] / (probas[i] + probas[i + 1])));
-          valpha_[i]=probas[i + 1] / probas[i];
-        }
-      break;
+      pl.addParameter(Parameter(getNamespace() + "theta" + TextTools::toString(i + 1), probas[i] / y));
+      y -= probas[i];
+    }
+    break;
+  case 2:
+    for (unsigned int i = 0; i < dim_ - 1; i++)
+    {
+      pl.addParameter(Parameter(getNamespace() + "theta" + TextTools::toString(i + 1), probas[i] / (probas[i] + probas[i + 1])));
+      valpha_[i] = probas[i + 1] / probas[i];
     }
+    break;
+  case 3:
+    for (size_t i = 1; i < dim_; i++)
+    {
+      size_t o = i;
+      size_t li2 = 0; // rank of the strongest bit
+      while (o)
+      {
+        li2++;
+        o = o >> 1;
+      }
+
+      double i1 = 0, i0 = 0;
+      size_t j = 0;
+      size_t pi = i &  ~(1 << (li2 - 1));
+      while (j < dim_)
+      {
+        size_t t = (j << li2) + pi;
+        if (t >= dim_)
+          break;
+        else
+          i0 += vProb_[t];
+        t += (1 << (li2 - 1));
+        if (t < dim_)
+          i1 += vProb_[t];
+        j++;
+      }
+      pl.addParameter(Parameter(getNamespace() + "theta" + TextTools::toString(i), i1 / (i0 + i1)));
+    }
+    break;
+  }
 
   matchParametersValues(pl);
 }
diff --git a/src/Bpp/Numeric/Prob/Simplex.h b/src/Bpp/Numeric/Prob/Simplex.h
index 20c1f66..cf93cb4 100644
--- a/src/Bpp/Numeric/Prob/Simplex.h
+++ b/src/Bpp/Numeric/Prob/Simplex.h
@@ -5,37 +5,37 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide classes
-for numerical calculus.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide classes
+   for numerical calculus.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 #ifndef _SIMPLEX_H_
 #define _SIMPLEX_H_
@@ -48,7 +48,6 @@ knowledge of the CeCILL license and that you accept its terms.
 
 namespace bpp
 {
-
 /**
  * @brief A Simplex object, used to define sets of probabilities that
  * sum 1.
@@ -76,41 +75,57 @@ namespace bpp
  * In the reverse if we denote @f$\alpha_i=\frac{1-\theta_i}{\theta_i}@f$,
  * @f$p_i=\frac{\alpha_1...\alpha_{i-1}}{1+\sum_{k=1}^{n-1}\alpha_1...\alpha_k}@f$.
  *
+ * Binary:
+ *
+ * This parametrization is based on the binary coding.
+ *
+ * Given @f$a_b...a_1 at f$ the writing of i in binary, we denote
+ * @f$i_k=a_k...a_1 at f$.
+ *
+ * Given @f$a_b...a_1 at f$ the writing of i in binary where @f$a_b=1 at f$,
+ * we denote @f$1_i=\sum\{p_{j+1} \text{ such that } j_b=i_b=1i_{b-1}\}@f$ and
+ * @f$0_i=\sum\{p_{j+1} \text{ such that }  j_b=0i_{b-1}\}@f$, and then we define:
+ *
+ *
+ * @f$\theta_i=\frac{1_i}{1_i+0_i}@f$
+ *
+ * and on the reverse, we denote @f$\theta'_{0i_{b-1}}=1-\theta_i at f$
+ * and @f$\theta'_{1i_{b-1}}=\theta_i at f$.
+ *
+ * Then, if @f$c=ceil(log_2(n))@f$, for @f$i \in <0,n-1>@f$.
+ *
+ * @f$p_{i+1}=\theta'_{i_c}....\theta'_{i_1} @f$
+ *
  */
-
-  class Simplex:
-    public AbstractParameterAliasable
+class Simplex :
+  public AbstractParameterAliasable
 {
 private:
-  /*
-   *@brief The dimension+1 of the space simplex (ie the number of probabilities).
+
+  /**
+   * @brief The dimension+1 of the space simplex (ie the number of probabilities).
    *
    */
-   
   size_t dim_;
 
-  /*
-   *@brief the method of parametrization.
+  /**
+   * @brief the method of parametrization.
    *
    * 0: No parametrization
    * 1: Global ratio
    * 2: Local ratio
-   *
+   * 3: Binary
    */
   unsigned short method_;
-  
+
   std::vector<double> vProb_;
 
-  /*
-   *@brief just used with local ratio (method 2)
-   *
+  /**
+   * @brief just used with local ratio (method 2)
    */
-  
   std::vector<double> valpha_;
-  
-  
-public:
 
+public:
   /**
    * @brief Builds a new Simplex object from a number of
    * probabilities. They are initialized equal.
@@ -120,11 +135,12 @@ public:
    *    0: No parametrization
    *    1: Global ratio
    *    2: Local ratio
+   *    3: Binary
+   * @param allowNull if null probabilites are allowed (default: false)
    * @param name The name passed to AbstractParameterAliasable constructor.
    *
    */
-  
-  Simplex(size_t dim, unsigned short method = 0, const std::string& name = "Simplex.");
+  Simplex(size_t dim, unsigned short method = 0, bool allowNull = false, const std::string& name = "Simplex.");
 
   /**
    * @brief Builds a new Simplex object from a vector of probabilities
@@ -134,29 +150,33 @@ public:
    *    0: No parametrization
    *    1: Global ratio
    *    2: Local ratio
+   *    3: Binary
+   * @param allowNull if null probabilites are allowed (default: false)
    * @param name The name passed to AbstractParameterAliasable constructor.
    *
    */
+  Simplex(const std::vector<double>& probas, unsigned short method = 0, bool allowNull = false, const std::string& name = "Simplex.");
 
-  Simplex(const std::vector<double>& probas, unsigned short method = 0, const std::string& name = "Simplex.");
-  
   virtual ~Simplex() {}
 
   Simplex* clone() const { return new Simplex(*this); }
 
 public:
-  void fireParameterChanged(const ParameterList & parameters);
+  void fireParameterChanged(const ParameterList& parameters);
 
   size_t dimension() const { return dim_; }
 
   void setFrequencies(const std::vector<double>&);
-  
-  double prob(size_t i) const { return vProb_[i];}
 
-  unsigned short getMethod() const { return method_;}
-};
+  const std::vector<double>& getFrequencies() const { return vProb_;}
 
-} //end of namespace bpp.
+  std::vector<double>& getFrequencies() { return vProb_;}
+
+  double prob(size_t i) const { return vProb_[i]; }
+
+  unsigned short getMethod() const { return method_; }
+};
+} // end of namespace bpp.
 
-#endif  //_SIMPLEDISCRETEDISTRIBUTION_H_
+#endif  // _SIMPLEDISCRETEDISTRIBUTION_H_
 
diff --git a/src/Bpp/Numeric/Random/RandomTools.cpp b/src/Bpp/Numeric/Random/RandomTools.cpp
index 42e7516..e470001 100644
--- a/src/Bpp/Numeric/Random/RandomTools.cpp
+++ b/src/Bpp/Numeric/Random/RandomTools.cpp
@@ -72,13 +72,6 @@ bool RandomTools::flipCoin(const RandomFactory& generator)
   return (RandomTools::giveRandomNumberBetweenZeroAndEntry(1.0, generator) - 0.5) > 0;
 }
 
-// Method to get a integer random value (between 0 and specified range)
-// Note : the number you get is between 0 and entry not including entry !
-int RandomTools::giveIntRandomNumberBetweenZeroAndEntry(int entry, const RandomFactory& generator)
-{
-  return static_cast<int>(giveRandomNumberBetweenZeroAndEntry(entry, generator));
-}
-
 double RandomTools::randGaussian(double mean, double variance, const RandomFactory& generator)
 {
   return RandomTools::qNorm(generator.drawNumber(), mean, sqrt(variance));
@@ -256,7 +249,7 @@ double RandomTools::lnGamma (double alpha)
 
 double RandomTools::incompleteGamma (double x, double alpha, double ln_gamma_alpha)
 {
-  int i;
+  size_t i;
   double p = alpha, g = ln_gamma_alpha;
   double accurate = 1e-8, overflow = 1e30;
   double factor, gin = 0, rn = 0, a = 0, b = 0, an = 0, dif = 0, term = 0;
diff --git a/src/Bpp/Numeric/Random/RandomTools.h b/src/Bpp/Numeric/Random/RandomTools.h
index 04ba6eb..77bb820 100644
--- a/src/Bpp/Numeric/Random/RandomTools.h
+++ b/src/Bpp/Numeric/Random/RandomTools.h
@@ -117,7 +117,10 @@ namespace bpp
      * @param entry Max number to reach.
      * @param generator Random number generator to use.
      */
-    static int giveIntRandomNumberBetweenZeroAndEntry(int entry, const RandomFactory& generator = *DEFAULT_GENERATOR);
+    template<class intType>
+    static intType giveIntRandomNumberBetweenZeroAndEntry(intType entry, const RandomFactory& generator = *DEFAULT_GENERATOR) {
+      return static_cast<intType>(giveRandomNumberBetweenZeroAndEntry(static_cast<double>(entry), generator));
+    }
 
     /**
      * @brief Set the default generator seed.
@@ -155,7 +158,6 @@ namespace bpp
      * @param beta The beta parameter.
      * @param generator The uniform generator to use.
      */
-
     static double randBeta(double alpha, double beta, const RandomFactory& generator = *DEFAULT_GENERATOR);
   
     /**
@@ -181,7 +183,7 @@ namespace bpp
     static T pickOne(std::vector<T>& v, bool replace = false) throw (EmptyVectorException<T>) {
       if (v.empty())
         throw EmptyVectorException<T>("RandomTools::pickOne: input vector is empty", &v);
-      size_t pos = static_cast<size_t>(RandomTools::giveIntRandomNumberBetweenZeroAndEntry(static_cast<int>(v.size())));
+      size_t pos = RandomTools::giveIntRandomNumberBetweenZeroAndEntry<size_t>(v.size());
       if (replace)
         return v[pos];
       else {
@@ -192,6 +194,14 @@ namespace bpp
       }
     }
 
+   template<class T>
+    static T pickOne(const std::vector<T>& v) throw (EmptyVectorException<T>) {
+      if (v.empty())
+        throw EmptyVectorException<T>("RandomTools::pickOne: input vector is empty", &v);
+      size_t pos = RandomTools::giveIntRandomNumberBetweenZeroAndEntry<size_t>(v.size());
+      return v[pos];
+    }
+
     /**
      * @brief Sample a vector.
      *
@@ -273,7 +283,7 @@ namespace bpp
      * the result is a shuffle of the original vector.
      *
      * It has to be noted that in case of sampling without replacement,
-     * the effect of the weighting scheme will be lower as the sampe size becomes
+     * the effect of the weighting scheme will be weaker as the sample size becomes
      * close to the population size. In case the two are equal (pure permutations),
      * the weigths have no effect at all.
      *
@@ -285,7 +295,8 @@ namespace bpp
      * @throw IndexOutOfBoundException if the sample size exceeds the original
      * size when sampling without replacement.
      * @throw EmptyVectorException if the vector is empty.
-     *
+     * @warning: For large sampling with replacement, the function is not efficient,
+     * as it recomputes the some of weights for each element picked.
      * @author Julien Dutheil
      */
    template<class T> 
diff --git a/src/Bpp/Numeric/Range.h b/src/Bpp/Numeric/Range.h
index 81cf091..bb4a669 100644
--- a/src/Bpp/Numeric/Range.h
+++ b/src/Bpp/Numeric/Range.h
@@ -47,8 +47,8 @@
 #include <string>
 #include <set>
 #include <algorithm>
-
 #include <iostream>
+#include <cstddef>
 
 namespace bpp {
 
@@ -428,7 +428,7 @@ template<class T> class MultiRange:
           ranges_[overlappingPositions[0]]->expandWith(*ranges_[overlappingPositions[i]]);
           //Then removes this range:
           delete ranges_[overlappingPositions[i]];
-          ranges_.erase(ranges_.begin() + overlappingPositions[i]);
+          ranges_.erase(ranges_.begin() + static_cast<ptrdiff_t>(overlappingPositions[i]));
         }
       }
       clean_();
diff --git a/src/Bpp/Numeric/TransformedParameter.h b/src/Bpp/Numeric/TransformedParameter.h
index 3360b36..88ae8e7 100644
--- a/src/Bpp/Numeric/TransformedParameter.h
+++ b/src/Bpp/Numeric/TransformedParameter.h
@@ -5,7 +5,7 @@
 //
 
 /*
-Copyright or © or Copr. CNRS, (November 19, 2004)
+Copyright or © or Copr. Bio++ Development Team, (November 19, 2004)
 
 This software is a computer program whose purpose is to provide classes
 for numerical calculus.
@@ -195,7 +195,7 @@ class RTransformedParameter:
  * @f[
  * x' = s\tan\left(\pi\frac{x-a}{b-a} - \frac{\pi}{2}\right)
  * @f]
- * The 'a' and 'b' parameters are the lower and upper bounds and 's' is a sclaing factor set to 1 by default.
+ * The 'a' and 'b' parameters are the lower and upper bounds and 's' is a scaling factor set to 1 by default.
  * If the hyperbolic option is set to true (the default), then the following transformation is used instead:
  * @f[
  * x' = s\,\text{atanh}\left(2\frac{x-a}{b-a} - 1\right)
@@ -221,7 +221,7 @@ class IntervalTransformedParameter:
      * @param lowerBound the inerval lower bound to use.
      * @param upperBound the inerval lower bound to use.
      * @param scale the scaling factor.
-     * @param hyper tell if the hyberboic function should be used (true by default).
+     * @param hyper tell if the hyberbolic function should be used (true by default).
      */
     IntervalTransformedParameter(const std::string& name, double value, double lowerBound = 0, double upperBound = 1, double scale = 1, bool hyper = true):
       TransformedParameter(name, hyper ?
@@ -242,7 +242,7 @@ class IntervalTransformedParameter:
       if (value <= lowerBound_ || value >= upperBound_) throw ConstraintException("IntervalTransformedParameter::setValue", this, value);
       setValue(hyper_ ?
           scale_ * atanh(2. * (value - lowerBound_) / (upperBound_ - lowerBound_) - 1.) :
-          scale_ * tan(NumConstants::PI() * (value - lowerBound_)/(upperBound_ - lowerBound_) - NumConstants::PI() / 2.));
+          scale_ * std::tan(NumConstants::PI() * (value - lowerBound_)/(upperBound_ - lowerBound_) - NumConstants::PI() / 2.));
     }
 
     double getOriginalValue() const
@@ -259,7 +259,7 @@ class IntervalTransformedParameter:
     {
       double x = getValue();
       double x2 = hyper_ ?
-        1. / (cosh(pow(x / scale_, 2))) * (upperBound_ - lowerBound_) / (2. * scale_) :
+        1. / (pow(cosh(x / scale_), 2)) * (upperBound_ - lowerBound_) / (2. * scale_) :
         (upperBound_ - lowerBound_) / (NumConstants::PI() * scale_ * (pow(x / scale_, 2) + 1.));
       return x2;
     }
@@ -267,7 +267,7 @@ class IntervalTransformedParameter:
     {
       double x = getValue();
       double x2 = hyper_ ?
-        - 1. / (cosh(pow(x / scale_, 2))) * tanh(x / scale_) *(upperBound_ - lowerBound_) / (scale_ * scale_) :
+        - 1. / (pow(cosh(x / scale_), 2)) * tanh(x / scale_) * (upperBound_ - lowerBound_) / (scale_ * scale_) :
         -2. * x * (upperBound_ - lowerBound_) / (NumConstants::PI() * pow(scale_, 3) * pow((pow(x / scale_, 2) + 1.), 2));
       return x2;
     }
diff --git a/src/Bpp/Numeric/VectorTools.h b/src/Bpp/Numeric/VectorTools.h
index 8c4ea51..8967d26 100644
--- a/src/Bpp/Numeric/VectorTools.h
+++ b/src/Bpp/Numeric/VectorTools.h
@@ -839,6 +839,7 @@ public:
   static std::string paste(const std::vector<T>& v, const std::string& delim = " ")
   {
     std::ostringstream out;
+    out.precision(12);
     for (size_t i = 0; i < v.size(); i++)
     {
       out << v[i];
diff --git a/src/Bpp/Text/KeyvalTools.cpp b/src/Bpp/Text/KeyvalTools.cpp
index 1b8f78b..396db5e 100644
--- a/src/Bpp/Text/KeyvalTools.cpp
+++ b/src/Bpp/Text/KeyvalTools.cpp
@@ -89,6 +89,8 @@ void KeyvalTools::multipleKeyvals(const std::string& desc, std::map<std::string,
   for (vector<string>::iterator it = tokens.begin(); it != tokens.end(); it++)
   {
     singleKeyval(*it, key, val);
+    key=TextTools::removeSurroundingWhiteSpaces(key);
+    val=TextTools::removeSurroundingWhiteSpaces(val);
     keyvals[key] = val;
   }
 }
diff --git a/src/Bpp/Text/NestedStringTokenizer.cpp b/src/Bpp/Text/NestedStringTokenizer.cpp
index bff6bc6..b51b7e5 100644
--- a/src/Bpp/Text/NestedStringTokenizer.cpp
+++ b/src/Bpp/Text/NestedStringTokenizer.cpp
@@ -5,36 +5,36 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
 
-This software is a computer program whose purpose is to map data onto
-a sequence or a phylogenetic tree.
+  This software is a computer program whose purpose is to map data onto
+  a sequence or a phylogenetic tree.
 
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
 
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
 
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
 
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #include "NestedStringTokenizer.h"
@@ -49,29 +49,29 @@ using namespace std;
 
 NestedStringTokenizer::NestedStringTokenizer(const std::string& s, const std::string& open, const std::string& end, const std::string& delimiters, bool solid)
   throw (Exception):
-    StringTokenizer()
+  StringTokenizer()
 {
   int blocks = 0;
   string cache = "";
-	if (!solid)
+  if (!solid)
   {
     string::size_type index = s.find_first_not_of(delimiters, 0);
-		while (index != s.npos)
+    while (index != s.npos)
     {
       string::size_type newIndex = s.find_first_of(delimiters, index);
       bool endBlockFound = false;
       while (!endBlockFound)
       {
-			  if (newIndex != s.npos)
+        if (newIndex != s.npos)
         {
-			    string token = s.substr(index, newIndex - index);
+          string token = s.substr(index, newIndex - index);
           blocks += static_cast<int>(TextTools::count(token, open)) - static_cast<int>(TextTools::count(token, end));
         
-				  if (blocks == 0)
+          if (blocks == 0)
           {
             tokens_.push_back(cache + token);
             cache = ""; //reset cache.
-				    index = s.find_first_not_of(delimiters, newIndex);
+            index = s.find_first_not_of(delimiters, newIndex);
             endBlockFound = true;
           }
           else
@@ -81,42 +81,42 @@ NestedStringTokenizer::NestedStringTokenizer(const std::string& s, const std::st
             index = newIndex + 1;
             newIndex = s.find_first_of(delimiters, index);
           }
-			  }
+        }
         else
         {
-			    string token = s.substr(index);
+          string token = s.substr(index);
           blocks += static_cast<int>(TextTools::count(token, open)) - static_cast<int>(TextTools::count(token, end));
-			    if (blocks == 0)
+          if (blocks == 0)
           {
-				    tokens_.push_back(cache + token);
+            tokens_.push_back(cache + token);
             cache = ""; //reset cache.
-				    index = newIndex;
+            index = newIndex;
             endBlockFound = true;
           }
           else throw Exception("NestedStringTokenizer (constructor). Unclosed block.");
-			  }
+        }
       }
-		}
-	}
-	else
+    }
+  }
+  else
   {
     string::size_type index = 0;
-		while (index != s.npos)
+    while (index != s.npos)
     {
       string::size_type newIndex = s.find(delimiters, index);
       bool endBlockFound = false;
       while (!endBlockFound)
       {
-			  if (newIndex != s.npos)
+        if (newIndex != s.npos)
         {
-			    string token = s.substr(index, newIndex - index);
+          string token = s.substr(index, newIndex - index);
           blocks += static_cast<int>(TextTools::count(token, open)) - static_cast<int>(TextTools::count(token, end));
 				  
           if (blocks == 0)
           {
             tokens_.push_back(cache + token);
             cache = ""; //reset cache.
-				    index = newIndex + delimiters.size();
+            index = newIndex + delimiters.size();
             endBlockFound = true;
           }
           else
@@ -126,28 +126,28 @@ NestedStringTokenizer::NestedStringTokenizer(const std::string& s, const std::st
             index = newIndex + 1;
             newIndex = s.find(delimiters, index);
           }
-			  }
+        }
         else
         {
-  		    string token = s.substr(index);
+          string token = s.substr(index);
           blocks += static_cast<int>(TextTools::count(token, open)) - static_cast<int>(TextTools::count(token, end));
-	  	    if (blocks == 0)
+          if (blocks == 0)
           {
-				    tokens_.push_back(cache + token);
+            tokens_.push_back(cache + token);
             cache = ""; //reset cache.
-				    index = newIndex;
+            index = newIndex;
             endBlockFound = true;
           }
           else throw Exception("Unclosed block."); 
-			  }
-		  }
-	  }
+        }
+      }
+    }
   }
 }
 
 const std::string& NestedStringTokenizer::nextToken() throw (Exception)
 {
-	if (!hasMoreToken()) throw Exception("No more token in nested tokenizer.");
-	return tokens_[currentPosition_++];
+  if (!hasMoreToken()) throw Exception("No more token in nested tokenizer.");
+  return tokens_[currentPosition_++];
 }
 
diff --git a/src/Bpp/Text/NestedStringTokenizer.h b/src/Bpp/Text/NestedStringTokenizer.h
index 0a4dd36..9ba5f8b 100644
--- a/src/Bpp/Text/NestedStringTokenizer.h
+++ b/src/Bpp/Text/NestedStringTokenizer.h
@@ -5,36 +5,36 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
-
-This software is a computer program whose purpose is to map data onto
-a sequence or a phylogenetic tree.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+  This software is a computer program whose purpose is to map data onto
+  a sequence or a phylogenetic tree.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _NESTEDSTRINGTOKENIZER_H_
@@ -50,39 +50,39 @@ knowledge of the CeCILL license and that you accept its terms.
 namespace bpp
 {
 
-/**
- * @brief An improved tokenizer for strings.
- *
- * Splits a string according to a given (set of) delimiter(s).
- * Delimiters in certains blocks ({}, [], etc) are ignored.
- */
-class NestedStringTokenizer:
-  public StringTokenizer
-{
-	public:
+  /**
+   * @brief An improved tokenizer for strings.
+   *
+   * Splits a string according to a given (set of) delimiter(s).
+   * Delimiters in certains blocks ({}, [], etc) are ignored.
+   */
+  class NestedStringTokenizer:
+    public StringTokenizer
+  {
+  public:
 		
-		/**
-		 * @brief Build a new StringTokenizer from a string.
-		 *
-		 * @param s          The string to parse.
+    /**
+     * @brief Build a new StringTokenizer from a string.
+     *
+     * @param s          The string to parse.
      * @param open       Opening block.
      * @param end        Ending block.
-		 * @param delimiters Chars that must be considered as delimiters.
-		 * @param solid      If true, delimiters is considered as a single bloc delimiter.
-		 */
-		NestedStringTokenizer(const std::string& s, const std::string& open, const std::string& end, const std::string& delimiters = " \t\n\f\r", bool solid = false) throw (Exception);
+     * @param delimiters Chars that must be considered as delimiters.
+     * @param solid      If true, delimiters is considered as a single bloc delimiter.
+     */
+    NestedStringTokenizer(const std::string& s, const std::string& open, const std::string& end, const std::string& delimiters = " \t\n\f\r", bool solid = false) throw (Exception);
 		
-		virtual ~NestedStringTokenizer() {}
+    virtual ~NestedStringTokenizer() {}
 	
-	public:
+  public:
 		
-		/**
-		 * @brief Get the next available token.
-		 * If no token is availbale, throw an Exception.
-		 *
-		 * @return The next token if there is one.
-		 */
-		const std::string& nextToken() throw (Exception);
+    /**
+     * @brief Get the next available token.
+     * If no token is availbale, throw an Exception.
+     *
+     * @return The next token if there is one.
+     */
+    const std::string& nextToken() throw (Exception);
 
 
     /**
@@ -91,7 +91,7 @@ class NestedStringTokenizer:
      * @return An empty string.
      */
     std::string unparseRemainingTokens() const { return ""; }
-};
+  };
 
 } //end of namespace bpp;
 
diff --git a/src/Bpp/Text/StringTokenizer.cpp b/src/Bpp/Text/StringTokenizer.cpp
index 51389a9..ac2caa3 100644
--- a/src/Bpp/Text/StringTokenizer.cpp
+++ b/src/Bpp/Text/StringTokenizer.cpp
@@ -105,7 +105,7 @@ void StringTokenizer::removeEmptyTokens()
 {
   for (size_t i = tokens_.size(); i > currentPosition_; i--)
   {
-    if (tokens_[i-1] == "") tokens_.erase(tokens_.begin() + i - 1);
+    if (tokens_[i - 1] == "") tokens_.erase(tokens_.begin() + static_cast<ptrdiff_t>(i - 1));
   }
 }
 
diff --git a/src/Bpp/Text/StringTokenizer.h b/src/Bpp/Text/StringTokenizer.h
index 3e96097..a7061e0 100644
--- a/src/Bpp/Text/StringTokenizer.h
+++ b/src/Bpp/Text/StringTokenizer.h
@@ -6,36 +6,36 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide utilitary
-classes. This file belongs to the Bio++ Project.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
+  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+  This software is a computer program whose purpose is to provide utilitary
+  classes. This file belongs to the Bio++ Project.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
 */
 
 #ifndef _STRINGTOKENIZER_H_
@@ -55,75 +55,75 @@ namespace bpp
  *
  * Splits a string according to a given (set of) delimiter(s).
  */
-class StringTokenizer
-{
-	protected:
+  class StringTokenizer
+  {
+  protected:
 
-		/** @brief Where the tokens are stored. */
+    /** @brief Where the tokens are stored. */
     std::deque<std::string> tokens_;
     std::deque<std::string> splits_;
 		
-		/** @brief the current position in the token list. */
-		size_t currentPosition_;
+    /** @brief the current position in the token list. */
+    size_t currentPosition_;
 
-	public:
+  public:
 		
-		/**
-		 * @brief Build a new StringTokenizer from a string.
-		 *
-		 * @param s                The string to parse.
-		 * @param delimiters       Chars that must be considered as delimiters.
-		 * @param solid            If true, delimiters is considered as a single bloc delimiter.
+    /**
+     * @brief Build a new StringTokenizer from a string.
+     *
+     * @param s                The string to parse.
+     * @param delimiters       Chars that must be considered as delimiters.
+     * @param solid            If true, delimiters is considered as a single bloc delimiter.
      * @param allowEmptyTokens Tell if empty tokens are allowed or should be ignored.
-		 */
-		StringTokenizer(const std::string& s, const std::string& delimiters = " \t\n\f\r", bool solid = false, bool allowEmptyTokens = false);
+     */
+    StringTokenizer(const std::string& s, const std::string& delimiters = " \t\n\f\r", bool solid = false, bool allowEmptyTokens = false);
 	
-		virtual ~StringTokenizer() {}
+    virtual ~StringTokenizer() {}
 
   public:
     StringTokenizer(): tokens_(), splits_(), currentPosition_(0) {}
 	
-	public:
+  public:
 		
-		/**
-		 * @brief Get the next available token.
-		 * If no token is availbale, throw an Exception.
-		 *
-		 * @return The next token if there is one.
-		 */
+    /**
+     * @brief Get the next available token.
+     * If no token is availbale, throw an Exception.
+     *
+     * @return The next token if there is one.
+     */
     const std::string& nextToken() throw (Exception);
 	
-		/**
-		 * @brief Tell if some tokens are still available.
-		 * @return True if some tokens are still available.
-		 */
-		bool hasMoreToken() const {
+    /**
+     * @brief Tell if some tokens are still available.
+     * @return True if some tokens are still available.
+     */
+    bool hasMoreToken() const {
       return currentPosition_ < tokens_.size();
     }
 	
-		/**
-		 * @brief Tell how many tokens are available.
-		 *
-		 * @return the number of tokens available.
-		 */
-		size_t numberOfRemainingTokens() const { return tokens_.size() - currentPosition_; }
-
-		/**
-		 * @brief Get a particular token.
-		 *
-		 * Do not move the iterator.
-		 *
-		 * @param pos The index of the token.
-		 * @return the token at position 'pos'.
-		 */
+    /**
+     * @brief Tell how many tokens are available.
+     *
+     * @return the number of tokens available.
+     */
+    size_t numberOfRemainingTokens() const { return tokens_.size() - currentPosition_; }
+
+    /**
+     * @brief Get a particular token.
+     *
+     * Do not move the iterator.
+     *
+     * @param pos The index of the token.
+     * @return the token at position 'pos'.
+     */
     const std::string& getToken(size_t pos) const { return tokens_[pos]; }
 
-		/**
-		 * @brief Retrieve all tokens.
-		 *
-		 * @return A reference toward the vector of tokens.
-		 */
-		const std::deque<std::string>& getTokens() const { return tokens_; }
+    /**
+     * @brief Retrieve all tokens.
+     *
+     * @return A reference toward the vector of tokens.
+     */
+    const std::deque<std::string>& getTokens() const { return tokens_; }
 
     /**
      * @brief remove all empty token from the current position.
@@ -134,7 +134,7 @@ class StringTokenizer
      * @return The remaining tokens as if the original corresponding string was not parsed.
      */
     std::string unparseRemainingTokens() const;
-};
+  };
 
 } //end of namespace bpp.
 
diff --git a/src/Bpp/Text/TextTools.cpp b/src/Bpp/Text/TextTools.cpp
index f187f7e..b531b8a 100644
--- a/src/Bpp/Text/TextTools.cpp
+++ b/src/Bpp/Text/TextTools.cpp
@@ -215,6 +215,9 @@ bool TextTools::isDecimalNumber(char c)
 
 bool TextTools::isDecimalNumber(const std::string& s, char dec, char scientificNotation)
 {
+  if (isEmpty(s))
+    return false;
+              
   size_t sepCount = 0;
   size_t sciCount = 0;
   size_t i = 0;
@@ -228,7 +231,7 @@ bool TextTools::isDecimalNumber(const std::string& s, char dec, char scientificN
       sciCount++;
       if (i == s.size() - 1) return false; //Must be sthg after scientific notation.
       c = s[i + 1];
-      if (c == '-') i++;
+      if (c == '-' || c == '+') i++;
       if (i == s.size() - 1) return false; //Must be sthg after scientific notation.
       if (sepCount == 0) sepCount = 1; //We do not want any dec in the exponent.
     } else if (!isDecimalNumber(c))
@@ -243,6 +246,9 @@ bool TextTools::isDecimalNumber(const std::string& s, char dec, char scientificN
 
 bool TextTools::isDecimalInteger(const std::string& s, char scientificNotation)
 {
+  if (isEmpty(s))
+    return false;
+              
   size_t sciCount = 0;
   size_t i = 0;
   if (s[0] == '-') i = 1;
@@ -254,6 +260,8 @@ bool TextTools::isDecimalInteger(const std::string& s, char scientificNotation)
       if (i == s.size() - 1) return false; //Must be sthg after scientific notation.
       c = s[i + 1];
       if (c == '-') return false; //Not an integer then!
+      if (c == '+') i++;
+      if (i == s.size() - 1) return false; //Must be sthg after scientific notation.
     } else if (!isDecimalNumber(c))
       return false;
     if (sciCount > 1)
@@ -291,9 +299,9 @@ std::string TextTools::toString(double d, int precision)
 
 /******************************************************************************/
 
-int TextTools::toInt(const std::string& s) throw (Exception)
+int TextTools::toInt(const std::string& s, char scientificNotation) throw (Exception)
 {
-  if (!isDecimalInteger(s)) throw Exception("TextTools::toInt(). Invalid number specification: " + s);
+  if (!isDecimalInteger(s, scientificNotation)) throw Exception("TextTools::toInt(). Invalid number specification: " + s);
   istringstream iss(s);
   int i;
   iss >> i;
@@ -302,9 +310,9 @@ int TextTools::toInt(const std::string& s) throw (Exception)
 
 /******************************************************************************/
 
-double TextTools::toDouble(const std::string& s) throw (Exception)
+double TextTools::toDouble(const std::string& s, char dec, char scientificNotation) throw (Exception)
 {
-  if (!isDecimalNumber(s)) throw Exception("TextTools::toDouble(). Invalid number specification: " + s);
+  if (!isDecimalNumber(s, dec, scientificNotation)) throw Exception("TextTools::toDouble(). Invalid number specification: " + s);
   istringstream iss(s);
   double d;
   iss >> d;
@@ -353,8 +361,8 @@ throw (Exception)
 {
   string t = "";
   int blockCount = 0;
-  int begPos = 0;
-  for (unsigned int i = 0; i < s.size(); i++)
+  size_t begPos = 0;
+  for (size_t i = 0; i < s.size(); i++)
   {
     char current = s[i];
     if (current == blockBeginning)
@@ -512,12 +520,11 @@ void TextTools::replaceAll(std::string& target, const std::string& query, const
 {
   if (query.empty())
     return;
-  size_t pos = 0;
+  size_t pos = target.find(query);
   while (pos != string::npos) {
-    pos = target.find(query, pos);
     target.replace(pos, query.length(), replacement);
-    pos += replacement.length(); //We prevent recursivity!
-  
+    pos += replacement.length(); //We prevent recursivity! 
+    pos = target.find(query, pos);
   }
 }
 
diff --git a/src/Bpp/Text/TextTools.h b/src/Bpp/Text/TextTools.h
index 423d8fd..9ce50d8 100644
--- a/src/Bpp/Text/TextTools.h
+++ b/src/Bpp/Text/TextTools.h
@@ -251,19 +251,22 @@ namespace bpp
        * @brief Convert from string to int.
        *
        * @param s The string to parse.
+       * @param scientificNotation character to use for scientific notation (typically 'e' or 'E').
        * @return The integer corresponding to s.
        * @throw Exception if the string does not specify a valid number.
        */
-      static int toInt(const std::string& s) throw (Exception);
+      static int toInt(const std::string& s, char scientificNotation = 'e') throw (Exception);
 
       /**
        * @brief Convert from string to double.
        *
        * @param s The string to parse.
+       * @param dec The decimal separator.
+       * @param scientificNotation character to use for scientific notation (typically 'e' or 'E').
        * @return The double corresponding to s.
        * @throw Exception if the string does not specify a valid number.
        */
-      static double toDouble(const std::string& s) throw (Exception);
+      static double toDouble(const std::string& s, char dec = '.', char scientificNotation = 'e') throw (Exception);
 
       /**
        * @brief Template to string conversion.
diff --git a/src/Bpp/Utils/AttributesTools.cpp b/src/Bpp/Utils/AttributesTools.cpp
index d2cd916..11e8915 100644
--- a/src/Bpp/Utils/AttributesTools.cpp
+++ b/src/Bpp/Utils/AttributesTools.cpp
@@ -5,43 +5,44 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide basal and 
-utilitary classes. This file belongs to the Bio++ Project.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide basal and
+   utilitary classes. This file belongs to the Bio++ Project.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 // From the STL:
 #include <cstdlib>
 #include <string>
 #include <iostream>
 #include <fstream>
+#include <algorithm>
 
 using namespace std;
 
@@ -54,19 +55,23 @@ using namespace bpp;
 
 /******************************************************************************/
 
-std::vector<std::string> AttributesTools::getVector( int argc, char * argv[])
+std::vector<std::string> AttributesTools::getVector(int argc, char* argv[])
 {
-  vector<string> result(argc);
-  for(int i = 1; i < argc; i++) result[i] = string(argv[i]);
-  //Ignore first argc which is the program name!    
+  size_t n = static_cast<size_t>(argc);
+  vector<string> result(n);
+  for (size_t i = 1; i < n; ++i)
+  {
+    result[i] = string(argv[i]);
+  }
+  // Ignore first argc which is the program name!
   return result;
 }
 
 /******************************************************************************/
 
 std::map<std::string, std::string> AttributesTools::getAttributesMap(
-  const std::vector<std::string> & argv,
-  const std::string & delimiter)
+  const std::vector<std::string>& argv,
+  const std::string& delimiter)
 {
   map<string, string> am;
   getAttributesMap(argv, am, delimiter);
@@ -76,49 +81,51 @@ std::map<std::string, std::string> AttributesTools::getAttributesMap(
 /******************************************************************************/
 
 void AttributesTools::getAttributesMap(
-  const std::vector<std::string> & argv,
-  std::map<std::string, std::string> & am,
-  const std::string & delimiter)
+  const std::vector<std::string>& argv,
+  std::map<std::string, std::string>& am,
+  const std::string& delimiter)
 {
   vector<string> argv2(argv.size());
-  //First make a few cleaning:
-  for(unsigned int i = 0; i < argv.size(); i++)
+  // First make a few cleaning:
+  for (size_t i = 0; i < argv.size(); i++)
   {
-    //Make a few corrections first:
-    string arg = removeComments(argv[i], string("#"), string("\n"));//remove shell comments.
-    arg = removeComments(arg, string("//"), string("\n"));//remove C simple comments.
-    arg = removeComments(arg, string("/*"), string("*/"));//remove C multiple comments.
+    // Make a few corrections first:
+    string arg = removeComments(argv[i], string("#"), string("\n")); // remove shell comments.
+    arg = removeComments(arg, string("//"), string("\n")); // remove C simple comments.
+    arg = removeComments(arg, string("/*"), string("*/")); // remove C multiple comments.
     arg = TextTools::removeWhiteSpaces(arg);
     argv2[i] = arg;
   }
-  //Now parse arguments:
-  for(unsigned int i = 0; i < argv.size(); i++)
+  // Now parse arguments:
+  for (size_t i = 0; i < argv.size(); i++)
   {
     string arg = argv2[i];
-    if(arg == "") continue; //Skipping void line.
-    while(arg[arg.size()-1] == '\\')
+    if (arg == "")
+      continue;  // Skipping void line.
+    while (arg[arg.size() - 1] == '\\')
     {
-      //Splitted line
+      // Splitted line
       i++;
-      arg = arg.substr(0, arg.length()-1) + argv2[i];
+      arg = arg.substr(0, arg.length() - 1) + argv2[i];
     }
-    //Parsing:
+    // Parsing:
     string::size_type limit = arg.find(delimiter, 0);
-    if(limit == string::npos)
+    if (limit == string::npos)
     {
-      //Invalid parameter
+      // Invalid parameter
       (*ApplicationTools::warning << "WARNING!!! Parameter '" << arg << "' has been ignored.").endLine();
     }
     else
     {
-      string name  = string(arg.begin(), arg.begin() + limit);
-      string value = string(arg.begin() + limit + delimiter.size(), arg.end());
-      if(name == "param")
-      {
-        //Recursive inclusion:
-        getAttributesMapFromFile(value, am, delimiter);
-      }
-      else am[name] = value;
+      string name  = string(arg.begin(), arg.begin() + static_cast<ptrdiff_t>(limit));
+      string value = string(arg.begin() + static_cast<ptrdiff_t>(limit + delimiter.size()), arg.end());
+      // if ((name == "param") || (name == "params"))
+      // {
+      //   //Recursive inclusion:
+      //   getAttributesMapFromFile(value, am, delimiter);
+      // }
+      // else
+      am[name] = value;
     }
   }
 }
@@ -126,9 +133,9 @@ void AttributesTools::getAttributesMap(
 /******************************************************************************/
 
 void AttributesTools::getAttributesMapFromFile(
-  const std::string & file,
-  std::map<std::string, std::string> & params,
-  const std::string & delimiter)
+  const std::string& file,
+  std::map<std::string, std::string>& params,
+  const std::string& delimiter)
 {
   cout << "Parsing file " << file << " for options." << endl;
   ifstream input(file.c_str(), ios::in);
@@ -139,8 +146,8 @@ void AttributesTools::getAttributesMapFromFile(
 /******************************************************************************/
 
 std::map<std::string, std::string> AttributesTools::getAttributesMapFromFile(
-  const std::string & file,
-  const std::string & delimiter)
+  const std::string& file,
+  const std::string& delimiter)
 {
   map<string, string> params;
   getAttributesMapFromFile(file, params, delimiter);
@@ -150,25 +157,26 @@ std::map<std::string, std::string> AttributesTools::getAttributesMapFromFile(
 /******************************************************************************/
 
 void AttributesTools::actualizeAttributesMap(
-  std::map<std::string, std::string> & attMap,
-  const std::map<std::string, std::string> & atts)
+  std::map<std::string, std::string>& attMap,
+  const std::map<std::string, std::string>& atts)
 {
-  for(map<string, string>::const_iterator i = atts.begin(); i != atts.end(); i++)
+  for (map<string, string>::const_iterator i = atts.begin(); i != atts.end(); i++)
   {
-    attMap[i->first] = i->second;
+    if ((i->first != "param") && (i->first != "params"))
+      attMap[i->first] = i->second;
   }
 }
 
 /******************************************************************************/
 
 void AttributesTools::resolveVariables(
-  std::map<std::string, std::string> & am,
+  std::map<std::string, std::string>& am,
   char varCode,
   char varBeg,
   char varEnd)
 throw (Exception)
 {
-  //Now resolve any variable:
+  // Now resolve any variable:
   for (map<string, string>::iterator it = am.begin(); it != am.end(); it++)
   {
     string value = it->second;
@@ -181,7 +189,7 @@ throw (Exception)
         string varName  = value.substr(index1 + 2, index2 - index1 - 2);
         map<string, string>::iterator varIt = am.find(varName);
         string varValue = "";
-	if (varIt == am.end())
+        if (varIt == am.end())
         {
           if (ApplicationTools::error)
             (*ApplicationTools::error << "Variable '" << varName << "' is undefined and was ignored.").endLine();
@@ -190,7 +198,7 @@ throw (Exception)
         {
           varValue = varIt->second;
         }
-        //Modify original field:
+        // Modify original field:
         string newValue = value.substr(0, index1) + varValue + value.substr(index2 + 1);
         it->second = newValue;
       }
@@ -205,33 +213,35 @@ throw (Exception)
 /******************************************************************************/
 
 std::string AttributesTools::removeComments(
-  const std::string & s,
-  const std::string & begin,
-  const std::string & end)
+  const std::string& s,
+  const std::string& begin,
+  const std::string& end)
 {
   string r = s;
   string::size_type last = 0;
   do
   {
     string::size_type first = r.find(begin, last);
-    if(first == string::npos) return r; //No shell comment.
-    //else:  
+    if (first == string::npos)
+      return r;  // No shell comment.
+    // else:
     last = r.find(end, first);
-    if(last == string::npos)
+    if (last == string::npos)
     {
-      r.erase(r.begin() + first, r.end());
+      r.erase(r.begin() + static_cast<ptrdiff_t>(first), r.end());
     }
     else
     {
-      r.erase(r.begin() + first, r.begin() + last);
+      r.erase(r.begin() + static_cast<ptrdiff_t>(first), r.begin() + static_cast<ptrdiff_t>(last));
     }
-  } while(last != string::npos);
+  }
+  while (last != string::npos);
   return r;
 }
 
 /******************************************************************************/
 
-std::map<std::string, std::string> AttributesTools::parseOptions(int args, char ** argv) throw (Exception)
+std::map<std::string, std::string> AttributesTools::parseOptions(int args, char** argv) throw (Exception)
 {
   // Get the parameters from command line:
   map<string, string> cmdParams = AttributesTools::getAttributesMap(
@@ -239,10 +249,12 @@ std::map<std::string, std::string> AttributesTools::parseOptions(int args, char
 
   // Look for a specified file with parameters:
   map<string, string> params;
-  if(cmdParams.find("param") != cmdParams.end())
+  std::map<std::string, std::string>::iterator it;
+
+  if (cmdParams.find("param") != cmdParams.end())
   {
     string file = cmdParams["param"];
-    if(!FileTools::fileExists(file))
+    if (!FileTools::fileExists(file))
     {
       throw Exception("AttributesTools::parseOptions(). Parameter file not found.");
     }
@@ -259,8 +271,47 @@ std::map<std::string, std::string> AttributesTools::parseOptions(int args, char
   }
   // Resolve variables:
   resolveVariables(params);
+
+  std::vector<string> mapfile;
+  std::vector<string>::iterator imapfile;
+  string file;
+
+  while (true)
+  {
+    it = params.find("param");
+    if (it != params.end())
+    {
+      file = it->second;
+      if (std::find(mapfile.begin(), mapfile.end(), file) == mapfile.end())
+      {
+        params.erase(it);
+        mapfile.push_back(file);
+        getAttributesMapFromFile(file, params, "=");
+        resolveVariables(params);
+        continue;
+      }
+      else
+        throw Exception("parsing error : Already used file " + file);
+    }
+    it = params.find("params");
+    if (it != params.end())
+    {
+      file = it->second;
+      if (find(mapfile.begin(), mapfile.end(), file) == mapfile.end())
+      {
+        params.erase(it);
+        mapfile.push_back(file);
+        getAttributesMapFromFile(file, params, "=");
+        resolveVariables(params);
+        continue;
+      }
+      else
+        throw Exception("parsing error : Already used file " + file);
+    }
+    break;
+  }
+
   return params;
 }
 
 /******************************************************************************/
-
diff --git a/src/Bpp/Utils/AttributesTools.h b/src/Bpp/Utils/AttributesTools.h
index e83390a..a73c0b4 100644
--- a/src/Bpp/Utils/AttributesTools.h
+++ b/src/Bpp/Utils/AttributesTools.h
@@ -5,37 +5,37 @@
 //
 
 /*
-Copyright or © or Copr. Bio++ Development Tools, (November 17, 2004)
-
-This software is a computer program whose purpose is to provide basal and 
-utilitary classes. This file belongs to the Bio++ Project.
-
-This software is governed by the CeCILL  license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
-modify and/ or redistribute the software under the terms of the CeCILL
-license as circulated by CEA, CNRS and INRIA at the following URL
-"http://www.cecill.info". 
-
-As a counterpart to the access to the source code and  rights to copy,
-modify and redistribute granted by the license, users are provided only
-with a limited warranty  and the software's author,  the holder of the
-economic rights,  and the successive licensors  have only  limited
-liability. 
-
-In this respect, the user's attention is drawn to the risks associated
-with loading,  using,  modifying and/or developing or reproducing the
-software by the user in light of its specific status of free software,
-that may mean  that it is complicated to manipulate,  and  that  also
-therefore means  that it is reserved for developers  and  experienced
-professionals having in-depth computer knowledge. Users are therefore
-encouraged to load and test the software's suitability as regards their
-requirements in conditions enabling the security of their systems and/or 
-data to be ensured and,  more generally, to use and operate it in the 
-same conditions as regards security. 
-
-The fact that you are presently reading this means that you have had
-knowledge of the CeCILL license and that you accept its terms.
-*/
+   Copyright or © or Copr. Bio++ Development Tools, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide basal and
+   utilitary classes. This file belongs to the Bio++ Project.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
 
 #ifndef _ATTRIBUTES_TOOLS_H_
 #define _ATTRIBUTES_TOOLS_H_
@@ -48,9 +48,8 @@ knowledge of the CeCILL license and that you accept its terms.
 #include <string>
 #include <vector>
 
-namespace bpp 
+namespace bpp
 {
-
 /**
  * @brief Some functions to deal with attributes, i.e. parameters passed to a program/method.
  *
@@ -72,7 +71,7 @@ namespace bpp
  * @code
  * optionfile=/home/foo/bar.txt
  * @endcode
- * 
+ *
  * Attributes are stored as a map<string, string>, with attributes names as keys,
  * and arguments as values.
  *
@@ -104,10 +103,10 @@ namespace bpp
  * @endcode
  * These pieces of code does the following:
  * - get all parameters from the command line and store them in a map,
- * - check if some parameter is called 'param'. If so, look for the file 
+ * - check if some parameter is called 'param' or 'params'. If so, look for the file
  *   given as value and try to read some parameters from it.
  * - If an parameter file was found, update the parameter in it with those from
- *   the command line. This implies that when a parameter is found in bothe the
+ *   the command line. This implies that when a parameter is found in both the
  *   command line and the option file, the value from the command line will be
  *   retained.
  *
@@ -127,125 +126,120 @@ namespace bpp
  */
 class AttributesTools
 {
-  
-  public:
-    
-    AttributesTools() {}
-    virtual ~AttributesTools() {}
-    
-    /**
-     * @brief Get attributes a vector of strings from command line arguments.
-     *
-     * @param argc The number of arguments.
-     * @param argv The array with all arguments.
-     * @return A vector with all arguments as strings.
-     */
-    static std::vector<std::string> getVector(int argc, char * argv[]);
-  
-    /**
-     * @brief Get an attribute map from a vector of arguments.
-     *
-     * This method also resolve all variable calls.
-     *
-     * @param argv      The vector of arguments.
-     * @param delimiter The string that separates attribute names from arguments (for instance '=').
-     * @return          The attribute map.
-     */
-    static std::map<std::string, std::string> getAttributesMap(
-      const std::vector<std::string> & argv,
-      const std::string & delimiter = "=");
-
-    /**
-     * @brief Get an attribute map from a vector of arguments.
-     *
-     * This method also resolve all variable calls.
-     *
-     * @param argv      The vector of arguments.
-     * @param am        The attribute map to fill.
-     * @param delimiter The string that separates attribute names from arguments (for instance '=').
-     */
-    static void getAttributesMap(
-      const std::vector<std::string> & argv,
-      std::map<std::string, std::string> & am,
-      const std::string & delimiter = "=");
-
-    /**
-     * @brief Get an attribute map from a file.
-     *
-     * @param file      The file with all arguments.
-     * @param delimiter The string that separates attribute names from arguments (for instance '=').
-     * @return An attribute map.
-     */
-    static std::map<std::string, std::string> getAttributesMapFromFile(
-      const std::string & file,
-      const std::string & delimiter);
-    
-    /**
-     * @brief Get an attribute map from a file.
-     *
-     * @param file      The file with all arguments.
-     * @param params    An attribute map to fill.
-     * @param delimiter The string that separates attribute names from arguments (for instance '=').
-     */
-    static void getAttributesMapFromFile(
-      const std::string & file,
-      std::map<std::string, std::string> & params,
-      const std::string & delimiter);
-  
-    /**
-     * @brief Actualizes an attribute map with another.
-     *
-     * All fields in map 2 will be added to map 1.
-     * If two attributes have the same name, then map 1 value will be overwritten.
-     *
-     * @param attMap The attributes map.
-     * @param atts   The attributes to add to the map.
-     */
-    static void actualizeAttributesMap(
-      std::map<std::string, std::string> & attMap,
-      const std::map<std::string, std::string> & atts);
-    
-    /**
-     * @brief Resolve the variables.
-     *
-     * If used prior to the actualizeAttributesMap, this function will make the
-     * variables 'local', whereas using them after will make them 'global'.
-     *
-     * @param am The attributes map.
-     * @param varCode   The code that defines variable recalls.
-     * @param varBeg    Variables begin name code.
-     * @param varEnd    Variables end name code.
-     * @throw Exception If there is a syntax error.
-     */
-    static void resolveVariables(std::map<std::string, std::string> & am,
-      char varCode = '$',
-      char varBeg = '(',
-      char varEnd = ')') throw (Exception);
-
-    /**
-     * @brief Global function that reads all parameters from command line and files,
-     * and set the values in a map.
-     *
-     * @param args Number of arguments, as passed to the main function.
-     * @param argv Array of values, as passed to the main function.
-     * @return An attributes map.
-     * @throw Exception in case an option file is not found.
-     */
-    static std::map<std::string, std::string> parseOptions(int args, char ** argv) throw (Exception);
-
-  private:
-    
-    /**
-     * @brief Remove comments from a string.
-     *
-     * @param s     The string to parse.
-     * @param begin Comments front delimiter.
-     * @param end   Comments end delimiter.
-     */
-    static std::string removeComments(const std::string & s, const std::string & begin, const std::string & end);
+public:
+  AttributesTools() {}
+  virtual ~AttributesTools() {}
+
+  /**
+   * @brief Get attributes a vector of strings from command line arguments.
+   *
+   * @param argc The number of arguments.
+   * @param argv The array with all arguments.
+   * @return A vector with all arguments as strings.
+   */
+  static std::vector<std::string> getVector(int argc, char* argv[]);
+
+  /**
+   * @brief Get an attribute map from a vector of arguments.
+   *
+   * This method also resolve all variable calls.
+   *
+   * @param argv      The vector of arguments.
+   * @param delimiter The string that separates attribute names from arguments (for instance '=').
+   * @return          The attribute map.
+   */
+  static std::map<std::string, std::string> getAttributesMap(
+    const std::vector<std::string>& argv,
+    const std::string& delimiter = "=");
+
+  /**
+   * @brief Get an attribute map from a vector of arguments.
+   *
+   * This method also resolve all variable calls.
+   *
+   * @param argv      The vector of arguments.
+   * @param am        The attribute map to fill.
+   * @param delimiter The string that separates attribute names from arguments (for instance '=').
+   */
+  static void getAttributesMap(
+    const std::vector<std::string>& argv,
+    std::map<std::string, std::string>& am,
+    const std::string& delimiter = "=");
+
+  /**
+   * @brief Get an attribute map from a file.
+   *
+   * @param file      The file with all arguments.
+   * @param delimiter The string that separates attribute names from arguments (for instance '=').
+   * @return An attribute map.
+   */
+  static std::map<std::string, std::string> getAttributesMapFromFile(
+    const std::string& file,
+    const std::string& delimiter);
+
+  /**
+   * @brief Get an attribute map from a file.
+   *
+   * @param file      The file with all arguments.
+   * @param params    An attribute map to fill.
+   * @param delimiter The string that separates attribute names from arguments (for instance '=').
+   */
+  static void getAttributesMapFromFile(
+    const std::string& file,
+    std::map<std::string, std::string>& params,
+    const std::string& delimiter);
+
+  /**
+   * @brief Actualizes an attribute map with another.
+   *
+   * All fields in map 2 will be added to map 1.
+   * If two attributes have the same name, then map 1 value will be overwritten.
+   *
+   * @param attMap The attributes map.
+   * @param atts   The attributes to add to the map.
+   */
+  static void actualizeAttributesMap(
+    std::map<std::string, std::string>& attMap,
+    const std::map<std::string, std::string>& atts);
+
+  /**
+   * @brief Resolve the variables.
+   *
+   * If used prior to the actualizeAttributesMap, this function will make the
+   * variables 'local', whereas using them after will make them 'global'.
+   *
+   * @param am The attributes map.
+   * @param varCode   The code that defines variable recalls.
+   * @param varBeg    Variables begin name code.
+   * @param varEnd    Variables end name code.
+   * @throw Exception If there is a syntax error.
+   */
+  static void resolveVariables(std::map<std::string, std::string>& am,
+                               char varCode = '$',
+                               char varBeg = '(',
+                               char varEnd = ')') throw (Exception);
+
+  /**
+   * @brief Global function that reads all parameters from command line and files,
+   * and set the values in a map.
+   *
+   * @param args Number of arguments, as passed to the main function.
+   * @param argv Array of values, as passed to the main function.
+   * @return An attributes map.
+   * @throw Exception in case an option file is not found.
+   */
+  static std::map<std::string, std::string> parseOptions(int args, char** argv) throw (Exception);
+
+private:
+  /**
+   * @brief Remove comments from a string.
+   *
+   * @param s     The string to parse.
+   * @param begin Comments front delimiter.
+   * @param end   Comments end delimiter.
+   */
+  static std::string removeComments(const std::string& s, const std::string& begin, const std::string& end);
 };
-
-} //end of namespace bpp.
+} // end of namespace bpp.
 
 #endif // _ATTRIBUTES_TOOLS_H_
-
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f3006b1..7ae06c6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -66,6 +66,10 @@ SET(CPP_FILES
   Bpp/Numeric/Function/SimpleNewtonMultiDimensions.cpp
   Bpp/Numeric/Function/ThreePointsNumericalDerivative.cpp
   Bpp/Numeric/Function/TwoPointsNumericalDerivative.cpp
+  Bpp/Numeric/Hmm/HmmLikelihood.cpp
+  Bpp/Numeric/Hmm/AbstractHmmTransitionMatrix.cpp
+  Bpp/Numeric/Hmm/FullHmmTransitionMatrix.cpp
+  Bpp/Numeric/Hmm/AutoCorrelationTransitionMatrix.cpp
   Bpp/Numeric/Hmm/LogsumHmmLikelihood.cpp
   Bpp/Numeric/Hmm/LowMemoryRescaledHmmLikelihood.cpp
   Bpp/Numeric/Hmm/RescaledHmmLikelihood.cpp
@@ -135,6 +139,7 @@ SET(H_FILES
   Bpp/Numeric/Parameter.h
   Bpp/Numeric/ParameterList.h
   Bpp/Numeric/Parametrizable.h
+  Bpp/Numeric/ParametrizableCollection.cpp
   Bpp/Numeric/TransformedParameter.h
   Bpp/Numeric/Random/RandomFactory.h
   Bpp/Numeric/Random/RandomTools.h
@@ -189,6 +194,9 @@ SET(H_FILES
   Bpp/Numeric/Hmm/HmmLikelihood.h
   Bpp/Numeric/Hmm/HmmStateAlphabet.h
   Bpp/Numeric/Hmm/HmmTransitionMatrix.h
+  Bpp/Numeric/Hmm/AbstractHmmTransitionMatrix.h
+  Bpp/Numeric/Hmm/FullHmmTransitionMatrix.h
+  Bpp/Numeric/Hmm/AutoCorrelationTransitionMatrix.h
   Bpp/Numeric/Hmm/LogsumHmmLikelihood.h
   Bpp/Numeric/Hmm/LowMemoryRescaledHmmLikelihood.h
   Bpp/Numeric/Hmm/RescaledHmmLikelihood.h
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index af83f96..40a3b87 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -40,6 +40,10 @@ ADD_EXECUTABLE(test_derivative1 test_derivative1.cpp)
 TARGET_LINK_LIBRARIES(test_derivative1 ${LIBS})
 ADD_TEST(test_derivative1 "test_derivative1")
 
+ADD_EXECUTABLE(test_reparametrization test_reparametrization.cpp)
+TARGET_LINK_LIBRARIES(test_reparametrization ${LIBS})
+ADD_TEST(test_reparametrization "test_reparametrization")
+
 ADD_EXECUTABLE(test_downhill test_downhill.cpp)
 TARGET_LINK_LIBRARIES(test_downhill ${LIBS})
 ADD_TEST(test_downhill "test_downhill")
@@ -60,6 +64,10 @@ ADD_EXECUTABLE(test_distributions test_distributions.cpp)
 TARGET_LINK_LIBRARIES(test_distributions ${LIBS})
 ADD_TEST(test_distributions "test_distributions")
 
+ADD_EXECUTABLE(test_simplex test_simplex.cpp)
+TARGET_LINK_LIBRARIES(test_simplex ${LIBS})
+ADD_TEST(test_simplex "test_simplex")
+
 ADD_EXECUTABLE(test_stats test_stats.cpp)
 TARGET_LINK_LIBRARIES(test_stats ${LIBS})
 ADD_TEST(test_stats "test_stats")
@@ -81,11 +89,11 @@ TARGET_LINK_LIBRARIES(test_text_tools ${LIBS})
 ADD_TEST(test_text_tools "test_text_tools")
 
 IF(UNIX)
-  SET_PROPERTY(TEST test_numconstants test_eigen test_matrices test_derivative1 test_downhill test_powell test_gradient test_bfgs test_distributions test_stats test_mva test_sample test_range test_text_tools PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:../src")
+  SET_PROPERTY(TEST test_numconstants test_eigen test_matrices test_derivative1 test_reparametrization test_downhill test_powell test_gradient test_bfgs test_distributions test_stats test_mva test_sample test_range test_text_tools test_simplex PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:../src")
 ENDIF()
 
 IF(APPLE)
-  SET_PROPERTY(TEST test_numconstants test_eigen test_matrices test_derivative1 test_downhill test_powell test_gradient test_bfgs test_distributions test_stats test_mva test_sample test_range test_text_tools PROPERTY ENVIRONMENT "DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}:../src")
+  SET_PROPERTY(TEST test_numconstants test_eigen test_matrices test_derivative1 test_reparametrization test_downhill test_powell test_gradient test_bfgs test_distributions test_stats test_mva test_sample test_range test_text_tools test_simplex PROPERTY ENVIRONMENT "DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}:../src")
 ENDIF()
 
 IF(WIN32)
diff --git a/test/test_derivative1.cpp b/test/test_derivative1.cpp
index 77cb089..e2e7fb1 100644
--- a/test/test_derivative1.cpp
+++ b/test/test_derivative1.cpp
@@ -57,33 +57,33 @@ int main() {
   FivePointsNumericalDerivative nd5pt(&f) ; nd5pt.setParametersToDerivate(pl.getParameterNames());
   
   for (unsigned int repeat = 0; repeat < 10000; ++repeat) {
-    for (unsigned int i = 0; i < pl.size(); ++i) {
+    for (size_t i = 0; i < pl.size(); ++i) {
       double val = RandomTools::giveRandomNumberBetweenZeroAndEntry(100) - 50;
       pl[i].setValue(val);
     }
 
     nd2pt.setParameters(pl);
     vector<double> derivativesNum2pt(pl.size());
-    for (unsigned int i = 0; i < pl.size(); ++i) {
+    for (size_t i = 0; i < pl.size(); ++i) {
       derivativesNum2pt[i] = nd2pt.getFirstOrderDerivative(pl.getParameterNames()[i]);
     }
 
     nd3pt.setParameters(pl);
     vector<double> derivativesNum3pt(pl.size());
-    for (unsigned int i = 0; i < pl.size(); ++i) {
+    for (size_t i = 0; i < pl.size(); ++i) {
       derivativesNum3pt[i] = nd3pt.getFirstOrderDerivative(pl.getParameterNames()[i]);
     }
 
     nd5pt.setParameters(pl);
     vector<double> derivativesNum5pt(pl.size());
-    for (unsigned int i = 0; i < pl.size(); ++i) {
+    for (size_t i = 0; i < pl.size(); ++i) {
       derivativesNum5pt[i] = nd5pt.getFirstOrderDerivative(pl.getParameterNames()[i]);
     }
 
     vector<double> derivativesAna(pl.size());
     f1.setParameters(pl);
     bool test = true;
-    for (unsigned int i = 0; i < pl.size(); ++i) {
+    for (size_t i = 0; i < pl.size(); ++i) {
       derivativesAna[i] = f1.getFirstOrderDerivative(pl.getParameterNames()[i]);
       if (abs(derivativesAna[i] - derivativesNum2pt[i]) > std::sqrt(nd2pt.getInterval())) test = false;
       if (abs(derivativesAna[i] - derivativesNum3pt[i]) > std::sqrt(nd2pt.getInterval())) test = false;
@@ -93,7 +93,7 @@ int main() {
     //Test:
     if (!test) {
       //Failure!
-      for (unsigned int i = 0; i < pl.size(); ++i) {
+      for (size_t i = 0; i < pl.size(); ++i) {
         cout << setprecision(20) << pl[i].getName() << "=" << pl[i].getValue() << endl;
         cout << setprecision(20) << "Ana. Der.     =" << derivativesAna[i]    << endl;
         cout << setprecision(20) << "Num. Der. 2pts=" << derivativesNum2pt[i] << endl;
diff --git a/test/test_reparametrization.cpp b/test/test_reparametrization.cpp
new file mode 100644
index 0000000..c503ca8
--- /dev/null
+++ b/test/test_reparametrization.cpp
@@ -0,0 +1,98 @@
+//
+// File: test_derivative1.cpp
+// Created by: Julien Dutheil
+// Created on: Thu Oct 28 12:49 2010
+//
+
+/*
+Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+This software is a computer program whose purpose is to provide classes
+for numerical calculus. This file is part of the Bio++ project.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+*/
+
+#include <Bpp/Numeric/Random/RandomTools.h>
+#include <Bpp/Numeric/Function/PowellMultiDimensions.h>
+#include <Bpp/Numeric/Function/ReparametrizationFunctionWrapper.h>
+#include <vector>
+#include <iostream>
+
+using namespace bpp;
+using namespace std;
+
+class MyFunction:
+  public virtual Function,
+  public AbstractParametrizable
+{
+  private:
+    double fval_;
+ 
+  public:
+    MyFunction() : AbstractParametrizable(""), fval_(0) {
+      //We declare parameters here:
+      addParameter_(new Parameter("x", 0, new IntervalConstraint(-1, 7, true, true), true));
+      addParameter_(new Parameter("y", 0, new IntervalConstraint(-4, 4, true, true), true));
+      fireParameterChanged(getParameters());
+    }
+ 
+    MyFunction* clone() const { return new MyFunction(*this); }
+ 
+  public:
+    void setParameters(const ParameterList& pl) 
+        throw (ParameterNotFoundException, ConstraintException, Exception)
+    {
+      matchParametersValues(pl);
+    }
+    double getValue() const throw (Exception) { return fval_; }
+ 
+    void fireParameterChanged(const ParameterList& pl) {
+      double x = getParameterValue("x");
+      double y = getParameterValue("y");
+      fval_ = cos(x) + sin(y);
+    }
+};
+
+int main() {
+  MyFunction f;
+  ReparametrizationFunctionWrapper fw(&f);
+  ParameterList pl = fw.getParameters();
+  PowellMultiDimensions optimizer(&fw);
+  optimizer.init(pl);
+  optimizer.optimize();
+  double minf = f.getValue();
+  double x = f.getParameterValue("x");
+  double y = f.getParameterValue("y");
+  cout << "x=" << x << endl;
+  cout << "y=" << y << endl;
+  cout << "f=" << minf << endl;
+
+  cout << setprecision(20) << (abs(x - 3.141593) + abs(y + 1.570796)) << endl;
+  bool test = (abs(x - 3.141593) + abs(y + 1.570796)) < optimizer.getStopCondition()->getTolerance();
+  return (test ? 0 : 1);
+}
diff --git a/test/test_simplex.cpp b/test/test_simplex.cpp
new file mode 100644
index 0000000..6c82e30
--- /dev/null
+++ b/test/test_simplex.cpp
@@ -0,0 +1,117 @@
+//
+// File: test_simplex.cpp
+// Created by: Laurent Guéguen
+// Created on: vendredi 5 juillet 2013, à 11h 08
+//
+
+/*
+   Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
+
+   This software is a computer program whose purpose is to provide classes
+   for numerical calculus. This file is part of the Bio++ project.
+
+   This software is governed by the CeCILL  license under French law and
+   abiding by the rules of distribution of free software.  You can  use,
+   modify and/ or redistribute the software under the terms of the CeCILL
+   license as circulated by CEA, CNRS and INRIA at the following URL
+   "http://www.cecill.info".
+
+   As a counterpart to the access to the source code and  rights to copy,
+   modify and redistribute granted by the license, users are provided only
+   with a limited warranty  and the software's author,  the holder of the
+   economic rights,  and the successive licensors  have only  limited
+   liability.
+
+   In this respect, the user's attention is drawn to the risks associated
+   with loading,  using,  modifying and/or developing or reproducing the
+   software by the user in light of its specific status of free software,
+   that may mean  that it is complicated to manipulate,  and  that  also
+   therefore means  that it is reserved for developers  and  experienced
+   professionals having in-depth computer knowledge. Users are therefore
+   encouraged to load and test the software's suitability as regards their
+   requirements in conditions enabling the security of their systems and/or
+   data to be ensured and,  more generally, to use and operate it in the
+   same conditions as regards security.
+
+   The fact that you are presently reading this means that you have had
+   knowledge of the CeCILL license and that you accept its terms.
+ */
+
+#include <Bpp/Numeric/Prob/Simplex.h>
+#include <Bpp/Text/TextTools.h>
+
+#include <iostream>
+#include <limits>
+
+using namespace bpp;
+using namespace std;
+
+int main()
+{
+  try
+  {
+    vector<double> prob;
+    prob.push_back(0.1);
+    prob.push_back(0.2);
+    prob.push_back(0.3);
+    prob.push_back(0.15);
+    prob.push_back(0.1);
+    prob.push_back(0.05);
+    prob.push_back(0.1);
+
+    vector<Simplex*> vpsi;
+    vpsi.push_back(new Simplex(prob, 1));
+    vpsi.push_back(new Simplex(prob, 2));
+    vpsi.push_back(new Simplex(prob, 3));
+
+    for (size_t i = 0; i < 3; i++)
+    {
+      cout << "Method " << i + 1 << endl;
+      for (size_t j = 0; j < prob.size() - 1; j++)
+      {
+        cout << vpsi[i]->getParameterValue("theta" + TextTools::toString(j + 1)) << "\t";
+      }
+      cout << endl;
+    }
+
+
+    cout << "Prob:";
+    for (size_t j = 0; j < prob.size(); j++)
+    {
+      cout << prob[j] << "\t";
+    }
+    cout << endl;
+    for (size_t i = 0; i < 3; i++)
+    {
+      for (size_t j = 0; j < prob.size() - 1; j++)
+      {
+        vpsi[i]->setParameterValue("theta" + TextTools::toString(j + 1),
+                                   vpsi[i]->getParameterValue("theta" + TextTools::toString(j + 1)) + 0.1);
+      }
+      for (size_t j = 0; j < prob.size() - 1; j++)
+      {
+        vpsi[i]->setParameterValue("theta" + TextTools::toString(j + 1),
+                                   vpsi[i]->getParameterValue("theta" + TextTools::toString(j + 1)) - 0.1);
+      }
+      cout << "Method " << i + 1 << endl;
+      cout << "prob\t";
+      for (size_t j = 0; j < prob.size(); j++)
+      {
+        cout << vpsi[i]->prob(j) << "\t";
+      }
+      cout << endl;
+    }
+
+    for (size_t i = 0; i < 3; i++)
+    {
+      delete vpsi[i];
+    }
+    return 0;
+  }
+  catch (Exception& ex)
+  {
+    cout << "failed :(" << endl;
+    return 1;
+  }
+}
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/libbpp-core.git



More information about the debian-med-commit mailing list