diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 32297b8f3aa9dbddda51e12bee028a825fb64124..0000000000000000000000000000000000000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-cmake_minimum_required(VERSION 2.4)
-cmake_policy(SET CMP0004 OLD)
-SET(local_prefix "local_config/local-")
-FIND_PROGRAM(HOSTNAME hostname PATHS $ENV{PATH})
-IF(HOSTNAME)
-	# TODO: hostname does not accept -s on cygwin
-	IF(CYGWIN OR WIN32)
-		SET(hostname_params "")
-	ELSE(CYGWIN OR WIN32)
-		SET(hostname_params "-s")
-	ENDIF(CYGWIN OR WIN32)
-	
-	EXEC_PROGRAM(${HOSTNAME} ARGS ${hostname_params} OUTPUT_VARIABLE host)
-
-	SET(local "${local_prefix}${host}.cmake")
-	
-	SET(extension "$ENV{CSM_CONF}")
-	IF(extension)
-		SET(local "${local_prefix}${host}-${extension}.cmake")
-	ENDIF(extension)
-	
-	IF(EXISTS ${local})
-		MESSAGE(STATUS "Including local configuration ${local}.")
-		INCLUDE(${local})
-	ELSE(EXISTS ${local})
-		MESSAGE(STATUS "Create a file named '${local}' if you want to add options.")
-	ENDIF(EXISTS ${local})
-ELSE(HOSTNAME)
-	MESSAGE(STATUS "Program `hostname` not found. (don't worry)")
-ENDIF(HOSTNAME)
-
-
-ENABLE_TESTING()
-SUBDIRS(sm)
diff --git a/Doxyfile b/Doxyfile
deleted file mode 100644
index 46d2d7408af4a6ae7335d129efb9e40934bc73a9..0000000000000000000000000000000000000000
--- a/Doxyfile
+++ /dev/null
@@ -1,1218 +0,0 @@
-# Doxyfile 1.4.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-#       TAG = value [value, ...]
-# For lists items can also be appended using:
-#       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
-# by quotes) that should identify the project.
-
-PROJECT_NAME           = CSM
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
-# This could be handy for archiving the generated documentation or 
-# if some version control system is used.
-
-PROJECT_NUMBER         = 
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
-# base path where the generated documentation will be put. 
-# If a relative path is entered, it will be relative to the location 
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY       = doxy
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
-# 4096 sub-directories (in 2 levels) under the output directory of each output 
-# format and will distribute the generated files over these directories. 
-# Enabling this option can be useful when feeding doxygen a huge amount of 
-# source files, where putting all generated files in the same directory would 
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS         = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
-# documentation generated by doxygen is written. Doxygen will use this 
-# information to generate all constant output in the proper language. 
-# The default language is English, other supported languages are: 
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, 
-# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, 
-# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, 
-# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, 
-# Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE        = English
-
-# This tag can be used to specify the encoding used in the generated output. 
-# The encoding is not always determined by the language that is chosen, 
-# but also whether or not the output is meant for Windows or non-Windows users. 
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
-# forces the Windows encoding (this is the default for the Windows binary), 
-# whereas setting the tag to NO uses a Unix-style encoding (the default for 
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING   = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
-# include brief member descriptions after the members that are listed in 
-# the file and class documentation (similar to JavaDoc). 
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC      = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
-# the brief description of a member or function before the detailed description. 
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF           = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator 
-# that is used to form the text in various listings. Each string 
-# in this list, if found as the leading text of the brief description, will be 
-# stripped from the text and the result after processing the whole list, is 
-# used as the annotated text. Otherwise, the brief description is used as-is. 
-# If left blank, the following values are used ("$name" is automatically 
-# replaced with the name of the entity): "The $name class" "The $name widget" 
-# "The $name file" "is" "provides" "specifies" "contains" 
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF       = 
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
-# Doxygen will generate a detailed section even if there is only a brief 
-# description.
-
-ALWAYS_DETAILED_SEC    = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
-# inherited members of a class in the documentation of that class as if those 
-# members were ordinary class members. Constructors, destructors and assignment 
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB  = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
-# path before files name in the file list and in the header files. If set 
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES        = 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.
-
-STRIP_FROM_PATH        = 
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
-# the path mentioned in the documentation of a class, which tells 
-# the reader which header file to include in order to use a class. 
-# If left blank only the name of the header file containing the class 
-# definition is used. Otherwise one should specify the include paths that 
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH    = 
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
-# (but less readable) file names. This can be useful is your file systems 
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES            = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
-# will interpret the first line (until the first dot) of a JavaDoc-style 
-# comment as the brief description. If set to NO, the JavaDoc 
-# comments will behave just like the Qt-style comments (thus requiring an 
-# explicit @brief command for a brief description.
-
-JAVADOC_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.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member 
-# documentation.
-
-DETAILS_AT_TOP         = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
-# member inherits the documentation from any documented member that it 
-# re-implements.
-
-INHERIT_DOCS           = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
-# tag is set to YES, then doxygen will reuse the documentation of the first 
-# member in the group (if any) for the other members of the group. By default 
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC   = NO
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
-# a new page for each member. If set to NO, the documentation of a member will 
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES  = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE               = 8
-
-# This tag can be used to specify a number of aliases that acts 
-# as commands in the documentation. An alias has the form "name=value". 
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
-# put the command \sideeffect (or @sideeffect) in the documentation, which 
-# will result in a user-defined paragraph with heading "Side Effects:". 
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES                = 
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
-# sources only. Doxygen will then generate output that is more tailored for C. 
-# For instance, some of the names that are used will be different. The list 
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C  = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources 
-# only. Doxygen will then generate output that is more tailored for Java. 
-# For instance, namespaces will be presented as packages, qualified scopes 
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA   = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
-# the same type (for instance a group of public functions) to be put as a 
-# subgroup of that type (e.g. under the Public Functions section). Set it to 
-# NO to prevent subgrouping. Alternatively, this can be done per class using 
-# the \nosubgrouping command.
-
-SUBGROUPING            = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
-# documentation are documented, even if no documentation was available. 
-# Private class members and static file members will be hidden unless 
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL            = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
-# will be included in the documentation.
-
-EXTRACT_PRIVATE        = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file 
-# will be included in the documentation.
-
-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.
-
-EXTRACT_LOCAL_CLASSES  = YES
-
-# This flag is only useful for Objective-C code. When set to YES local 
-# methods, which are defined in the implementation section but not in 
-# the interface are included in the documentation. 
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS  = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
-# undocumented members of documented classes, files or namespaces. 
-# If set to NO (the default) these members will be included in the 
-# various overviews, but no documentation section is generated. 
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS     = 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.
-
-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.
-
-HIDE_FRIEND_COMPOUNDS  = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
-# documentation blocks found inside the body of a function. 
-# If set to NO (the default) these blocks will be appended to the 
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS      = NO
-
-# The INTERNAL_DOCS tag determines if documentation 
-# that is typed after a \internal command is included. If the tag is set 
-# to NO (the default) then the documentation will be excluded. 
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS          = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
-# file names in lower-case letters. If set to YES upper-case letters are also 
-# allowed. This is useful if you have classes or files whose names only differ 
-# in case and if your file system supports case sensitive file names. Windows 
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES       = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
-# will show members with their full class and namespace scopes in the 
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES       = 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.
-
-SHOW_INCLUDE_FILES     = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
-# is inserted in the documentation for inline members.
-
-INLINE_INFO            = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
-# will sort the (detailed) documentation of file and class members 
-# alphabetically by member name. If set to NO the members will appear in 
-# declaration order.
-
-SORT_MEMBER_DOCS       = 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.
-
-SORT_BRIEF_DOCS        = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
-# sorted by fully-qualified names, including namespaces. If set to 
-# NO (the default), the class list will be sorted only by class name, 
-# not including the namespace part. 
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the 
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME     = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or 
-# disable (NO) the todo list. This list is created by putting \todo 
-# commands in the documentation.
-
-GENERATE_TODOLIST      = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or 
-# disable (NO) the test list. This list is created by putting \test 
-# commands in the documentation.
-
-GENERATE_TESTLIST      = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or 
-# disable (NO) the bug list. This list is created by putting \bug 
-# commands in the documentation.
-
-GENERATE_BUGLIST       = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
-# disable (NO) the deprecated list. This list is created by putting 
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional 
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS       = 
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
-# the initial value of a variable or define consists of for it to appear in 
-# the documentation. If the initializer consists of more lines than specified 
-# here it will be hidden. Use a value of 0 to hide initializers completely. 
-# The appearance of the initializer of individual variables and defines in the 
-# documentation can be controlled using \showinitializer or \hideinitializer 
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES  = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
-# at the bottom of the documentation of classes and structs. If set to YES the 
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES        = YES
-
-# If the sources in your project are distributed over multiple directories 
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
-# in the documentation.
-
-SHOW_DIRECTORIES       = 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 progam writes to standard output 
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER    = 
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated 
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET                  = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are 
-# generated by doxygen. Possible values are YES and NO. If left blank 
-# NO is used.
-
-WARNINGS               = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED   = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
-# potential errors in the documentation, such as not documenting some 
-# parameters in a documented function, or documenting parameters that 
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR      = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for 
-# functions that are documented, but have no documentation for their parameters 
-# or return value. If set to NO (the default) doxygen will only warn about 
-# wrong or incomplete parameter documentation, but not about the absence of 
-# documentation.
-
-WARN_NO_PARAMDOC       = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that 
-# doxygen can produce. The string should contain the $file, $line, and $text 
-# tags, which will be replaced by the file and line number from which the 
-# warning originated and the warning text. Optionally the format may contain 
-# $version, which will be replaced by the version of the file (if it could 
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT            = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning 
-# and error messages should be written. If left blank the output is written 
-# to stderr.
-
-WARN_LOGFILE           = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain 
-# documented source files. You may enter file names like "myfile.cpp" or 
-# directories like "/usr/src/myproject". Separate the files or directories 
-# with spaces.
-
-INPUT                  = sm/
-
-# If the value of the INPUT tag contains directories, you can use the 
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank the following patterns are tested: 
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
-
-FILE_PATTERNS          = 
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
-# should be searched for input files as well. Possible values are YES and NO. 
-# If left blank NO is used.
-
-RECURSIVE              = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should 
-# excluded from the INPUT source files. This way you can easily exclude a 
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE                = 
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
-# directories that are symbolic links (a Unix filesystem feature) are excluded 
-# from the input.
-
-EXCLUDE_SYMLINKS       = NO
-
-# If the value of the INPUT tag contains directories, you can use the 
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
-# certain files from those directories.
-
-EXCLUDE_PATTERNS       = 
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or 
-# directories that contain example code fragments that are included (see 
-# the \include command).
-
-EXAMPLE_PATH           = 
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank all files are included.
-
-EXAMPLE_PATTERNS       = 
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
-# searched for input files to be used with the \include or \dontinclude 
-# commands irrespective of the value of the RECURSIVE tag. 
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE      = 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).
-
-IMAGE_PATH             = 
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should 
-# invoke to filter for each input file. Doxygen will invoke the filter program 
-# by executing (via popen()) the command <filter> <input-file>, where <filter> 
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
-# input file. Doxygen will then use the output that the filter program writes 
-# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
-# ignored.
-
-INPUT_FILTER           = 
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
-# basis.  Doxygen will compare the file name with each pattern and apply the 
-# filter if there is a match.  The filters are a list of the form: 
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
-# is applied to all files.
-
-FILTER_PATTERNS        = 
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
-# INPUT_FILTER) will be used to filter the input files when producing source 
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES    = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
-# be generated. Documented entities will be cross-referenced with these sources. 
-# Note: To get rid of all source code in the generated output, make sure also 
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER         = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body 
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES         = YES
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
-# doxygen to hide any special comment blocks from generated source code 
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS    = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
-# then for each documented function all documented 
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default) 
-# then for each documented function all documented entities 
-# called/used by that function will be listed.
-
-REFERENCES_RELATION    = YES
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
-# will generate a verbatim copy of the header file for each class for 
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS       = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
-# of all compounds will be generated. Enable this if the project 
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX     = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX    = 5
-
-# In case all classes in a project start with a common prefix, all 
-# classes will be put under the same header in the alphabetical index. 
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX          = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
-# generate HTML output.
-
-GENERATE_HTML          = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT            = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION    = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for 
-# each generated HTML page. If it is left blank doxygen will generate a 
-# standard header.
-
-HTML_HEADER            = 
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
-# each generated HTML page. If it is left blank doxygen will generate a 
-# standard footer.
-
-HTML_FOOTER            = 
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
-# style sheet that is used by each HTML page. It can be used to 
-# fine-tune the look of the HTML output. If the tag is left blank doxygen 
-# will generate a default style sheet. Note that doxygen will try to copy 
-# the style sheet file to the HTML output directory, so don't put your own 
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET        = 
-
-# 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 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 compressed HTML help file (.chm) 
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP      = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
-# be used to specify the file name of the resulting .chm file. You 
-# can add a path in front of the file if the result should not be 
-# written to the html output directory.
-
-CHM_FILE               = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
-# be used to specify the location (absolute path including file name) of 
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION           = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
-# controls if a separate .chi index file is generated (YES) or that 
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI           = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
-# controls whether a binary table of contents is generated (YES) or a 
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC             = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members 
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND             = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
-# top of each HTML page. The value NO (the default) enables the index and 
-# the value YES disables it.
-
-DISABLE_INDEX          = NO
-
-# This tag can be used to set the number of enum values (range [1..20]) 
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE   = 4
-
-# If the GENERATE_TREEVIEW tag 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 (for instance Mozilla 1.0+, 
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW      = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
-# used to set the initial width (in pixels) of the frame in which the tree 
-# is shown.
-
-TREEVIEW_WIDTH         = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
-# generate Latex output.
-
-GENERATE_LATEX         = YES
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT           = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME         = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
-# generate index for LaTeX. If left blank `makeindex' will be used as the 
-# default command name.
-
-MAKEINDEX_CMD_NAME     = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
-# LaTeX documents. This may be useful for small projects and may help to 
-# save some trees in general.
-
-COMPACT_LATEX          = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used 
-# by the printer. Possible values are: a4, a4wide, letter, legal and 
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE             = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES         = 
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
-# the generated latex document. The header should contain everything until 
-# the first chapter. If it is left blank doxygen will generate a 
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER           = 
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
-# contain links (just like the HTML output) instead of page references 
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS         = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
-# plain latex in the generated Makefile. Set this option to YES to get a 
-# higher quality PDF documentation.
-
-USE_PDFLATEX           = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
-# command to the generated LaTeX files. This will instruct LaTeX to keep 
-# running if errors occur, instead of asking the user for help. 
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE        = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
-# include the index chapters (such as File Index, Compound Index, etc.) 
-# in the output.
-
-LATEX_HIDE_INDICES     = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
-# The RTF output is optimized for Word 97 and may not look very pretty with 
-# other RTF readers or editors.
-
-GENERATE_RTF           = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT             = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
-# RTF documents. This may be useful for small projects and may help to 
-# save some trees in general.
-
-COMPACT_RTF            = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
-# will contain hyperlink fields. The RTF file will 
-# contain links (just like the HTML output) instead of page references. 
-# This makes the output suitable for online browsing using WORD or other 
-# programs which support those fields. 
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS         = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's 
-# config file, i.e. a series of assignments. You only have to provide 
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE    = 
-
-# Set optional variables used in the generation of an rtf document. 
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE    = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
-# generate man pages
-
-GENERATE_MAN           = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT             = man
-
-# The MAN_EXTENSION tag determines the extension that is added to 
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION          = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
-# then it will generate one additional man file for each entity 
-# documented in the real man page(s). These additional files 
-# only source the real man page, but without them the man command 
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will 
-# generate an XML file that captures the structure of 
-# the code including all documentation.
-
-GENERATE_XML           = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT             = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema, 
-# which can be used by a validating XML parser to check the 
-# syntax of the XML files.
-
-XML_SCHEMA             = 
-
-# The XML_DTD tag can be used to specify an XML DTD, 
-# which can be used by a validating XML parser to check the 
-# syntax of the XML files.
-
-XML_DTD                = 
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
-# dump the program listings (including syntax highlighting 
-# and cross-referencing information) to the XML output. Note that 
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING     = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
-# generate an AutoGen Definitions (see autogen.sf.net) file 
-# that captures the structure of the code including all 
-# documentation. Note that this feature is still experimental 
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
-# generate a Perl module file that captures the structure of 
-# the code including all documentation. Note that this 
-# feature is still experimental and incomplete at the 
-# moment.
-
-GENERATE_PERLMOD       = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX          = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
-# nicely formatted so it can be parsed by a human reader.  This is useful 
-# if you want to understand what is going on.  On the other hand, if this 
-# tag is set to NO the size of the Perl module output will be much smaller 
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY         = YES
-
-# The names of the make variables in the generated doxyrules.make file 
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
-# This is useful so different doxyrules.make files included by the same 
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX = 
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor   
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
-# evaluate all C-preprocessor directives found in the sources and include 
-# files.
-
-ENABLE_PREPROCESSING   = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
-# names in the source code. If set to NO (the default) only conditional 
-# compilation will be performed. Macro expansion can be done in a controlled 
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION        = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
-# then the macro expansion is limited to the macros specified with the 
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF     = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES        = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that 
-# contain include files that are not input files but should be processed by 
-# the preprocessor.
-
-INCLUDE_PATH           = 
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
-# patterns (like *.h and *.hpp) to filter out the header-files in the 
-# directories. If left blank, the patterns specified with FILE_PATTERNS will 
-# be used.
-
-INCLUDE_FILE_PATTERNS  = 
-
-# The PREDEFINED tag can be used to specify one or more macro names that 
-# are defined before the preprocessor is started (similar to the -D option of 
-# gcc). The argument of the tag is a list of macros of the form: name 
-# or name=definition (no spaces). If the definition and the = are 
-# omitted =1 is assumed. To prevent a macro definition from being 
-# undefined via #undef or recursively expanded use the := operator 
-# instead of the = operator.
-
-PREDEFINED             = 
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
-# this tag can be used to specify a list of macro names that should be expanded. 
-# The macro definition that is found in the sources will be used. 
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED      = 
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
-# doxygen's preprocessor will remove all function-like macros that are alone 
-# on a line, have an all uppercase name, and do not end with a semicolon. Such 
-# function macros are typically used for boiler-plate code, and will confuse 
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references   
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles. 
-# Optionally an initial location of the external documentation 
-# can be added for each tagfile. The format of a tag file without 
-# this location is as follows: 
-#   TAGFILES = file1 file2 ... 
-# Adding location for the tag files is done as follows: 
-#   TAGFILES = file1=loc1 "file2 = loc2" ... 
-# where "loc1" and "loc2" can be relative or absolute paths or 
-# URLs. If a location is present for each tag, the installdox tool 
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen 
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES               = 
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE       = 
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
-# in the class index. If set to NO only the inherited external classes 
-# will be listed.
-
-ALLEXTERNALS           = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
-# in the modules index. If set to NO, only the current project's groups will 
-# be listed.
-
-EXTERNAL_GROUPS        = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script 
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH              = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool   
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
-# or super classes. Setting the tag to NO turns the diagrams off. Note that 
-# this option is superseded by the HAVE_DOT option below. This is only a 
-# fallback. It is recommended to install and use dot, since it yields more 
-# powerful graphs.
-
-CLASS_DIAGRAMS         = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide 
-# inheritance and usage relations if the target is undocumented 
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS   = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
-# available from the path. This tool is part of Graphviz, a graph visualization 
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT               = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect inheritance relations. Setting this tag to YES will force the 
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH            = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect implementation dependencies (inheritance, containment, and 
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH    = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS           = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
-# collaboration diagrams in a style similar to the OMG's Unified Modeling 
-# Language.
-
-UML_LOOK               = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the 
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS     = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
-# tags are set to YES then doxygen will generate a graph for each documented 
-# file showing the direct and indirect include dependencies of the file with 
-# other documented files.
-
-INCLUDE_GRAPH          = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
-# documented header file showing the documented files that directly or 
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH      = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
-# generate a call dependency graph for every global function or class method. 
-# Note that enabling this option will significantly increase the time of a run. 
-# So in most cases it will be better to enable call graphs for selected 
-# functions only using the \callgraph command.
-
-CALL_GRAPH             = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY    = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
-# then doxygen will show the dependencies a directory has on other directories 
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH        = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT       = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be 
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH               = 
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that 
-# contain dot files that are included in the documentation (see the 
-# \dotfile command).
-
-DOTFILE_DIRS           = 
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
-# large images.
-
-MAX_DOT_GRAPH_WIDTH    = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT   = 1024
-
-# 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 a graph may be further truncated if the graph's 
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH 
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), 
-# the graph is not depth-constrained.
-
-MAX_DOT_GRAPH_DEPTH    = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
-# background. This is disabled by default, which results in a white background. 
-# Warning: Depending on the platform used, enabling this option may lead to 
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to 
-# read).
-
-DOT_TRANSPARENT        = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
-# files in one run (i.e. multiple -o and -T options on the command line). This 
-# makes dot run faster, but since only newer versions of dot (>1.8.10) 
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS      = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
-# generate a legend page explaining the meaning of the various boxes and 
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND        = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
-# remove the intermediate dot files that are used to generate 
-# the various graphs.
-
-DOT_CLEANUP            = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine   
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be 
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE           = NO
diff --git a/TODO.txt b/TODO.txt
deleted file mode 100644
index 6bf8842b824092e92d0a75e473e481ffff3ec471..0000000000000000000000000000000000000000
--- a/TODO.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-* add FAQ from email w/Tarek
-* add link to algos.h in the manual
-* publish gh-pages
diff --git a/csm_manual.html b/csm_manual.html
deleted file mode 100644
index 77bd28b6f993c94e8d07672aef4d435799e25b48..0000000000000000000000000000000000000000
--- a/csm_manual.html
+++ /dev/null
@@ -1,675 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC
-    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
-    "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
-<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
-<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>The C(anonical) Scan Matcher</title><link href='style.css' rel='stylesheet' type='text/css' />
-</head>
-<body><style>
-body { padding-left: 3em;}
-body p, body ul { max-width: 35em;}
-pre { margin-left: 2em; background-color: #bbf; border: solid 1px black;
-	padding: 10px;}
-	
-code { background-color: #ddf; padding: 3px; color: #008;}
-pre code { background-color: #bbf;}
-p, pre { max-width: 40em; }
-h2 { 
-	border-left: solid 2px #b00; 
-	border-top: solid 2px #b00; 
-	margin-top: 4em;
-	padding: 1em; margin-left: -1em;}
-</style>
-<h1 id='the_canonical_scan_matcher'>The C(anonical) Scan Matcher</h1>
-<div class='maruku_toc'><ul style='list-style: none;'><li><span class='maruku_section_number'>1. </span><a href='#introduction'>Introduction</a></li><li><span class='maruku_section_number'>2. </span><a href='#content_of_this_package'>Content of this package</a><ul style='list-style: none;'><li><span class='maruku_section_number'>2.1. </span><a href='#stable_things_c_scan_matching_library'>Stable things: C scan matching library</a></li><li><span class='maruku_section_number'>2.2. </span><a href='#stable_things_applications'>Stable things: applications</a></li><li><span class='maruku_section_number'>2.3. </span><a href='#unstable_things_scripts'>Unstable things: scripts</a></li><li><span class='maruku_section_number'>2.4. </span><a href='#unstable_things_ruby_and_matlab_implementations'>Unstable things: Ruby and Matlab implementations</a></li></ul></li><li><span class='maruku_section_number'>3. </span><a href='#installation'>Installation</a><ul style='list-style: none;'><li><span class='maruku_section_number'>3.1. </span><a href='#required_software_dependencies'>Required software dependencies</a></li><li><span class='maruku_section_number'>3.2. </span><a href='#compiling'>Compiling</a></li><li><span class='maruku_section_number'>3.3. </span><a href='#getting_started'>Getting started</a></li><li><span class='maruku_section_number'>3.4. </span><a href='#installing_ruby_libraries_and_wrapper_optional'>Installing Ruby libraries and wrapper (optional)</a></li></ul></li><li><span class='maruku_section_number'>4. </span><a href='#the__data_structure'>The <code>laser_data</code> data structure</a></li><li><span class='maruku_section_number'>5. </span><a href='#input_and_output_formats'>Input and output formats</a><ul style='list-style: none;'><li><span class='maruku_section_number'>5.1. </span><a href='#the_json_log_format'>The JSON log format</a></li><li><span class='maruku_section_number'>5.2. </span><a href='#the_carmen_log_format'>The Carmen log format</a><ul style='list-style: none;'><li><span class='maruku_section_number'>5.2.1. </span><a href='#regarding_the_timestamp'>Regarding the timestamp</a></li></ul></li></ul></li><li><span class='maruku_section_number'>6. </span><a href='#examples'>Examples</a><ul style='list-style: none;'><li><span class='maruku_section_number'>6.1. </span><a href='#simple_scan_matching'>Simple scan matching</a></li><li><span class='maruku_section_number'>6.2. </span><a href='#creating_a_pdf'>Creating a PDF</a></li><li><span class='maruku_section_number'>6.3. </span><a href='#examining_one_particular_matching_video'>Examining one particular matching (video)</a></li><li><span class='maruku_section_number'>6.4. </span><a href='#help_icp_doesnt_work'>Help! ICP doesn&#8217;t work</a></li></ul></li><li><span class='maruku_section_number'>7. </span><a href='#embedding_csm_in_your_programs'>Embedding CSM in your programs</a><ul style='list-style: none;'><li><span class='maruku_section_number'>7.1. </span><a href='#linking_to_csm'>Linking to CSM</a></li><li><span class='maruku_section_number'>7.2. </span><a href='#accessing_csm_functions_from_your_applications'>Accessing CSM functions from your applications</a></li><li><span class='maruku_section_number'>7.3. </span><a href='#orienting_oneself_in_the_source_code'>Orienting oneself in the source code</a></li></ul></li></ul></div>
-<h2 id='introduction'><span class='maruku_section_number'>1. </span>Introduction</h2>
-
-<p>I created this package:</p>
-
-<ul>
-<li>
-<p>To have a well-documented reference implementation of <a href='http://purl.org/censi/2007/plicp'>PL-ICP</a>. If you are only interested in the core algorithm of PL-ICP, a <a href='http://purl.org/censi/2007/plicp'>separate concise implementation in C/Matlab/Ruby</a> is available.</p>
-</li>
-
-<li>
-<p>To have a <strong>trustworthy</strong> scan matcher to be used in the experiments for some papers on <a href='http://purl.org/censi/2006/icpcov'>ICP covariance</a>, <a href='http://purl.org/censi/2006/accuracy'>the Cramer-Rao bound for range finders</a>, and <a href='http://purl.org/censi/2007/calib'>robot calibration</a>. For batch experiments, it&#8217;s also useful that it&#8217;s pretty fast.</p>
-</li>
-
-<li>
-<p>To have a collection of utilies for command line (UNIX-style) manipulation of laser data, and creating beautiful maps and animations.</p>
-</li>
-</ul>
-
-<h2 id='content_of_this_package'><span class='maruku_section_number'>2. </span>Content of this package</h2>
-
-<p>The core content is the C scan matching library which is quite polished, but this package contains a lot of software, only some of that in an usable state. In general, I am not ashamed of the prototypical code I write.</p>
-
-<h3 id='stable_things_c_scan_matching_library'><span class='maruku_section_number'>2.1. </span>Stable things: C scan matching library</h3>
-
-<p>The directory <code>sm/csm</code> contains a scan matcher written in C, plus associated tools and apps. This is stable and reasonably bug-free.</p>
-
-<p>There are many libraries in the <code>sm/lib</code> directory:</p>
-
-<ul>
-<li>
-<p>Directory <code>egsl</code>: a light wrapper for GSL that makes manipulating matrices easy and efficient. This is documented in another file: see <code>sm/lib/egsl/docs</code>.</p>
-</li>
-
-<li>
-<p>Directory <code>options</code>: for processing command-line arguments and configuration files.</p>
-</li>
-
-<li>
-<p>Directory <code>json-c</code>: a library for JSON input/output. This is a slightly modified version of the original <a href='http://www.json.org'><code>json-c</code></a> library released under the <a href='http://en.wikipedia.org/wiki/MIT_License'>MIT license</a>.</p>
-</li>
-</ul>
-
-<h3 id='stable_things_applications'><span class='maruku_section_number'>2.2. </span>Stable things: applications</h3>
-
-<p>There are many applications in the <code>sm/apps</code> directory:</p>
-
-<ul>
-<li>
-<p>Application <code>sm2</code>: standard scan-matching. Reads a log, runs ICP, and writes the scan-matched output. Input can be both Carmen and JSON.</p>
-</li>
-
-<li>
-<p>Application <code>sm3</code>: like sm2, but instead of actual output it measures the performance. This is the application that produced the stats found in the paper submitted to ICRA&#8217;08.</p>
-</li>
-
-<li>
-<p>Application <code>sm1</code>: useful for running experiments. Reads scans from two different files, and outputs statistics.</p>
-</li>
-</ul>
-
-<p>Visualization apps:</p>
-
-<ul>
-<li>
-<p>Application <code>log2pdf</code>: converts a laser log to a PDF map. To build this application, it is needed to install the <a href='http://cairographics.org'>Cairo</a> graphics library.</p>
-</li>
-
-<li>
-<p>Application <code>sm_animate</code>: creates an animation for the ICP process, displaying the correspondences, etc. This application reads the output created by <code>sm2</code> with the <code>-file_jj</code> option. To build this application, it is needed to install the <a href='http://cairographics.org'>Cairo</a> graphics library.</p>
-</li>
-</ul>
-
-<p>Miscellaneous Unix-style processing for laser data:</p>
-
-<ul>
-<li>
-<p>Application <code>carmen2json</code>: converts a Carmen log to the JSON format.</p>
-</li>
-
-<li>
-<p>Application <code>ld_fisher</code>: computes the Fisher&#8217;s information matrix. See <a href='http://purl.org/censi/2006/accuracy'>http://purl.org/censi/2006/accuracy</a> for details.</p>
-</li>
-
-<li>
-<p>Application <code>json_extract</code>: extract the n-th object from a JSON stream.</p>
-</li>
-
-<li>
-<p>Application <code>ld_slip</code>: adds some noise to the odometry field.</p>
-</li>
-
-<li>
-<p>Application <code>ld_smooth</code>: smooths the readings data.</p>
-</li>
-
-<li>
-<p>Application <code>ld_noise</code>: adds sensor noise.</p>
-</li>
-
-<li>
-<p>Application <code>ld_cluster_curv</code>: clusterize the rays based on the analysis of the curvature.</p>
-</li>
-
-<li>
-<p>Application <code>ld_linearize</code>: fits a line to each cluster (data must have been previously clustered, for example by <code>ld_cluster_curv</code>).</p>
-</li>
-</ul>
-
-<p>GUI apps:</p>
-
-<ul>
-<li><code>apps/gtk_viewer</code> contains the prototype of a viewer using GTK. It does not work yet.</li>
-</ul>
-
-<h3 id='unstable_things_scripts'><span class='maruku_section_number'>2.3. </span>Unstable things: scripts</h3>
-
-<p>In the <code>scripts/</code> directory you can find:</p>
-
-<ul>
-<li>
-<p>Script <code>json2matlab.rb</code>: converts a JSON object in a Matlab scripts. This is the holy grail of data exchange.</p>
-
-<p>Warning: at the moment, this script relies on some patches to the Ruby JSON library. Without them, it is limited to only 1 JSON object in each file.</p>
-</li>
-
-<li>
-<p>Script <code>fig2pics.rb</code>: used for converting FIG files to PDF. It has many more options than <a href='http://www.xfig.org'><code>fig2dev</code></a> (that is being used internally), including the ability to use a LaTeX preamble and to change the resulting bounding box.</p>
-</li>
-
-<li>
-<p>Script <code>create_video.rb</code>: displays the scan-matching process. This reads the journal files written by applications <code>sm1</code> and <code>sm2</code>. <strong>Made obsolete by <code>sm_animate</code></strong></p>
-</li>
-</ul>
-
-<h3 id='unstable_things_ruby_and_matlab_implementations'><span class='maruku_section_number'>2.4. </span>Unstable things: Ruby and Matlab implementations</h3>
-
-<p>Unstable things include:</p>
-
-<ul>
-<li>
-<p>Directory <code>sm_ruby_wrapper/</code>: a ruby wrapper for the <code>sm</code> C library. This wrapper is used for running some of the experiments. It is not documented and it needs tidying a little.</p>
-</li>
-
-<li>
-<p>Directory <code>rsm/</code>: a Ruby implementation of the same algorithms used in the <code>sm</code> library. Some times ago, the C and Matlab implementation were perfectly in sync. Now they differ a little. However, in the future I will try to get them back in sync, as the only way of having a good chance of making a bug-free implementation, is to make it twice.</p>
-</li>
-
-<li>
-<p>Directory <code>matlab/</code> and <code>matlab_new/</code>. The Matlab scripts are a mess that needs tidying. There&#8217;s a lot in there. They are kept here because they are used for creating some of the figures in the submitted papers. Also, the first PLICP implementation was written in Matlab and is buried there, somewhere.</p>
-
-<p>Also, I occasionally tried to make sure that the scripts run fine in <a href='http://www.octave.org'>Octave</a>. They do, except for the plotting.</p>
-</li>
-</ul>
-
-<h2 id='installation'><span class='maruku_section_number'>3. </span>Installation</h2>
-<!--
-### Downloading ###
-
-Download with SVN, using the following:
-
-	$ svn checkout --username ANTANI svn://net143-184.mclink.it/csm
-
-where `ANTANI` is your surname (you should have received a password). 
-
-This will checkout both the source code
-and some files used for experiments, that might be slightly slow to download.
-If you are only interested in  the source code, use:
-
-	$ svn checkout --username ANTANI svn://net143-184.mclink.it/csm/csm
--->
-<h3 id='required_software_dependencies'><span class='maruku_section_number'>3.1. </span>Required software dependencies</h3>
-
-<p>This software has been tested on Mac OS X, Linux, and Windows XP (using Cygwin). It compiles with GCC (3.3 or 4.x) and the Intel C++ Compiler (ICC).</p>
-
-<p>Required software:</p>
-
-<ul>
-<li>The build system is based on <code>cmake</code>, which is available at <a href='http://www.cmake.org/'>http://www.cmake.org/</a>.</li>
-
-<li>The GSL, Gnu Scientific Library, available at <a href='http://www.gnu.org/software/gsl/'>http://www.gnu.org/software/gsl/</a>.</li>
-
-<li>(optional) For <code>log2pdf</code> and other visualization applications, you will need the Cairo graphics library, available at <a href='http://cairographics.org'>http://cairographics.org</a>. The recommended version is the stable 1.4.12.</li>
-</ul>
-
-<p><strong>Linux</strong>. CMake, Cairo, and GSL are probably already packaged for your Linux distribution. For example, in Ubuntu, you can simply enter this command to install all dependencies:</p>
-
-<pre><code>$ sudo apt-get install build-essential cmake libgsl0-dev libcairo2-dev </code></pre>
-
-<p><strong>OS X</strong>. You can install GSL using <a href='http://finkproject.org/'>Fink</a>. You have to install Cairo manually.</p>
-
-<p><strong>Windows XP, using Cygwin</strong>. CSM runs fine on Cygwin, but very slow compared to Linux/OS X. Make sure you install the Cygwin packages <code>cairo</code>, <code>gsl</code>, <code>gsl-apps</code>, <code>gsl-devel</code>.</p>
-
-<p><strong>Windows XP, using Visual Studio</strong>. CSM doesn&#8217;t compile yet on this platform. CMake can theoretically create Visual Studio projects, but I could not manage to do it. Also, some CMake code is probably Unix-specific.</p>
-
-<h3 id='compiling'><span class='maruku_section_number'>3.2. </span>Compiling</h3>
-
-<p>If you are lucky, this should be it:</p>
-
-<pre><code>$ cmake .
-$ make</code></pre>
-
-<p>If you want to install this library system-wide, you could use:</p>
-
-<pre><code>$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .
-$ make 
-$ make install</code></pre>
-
-<p>as the first step.</p>
-
-<p>For installing the Ruby wrapper, refer to the separate instructions. If you want to use the Ruby wrapper, I suggest to install the source code in a <code>deploy</code> sub-directory of <code>csm</code>:</p>
-
-<pre><code>csm/
-	docs/
-	csm/
-	rsm/
-	deploy/     &lt;---  here</code></pre>
-
-<p>To do this, use:</p>
-
-<pre><code>$ cmake -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/deploy .
-$ make 
-$ make install</code></pre>
-
-<p>(you have to give a complete path to <code>-DCMAKE_INSTALL_PREFIX:PATH</code>).</p>
-
-<p>Later, remember to set your <code>PATH</code> variable to <code>csm/deploy/bin</code>.</p>
-
-<h3 id='getting_started'><span class='maruku_section_number'>3.3. </span>Getting started</h3>
-
-<p>You might get started by doing this:</p>
-
-<pre><code>$ sm2 &lt; in.log &gt; out.log</code></pre>
-
-<p>where <code>in.log</code> is a Carmen-format log file.</p>
-
-<p>You can find one in the top-level <code>experiments</code> directory: it is called <code>laserazosSM3.log</code>. So, if you installed the Cairo library, you can see the result with:</p>
-
-<pre><code>$ sm2 &lt; in.log &gt; out.log
-$ log2pdf -use odometry -in out.log -out out-odometry.pdf
-$ log2pdf -use estimate -in out.log -out out-estimate.pdf</code></pre>
-
-<h3 id='installing_ruby_libraries_and_wrapper_optional'><span class='maruku_section_number'>3.4. </span>Installing Ruby libraries and wrapper (optional)</h3>
-
-<p>This step-by-step guide is written by me, for me.</p>
-
-<p>Installing with cmake:</p>
-
-<pre><code>$ cmake . -DCMAKE_INSTALL_PREFIX:PATH=/usr/local</code></pre>
-
-<p>First, set up some directories</p>
-
-<pre><code>$ export SMLIB=
-$ cd $SMLIB
-$ ls 
-...................</code></pre>
-
-<p>Create installation directory:</p>
-
-<pre><code>$ mkdir deploy
-$ mkdir deploy/bin
-$ export PATH=$PATH $SMLIB/deploy/bin</code></pre>
-
-<p>Create a new ruby installation</p>
-
-<pre><code>$ mkdir my_ruby
-$ cd my_ruby</code></pre>
-
-<p>Download ruby:</p>
-
-<pre><code>$ wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz
-$ tar xvzf ruby-1.8.5.tar.gz 
-$ ./configure --prefix=$SMLIB/deploy
-$ make 
-$ make install</code></pre>
-
-<p>Now you should be able to use the new ruby installation</p>
-
-<pre><code>$ which ruby
-&lt;SMLIB&gt;/deploy/bin/ruby
-$ ruby --version
-ruby 1.8.5 (2006-08-25)</code></pre>
-
-<p>Instructions for installing rb-gsl:</p>
-
-<ol>
-<li>Get and install GSL. Make sure the command &#8220;gsl-config&#8221; is in command search path.</li>
-
-<li>Download Ruby/GSL, ungzip and untar the archive rb-gsl-xxx.tar.gz.</li>
-
-<li>Use: % cd rb-gsl-xxx/ % ruby setup.rb config % ruby setup.rb setup % ruby setup.rb install (as root)</li>
-</ol>
-
-<p>Download rubygems:</p>
-
-<pre><code>$ cd $SMLIB/my_ruby 
-$ wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
-$ tar xvzf rubygems-0.9.0.tgz
-$ cd rubygems-0.9.0
-$ ruby setup.rb</code></pre>
-
-<p>Now you should have the &#8220;gem&#8221; command installed:</p>
-
-<pre><code>$ which gem
-&lt;SMLIB&gt;/deploy/bin/gem</code></pre>
-<!--	
-/path/to/cmake . -DCMAKE_INSTALL_PREFIX:PATH=/path/to/install/to/scribuscmake/
-
-#export PKG_CONFIG_PATH=/Users/andrea/06MELANIA/censi-2006/Matlab-yasmine/deploy/lib/pkgconfig/ 
-       
--->
-<h2 id='the__data_structure'><span class='maruku_section_number'>4. </span>The <code>laser_data</code> data structure</h2>
-
-<p>Laser data is passed around in a structure which is quite rich and in some ways redundant to achieve ease of use.</p>
-
-<p>In C, the structure&#8217;s name is <code>struct laser_data</code>. In Ruby, it is <code>class LaserData</code>. In Matlab, it&#8217;s a generic structure.</p>
-
-<p>A description of the fields follows (assume the structure is called <code>ld</code>).</p>
-
-<p>Regarding the pose of the robot:</p>
-
-<dl>
-<dt><code>ld.true_pose</code></dt>
-
-<dd>Pose of the robot (m,m,rad), in world coordinates.</dd>
-
-<dt><code>ld.odometry</code></dt>
-
-<dd>Odometry (<code>true_pose</code> corrupted by noise).</dd>
-
-<dt><code>ld.estimate</code></dt>
-
-<dd>Estimate of <code>true_pose</code>.</dd>
-</dl>
-
-<p>Regarding the rays:</p>
-
-<dl>
-<dt><code>ld.nrays</code></dt>
-
-<dd>
-<p>Number of rays.</p>
-</dd>
-
-<dt><code>ld.min_theta</code> and <code>ld.max_theta</code></dt>
-
-<dd>
-<p>Minimum and maximum theta (radians).</p>
-</dd>
-
-<dt><code>ld.theta[i]</code></dt>
-
-<dd>
-<p>Direction of i-th ray with respect to the robot (radians).</p>
-</dd>
-
-<dt><code>ld.readings[i]</code></dt>
-
-<dd>
-<p>Sensor reading (meters). If the reading is not valid, then <code>ld.readings(i) == NAN</code>.</p>
-</dd>
-
-<dt><code>ld.valid[i]</code></dt>
-
-<dd>
-<p>In C, it assumes values <code>0</code> and <code>1</code>. In Ruby, it assumes values <code>true</code> or <code>false</code>. (<strong>TODO</strong>: choose how to serialize).</p>
-
-<p>This field is true if this ray is valid, and, in particular, <code>ld.readings[i]</code> is valid. Invalid rays occur when the obstacle is farther than the sensor horizon.</p>
-</dd>
-
-<dt><code>ld.true_alpha[i]</code></dt>
-
-<dd>
-<p>Orientation of the normal of the surface (radians, relative to robot). It is <code>NAN</code> if not valid.</p>
-</dd>
-
-<dt><code>ld.alpha[i]</code></dt>
-
-<dd>
-<p>Estimated orientation of the surface (radians, relative to robot). It is an estimate of <code>ld.true_alpha[i]</code>.</p>
-</dd>
-
-<dt><code>ld.alpha_valid[i]</code></dt>
-
-<dd>
-<p>True if previous field is valid.</p>
-</dd>
-
-<dt><code>ld.cov_alpha[i]</code></dt>
-
-<dd>
-<p>Estimated covariance of <code>ld.alpha[i]</code>.</p>
-</dd>
-</dl>
-
-<p>Additional fields used during the computation:</p>
-
-<dl>
-<dt><code>ld.cluster[i]</code></dt>
-
-<dd>Cluster to which point i belongs. This is used for computing the orientation (at the moment a really dumb algorithm is used for clustering). If <code>cluster[i] == -1</code>, the point does not belong to any cluster.</dd>
-
-<dt><code>ld.points[i].p</code></dt>
-
-<dd>Point coordinates (cartesian). Computed from the polar coordinates <code>theta[i]</code> and <code>readings[i]</code>.</dd>
-
-<dt><code>ld.points_w[i].p</code></dt>
-
-<dd>Point coordinates (cartesian) in a &#8220;world&#8221; reference frame. Computed with the function <code>ld_compute_world_coords(LDP, double pose[3])</code>.</dd>
-
-<dt><code>ld.hostname</code></dt>
-
-<dd>This is parsed from the Carmen data field.</dd>
-
-<dt><code>ld.tv</code></dt>
-
-<dd>This is a <code>struct timeval</code> field giving a timestamp for the laser scan. Please see the section on parsing to learn how this is parsed from the Carmen log.</dd>
-</dl>
-
-<h2 id='input_and_output_formats'><span class='maruku_section_number'>5. </span>Input and output formats</h2>
-
-<p>The library understands two formats: a rich JSON format, and the old good Carmen format.</p>
-
-<h3 id='the_json_log_format'><span class='maruku_section_number'>5.1. </span>The JSON log format</h3>
-
-<p>See this site: <a href='http://www.json.org'>http://www.json.org</a> for general information about JSON.</p>
-
-<p>This is a sample laser data structure. It has only 5 rays (which all happen to be invalid), and it has no <code>alpha</code>, <code>true_alpha</code>, <code>cluster</code> fields:</p>
-
-<pre><code>{ 
-  &quot;nrays&quot;: 5, 
-  &quot;min_theta&quot;: null, 
-  &quot;max_theta&quot;: null, 
-  &quot;theta&quot;:    [ null, null, null, null, null ],   
-  &quot;readings&quot;: [ null, null, null, null, null], 
-  &quot;valid&quot;:    [ 0, 0, 0, 0, 0],
-
-  &quot;odometry&quot;: [ null, null, null ], 
-  &quot;estimate&quot;: [ null, null, null ], 
-  &quot;true_pose&quot;: [ null, null, null ] 
-}</code></pre>
-
-<p>Note that <code>NAN</code> is represented with <code>null</code> in the JSON format.</p>
-
-<h3 id='the_carmen_log_format'><span class='maruku_section_number'>5.2. </span>The Carmen log format</h3>
-
-<p>The 6 pose values in the log are interpreted as follows:</p>
-
-<pre><code>estimate.x estimate.y estimate.theta ....
-odometry.x odometry.y odometry.theta </code></pre>
-<!--diego:
-	quindi tu alla fine
-	leggi il secondo campo
-	e scrivi il secondo campo
-	(e scrivi, per sicurezza, il primo campo)-->
-<h4 id='regarding_the_timestamp'><span class='maruku_section_number'>5.2.1. </span>Regarding the timestamp</h4>
-
-<p>Regarding the timestamp &#8220;fields&#8221;. The last three fields in a Carmen log can be:</p>
-
-<pre><code>integer   string   integer</code></pre>
-
-<p>This is interpreted as seconds, hostname, microseconds. This is good if you want to write a <code>timeval</code> struct to the log and <em>be sure</em> it won&#8217;t be modified by precision problems when writing, and parsing, as a <code>double</code>.</p>
-
-<p>If it doesn&#8217;t look like a timestamp, then it is assumed that the fields are:</p>
-
-<pre><code>double string double</code></pre>
-
-<p>In this case, the first double is interpreted as the timestamp in seconds, while the second double is discarded.</p>
-
-<p>The library will warn the user about these decisions by writing on the console this message:</p>
-
-<pre><code>sm2:inf: Reading timestamp as &#39;sec hostname usec&#39;.</code></pre>
-
-<p>or this one:</p>
-
-<pre><code>sm2:inf: Reading timestamp as doubles (discarding second one).</code></pre>
-
-<h2 id='examples'><span class='maruku_section_number'>6. </span>Examples</h2>
-
-<h3 id='simple_scan_matching'><span class='maruku_section_number'>6.1. </span>Simple scan matching</h3>
-
-<p>Simple scan-matching:</p>
-
-<pre><code>$ sm2 &lt; in.log &gt; out.log</code></pre>
-
-<p>where <code>in.log</code> may be in either Carmen or JSON format.</p>
-
-<h3 id='creating_a_pdf'><span class='maruku_section_number'>6.2. </span>Creating a PDF</h3>
-
-<p>Creating a PDF:</p>
-
-<pre><code>$ log2pdf -use odometry  -in in.log -out out_odometry.pdf
-$ log2pdf -use estimate  -in in.log -out out_estimate.pdf</code></pre>
-
-<h3 id='examining_one_particular_matching_video'><span class='maruku_section_number'>6.3. </span>Examining one particular matching (video)</h3>
-
-<p>To zoom on one particular matching, write a &#8220;journal&#8221; using the <code>-file_jj</code> option of <code>sm2</code>:</p>
-
-<pre><code>$ sm2 -file_jj journal.txt &lt; in.log &gt; out.log</code></pre>
-
-<p>Extract what you are interested in from the journal. In this example, the 13th matching:</p>
-
-<pre><code>$ json_extract -nth 13 &lt; journal.txt &gt; matching13.txt</code></pre>
-
-<p>Create the animation:</p>
-
-<pre><code>$ sm_animate -in matching13.txt</code></pre>
-
-<h3 id='help_icp_doesnt_work'><span class='maruku_section_number'>6.4. </span>Help! ICP doesn&#8217;t work</h3>
-
-<p>Actually, there are a million reasons for which it shouldn&#8217;t work. If it gives strange results, try the following:</p>
-
-<ol>
-<li>
-<p>Plot the data! Plot the input and plot the output using <code>log2pdf</code>.</p>
-</li>
-
-<li>
-<p>Plot the animation! Use the procedure above and inspect the resulting videos.</p>
-</li>
-
-<li>
-<p>Double-check the parameters you are using. Note that there are some like <code>max_correspondence_dist</code> which depend on the scale of your data. A value of 2m might work for a big robot making large movements, but not for a little Khepera.</p>
-</li>
-
-<li>
-<p>Smooth your data &#8211; if your sensor is very noisy, like an Hokuyo, it&#8217;s worth to do simple low-pass filtering. Especially for PLICP which uses the orientation information.</p>
-</li>
-</ol>
-
-<h2 id='embedding_csm_in_your_programs'><span class='maruku_section_number'>7. </span>Embedding CSM in your programs</h2>
-
-<h3 id='linking_to_csm'><span class='maruku_section_number'>7.1. </span>Linking to CSM</h3>
-
-<p>When CSM is installed, a <a href='http://pkg-config.freedesktop.org/wiki/'>pkgconfig</a> <code>csm.pc</code> file is installed as well. This makes it easy to link to CSM.</p>
-
-<p>For example, on my system, after installing CSM, I can run <code>pkgconfig</code> to get the C preprocessors and linker flags.</p>
-
-<p>This is what I get on my system (on yours, paths will be different, of course).</p>
-
-<pre><code> $ pkg-config --cflags csm  
-   -I/sw/include -I/Users/andrea/svn/cds/csm/deploy/include/cairo
-   -I/Users/andrea/svn/cds/csm/deploy/include
-
- $ pkg-config --libs csm 
-   -L/sw/lib -L/Users/andrea/svn/cds/csm/deploy/lib 
-   -lcsm-static -lgsl -lgslcblas -lm</code></pre>
-
-<p>If you use GNU Make, a basic Makefile for your program linking to CSM would be something like:</p>
-
-<pre><code>CSM_FLAGS=`pkg-config --libs --cflags csm`
-
-myprogram: myprogram.c
-	gcc $(CSM_FLAGS) -o myprogram myprogram.c</code></pre>
-
-<p>You can download the sources for this example in the repository (directory <code>docs/example-linking-make</code>).</p>
-
-<p>If you use <a href='http://www.cmake.org/'>CMake</a> &#8212; and you should! &#8212; it is reccomended that you use something like the following in your <code>CMakeLists.txt</code>.</p>
-
-<pre><code>cmake_minimum_required(VERSION 2.4)
-project(myproject)
-
-# Require we have pkgconfig installed
-find_package(PkgConfig REQUIRED)
-# Tell pkgconfig to look for CSM
-pkg_check_modules(CSM REQUIRED csm)
-
-IF(${CSM_FOUND})
-	MESSAGE(&quot;CSM_LIBRARY_DIRS: ${CSM_LIBRARY_DIRS}&quot;)
-	MESSAGE(&quot;CSM_LIBRARIES: ${CSM_LIBRARIES}&quot;)
-	MESSAGE(&quot;CSM_INCLUDE_DIRS: ${CSM_INCLUDE_DIRS}&quot;)
-
-	INCLUDE_DIRECTORIES(${CSM_INCLUDE_DIRS}) # important! 
-	LINK_DIRECTORIES(${CSM_LIBRARY_DIRS})    # important! 
-ELSE(${CSM_FOUND})	
-	MESSAGE(FATAL_ERROR &quot;CSM not found. Check that the environment \
-	variable PKG_CONFIG_PATH includes the path containing the file &#39;csm.pc&#39;.&quot;)
-ENDIF(${CSM_FOUND})		
-
-add_executable(myprogram myprogram.c)
-
-target_link_libraries(myprogram ${CSM_LIBRARIES}) # important! </code></pre>
-
-<p>You can download the sources for this example in the repository (directory <code>docs/example-linking-cmake</code>).</p>
-
-<h3 id='accessing_csm_functions_from_your_applications'><span class='maruku_section_number'>7.2. </span>Accessing CSM functions from your applications</h3>
-
-<p>All functions that you would be interested in using are accessible by including one header:</p>
-
-<pre><code>#include &lt;csm/csm_all.h&gt;</code></pre>
-
-<p>If you are linking from C++, as opposed to C, all functions are enclosed in the <code>CSM</code> namespace. Therefore, you need something like the following.</p>
-
-<pre><code>#include &lt;csm/csm_all.h&gt;
-using namespace CSM;</code></pre>
-
-<h3 id='orienting_oneself_in_the_source_code'><span class='maruku_section_number'>7.3. </span>Orienting oneself in the source code</h3>
-
-<p>The main function to call is the following:</p>
-
-<pre><code>void sm_icp(struct sm_params*params, struct sm_result*result);</code></pre>
-
-<p>This implements matching between two laser scans. All the applications discussed above (<code>sm1</code>, <code>sm2</code>, etc.) are essentially wrapper of <code>sm_icp</code>: they fill in the <code>params</code> structure, and read from the <code>result</code> structure.</p>
-
-<p>The <code>sm_params</code> structure is described in the <code>&lt;csm/algos.h&gt;</code> header file. It contains parameters for both ICP and other algorithms (like HSM; however, only (PL)ICP is considered stable in CSM)</p>
-
-<p>Note that many of the parameters greatly influence the behavior of PLICP, so it is worth reading them all. If you run <code>sm2 -help</code> you will see the default values, which are reasonable as a starting point.</p>
-
-<p>We now briefly discuss the main parameters.</p>
-
-<ul>
-<li><code>params-&gt;laser_ref</code>: pointer of a structure of type <code>laser_data</code> (described before in this document) representing the &#8220;ref&#8221;erence scan (first scan).</li>
-
-<li><code>params-&gt;laser_sens</code>: pointer of a structure of type <code>laser_data</code> representing the second scan.</li>
-
-<li><code>params-&gt;first_guess</code>: first guess (x,y,theta).</li>
-
-<li><code>use_point_to_line_distance</code>: 1 for PLICP, 0 for ICP.</li>
-
-<li><code>use_corr_tricks</code>: use the tricks described in the PLICP paper.</li>
-</ul>
-
-<p>Parameters that influence stopping and restarting:</p>
-
-<ul>
-<li><code>max_iterations</code>: maximum number of iterations</li>
-
-<li><code>epsilon_xy</code>, <code>epsilon_theta</code>: stop if change below these thresholds</li>
-
-<li><code>restart*</code>: whether to add some noise and restart if the match is not satisfactory. Useful for getting out of local minima but expensive.</li>
-</ul>
-
-<p>Parameters that influence correspondence establishment:</p>
-
-<ul>
-<li><code>max_angular_correction_deg</code>, <code>max_linear_correction</code>.</li>
-
-<li><code>max_correspondence_dist</code></li>
-</ul>
-
-<p>Parameters that influence correspondence pruning:</p>
-
-<ul>
-<li><code>outliers_maxPerc</code></li>
-
-<li><code>outliers_adaptive_*</code></li>
-
-<li><code>outliers_remove_doubles</code></li>
-</ul>
-
-<p>See the file <code>&lt;csm/algos.h&gt;</code> for a description of the above parameters, and the other minor parameters.</p>
-</body></html>
diff --git a/csm_manual.pdf b/csm_manual.pdf
deleted file mode 100644
index 9701afe5ea5362037d70972280b02fab7b9692db..0000000000000000000000000000000000000000
Binary files a/csm_manual.pdf and /dev/null differ
diff --git a/docs/Makefile b/docs/Makefile
deleted file mode 100644
index e1457cd191a231ecb46cacf98ece47348e609dfe..0000000000000000000000000000000000000000
--- a/docs/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-
-#maruku=ruby -I~/maruku/lib ~/maruku/bin/maruku
-maruku=maruku
-
-out=csm_manual.pdf csm_manual.html
-
-all: $(out)
-	cp $(out) ..
-
-src=\
-  preamble.txt \
-  inline_style.css \
-  readme.txt \
-  install.txt \
-  install-ruby.txt \
-  laserdata.txt \
-  formats.txt \
-  examples.txt \
-  embedding.txt
-
-
-%: tmp_%
-	cp $< $@
-
-csm_manual.txt: $(src)
-	cat $^ > $@
-
-%.pdf: %.txt
-	$(maruku) --pdf -o $@ $<
-
-%.html: %.txt
-	$(maruku) --html $<
-
-clean: 
-	rm $(out)
-	
-copy: out/csm_manual.html
-	cp $< ../CSM_MANUAL.html
-
diff --git a/docs/TODO.txt b/docs/TODO.txt
deleted file mode 100644
index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000
--- a/docs/TODO.txt
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/docs/description.lyx b/docs/description.lyx
deleted file mode 100644
index 3ccd224ef03aa4be8e7b454ea3331e90c928a5a1..0000000000000000000000000000000000000000
--- a/docs/description.lyx
+++ /dev/null
@@ -1,167 +0,0 @@
-#LyX 1.4.2 created this file. For more info see http://www.lyx.org/
-\lyxformat 245
-\begin_document
-\begin_header
-\textclass article
-\language english
-\inputencoding auto
-\fontscheme default
-\graphics default
-\paperfontsize default
-\papersize default
-\use_geometry false
-\use_amsmath 1
-\cite_engine basic
-\use_bibtopic false
-\paperorientation portrait
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\defskip medskip
-\quotes_language english
-\papercolumns 1
-\papersides 1
-\paperpagestyle default
-\tracking_changes false
-\output_changes false
-\end_header
-
-\begin_body
-
-\begin_layout Section
-HSM
-\end_layout
-
-\begin_layout Standard
-Filtering orientation
-\end_layout
-
-\begin_layout Standard
-\begin_inset Formula \[
-f'(\theta_{0})=\frac{f(\theta_{i})-f(\theta_{0})}{\theta_{i}-\theta_{0}}+f''(\xi)\frac{\left(\theta_{i}-\theta_{0}\right)^{2}}{2}\]
-
-\end_inset
-
-
-\begin_inset Formula \[
-f'(\theta_{0})=\frac{\rho_{i}-\rho_{0}}{\theta_{i}-\theta_{0}}+\left(\frac{1}{\theta_{i}-\theta_{0}}\right)\epsilon_{i}+\left(\frac{-1}{\theta_{i}-\theta_{0}}\right)\epsilon_{0}+\frac{\left(\theta_{i}-\theta_{0}\right)^{2}}{2}c_{i}\]
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-\begin_inset Formula \[
-Y=LX+R\epsilon\]
-
-\end_inset
-
-
-\begin_inset Formula \[
-Y=\left[\begin{array}{c}
-\frac{\rho_{1}-\rho_{0}}{\theta_{1}-\theta_{0}}\\
-\vdots\\
-\frac{\rho_{n}-\rho_{0}}{\theta_{n}-\theta_{0}}\end{array}\right]\quad\qquad L=\left[\begin{array}{c}
-1\\
-\vdots\\
-1\end{array}\right]\quad X=f'(\theta_{0})\qquad R\epsilon=\left[\begin{array}{cccc}
-\frac{-1}{\theta_{1}-\theta_{0}} & \frac{1}{\theta_{1}-\theta_{0}} & 0 & 0\\
-\vdots &  & \ddots\\
-\frac{-1}{\theta_{n}-\theta_{0}} & 0 & 0 & \frac{1}{\theta_{n}-\theta_{0}}\end{array}\right]\left[\begin{array}{c}
-\underbar{\epsilon_{0}}\\
-\epsilon_{1}\\
-\vdots\\
-\epsilon_{n}\end{array}\right]\]
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-\begin_inset Formula \[
-\alpha=\theta_{0}-\mbox{atan}\left(\frac{f'(\theta_{0})}{f(\theta_{0})}\right)\]
-
-\end_inset
-
-
-\begin_inset Formula \[
-\frac{\partial\alpha}{\partial f'}=\frac{1}{1+\left(f'/f\right)^{2}}\frac{1}{f}=\frac{f}{f^{2}+f'^{2}}\]
-
-\end_inset
-
-
-\begin_inset Formula \[
-\frac{\partial\alpha}{\partial f}=\frac{1}{1+\left(f'/f\right)^{2}}\frac{-f'}{f^{2}}=\frac{-f'}{f^{2}+f'^{2}}\]
-
-\end_inset
-
-
-\family roman
-\series medium
-\shape up
-\size normal
-\emph off
-\bar no
-\noun off
-\color none
-
-\backslash
-frac{f}{f^{2}+f'^{2}}
-\end_layout
-
-\begin_layout Section
-ICP
-\end_layout
-
-\begin_layout Subsection
-Tricks
-\end_layout
-
-\begin_layout Standard
-Tutti esatti
-\end_layout
-
-\begin_layout Subsubsection
-The from-to trick
-\end_layout
-
-\begin_layout Subsubsection
-Going up and going down
-\end_layout
-
-\begin_layout Subsubsection
-Start at last cell
-\end_layout
-
-\begin_layout Subsubsection
-Early stop
-\end_layout
-
-\begin_layout Subsubsection
-Use jumps
-\end_layout
-
-\begin_layout Subsection
-Code optimizations
-\end_layout
-
-\begin_layout Standard
-no sin() con tables o similari
-\end_layout
-
-\begin_layout Subsection
-Minimizzazione
-\end_layout
-
-\begin_layout Subsection
-Trimming
-\end_layout
-
-\begin_layout Section
-Evolution
-\end_layout
-
-\end_body
-\end_document
diff --git a/docs/embedding.txt b/docs/embedding.txt
deleted file mode 100644
index b647c28f3a5e5205e8562aca469b1c370adae7e0..0000000000000000000000000000000000000000
--- a/docs/embedding.txt
+++ /dev/null
@@ -1,133 +0,0 @@
-
-## Embedding CSM in your programs ##
-
-### Linking to CSM ###
-
-When CSM is installed, a [pkgconfig] ``csm.pc`` file is installed as well.
-This makes it easy to link to CSM. 
-
-[pkgconfig]: http://pkg-config.freedesktop.org/wiki/
-
-For example, on my system, after installing CSM, I can run ``pkgconfig`` to
-get the C preprocessors and linker flags.
-
-This is what I get on my system (on yours, paths will be different, of course).
-
-     $ pkg-config --cflags csm  
-       -I/sw/include -I/Users/andrea/svn/cds/csm/deploy/include/cairo
-       -I/Users/andrea/svn/cds/csm/deploy/include
-
-     $ pkg-config --libs csm 
-       -L/sw/lib -L/Users/andrea/svn/cds/csm/deploy/lib 
-       -lcsm-static -lgsl -lgslcblas -lm
-
-If you use GNU Make, a basic Makefile for your program linking to CSM
-would be something like:
-
-	CSM_FLAGS=`pkg-config --libs --cflags csm`
-
-	myprogram: myprogram.c
-		gcc $(CSM_FLAGS) -o myprogram myprogram.c
-
-You can download the sources for this example in the repository (directory `docs/example-linking-make`).
-
-If you use [CMake] --- and you should! --- it is reccomended that 
-you use something like the following in your ``CMakeLists.txt``.
-
-	cmake_minimum_required(VERSION 2.4)
-	project(myproject)
-
-	# Require we have pkgconfig installed
-	find_package(PkgConfig REQUIRED)
-	# Tell pkgconfig to look for CSM
-	pkg_check_modules(CSM REQUIRED csm)
-
-	IF(${CSM_FOUND})
-		MESSAGE("CSM_LIBRARY_DIRS: ${CSM_LIBRARY_DIRS}")
-		MESSAGE("CSM_LIBRARIES: ${CSM_LIBRARIES}")
-		MESSAGE("CSM_INCLUDE_DIRS: ${CSM_INCLUDE_DIRS}")
-
-		INCLUDE_DIRECTORIES(${CSM_INCLUDE_DIRS}) # important! 
-		LINK_DIRECTORIES(${CSM_LIBRARY_DIRS})    # important! 
-	ELSE(${CSM_FOUND})	
-		MESSAGE(FATAL_ERROR "CSM not found. Check that the environment \
-		variable PKG_CONFIG_PATH includes the path containing the file 'csm.pc'.")
-	ENDIF(${CSM_FOUND})		
-
-	add_executable(myprogram myprogram.c)
-
-	target_link_libraries(myprogram ${CSM_LIBRARIES}) # important! 
-
-You can download the sources for this example in the repository (directory `docs/example-linking-cmake`).
-
-[CMake]: http://www.cmake.org/
-
-
-### Accessing CSM functions from your applications ###
-
-All functions that you would be interested in using are accessible by including one header:
-
-	#include <csm/csm_all.h>
-
-If you are linking from C++, as opposed to C, all functions are enclosed
-in the `CSM` namespace. Therefore, you need something like the following.
-
-	#include <csm/csm_all.h>
-	using namespace CSM;
-
-
-### Orienting oneself in the source code ###
-
-The main function to call is the following:
-
-	void sm_icp(struct sm_params*params, struct sm_result*result);
-
-This implements matching between two laser scans.
-All the applications discussed above (``sm1``, ``sm2``, etc.) are essentially
-wrapper of ``sm_icp``: they fill in the ``params`` structure, and read from the ``result`` structure.
-
-The ``sm_params`` structure is described in the ``<csm/algos.h>`` header file.
-It contains parameters for both ICP and other algorithms (like HSM; however, only (PL)ICP is considered stable in CSM)
-
-Note that many of the parameters greatly influence the behavior of PLICP, so it
-is worth reading them all. If you run ``sm2 -help`` you will see the default
-values, which are reasonable as a starting point.
-
-We now briefly discuss the main parameters.
-	
-* ``params->laser_ref``:  pointer of a structure of type ``laser_data`` (described before in this document) representing
-   the "ref"erence scan (first scan).
-* ``params->laser_sens``:  pointer of a structure of type ``laser_data`` representing
-   the second scan.
-* ``params->first_guess``: first guess (x,y,theta).
-* ``use_point_to_line_distance``: 1 for PLICP, 0 for ICP.
-* ``use_corr_tricks``: use the tricks described in the PLICP paper.
-
-Parameters that influence stopping and restarting:
-
-* ``max_iterations``: maximum number of iterations
-* ``epsilon_xy``, ``epsilon_theta``: stop if change below these thresholds
-* ``restart*``: whether to add some noise and restart if the match
-  is not satisfactory. Useful for getting out of local minima but
-  expensive.
-
-Parameters that influence correspondence establishment:
-
-* ``max_angular_correction_deg``, ``max_linear_correction``.
-* ``max_correspondence_dist``
-
-Parameters that influence correspondence pruning:
-
-* ``outliers_maxPerc``
-* ``outliers_adaptive_*``
-* ``outliers_remove_doubles``
-
-See the file ``<csm/algos.h>`` for a description of the above parameters,
-and the other minor parameters.
-
-
-
-
-
-
-
diff --git a/docs/example-linking-cmake/CMakeLists.txt b/docs/example-linking-cmake/CMakeLists.txt
deleted file mode 100644
index c9bae75c14e085cf5b6befc4b46cd45c521f80a7..0000000000000000000000000000000000000000
--- a/docs/example-linking-cmake/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-cmake_minimum_required(VERSION 2.4)
-project(myproject)
-
-# Require we have pkgconfig installed
-find_package(PkgConfig REQUIRED)
-# Tell pkgconfig to look for CSM
-pkg_check_modules(CSM REQUIRED csm)
-
-IF(${CSM_FOUND})
-	MESSAGE("CSM_LIBRARY_DIRS: ${CSM_LIBRARY_DIRS}")
-	MESSAGE("CSM_LIBRARIES: ${CSM_LIBRARIES}")
-	MESSAGE("CSM_INCLUDE_DIRS: ${CSM_INCLUDE_DIRS}")
-
-	INCLUDE_DIRECTORIES(${CSM_INCLUDE_DIRS}) # important! 
-	LINK_DIRECTORIES(${CSM_LIBRARY_DIRS})    # important! 
-ELSE(${CSM_FOUND})	
-	MESSAGE(FATAL_ERROR "CSM not found. Check that the environment variable PKG_CONFIG_PATH includes the path containing the file 'csm.pc'.")
-ENDIF(${CSM_FOUND})		
-
-add_executable(myprogram myprogram.c)
-
-target_link_libraries(myprogram ${CSM_LIBRARIES}) # important! 
-
diff --git a/docs/example-linking-cmake/myprogram.c b/docs/example-linking-cmake/myprogram.c
deleted file mode 100644
index d07f1f0578faaa77ff445aa05b712731be763967..0000000000000000000000000000000000000000
--- a/docs/example-linking-cmake/myprogram.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <csm/csm_all.h>
-
-int main() {
-	
-}
\ No newline at end of file
diff --git a/docs/example-linking-make/Makefile b/docs/example-linking-make/Makefile
deleted file mode 100644
index c32cba3f7d83b5aa12f947b01a1025e633364c43..0000000000000000000000000000000000000000
--- a/docs/example-linking-make/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-CSM_FLAGS=`pkg-config --libs --cflags csm`
-
-myprogram: myprogram.c
-	gcc $(CSM_FLAGS) -o myprogram myprogram.c
diff --git a/docs/example-linking-make/myprogram.c b/docs/example-linking-make/myprogram.c
deleted file mode 100644
index d07f1f0578faaa77ff445aa05b712731be763967..0000000000000000000000000000000000000000
--- a/docs/example-linking-make/myprogram.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <csm/csm_all.h>
-
-int main() {
-	
-}
\ No newline at end of file
diff --git a/docs/examples.txt b/docs/examples.txt
deleted file mode 100644
index 0b4321f413c863a937fdcec2840cfdd33bc646da..0000000000000000000000000000000000000000
--- a/docs/examples.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-
-## Examples ##
-
-
-### Simple scan matching ###
-
-Simple scan-matching:
-
-	$ sm2 < in.log > out.log
-
-where `in.log` may be in either Carmen or JSON format.
-
-### Creating a PDF ###
-
-Creating a PDF:
-
-	$ log2pdf -use odometry  -in in.log -out out_odometry.pdf
-	$ log2pdf -use estimate  -in in.log -out out_estimate.pdf
-
-### Examining one particular matching (video) ###
-
-To zoom on one particular matching, write a "journal"
-using the `-file_jj` option of `sm2`:
-
-	$ sm2 -file_jj journal.txt < in.log > out.log
-
-Extract what you are interested in from the journal.
-In this example, the 13th matching:
-
-	$ json_extract -nth 13 < journal.txt > matching13.txt
-
-Create the animation:
-
-	$ sm_animate -in matching13.txt
-
-### Help! ICP doesn't work ###
-
-Actually, there are a million reasons for which it shouldn't work.
-If it gives strange results, try the following:
-
-1. Plot the data! Plot the input and plot the output using `log2pdf`.
-
-2. Plot the animation! Use the procedure above and inspect the resulting videos.
-
-3. Double-check the parameters you are using. Note that there are some like
-   `max_correspondence_dist` which depend on the scale of your data. A value
-   of 2m might work for a big robot making large movements, but not for a little
-   Khepera.
-
-4. Smooth your data -- if your sensor is very noisy, like an Hokuyo, it's worth
-   to do simple low-pass filtering. Especially for PLICP which uses the orientation
-   information.
-
-
-
-
-
-
-
-
diff --git a/docs/formats.txt b/docs/formats.txt
deleted file mode 100644
index a8da310f92dc1b5cfa6fd6b560e47d8cf822dfde..0000000000000000000000000000000000000000
--- a/docs/formats.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-Input and output formats
-------------------------
-
-The library understands two formats: a rich JSON format, and the old good Carmen format.
-
-### The JSON log format ###
-
-See this site: <http://www.json.org> for general information about JSON.
-
-This is a sample laser data structure. It has only 5 rays (which all
-happen to be invalid), and it has no `alpha`, `true_alpha`, `cluster` fields:
-
-	{ 
-	  "nrays": 5, 
-	  "min_theta": null, 
-	  "max_theta": null, 
-	  "theta":    [ null, null, null, null, null ],   
-	  "readings": [ null, null, null, null, null], 
-	  "valid":    [ 0, 0, 0, 0, 0],
-
-	  "odometry": [ null, null, null ], 
-	  "estimate": [ null, null, null ], 
-	  "true_pose": [ null, null, null ] 
-	}
-
-Note that `NAN` is represented with `null` in the JSON format.
-
-
-### The Carmen log format ###
-
-The 6 pose values in the log are interpreted as follows:
-
-	estimate.x estimate.y estimate.theta ....
-	odometry.x odometry.y odometry.theta 
-
-<!--diego:
-	quindi tu alla fine
-	leggi il secondo campo
-	e scrivi il secondo campo
-	(e scrivi, per sicurezza, il primo campo)-->
-
-#### Regarding the timestamp ####	
-	
-Regarding the timestamp "fields". The last three fields in a Carmen log can be:
-
-	integer   string   integer
-
-This is interpreted as seconds, hostname, microseconds. This is good if you want to write a `timeval` struct to the log and *be sure* it won't be modified by precision problems when writing, and parsing, as a `double`.
-
-If it doesn't look like a timestamp, then it is assumed that the fields are:
-
-	double string double
-
-In this case, the first double is interpreted as the timestamp in seconds, while the second double is discarded.
-
-The library will warn the user about these decisions by writing on the console this message:
-
-	sm2:inf: Reading timestamp as 'sec hostname usec'.
-
-or this one:
-
-	sm2:inf: Reading timestamp as doubles (discarding second one).
-
diff --git a/docs/inline_style.css b/docs/inline_style.css
deleted file mode 100644
index 4e66f2db32b00c48c5dab52ad23441ad90b6805e..0000000000000000000000000000000000000000
--- a/docs/inline_style.css
+++ /dev/null
@@ -1,16 +0,0 @@
-
-<style>
-body { padding-left: 3em;}
-body p, body ul { max-width: 35em;}
-pre { margin-left: 2em; background-color: #bbf; border: solid 1px black;
-	padding: 10px;}
-	
-code { background-color: #ddf; padding: 3px; color: #008;}
-pre code { background-color: #bbf;}
-p, pre { max-width: 40em; }
-h2 { 
-	border-left: solid 2px #b00; 
-	border-top: solid 2px #b00; 
-	margin-top: 4em;
-	padding: 1em; margin-left: -1em;}
-</style>
diff --git a/docs/install-ruby.txt b/docs/install-ruby.txt
deleted file mode 100644
index b653299bb5927af11cc7a54ea8320a2f41d94672..0000000000000000000000000000000000000000
--- a/docs/install-ruby.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-### Installing Ruby libraries and wrapper (optional) ###
-
-This step-by-step guide is written by me, for me.
-
-Installing with cmake:
-
-	$ cmake . -DCMAKE_INSTALL_PREFIX:PATH=/usr/local
-
-First, set up some directories
- 
-	$ export SMLIB=
-	$ cd $SMLIB
-	$ ls 
-	...................
-
-Create installation directory:
-
-	$ mkdir deploy
-	$ mkdir deploy/bin
-	$ export PATH=$PATH $SMLIB/deploy/bin
-	
-Create a new ruby installation
-
-	$ mkdir my_ruby
-	$ cd my_ruby
-
-Download ruby:
-
-	$ wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz
-	$ tar xvzf ruby-1.8.5.tar.gz 
-	$ ./configure --prefix=$SMLIB/deploy
-	$ make 
-	$ make install
-
-Now you should be able to use the new ruby installation
-
-	$ which ruby
-	<SMLIB>/deploy/bin/ruby
-	$ ruby --version
-	ruby 1.8.5 (2006-08-25)
-
-Instructions for installing rb-gsl:
-
-1. Get and install GSL. Make sure the command "gsl-config" is in command search path.
-2. Download Ruby/GSL, ungzip and untar the archive rb-gsl-xxx.tar.gz.
-3.	Use:
-		% cd rb-gsl-xxx/
-		% ruby setup.rb config
-		% ruby setup.rb setup
-		% ruby setup.rb install (as root)
-
-Download rubygems:
-
-	$ cd $SMLIB/my_ruby 
-	$ wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
-	$ tar xvzf rubygems-0.9.0.tgz
-	$ cd rubygems-0.9.0
-	$ ruby setup.rb
-	
-Now you should have the "gem" command installed:
-
-	$ which gem
-	<SMLIB>/deploy/bin/gem
-	
-	
-<!--	
-/path/to/cmake . -DCMAKE_INSTALL_PREFIX:PATH=/path/to/install/to/scribuscmake/
-
-#export PKG_CONFIG_PATH=/Users/andrea/06MELANIA/censi-2006/Matlab-yasmine/deploy/lib/pkgconfig/ 
-       
--->
\ No newline at end of file
diff --git a/docs/install.txt b/docs/install.txt
deleted file mode 100644
index 9e1f9b00c62edb9abc8e5b9e43a051addd27d27d..0000000000000000000000000000000000000000
--- a/docs/install.txt
+++ /dev/null
@@ -1,96 +0,0 @@
-
-Installation
-------------
-
-<!--
-### Downloading ###
-
-Download with SVN, using the following:
-
-	$ svn checkout --username ANTANI svn://net143-184.mclink.it/csm
-
-where `ANTANI` is your surname (you should have received a password). 
-
-This will checkout both the source code
-and some files used for experiments, that might be slightly slow to download.
-If you are only interested in  the source code, use:
-
-	$ svn checkout --username ANTANI svn://net143-184.mclink.it/csm/csm
--->
-
-### Required software dependencies ###
-
-This software has been tested on Mac OS X, Linux, and Windows XP (using Cygwin).
-It compiles with GCC (3.3 or 4.x) and the Intel C++ Compiler (ICC).
-
-Required software:
-* The build system is based on `cmake`, which is available at <http://www.cmake.org/>.
-* The GSL, Gnu Scientific Library, available at <http://www.gnu.org/software/gsl/>.
-* (optional) For `log2pdf` and other visualization applications, you will need the Cairo graphics library, available at <http://cairographics.org>. The recommended version is the stable 1.4.12.
-
-**Linux**. CMake, Cairo, and GSL are probably already packaged for your Linux distribution. For example, in Ubuntu, you can simply enter this command to install all dependencies:
-
-	$ sudo apt-get install build-essential cmake libgsl0-dev libcairo2-dev 
-
-**OS X**. You can install GSL using [Fink](http://finkproject.org/). You have to install Cairo manually. 
-
-**Windows XP, using Cygwin**. CSM runs fine on Cygwin, but very slow compared to Linux/OS X.
-Make sure you install the Cygwin packages `cairo`, `gsl`, `gsl-apps`, `gsl-devel`.
-
-**Windows XP, using Visual Studio**. CSM doesn't compile yet on this platform. CMake can theoretically create
-Visual Studio projects, but I could not manage to do it. Also, some CMake code is probably Unix-specific.
-
-### Compiling ###
-
-If you are lucky, this should be it:
-
-	$ cmake .
-	$ make
-
-If you want to install this library system-wide, you could use:
-
-	$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .
-	$ make 
-	$ make install
-
-as the first step.
-
-
-For installing the Ruby wrapper, refer to the separate instructions.
-If you want to use the Ruby wrapper, I suggest to install the source
-code in a `deploy` sub-directory of `csm`:
-
-	csm/
-		docs/
-		csm/
-		rsm/
-		deploy/     <---  here
-
-To do this, use:
-
-	$ cmake -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/deploy .
-	$ make 
-	$ make install
-
-(you have to give a complete path to `-DCMAKE_INSTALL_PREFIX:PATH`).
-
-Later, remember to set your `PATH` variable to `csm/deploy/bin`. 
-
-### Getting started ###
-
-You might get started by doing this:
-
-	$ sm2 < in.log > out.log
-
-where `in.log` is a Carmen-format log file. 
-
-You can find one in the top-level `experiments` directory: it is called `laserazosSM3.log`.
-So, if you installed the Cairo library, you can see the result with:
-
-	$ sm2 < in.log > out.log
-	$ log2pdf -use odometry -in out.log -out out-odometry.pdf
-	$ log2pdf -use estimate -in out.log -out out-estimate.pdf
-
-
-
-
diff --git a/docs/laserdata.lyx b/docs/laserdata.lyx
deleted file mode 100644
index 25afd35b2cd4d25edec871d0aa341a691ff3dbdf..0000000000000000000000000000000000000000
--- a/docs/laserdata.lyx
+++ /dev/null
@@ -1,285 +0,0 @@
-#LyX 1.4.4 created this file. For more info see http://www.lyx.org/
-\lyxformat 245
-\begin_document
-\begin_header
-\textclass article
-\begin_preamble
-\usepackage{verbatim}
-\end_preamble
-\language english
-\inputencoding auto
-\fontscheme default
-\graphics default
-\paperfontsize default
-\spacing single
-\papersize default
-\use_geometry false
-\use_amsmath 1
-\cite_engine basic
-\use_bibtopic false
-\paperorientation portrait
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation indent
-\defskip medskip
-\quotes_language english
-\papercolumns 1
-\papersides 1
-\paperpagestyle default
-\tracking_changes false
-\output_changes false
-\end_header
-
-\begin_body
-
-\begin_layout Section
-The laser data data structure
-\end_layout
-
-\begin_layout Standard
-Laser data is passed around in a Matlab structure, which is quite rich and
- in some ways redundant to achieve ease of use.
- 
-\end_layout
-
-\begin_layout Standard
-A description of the fields follows.
-\end_layout
-
-\begin_layout Description
-
-\family typewriter
-ld.nrays
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-Number of rays.
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.theta(i)
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-Direction of 
-\begin_inset Formula $i$
-\end_inset
-
--th ray with respect to the robot.
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.readings(i)
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-Sensor reading (meters).
- If the reading is not valid, then 
-\family typewriter
-ld.readings(i) == nan
-\family default
-.
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.readings_valid(i)\InsetSpace ~
-or\InsetSpace ~
-ld.valid(i)
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-This field is true if this ray is valid.
- Invalid rays occur when the obstacle is farther than the sensor horizon.
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.true_alpha(i)
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-Orientation of the surface (radians, relative to robot).
- It is
-\family typewriter
- nan 
-\family default
-if not valid.
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.true_alpha_abs(i)
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-(eliminated in new version) Orientation of the surface (radians, relative
- to 
-\series bold
-world
-\series default
-).
- It is
-\family typewriter
- nan 
-\family default
-if not valid.
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.alpha(i)
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-Estimated orientation of the surface (radians, relative to robot).
- It is an estimation of ld.true_alpha(i)
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.alpha_valid(i)
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-True if previous field is valid.
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.alpha_error(i)
-\end_layout
-
-\begin_layout Standard
-True if previous field is valid.
-\end_layout
-
-\begin_layout Description
-
-\family typewriter
-ld.true_pose
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-Pose of the robot (m,m,rad), in world coordinates.
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.odometry
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-Corrupted true_pose.
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.estimate
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-Estimate of true_pose.
-\end_layout
-
-\end_deeper
-\begin_layout Description
-
-\family typewriter
-ld.points
-\end_layout
-
-\begin_layout Description
-
-\family typewriter
-ld.hostname
-\end_layout
-
-\begin_layout Description
-
-\family typewriter
-ld.timestamp1,\InsetSpace ~
-ld.timestamp2
-\end_layout
-
-\begin_layout Section
-Featured functions
-\end_layout
-
-\begin_layout Description
-ld_fisher This function computes Fisher's information matrix, in robot coordinat
-es.
- 
-\end_layout
-
-\begin_deeper
-\begin_layout Standard
-Uses field 'true_alpha' (and 'theta', 'readings').
- 
-\end_layout
-
-\begin_layout Standard
-For details about the Fisher's information matrix for localization, please
- see this paper: http://purl.org/censi/2006/accuracy
-\end_layout
-
-\end_deeper
-\begin_layout Standard
-Available as matlab function 
-\emph on
-ld_fisher0.m
-\emph default
-, C function ld
-\emph on
-_
-\emph default
-fisher0 and command line ld_fisher.
-\end_layout
-
-\begin_layout Section
-Other utilities
-\end_layout
-
-\begin_layout Subsection
-Reading from file
-\end_layout
-
-\begin_layout Subsection
-Displaying laserdata
-\end_layout
-
-\end_body
-\end_document
diff --git a/docs/laserdata.txt b/docs/laserdata.txt
deleted file mode 100644
index 5ad81d1618fa0376e1dcac5c1da10ee325dd13cc..0000000000000000000000000000000000000000
--- a/docs/laserdata.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-
-## The `laser_data` data structure ##
-
-Laser data is passed around in a structure which is quite 
-rich and in some ways redundant to achieve ease of use. 
-
-In C, the structure's name is `struct laser_data`. In Ruby,
-it is `class LaserData`. In Matlab, it's a generic structure.
-
-A description of the fields follows (assume the structure is 
-called `ld`).
-
-Regarding the pose of the robot:
-
-`ld.true_pose`
-: Pose of the robot (m,m,rad), in world coordinates.
-
-`ld.odometry`
-: Odometry (`true_pose` corrupted by noise).
-
-`ld.estimate`
-: Estimate of `true_pose`.
-
-Regarding the rays:
-
-`ld.nrays`
-: Number of rays.
-
-`ld.min_theta` and `ld.max_theta`
-: Minimum and maximum theta (radians).
-
-`ld.theta[i]`
-: Direction of i-th ray with respect to the robot (radians).
-
-`ld.readings[i]`
-: Sensor reading (meters). If the reading is not valid, 
-  then `ld.readings(i) == NAN`.
-
-`ld.valid[i]`
-:	In C, it assumes values `0` and `1`. 
-	In Ruby, it assumes values `true` or `false`.
-	(**TODO**: choose how to serialize).
-
-	This field is true if this ray is valid, and, in particular,
-	`ld.readings[i]` is valid. Invalid rays 
-	occur when the obstacle is farther than the sensor horizon.
-
-`ld.true_alpha[i]`
-: Orientation of the normal of the surface (radians, relative to 
-robot). It is `NAN` if not valid.
-
-`ld.alpha[i]`
-: Estimated orientation of the surface (radians, 
-relative to robot). It is an estimate of `ld.true_alpha[i]`.
-
-`ld.alpha_valid[i]`
-:  True if previous field is valid.
-
-`ld.cov_alpha[i]`
-: Estimated covariance of `ld.alpha[i]`.
-
-Additional fields used during the computation:
-
-`ld.cluster[i]`
-: Cluster to which point i belongs. This is used for computing
-the orientation (at the moment a really dumb algorithm is used
-for clustering). If `cluster[i] == -1`, the point does not belong
-to any cluster.
-
-`ld.points[i].p`
-: Point coordinates (cartesian). Computed from the polar coordinates
-`theta[i]` and `readings[i]`.
-
-`ld.points_w[i].p`
-: Point coordinates (cartesian) in a "world" reference frame. Computed with the function `ld_compute_world_coords(LDP, double pose[3])`.
-
-`ld.hostname`
-: This is parsed from the Carmen data field.
-
-`ld.tv`
-: This is a `struct timeval` field giving a timestamp for the laser scan. Please see the section on parsing to learn how this is parsed from the Carmen log.
-
-
diff --git a/docs/misc.txt b/docs/misc.txt
deleted file mode 100644
index 6100344ff93453ca1a2f05b3bd4b9aec9a7794fc..0000000000000000000000000000000000000000
--- a/docs/misc.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Installing GSL:
-
-	export CFLAGS="-Wno-long-double -mtune=7450 -mcpu=7450  -fomit-frame-pointer -O3";     ./configure --disable-shared --prefix=/Volumes/Alter/07repo/csm/csm/deploy
\ No newline at end of file
diff --git a/docs/optimization-notes.txt b/docs/optimization-notes.txt
deleted file mode 100644
index aff9a7f2a78a0bf4e9b19208aee6ecf27ba018d5..0000000000000000000000000000000000000000
--- a/docs/optimization-notes.txt
+++ /dev/null
@@ -1,130 +0,0 @@
-2007-06-08
-
-
-Prima di ottimizzare, compilato con -O3 -fomit-frame-pointer -mcpu
-
- time = 23.719999 (seconds) (start=104 end=2476)
-sm0: Total number of matchings = 777
-sm0: Total number of iterations = 5774
-sm0: Avg. iterations per matching = 7.431146
-sm0: Avg. seconds per matching = 0.030528
-sm0:   that is, 32 matchings per second
-sm0: Avg. seconds per iteration = 0.004108 (note: very imprecise)
-sm0: Number of comparisons = 15708338 
-sm0: Avg. comparisons per ray = 7.536093 
-
-dopo aver cambiato outliers, togliendo i gsl_vector (ma tenendo sqrt)
-
-sm0: CPU time = 16.620001 (seconds) (start=103 end=1765)
-sm0: Total number of matchings = 777
-sm0: Total number of iterations = 5774
-sm0: Avg. iterations per matching = 7.431146
-sm0: Avg. seconds per matching = 0.021390
-sm0:   that is, 46 matchings per second
-sm0: Avg. seconds per iteration = 0.002878 (note: very imprecise)
-sm0: Number of comparisons = 15708328 
-sm0: Avg. comparisons per ray = 7.536088
-
-in tricks: dopo aver tolto gsl_vector_get da distance in tricks:
-
-sm0: CPU time = 14.390000 (seconds) (start=103 end=1542)
-sm0: Total number of matchings = 777
-sm0: Total number of iterations = 5774
-sm0: Avg. iterations per matching = 7.431146
-sm0: Avg. seconds per matching = 0.018520
-sm0:   that is, 53 matchings per second
-sm0: Avg. seconds per iteration = 0.002492 (note: very imprecise)
-sm0: Number of comparisons = 15708328 
-sm0: Avg. comparisons per ray = 7.536088
-
-1.0%	46.8%	sm3	compute_next_estimate	
-6.4%	26.1%	sm3	find_correspondences_tricks	
-0.5%	13.2%	sm3	kill_outliers_trim	
-0.6%	10.2%	sm3	kill_outliers_double	
-
-Dopo aver cambiato distance_d, distance_squared in kill_outliers_double:
-
-sm0: CPU time = 13.310000 (seconds) (start=105 end=1436)
-sm0: Total number of matchings = 777
-sm0: Total number of iterations = 5774
-sm0: Avg. iterations per matching = 7.431146
-sm0: Avg. seconds per matching = 0.017130
-sm0:   that is, 58 matchings per second
-sm0: Avg. seconds per iteration = 0.002305 (note: very imprecise)
-sm0: Number of comparisons = 15708328 
-sm0: Avg. comparisons per ray = 7.536088
-
-1.0%	50.6%	sm3	compute_next_estimate	
-6.8%	28.3%	sm3	find_correspondences_tricks	
-0.6%	14.3%	sm3	kill_outliers_trim	
-0.6%	3.4%	sm3	kill_outliers_double	
-
-Dopo aver tolto cos(alpha)*cos(alpha):
-
-sm0: CPU time = 12.590000 (seconds) (start=104 end=1363)
-sm0: Total number of matchings = 777
-sm0: Total number of iterations = 5774
-sm0: Avg. iterations per matching = 7.431146
-sm0: Avg. seconds per matching = 0.016203
-sm0:   that is, 61 matchings per second
-sm0: Avg. seconds per iteration = 0.002180 (note: very imprecise)
-sm0: Number of comparisons = 15708328 
-sm0: Avg. comparisons per ray = 7.536088
-
-0.7%	48.4%	sm3	compute_next_estimate	
-7.4%	29.8%	sm3	find_correspondences_tricks	
-0.5%	14.7%	sm3	kill_outliers_trim	
-0.7%	3.8%	sm3	kill_outliers_double	
-
-Dopo aver linkato a GSL 1.9 con 03 e mtune:
-
-sm0: CPU time = 10.270000 (seconds) (start=104 end=1131)
-sm0: Total number of matchings = 777
-sm0: Total number of iterations = 5774
-sm0: Avg. iterations per matching = 7.431146
-sm0: Avg. seconds per matching = 0.013218
-sm0:   that is, 75 matchings per second
-sm0: Avg. seconds per iteration = 0.001779 (note: very imprecise)
-sm0: Number of comparisons = 15706493 
-sm0: Avg. comparisons per ray = 7.535208
-
-1.1%	49.2%	sm3	compute_next_estimate	
-9.9%	23.4%	sm3	find_correspondences_tricks	
-0.8%	19.3%	sm3	kill_outliers_trim	
-0.9%	4.6%	sm3	kill_outliers_double	
-
-Dopo aver messo le costanti C0,C1 in tricks:
-
-sm0: CPU time = 9.530000 (seconds) (start=105 end=1058)
-sm0: Total number of matchings = 777
-sm0: Total number of iterations = 5822
-sm0: Avg. iterations per matching = 7.492921
-sm0: Avg. seconds per matching = 0.012265
-sm0:   that is, 81 matchings per second
-sm0: Avg. seconds per iteration = 0.001637 (note: very imprecise)
-sm0: Number of comparisons = 15837504 
-sm0: Avg. comparisons per ray = 7.535418
-
-1.6%	48.0%	sm3	compute_next_estimate	
-8.4%	22.3%	sm3	find_correspondences_tricks	
-0.8%	20.9%	sm3	kill_outliers_trim	
-0.9%	5.0%	sm3	kill_outliers_double	
-
-Dopo aver tolto gsl_matrix in GPC:
-
-sm0: CPU time = 6.740000 (seconds) (start=104 end=778)
-sm0: Total number of matchings = 777
-sm0: Total number of iterations = 5822
-sm0: Avg. iterations per matching = 7.492921
-sm0: Avg. seconds per matching = 0.008674
-sm0:   that is, 115 matchings per second
-sm0: Avg. seconds per iteration = 0.001158 (note: very imprecise)
-sm0: Number of comparisons = 15837504 
-sm0: Avg. comparisons per ray = 7.535418
-
-11.8%	31.9%	sm3	find_correspondences_tricks	
-1.2%	30.6%	sm3	kill_outliers_trim	
-2.3%	24.8%	sm3	compute_next_estimate	
-1.4%	7.4%	sm3	kill_outliers_double	
-
-
diff --git a/docs/optimizations.txt b/docs/optimizations.txt
deleted file mode 100644
index aa3b20591a8bd5036865f34b87f85ea2aa894b23..0000000000000000000000000000000000000000
--- a/docs/optimizations.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-
-Optimizations
--------------
-
-The ICP code is reasonably optimized (the correspondence search in particular).
-But only algorithmic optimization were used. In particular, the following were *not* used:
-
-- look-up tables
-- fixed-point math
-- chipset-specific extensions for vectorizations (altivec, etc)
-- optimizations that would give an approximation to the answer
-- assembler in general
-
-All computations done in *double* precision (*float* would be more than enough).
diff --git a/docs/other.txt b/docs/other.txt
deleted file mode 100644
index 94b5d1eebf5325e8f35928183d2faa9fd8b67f7d..0000000000000000000000000000000000000000
--- a/docs/other.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-Misc documentation
-------------------
-
-**Do not believe anything you read here**
-
-### Featured functions ###
-
-`ld_fisher `
-:	This function computes Fisher's information 
-	matrix, in robot coordinates. 
-
-	It uses field `true_alpha` (and `theta`, `readings`). 
-
-	For details about the Fisher's information matrix for 
-	localization, please see this paper: 
-	
-	<http://purl.org/censi/2006/accuracy>
-
-	Available as matlab function `ld_fisher0.m`, C function 
-	`ld_fisher0` and command line `ld_fisher`.
-
diff --git a/docs/preamble.tex b/docs/preamble.tex
deleted file mode 100644
index 62fd1ab7aaf141e0cd5d08d8a920b6f609246e72..0000000000000000000000000000000000000000
--- a/docs/preamble.tex
+++ /dev/null
@@ -1,5 +0,0 @@
-\setlength\parindent{0pt}
-\setlength\parskip{5pt}
-%\usepackage[textwidth=72ex]{geometry}
-\usepackage[vmargin={1in,1in},hmargin={1in,2in}]{geometry}
-%\usepackage[margin=1in]{geometry}
diff --git a/docs/preamble.txt b/docs/preamble.txt
deleted file mode 100644
index 0c23de1b09cc9525df5912bce1fea98211a2aaaf..0000000000000000000000000000000000000000
--- a/docs/preamble.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-CSS: style.css
-Use numbered headers: true
-HTML use syntax: true
-LaTeX use listings: true
-LaTeX CJK: false
-LaTeX preamble: preamble.tex
diff --git a/docs/readme.txt b/docs/readme.txt
deleted file mode 100644
index c54130d3ddb31f7f9e2b020c4c29eebd3fbc3b9d..0000000000000000000000000000000000000000
--- a/docs/readme.txt
+++ /dev/null
@@ -1,127 +0,0 @@
-
-The C(anonical) Scan Matcher 
-================================
-
-* TOC
-{:toc}
-
-## Introduction ##
-
-I created this package:
-
-- To have a well-documented reference implementation of [PL-ICP](http://purl.org/censi/2007/plicp). If you are only interested in the core algorithm of PL-ICP, a [separate concise implementation in C/Matlab/Ruby](http://purl.org/censi/2007/plicp) is available.
-
-- To have a **trustworthy** scan matcher to be used in the experiments for some papers on [ICP covariance](http://purl.org/censi/2006/icpcov), [the Cramer-Rao bound for range finders](http://purl.org/censi/2006/accuracy), and [robot calibration](http://purl.org/censi/2007/calib).  For batch experiments, it's also useful that it's pretty fast.
-
-- To have a collection of utilies for command line (UNIX-style) manipulation of laser data, and creating beautiful maps and animations.
-
-## Content of this package ##
-
-The core content is the C scan matching library which is quite polished, but this package contains a lot of software, only some of that in an usable state.
-In general, I am not ashamed of the prototypical code I write.
-
-### Stable things: C scan matching library ###
-
-The directory `sm/csm` contains a scan matcher written in C, plus 
-associated tools and apps. This is stable and reasonably bug-free.
-
-There are many libraries in the `sm/lib` directory:
-
--	Directory `egsl`: a light wrapper for GSL that makes manipulating
-	matrices easy and efficient. This is documented in another file:
-	see `sm/lib/egsl/docs`.
-
--	Directory `options`: for processing command-line arguments and 
-	configuration files.
-
--	Directory `json-c`: a library for JSON input/output. This is a 
-	slightly modified version of the original [`json-c`][json-c] 
-	library released under the [MIT license].
-
-### Stable things: applications ###
-
-There are many applications in the `sm/apps` directory:
-
--	Application `sm2`: standard scan-matching. Reads a log, runs ICP, and writes the scan-matched output. Input can be both Carmen and JSON.
-
--	Application `sm3`: like sm2, but instead of actual output it measures the performance. This is the application that produced the stats found in the paper submitted to ICRA'08.
-
--	Application `sm1`: useful for running experiments. Reads scans
-	from two different files, and outputs statistics.
-
-Visualization apps:
-
--	Application `log2pdf`: converts a laser log to a PDF map.
-	To build this application, it is needed to install the [Cairo] graphics
-	library.
-
--	Application `sm_animate`: creates an animation for the ICP process, displaying the correspondences, etc. This application reads the output created by `sm2` with the `-file_jj` option. To build this application, it is needed to install the [Cairo] graphics
-library.
-
-Miscellaneous Unix-style processing for laser data:
-
--	Application `carmen2json`: converts a Carmen log to the JSON format.
-
--	Application `ld_fisher`: computes the Fisher's information matrix. See <http://purl.org/censi/2006/accuracy> for details.
-
--	Application `json_extract`: extract the n-th object from a JSON stream.
-
--	Application `ld_slip`: adds some noise to the odometry field.
-
--	Application `ld_smooth`: smooths the readings data.
-
--	Application `ld_noise`: adds sensor noise.
-
--	Application `ld_cluster_curv`: clusterize the rays based on the analysis of the curvature.
-
--	Application `ld_linearize`: fits a line to each cluster (data must have been previously clustered, for example by `ld_cluster_curv`).
-
-
-GUI apps:
-
--   `apps/gtk_viewer` contains the prototype of a viewer using GTK. It does not work yet.
-
-### Unstable things: scripts ###
-
-In the `scripts/` directory you can find:
-
--	Script `json2matlab.rb`: converts a JSON object in a Matlab scripts.
-	This is the holy grail of data exchange.
-	
-	Warning: at the moment, this script relies on some patches to
-	the Ruby JSON library. Without them, it is limited to only
-	1 JSON object in each file.
-
--	Script `fig2pics.rb`: used for converting FIG files to PDF.
-	It has many more options than [`fig2dev`][fig2dev] (that is being used internally), 
-	including the ability to use a LaTeX preamble and to change
-	the resulting bounding box.
-
--	Script `create_video.rb`: displays the scan-matching process.
-	This reads the journal files written by applications `sm1` and `sm2`.
-	**Made obsolete by `sm_animate`**
-
-### Unstable things: Ruby and Matlab implementations ###
-
-Unstable things include:
-
--	Directory `sm_ruby_wrapper/`: a ruby wrapper for the `sm` C library. This wrapper is used for running some of the experiments. It is not documented and it needs tidying a little.
-
--	Directory `rsm/`: a Ruby implementation of the same algorithms used
-	in the `sm` library. Some times ago, the C and Matlab implementation
-	were perfectly in sync. Now they differ a little. However, in the future
-	I will try to get them back in sync, as the only way of having a good
-	chance of making a bug-free implementation, is to make it twice.
-
--	Directory `matlab/` and `matlab_new/`. The Matlab scripts are a mess that needs tidying. There's a lot in there. They are kept here because they are used for creating some of the figures in the submitted papers. Also, the first PLICP implementation was written in Matlab and is buried there, somewhere.
-	
-	Also, I occasionally tried to make sure that the scripts run fine
-	in [Octave]. They do, except for the plotting.
-
-
-[octave]: http://www.octave.org
-[cairo]: http://cairographics.org
-[json-c]: http://www.json.org
-[fig2dev]: http://www.xfig.org
-[MIT license]: http://en.wikipedia.org/wiki/MIT_License
-
diff --git a/docs/references.txt b/docs/references.txt
deleted file mode 100644
index 8f632b18836ffa74567aca5bf82080b3eae00832..0000000000000000000000000000000000000000
--- a/docs/references.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Fast atan2:
-
-http://lists.apple.com/archives/PerfOptimization-dev/2005/Jan/threads.html#00032
\ No newline at end of file
diff --git a/docs/style.css b/docs/style.css
deleted file mode 100644
index 4e563b36283927abdd32e93af2896fda1d87e048..0000000000000000000000000000000000000000
--- a/docs/style.css
+++ /dev/null
@@ -1,106 +0,0 @@
-
-body {
-	font-family: Georgia;
-	max-width: 40em;
-	padding-left: 3em;
-}
-
-#news {
-	background-color: #fee;
-	border: solid 2px red;
-	padding: 0.3em;
-	margin: 0.3em;
-	width: 50%;
-}
-
-h1 { margin-left: -1em;}
-h2 { margin-left: -1em;}
-
-pre {
-	margin-left: 2em;
-	background-color: #eff;
-	border: solid 1px #bdd;
-	padding: 4px;
-}
-
-/*code {background-color: #eff;}*/
-h1 strong { color: red;}
-
-table.example TD,
-table.example TR,
-table.example TH {
-	border: solid 1px #555;
-	padding: 4px;
-	
-}
-
-img#logo {
-	float: right;
-}
-
-/*pre SPAN { border: solid 1px black; }*/
-
-.ruby .normal {}
-.ruby .comment { color: #005; font-style: italic; }
-.ruby .keyword { color: #A00; font-weight: bold; }
-.ruby .method { color: #077; }
-.ruby .class { color: #074; }
-.ruby .module { color: #050; }
-.ruby .punct { color: #447; font-weight: bold; }
-.ruby .symbol { color: #099; }
-.ruby .string { color: #944; background: #FFE; }
-.ruby .char { color: #F07; }
-.ruby .ident { color: #004; }
-.ruby .constant { color: #07F; }
-.ruby .regex { color: #B66; background: #FEF; }
-.ruby .number { color: #F99; }
-.ruby .attribute { color: #7BB; }
-.ruby .global { color: #7FB; }
-.ruby .expr { color: #227; }
-.ruby .escape { color: #277; }
-
-.xml .normal {}
-.xml .namespace { color: #B66; font-weight: bold; }
-.xml .tag { color: #F88; }
-.xml .comment { color: #005; font-style: italic; }
-.xml .punct { color: #447; font-weight: bold; }
-.xml .string { color: #944; }
-.xml .number { color: #F99; }
-.xml .attribute { color: #BB7; }
-
-.html .normal {}
-.html .namespace { color: #B66; font-weight: bold; }
-.html .tag { color: #F88; }
-.html .comment { color: #005; font-style: italic; }
-.html .punct { color: #447; font-weight: bold; }
-.html .string { color: #944; }
-.html .number { color: #F99; }
-.html .attribute { color: #BB7; }
-
-.maruku-att-origin {
-	padding-left: 30px;
-	margin-top: -1em;
-	font-size: 70%;
-	color: grey;
-}
-
-.maruku-att-default {
-	padding-left: 30px;
-	margin-top: -1.4em;
-	margin-bottom: +1em;
-	font-size: 90%;
-}
-
-a.maruku-link-samedoc {
-	color: red;
-}
-
-a.maruku-link-local {
-	color: green;	
-}
-
-a.maruku-link-external {
-	color: blue;		
-}
-
-
diff --git a/docs/todo.mm b/docs/todo.mm
deleted file mode 100644
index 064a42da557762c30f32567ba94c748aa45b87eb..0000000000000000000000000000000000000000
--- a/docs/todo.mm
+++ /dev/null
@@ -1,38 +0,0 @@
-<map version="0.9.0_Beta_8" background_color="#ffffff">
-<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
-<node CREATED="1185522662655" ID="Freemind_Link_697017692" MODIFIED="1185522662655" TEXT="New Mindmap">
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180440171456" HGAP="13" ID="Freemind_Link_1536550240" MODIFIED="1185522671080" POSITION="right" TEXT="icp" VSHIFT="-71">
-<node BACKGROUND_COLOR="#ffff00" CREATED="1181117607993" ID="Freemind_Link_1092514301" MODIFIED="1181117725197" TEXT="sm_icp_animation">
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180597650306" ID="Freemind_Link_771510588" MODIFIED="1180605225798" TEXT="fare demo carina con animation"/>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1181117621181" ID="Freemind_Link_755242794" MODIFIED="1181117705322" TEXT="creare default configurations (many_points)"/>
-</node>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1181117849182" ID="Freemind_Link_305830794" MODIFIED="1181117852985" TEXT="formati">
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180735952196" ID="Freemind_Link_770251969" MODIFIED="1180735957333" TEXT="togliere theta da json"/>
-</node>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1181117858778" ID="Freemind_Link_1547450624" MODIFIED="1181117861394" TEXT="libcsm">
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180772534386" ID="Freemind_Link_82493141" MODIFIED="1180772537900" TEXT="output CARMEN">
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180772538326" ID="Freemind_Link_1186113497" MODIFIED="1180772543140" TEXT="opzione output_format"/>
-</node>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180520218191" ID="Freemind_Link_1659736302" MODIFIED="1180520224162" TEXT="cambiare nomi maxPerc e *Deg"/>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180519409707" ID="Freemind_Link_1896482752" MODIFIED="1180519416420" TEXT="fare check memoria con valgrind"/>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180520392227" ID="Freemind_Link_1281566208" MODIFIED="1180520396890" TEXT="togliere assert da journal"/>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180520568815" ID="Freemind_Link_150033155" MODIFIED="1180520575765" TEXT="opzioni set in options">
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180809994085" ID="Freemind_Link_648038378" MODIFIED="1180810000814" TEXT="quoted strings"/>
-</node>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180448230938" ID="Freemind_Link_442257989" MODIFIED="1180448237104" TEXT="mettere misc_apps di l&#xe0;"/>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180440303009" ID="Freemind_Link_1454958561" MODIFIED="1180440309734" TEXT="sei sicuro della precisione json?"/>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1181889593162" ID="Freemind_Link_1035409220" MODIFIED="1181889629303" TEXT="isnan con fast-math"/>
-</node>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1181117893258" ID="Freemind_Link_942437306" MODIFIED="1181117895596" TEXT="raytracer">
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180776125485" ID="Freemind_Link_391369505" MODIFIED="1180776136422" TEXT="fare raytracer che legge le pose da file (non da cin)"/>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180440764465" ID="Freemind_Link_368708750" MODIFIED="1180440770287" TEXT="fare raytracing circles"/>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180775902928" ID="Freemind_Link_732352514" MODIFIED="1180775916533" TEXT="fare FIG.read(FILE*) e cambiare &quot;raytracer.cpp&quot;"/>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1181656906861" ID="Freemind_Link_411765945" MODIFIED="1181656912316" TEXT="aggiungere real-cluster"/>
-</node>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1181117946781" ID="Freemind_Link_39490840" MODIFIED="1181117950748" TEXT="esperimenti">
-<node BACKGROUND_COLOR="#ffff00" CREATED="1180451745014" ID="Freemind_Link_514348022" MODIFIED="1180451751115" TEXT="disegnare altri ambienti"/>
-<node BACKGROUND_COLOR="#ffff00" CREATED="1181118007333" ID="Freemind_Link_1940417774" MODIFIED="1181118012234" TEXT="rimetti a posto esperimenti"/>
-</node>
-</node>
-</node>
-</map>
diff --git a/docs/troubleshootings.txt b/docs/troubleshootings.txt
deleted file mode 100644
index 0c9b5390eaed1191113445d7d35eece3a8fedeaa..0000000000000000000000000000000000000000
--- a/docs/troubleshootings.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-## Known problems and troubleshootings ##
-
-### Usage of `-ffast-math` ###
-
-Use of `-ffast-math` is ok for computations. However, output routines do not work as expected. In particular, invalid JSON is generated, because it can't distinguish `NaN` values.
-
-To make sure that it's all ok, there is a test program called `test_math_utils_sanity` that checks for good behaviour with NaN values.
-
diff --git a/sm/csm/algos.h b/include/csm/algos.h
similarity index 89%
rename from sm/csm/algos.h
rename to include/csm/algos.h
index abcbd1039ef937000bfbbe1a60e51e217afd47aa..4f7fe3c8aa3bee7da4a2b8a8817d0353977cebcf 100644
--- a/sm/csm/algos.h
+++ b/include/csm/algos.h
@@ -1,11 +1,10 @@
 #ifndef H_SCAN_MATCHING_LIB
 #define H_SCAN_MATCHING_LIB
 
-#include <gsl/gsl_vector.h>
-#include <gsl/gsl_matrix.h>
+//#include <gsl/gsl_vector.h>
+//#include <gsl/gsl_matrix.h>
+#include <gsl_eigen/gsl_eigen.h>
 
-#include "hsm/hsm.h"
-#include "hsm/hsm_interface.h"
 #include "laser_data.h"
 
 
@@ -125,13 +124,6 @@ struct sm_params {
 
 	/** mark as invalid ( = don't use ) rays outside of this interval */
 	double min_reading, max_reading;
-	
-	/* Parameters specific to GPM (unfinished :-/ ) */
-	double gpm_theta_bin_size_deg;
-	double gpm_extend_range_deg; 
-	int gpm_interval;
-	/* Parameter specific to HSM (unfinished :-/ ) */
-	struct hsm_params hsm;
 };
 
 
@@ -159,14 +151,9 @@ struct sm_result {
 
 
 void sm_icp(struct sm_params*input, struct sm_result*output);
-void sm_gpm(struct sm_params*input, struct sm_result*output);
-void sm_hsm(struct sm_params*input, struct sm_result*output);
-
-/* Unfinished, untested :-/ */
-void sm_mbcip(struct sm_params*input, struct sm_result*output);
-
-
 
 void sm_journal_open(const char* file);
 
+void csm_free_unused_memory();
+
 #endif
diff --git a/include/csm/csm.h b/include/csm/csm.h
new file mode 100644
index 0000000000000000000000000000000000000000..9320b33563df42065cb4fc0737201cf967113bcc
--- /dev/null
+++ b/include/csm/csm.h
@@ -0,0 +1,7 @@
+#ifndef H_CSM_H
+#define H_CSM_H
+
+#include <csm/laser_data.h>
+#include <csm/algos.h>
+
+#endif
diff --git a/sm/csm/laser_data.h b/include/csm/laser_data.h
similarity index 97%
rename from sm/csm/laser_data.h
rename to include/csm/laser_data.h
index 15645d11fd793788557de10472b0c9007d046515..3e8c483990350dde9f47c031ef4384026d991202 100644
--- a/sm/csm/laser_data.h
+++ b/include/csm/laser_data.h
@@ -1,7 +1,14 @@
 #ifndef H_LASER_DATA
 #define H_LASER_DATA
 
+// KUKA: WINDOWS COMPILATION
+#ifndef WINDOWS
 #include <sys/time.h>
+#else
+#include <time.h>
+#include <windows.h>
+#endif
+
 #include <stdio.h>
 
 #include "restrict.h"
diff --git a/sm/csm/laser_data_inline.h b/include/csm/laser_data_inline.h
similarity index 85%
rename from sm/csm/laser_data_inline.h
rename to include/csm/laser_data_inline.h
index b2586513beb2c566843db6bdfcf726d1773e4537..d351c626fcdd593aabfdbf7f74342e27fef4d5b5 100644
--- a/sm/csm/laser_data_inline.h
+++ b/include/csm/laser_data_inline.h
@@ -1,10 +1,11 @@
 #ifndef H_LASER_DATA_INLINE
 #define H_LASER_DATA_INLINE
 
-#include <gsl/gsl_math.h>
-#include <gsl/gsl_vector.h>
+//#include <gsl/gsl_math.h>
+//#include <gsl/gsl_vector.h>
+#include <limits>
 
-#include "csm.h"
+//#include "csm.h"
 
 /* Simple inline functions */
 
@@ -22,7 +23,7 @@ INLINE void ld_set_null_correspondence(LDP ld, int i) {
 	ld->corr[i].valid = 0;
 	ld->corr[i].j1 = -1;	
 	ld->corr[i].j2 = -1;	
-	ld->corr[i].dist2_j1 = GSL_NAN;	
+	ld->corr[i].dist2_j1 = std::numeric_limits<double>::quiet_NaN(); //GSL_NAN;
 }
 
 INLINE void ld_set_correspondence(LDP ld, int i, int j1, int j2) {
diff --git a/sm/csm/restrict.h b/include/csm/restrict.h
similarity index 95%
rename from sm/csm/restrict.h
rename to include/csm/restrict.h
index 5582dd51e70559ee8189568688c67ef732e25015..786aadf145bc44498e4d6f132b7407f0afcd3e89 100644
--- a/sm/csm/restrict.h
+++ b/include/csm/restrict.h
@@ -1,6 +1,4 @@
 /* Some preprocessor magic for having fast inline functions. */
-#include <gsl/gsl_matrix.h>
-
 #ifndef INLINE
 #define INLINE static inline
 #endif
diff --git a/include/gsl_eigen/gsl_eigen.h b/include/gsl_eigen/gsl_eigen.h
new file mode 100644
index 0000000000000000000000000000000000000000..b42795301ce91704e43f3663522d3403acfae104
--- /dev/null
+++ b/include/gsl_eigen/gsl_eigen.h
@@ -0,0 +1,80 @@
+/*
+ * gsl_eigen.h
+ *
+ *  Created on: Oct 11, 2012
+ *      Author: sprunkc
+ */
+
+#ifndef GSL_EIGEN_H_
+#define GSL_EIGEN_H_
+
+#include <Eigen/Core>
+#include <Eigen/Geometry>
+
+typedef  Eigen::VectorXd gsl_vector;
+typedef  Eigen::MatrixXd gsl_matrix;
+
+inline gsl_vector *gsl_vector_alloc (const size_t n){
+  return new Eigen::VectorXd(n);
+}
+
+inline void gsl_vector_free (gsl_vector * v){
+  delete v;
+}
+
+inline void gsl_vector_memcpy (gsl_vector * dest, const gsl_vector * src){
+  *dest = *src;
+}
+
+
+inline double gsl_vector_get (const gsl_vector * v, const size_t i){
+  return (*v)(i);
+}
+
+inline void gsl_vector_set (gsl_vector * v, const size_t i, double x){
+  (*v)(i) = x;
+}
+
+
+inline gsl_matrix* gsl_matrix_alloc(const size_t rows, const size_t cols){
+  return new Eigen::MatrixXd(rows, cols);
+}
+
+inline void gsl_matrix_free(gsl_matrix* m){
+  delete m;
+}
+
+inline void gsl_matrix_memcpy(gsl_matrix* m2, const gsl_matrix* m){
+  *m2 = *m;
+}
+
+inline void gsl_matrix_set(gsl_matrix * m, const size_t i, const size_t j, const double x){
+  (*m)(i,j) = x;
+}
+
+inline void gsl_matrix_set_zero (gsl_matrix * m){
+  m->setZero();
+}
+
+
+inline double gsl_matrix_get(const gsl_matrix * m, const size_t i, const size_t j){
+  return (*m)(i,j);
+}
+
+inline double * gsl_matrix_ptr(gsl_matrix * m, const size_t i, const size_t j){
+  return &(*m)(i,j);
+}
+
+inline void gsl_matrix_set_all (gsl_matrix * m, double x){
+  m->setConstant(x);
+}
+
+inline void gsl_matrix_add (gsl_matrix * a, const gsl_matrix * b){
+  *a += *b;
+}
+
+inline void gsl_matrix_scale (gsl_matrix * a, const double x){
+  *a *=x;
+}
+
+#endif /* GSL_EIGEN_H_ */
diff --git a/install_quickstart.sh b/install_quickstart.sh
deleted file mode 100755
index 3e9e7275023fe68e17305d3631e24594e76560c3..0000000000000000000000000000000000000000
--- a/install_quickstart.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-echo "If you are lucky, this is it. (press ENTER)"
-read 
-mkdir -p deploy
-cmake -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/deploy .
-make
-make install
-
diff --git a/local_config/icc-warnings.txt b/local_config/icc-warnings.txt
deleted file mode 100644
index cbad50edb1099ae4f61a962594dbea1216363076..0000000000000000000000000000000000000000
--- a/local_config/icc-warnings.txt
+++ /dev/null
@@ -1,216 +0,0 @@
-/home/acensi/src/csm/csm/sm/csm/icp/icp.c(3): remark #869: parameter "file" was never referenced
-  void sm_journal_open(const char* file) {
-                                   ^
-
-/home/acensi/src/csm/csm/sm/csm/laser_data_json.c(97): remark #1572: floating-point equality and inequality comparisons are unreliable
-  	int i; for(i=0;i<n;i++) if(v[i]==v[i]) return 0;
-  	                                 ^
-
-/home/acensi/src/csm/csm/sm/csm/logging.c(20): remark #593: parameter "msg" was set but never used
-  void sm_debug(const char *msg, ...)
-                            ^
-
-/home/acensi/src/csm/csm/sm/csm/math_utils.c(76): remark #1572: floating-point equality and inequality comparisons are unreliable
-  	return v == v ? 0 : 1;
-  	            ^
-
-/home/acensi/src/csm/csm/sm/lib/gpc/gpc.c(33): remark #869: parameter "x0" was never referenced
-  	const double*x0, const double *cov_x0,
-  	             ^
-
-/home/acensi/src/csm/csm/sm/lib/gpc/gpc.c(33): remark #869: parameter "cov_x0" was never referenced
-  	const double*x0, const double *cov_x0,
-  	                               ^
-
-/home/acensi/src/csm/csm/sm/lib/gpc/gpc_utils.c(70): remark #1572: floating-point equality and inequality comparisons are unreliable
-  		if( (z[2*i+1]==0) && (z[2*i]>lambda))
-  		               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/debug.c(50): warning #266: function "vsyslog" declared implicitly
-  	  vsyslog(LOG_ERR, msg, ap);
-  	  ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/debug.c(65): warning #266: function "vsyslog" declared implicitly
-  		vsyslog(LOG_DEBUG, msg, ap);
-  		^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/debug.c(78): warning #266: function "vsyslog" declared implicitly
-  		vsyslog(LOG_ERR, msg, ap);
-  		^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/debug.c(90): warning #266: function "vsyslog" declared implicitly
-  		vsyslog(LOG_INFO, msg, ap);
-  		^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_more_utils.c(184): remark #1572: floating-point equality and inequality comparisons are unreliable
-  	return (v == v) ?  /* NAN is null */
-  	             ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_object.c(271): warning #266: function "strdup" declared implicitly
-    lh_table_insert(this->o.c_object, strdup(key), val);
-                                      ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_object.c(271): warning #167: argument of type "const char *" is incompatible with parameter of type "void *"
-    lh_table_insert(this->o.c_object, strdup(key), val);
-                                             ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_object.c(312): remark #1572: floating-point equality and inequality comparisons are unreliable
-      return (this->o.c_double != 0);
-                                  ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(334): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[0] = tok->ucs_char;
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(337): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[0] = 0xc0 | (tok->ucs_char >> 6);
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(338): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[1] = 0x80 | (tok->ucs_char & 0x3f);
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(341): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[0] = 0xe0 | (tok->ucs_char >> 12);
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(342): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[1] = 0x80 | ((tok->ucs_char >> 6) & 0x3f);
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(343): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[2] = 0x80 | (tok->ucs_char & 0x3f);
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(451): warning #266: function "strdup" declared implicitly
-  	obj_field_name = strdup(tok->pb->buf);
-  	                 ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/linkhash.c(170): remark #111: statement is unreachable
-  	return NULL;
-  	^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/printbuf.c(122): warning #266: function "vasprintf" declared implicitly
-      if((size = vasprintf(&t, msg, ap)) == -1) return -1;
-                 ^
-
-/home/acensi/src/csm/csm/sm/lib/gpc/gpc.c(33): remark #869: parameter "x0" was never referenced
-  	const double*x0, const double *cov_x0,
-  	             ^
-
-/home/acensi/src/csm/csm/sm/lib/gpc/gpc.c(33): remark #869: parameter "cov_x0" was never referenced
-  	const double*x0, const double *cov_x0,
-  	                               ^
-
-/home/acensi/src/csm/csm/sm/lib/gpc/gpc_utils.c(70): remark #1572: floating-point equality and inequality comparisons are unreliable
-  		if( (z[2*i+1]==0) && (z[2*i]>lambda))
-  		               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/debug.c(50): warning #266: function "vsyslog" declared implicitly
-  	  vsyslog(LOG_ERR, msg, ap);
-  	  ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/debug.c(65): warning #266: function "vsyslog" declared implicitly
-  		vsyslog(LOG_DEBUG, msg, ap);
-  		^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/debug.c(78): warning #266: function "vsyslog" declared implicitly
-  		vsyslog(LOG_ERR, msg, ap);
-  		^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/debug.c(90): warning #266: function "vsyslog" declared implicitly
-  		vsyslog(LOG_INFO, msg, ap);
-  		^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_object.c(271): warning #266: function "strdup" declared implicitly
-    lh_table_insert(this->o.c_object, strdup(key), val);
-                                      ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_object.c(271): warning #167: argument of type "const char *" is incompatible with parameter of type "void *"
-    lh_table_insert(this->o.c_object, strdup(key), val);
-                                             ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_object.c(312): remark #1572: floating-point equality and inequality comparisons are unreliable
-      return (this->o.c_double != 0);
-                                  ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(334): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[0] = tok->ucs_char;
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(337): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[0] = 0xc0 | (tok->ucs_char >> 6);
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(338): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[1] = 0x80 | (tok->ucs_char & 0x3f);
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(341): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[0] = 0xe0 | (tok->ucs_char >> 12);
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(342): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[1] = 0x80 | ((tok->ucs_char >> 6) & 0x3f);
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(343): remark #810: conversion from "unsigned int" to "unsigned char" may lose significant bits
-  	    utf_out[2] = 0x80 | (tok->ucs_char & 0x3f);
-  	               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_tokener.c(451): warning #266: function "strdup" declared implicitly
-  	obj_field_name = strdup(tok->pb->buf);
-  	                 ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/linkhash.c(170): remark #111: statement is unreachable
-  	return NULL;
-  	^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/printbuf.c(122): warning #266: function "vasprintf" declared implicitly
-      if((size = vasprintf(&t, msg, ap)) == -1) return -1;
-                 ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/json_more_utils.c(184): remark #1572: floating-point equality and inequality comparisons are unreliable
-  	return (v == v) ?  /* NAN is null */
-  	             ^
-
-/home/acensi/src/csm/csm/sm/csm/laser_data_json.c(97): remark #1572: floating-point equality and inequality comparisons are unreliable
-  	int i; for(i=0;i<n;i++) if(v[i]==v[i]) return 0;
-  	                                 ^
-
-/home/acensi/src/csm/csm/sm/csm/math_utils.c(76): remark #1572: floating-point equality and inequality comparisons are unreliable
-  	return v == v ? 0 : 1;
-  	            ^
-
-/home/acensi/src/csm/csm/sm/csm/logging.c(20): remark #593: parameter "msg" was set but never used
-  void sm_debug(const char *msg, ...)
-                            ^
-
-/home/acensi/src/csm/csm/sm/csm/icp/icp.c(3): remark #869: parameter "file" was never referenced
-  void sm_journal_open(const char* file) {
-                                   ^
-
-/home/acensi/src/csm/csm/sm/csm/math_utils_test.c(12): remark #177: variable "A" was declared but never referenced
-  	gsl_vector * A = vector_from_array(2,a);
-  	             ^
-
-/home/acensi/src/csm/csm/sm/csm/math_utils_test.c(13): remark #177: variable "B" was declared but never referenced
-  	gsl_vector * B = vector_from_array(2,b);
-  	             ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/test1.c(167): remark #1599: declaration hides variable "my_array" (declared at line 11)
-  	struct json_object *my_array = json_object_new_array();
-  	                    ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/test1.c(168): remark #1599: declaration hides variable "i" (declared at line 13)
-  	int i; for(i=0;i<20;i++) {
-  	    ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/test1.c(7): remark #593: parameter "argc" was set but never used
-  int main(int argc, char **argv)
-               ^
-
-/home/acensi/src/csm/csm/sm/lib/json-c/test1.c(7): remark #593: parameter "argv" was set but never used
-  int main(int argc, char **argv)
-                            ^
-
diff --git a/local_config/local-Melania.cmake b/local_config/local-Melania.cmake
deleted file mode 100644
index da025b0d74895299638f050db483020b08c46c61..0000000000000000000000000000000000000000
--- a/local_config/local-Melania.cmake
+++ /dev/null
@@ -1,32 +0,0 @@
-
-# Melania is a 1.4GhZ PPC Powerbook
-
-SET(GSL_CONFIG_PREFER_PATH /Users/andrea/csm/csm/deploy/bin)
-SET(GSL_CONFIG /Users/andrea/csm/csm/deploy/bin/gsl-config)
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-double")
-SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-double")
-
-# 
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mtune=7450 -mcpu=7450  -fomit-frame-pointer -O3")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mtune=7450 -mcpu=7450  -O2")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -gfull")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno  -fno-trapping-math -fno-signaling-nans")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno -funsafe-math-optimizations -fno-trapping-math -fno-signaling-nans")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wmissing-prototypes  -Wconversion   -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs -fshort-enums -fno-common -Winline" )
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unreachable-code")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstrict-aliasing")
-
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -funroll-loops")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -falign-loops=16")
-
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes ")
-
-
-SET(COMPILE_HSM 0)
diff --git a/local_config/local-linuxserv-icc.cmake b/local_config/local-linuxserv-icc.cmake
deleted file mode 100644
index 38e3a6e339d9a174689c17af406c78dfdc3a0e9b..0000000000000000000000000000000000000000
--- a/local_config/local-linuxserv-icc.cmake
+++ /dev/null
@@ -1,15 +0,0 @@
-
-# linuxserv is a 4 x Xeon 1.8Gh
-
-#icc
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 ")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=pentium4 ")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd981 ")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd1418 -wd1419")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model fast ")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall ")
-
-
-
-
-
diff --git a/local_config/local-linuxserv.cmake b/local_config/local-linuxserv.cmake
deleted file mode 100644
index c777a72dd8b58e174313cf98cbc3b22f9822703f..0000000000000000000000000000000000000000
--- a/local_config/local-linuxserv.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-
-# linuxserv is a 4 x Xeon 1.8Gh
-
-#gcc
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -O3")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=pentium4 -msse2 -mfpmath=sse -mmmx -funroll-loops")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftree-vectorize -ftree-vectorizer-verbose=5")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
-
diff --git a/local_config/local-lisablack.cmake b/local_config/local-lisablack.cmake
deleted file mode 100644
index c2512c1060fba66edf94e86cda243c72b20dc473..0000000000000000000000000000000000000000
--- a/local_config/local-lisablack.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-
-# Lisablack is a Pentium 3
-
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  -fomit-frame-pointer -O3")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=pentium3 -msse -O3 -pipe")
-
-
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
diff --git a/local_config/local-overlook.cmake b/local_config/local-overlook.cmake
deleted file mode 100644
index 3696f1581f228ffc90131e61fe5c121bd8e86fae..0000000000000000000000000000000000000000
--- a/local_config/local-overlook.cmake
+++ /dev/null
@@ -1,27 +0,0 @@
-# overlook is a MacBook with Leopard
-
-#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-double")
-#SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-double")
-
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  -O2")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=pentium4  -pipe")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -gfull")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno  -fno-trapping-math -fno-signaling-nans")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno -funsafe-math-optimizations -fno-trapping-math -fno-signaling-nans")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wmissing-prototypes  -Wconversion   -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs -fshort-enums -fno-common -Winline" )
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unreachable-code")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstrict-aliasing")
-
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -funroll-loops")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -falign-loops=16")
-
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes ")
-
-#ÂĢSET(COMPILE_HSM 1)
diff --git a/local_config/local-pammela.cmake b/local_config/local-pammela.cmake
deleted file mode 100644
index 5bd204f758f496d99b9e39c0b9b9ca0c55cf93d7..0000000000000000000000000000000000000000
--- a/local_config/local-pammela.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-
-# Melania is a 1.4GhZ PPC Powerbook
-
-#SET(GSL_CONFIG_PREFER_PATH /Users/andrea/csm/csm/deploy/bin)
-#SET(GSL_CONFIG /Users/andrea/csm/csm/deploy/bin/gsl-config)
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-double")
-SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-double")
-
-# 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mtune=7450 -mcpu=7450  -fomit-frame-pointer -O3")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno -funsafe-math-optimizations -fno-trapping-math -fno-signaling-nans")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wmissing-prototypes  -Wconversion   -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wnested-externs -fshort-enums -fno-common -Winline" )
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unreachable-code")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstrict-aliasing")
-
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -funroll-loops")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -falign-loops=16")
-
diff --git a/local_config/local-pdelapuente.cmake b/local_config/local-pdelapuente.cmake
deleted file mode 100644
index 8fed575253e7eb331c227f373c879240fadb683f..0000000000000000000000000000000000000000
--- a/local_config/local-pdelapuente.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-SET(COMPILE_HSM 0)
-SET(COMPILE_STRUCTPRIOR 1)
diff --git a/local_config/local-sorchetta.cmake b/local_config/local-sorchetta.cmake
deleted file mode 100644
index 471ca6a0bd3b861d2d2868acfdc89235498b2d2b..0000000000000000000000000000000000000000
--- a/local_config/local-sorchetta.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-# sorchetta is an Intel Duo 2 with 2.0 Ghz for core
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=prescott -fomit-frame-pointer -O3 -msse3 -mfpmath=sse -pipe")
diff --git a/misc/matlab/appunti/MMt.png b/misc/matlab/appunti/MMt.png
deleted file mode 100644
index 9b4a3d4beb45d55f09a5cd440a2f278908dd8598..0000000000000000000000000000000000000000
Binary files a/misc/matlab/appunti/MMt.png and /dev/null differ
diff --git a/misc/matlab/appunti/problem.eps b/misc/matlab/appunti/problem.eps
deleted file mode 100644
index 9a244123e7b5dc84857f03482ea5cb8a203f576f..0000000000000000000000000000000000000000
--- a/misc/matlab/appunti/problem.eps
+++ /dev/null
@@ -1,4973 +0,0 @@
-%!PS-Adobe-3.0 EPSF-3.0
-%%Creator: MATLAB, The Mathworks, Inc.
-%%Title: /Users/andrea-base/repositories/alessia.svn/repository-andrea/years/2005/matlab-yasmine/problem.eps
-%%CreationDate: 10/16/2005  21:51:51
-%%DocumentNeededFonts: Helvetica
-%%DocumentProcessColors: Cyan Magenta Yellow Black
-%%LanguageLevel: 2
-%%Pages: 1
-%%BoundingBox:    59   211   550   580
-%%EndComments
-
-%%BeginProlog
-% MathWorks dictionary
-/MathWorks 160 dict begin
-% definition operators
-/bdef {bind def} bind def
-/ldef {load def} bind def
-/xdef {exch def} bdef
-/xstore {exch store} bdef
-% operator abbreviations
-/c  /clip ldef
-/cc /concat ldef
-/cp /closepath ldef
-/gr /grestore ldef
-/gs /gsave ldef
-/mt /moveto ldef
-/np /newpath ldef
-/cm /currentmatrix ldef
-/sm /setmatrix ldef
-/rm /rmoveto ldef
-/rl /rlineto ldef
-/s {show newpath} bdef
-/sc {setcmykcolor} bdef
-/sr /setrgbcolor ldef
-/sg /setgray ldef
-/w /setlinewidth ldef
-/j /setlinejoin ldef
-/cap /setlinecap ldef
-/rc {rectclip} bdef
-/rf {rectfill} bdef
-% page state control
-/pgsv () def
-/bpage {/pgsv save def} bdef
-/epage {pgsv restore} bdef
-/bplot /gsave ldef
-/eplot {stroke grestore} bdef
-% orientation switch
-/portraitMode 0 def /landscapeMode 1 def /rotateMode 2 def
-% coordinate system mappings
-/dpi2point 0 def
-% font control
-/FontSize 0 def
-/FMS {/FontSize xstore findfont [FontSize 0 0 FontSize neg 0 0]
-  makefont setfont} bdef
-/reencode {exch dup where {pop load} {pop StandardEncoding} ifelse
-  exch dup 3 1 roll findfont dup length dict begin
-  { 1 index /FID ne {def}{pop pop} ifelse } forall
-  /Encoding exch def currentdict end definefont pop} bdef
-/isroman {findfont /CharStrings get /Agrave known} bdef
-/FMSR {3 1 roll 1 index dup isroman {reencode} {pop pop} ifelse
-  exch FMS} bdef
-/csm {1 dpi2point div -1 dpi2point div scale neg translate
- dup landscapeMode eq {pop -90 rotate}
-  {rotateMode eq {90 rotate} if} ifelse} bdef
-% line types: solid, dotted, dashed, dotdash
-/SO { [] 0 setdash } bdef
-/DO { [.5 dpi2point mul 4 dpi2point mul] 0 setdash } bdef
-/DA { [6 dpi2point mul] 0 setdash } bdef
-/DD { [.5 dpi2point mul 4 dpi2point mul 6 dpi2point mul 4
-  dpi2point mul] 0 setdash } bdef
-% macros for lines and objects
-/L {lineto stroke} bdef
-/MP {3 1 roll moveto 1 sub {rlineto} repeat} bdef
-/AP {{rlineto} repeat} bdef
-/PDlw -1 def
-/W {/PDlw currentlinewidth def setlinewidth} def
-/PP {closepath eofill} bdef
-/DP {closepath stroke} bdef
-/MR {4 -2 roll moveto dup  0 exch rlineto exch 0 rlineto
-  neg 0 exch rlineto closepath} bdef
-/FR {MR stroke} bdef
-/PR {MR fill} bdef
-/L1i {{currentfile picstr readhexstring pop} image} bdef
-/tMatrix matrix def
-/MakeOval {newpath tMatrix currentmatrix pop translate scale
-0 0 1 0 360 arc tMatrix setmatrix} bdef
-/FO {MakeOval stroke} bdef
-/PO {MakeOval fill} bdef
-/PD {currentlinewidth 2 div 0 360 arc fill
-   PDlw -1 eq not {PDlw w /PDlw -1 def} if} def
-/FA {newpath tMatrix currentmatrix pop translate scale
-  0 0 1 5 -2 roll arc tMatrix setmatrix stroke} bdef
-/PA {newpath tMatrix currentmatrix pop	translate 0 0 moveto scale
-  0 0 1 5 -2 roll arc closepath tMatrix setmatrix fill} bdef
-/FAn {newpath tMatrix currentmatrix pop translate scale
-  0 0 1 5 -2 roll arcn tMatrix setmatrix stroke} bdef
-/PAn {newpath tMatrix currentmatrix pop translate 0 0 moveto scale
-  0 0 1 5 -2 roll arcn closepath tMatrix setmatrix fill} bdef
-/vradius 0 def /hradius 0 def /lry 0 def
-/lrx 0 def /uly 0 def /ulx 0 def /rad 0 def
-/MRR {/vradius xdef /hradius xdef /lry xdef /lrx xdef /uly xdef
-  /ulx xdef newpath tMatrix currentmatrix pop ulx hradius add uly
-  vradius add translate hradius vradius scale 0 0 1 180 270 arc 
-  tMatrix setmatrix lrx hradius sub uly vradius add translate
-  hradius vradius scale 0 0 1 270 360 arc tMatrix setmatrix
-  lrx hradius sub lry vradius sub translate hradius vradius scale
-  0 0 1 0 90 arc tMatrix setmatrix ulx hradius add lry vradius sub
-  translate hradius vradius scale 0 0 1 90 180 arc tMatrix setmatrix
-  closepath} bdef
-/FRR {MRR stroke } bdef
-/PRR {MRR fill } bdef
-/MlrRR {/lry xdef /lrx xdef /uly xdef /ulx xdef /rad lry uly sub 2 div def
-  newpath tMatrix currentmatrix pop ulx rad add uly rad add translate
-  rad rad scale 0 0 1 90 270 arc tMatrix setmatrix lrx rad sub lry rad
-  sub translate rad rad scale 0 0 1 270 90 arc tMatrix setmatrix
-  closepath} bdef
-/FlrRR {MlrRR stroke } bdef
-/PlrRR {MlrRR fill } bdef
-/MtbRR {/lry xdef /lrx xdef /uly xdef /ulx xdef /rad lrx ulx sub 2 div def
-  newpath tMatrix currentmatrix pop ulx rad add uly rad add translate
-  rad rad scale 0 0 1 180 360 arc tMatrix setmatrix lrx rad sub lry rad
-  sub translate rad rad scale 0 0 1 0 180 arc tMatrix setmatrix
-  closepath} bdef
-/FtbRR {MtbRR stroke } bdef
-/PtbRR {MtbRR fill } bdef
-/stri 6 array def /dtri 6 array def
-/smat 6 array def /dmat 6 array def
-/tmat1 6 array def /tmat2 6 array def /dif 3 array def
-/asub {/ind2 exch def /ind1 exch def dup dup
-  ind1 get exch ind2 get sub exch } bdef
-/tri_to_matrix {
-  2 0 asub 3 1 asub 4 0 asub 5 1 asub
-  dup 0 get exch 1 get 7 -1 roll astore } bdef
-/compute_transform {
-  dmat dtri tri_to_matrix tmat1 invertmatrix 
-  smat stri tri_to_matrix tmat2 concatmatrix } bdef
-/ds {stri astore pop} bdef
-/dt {dtri astore pop} bdef
-/db {2 copy /cols xdef /rows xdef mul dup 3 mul string
-  currentfile 
-  3 index 0 eq {/ASCIIHexDecode filter}
-  {/ASCII85Decode filter 3 index 2 eq {/RunLengthDecode filter} if }
-  ifelse exch readstring pop
-  dup 0 3 index getinterval /rbmap xdef
-  dup 2 index dup getinterval /gbmap xdef
-  1 index dup 2 mul exch getinterval /bbmap xdef pop pop}bdef
-/it {gs np dtri aload pop moveto lineto lineto cp c
-  cols rows 8 compute_transform 
-  rbmap gbmap bbmap true 3 colorimage gr}bdef
-/il {newpath moveto lineto stroke}bdef
-currentdict end def
-%%EndProlog
-
-%%BeginSetup
-MathWorks begin
-
-0 cap
-
-end
-%%EndSetup
-
-%%Page: 1 1
-%%BeginPageSetup
-%%PageBoundingBox:    59   211   550   580
-MathWorks begin
-bpage
-%%EndPageSetup
-
-%%BeginObject: obj1
-bplot
-
-/dpi2point 12 def
-portraitMode 0708 6960 csm
-
-    0     0  5903  4424 rc
-125 dict begin %Colortable dictionary
-/c0 { 0.000000 0.000000 0.000000 sr} bdef
-/c1 { 1.000000 1.000000 1.000000 sr} bdef
-/c2 { 0.900000 0.000000 0.000000 sr} bdef
-/c3 { 0.000000 0.820000 0.000000 sr} bdef
-/c4 { 0.000000 0.000000 0.800000 sr} bdef
-/c5 { 0.910000 0.820000 0.320000 sr} bdef
-/c6 { 1.000000 0.260000 0.820000 sr} bdef
-/c7 { 0.000000 0.820000 0.820000 sr} bdef
-c0
-1 j
-1 sg
-   0    0 5904 4425 rf
-6 w
-0 3605 4575 0 0 -3605 767 3937 4 MP
-PP
--4575 0 0 3605 4575 0 0 -3605 767 3937 5 MP stroke
-4 w
-DO
-SO
-6 w
-0 sg
- 767 3937 mt 5342 3937 L
- 767  332 mt 5342  332 L
- 767 3937 mt  767  332 L
-5342 3937 mt 5342  332 L
- 767 3937 mt 5342 3937 L
- 767 3937 mt  767  332 L
- 767 3937 mt  767 3891 L
- 767  332 mt  767  377 L
-%%IncludeResource: font Helvetica
-/Helvetica /ISOLatin1Encoding 120 FMSR
-
- 597 4082 mt 
-(-100) s
-1338 3937 mt 1338 3891 L
-1338  332 mt 1338  377 L
-1202 4082 mt 
-(-50) s
-1910 3937 mt 1910 3891 L
-1910  332 mt 1910  377 L
-1877 4082 mt 
-(0) s
-2482 3937 mt 2482 3891 L
-2482  332 mt 2482  377 L
-2416 4082 mt 
-(50) s
-3054 3937 mt 3054 3891 L
-3054  332 mt 3054  377 L
-2954 4082 mt 
-(100) s
-3626 3937 mt 3626 3891 L
-3626  332 mt 3626  377 L
-3526 4082 mt 
-(150) s
-4198 3937 mt 4198 3891 L
-4198  332 mt 4198  377 L
-4098 4082 mt 
-(200) s
-4770 3937 mt 4770 3891 L
-4770  332 mt 4770  377 L
-4670 4082 mt 
-(250) s
-5342 3937 mt 5342 3891 L
-5342  332 mt 5342  377 L
-5242 4082 mt 
-(300) s
- 767 3937 mt  812 3937 L
-5342 3937 mt 5296 3937 L
- 666 3981 mt 
-(0) s
- 767 3576 mt  812 3576 L
-5342 3576 mt 5296 3576 L
- 566 3620 mt 
-(0.1) s
- 767 3216 mt  812 3216 L
-5342 3216 mt 5296 3216 L
- 566 3260 mt 
-(0.2) s
- 767 2855 mt  812 2855 L
-5342 2855 mt 5296 2855 L
- 566 2899 mt 
-(0.3) s
- 767 2495 mt  812 2495 L
-5342 2495 mt 5296 2495 L
- 566 2539 mt 
-(0.4) s
- 767 2134 mt  812 2134 L
-5342 2134 mt 5296 2134 L
- 566 2178 mt 
-(0.5) s
- 767 1773 mt  812 1773 L
-5342 1773 mt 5296 1773 L
- 566 1817 mt 
-(0.6) s
- 767 1413 mt  812 1413 L
-5342 1413 mt 5296 1413 L
- 566 1457 mt 
-(0.7) s
- 767 1053 mt  812 1053 L
-5342 1053 mt 5296 1053 L
- 566 1097 mt 
-(0.8) s
- 767  692 mt  812  692 L
-5342  692 mt 5296  692 L
- 566  736 mt 
-(0.9) s
- 767  332 mt  812  332 L
-5342  332 mt 5296  332 L
- 666  376 mt 
-(1) s
- 767 3937 mt 5342 3937 L
- 767  332 mt 5342  332 L
- 767 3937 mt  767  332 L
-5342 3937 mt 5342  332 L
-gs 767 332 4576 3606 rc
-gr
-
-gs 866 259 4198 3752 rc
-24 W
-/c8 { 0.000000 0.000000 1.000000 sr} bdef
-c8
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3869 PD
-24 W
-3008 3872 PD
-24 W
-3008 3877 PD
-24 W
-3008 3881 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3868 PD
-24 W
-3008 3872 PD
-24 W
-3008 3876 PD
-24 W
-3008 3881 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3868 PD
-24 W
-3008 3872 PD
-24 W
-3008 3876 PD
-24 W
-3008 3881 PD
-24 W
-3008 3869 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3868 PD
-24 W
-3008 3872 PD
-24 W
-3008 3876 PD
-24 W
-3008 3881 PD
-24 W
-3008 3872 PD
-24 W
-3008 3868 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3868 PD
-24 W
-3008 3872 PD
-24 W
-3008 3876 PD
-24 W
-3008 3881 PD
-24 W
-3008 3877 PD
-24 W
-3008 3872 PD
-24 W
-3008 3868 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3868 PD
-24 W
-3008 3872 PD
-24 W
-3008 3876 PD
-24 W
-3008 3881 PD
-24 W
-3008 3876 PD
-24 W
-3008 3872 PD
-24 W
-3008 3868 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3868 PD
-24 W
-3008 3872 PD
-24 W
-3008 3877 PD
-24 W
-3008 3881 PD
-24 W
-3008 3876 PD
-24 W
-3008 3872 PD
-24 W
-3008 3868 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3868 PD
-24 W
-3008 3872 PD
-24 W
-3008 3877 PD
-24 W
-3008 3881 PD
-24 W
-3008 3876 PD
-24 W
-3008 3872 PD
-24 W
-3008 3868 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3869 PD
-24 W
-3008 3872 PD
-24 W
-3008 3881 PD
-24 W
-3008 3876 PD
-24 W
-3008 3872 PD
-24 W
-3008 3868 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3869 PD
-24 W
-3008 3877 PD
-24 W
-3008 3822 PD
-24 W
-3008 3881 PD
-24 W
-3008 3876 PD
-24 W
-3008 3872 PD
-24 W
-3008 3868 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3872 PD
-24 W
-3008 3881 PD
-24 W
-3008 3814 PD
-24 W
-3008 3881 PD
-24 W
-3008 3877 PD
-24 W
-3008 3872 PD
-24 W
-3008 3869 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3868 PD
-24 W
-3008 3876 PD
-24 W
-3008 3803 PD
-24 W
-3008 3881 PD
-24 W
-3008 3877 PD
-24 W
-3008 3872 PD
-24 W
-3008 3869 PD
-24 W
-3008 3866 PD
-24 W
-3008 3864 PD
-24 W
-3008 3866 PD
-24 W
-3008 3871 PD
-24 W
-3008 3877 PD
-24 W
-3008 3798 PD
-24 W
-2996 3877 PD
-24 W
-2996 3872 PD
-24 W
-2996 3868 PD
-24 W
-2996 3866 PD
-24 W
-2996 3863 PD
-24 W
-2996 3865 PD
-24 W
-2996 3868 PD
-24 W
-2996 3879 PD
-24 W
-2996 3793 PD
-24 W
-2986 3881 PD
-24 W
-2986 3876 PD
-24 W
-2986 3871 PD
-24 W
-2986 3865 PD
-24 W
-2986 3863 PD
-24 W
-2986 3870 PD
-24 W
-2986 3877 PD
-24 W
-2986 3794 PD
-24 W
-2982 3877 PD
-24 W
-2982 3868 PD
-24 W
-2982 3863 PD
-24 W
-2982 3862 PD
-24 W
-2982 3865 PD
-24 W
-2982 3870 PD
-24 W
-2982 3873 PD
-24 W
-2968 3879 PD
-24 W
-2968 3870 PD
-24 W
-2968 3865 PD
-24 W
-2968 3862 PD
-24 W
-2968 3863 PD
-24 W
-2968 3864 PD
-24 W
-2968 3869 PD
-24 W
-2968 3873 PD
-24 W
-2968 3870 PD
-24 W
-2968 3877 PD
-24 W
-2968 3850 PD
-24 W
-2962 3877 PD
-24 W
-2962 3870 PD
-24 W
-2962 3863 PD
-24 W
-2962 3862 PD
-24 W
-2962 3861 PD
-24 W
-2962 3863 PD
-24 W
-2962 3864 PD
-24 W
-2962 3866 PD
-24 W
-2962 3864 PD
-24 W
-2962 3869 PD
-24 W
-2962 3868 PD
-24 W
-2962 3869 PD
-24 W
-2962 3871 PD
-24 W
-2962 3840 PD
-24 W
-2964 3873 PD
-24 W
-2964 3864 PD
-24 W
-2964 3861 PD
-24 W
-2964 3860 PD
-24 W
-2964 3861 PD
-24 W
-2964 3863 PD
-24 W
-2964 3861 PD
-24 W
-2964 3865 PD
-24 W
-2964 3864 PD
-24 W
-2964 3865 PD
-24 W
-2964 3864 PD
-24 W
-2964 3867 PD
-24 W
-2964 3835 PD
-24 W
-2961 3869 PD
-24 W
-2961 3863 PD
-24 W
-2961 3861 PD
-24 W
-2961 3860 PD
-24 W
-2961 3859 PD
-24 W
-2961 3858 PD
-24 W
-2961 3860 PD
-24 W
-2961 3859 PD
-24 W
-2961 3858 PD
-24 W
-2961 3860 PD
-24 W
-2961 3868 PD
-24 W
-2961 3828 PD
-24 W
-2969 3869 PD
-24 W
-2969 3864 PD
-24 W
-2969 3861 PD
-24 W
-2969 3859 PD
-24 W
-2969 3858 PD
-24 W
-2969 3857 PD
-24 W
-2969 3859 PD
-24 W
-2969 3858 PD
-24 W
-2969 3856 PD
-24 W
-2969 3858 PD
-24 W
-2969 3865 PD
-24 W
-2969 3826 PD
-24 W
-2972 3873 PD
-24 W
-2972 3866 PD
-24 W
-2972 3863 PD
-24 W
-2972 3859 PD
-24 W
-2972 3858 PD
-24 W
-2972 3857 PD
-24 W
-2972 3856 PD
-24 W
-2972 3855 PD
-24 W
-2972 3853 PD
-24 W
-2972 3854 PD
-24 W
-2972 3860 PD
-24 W
-2972 3866 PD
-24 W
-2972 3822 PD
-24 W
-2988 3870 PD
-24 W
-2988 3864 PD
-24 W
-2988 3861 PD
-24 W
-2988 3858 PD
-24 W
-2988 3857 PD
-24 W
-2988 3856 PD
-24 W
-2988 3855 PD
-24 W
-2988 3856 PD
-24 W
-2988 3855 PD
-24 W
-2988 3854 PD
-24 W
-2988 3853 PD
-24 W
-2988 3854 PD
-24 W
-2988 3861 PD
-24 W
-2988 3868 PD
-24 W
-2988 3821 PD
-24 W
-2986 3877 PD
-24 W
-2986 3869 PD
-24 W
-2986 3865 PD
-24 W
-2986 3860 PD
-24 W
-2986 3859 PD
-24 W
-2986 3856 PD
-24 W
-2986 3854 PD
-24 W
-2986 3853 PD
-24 W
-2986 3852 PD
-24 W
-2986 3850 PD
-24 W
-2986 3849 PD
-24 W
-2986 3853 PD
-24 W
-2986 3859 PD
-24 W
-2986 3861 PD
-24 W
-2986 3863 PD
-24 W
-2986 3818 PD
-24 W
-2996 3868 PD
-24 W
-2996 3864 PD
-24 W
-2996 3859 PD
-24 W
-2996 3858 PD
-24 W
-2996 3855 PD
-24 W
-2996 3853 PD
-24 W
-2996 3851 PD
-24 W
-2996 3850 PD
-24 W
-2996 3848 PD
-24 W
-2996 3852 PD
-24 W
-2996 3857 PD
-24 W
-2996 3859 PD
-24 W
-2996 3861 PD
-24 W
-2996 3856 PD
-24 W
-2996 3816 PD
-24 W
-3006 3869 PD
-24 W
-3006 3865 PD
-24 W
-3006 3859 PD
-24 W
-3006 3858 PD
-24 W
-3006 3855 PD
-24 W
-3006 3854 PD
-24 W
-3006 3852 PD
-24 W
-3006 3850 PD
-24 W
-3006 3849 PD
-24 W
-3006 3847 PD
-24 W
-3006 3846 PD
-24 W
-3006 3849 PD
-24 W
-3006 3854 PD
-24 W
-3006 3856 PD
-24 W
-3006 3858 PD
-24 W
-3006 3852 PD
-24 W
-3006 3814 PD
-24 W
-3015 3869 PD
-24 W
-3015 3864 PD
-24 W
-3015 3858 PD
-24 W
-3015 3856 PD
-24 W
-3015 3853 PD
-24 W
-3015 3850 PD
-24 W
-3015 3848 PD
-24 W
-3015 3847 PD
-24 W
-3015 3845 PD
-24 W
-3015 3844 PD
-24 W
-3015 3846 PD
-24 W
-3015 3851 PD
-24 W
-3015 3853 PD
-24 W
-3015 3855 PD
-24 W
-3015 3849 PD
-24 W
-3015 3812 PD
-24 W
-3023 3871 PD
-24 W
-3023 3867 PD
-24 W
-3023 3860 PD
-24 W
-3023 3858 PD
-24 W
-3023 3854 PD
-24 W
-3023 3849 PD
-24 W
-3023 3848 PD
-24 W
-3023 3846 PD
-24 W
-3023 3844 PD
-24 W
-3023 3842 PD
-24 W
-3023 3843 PD
-24 W
-3023 3847 PD
-24 W
-3023 3849 PD
-24 W
-3023 3850 PD
-24 W
-3023 3843 PD
-24 W
-3023 3810 PD
-24 W
-3015 3868 PD
-24 W
-3015 3865 PD
-24 W
-3015 3860 PD
-24 W
-3015 3861 PD
-24 W
-3015 3853 PD
-24 W
-3015 3852 PD
-24 W
-3015 3849 PD
-24 W
-3015 3846 PD
-24 W
-3015 3843 PD
-24 W
-3015 3839 PD
-24 W
-3015 3840 PD
-24 W
-3015 3848 PD
-24 W
-3015 3854 PD
-24 W
-3015 3831 PD
-24 W
-3015 3816 PD
-24 W
-3015 3866 PD
-24 W
-3015 3868 PD
-24 W
-3015 3859 PD
-24 W
-3015 3857 PD
-24 W
-3015 3854 PD
-24 W
-3015 3851 PD
-24 W
-3015 3847 PD
-24 W
-3015 3840 PD
-24 W
-3015 3838 PD
-24 W
-3015 3837 PD
-24 W
-3015 3835 PD
-24 W
-3015 3840 PD
-24 W
-3015 3845 PD
-24 W
-3015 3857 PD
-24 W
-3015 3825 PD
-24 W
-3015 3824 PD
-24 W
-3018 3861 PD
-24 W
-3018 3859 PD
-24 W
-3018 3856 PD
-24 W
-3018 3853 PD
-24 W
-3018 3849 PD
-24 W
-3018 3840 PD
-24 W
-3018 3837 PD
-24 W
-3018 3834 PD
-24 W
-3018 3833 PD
-24 W
-3018 3836 PD
-24 W
-3018 3839 PD
-24 W
-3018 3850 PD
-24 W
-3018 3821 PD
-24 W
-3018 3828 PD
-24 W
-3026 3863 PD
-24 W
-3026 3861 PD
-24 W
-3026 3858 PD
-24 W
-3026 3855 PD
-24 W
-3026 3850 PD
-24 W
-3026 3840 PD
-24 W
-3026 3835 PD
-24 W
-3026 3833 PD
-24 W
-3026 3830 PD
-24 W
-3026 3832 PD
-24 W
-3026 3835 PD
-24 W
-3026 3845 PD
-24 W
-3026 3818 PD
-24 W
-3026 3831 PD
-24 W
-3021 3848 PD
-24 W
-3021 3840 PD
-24 W
-3021 3836 PD
-24 W
-3021 3832 PD
-24 W
-3021 3828 PD
-24 W
-3021 3833 PD
-24 W
-3021 3819 PD
-24 W
-3022 3854 PD
-24 W
-3022 3845 PD
-24 W
-3022 3839 PD
-24 W
-3022 3835 PD
-24 W
-3022 3828 PD
-24 W
-3022 3826 PD
-24 W
-3022 3828 PD
-24 W
-3022 3821 PD
-24 W
-3016 3857 PD
-24 W
-3016 3850 PD
-24 W
-3016 3845 PD
-24 W
-3016 3833 PD
-24 W
-3016 3828 PD
-24 W
-3016 3824 PD
-24 W
-3016 3831 PD
-24 W
-3067 3856 PD
-24 W
-3067 3852 PD
-24 W
-3067 3849 PD
-24 W
-3067 3843 PD
-24 W
-3067 3831 PD
-24 W
-3067 3825 PD
-24 W
-3067 3821 PD
-24 W
-3067 3818 PD
-24 W
-3067 3819 PD
-24 W
-3067 3821 PD
-24 W
-3067 3831 PD
-24 W
-3067 3804 PD
-24 W
-3139 3850 PD
-24 W
-3139 3840 PD
-24 W
-3139 3835 PD
-24 W
-3139 3828 PD
-24 W
-3139 3826 PD
-24 W
-3139 3822 PD
-24 W
-3139 3821 PD
-24 W
-3139 3818 PD
-24 W
-3139 3816 PD
-24 W
-3139 3814 PD
-24 W
-3139 3812 PD
-24 W
-3139 3810 PD
-24 W
-3139 3816 PD
-24 W
-3139 3824 PD
-24 W
-3139 3828 PD
-24 W
-3139 3831 PD
-24 W
-3139 3762 PD
-24 W
-3269 3822 PD
-24 W
-3269 3814 PD
-24 W
-3269 3803 PD
-24 W
-3269 3798 PD
-24 W
-3269 3793 PD
-24 W
-3269 3794 PD
-24 W
-3269 3628 PD
-24 W
-3482 3165 PD
-24 W
-3817 1475 PD
-24 W
-4038 822 PD
-24 W
-4038 874 PD
-24 W
-4038 1011 PD
-24 W
-4038 1260 PD
-24 W
-4038 1558 PD
-24 W
-4043 874 PD
-24 W
-4043 836 PD
-24 W
-4043 881 PD
-24 W
-4043 1045 PD
-24 W
-4043 1289 PD
-24 W
-4042 1011 PD
-24 W
-4042 881 PD
-24 W
-4042 813 PD
-24 W
-4042 860 PD
-24 W
-4042 1019 PD
-24 W
-4042 1251 PD
-24 W
-4042 1477 PD
-24 W
-4039 1260 PD
-24 W
-4039 1045 PD
-24 W
-4039 860 PD
-24 W
-4039 770 PD
-24 W
-4039 818 PD
-24 W
-4039 960 PD
-24 W
-4039 1124 PD
-24 W
-4039 1439 PD
-24 W
-4039 1558 PD
-24 W
-4039 1289 PD
-24 W
-4039 1019 PD
-24 W
-4039 818 PD
-24 W
-4039 762 PD
-24 W
-4039 807 PD
-24 W
-4039 902 PD
-24 W
-4039 1138 PD
-24 W
-4039 1364 PD
-24 W
-4040 1251 PD
-24 W
-4040 960 PD
-24 W
-4040 807 PD
-24 W
-4040 752 PD
-24 W
-4040 773 PD
-24 W
-4040 911 PD
-24 W
-4040 1085 PD
-24 W
-4040 1245 PD
-24 W
-4040 1490 PD
-24 W
-4038 1477 PD
-24 W
-4038 1124 PD
-24 W
-4038 902 PD
-24 W
-4038 773 PD
-24 W
-4038 721 PD
-24 W
-4038 769 PD
-24 W
-4038 903 PD
-24 W
-4038 1027 PD
-24 W
-4038 1229 PD
-24 W
-4038 1487 PD
-24 W
-4034 1439 PD
-24 W
-4034 1138 PD
-24 W
-4034 911 PD
-24 W
-4034 769 PD
-24 W
-4034 681 PD
-24 W
-4034 734 PD
-24 W
-4034 796 PD
-24 W
-4034 921 PD
-24 W
-4034 1128 PD
-24 W
-4034 1308 PD
-24 W
-4041 1364 PD
-24 W
-4041 1085 PD
-24 W
-4041 903 PD
-24 W
-4041 734 PD
-24 W
-4041 715 PD
-24 W
-4041 733 PD
-24 W
-4041 809 PD
-24 W
-4041 954 PD
-24 W
-4041 1102 PD
-24 W
-4041 1291 PD
-24 W
-4044 1245 PD
-24 W
-4044 1027 PD
-24 W
-4044 796 PD
-24 W
-4044 733 PD
-24 W
-4044 713 PD
-24 W
-4044 736 PD
-24 W
-4044 839 PD
-24 W
-4044 957 PD
-24 W
-4044 1117 PD
-24 W
-4044 1327 PD
-24 W
-4039 1490 PD
-24 W
-4039 1229 PD
-24 W
-4039 921 PD
-24 W
-4039 809 PD
-24 W
-4039 736 PD
-24 W
-4039 680 PD
-24 W
-4039 727 PD
-24 W
-4039 796 PD
-24 W
-4039 905 PD
-24 W
-4039 1072 PD
-24 W
-4039 1269 PD
-24 W
-4044 1487 PD
-24 W
-4044 1128 PD
-24 W
-4044 954 PD
-24 W
-4044 839 PD
-24 W
-4044 727 PD
-24 W
-4044 693 PD
-24 W
-4044 711 PD
-24 W
-4044 771 PD
-24 W
-4044 892 PD
-24 W
-4044 1052 PD
-24 W
-4044 1248 PD
-24 W
-4044 1436 PD
-24 W
-4046 1308 PD
-24 W
-4046 1102 PD
-24 W
-4046 957 PD
-24 W
-4046 796 PD
-24 W
-4046 711 PD
-24 W
-4046 686 PD
-24 W
-4046 701 PD
-24 W
-4046 777 PD
-24 W
-4046 899 PD
-24 W
-4046 1064 PD
-24 W
-4046 1231 PD
-24 W
-4044 1291 PD
-24 W
-4044 1117 PD
-24 W
-4044 905 PD
-24 W
-4044 771 PD
-24 W
-4044 701 PD
-24 W
-4044 663 PD
-24 W
-4044 685 PD
-24 W
-4044 757 PD
-24 W
-4044 880 PD
-24 W
-4044 1020 PD
-24 W
-4044 1232 PD
-24 W
-4044 1418 PD
-24 W
-4042 1327 PD
-24 W
-4042 1072 PD
-24 W
-4042 892 PD
-24 W
-4042 777 PD
-24 W
-4042 685 PD
-24 W
-4042 648 PD
-24 W
-4042 664 PD
-24 W
-4042 737 PD
-24 W
-4042 840 PD
-24 W
-4042 1010 PD
-24 W
-4042 1174 PD
-24 W
-4042 1335 PD
-24 W
-4040 1269 PD
-24 W
-4040 1052 PD
-24 W
-4040 899 PD
-24 W
-4040 757 PD
-24 W
-4040 664 PD
-24 W
-4040 622 PD
-24 W
-4040 642 PD
-24 W
-4040 704 PD
-24 W
-4040 824 PD
-24 W
-4040 958 PD
-24 W
-4040 1100 PD
-24 W
-4040 1211 PD
-24 W
-4040 1347 PD
-24 W
-4038 1248 PD
-24 W
-4038 1064 PD
-24 W
-4038 880 PD
-24 W
-4038 737 PD
-24 W
-4038 642 PD
-24 W
-4038 609 PD
-24 W
-4038 626 PD
-24 W
-4038 693 PD
-24 W
-4038 791 PD
-24 W
-4038 908 PD
-24 W
-4038 1007 PD
-24 W
-4038 1120 PD
-24 W
-4038 1347 PD
-24 W
-4040 1436 PD
-24 W
-4040 1231 PD
-24 W
-4040 1020 PD
-24 W
-4040 840 PD
-24 W
-4040 704 PD
-24 W
-4040 626 PD
-24 W
-4040 604 PD
-24 W
-4040 622 PD
-24 W
-4040 685 PD
-24 W
-4040 774 PD
-24 W
-4040 856 PD
-24 W
-4040 951 PD
-24 W
-4040 1150 PD
-24 W
-4040 1309 PD
-24 W
-4035 1232 PD
-24 W
-4035 1010 PD
-24 W
-4035 824 PD
-24 W
-4035 693 PD
-24 W
-4035 622 PD
-24 W
-4035 574 PD
-24 W
-4035 589 PD
-24 W
-4035 641 PD
-24 W
-4035 704 PD
-24 W
-4035 763 PD
-24 W
-4035 919 PD
-24 W
-4035 1058 PD
-24 W
-4035 1159 PD
-24 W
-4035 1347 PD
-24 W
-4036 1418 PD
-24 W
-4036 1174 PD
-24 W
-4036 958 PD
-24 W
-4036 791 PD
-24 W
-4036 685 PD
-24 W
-4036 589 PD
-24 W
-4036 566 PD
-24 W
-4036 586 PD
-24 W
-4036 630 PD
-24 W
-4036 662 PD
-24 W
-4036 779 PD
-24 W
-4036 896 PD
-24 W
-4036 982 PD
-24 W
-4036 1152 PD
-24 W
-4036 1278 PD
-24 W
-4040 1335 PD
-24 W
-4040 1100 PD
-24 W
-4040 908 PD
-24 W
-4040 774 PD
-24 W
-4040 641 PD
-24 W
-4040 586 PD
-24 W
-4040 577 PD
-24 W
-4040 599 PD
-24 W
-4040 611 PD
-24 W
-4040 690 PD
-24 W
-4040 783 PD
-24 W
-4040 858 PD
-24 W
-4040 1006 PD
-24 W
-4040 1119 PD
-24 W
-4040 1234 PD
-24 W
-4049 1211 PD
-24 W
-4049 1007 PD
-24 W
-4049 856 PD
-24 W
-4049 704 PD
-24 W
-4049 630 PD
-24 W
-4049 599 PD
-24 W
-4049 601 PD
-24 W
-4049 608 PD
-24 W
-4049 662 PD
-24 W
-4049 735 PD
-24 W
-4049 806 PD
-24 W
-4049 935 PD
-24 W
-4049 1033 PD
-24 W
-4049 1146 PD
-24 W
-4049 1293 PD
-24 W
-4046 1347 PD
-24 W
-4046 1120 PD
-24 W
-4046 951 PD
-24 W
-4046 763 PD
-24 W
-4046 662 PD
-24 W
-4046 611 PD
-24 W
-4046 608 PD
-24 W
-4046 577 PD
-24 W
-4046 595 PD
-24 W
-4046 652 PD
-24 W
-4046 699 PD
-24 W
-4046 809 PD
-24 W
-4046 904 PD
-24 W
-4046 997 PD
-24 W
-4046 1138 PD
-24 W
-4046 1278 PD
-24 W
-4042 1347 PD
-24 W
-4042 1150 PD
-24 W
-4042 919 PD
-24 W
-4042 779 PD
-24 W
-4042 690 PD
-24 W
-4042 662 PD
-24 W
-4042 595 PD
-24 W
-4042 553 PD
-24 W
-4042 571 PD
-24 W
-4042 591 PD
-24 W
-4042 659 PD
-24 W
-4042 731 PD
-24 W
-4042 799 PD
-24 W
-4042 916 PD
-24 W
-4042 1035 PD
-24 W
-4042 1194 PD
-24 W
-4042 1356 PD
-24 W
-4046 1309 PD
-24 W
-4046 1058 PD
-24 W
-4046 896 PD
-24 W
-4046 783 PD
-24 W
-4046 735 PD
-24 W
-4046 652 PD
-24 W
-4046 571 PD
-24 W
-4046 561 PD
-24 W
-4046 566 PD
-24 W
-4046 603 PD
-24 W
-4046 652 PD
-24 W
-4046 707 PD
-24 W
-4046 801 PD
-24 W
-4046 906 PD
-24 W
-4046 1047 PD
-24 W
-4046 1200 PD
-24 W
-4046 1159 PD
-24 W
-4046 982 PD
-24 W
-4046 858 PD
-24 W
-4046 806 PD
-24 W
-4046 699 PD
-24 W
-4046 591 PD
-24 W
-4046 566 PD
-24 W
-4046 551 PD
-24 W
-4046 569 PD
-24 W
-4046 611 PD
-24 W
-4046 645 PD
-24 W
-4046 728 PD
-24 W
-4046 813 PD
-24 W
-4046 943 PD
-24 W
-4046 1079 PD
-24 W
-4046 1257 PD
-24 W
-4047 1347 PD
-24 W
-4047 1152 PD
-24 W
-4047 1006 PD
-24 W
-4047 935 PD
-24 W
-4047 809 PD
-24 W
-4047 659 PD
-24 W
-4047 603 PD
-24 W
-4047 569 PD
-24 W
-4047 548 PD
-24 W
-4047 565 PD
-24 W
-4047 578 PD
-24 W
-4047 630 PD
-24 W
-4047 693 PD
-24 W
-4047 796 PD
-24 W
-4047 912 PD
-24 W
-4047 1074 PD
-24 W
-4047 1254 PD
-24 W
-4054 1278 PD
-24 W
-4054 1119 PD
-24 W
-4054 1033 PD
-24 W
-4054 904 PD
-24 W
-4054 731 PD
-24 W
-4054 652 PD
-24 W
-4054 611 PD
-24 W
-4054 565 PD
-24 W
-4054 559 PD
-24 W
-4054 564 PD
-24 W
-4054 592 PD
-24 W
-4054 646 PD
-24 W
-4054 726 PD
-24 W
-4054 833 PD
-24 W
-4054 987 PD
-24 W
-4054 1149 PD
-24 W
-4054 1325 PD
-24 W
-4053 1234 PD
-24 W
-4053 1146 PD
-24 W
-4053 997 PD
-24 W
-4053 799 PD
-24 W
-4053 707 PD
-24 W
-4053 645 PD
-24 W
-4053 578 PD
-24 W
-4053 564 PD
-24 W
-4053 545 PD
-24 W
-4053 559 PD
-24 W
-4053 585 PD
-24 W
-4053 649 PD
-24 W
-4053 732 PD
-24 W
-4053 861 PD
-24 W
-4053 1012 PD
-24 W
-4053 1174 PD
-24 W
-4053 1315 PD
-24 W
-4056 1293 PD
-24 W
-4056 1138 PD
-24 W
-4056 916 PD
-24 W
-4056 801 PD
-24 W
-4056 728 PD
-24 W
-4056 630 PD
-24 W
-4056 592 PD
-24 W
-4056 559 PD
-24 W
-4056 543 PD
-24 W
-4056 552 PD
-24 W
-4056 586 PD
-24 W
-4056 651 PD
-24 W
-4056 762 PD
-24 W
-4056 887 PD
-24 W
-4056 1037 PD
-24 W
-4056 1161 PD
-24 W
-4056 1288 PD
-24 W
-4053 1278 PD
-24 W
-4053 1035 PD
-24 W
-4053 906 PD
-24 W
-4053 813 PD
-24 W
-4053 693 PD
-24 W
-4053 646 PD
-24 W
-4053 585 PD
-24 W
-4053 552 PD
-24 W
-4053 530 PD
-24 W
-4053 542 PD
-24 W
-4053 574 PD
-24 W
-4053 652 PD
-24 W
-4053 758 PD
-24 W
-4053 885 PD
-24 W
-4053 1003 PD
-24 W
-4053 1119 PD
-24 W
-4053 1267 PD
-24 W
-4054 1194 PD
-24 W
-4054 1047 PD
-24 W
-4054 943 PD
-24 W
-4054 796 PD
-24 W
-4054 726 PD
-24 W
-4054 649 PD
-24 W
-4054 586 PD
-24 W
-4054 542 PD
-24 W
-4054 521 PD
-24 W
-4054 528 PD
-24 W
-4054 580 PD
-24 W
-4054 652 PD
-24 W
-4054 759 PD
-24 W
-4054 854 PD
-24 W
-4054 960 PD
-24 W
-4054 1098 PD
-24 W
-4054 1173 PD
-24 W
-4049 1356 PD
-24 W
-4049 1200 PD
-24 W
-4049 1079 PD
-24 W
-4049 912 PD
-24 W
-4049 833 PD
-24 W
-4049 732 PD
-24 W
-4049 651 PD
-24 W
-4049 574 PD
-24 W
-4049 528 PD
-24 W
-4049 499 PD
-24 W
-4049 511 PD
-24 W
-4049 558 PD
-24 W
-4049 633 PD
-24 W
-4049 716 PD
-24 W
-4049 803 PD
-24 W
-4049 922 PD
-24 W
-4049 998 PD
-24 W
-4049 1136 PD
-24 W
-4049 1276 PD
-24 W
-4043 1257 PD
-24 W
-4043 1074 PD
-24 W
-4043 987 PD
-24 W
-4043 861 PD
-24 W
-4043 762 PD
-24 W
-4043 652 PD
-24 W
-4043 580 PD
-24 W
-4043 511 PD
-24 W
-4043 480 PD
-24 W
-4043 495 PD
-24 W
-4043 533 PD
-24 W
-4043 599 PD
-24 W
-4043 663 PD
-24 W
-4043 757 PD
-24 W
-4043 833 PD
-24 W
-4043 950 PD
-24 W
-4043 1074 PD
-24 W
-4043 1238 PD
-24 W
-4042 1254 PD
-24 W
-4042 1149 PD
-24 W
-4042 1012 PD
-24 W
-4042 887 PD
-24 W
-4042 758 PD
-24 W
-4042 652 PD
-24 W
-4042 558 PD
-24 W
-4042 495 PD
-24 W
-4042 467 PD
-24 W
-4042 476 PD
-24 W
-4042 508 PD
-24 W
-4042 554 PD
-24 W
-4042 626 PD
-24 W
-4042 681 PD
-24 W
-4042 780 PD
-24 W
-4042 890 PD
-24 W
-4042 1038 PD
-24 W
-4042 1122 PD
-24 W
-4042 1263 PD
-24 W
-4037 1325 PD
-24 W
-4037 1174 PD
-24 W
-4037 1037 PD
-24 W
-4037 885 PD
-24 W
-4037 759 PD
-24 W
-4037 633 PD
-24 W
-4037 533 PD
-24 W
-4037 476 PD
-24 W
-4037 448 PD
-24 W
-4037 462 PD
-24 W
-4037 483 PD
-24 W
-4037 527 PD
-24 W
-4037 578 PD
-24 W
-4037 652 PD
-24 W
-4037 741 PD
-24 W
-4037 868 PD
-24 W
-4037 951 PD
-24 W
-4037 1078 PD
-24 W
-4037 1203 PD
-24 W
-4040 1315 PD
-24 W
-4040 1161 PD
-24 W
-4040 1003 PD
-24 W
-4040 854 PD
-24 W
-4040 716 PD
-24 W
-4040 599 PD
-24 W
-4040 508 PD
-24 W
-4040 462 PD
-24 W
-4040 446 PD
-24 W
-4040 453 PD
-24 W
-4040 481 PD
-24 W
-4040 508 PD
-24 W
-4040 566 PD
-24 W
-4040 642 PD
-24 W
-4040 754 PD
-24 W
-4040 819 PD
-24 W
-4040 937 PD
-24 W
-4040 1054 PD
-24 W
-4040 1195 PD
-24 W
-4040 1288 PD
-24 W
-4040 1119 PD
-24 W
-4040 960 PD
-24 W
-4040 803 PD
-24 W
-4040 663 PD
-24 W
-4040 554 PD
-24 W
-4040 483 PD
-24 W
-4040 453 PD
-24 W
-4040 443 PD
-24 W
-4040 449 PD
-24 W
-4040 472 PD
-24 W
-4040 510 PD
-24 W
-4040 569 PD
-24 W
-4040 662 PD
-24 W
-4040 724 PD
-24 W
-4040 828 PD
-24 W
-4040 935 PD
-24 W
-4040 1067 PD
-24 W
-4040 1181 PD
-24 W
-4038 1267 PD
-24 W
-4038 1098 PD
-24 W
-4038 922 PD
-24 W
-4038 757 PD
-24 W
-4038 626 PD
-24 W
-4038 527 PD
-24 W
-4038 481 PD
-24 W
-4038 449 PD
-24 W
-4038 431 PD
-24 W
-4038 446 PD
-24 W
-4038 460 PD
-24 W
-4038 497 PD
-24 W
-4038 566 PD
-24 W
-4038 623 PD
-24 W
-4038 709 PD
-24 W
-4038 802 PD
-24 W
-4038 920 PD
-24 W
-4038 1024 PD
-24 W
-4038 1200 PD
-24 W
-4046 1173 PD
-24 W
-4046 998 PD
-24 W
-4046 833 PD
-24 W
-4046 681 PD
-24 W
-4046 578 PD
-24 W
-4046 508 PD
-24 W
-4046 472 PD
-24 W
-4046 446 PD
-24 W
-4046 438 PD
-24 W
-4046 444 PD
-24 W
-4046 475 PD
-24 W
-4046 536 PD
-24 W
-4046 571 PD
-24 W
-4046 651 PD
-24 W
-4046 739 PD
-24 W
-4046 851 PD
-24 W
-4046 952 PD
-24 W
-4046 1123 PD
-24 W
-4043 1136 PD
-24 W
-4043 950 PD
-24 W
-4043 780 PD
-24 W
-4043 652 PD
-24 W
-4043 566 PD
-24 W
-4043 510 PD
-24 W
-4043 460 PD
-24 W
-4043 444 PD
-24 W
-4043 425 PD
-24 W
-4043 433 PD
-24 W
-4043 467 PD
-24 W
-4043 495 PD
-24 W
-4043 555 PD
-24 W
-4043 626 PD
-24 W
-4043 721 PD
-24 W
-4043 809 PD
-24 W
-4043 964 PD
-24 W
-4043 1129 PD
-24 W
-4043 1191 PD
-24 W
-4042 1276 PD
-24 W
-4042 1074 PD
-24 W
-4042 890 PD
-24 W
-4042 741 PD
-24 W
-4042 642 PD
-24 W
-4042 569 PD
-24 W
-4042 497 PD
-24 W
-4042 475 PD
-24 W
-4042 433 PD
-24 W
-4042 420 PD
-24 W
-4042 429 PD
-24 W
-4042 451 PD
-24 W
-4042 490 PD
-24 W
-4042 545 PD
-24 W
-4042 622 PD
-24 W
-4042 698 PD
-24 W
-4042 835 PD
-24 W
-4042 986 PD
-24 W
-4042 1049 PD
-24 W
-4042 1153 PD
-24 W
-4042 1224 PD
-24 W
-4038 1238 PD
-24 W
-4038 1038 PD
-24 W
-4038 868 PD
-24 W
-4038 754 PD
-24 W
-4038 662 PD
-24 W
-4038 566 PD
-24 W
-4038 536 PD
-24 W
-4038 467 PD
-24 W
-4038 429 PD
-24 W
-4038 406 PD
-24 W
-4038 419 PD
-24 W
-4038 433 PD
-24 W
-4038 466 PD
-24 W
-4038 521 PD
-24 W
-4038 579 PD
-24 W
-4038 693 PD
-24 W
-4038 825 PD
-24 W
-4038 886 PD
-24 W
-4038 980 PD
-24 W
-4038 1046 PD
-24 W
-4038 1163 PD
-24 W
-4045 1122 PD
-24 W
-4045 951 PD
-24 W
-4045 819 PD
-24 W
-4045 724 PD
-24 W
-4045 623 PD
-24 W
-4045 571 PD
-24 W
-4045 495 PD
-24 W
-4045 451 PD
-24 W
-4045 419 PD
-24 W
-4045 410 PD
-24 W
-4045 416 PD
-24 W
-4045 442 PD
-24 W
-4045 488 PD
-24 W
-4045 540 PD
-24 W
-4045 643 PD
-24 W
-4045 766 PD
-24 W
-4045 810 PD
-24 W
-4045 900 PD
-24 W
-4045 963 PD
-24 W
-4045 1075 PD
-24 W
-4045 1248 PD
-24 W
-4043 1263 PD
-24 W
-4043 1078 PD
-24 W
-4043 937 PD
-24 W
-4043 828 PD
-24 W
-4043 709 PD
-24 W
-4043 651 PD
-24 W
-4043 555 PD
-24 W
-4043 490 PD
-24 W
-4043 433 PD
-24 W
-4043 416 PD
-24 W
-4043 400 PD
-24 W
-4043 407 PD
-24 W
-4043 432 PD
-24 W
-4043 468 PD
-24 W
-4043 548 PD
-24 W
-4043 651 PD
-24 W
-4043 692 PD
-24 W
-4043 771 PD
-24 W
-4043 828 PD
-24 W
-4043 931 PD
-24 W
-4043 1093 PD
-24 W
-4043 1222 PD
-24 W
-4043 1203 PD
-24 W
-4043 1054 PD
-24 W
-4043 935 PD
-24 W
-4043 802 PD
-24 W
-4043 739 PD
-24 W
-4043 626 PD
-24 W
-4043 545 PD
-24 W
-4043 466 PD
-24 W
-4043 442 PD
-24 W
-4043 407 PD
-24 W
-4043 397 PD
-24 W
-4043 403 PD
-24 W
-4043 424 PD
-24 W
-4043 482 PD
-24 W
-4043 567 PD
-24 W
-4043 604 PD
-24 W
-4043 673 PD
-24 W
-4043 724 PD
-24 W
-4043 817 PD
-24 W
-4043 966 PD
-24 W
-4043 1089 PD
-24 W
-4043 1209 PD
-24 W
-4042 1195 PD
-24 W
-4042 1067 PD
-24 W
-4042 920 PD
-24 W
-4042 851 PD
-24 W
-4042 721 PD
-24 W
-4042 622 PD
-24 W
-4042 521 PD
-24 W
-4042 488 PD
-24 W
-4042 432 PD
-24 W
-4042 403 PD
-24 W
-4042 388 PD
-24 W
-4042 392 PD
-24 W
-4042 424 PD
-24 W
-4042 486 PD
-24 W
-4042 518 PD
-24 W
-4042 574 PD
-24 W
-4042 617 PD
-24 W
-4042 697 PD
-24 W
-4042 831 PD
-24 W
-4042 943 PD
-24 W
-4042 1056 PD
-24 W
-4042 1215 PD
-24 W
-4043 1181 PD
-24 W
-4043 1024 PD
-24 W
-4043 952 PD
-24 W
-4043 809 PD
-24 W
-4043 698 PD
-24 W
-4043 579 PD
-24 W
-4043 540 PD
-24 W
-4043 468 PD
-24 W
-4043 424 PD
-24 W
-4043 392 PD
-24 W
-4043 382 PD
-24 W
-4043 393 PD
-24 W
-4043 435 PD
-24 W
-4043 463 PD
-24 W
-4043 509 PD
-24 W
-4043 545 PD
-24 W
-4043 614 PD
-24 W
-4043 733 PD
-24 W
-4043 836 PD
-24 W
-4043 942 PD
-24 W
-4043 1092 PD
-24 W
-4043 1189 PD
-24 W
-4038 1200 PD
-24 W
-4038 1123 PD
-24 W
-4038 964 PD
-24 W
-4038 835 PD
-24 W
-4038 693 PD
-24 W
-4038 643 PD
-24 W
-4038 548 PD
-24 W
-4038 482 PD
-24 W
-4038 424 PD
-24 W
-4038 393 PD
-24 W
-4038 370 PD
-24 W
-4038 382 PD
-24 W
-4038 402 PD
-24 W
-4038 429 PD
-24 W
-4038 453 PD
-24 W
-4038 503 PD
-24 W
-4038 598 PD
-24 W
-4038 685 PD
-24 W
-4038 777 PD
-24 W
-4038 911 PD
-24 W
-4038 1000 PD
-24 W
-4038 1122 PD
-24 W
-4035 1129 PD
-24 W
-4035 986 PD
-24 W
-4035 825 PD
-24 W
-4035 766 PD
-24 W
-4035 651 PD
-24 W
-4035 567 PD
-24 W
-4035 486 PD
-24 W
-4035 435 PD
-24 W
-4035 382 PD
-24 W
-4035 364 PD
-24 W
-4035 376 PD
-24 W
-4035 385 PD
-24 W
-4035 398 PD
-24 W
-4035 429 PD
-24 W
-4035 497 PD
-24 W
-4035 567 PD
-24 W
-4035 643 PD
-24 W
-4035 760 PD
-24 W
-4035 840 PD
-24 W
-4035 951 PD
-24 W
-4035 1099 PD
-24 W
-4035 1173 PD
-24 W
-4042 1191 PD
-24 W
-4042 1049 PD
-24 W
-4042 886 PD
-24 W
-4042 810 PD
-24 W
-4042 692 PD
-24 W
-4042 604 PD
-24 W
-4042 518 PD
-24 W
-4042 463 PD
-24 W
-4042 402 PD
-24 W
-4042 376 PD
-24 W
-4042 366 PD
-24 W
-4042 369 PD
-24 W
-4042 378 PD
-24 W
-4042 403 PD
-24 W
-4042 463 PD
-24 W
-4042 526 PD
-24 W
-4042 596 PD
-24 W
-4042 706 PD
-24 W
-4042 781 PD
-24 W
-4042 887 PD
-24 W
-4042 1029 PD
-24 W
-4042 1101 PD
-24 W
-4042 1194 PD
-24 W
-4044 1153 PD
-24 W
-4044 980 PD
-24 W
-4044 900 PD
-24 W
-4044 771 PD
-24 W
-4044 673 PD
-24 W
-4044 574 PD
-24 W
-4044 509 PD
-24 W
-4044 429 PD
-24 W
-4044 385 PD
-24 W
-4044 369 PD
-24 W
-4044 362 PD
-24 W
-4044 363 PD
-24 W
-4044 376 PD
-24 W
-4044 418 PD
-24 W
-4044 469 PD
-24 W
-4044 529 PD
-24 W
-4044 625 PD
-24 W
-4044 694 PD
-24 W
-4044 791 PD
-24 W
-4044 925 PD
-24 W
-4044 993 PD
-24 W
-4044 1083 PD
-24 W
-4049 1224 PD
-24 W
-4049 1046 PD
-24 W
-4049 963 PD
-24 W
-4049 828 PD
-24 W
-4049 724 PD
-24 W
-4049 617 PD
-24 W
-4049 545 PD
-24 W
-4049 453 PD
-24 W
-4049 398 PD
-24 W
-4049 378 PD
-24 W
-4049 363 PD
-24 W
-4049 360 PD
-24 W
-4049 365 PD
-24 W
-4049 395 PD
-24 W
-4049 438 PD
-24 W
-4049 490 PD
-24 W
-4049 578 PD
-24 W
-4049 641 PD
-24 W
-4049 733 PD
-24 W
-4049 860 PD
-24 W
-4049 926 PD
-24 W
-4049 1012 PD
-24 W
-4050 1163 PD
-24 W
-4050 1075 PD
-24 W
-4050 931 PD
-24 W
-4050 817 PD
-24 W
-4050 697 PD
-24 W
-4050 614 PD
-24 W
-4050 503 PD
-24 W
-4050 429 PD
-24 W
-4050 403 PD
-24 W
-4050 376 PD
-24 W
-4050 365 PD
-24 W
-4050 355 PD
-24 W
-4050 365 PD
-24 W
-4050 394 PD
-24 W
-4050 433 PD
-24 W
-4050 505 PD
-24 W
-4050 559 PD
-24 W
-4050 640 PD
-24 W
-4050 755 PD
-24 W
-4050 816 PD
-24 W
-4050 897 PD
-24 W
-4050 1114 PD
-24 W
-4046 1248 PD
-24 W
-4046 1093 PD
-24 W
-4046 966 PD
-24 W
-4046 831 PD
-24 W
-4046 733 PD
-24 W
-4046 598 PD
-24 W
-4046 497 PD
-24 W
-4046 463 PD
-24 W
-4046 418 PD
-24 W
-4046 395 PD
-24 W
-4046 365 PD
-24 W
-4046 346 PD
-24 W
-4046 354 PD
-24 W
-4046 374 PD
-24 W
-4046 420 PD
-24 W
-4046 460 PD
-24 W
-4046 524 PD
-24 W
-4046 620 PD
-24 W
-4046 673 PD
-24 W
-4046 744 PD
-24 W
-4046 940 PD
-24 W
-4046 1153 PD
-24 W
-4046 1222 PD
-24 W
-4046 1089 PD
-24 W
-4046 943 PD
-24 W
-4046 836 PD
-24 W
-4046 685 PD
-24 W
-4046 567 PD
-24 W
-4046 526 PD
-24 W
-4046 469 PD
-24 W
-4046 438 PD
-24 W
-4046 394 PD
-24 W
-4046 354 PD
-24 W
-4046 346 PD
-24 W
-4046 351 PD
-24 W
-4046 378 PD
-24 W
-4046 408 PD
-24 W
-4046 457 PD
-24 W
-4046 537 PD
-24 W
-4046 583 PD
-24 W
-4046 647 PD
-24 W
-4046 825 PD
-24 W
-4046 1025 PD
-24 W
-4046 1147 PD
-24 W
-4047 1209 PD
-24 W
-4047 1056 PD
-24 W
-4047 942 PD
-24 W
-4047 777 PD
-24 W
-4047 643 PD
-24 W
-4047 596 PD
-24 W
-4047 529 PD
-24 W
-4047 490 PD
-24 W
-4047 433 PD
-24 W
-4047 374 PD
-24 W
-4047 351 PD
-24 W
-4047 342 PD
-24 W
-4047 351 PD
-24 W
-4047 369 PD
-24 W
-4047 406 PD
-24 W
-4047 470 PD
-24 W
-4047 509 PD
-24 W
-4047 564 PD
-24 W
-4047 724 PD
-24 W
-4047 908 PD
-24 W
-4047 1025 PD
-24 W
-4047 1147 PD
-24 W
-4044 1215 PD
-24 W
-4044 1092 PD
-24 W
-4044 911 PD
-24 W
-4044 760 PD
-24 W
-4044 706 PD
-24 W
-4044 625 PD
-24 W
-4044 578 PD
-24 W
-4044 505 PD
-24 W
-4044 420 PD
-24 W
-4044 378 PD
-24 W
-4044 351 PD
-24 W
-4044 336 PD
-24 W
-4044 340 PD
-24 W
-4044 358 PD
-24 W
-4044 400 PD
-24 W
-4044 429 PD
-24 W
-4044 472 PD
-24 W
-4044 605 PD
-24 W
-4044 767 PD
-24 W
-4044 873 PD
-24 W
-4044 987 PD
-24 W
-4044 1108 PD
-24 W
-4047 1189 PD
-24 W
-4047 1000 PD
-24 W
-4047 840 PD
-24 W
-4047 781 PD
-24 W
-4047 694 PD
-24 W
-4047 641 PD
-24 W
-4047 559 PD
-24 W
-4047 460 PD
-24 W
-4047 408 PD
-24 W
-4047 369 PD
-24 W
-4047 340 PD
-24 W
-4047 335 PD
-24 W
-4047 342 PD
-24 W
-4047 370 PD
-24 W
-4047 393 PD
-24 W
-4047 428 PD
-24 W
-4047 544 PD
-24 W
-4047 691 PD
-24 W
-4047 790 PD
-24 W
-4047 897 PD
-24 W
-4047 1013 PD
-24 W
-4047 1135 PD
-24 W
-4048 1122 PD
-24 W
-4048 951 PD
-24 W
-4048 887 PD
-24 W
-4048 791 PD
-24 W
-4048 733 PD
-24 W
-4048 640 PD
-24 W
-4048 524 PD
-24 W
-4048 457 PD
-24 W
-4048 406 PD
-24 W
-4048 358 PD
-24 W
-4048 342 PD
-24 W
-4048 334 PD
-24 W
-4048 344 PD
-24 W
-4048 358 PD
-24 W
-4048 383 PD
-24 W
-4048 476 PD
-24 W
-4048 602 PD
-24 W
-4048 690 PD
-24 W
-4048 788 PD
-24 W
-4048 896 PD
-24 W
-4048 1012 PD
-24 W
-4046 1099 PD
-24 W
-4046 1029 PD
-24 W
-4046 925 PD
-24 W
-4046 860 PD
-24 W
-4046 755 PD
-24 W
-4046 620 PD
-24 W
-4046 537 PD
-24 W
-4046 470 PD
-24 W
-4046 400 PD
-24 W
-4046 370 PD
-24 W
-4046 344 PD
-24 W
-4046 332 PD
-24 W
-4046 336 PD
-24 W
-4046 347 PD
-24 W
-4046 410 PD
-24 W
-4046 507 PD
-24 W
-4046 581 PD
-24 W
-4046 667 PD
-24 W
-4046 763 PD
-24 W
-4046 868 PD
-24 W
-4046 1109 PD
-24 W
-4051 1173 PD
-24 W
-4051 1101 PD
-24 W
-4051 993 PD
-24 W
-4051 926 PD
-24 W
-4051 816 PD
-24 W
-4051 673 PD
-24 W
-4051 583 PD
-24 W
-4051 509 PD
-24 W
-4051 429 PD
-24 W
-4051 393 PD
-24 W
-4051 358 PD
-24 W
-4051 336 PD
-24 W
-4051 335 PD
-24 W
-4051 340 PD
-24 W
-4051 389 PD
-24 W
-4051 472 PD
-24 W
-4051 539 PD
-24 W
-4051 617 PD
-24 W
-4051 707 PD
-24 W
-4051 807 PD
-24 W
-4051 1039 PD
-24 W
-4055 1194 PD
-24 W
-4055 1083 PD
-24 W
-4055 1012 PD
-24 W
-4055 897 PD
-24 W
-4055 744 PD
-24 W
-4055 647 PD
-24 W
-4055 564 PD
-24 W
-4055 472 PD
-24 W
-4055 428 PD
-24 W
-4055 383 PD
-24 W
-4055 347 PD
-24 W
-4055 340 PD
-24 W
-4055 338 PD
-24 W
-4055 369 PD
-24 W
-4055 434 PD
-24 W
-4055 491 PD
-24 W
-4055 561 PD
-24 W
-4055 643 PD
-24 W
-4055 735 PD
-24 W
-4055 955 PD
-24 W
-4055 1156 PD
-24 W
-4048 1114 PD
-24 W
-4048 940 PD
-24 W
-4048 825 PD
-24 W
-4048 724 PD
-24 W
-4048 605 PD
-24 W
-4048 544 PD
-24 W
-4048 476 PD
-24 W
-4048 410 PD
-24 W
-4048 389 PD
-24 W
-4048 369 PD
-24 W
-4048 337 PD
-24 W
-4048 360 PD
-24 W
-4048 395 PD
-24 W
-4048 444 PD
-24 W
-4048 507 PD
-24 W
-4048 582 PD
-24 W
-4048 757 PD
-24 W
-4048 939 PD
-24 W
-4048 1135 PD
-24 W
-4048 1224 PD
-24 W
-4041 1153 PD
-24 W
-4041 1025 PD
-24 W
-4041 908 PD
-24 W
-4041 767 PD
-24 W
-4041 691 PD
-24 W
-4041 602 PD
-24 W
-4041 507 PD
-24 W
-4041 472 PD
-24 W
-4041 434 PD
-24 W
-4041 360 PD
-24 W
-4041 336 PD
-24 W
-4041 345 PD
-24 W
-4041 369 PD
-24 W
-4041 408 PD
-24 W
-4041 460 PD
-24 W
-4041 595 PD
-24 W
-4041 747 PD
-24 W
-4041 919 PD
-24 W
-4041 1001 PD
-24 W
-4041 1205 PD
-24 W
-4042 1147 PD
-24 W
-4042 1025 PD
-24 W
-4042 873 PD
-24 W
-4042 790 PD
-24 W
-4042 690 PD
-24 W
-4042 581 PD
-24 W
-4042 539 PD
-24 W
-4042 491 PD
-24 W
-4042 395 PD
-24 W
-4042 345 PD
-24 W
-4042 340 PD
-24 W
-4042 350 PD
-24 W
-4042 374 PD
-24 W
-4042 413 PD
-24 W
-4042 523 PD
-24 W
-4042 655 PD
-24 W
-4042 812 PD
-24 W
-4042 888 PD
-24 W
-4042 1083 PD
-24 W
-4042 1222 PD
-24 W
-4042 1147 PD
-24 W
-4042 987 PD
-24 W
-4042 897 PD
-24 W
-4042 788 PD
-24 W
-4042 667 PD
-24 W
-4042 617 PD
-24 W
-4042 561 PD
-24 W
-4042 444 PD
-24 W
-4042 369 PD
-24 W
-4042 350 PD
-24 W
-4042 345 PD
-24 W
-4042 355 PD
-24 W
-4042 379 PD
-24 W
-4042 465 PD
-24 W
-4042 576 PD
-24 W
-4042 714 PD
-24 W
-4042 784 PD
-24 W
-4042 967 PD
-24 W
-4042 1099 PD
-24 W
-4042 1210 PD
-24 W
-4043 1108 PD
-24 W
-4043 1013 PD
-24 W
-4043 896 PD
-24 W
-4043 763 PD
-24 W
-4043 707 PD
-24 W
-4043 643 PD
-24 W
-4043 507 PD
-24 W
-4043 408 PD
-24 W
-4043 374 PD
-24 W
-4043 355 PD
-24 W
-4043 350 PD
-24 W
-4043 361 PD
-24 W
-4043 420 PD
-24 W
-4043 508 PD
-24 W
-4043 628 PD
-24 W
-4043 691 PD
-24 W
-4043 860 PD
-24 W
-4043 983 PD
-24 W
-4043 1088 PD
-24 W
-4044 1135 PD
-24 W
-4044 1012 PD
-24 W
-4044 868 PD
-24 W
-4044 807 PD
-24 W
-4044 735 PD
-24 W
-4044 582 PD
-24 W
-4044 460 PD
-24 W
-4044 413 PD
-24 W
-4044 379 PD
-24 W
-4044 361 PD
-24 W
-4044 356 PD
-24 W
-4044 389 PD
-24 W
-4044 454 PD
-24 W
-4044 553 PD
-24 W
-4044 608 PD
-24 W
-4044 762 PD
-24 W
-4044 875 PD
-24 W
-4044 974 PD
-24 W
-4044 1190 PD
-24 W
-4037 1109 PD
-24 W
-4037 1039 PD
-24 W
-4037 955 PD
-24 W
-4037 757 PD
-24 W
-4037 595 PD
-24 W
-4037 523 PD
-24 W
-4037 465 PD
-24 W
-4037 420 PD
-24 W
-4037 389 PD
-24 W
-4037 355 PD
-24 W
-4037 376 PD
-24 W
-4037 436 PD
-24 W
-4037 476 PD
-24 W
-4037 582 PD
-24 W
-4037 676 PD
-24 W
-4037 762 PD
-24 W
-4037 945 PD
-24 W
-4037 1074 PD
-24 W
-4037 1174 PD
-24 W
-4030 1156 PD
-24 W
-4030 939 PD
-24 W
-4030 747 PD
-24 W
-4030 655 PD
-24 W
-4030 576 PD
-24 W
-4030 508 PD
-24 W
-4030 454 PD
-24 W
-4030 376 PD
-24 W
-4030 353 PD
-24 W
-4030 372 PD
-24 W
-4030 396 PD
-24 W
-4030 469 PD
-24 W
-4030 539 PD
-24 W
-4030 607 PD
-24 W
-4030 764 PD
-24 W
-4030 876 PD
-24 W
-4030 966 PD
-24 W
-4030 1161 PD
-24 W
-4024 1135 PD
-24 W
-4024 919 PD
-24 W
-4024 812 PD
-24 W
-4024 714 PD
-24 W
-4024 628 PD
-24 W
-4024 553 PD
-24 W
-4024 436 PD
-24 W
-4024 372 PD
-24 W
-4024 351 PD
-24 W
-4024 359 PD
-24 W
-4024 399 PD
-24 W
-4024 443 PD
-24 W
-4024 493 PD
-24 W
-4024 621 PD
-24 W
-4024 713 PD
-24 W
-4024 791 PD
-24 W
-4024 969 PD
-24 W
-4024 1059 PD
-24 W
-4024 1250 PD
-24 W
-4029 1224 PD
-24 W
-4029 1001 PD
-24 W
-4029 888 PD
-24 W
-4029 784 PD
-24 W
-4029 691 PD
-24 W
-4029 608 PD
-24 W
-4029 476 PD
-24 W
-4029 396 PD
-24 W
-4029 359 PD
-24 W
-4029 360 PD
-24 W
-4029 386 PD
-24 W
-4029 420 PD
-24 W
-4029 462 PD
-24 W
-4029 576 PD
-24 W
-4029 660 PD
-24 W
-4029 732 PD
-24 W
-4029 901 PD
-24 W
-4029 987 PD
-24 W
-4029 1172 PD
-24 W
-4029 1248 PD
-24 W
-4026 1205 PD
-24 W
-4026 1083 PD
-24 W
-4026 967 PD
-24 W
-4026 860 PD
-24 W
-4026 762 PD
-24 W
-4026 582 PD
-24 W
-4026 469 PD
-24 W
-4026 399 PD
-24 W
-4026 386 PD
-24 W
-4026 362 PD
-24 W
-4026 374 PD
-24 W
-4026 398 PD
-24 W
-4026 466 PD
-24 W
-4026 533 PD
-24 W
-4026 594 PD
-24 W
-4026 729 PD
-24 W
-4026 807 PD
-24 W
-4026 968 PD
-24 W
-4026 1041 PD
-24 W
-4026 1247 PD
-24 W
-4026 1222 PD
-24 W
-4026 1099 PD
-24 W
-4026 983 PD
-24 W
-4026 875 PD
-24 W
-4026 676 PD
-24 W
-4026 539 PD
-24 W
-4026 443 PD
-24 W
-4026 420 PD
-24 W
-4026 374 PD
-24 W
-4026 367 PD
-24 W
-4026 377 PD
-24 W
-4026 421 PD
-24 W
-4026 470 PD
-24 W
-4026 519 PD
-24 W
-4026 637 PD
-24 W
-4026 705 PD
-24 W
-4026 853 PD
-24 W
-4026 920 PD
-24 W
-4026 1116 PD
-24 W
-4026 1247 PD
-24 W
-4028 1210 PD
-24 W
-4028 1088 PD
-24 W
-4028 974 PD
-24 W
-4028 762 PD
-24 W
-4028 607 PD
-24 W
-4028 493 PD
-24 W
-4028 462 PD
-24 W
-4028 398 PD
-24 W
-4028 377 PD
-24 W
-4028 375 PD
-24 W
-4028 400 PD
-24 W
-4028 435 PD
-24 W
-4028 474 PD
-24 W
-4028 577 PD
-24 W
-4028 637 PD
-24 W
-4028 774 PD
-24 W
-4028 836 PD
-24 W
-4028 1022 PD
-24 W
-4028 1146 PD
-24 W
-4025 1190 PD
-24 W
-4025 945 PD
-24 W
-4025 764 PD
-24 W
-4025 621 PD
-24 W
-4025 576 PD
-24 W
-4025 466 PD
-24 W
-4025 421 PD
-24 W
-4025 400 PD
-24 W
-4025 375 PD
-24 W
-4025 387 PD
-24 W
-4025 410 PD
-24 W
-4025 470 PD
-24 W
-4025 516 PD
-24 W
-4025 619 PD
-24 W
-4025 672 PD
-24 W
-4025 828 PD
-24 W
-4025 941 PD
-24 W
-4025 1157 PD
-24 W
-4025 1251 PD
-24 W
-4025 1074 PD
-24 W
-4025 876 PD
-24 W
-4025 713 PD
-24 W
-4025 660 PD
-24 W
-4025 533 PD
-24 W
-4025 470 PD
-24 W
-4025 435 PD
-24 W
-4025 387 PD
-24 W
-4025 380 PD
-24 W
-4025 390 PD
-24 W
-4025 430 PD
-24 W
-4025 464 PD
-24 W
-4025 549 PD
-24 W
-4025 594 PD
-24 W
-4025 733 PD
-24 W
-4025 833 PD
-24 W
-4025 1035 PD
-24 W
-4025 1123 PD
-24 W
-4025 1263 PD
-24 W
-4028 1174 PD
-24 W
-4028 966 PD
-24 W
-4028 791 PD
-24 W
-4028 732 PD
-24 W
-4028 594 PD
-24 W
-4028 519 PD
-24 W
-4028 474 PD
-24 W
-4028 410 PD
-24 W
-4028 390 PD
-24 W
-4028 391 PD
-24 W
-4028 415 PD
-24 W
-4028 440 PD
-24 W
-4028 513 PD
-24 W
-4028 551 PD
-24 W
-4028 678 PD
-24 W
-4028 767 PD
-24 W
-4028 957 PD
-24 W
-4028 1040 PD
-24 W
-4028 1178 PD
-24 W
-4027 1161 PD
-24 W
-4027 969 PD
-24 W
-4027 901 PD
-24 W
-4027 729 PD
-24 W
-4027 637 PD
-24 W
-4027 577 PD
-24 W
-4027 470 PD
-24 W
-4027 430 PD
-24 W
-4027 415 PD
-24 W
-4027 397 PD
-24 W
-4027 408 PD
-24 W
-4027 442 PD
-24 W
-4027 471 PD
-24 W
-4027 559 PD
-24 W
-4027 633 PD
-24 W
-4027 791 PD
-24 W
-4027 867 PD
-24 W
-4027 988 PD
-24 W
-4027 1248 PD
-24 W
-4031 1059 PD
-24 W
-4031 987 PD
-24 W
-4031 807 PD
-24 W
-4031 705 PD
-24 W
-4031 637 PD
-24 W
-4031 516 PD
-24 W
-4031 464 PD
-24 W
-4031 440 PD
-24 W
-4031 408 PD
-24 W
-4031 409 PD
-24 W
-4031 430 PD
-24 W
-4031 452 PD
-24 W
-4031 526 PD
-24 W
-4031 588 PD
-24 W
-4031 731 PD
-24 W
-4031 800 PD
-24 W
-4031 919 PD
-24 W
-4031 1166 PD
-24 W
-4031 1274 PD
-24 W
-4031 1250 PD
-24 W
-4031 1172 PD
-24 W
-4031 968 PD
-24 W
-4031 853 PD
-24 W
-4031 774 PD
-24 W
-4031 619 PD
-24 W
-4031 549 PD
-24 W
-4031 513 PD
-24 W
-4031 442 PD
-24 W
-4031 430 PD
-24 W
-4031 416 PD
-24 W
-4031 427 PD
-24 W
-4031 464 PD
-24 W
-4031 508 PD
-24 W
-4031 615 PD
-24 W
-4031 676 PD
-24 W
-4031 774 PD
-24 W
-4031 993 PD
-24 W
-4031 1096 PD
-24 W
-4031 1253 PD
-24 W
-4036 1248 PD
-24 W
-4036 1041 PD
-24 W
-4036 920 PD
-24 W
-4036 836 PD
-24 W
-4036 672 PD
-24 W
-4036 594 PD
-24 W
-4036 551 PD
-24 W
-4036 471 PD
-24 W
-4036 452 PD
-24 W
-4036 427 PD
-24 W
-4036 433 PD
-24 W
-4036 458 PD
-24 W
-4036 492 PD
-24 W
-4036 587 PD
-24 W
-4036 641 PD
-24 W
-4036 735 PD
-24 W
-4036 942 PD
-24 W
-4036 1039 PD
-24 W
-4036 1194 PD
-24 W
-4036 1247 PD
-24 W
-4036 1116 PD
-24 W
-4036 1022 PD
-24 W
-4036 828 PD
-24 W
-4036 733 PD
-24 W
-4036 678 PD
-24 W
-4036 559 PD
-24 W
-4036 526 PD
-24 W
-4036 464 PD
-24 W
-4036 458 PD
-24 W
-4036 441 PD
-24 W
-4036 454 PD
-24 W
-4036 504 PD
-24 W
-4036 547 PD
-24 W
-4036 616 PD
-24 W
-4036 782 PD
-24 W
-4036 869 PD
-24 W
-4036 1006 PD
-24 W
-4036 1263 PD
-24 W
-4036 1247 PD
-24 W
-4036 1146 PD
-24 W
-4036 941 PD
-24 W
-4036 833 PD
-24 W
-4036 767 PD
-24 W
-4036 633 PD
-24 W
-4036 588 PD
-24 W
-4036 508 PD
-24 W
-4036 492 PD
-24 W
-4036 454 PD
-24 W
-4036 447 PD
-24 W
-4036 473 PD
-24 W
-4036 502 PD
-24 W
-4036 563 PD
-24 W
-4036 701 PD
-24 W
-4036 775 PD
-24 W
-4036 905 PD
-24 W
-4036 1143 PD
-24 W
-4033 1157 PD
-24 W
-4033 1035 PD
-24 W
-4033 957 PD
-24 W
-4033 791 PD
-24 W
-4033 731 PD
-24 W
-4033 615 PD
-24 W
-4033 587 PD
-24 W
-4033 504 PD
-24 W
-4033 473 PD
-24 W
-4033 448 PD
-24 W
-4033 461 PD
-24 W
-4033 492 PD
-24 W
-4033 577 PD
-24 W
-4033 634 PD
-24 W
-4033 737 PD
-24 W
-4033 938 PD
-24 W
-4033 1153 PD
-24 W
-4033 1242 PD
-24 W
-4037 1251 PD
-24 W
-4037 1123 PD
-24 W
-4037 1040 PD
-24 W
-4037 867 PD
-24 W
-4037 800 PD
-24 W
-4037 676 PD
-24 W
-4037 641 PD
-24 W
-4037 547 PD
-24 W
-4037 502 PD
-24 W
-4037 461 PD
-24 W
-4037 464 PD
-24 W
-4037 490 PD
-24 W
-4037 553 PD
-24 W
-4037 600 PD
-24 W
-4037 696 PD
-24 W
-4037 880 PD
-24 W
-4037 1083 PD
-24 W
-4037 1166 PD
-24 W
-4044 1263 PD
-24 W
-4044 1178 PD
-24 W
-4044 988 PD
-24 W
-4044 919 PD
-24 W
-4044 774 PD
-24 W
-4044 735 PD
-24 W
-4044 616 PD
-24 W
-4044 563 PD
-24 W
-4044 492 PD
-24 W
-4044 490 PD
-24 W
-4044 493 PD
-24 W
-4044 524 PD
-24 W
-4044 564 PD
-24 W
-4044 638 PD
-24 W
-4044 796 PD
-24 W
-4044 980 PD
-24 W
-4044 1063 PD
-24 W
-4038 1248 PD
-24 W
-4038 1166 PD
-24 W
-4038 993 PD
-24 W
-4038 942 PD
-24 W
-4038 782 PD
-24 W
-4038 701 PD
-24 W
-4038 577 PD
-24 W
-4038 553 PD
-24 W
-4038 524 PD
-24 W
-4038 484 PD
-24 W
-4038 498 PD
-24 W
-4038 535 PD
-24 W
-4038 630 PD
-24 W
-4038 769 PD
-24 W
-4038 837 PD
-24 W
-4040 1274 PD
-24 W
-4040 1096 PD
-24 W
-4040 1039 PD
-24 W
-4040 869 PD
-24 W
-4040 775 PD
-24 W
-4040 634 PD
-24 W
-4040 600 PD
-24 W
-4040 564 PD
-24 W
-4040 498 PD
-24 W
-4040 497 PD
-24 W
-4040 525 PD
-24 W
-4040 593 PD
-24 W
-4040 712 PD
-24 W
-4040 770 PD
-24 W
-4040 1259 PD
-24 W
-4046 1253 PD
-24 W
-4046 1194 PD
-24 W
-4046 1006 PD
-24 W
-4046 905 PD
-24 W
-4046 737 PD
-24 W
-4046 696 PD
-24 W
-4046 638 PD
-24 W
-4046 535 PD
-24 W
-4046 525 PD
-24 W
-4046 526 PD
-24 W
-4046 557 PD
-24 W
-4046 645 PD
-24 W
-4046 698 PD
-24 W
-4046 1125 PD
-24 W
-4046 1329 PD
-24 W
-4040 1263 PD
-24 W
-4040 1143 PD
-24 W
-4040 938 PD
-24 W
-4040 880 PD
-24 W
-4040 796 PD
-24 W
-4040 630 PD
-24 W
-4040 593 PD
-24 W
-4040 557 PD
-24 W
-4040 516 PD
-24 W
-4040 545 PD
-24 W
-4040 577 PD
-24 W
-4040 884 PD
-24 W
-4040 1059 PD
-24 W
-4040 1287 PD
-24 W
-4038 1153 PD
-24 W
-4038 1083 PD
-24 W
-4038 980 PD
-24 W
-4038 769 PD
-24 W
-4038 712 PD
-24 W
-4038 645 PD
-24 W
-4038 545 PD
-24 W
-4038 521 PD
-24 W
-4038 536 PD
-24 W
-4038 722 PD
-24 W
-4038 866 PD
-24 W
-4038 1066 PD
-24 W
-4042 1242 PD
-24 W
-4042 1166 PD
-24 W
-4042 1063 PD
-24 W
-4042 837 PD
-24 W
-4042 770 PD
-24 W
-4042 698 PD
-24 W
-4042 577 PD
-24 W
-4042 536 PD
-24 W
-4042 539 PD
-24 W
-4042 684 PD
-24 W
-4042 805 PD
-24 W
-4042 992 PD
-24 W
-4024 1259 PD
-24 W
-4024 1125 PD
-24 W
-4024 884 PD
-24 W
-4024 722 PD
-24 W
-4024 684 PD
-24 W
-4024 489 PD
-24 W
-4024 514 PD
-24 W
-4024 589 PD
-24 W
-4024 870 PD
-24 W
-4024 1191 PD
-24 W
-4017 1329 PD
-24 W
-4017 1059 PD
-24 W
-4017 866 PD
-24 W
-4017 805 PD
-24 W
-4017 514 PD
-24 W
-4017 470 PD
-24 W
-4017 498 PD
-24 W
-4017 689 PD
-24 W
-4017 951 PD
-24 W
-4017 1228 PD
-24 W
-4015 1287 PD
-24 W
-4015 1066 PD
-24 W
-4015 992 PD
-24 W
-4015 589 PD
-24 W
-4015 498 PD
-24 W
-4015 471 PD
-24 W
-4015 558 PD
-24 W
-4015 758 PD
-24 W
-4015 998 PD
-24 W
-4015 1152 PD
-24 W
-4001 870 PD
-24 W
-4001 689 PD
-24 W
-4001 558 PD
-24 W
-4001 420 PD
-24 W
-4001 467 PD
-24 W
-4001 600 PD
-24 W
-4001 709 PD
-24 W
-4001 892 PD
-24 W
-4001 1114 PD
-24 W
-4001 1269 PD
-24 W
-3990 1191 PD
-24 W
-3990 951 PD
-24 W
-3990 758 PD
-24 W
-3990 467 PD
-24 W
-3990 379 PD
-24 W
-3990 413 PD
-24 W
-3990 481 PD
-24 W
-3990 604 PD
-24 W
-3990 797 PD
-24 W
-3990 939 PD
-24 W
-3990 1157 PD
-24 W
-3990 1334 PD
-24 W
-3985 1228 PD
-24 W
-3985 998 PD
-24 W
-3985 600 PD
-24 W
-3985 413 PD
-24 W
-3985 362 PD
-24 W
-3985 389 PD
-24 W
-3985 453 PD
-24 W
-3985 604 PD
-24 W
-3985 724 PD
-24 W
-3985 955 PD
-24 W
-3985 1105 PD
-24 W
-3991 1152 PD
-24 W
-3991 709 PD
-24 W
-3991 481 PD
-24 W
-3991 389 PD
-24 W
-3991 392 PD
-24 W
-3991 422 PD
-24 W
-3991 535 PD
-24 W
-3991 637 PD
-24 W
-3991 854 PD
-24 W
-3991 985 PD
-24 W
-3991 1290 PD
-24 W
-3992 892 PD
-24 W
-3992 604 PD
-24 W
-3992 453 PD
-24 W
-3992 422 PD
-24 W
-3992 402 PD
-24 W
-3992 468 PD
-24 W
-3992 544 PD
-24 W
-3992 754 PD
-24 W
-3992 855 PD
-24 W
-3992 1114 PD
-24 W
-4001 1114 PD
-24 W
-4001 797 PD
-24 W
-4001 604 PD
-24 W
-4001 535 PD
-24 W
-4001 468 PD
-24 W
-4001 454 PD
-24 W
-4001 490 PD
-24 W
-4001 636 PD
-24 W
-4001 703 PD
-24 W
-4001 901 PD
-24 W
-4001 1178 PD
-24 W
-4001 1354 PD
-24 W
-4010 1269 PD
-24 W
-4010 939 PD
-24 W
-4010 724 PD
-24 W
-4010 637 PD
-24 W
-4010 544 PD
-24 W
-4010 490 PD
-24 W
-4010 505 PD
-24 W
-4010 620 PD
-24 W
-4010 666 PD
-24 W
-4010 824 PD
-24 W
-4010 1070 PD
-24 W
-4010 1234 PD
-24 W
-4031 1157 PD
-24 W
-4031 955 PD
-24 W
-4031 854 PD
-24 W
-4031 754 PD
-24 W
-4031 636 PD
-24 W
-4031 620 PD
-24 W
-4031 631 PD
-24 W
-4031 661 PD
-24 W
-4031 779 PD
-24 W
-4031 980 PD
-24 W
-4031 1144 PD
-24 W
-4031 1461 PD
-24 W
-4036 1334 PD
-24 W
-4036 1105 PD
-24 W
-4036 985 PD
-24 W
-4036 855 PD
-24 W
-4036 703 PD
-24 W
-4036 666 PD
-24 W
-4036 661 PD
-24 W
-4036 662 PD
-24 W
-4036 725 PD
-24 W
-4036 883 PD
-24 W
-4036 1022 PD
-24 W
-4036 1308 PD
-24 W
-4036 1290 PD
-24 W
-4036 1114 PD
-24 W
-4036 901 PD
-24 W
-4036 824 PD
-24 W
-4036 779 PD
-24 W
-4036 725 PD
-24 W
-4036 681 PD
-24 W
-4036 746 PD
-24 W
-4036 832 PD
-24 W
-4036 1042 PD
-24 W
-4036 1450 PD
-24 W
-4040 1178 PD
-24 W
-4040 1070 PD
-24 W
-4040 980 PD
-24 W
-4040 883 PD
-24 W
-4040 746 PD
-24 W
-4040 718 PD
-24 W
-4040 752 PD
-24 W
-4040 877 PD
-24 W
-4040 1193 PD
-24 W
-4043 1354 PD
-24 W
-4043 1234 PD
-24 W
-4043 1144 PD
-24 W
-4043 1022 PD
-24 W
-4043 832 PD
-24 W
-4043 752 PD
-24 W
-4043 746 PD
-24 W
-4043 811 PD
-24 W
-4043 1060 PD
-24 W
-4043 1375 PD
-24 W
-4044 1461 PD
-24 W
-4044 1308 PD
-24 W
-4044 1042 PD
-24 W
-4044 877 PD
-24 W
-4044 811 PD
-24 W
-4044 774 PD
-24 W
-4044 888 PD
-24 W
-4044 1113 PD
-24 W
-4044 1384 PD
-24 W
-4045 1450 PD
-24 W
-4045 1193 PD
-24 W
-4045 1060 PD
-24 W
-4045 888 PD
-24 W
-4045 800 PD
-24 W
-4045 873 PD
-24 W
-4045 1045 PD
-24 W
-4045 1482 PD
-24 W
-4039 1375 PD
-24 W
-4039 1113 PD
-24 W
-4039 873 PD
-24 W
-4039 776 PD
-24 W
-4039 843 PD
-24 W
-4039 1118 PD
-24 W
-4043 1384 PD
-24 W
-4043 1045 PD
-24 W
-4043 843 PD
-24 W
-4043 820 PD
-24 W
-4043 951 PD
-24 W
-4043 1332 PD
-24 W
-4036 1482 PD
-24 W
-4036 1118 PD
-24 W
-4036 951 PD
-24 W
-4036 795 PD
-24 W
-4036 924 PD
-24 W
-4036 1142 PD
-24 W
-4028 1332 PD
-24 W
-4028 924 PD
-24 W
-4028 757 PD
-24 W
-4028 832 PD
-24 W
-4028 1154 PD
-24 W
-4033 1142 PD
-24 W
-4033 832 PD
-24 W
-4033 817 PD
-24 W
-4033 990 PD
-24 W
-4033 1352 PD
-24 W
-4037 1154 PD
-24 W
-4037 990 PD
-24 W
-4037 867 PD
-24 W
-4037 1002 PD
-24 W
-4037 1413 PD
-24 W
-4031 1352 PD
-24 W
-4031 1002 PD
-24 W
-4031 847 PD
-24 W
-4031 1022 PD
-24 W
-4031 1340 PD
-24 W
-4031 1464 PD
-24 W
-4034 1413 PD
-24 W
-4034 1022 PD
-24 W
-4034 891 PD
-24 W
-4034 1015 PD
-24 W
-4034 1248 PD
-24 W
-4041 1340 PD
-24 W
-4041 1015 PD
-24 W
-4041 978 PD
-24 W
-4041 1263 PD
-24 W
-4074 1464 PD
-24 W
-4074 1248 PD
-24 W
-4074 1263 PD
-24 W
-4074 1292 PD
-24 W
-4074 1925 PD
-24 W
-4130 1925 PD
-24 W
-4130 1781 PD
-24 W
-4130 2371 PD
-24 W
-4188 2371 PD
-24 W
-4188 2229 PD
-24 W
-4188 2806 PD
-24 W
-4255 2806 PD
-24 W
-4255 2659 PD
-24 W
-4459 3535 PD
-24 W
-4566 3756 PD
-24 W
-4664 3865 PD
-24 W
-4862 3934 PD
-24 W
-4990 3937 PD
-24 W
-948 3936 PD
-24 W
-957 3936 PD
-24 W
-959 3937 PD
-24 W
-959 3936 PD
-24 W
-953 3937 PD
-24 W
-953 3936 PD
-24 W
-940 3937 PD
-24 W
-940 3936 PD
-24 W
-941 3937 PD
-24 W
-941 3936 PD
-24 W
-939 3937 PD
-24 W
-939 3936 PD
-24 W
-948 3937 PD
-24 W
-948 3936 PD
-24 W
-948 3935 PD
-24 W
-948 3936 PD
-24 W
-948 3935 PD
-24 W
-955 3937 PD
-24 W
-955 3936 PD
-24 W
-955 3935 PD
-24 W
-948 3937 PD
-24 W
-948 3936 PD
-24 W
-948 3935 PD
-24 W
-945 3937 PD
-24 W
-945 3936 PD
-24 W
-945 3935 PD
-24 W
-946 3936 PD
-24 W
-946 3935 PD
-gr
-
-c8
-gs 767 332 4576 3606 rc
-gr
-
-0 sg
-11 -2134 253 3548 2 MP stroke
--45 42 -45 -42 44 120 46 -120 219 1456 5 MP
-PP
-  81 3659 mt 
-(weight) s
-1755 0 1302 4262 2 MP stroke
--42 -45 42 -45 -120 45 120 45 3015 4217 5 MP
-PP
-1011 4304 mt 
-(angle) s
-0 2731 2997 1059 2 MP stroke
-0 2293 4035 1543 2 MP stroke
-614 0 3262 944 2 MP stroke
--42 -45 42 -45 -120 45 120 45 3834 899 5 MP
-PP
-2931  986 mt 
-(90deg) s
-4277 1047 mt 5365 1047 L
-5365 1047 mt 5365  649 L
-4277 1047 mt 4277  649 L
-4277  649 mt 5365  649 L
-4337  798 mt 
-(many observation) s
-4337  936 mt 
-(with high weight) s
-1740 3709 mt 2778 3709 L
-2778 3709 mt 2778 3449 L
-1740 3709 mt 1740 3449 L
-1740 3449 mt 2778 3449 L
-1801 3598 mt 
-(few,  low weight) s
-
-end %%Color Dict
-
-eplot
-%%EndObject
-
-epage
-end
-
-showpage
-
-%%Trailer
-%%EOF
diff --git a/misc/matlab/appunti/problem.fig b/misc/matlab/appunti/problem.fig
deleted file mode 100644
index bb099555584a89c1a073fa9c463846ab710de28e..0000000000000000000000000000000000000000
Binary files a/misc/matlab/appunti/problem.fig and /dev/null differ
diff --git a/misc/matlab/carmen/convertFile.m b/misc/matlab/carmen/convertFile.m
deleted file mode 100644
index bda5d669c83d0b371c86d1031cdf121647dac365..0000000000000000000000000000000000000000
--- a/misc/matlab/carmen/convertFile.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function lds = convertFile(file)
-Output = readFileInCells(file);
-
-k=1;
-
-for i=1:size(Output)
-	line = Output(i,:);
-	if 1==strcmp(line(1), 'FLASER')
-		lds{k} = convertLine(line);
-		k = k + 1;
-	end
-end
diff --git a/misc/matlab/carmen/convertLine.m b/misc/matlab/carmen/convertLine.m
deleted file mode 100644
index 5265c1427cdcf1d38ed98c28f24ac6b3268114c6..0000000000000000000000000000000000000000
--- a/misc/matlab/carmen/convertLine.m
+++ /dev/null
@@ -1,25 +0,0 @@
-function laserData = convertLine(lineCells)
-	if 0==strcmp(lineCells(1),'FLASER')
-		error('Not a FLASER line');
-	end
-	
-	laserData.nrays      = str2double( lineCells(2) );
-	laserData.readings   = str2double( lineCells(3:3+laserData.nrays-1) );
-	laserData.odometry   = str2double( lineCells(laserData.nrays+2+1: laserData.nrays+2+3));
-	laserData.estimate   = str2double( lineCells(laserData.nrays+2+4: laserData.nrays+2+6));
-	laserData.timestamp1 = lineCells(laserData.nrays+2+7);
-	laserData.hostname   = lineCells(laserData.nrays+2+8);
-	laserData.timestamp2 = lineCells(laserData.nrays+2+9);
-	
-	% Theta array
-	for i=1:laserData.nrays
-		% Maybe this is not so precise
-		laserData.theta(i) = (i - laserData.nrays/2) * pi / laserData.nrays;
-	end
-	
-	% Cartesian points corrisponding to readings
-	for i=1:laserData.nrays
-		theta = laserData.theta(i);
-		rho   = laserData.readings(i);
-		laserData.points(:,i) =  [cos(theta); sin(theta)] * rho;
-	end
\ No newline at end of file
diff --git a/misc/matlab/carmen/readFileInCells.m b/misc/matlab/carmen/readFileInCells.m
deleted file mode 100644
index d84b5ce1e4a550be7ac5b78742fdff28d3bdd2d3..0000000000000000000000000000000000000000
--- a/misc/matlab/carmen/readFileInCells.m
+++ /dev/null
@@ -1,44 +0,0 @@
-% I got this code from Matlab file exchange
-% http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=7933&objectType=file
-% Author: John McArthur (University of Southern California)
-% his email: johnnyfisma@hotmail.com
-% http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectType=author&objectId=1094612
-
-function Output = readFileInCells(file)
-
-%Location of Data File
-root=file;
-
-%Open File and count the number of rows in the file
-fid=fopen(root);
-nRows=0;
-while 1
-    iString=fgetl(fid);
-    if ~ischar(iString)
-        break
-    end
-    nRows=nRows+1;
-end
-
-%Return to beginning of file
-fseek(fid,0,'bof');
-
-%For each row, assign each space delimitted object to a cell in the "Output" matrix
-for iRow=1:nRows
-    iCol=1;
-    %Temporary storage of the first object
-    %   Note: the space delimitter used here can be replaced by any delimitter
-    [TempOutput,Rem]=strtok(fgetl(fid),' ');
-    %If there is now data on this row, then assign the first object to be an underscore
-    if (length(TempOutput) == 0)
-        TempOutput='_';
-    end
-    %Build the "Output" matrix this will be the first column of the iRow-th row
-    Output(iRow,iCol)=cellstr(TempOutput);
-    %Repeat this only using Rem as the total string and incrementing the iCol counter
-    while length(Rem) > 0
-        iCol=iCol+1;
-        [TempOutput,Rem]=strtok(Rem,' ');            
-        Output(iRow,iCol)=cellstr(TempOutput);
-    end
-end
diff --git a/misc/matlab/carmen/reading.m b/misc/matlab/carmen/reading.m
deleted file mode 100644
index d84b5ce1e4a550be7ac5b78742fdff28d3bdd2d3..0000000000000000000000000000000000000000
--- a/misc/matlab/carmen/reading.m
+++ /dev/null
@@ -1,44 +0,0 @@
-% I got this code from Matlab file exchange
-% http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=7933&objectType=file
-% Author: John McArthur (University of Southern California)
-% his email: johnnyfisma@hotmail.com
-% http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectType=author&objectId=1094612
-
-function Output = readFileInCells(file)
-
-%Location of Data File
-root=file;
-
-%Open File and count the number of rows in the file
-fid=fopen(root);
-nRows=0;
-while 1
-    iString=fgetl(fid);
-    if ~ischar(iString)
-        break
-    end
-    nRows=nRows+1;
-end
-
-%Return to beginning of file
-fseek(fid,0,'bof');
-
-%For each row, assign each space delimitted object to a cell in the "Output" matrix
-for iRow=1:nRows
-    iCol=1;
-    %Temporary storage of the first object
-    %   Note: the space delimitter used here can be replaced by any delimitter
-    [TempOutput,Rem]=strtok(fgetl(fid),' ');
-    %If there is now data on this row, then assign the first object to be an underscore
-    if (length(TempOutput) == 0)
-        TempOutput='_';
-    end
-    %Build the "Output" matrix this will be the first column of the iRow-th row
-    Output(iRow,iCol)=cellstr(TempOutput);
-    %Repeat this only using Rem as the total string and incrementing the iCol counter
-    while length(Rem) > 0
-        iCol=iCol+1;
-        [TempOutput,Rem]=strtok(Rem,' ');            
-        Output(iRow,iCol)=cellstr(TempOutput);
-    end
-end
diff --git a/misc/matlab/ci.m b/misc/matlab/ci.m
deleted file mode 100644
index cf454c6b596e19cd7f9cef96e670218276e27ea2..0000000000000000000000000000000000000000
--- a/misc/matlab/ci.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function M = ci(matrices)
-
-	s = zeros(size(matrices{1}));
-	
-	n = size(matrices,2);
-	for i=1:n
-		s = s + inv(matrices{i});	
-	end
-	
-	s = s / n;
-	M = inv(s);
\ No newline at end of file
diff --git a/misc/matlab/cramer_rao/compute_bounds.m b/misc/matlab/cramer_rao/compute_bounds.m
deleted file mode 100644
index 5d585dc5016de95c9c7683ea52dc8ffe815e5036..0000000000000000000000000000000000000000
--- a/misc/matlab/cramer_rao/compute_bounds.m
+++ /dev/null
@@ -1,40 +0,0 @@
-function bounds = compute_bounds(ld)
-% bounds = compute_bounds(ld)
-% ld: laserdata
-% return bounds.I0
-%        bounds.C0 if I0 is invertible
-
-
-I0 = zeros(3,3);
-
-for i=1:ld.nrays
-	r = ld.readings(i);
-	alpha_i = ld.true_alpha_abs(i);
-
-	if isnan(alpha_i) | isnan(r) 
-		continue;
-	end
-	
-	phi_i   = ld.theta(i);
-	theta   = ld.odometry(3);
-	beta_i  = alpha_i - (theta+phi_i);
-	
-	% dr_dt = v(beta_i)' / cos(beta_i);
-	dr_dt = (v(theta+phi_i) + v(theta+phi_i+pi/2) * tan(beta_i))';
-	dr_dt = v(alpha_i)' / cos(beta_i);
-	dr_dtheta = r * tan(beta_i);
-	
-	
-	I0(1:2,1:2) = I0(1:2,1:2) + (dr_dt' * dr_dt);
-	I0(1:2,3) = I0(1:2,3) + (dr_dt' * dr_dtheta);
-	I0(3,1:2) = I0(3,1:2) + (dr_dt * dr_dtheta);
-	I0(3,3) = I0(3,3) + dr_dtheta * dr_dtheta;
-end
-
-
-bounds.I0 = I0;
-bounds.C0 = inv(bounds.I0);
-
-
-function res = v(a)
-	res = [cos(a); sin(a)];
diff --git a/misc/matlab/cramer_rao/plot_bounds.m b/misc/matlab/cramer_rao/plot_bounds.m
deleted file mode 100644
index 7eb9a3f47c2b10a0a918d5bfc106aeffe0bd6055..0000000000000000000000000000000000000000
--- a/misc/matlab/cramer_rao/plot_bounds.m
+++ /dev/null
@@ -1,80 +0,0 @@
-function f = plot_bound(res)
-
-prefix = 'tbs'
-
-
-s = size(res.etmin,2);
-
-if false
-res.eth(1,1) = 0;
-res.eth(size(res.etmin,1)-3,size(res.etmin,2)-3) = 0;
-res.eth(1,size(res.etmin,2)-10) = 0;
-end
-
-f= figure
-subplot(1,5,1)
-etmax = good_direction(res.etmax);
-writeToFile(etmax,strcat(prefix, '_max.png'));
-imagesc(etmax)
-AXIS('image');
-AXIS('off');
-title('\sigma_1 = max \sigma Cov(t)')
-
-
-subplot(1,5,2)
-etmin=good_direction(res.etmin);
-writeToFile(etmax,strcat(prefix, '_min.png'));
-imagesc(etmin)
-AXIS('image');
-AXIS('off');
-title('\sigma_2 =  min \sigma Cov(t)')
-
-subplot(1,5,3)
-mea = good_direction(sqrt(res.etmin.*res.etmax));
-imagesc(mea)
-writeToFile(mea,strcat(prefix, '_mean.png'));
-AXIS('image');
-AXIS('off');
-title('sqrt(\sigma_1 \sigma_2)')
-
-subplot(1,5,4)
-eth = good_direction(sqrt(res.eth));
-imagesc(eth)
-writeToFile(eth,strcat(prefix, '_th.png'));
-AXIS('image');
-AXIS('off');
-title('var(\phi)');
-
-
-tot = good_direction((res.eth.*res.etmin.*res.etmax).^(1/6));
-subplot(1,5,5)
-imagesc(tot)
-AXIS('image');
-AXIS('off');
-title('det');
-
-print(gcf,'-dpng', 'bounds.png')
-%colormap('prism')
-
-f = figure
-imagesc(tot)
-writeToFile(tot,strcat(prefix, '_tot.png'));
-AXIS('image');
-AXIS('off');
-title('det');
-
-%colormap('pink')
-
-function writeToFile(image, file)
- 
-%map = colormap
-%ind2rgb(mat2gray(etmax)*255,map)
-%imwrite(, 
-
-function res = good_direction(x)
-	for i=1:size(x,1)
-	for j=1:size(x,2)	
-		res(i,j) = real(x(j,size(x,2)-i+1));
-		% res(i,j) = x(i,j);
-	end
-	end
diff --git a/misc/matlab/cramer_rao/square.pdf b/misc/matlab/cramer_rao/square.pdf
deleted file mode 100644
index 1679b71aad811e95f890d546e2161a447be4aab8..0000000000000000000000000000000000000000
Binary files a/misc/matlab/cramer_rao/square.pdf and /dev/null differ
diff --git a/misc/matlab/cramer_rao/test_bounds_circle.m b/misc/matlab/cramer_rao/test_bounds_circle.m
deleted file mode 100644
index fcb948d950540db378f250b11a532dec8a6ebe85..0000000000000000000000000000000000000000
--- a/misc/matlab/cramer_rao/test_bounds_circle.m
+++ /dev/null
@@ -1,39 +0,0 @@
-function res = test_bounds_circle
-
-% grid
-side = 5;
-cell=0.1;
-x=-side*0.5:cell:side*0.5;
-y=-side*0.5:cell:side*0.5;
-
-%
-radius = 0.5 * side * sqrt(2) + 1;
-fov = pi;
-rays = 91;
-
-for i=1:size(x,2)
-for j=1:size(y,2)
-
-	pose = [x(i); y(j); 0];
-	ld = ld_circle(radius, pose, rays, fov);
-	bounds = compute_bounds(ld);
-	
-	etmax(i,j) = max(sqrt(eig(bounds.C0(1:2,1:2))));
-	etmin(i,j) = min(sqrt(eig(bounds.C0(1:2,1:2))));
-	eth(i,j) = rad2deg(sqrt(bounds.C0(3,3)));
-	
-	sigma = 0.01;
-	[etmax(i,j) * sigma etmin(i,j) * sigma eth(i,j) * sigma]
-	
-	data{i,j}.bounds = bounds;
-	data{i,j}.ld = ld;
-end
-	fprintf('%d\n',i);
-end
-
-%res.bounds = bounds;
-res.etmax = etmax;
-res.etmin = etmin;
-res.eth = eth;
-res.data = data;
-
diff --git a/misc/matlab/cramer_rao/test_bounds_oval.m b/misc/matlab/cramer_rao/test_bounds_oval.m
deleted file mode 100644
index e93e90549f61147b53c1fa0654d9a8a7b03726ad..0000000000000000000000000000000000000000
--- a/misc/matlab/cramer_rao/test_bounds_oval.m
+++ /dev/null
@@ -1,45 +0,0 @@
-function res = test_bounds_oval
-
-% grid
-side = 5;
-cell=0.1;
-x=-side*0.5:cell:side*0.5;
-y=-side*0.5:cell:side*0.5;
-
-%
-x_radius = 5.5;
-y_radius = 5.2;
-
-fov = pi;
-rays = 91;
-
-for i=1:size(x,2)
-for j=1:size(y,2)
-
-	pose = [x(i); y(j); 0];
-	ld = ld_oval(x_radius, y_radius, pose, rays, fov);
-	bounds = compute_bounds(ld);
-	
-	etmax(i,j) = max(sqrt(eig(bounds.C0(1:2,1:2))));
-	etmin(i,j) = min(sqrt(eig(bounds.C0(1:2,1:2))));
-	eth(i,j) = rad2deg(sqrt(bounds.C0(3,3)));
-	
-	sigma = 0.01;
-	%[etmax(i,j) * sigma etmin(i,j) * sigma eth(i,j) * sigma]
-	
-	data{i,j}.bounds = bounds;
-	data{i,j}.ld = ld;
-end
-	fprintf('%d\n',i);
-end
-
-%res.bounds = bounds;
-res.etmax = etmax;
-res.etmin = etmin;
-res.eth = eth;
-res.data = data;
-
-test_bounds_oval_result2 = res;
-save 'test_bounds_oval_2.mat' test_bounds_oval_result2;
-% 1 = 5.5, 4.5
-% 2 = 5.5, 5.2
diff --git a/misc/matlab/cramer_rao/test_bounds_square.m b/misc/matlab/cramer_rao/test_bounds_square.m
deleted file mode 100644
index 19e177fec145507b5b3abde6f086434046f10f7b..0000000000000000000000000000000000000000
--- a/misc/matlab/cramer_rao/test_bounds_square.m
+++ /dev/null
@@ -1,35 +0,0 @@
-function res = test_bounds_square(theta)
-
-side = 5;
-cell=0.1;
-x=-side*0.4:cell:side*0.4;
-y=-side*0.4:cell:side*0.4;
-
-fov = pi;
-rays = 91;
-
-for i=1:size(x,2)
-for j=1:size(y,2)
-
-	pose = [x(i); y(j); theta]
-	ld = ld_square(side, pose, rays, fov);
-	bounds = compute_bounds(ld);
-	
-	etmax(i,j) = max(sqrt(eig(bounds.C0(1:2,1:2))));
-	etmin(i,j) = min(sqrt(eig(bounds.C0(1:2,1:2))));
-	eth(i,j) = rad2deg(sqrt(bounds.C0(3,3)));
-	
-	sigma = 0.01;
-	[etmax(i,j) * sigma etmin(i,j) * sigma eth(i,j) * sigma]
-	
-	data{i,j}.bounds = bounds;
-	data{i,j}.ld = ld;
-end
-end
-
-%res.bounds = bounds;
-res.etmax = etmax;
-res.etmin = etmin;
-res.eth = eth;
-res.data = data;
-
diff --git a/misc/matlab/cramer_rao/test_bounds_square2_tmp.m b/misc/matlab/cramer_rao/test_bounds_square2_tmp.m
deleted file mode 100644
index ab033556e55a41ac98d1e9391ac4ee5d5d9f1835..0000000000000000000000000000000000000000
--- a/misc/matlab/cramer_rao/test_bounds_square2_tmp.m
+++ /dev/null
@@ -1,28 +0,0 @@
-function res = test_bounds_square2_tmp(stuff)
-
-for i=1:size(stuff,1)
-for j=1:size(stuff,2)
-
-	ld = stuff{i,j}.ld;
-	bounds = compute_bounds(ld);
-	
-	etmax(i,j) = max(sqrt(eig(bounds.C0(1:2,1:2))));
-	etmin(i,j) = min(sqrt(eig(bounds.C0(1:2,1:2))));
-	eth(i,j) = rad2deg(sqrt(bounds.C0(3,3)));
-	
-	data{i,j}.bounds = bounds;
-	data{i,j}.ld = ld;
-	
-	if rand>0.95
-		pause(0.01)
-	end
-end
-fprintf('%d\n', i);
-end
-
-%res.bounds = bounds;
-res.etmax = etmax;
-res.etmin = etmin;
-res.eth = eth;
-res.data = data;
-
diff --git a/misc/matlab/cramer_rao/test_unstructured.m b/misc/matlab/cramer_rao/test_unstructured.m
deleted file mode 100644
index 1d6b733ffa06709e380bdc01551e3e671d85f251..0000000000000000000000000000000000000000
--- a/misc/matlab/cramer_rao/test_unstructured.m
+++ /dev/null
@@ -1,140 +0,0 @@
-function test_unstructured(res)
-	% analyzes result of the test_unstructured
-	
-	rho = 5;
-	amp = 0.2;
-	N   = 30;
-	
-	nrays = 181;
-	fov = pi;
-
-	ld2 = ld_sine(rho, amp, N, [0;0;0], nrays, fov);
-	
-	crb = compute_bounds(ld2);
-	
-	eig(crb.I0)
-	
-	% C of the f function in ld_sine
-	C = amp^2 * N^2 / (2 * rho^2);
-	D = amp^2 * N^4 / rho^4;
-	fprintf('Real information matrix:\n');
-	crb.I0
-	fprintf('Approximated information matrix:\n');
-	I = cramer_rao_approximation(ld2, rho, C)
-	C
-	
-	
-	truth =[0;0;0];
-	
-	for i=1:size(res,2)
-		points(:,i) = res{i}.X - truth;
-	end
-	
-
-	bias = mean(points,2);
-	sample_cov = cov(points');
-	
-	sigma = 0.01;
-	
-	if false
-	
-	m.datasets{1}.points = points;
-	m.datasets{1}.color = 'r.';
-	m.covariances{1}.mean = bias;
-	m.covariances{1}.cov = sample_cov;
-	m.covariances{1}.color = 'r-';
-	m.covariances{2}.mean = [0;0;0];
-	m.covariances{2}.cov = crb.C0 * (sigma^2);
-	m.covariances{2}.color = 'b--';
-	m.covariances{3}.mean = [0;0;0];
-	m.covariances{3}.cov = inv(I) * (sigma^2);
-	m.covariances{3}.color = 'k-.';
-	m.legend = {'Samples'; 'Sample \Sigma'; 'Cramer-Rao'; ...
-		'Approximated\newline Cramer-Rao'};
-	m.format = '-depsc2';
-	m.prefix = 'icp_un';
-	m.extension = 'eps';
-	m.title = 'ICP, Unstructured env. -';
-	fs = plot_xyt(m);
-	end
-
-	e_th = points(3,:);
-	
-	real_std_th = sqrt(var(e_th'));
-	crb_std_th = sqrt(inv(crb.I0(3,3)))*sigma;
-	
-	batta = ((sigma/rho)^2 / (nrays * C)) * (1 + sigma * D / (2* C^2));
-	approx_crb_std_th =  sigma*sqrt(inv(nrays*(rho^2)*C))
-	
-	batta_std_th = sqrt(batta);
-	
-	fprintf('Sample std: %f\n', rad2deg(real_std_th));
-	fprintf('Cramer-Rao std: %f\n', rad2deg(crb_std_th));
-	fprintf('Cramer-Rao (approx) std: %f\n', rad2deg(approx_crb_std_th));
-	fprintf('Battacharya std: %f\n', rad2deg(batta_std_th));
-	
-	ib=0;
-	n = 1;
-	
-	for theta=ld2.theta
-		s = rho * theta;
-		f = f(amp, N, rho, s);
-		f1 = f_dot(amp, N, rho, s);
-		f2 = f_ddot(amp, N, rho, s);
-	%	ib = ib + (nf_dot^2) / (sigma^2) * inv(1+((sigma^2)/2)*( (nf_ddot^2)/(nf_dot^4)));
-	
-		inf = 2*(f1^6) / ( ((sigma/rho)^2)*(2*f1^4+(f2*sigma)^2));
-	
-		if (f1^2) < 0.001
-		n = n+1;
-			continue
-		end
-		
-		inf = (f1*rho/sigma)^2 * inv(1+0.5*(f2*sigma/(f1^2))^2);
-		ib = ib +  inf;
-		
-		m(1,n)=f1; m(2,n)=f2; m(3,n)=inf; 
-		m(4,n)=f; m(5,n)=ld2.readings(n);
-		n = n+1;
-	end
-	
-	mb = inv(ib);
-	figure
-	subplot(4,1,1); plot(m(1,:));
-	subplot(4,1,2); plot(m(2,:));
-	subplot(4,1,3); plot(m(3,:));
-	subplot(4,1,4);
-		hold on; plot(m(4,:),'r-');
-		plot(m(5,:),'b.');
-	
-	fprintf('Battacharya real: %f\n', rad2deg(sqrt(mb)));
-	
-function res = f(amp,N,rho,s)
-	res = rho+amp * cos( (N/rho) * s);
-	
-function res = f_dot(amp, N, rho, s)
-	res = -amp * (N/rho) * sin ( (N/rho) * s);
-function res = f_ddot(amp, N, rho, s)
-	res = -amp * ((N/rho)^2) * cos ( (N/rho) * s);
-
-function I = cramer_rao_approximation(ld, rho, C)
-	fov =  max(ld.theta)-min(ld.theta);
-	
-	if (abs(fov - pi) < deg2rad(1))
-		I_xy_th = [0; C*rho*(ld.nrays/pi)*2];
-	else
-		if abs(fov - 2*pi) < deg2rad(1)
-		I_xy_th = [0; 0];
-		else
-		error(sprintf('detected fov: %f', rad2deg(fov)));
-		end
-	end
-	lambda_I_t = (ld.nrays/2) * (1+C);
-	I_th =  ld.nrays*(rho^2)*C;
-		
-
-	I_t = [lambda_I_t 0; ...
-	     0  lambda_I_t];
-		  
-	I = [I_t I_xy_th; ...
-			I_xy_th' I_th];
diff --git a/misc/matlab/cramer_rao/test_unstructured_print.m b/misc/matlab/cramer_rao/test_unstructured_print.m
deleted file mode 100644
index a17202e11b2c24008ce0d329da1acfa80913be01..0000000000000000000000000000000000000000
--- a/misc/matlab/cramer_rao/test_unstructured_print.m
+++ /dev/null
@@ -1,20 +0,0 @@
-function test_unstructured_print
-	% prints the test environment
-	
-	rho = 5;
-	amp = 0.2;
-	N   = 30;
-	
-	nrays = 181;
-	fov = pi;
-
-	ld2 = ld_sine(rho, amp, N, [0;0;pi/2], nrays, fov);
-	
-	f=figure;hold on;
-	params.color = 'b-';
-	ld_plot(ld2, params);
-	
-	ld = ld_add_noise(ld2, 0.01);
-	params.color = 'r.';
-	ld_plot(ld, params)
-	axis('equal');
diff --git a/misc/matlab/gpm/go.sh b/misc/matlab/gpm/go.sh
deleted file mode 100755
index eeadd4f4af5945cddbec398211ea8a655c7ae96d..0000000000000000000000000000000000000000
--- a/misc/matlab/gpm/go.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-../scripts/collate.rb < gpm.m > test_gpm.m  
-pdflatex test
-
diff --git a/misc/matlab/gpm/gpm.m b/misc/matlab/gpm/gpm.m
deleted file mode 100644
index 923b9d84348dc266787c3718699a9f30c339ebd1..0000000000000000000000000000000000000000
--- a/misc/matlab/gpm/gpm.m
+++ /dev/null
@@ -1,265 +0,0 @@
-function res = gpm(params)
-% params.laser_ref  The #first scan $\frac{pi}{4}$#
-% params.laser_sens
-% params.maxAngularCorrectionDeg
-% params.maxLinearCorrection
-% params.sigma
-
-
-	params_required(params, 'laser_sens');
-	params_required(params, 'laser_ref');
-	params = params_set_default(params, 'maxAngularCorrectionDeg', 25);
-	params = params_set_default(params, 'maxLinearCorrection',    0.4);
-	params = params_set_default(params, 'maxIterations',           20);
-	params = params_set_default(params, 'sigma',                 0.01);
-	params = params_set_default(params, 'interactive',  false);
-
-	%% Compute surface orientation for \verb|params.laser_ref| and \verb|params.laser_sens|
-	params = compute_surface_orientation(params);
-
-	%% Number of constraints generated (total)
-	k=1;
-
-	%% \verb| ngenerated(a)|: number of constraints generated by point $a$ in \verb|laser_ref|.
-	ngenerated = zeros(1, params.laser_ref.nrays);
-	
-	%% \verb|ngeneratedb(b)|: number of constraints generated by $b$ in \verb|laser_sens|.
-	ngeneratedb = zeros(1, params.laser_sens.nrays);
-	
-	%% Iterate only on points which have a valid orientation.
-	for j=find(params.laser_ref.alpha_valid)
-
-		alpha_j = params.laser_ref.alpha(j);
-		p_j = params.laser_ref.points(:,j);
-
-		%% This finds a bound for the maximum variation of $\theta$ for 
-		%% a rototranslation such that 
-		%%  \[|t|\leq|t|_{\text{max}}=\verb|maxLinearCorrection|\]
-		%% and
-		%% \[|\varphi|\leq|\varphi|_{\text{max}}=\verb|maxAngularCorrectionDeg|\]
-		%%  
-		%% The bound is given by 
-		%% \[ |\delta| \leq |\varphi|_{\text{max}} + \text{atan}{\frac{|t|_{\text{max}}}{|p_j|}}\]
-	
-		delta = abs(deg2rad(params.maxAngularCorrectionDeg)) + ...
-		        abs(atan(params.maxLinearCorrection/norm(p_j)));
-		
-		angleRes = pi / size(params.laser_sens.points,2);
-		range = ceil(delta/angleRes);
-		from = j-range;
-		to = j+range;
-		from = max(from, 1);
-		to   = min(to, size(params.laser_sens.points,2));
-			
-		
-		for i=from:to
-		
-			if params.laser_sens.alpha_valid(i)==0
-				continue;
-			end
-		
-			alpha_i = params.laser_sens.alpha(i);
-			phi = alpha_j - alpha_i;
-			phi = normAngle(phi);
-			
-			if abs(phi) > deg2rad(params.maxAngularCorrectionDeg)
-				continue
-			end
-			
-			p_i = params.laser_sens.points(:,i);
-			%% \newcommand{\fp}{\mathbf{p}}
-			%% $\hat{T} = \fp_j - R_\phi \fp_j$
-			T = p_j - rot(phi) * p_i;
-			
-	
-			if norm(T) > params.maxLinearCorrection
-				continue
-			end
-			
-			weight=1;
-			weight = weight * sqrt(params.laser_ref.alpha_error(j));
-			weight = weight * sqrt(params.laser_sens.alpha_error(i));
-			weight=sqrt(weight);
-	
-					
-			C{k}.T = T;
-			C{k}.phi = phi; 
-			% Surface normal
-			C{k}.alpha = alpha_j; 
-			C{k}.weight = 1/weight;
-			C{k}.i = i; 
-			C{k}.j = j; 
-			
-			%% Keep track of how many generated particles per point
-			ngenerated(j) = ngenerated(j) + 1;
-			ngeneratedb(i) = ngeneratedb(i) + 1;
-			%% Keep track of how many generated particles.
-			k=k+1;
-		end
-	end
-	
-	%% Number of correspondences.
-	N = size(C,2);
-	fprintf('Number of corr.: %d\n', N);
-	
-	% build L matrix (Nx2) 
-	L = zeros(N,2); L2 = zeros(2*N,3);
-	Y = zeros(N,1); Y2 = zeros(2*N,1);
-	W = zeros(N,1); W2 = zeros(2*N,1);
-	Phi = zeros(N,1);
-	samples = zeros(3,N);
-	for k=1:N
-		L(k,:) = vers(C{k}.alpha)';
-		Y(k,1) = vers(C{k}.alpha)' * C{k}.T;
-		W(k,1) = C{k}.weight;
-		Phi(k,1) = C{k}.phi;
-		block = [vers(C{k}.alpha)' 0; 0 0 1];
-		L2((k-1)*2+1:(k-1)*2+2,1:3) = block;
-		Y2((k-1)*2+1:(k-1)*2+2,1) = [Y(k,1); C{k}.phi]; 
-		W2((k-1)*2+1:(k-1)*2+2,1) = [C{k}.weight;C{k}.weight];
-		
-		samples(:,k) = [C{k}.T; C{k}.phi];
-	end
-	
-	theta = hill_climbing(Phi, W, deg2rad(20), mean(Phi), 20, deg2rad(0.001));
-	fprintf('Theta: %f\n', rad2deg(theta));
-	
-
-	Inf3 = zeros(3,3);
-	
-	for k=1:N
-		C{k}.v_alpha      = vers(C{k}.alpha);
-		C{k}.v_dot_alpha  = vers(C{k}.alpha + pi/2);
-		C{k}.R_phi        = rot(C{k}.phi);
-		C{k}.R_dot_phi    = rot(C{k}.phi + pi/2);
-		C{k}.v_j          = vers(params.laser_ref.theta(C{k}.j));
-		C{k}.v_i          = vers(params.laser_sens.theta(C{k}.i)); 
-		C{k}.cos_beta     = C{k}.v_alpha' * C{k}.v_i;
-		C{k}.p_j          = params.laser_ref.points(:,C{k}.j);
-		C{k}.p_i          = params.laser_sens.points(:,C{k}.i);
-		C{k}.ngi          = 1; %ngeneratedb(C{k}.i);
-		C{k}.ngj          = 1; %ngenerated(C{k}.j);
-		
-		sigma_alpha = deg2rad(6.4);
-		sigma = params.sigma;
-		noises = diag([C{k}.ngi*sigma_alpha^2 C{k}.ngj*sigma_alpha^2 ...
-		              C{k}.ngi*sigma^2 C{k}.ngj*sigma^2]);
-
-		n_alpha_i = -C{k}.v_alpha'*C{k}.R_dot_phi*C{k}.p_i;
-		n_alpha_j = C{k}.v_dot_alpha'*(C{k}.T)+ C{k}.v_alpha'*C{k}.R_dot_phi*C{k}.p_i;
-		n_sigma_i =  C{k}.v_alpha'* C{k}.R_phi * C{k}.v_i + C{k}.cos_beta;
-		n_sigma_j =  - C{k}.v_alpha'*  C{k}.v_j;
-		
-		L_k = [C{k}.v_alpha' 0; 0 0 1];
-		Y_k = [C{k}.v_alpha'*C{k}.T; C{k}.phi];
-		M_k = [ n_alpha_i n_alpha_j n_sigma_i n_sigma_j; -1 1 0 0 ];
-		R_k =  M_k * noises * M_k';
-		C{k}.I = L_k' * inv(R_k) * L_k; 
-		C{k}.M = L_k' * inv(R_k) * Y_k;
-		Inf3 = Inf3 + C{k}.I;
-	end
-	
-	Inf3
-	Inf3(1:2,1:2)
-	Cov = inv(Inf3(1:2,1:2));
-	
-	X = mean(samples,2);
-	X2 = mean(samples,2);
-	
-%	X(3) = theta;
-	for it=1:params.maxIterations
-		fprintf(strcat(' X : ',pv(X),'\n'))
-		fprintf(strcat(' X2: ',pv(X2),'\n'))
-		Sigma = diag([0.5 0.5 deg2rad(40)].^2);
-		
-		M1 = zeros(3,3); M2 = zeros(3,1); block=zeros(3,2); by=zeros(2,1);
-		T1 = zeros(3,3); T2 = zeros(3,1); 
-		% update weights
-		for k=1:N
-			myX = [C{k}.T; C{k}.phi];
-			weight = W(k,1) * mynormpdf( myX-X, [0;0;0], Sigma);
-			%we =  exp(-norm(myX-X2));
-			we = weight ;
-			va = vers(C{k}.alpha);
-			block = [va' 0; 0 0 1];
-			by = [va' * C{k}.T; C{k}.phi];
-			M1 = M1 + block' * weight * block;
-			M2 = M2 + block' * weight * by;
-			
-			T1 = T1 + C{k}.I * we;
-			T2 = T2 + C{k}.M * we;
-		end
-		Xhat = inv(M1) * M2;
-		Xhat2 = inv(T1) * T2;
-		
-		delta = X-Xhat;
-		delta = X2-Xhat2;
-		X = Xhat;% X(3) = theta;
-		X2 = Xhat2;
-		if norm(delta(1:2)) < 0.00001
-			break
-		end
-		pause(0.1)
-	end
-	
-	res.X = X2;
-	res.Phi = Phi;
-	res.W = W;
-	res.samples = samples;
-	res.laser_ref=params.laser_ref;
-	res.laser_sens=params.laser_sens;
-	res.Inf = Inf;
-	res.Cov = Cov;
-	res.Cov3 = inv(Inf3);
-	res.corr = C;
-	
-	
-function p = mynormpdf(x, mu, sigma);
-    mahal = (x-mu)' * inv(sigma) * (x-mu);    
-	 p = (1 / sqrt(2*pi * det(sigma))) * exp(-0.5*mahal); % XXX
-	 
-function res = hill_climbing(x, weight, sigma, x0, iterations, precision)
-% hill_climbing(x, weight, sigma, x0, iterations, precision)
-	for i=1:iterations
-		for j=1:size(x)
-			updated_weight(j) =  weight(j) * mynormpdf(x(j), x0, sigma^2);
-			%updated\_weight(j) =  weight(j) * exp( -abs(x(j)- x0)/ (sigma));
-		end
-		
-		x0new = sum(x .* updated_weight') / sum(updated_weight);
-		delta = abs(x0-x0new);
-		x0 = x0new;
-		
-		fprintf(' - %f \n', rad2deg(x0));
-		
-		if delta < precision
-			break
-		end
-	end
-	
-	res = x0;
-
-function res = compute_surface_orientation(params)
-	%% Find a parameter of scale
-	n = params.laser_ref.nrays-1;
-	for i=1:n
-		dists(i) = norm( params.laser_ref.points(:,i)-params.laser_ref.points(:,i+1));
-	end
-	dists=sort(dists);
-	
-	%params.scale = mean(dists(n/2:n-n/5))*2;
-	params.scale = max(dists(1:n-5))*2;
-	fprintf('scale: %f\n', params.scale);
-	
-	if not(isfield(params.laser_ref, 'alpha_valid'))
-		fprintf('Computing surface normals for ld1.\n');
-		params.laser_ref = computeSurfaceNormals(params.laser_ref, params.scale);
-	end
-	
-	if not(isfield(params.laser_sens, 'alpha_valid'))
-		fprintf('Computing surface normals for ld2.\n');
-		params.laser_sens = computeSurfaceNormals(params.laser_sens, params.scale);
-	end
-	
-	res = params;
-	
diff --git a/misc/matlab/gpm/gpmSample.m b/misc/matlab/gpm/gpmSample.m
deleted file mode 100644
index eaf2154acc8b5131383d311be09a9a0ced1ae363..0000000000000000000000000000000000000000
--- a/misc/matlab/gpm/gpmSample.m
+++ /dev/null
@@ -1,44 +0,0 @@
-function res = gpmSample(gpmres,n)
-
-m = size(gpmres.T, 2);
-prepared = prepareSampling(1:m, gpmres.weight);
-fprintf('Prepared\n');
-i=1;
-
-while i<n
-
-	i1 = sampleIndex(prepared);
-	i2 = sampleIndex(prepared);
-	
-	alpha1 = gpmres.alpha(i1);
-	alpha2 = gpmres.alpha(i2);
-	rho1 = vers(alpha1)' * gpmres.T(:,i1);
-	rho2 = vers(alpha2)' * gpmres.T(:,i2);
-	
-	A = [vers(alpha1)'; vers(alpha2)'];
-	b = [rho1; rho2];
-	
-	if det(A) == 0 
-		fprintf('No. det = %f\n', det(A));
-		continue;
-	end
-
-	W = diag([gpmres.weight(i1) gpmres.weight(i2)]); 
-	C = inv(A' * inv(W) * A);
-	
-	e = eigs(C);
-	if min(e) / max(e) < 0.5
-		fprintf('No.\n');
-		continue
-	end
-	
-	T = A\b
-	res(:, i) = T;
-	i = i + 1;
-	pause(0.0001);
-end
-
-
-function v = vers(theta)
-	v = [cos(theta) sin(theta)]';
-
diff --git a/misc/matlab/gpm/gpm_plot_res.m b/misc/matlab/gpm/gpm_plot_res.m
deleted file mode 100644
index 22b3d66ba1ee9b635106c306549597bdae3d8217..0000000000000000000000000000000000000000
--- a/misc/matlab/gpm/gpm_plot_res.m
+++ /dev/null
@@ -1,32 +0,0 @@
-function gpm_plot_res(res, mmin, mmax)
-	
-
-	side = 2;
-	length = sqrt(2)*side;
-	hold on
-	
-	% number of correspondences
-	Ktot = size(res.corr, 2);
-
-	drawn=0;
-	for k=1:Ktot
-	
-		
-		drawn = drawn + 1;
-		
-		T = res.corr{k}.T;
-		alpha = res.corr{k}.alpha;
-		
-		p1 = T + vers(alpha-pi/2) * length * 0.5;
-		p2 = T + vers(alpha+pi/2) * length * 0.5;
-		
-		reference = [0;0;0;]; % f.ts.laser_ref.estimate;
-		plotVectors(reference, [p1 p2], 'b-');
-		
-		axis([-side side -side side]/2);
-	end
-	
-	fprintf('drawn %d/%d\n', drawn, Ktot);
-	
-function v = vers(theta)
-	v = [cos(theta) sin(theta)]';
diff --git a/misc/matlab/gpm/gpm_test.m b/misc/matlab/gpm/gpm_test.m
deleted file mode 100644
index 6ce49fb617bf092ecb6e678c59c249b09ac04126..0000000000000000000000000000000000000000
--- a/misc/matlab/gpm/gpm_test.m
+++ /dev/null
@@ -1,45 +0,0 @@
-function doScanMatch(log)
-
-params.maxAngularCorrectionDeg = 25; % degrees
-params.maxLinearCorrection = 0.15; % meters
-params.emXYsigma = 0.2;
-
-f=figure;
-	set(f,'DoubleBuffer','on'); 
-	set(f, 'NextPlot', 'replacechildren');
-	
-k=1;
-for i=2:size(log,2)
-	if i>1 & ( vectorNorm2(log(i).odometry-log(i-1).odometry) < 0.01 )
-		continue
-	end
-		
-	params.laserData1 = log(i-1);
-	params.laserData2 = log(i);
-
-	res(k) = gpm(params); 
-
-		clf;
-	subplot(3,1,1)
-		hold off;
-		plotLaserData(log(i));
-		axis('equal');
-
-	subplot(3,1,2);
-		hold off;
-		l = params.maxLinearCorrection;
-		axis([-l l -l l]);
-		plot( res(k).T(1,:),res(k).T(2,:), 'b.');
-		axis('equal');
-		
-	subplot(3,1,3);
-		hold off;
-		l = params.maxLinearCorrection;
-		axis([-l l -l l]);
-		plotGPM1(res(k));
-		axis('equal');
-		
-		
-		k=k+1;
-	drawnow;
-end
diff --git a/misc/matlab/gpm/gpm_test2.m b/misc/matlab/gpm/gpm_test2.m
deleted file mode 100644
index 991f7bdfb6535ce5ca75867dbb3c4b739ec2801d..0000000000000000000000000000000000000000
--- a/misc/matlab/gpm/gpm_test2.m
+++ /dev/null
@@ -1,40 +0,0 @@
-
-params.maxAngularCorrectionDeg = 25; % degrees
-params.maxLinearCorrection = 0.15; % meters
-params.emXYsigma = 0.2;
-
-		i=3;
-	params.laserData1 = log_bighouse(i-1);
-	params.laserData2 = log_bighouse(i);
-
-	fprintf('executing gpm\n');
-	%res = gpm(params); 
-
-	%fprintf('sampling\n');
-	%r = gpmSample(res, 500);
-	
-	
-	% Densitā
-	d = zeros(1,360);
-	for m=1:size(res.weight,2)
-		th = ceil(mod(rad2deg(res.alpha(m)),360));
-		d(th) = d(th) + res.weight(m);
-	end
-	
-	d2 = simpleLowPassFilterCircular(d, 30);
-	%d = hist( mod(rad2deg(res.alpha),360), 1:360);
-	%mask = exp(-d2);
-	
-	for m=1:size(res.weight,2)
-		k = ceil( mod(rad2deg(res.alpha(m)), 360));
-		
-		w(m) = res.weight(m) / d2(k  );
-	end
-	
-	
-	% Densitā
-	d3 = zeros(1,360);
-	for m=1:size(res.weight,2)
-		th = ceil(mod(rad2deg(res.alpha(m)),360));
-		d3(th) = d3(th) + w(m);
-	end
diff --git a/misc/matlab/gpm/test.tex b/misc/matlab/gpm/test.tex
deleted file mode 100644
index 498ccd2a648adc1ed0c5212b8b647e4eaf257589..0000000000000000000000000000000000000000
--- a/misc/matlab/gpm/test.tex
+++ /dev/null
@@ -1,26 +0,0 @@
-\documentclass{article}
-\usepackage{amsmath}
-\usepackage{xcolor}
-\usepackage{listings}
-
-\begin{document}
-\lstset{% general command to set parameter(s)
-	basicstyle=\footnotesize\ttfamily, % print whole listing small
-	keywordstyle=\color{blue}\bfseries,
-	% underlined bold black keywords
-	identifierstyle=, % nothing happens
-	commentstyle=\color{green}, % white comments
-	stringstyle=\color{red}\ttfamily, % typewriter type for strings
-	tabsize=4,
-	language=matlab,
-	escapeinside={\%\%}{\^^M},
-	%escapeinside={\%\%\%}{M\%\%\%},
-	escapebegin=\begin{commentline},
-	escapeend=\end{commentline},
-	showstringspaces=false} % no special string spaces
-
-\newenvironment{commentline}{\begin{minipage}{\textwidth}\color{violet}\rmfamily}{\end{minipage}}
-
-\lstinputlisting[tabsize=4,language=matlab]{test_gpm.m}
-\end{document}
-
diff --git a/misc/matlab/gpm/test_gpm.m b/misc/matlab/gpm/test_gpm.m
deleted file mode 100644
index 6f687f680468680cf91a9f22d06169163260920d..0000000000000000000000000000000000000000
--- a/misc/matlab/gpm/test_gpm.m
+++ /dev/null
@@ -1,258 +0,0 @@
-function res = gpm(params)
-% params.laser_ref  The #first scan $\frac{pi}{4}$#
-% params.laser_sens
-% params.maxAngularCorrectionDeg
-% params.maxLinearCorrection
-% params.sigma
-
-
-	params_required(params, 'laser_sens');
-	params_required(params, 'laser_ref');
-	params = params_set_default(params, 'maxAngularCorrectionDeg', 25);
-	params = params_set_default(params, 'maxLinearCorrection',    0.4);
-	params = params_set_default(params, 'maxIterations',           20);
-	params = params_set_default(params, 'sigma',                 0.01);
-	params = params_set_default(params, 'interactive',  false);
-
-	%%  Compute surface orientation for \verb|params.laser_ref| and \verb|params.laser_sens|
-	params = compute_surface_orientation(params);
-
-	%%  Number of constraints generated (total)
-	k=1;
-
-	%%  \verb| ngenerated(a)|: number of constraints generated by point $a$ in \verb|laser_ref|.
-	ngenerated = zeros(1, params.laser_ref.nrays);
-	
-	%%  \verb|ngeneratedb(b)|: number of constraints generated by $b$ in \verb|laser_sens|.
-	ngeneratedb = zeros(1, params.laser_sens.nrays);
-	
-	%%  Iterate only on points which have a valid orientation.
-	for j=find(params.laser_ref.alpha_valid)
-
-		alpha_j = params.laser_ref.alpha(j);
-		p_j = params.laser_ref.points(:,j);
-
-		%%  This finds a bound for the maximum variation of $\theta$ for  a rototranslation such that   \[|t|\leq|t|_{\text{max}}=\verb|maxLinearCorrection|\] and \[|\varphi|\leq|\varphi|_{\text{max}}=\verb|maxAngularCorrectionDeg|\]
-		%%  The bound is given by  \[ |\delta| \leq |\varphi|_{\text{max}} + \text{atan}{\frac{|t|_{\text{max}}}{|p_j|}}\]
-	
-		delta = abs(deg2rad(params.maxAngularCorrectionDeg)) + ...
-		        abs(atan(params.maxLinearCorrection/norm(p_j)));
-		
-		angleRes = pi / size(params.laser_sens.points,2);
-		range = ceil(delta/angleRes);
-		from = j-range;
-		to = j+range;
-		from = max(from, 1);
-		to   = min(to, size(params.laser_sens.points,2));
-			
-		
-		for i=from:to
-		
-			if params.laser_sens.alpha_valid(i)==0
-				continue;
-			end
-		
-			alpha_i = params.laser_sens.alpha(i);
-			phi = alpha_j - alpha_i;
-			phi = normAngle(phi);
-			
-			if abs(phi) > deg2rad(params.maxAngularCorrectionDeg)
-				continue
-			end
-			
-			p_i = params.laser_sens.points(:,i);
-			%%  \newcommand{\fp}{\mathbf{p}} $\hat{T} = \fp_j - R_\phi \fp_j$
-			T = p_j - rot(phi) * p_i;
-			
-	
-			if norm(T) > params.maxLinearCorrection
-				continue
-			end
-			
-			weight=1;
-			weight = weight * sqrt(params.laser_ref.alpha_error(j));
-			weight = weight * sqrt(params.laser_sens.alpha_error(i));
-			weight=sqrt(weight);
-	
-					
-			C{k}.T = T;
-			C{k}.phi = phi; 
-			% Surface normal
-			C{k}.alpha = alpha_j; 
-			C{k}.weight = 1/weight;
-			C{k}.i = i; 
-			C{k}.j = j; 
-			
-			%%  Keep track of how many generated particles per point
-			ngenerated(j) = ngenerated(j) + 1;
-			ngeneratedb(i) = ngeneratedb(i) + 1;
-			%%  Keep track of how many generated particles.
-			k=k+1;
-		end
-	end
-	
-	%%  Number of correspondences.
-	N = size(C,2);
-	fprintf('Number of corr.: %d\n', N);
-	
-	% build L matrix (Nx2) 
-	L = zeros(N,2); L2 = zeros(2*N,3);
-	Y = zeros(N,1); Y2 = zeros(2*N,1);
-	W = zeros(N,1); W2 = zeros(2*N,1);
-	Phi = zeros(N,1);
-	samples = zeros(3,N);
-	for k=1:N
-		L(k,:) = vers(C{k}.alpha)';
-		Y(k,1) = vers(C{k}.alpha)' * C{k}.T;
-		W(k,1) = C{k}.weight;
-		Phi(k,1) = C{k}.phi;
-		block = [vers(C{k}.alpha)' 0; 0 0 1];
-		L2((k-1)*2+1:(k-1)*2+2,1:3) = block;
-		Y2((k-1)*2+1:(k-1)*2+2,1) = [Y(k,1); C{k}.phi]; 
-		W2((k-1)*2+1:(k-1)*2+2,1) = [C{k}.weight;C{k}.weight];
-		
-		samples(:,k) = [C{k}.T; C{k}.phi];
-	end
-	
-	theta = hill_climbing(Phi, W, deg2rad(20), mean(Phi), 20, deg2rad(0.001));
-	fprintf('Theta: %f\n', rad2deg(theta));
-	
-
-	Inf3 = zeros(3,3);
-	
-	for k=1:N
-		C{k}.v_alpha      = vers(C{k}.alpha);
-		C{k}.v_dot_alpha  = vers(C{k}.alpha + pi/2);
-		C{k}.R_phi        = rot(C{k}.phi);
-		C{k}.R_dot_phi    = rot(C{k}.phi + pi/2);
-		C{k}.v_j          = vers(params.laser_ref.theta(C{k}.j));
-		C{k}.v_i          = vers(params.laser_sens.theta(C{k}.i)); 
-		C{k}.cos_beta     = C{k}.v_alpha' * C{k}.v_i;
-		C{k}.p_j          = params.laser_ref.points(:,C{k}.j);
-		C{k}.p_i          = params.laser_sens.points(:,C{k}.i);
-		C{k}.ngi          = 1; %ngeneratedb(C{k}.i);
-		C{k}.ngj          = 1; %ngenerated(C{k}.j);
-		
-		sigma_alpha = deg2rad(6.4);
-		sigma = params.sigma;
-		noises = diag([C{k}.ngi*sigma_alpha^2 C{k}.ngj*sigma_alpha^2 ...
-		              C{k}.ngi*sigma^2 C{k}.ngj*sigma^2]);
-
-		n_alpha_i = -C{k}.v_alpha'*C{k}.R_dot_phi*C{k}.p_i;
-		n_alpha_j = C{k}.v_dot_alpha'*(C{k}.T)+ C{k}.v_alpha'*C{k}.R_dot_phi*C{k}.p_i;
-		n_sigma_i =  C{k}.v_alpha'* C{k}.R_phi * C{k}.v_i + C{k}.cos_beta;
-		n_sigma_j =  - C{k}.v_alpha'*  C{k}.v_j;
-		
-		L_k = [C{k}.v_alpha' 0; 0 0 1];
-		Y_k = [C{k}.v_alpha'*C{k}.T; C{k}.phi];
-		M_k = [ n_alpha_i n_alpha_j n_sigma_i n_sigma_j; -1 1 0 0 ];
-		R_k =  M_k * noises * M_k';
-		C{k}.I = L_k' * inv(R_k) * L_k; 
-		C{k}.M = L_k' * inv(R_k) * Y_k;
-		Inf3 = Inf3 + C{k}.I;
-	end
-	
-	Inf3
-	Inf3(1:2,1:2)
-	Cov = inv(Inf3(1:2,1:2));
-	
-	X = mean(samples,2);
-	X2 = mean(samples,2);
-	
-%	X(3) = theta;
-	for it=1:params.maxIterations
-		fprintf(strcat(' X : ',pv(X),'\n'))
-		fprintf(strcat(' X2: ',pv(X2),'\n'))
-		Sigma = diag([0.5 0.5 deg2rad(40)].^2);
-		
-		M1 = zeros(3,3); M2 = zeros(3,1); block=zeros(3,2); by=zeros(2,1);
-		T1 = zeros(3,3); T2 = zeros(3,1); 
-		% update weights
-		for k=1:N
-			myX = [C{k}.T; C{k}.phi];
-			weight = W(k,1) * mynormpdf( myX-X, [0;0;0], Sigma);
-			%we =  exp(-norm(myX-X2));
-			we = weight ;
-			va = vers(C{k}.alpha);
-			block = [va' 0; 0 0 1];
-			by = [va' * C{k}.T; C{k}.phi];
-			M1 = M1 + block' * weight * block;
-			M2 = M2 + block' * weight * by;
-			
-			T1 = T1 + C{k}.I * we;
-			T2 = T2 + C{k}.M * we;
-		end
-		Xhat = inv(M1) * M2;
-		Xhat2 = inv(T1) * T2;
-		
-		delta = X-Xhat;
-		delta = X2-Xhat2;
-		X = Xhat;% X(3) = theta;
-		X2 = Xhat2;
-		if norm(delta(1:2)) < 0.00001
-			break
-		end
-		pause(0.1)
-	end
-	
-	res.X = X2;
-	res.Phi = Phi;
-	res.W = W;
-	res.samples = samples;
-	res.laser_ref=params.laser_ref;
-	res.laser_sens=params.laser_sens;
-	res.Inf = Inf;
-	res.Cov = Cov;
-	res.Cov3 = inv(Inf3);
-	res.corr = C;
-	
-	
-function p = mynormpdf(x, mu, sigma);
-    mahal = (x-mu)' * inv(sigma) * (x-mu);    
-	 p = (1 / sqrt(2*pi * det(sigma))) * exp(-0.5*mahal); % XXX
-	 
-function res = hill_climbing(x, weight, sigma, x0, iterations, precision)
-% hill_climbing(x, weight, sigma, x0, iterations, precision)
-	for i=1:iterations
-		for j=1:size(x)
-			updated_weight(j) =  weight(j) * mynormpdf(x(j), x0, sigma^2);
-			%updated\_weight(j) =  weight(j) * exp( -abs(x(j)- x0)/ (sigma));
-		end
-		
-		x0new = sum(x .* updated_weight') / sum(updated_weight);
-		delta = abs(x0-x0new);
-		x0 = x0new;
-		
-		fprintf(' - %f \n', rad2deg(x0));
-		
-		if delta < precision
-			break
-		end
-	end
-	
-	res = x0;
-
-function res = compute_surface_orientation(params)
-	%%  Find a parameter of scale
-	n = params.laser_ref.nrays-1;
-	for i=1:n
-		dists(i) = norm( params.laser_ref.points(:,i)-params.laser_ref.points(:,i+1));
-	end
-	dists=sort(dists);
-	
-	%params.scale = mean(dists(n/2:n-n/5))*2;
-	params.scale = max(dists(1:n-5))*2;
-	fprintf('scale: %f\n', params.scale);
-	
-	if not(isfield(params.laser_ref, 'alpha_valid'))
-		fprintf('Computing surface normals for ld1.\n');
-		params.laser_ref = computeSurfaceNormals(params.laser_ref, params.scale);
-	end
-	
-	if not(isfield(params.laser_sens, 'alpha_valid'))
-		fprintf('Computing surface normals for ld2.\n');
-		params.laser_sens = computeSurfaceNormals(params.laser_sens, params.scale);
-	end
-	
-	res = params;
-	
diff --git a/misc/matlab/gpm/yasmine.m b/misc/matlab/gpm/yasmine.m
deleted file mode 100644
index 103d14c749efd01d075dcd0d75543cccfd6b5b64..0000000000000000000000000000000000000000
--- a/misc/matlab/gpm/yasmine.m
+++ /dev/null
@@ -1,157 +0,0 @@
-function res = yasmine(params)
-% params.sigma
-% params.laser_sens     % sensor (indexed by i)
-% params.laser_ref      % map    (indexed by j)  laser_sens * (x,y,theta) = laser_ref 
-% params.maxAngularCorrectionDeg
-% params.maxLinearCorrection
-
-	% readings for which a valid alpha was computed
-	valid1 = find(params.laser_sens.alpha_valid);
-	
-	ktot = 1;
-	
-	num_noises = params.laser_sens.nrays*2 + params.laser_ref.nrays *2;
-	num_corr = 50 *params.laser_sens.nrays;
-	res.M = zeros(num_corr*2, num_noises);
-	res.Y = zeros(num_corr*2, 1);
-	res.L = zeros(num_corr*2, 3);
-	
-	for i=valid1
-		
-		fprintf('%d / %d \n', i, params.laser_sens.nrays);
-		
-		theta_i     = params.laser_sens.theta(i);
-		    p_i     = params.laser_sens.readings(i) * vers(theta_i);
-		alpha_i     = params.laser_sens.alpha(i);
-		alpha_i_var = params.laser_sens.alpha_error(i);
-		
-		% estimate other interval
-		delta = abs(deg2rad(params.maxAngularCorrectionDeg)) ...
-		       +abs(atan(params.maxLinearCorrection/norm(p_i)));
-		angleRes = pi / params.laser_ref.nrays;
-		range = ceil(delta/angleRes);
-		from = i-range;
-		to = i+range;
-		from = max(from, 1);
-		to   = min(to, params.laser_ref.nrays);
-	
-		%from = 1;
-		%to = params.laser_ref.nrays;
-		% putting all correespondences in "corre"
-		k = 1;
-		corre={};
-		for j=from:to
-			if params.laser_ref.alpha_valid(j)==0
-				continue;
-			end
-		
-			p_j = params.laser_ref.readings(j) * vers(params.laser_ref.theta(j));
-			alpha_j = params.laser_ref.alpha(j);
-			
-			phi_hat = normAngle(alpha_j - alpha_i);
-			T_hat = p_j - rot(phi_hat) *  p_i;
-			
-			if abs(phi_hat) > deg2rad(params.maxAngularCorrectionDeg)
-				continue
-			end
-			if norm(T_hat) > params.maxLinearCorrection
-				continue
-			end
-			
-			corre{k}.j = j;
-			corre{k}.alpha_j = alpha_j;
-			corre{k}.phi_hat = phi_hat;
-			corre{k}.T_hat = T_hat;
-			k = k+1;
-		end
-		
-		for k=1:size(corre,2)
-			% regressore
-			j = corre{k}.j ;
-			theta_j = params.laser_ref.theta(j);
-			alpha_j = params.laser_ref.alpha(j);;
-			alpha_j_var = params.laser_ref.alpha_error(j);
-			alpha_i_var = params.laser_sens.alpha_error(i);
-			phi_hat = corre{k}.phi_hat;
-			  T_hat = corre{k}.T_hat;
-			proj =  vers(alpha_j)';
-			% Lk * (T phi) = yk
-			
-			Lk = [ proj 0; 0 0 1];
-			Yk = [ proj*T_hat; phi_hat];
-		
-			res.L((ktot-1)*2+1:(ktot-1)*2+2,1:3) = Lk;
-			res.Y((ktot-1)*2+1:(ktot-1)*2+2,1)   = Yk;
-			
-			index_e_i = (i-1)*4 + 1;
-			index_w_i = (i-1)*4 + 2;
-			index_e_j = (j-1)*4 + 3;
-			index_w_j = (j-1)*4 + 4;
-			
-			v_i = vers(theta_i);
-			v_j = vers(theta_j);
-
-			% incertezza proj
-			C = sqrt(size(corre,2));
-			res.M((ktot-1)*2+1, index_e_i) = C * (- proj * rot(phi_hat) * v_i);
-			res.M((ktot-1)*2+1, index_e_j) = C * (  proj                * v_j);
-			res.M((ktot-1)*2+1, index_w_i) = C * ( ...
-				vers(alpha_j+pi/2)'*T_hat + ...
-				proj *  rot(phi_hat+pi/2) * p_i );
-			res.M((ktot-1)*2+1, index_w_j) = C * (- proj * rot(phi_hat+pi/2) * p_i);
-			% incertezza angolo
-			res.M((ktot-1)*2+2, index_w_i) = C * -1;
-			res.M((ktot-1)*2+2, index_w_j) = C * 1; 
-			
-			Rk = [res.M((ktot-1)*2+1, index_e_i) ...
-			      res.M((ktot-1)*2+1, index_e_j) ...
-					res.M((ktot-1)*2+1, index_w_i) ...
-					res.M((ktot-1)*2+1, index_w_j);...
-					0 0 ...
-					res.M((ktot-1)*2+2, index_w_i) ...
-					res.M((ktot-1)*2+2, index_w_j)];
-					
-			Zk = diag([ params.sigma params.sigma alpha_i_var alpha_j_var]);
-			
-			Covk = Rk * Zk * Rk';
-			
-			
-			Lk = [ proj 0; 0 0 1];
-			Yk = [ proj*T_hat; phi_hat];
-		
-			res.s{ktot}.Lk = Lk;
-			res.s{ktot}.Yk = Yk;
-			res.s{ktot}.Rk = Rk;
-			res.s{ktot}.Covk = Covk;
-			
-			ktot = ktot+1;
-		end
-		
-%		fprintf('corr = %d \n', size(corre,2));
-	
-	end
-	
-	num_corr = ktot-1; 
-	res.M = res.M(1:num_corr*2, 1:num_noises);
-	res.Y = res.Y(1:num_corr*2, 1);
-	res.L = res.L(1:num_corr*2, 1:3);
-	
-	% trova soluzione singola
-	I = zeros(3,3);
-	A = zeros(3,1);
-	for i=1:num_corr
-		I = I + res.s{i}.Lk' * inv(res.s{i}.Covk) * res.s{i}.Lk;
-		A = A + res.s{i}.Lk' * inv(res.s{i}.Covk) * res.s{i}.Yk;
-	end
-	
-	res.I = I;
-	res.Cov = inv(I);
-	res.x_hat = res.Cov * A;
-	
-function res = rot(phi)
-	% Rotation matrix
-	res = [cos(phi) -sin(phi); sin(phi) cos(phi)];
-	
-function v = vers(theta)
-	v = [cos(theta) sin(theta)]';
-
diff --git a/misc/matlab/gpm/yasmine2.m b/misc/matlab/gpm/yasmine2.m
deleted file mode 100644
index 510872847ba133b864c32dabd5704e23e7d147c6..0000000000000000000000000000000000000000
--- a/misc/matlab/gpm/yasmine2.m
+++ /dev/null
@@ -1,227 +0,0 @@
-% params.sigma
-% params.laser_sens     % sensor (indexed by i)
-% params.laser_ref      % map    (indexed by j)  laser_sens * (x,y,theta) = laser_ref 
-% params.maxAngularCorreectionDeg
-% params.maxLinearCorreection
-
-function res = yasmine2(params)
-
-	% readings for which a valid alpha was computed
-	valid1 = find(params.laser_sens.alpha_valid);
-	n_i = sum(params.laser_sens.alpha_valid)
-	
-	ktot = 1;
-	
-	for i=valid1
-		
-		theta_i     = params.laser_sens.theta(i);
-		    p_i     = params.laser_sens.readings(i) * vers(theta_i);
-		alpha_i     = params.laser_sens.alpha(i);
-		alpha_i_var = params.laser_sens.alpha_error(i);
-		
-		% estimate other interval
-		delta = abs(deg2rad(params.maxAngularCorrectionDeg)) ...
-		       +abs(atan(params.maxLinearCorrection/norm(p_i)));
-		angleRes = pi / params.laser_ref.nrays;
-		range = ceil(delta/angleRes);
-		from = i-range;
-		to = i+range;
-		from = max(from, 1);
-		to   = min(to, params.laser_ref.nrays);
-	
-		
-		% putting all correespondences in "corre"
-		k = 1;
-		corre={};
-		for j=from:to
-			if params.laser_ref.alpha_valid(j)==0
-				continue;
-			end
-		
-			p_j = params.laser_ref.readings(j) * vers(params.laser_ref.theta(j));
-			alpha_j = params.laser_ref.alpha(j);
-			
-			phi_hat = normAngle(alpha_j - alpha_i);
-			T_hat = p_j - rot(phi_hat) *  p_i;
-			
-			
-			if abs(phi_hat) > deg2rad(params.maxAngularCorrectionDeg)
-				continue
-			end
-			if norm(T_hat) > params.maxLinearCorrection
-				continue
-			end
-	
-			corre{k}.j = j;
-			corre{k}.alpha_j = alpha_j;
-			corre{k}.phi_hat = phi_hat;
-			corre{k}.T_hat = T_hat;
-			k = k+1;
-		end
-		
-		for k=1:size(corre,2)
-			% regressore
-			j = corre{k}.j ;
-			theta_j = params.laser_ref.theta(j);
-			alpha_j = params.laser_ref.alpha(j);;
-			alpha_j_var = params.laser_ref.alpha_error(j);
-			alpha_i_var = params.laser_sens.alpha_error(i);
-			phi_hat = corre{k}.phi_hat;
-			  T_hat = corre{k}.T_hat;
-			proj =  vers(alpha_j)';
-			% Lk * (T phi) = yk
-			
-			Lk = [ proj 0; 0 0 1];
-			Yk = [ proj*T_hat; phi_hat];
-		
-%			res.L((ktot-1)*2+1:(ktot-1)*2+2,1:3) = Lk;
-%			res.Y((ktot-1)*2+1:(ktot-1)*2+2,1)   = Yk;
-			
-			index_e_i = (i-1)*4 + 1;
-			index_w_i = (i-1)*4 + 2;
-			index_e_j = (j-1)*4 + 3;
-			index_w_j = (j-1)*4 + 4;
-			
-			v_i = vers(theta_i);
-			v_j = vers(theta_j);
-
-			% incertezza proj
-			C = sqrt(size(corre,2));
-			C = 1;
-			r_e_i = C * (- proj * rot(phi_hat) * v_i);
-			r_e_j = C * (  proj                * v_j);
-			r_w_i = C * ( ...
-				vers(alpha_j+pi/2)'*T_hat + ...
-				proj *  rot(phi_hat+pi/2) * p_i );
-			r_w_j = C * (- proj * rot(phi_hat+pi/2) * p_i);
-			% incertezza angolo
-			s_w_i = C * -1;
-			s_w_j = C * 1; 
-			
-			Rk = [r_e_i r_e_j r_w_i r_w_j;...
-					0 0 s_w_i s_w_j];
-					
-			Zk = diag([ params.sigma params.sigma alpha_i_var alpha_j_var]);
-			
-			Covk = Rk * Zk * Rk';
-			
-			Lk = [ proj 0; 0 0 1];
-			Yk = [ proj*T_hat; phi_hat];
-		
-			maha = compute_ma(Lk,Yk,Covk, params.odometry, params.odometry_cov);
-			if(maha>params.chi_limit)
-				continue
-			end
-
-			res.s{ktot}.Lk = Lk;
-			res.s{ktot}.Yk = Yk;
-			res.s{ktot}.Rk = Rk;
-			res.s{ktot}.Covk = Covk;
-			res.s{ktot}.alpha = alpha_j;
-			res.s{ktot}.T = T_hat;
-			res.s{ktot}.phi = phi_hat;
-			
-			ktot = ktot+1;
-		end
-		
-%		fprintf('corr = %d \n', size(corre,2));
-	
-	end
-	
-	
-	trim = params.trim;
-	chi_perc = params.chi_perc;
-	chi_limit = params.chi_limit;
-	
-	valids = ones(1,ktot-1); valids_i = find(valids>0); nvalids = sum(valids);
-	[x, Cov] = find_solution(res.s, valids_i, params.odometry, params.odometry_cov);
-	
-	limit = 2.3 * n_i
-	while true
-		if nvalids < limit
-			res.x_hat = x;
-			res.Cov = Cov;
-			fprintf('Terminated reaching limit \n');
-			break;
-		end
-		
-		ms = compute_m(res.s, valids_i, x, Cov);
-		
-		fprintf(' valid = %d min %f mean %f max %f \n', nvalids, min(ms(valids_i)), ...
-			mean(ms(valids_i)),max(ms(valids_i)));
-		
-		s = sum( ms(valids_i) <chi_limit );
-		low_perc = s / nvalids;
-		
-%		fprintf(' low perc: %f \n', low_perc);
-		if low_perc > chi_perc
-			res.x_hat = x;
-			res.Cov = Cov;
-			break;
-		end
-		
-		
-		
-		Y = sort(ms(valids_i),2,'descend');
-		threshold = Y( ceil( trim *nvalids) );
-		
-%		fprintf(' threshold: %f \n', threshold);
-		for i=valids_i
-			if(ms(i)>threshold) 
-				valids(i) = 0;
-			end
-		end
-		
-		valids_i = find(valids>0); nvalids = sum(valids);
-	
-		[x, Cov] = find_solution(res.s, valids_i, params.odometry, params.odometry_cov);
-		fprintf(' x =  %f %f %f \n ', x(1),x(2),rad2deg(x(3)));
-
-	end
-	
-	
-	xy=sqrt(eig(Cov(1:2,1:2)));
-	et=rad2deg(sqrt(Cov(3,3)));
-	fprintf(' x =  %f %f %f \n ', x(1),x(2),rad2deg(x(3)));
-	fprintf(' eig xy: %f %f \n ', xy(1), xy(2));
-	fprintf(' eig theta: %f \n ', et(1));
-
-function ms = compute_m(s, valids_i, x_hat, x_cov)
-	for k=valids_i
-		L = s{k}.Lk;
-		Y = s{k}.Yk;
-		Cov = s{k}.Covk; 
-		ms(k) = compute_ma(L,Y,Cov, x_hat, x_cov);
-	end
-
-function ma = compute_ma(L,Y,C, x_hat, x_cov)
-	Ctot = C + L * x_cov * L';
-	e = L * x_hat - Y;
-	ma = e' * inv(Ctot) * e;
-
-function [x, Cov] = find_solution(s, valids_i, odometry, odometry_cov)
-	% trova soluzione singola
-	I = zeros(3,3);
-	A = zeros(3,1);
-	used = 0;
-	for i=valids_i
-		used = used +1;
-		I = I + s{i}.Lk' * inv(s{i}.Covk) *s{i}.Lk;
-		A = A + s{i}.Lk' * inv(s{i}.Covk) *s{i}.Yk;
-	end
-	
-	I = I + inv(odometry_cov);
-	A = A + inv(odometry_cov) * odometry;
-	
-	Cov = inv(I);
-	x = Cov * A;
-	%fprintf('used %d / %d \n', used, size(valids,2));
-
-	
-function res = rot(phi)
-	% Rotation matrix
-	res = [cos(phi) -sin(phi); sin(phi) cos(phi)];
-	
-function v = vers(theta)
-	v = [cos(theta) sin(theta)]';
-
diff --git a/misc/matlab/icp/closest_point_on_segment.m b/misc/matlab/icp/closest_point_on_segment.m
deleted file mode 100644
index da212f2ed3b108ca5937a1190f869cc73de51bb6..0000000000000000000000000000000000000000
--- a/misc/matlab/icp/closest_point_on_segment.m
+++ /dev/null
@@ -1,45 +0,0 @@
-
-function res = closest_point_on_segment(A,B,p)
-% closest_point_on_segment(A,B,p)
-%  find closest point to p on segment A-B
-	projection = projection_on_line_seg(A,B,p);
-	
-%	fprintf('Closest(%s,%s;%s)\n', pv(A), pv(B), pv(p));
-%	fprintf('  projection: \n', pv(projection));
-	
-%	fprintf('A: %s B: %s p: %s proj: %s\n',pv(A),pv(B),pv(p),pv(projection));
-
-	%res = projection;
-	%return;
-		
-	% check whether projection is inside the segment
-	if (projection-A)'*(projection-B)<0
-		res = projection;
-	else
-		if norm(p-A) < norm(p-B)
-			res = A;
-		else
-			res = B;
-		end
-	end
-		
-function res = projection_on_line_seg(A,B,p)
-% projection_on_line_seg(A,B,p)
-%  finds projection of p on line through A,B
-
-	% find polar representation
-	v_alpha = rot(pi/2) * (A-B) / norm(A-B);
-	alpha = atan2(v_alpha(2),v_alpha(1));
-	rho = v_alpha' * A; 
-	res = projection_on_line(alpha, rho, p);
-%	fprintf('alpha = %f  v_alpha = %s  rho = %f\n', alpha, pv(v_alpha), rho);
-
-function res = projection_on_line(alpha, rho, p)
-% projection_on_line(alpha, rho, p)
-%  finds projection of p on line whose polar representation is (alpha,rho)
-
-	res = vers(alpha) * rho + (p-(vers(alpha)'*p)*vers(alpha));
-	
-	% 0 == vers(alpha)' * res - rho
-
-
diff --git a/misc/matlab/icp/exact_minimization.m b/misc/matlab/icp/exact_minimization.m
deleted file mode 100644
index b0c819994fcc063cc4fdfb4f301840dd958b537b..0000000000000000000000000000000000000000
--- a/misc/matlab/icp/exact_minimization.m
+++ /dev/null
@@ -1,46 +0,0 @@
-function [pose, L, Y] = exact_minimization(points1, points2)
-	[L,Y] = create_system(points1,points2);
-	
-	B = L'*Y;
-	x1 = B(1:2); 
-	x2 = B(3:4);
-
-	A = (L'*L);
-	lB = A(1:2,3:4);
-	bt=lB'*lB;
-	b=bt(1,1);
-	
-	% closed form solution
-	n = A(1,1);
-	c = A(3,3);
-	
-	pol = [ (b* x1'*x1+n^2 * x2'*x2 -2*n*x1'*lB*x2) 0 (-1)];
-	r = roots(pol);
-	la1 = (1/n) * (1/r(1) -n*c+b);
-	la2 = (1/n) * (1/r(2) -n*c+b);
-	
-	M = diag([0 0 1 1]);
-	L2 = (L'*L + la1 * M);
-	Y2 = L'*Y;
-	x_hat = inv(L2) * Y2;
-	
-	theta_hat = atan2(x_hat(4),x_hat(3));
-	pose = [x_hat(1); x_hat(2); theta_hat];
-	
-	
-function [L,Y] = create_system(points1, points2)
-	N = size(points1,2);
-	L = zeros(2*N,4);
-	Y = zeros(2*N,1);
-	for i=1:N
-		for j=max(1,i):min(i,N)
-		p_i = points1(:,i);
-		p_j = points2(:,j);
-		Lk = [ eye(2) p_i rot(pi/2)*p_i ];
-		Yk = p_j;
-	
-		L((i-1)*2+1:(i-1)*2+2,1:4) = Lk;
-		Y((i-1)*2+1:(i-1)*2+2,1)   = Yk;
-		end
-	end
-	
diff --git a/misc/matlab/icp/icp.m b/misc/matlab/icp/icp.m
deleted file mode 100644
index 9879db44f8107913938495323559f42483adc8d9..0000000000000000000000000000000000000000
--- a/misc/matlab/icp/icp.m
+++ /dev/null
@@ -1,139 +0,0 @@
-% Dependences of this script:
-% Requires: params_required, params_set_default, icp_get_correspondences
-% Requires: ld_plot, icp_covariance, exact_minimization, transform
-% Requires: icp_possible_interval
-
-function res = icp(params)
-% Note: it is assumed that params.laser_ref has a radial uniform scan 
-% params.laser_ref                - first scan
-% params.laser_sens               - second scan
-% params.maxAngularCorrectionDeg  - search space bound for phi, in degrees
-% params.maxLinearCorrection      - search space bound for |t|, in degrees
-	
-	
-	params_required(params, 'laser_sens');
-	params_required(params, 'laser_ref');
-	params = params_set_default(params, 'maxAngularCorrectionDeg', 105);
-	params = params_set_default(params, 'maxCorrespondenceDist', 4);
-	params = params_set_default(params, 'maxLinearCorrection',    2);
-	params = params_set_default(params, 'maxIterations',           40);
-	params = params_set_default(params, 'firstGuess',         [0;0;0]);
-	params = params_set_default(params, 'interactive',  false);
-	params = params_set_default(params, 'epsilon_xy',  0.0001);
-	params = params_set_default(params, 'epsilon_theta',  deg2rad(0.001));
-	params = params_set_default(params, 'sigma',  0.01);
-	params = params_set_default(params, 'do_covariance', false);
-
-	%% If true, consider as null correspondences with first or last point
-	%% in the reference scan.
-	params = params_set_default(params, 'dont_consider_extrema', false);
-	
-
-	current_estimate = params.firstGuess;
-	params.laser_sens.estimate = current_estimate;
-	
-	if params.interactive
-		f = figure; hold on
-	end
-
-	
-	estimated_cov = eye(3);	
-	
-	for n=1:params.maxIterations
-		estimates{n} = current_estimate;
-	
-
-		[P, valids, jindexes] = icp_get_correspondences(params, current_estimate);
-		
-		fprintf('Valid corr.: %d\n', sum(valids));
-		next_estimate = next_estimate(params, current_estimate, P, valids);
-
-		delta = next_estimate-current_estimate;
-	
-		
-		%% If in interactive mode, show partial solution.
-		if params.interactive
-			clf
-			pl.color = 'b.';
-			ld_plot(params.laser_ref,pl);
-			pl.color = 'r.';
-			params.laser_sens.estimate = rtcat(params.laser_ref.estimate, current_estimate);
-			ld_plot(params.laser_sens,pl);
-			axis('equal');
-		
-		
-			for i=find(valids)
-	
-				plotVectors(params.laser_sens.estimate, [params.laser_sens.points(:,i) P(:,i)] , 'k');
-	
-			end
-		
-		%	pause
-		end
-		
-		current_estimate = next_estimate;
-		
-		fprintf('Delta: %s\n', pv(delta));
-		fprintf('Estimate: %s\n', pv(current_estimate));
-		
-		if (norm(delta(1:2)) < params.epsilon_xy) & ...
-			(norm(delta(3))   < params.epsilon_theta) 
-			
-			break;
-		end
-		
-		pause(0.01)
-	end % iterations
-fprintf('Converged at iteration %d.\n', n);
-
-	res = params;
-	
-	if(params.do_covariance)		
-		estimated_cov = icp_covariance(params, current_estimate, P, valids, jindexes);	
-		res.sm_cov_bengtsson = estimated_cov.sm_cov_bengtsson;
-		res.loc_cov_censi = estimated_cov.loc_cov_censi;
-		res.sm_cov_censi = estimated_cov.sm_cov_censi;
-	end
-	
-	
-	res.X = current_estimate;
-	res.iteration = n;
-	estimates{n+1} = current_estimate;
-	res.estimates = estimates;
-	
-	
-function next = next_estimate(params, current_estimate, P, valids)
-% Requires: transform
-	if sum(valids) < 2
-		error('icp:run', sprintf('Only %d correspondences found.',sum(valids)));
-	end
-
-	next = current_estimate;
-
-	k=1; e = 0;
-	for a=find(valids)
-		points1(:,k) = transform(params.laser_sens.points(:,a), current_estimate);
-		points2(:,k) = P(:,a);
-		
-		if params.interactive
-			plot_line(points1(:,k),points2(:,k),'g-');
-		end
-		
-		e = e + norm(points1(:,k)-points2(:,k));
-		k=k+1;
-	end
-	
-	[pose, L, Y] = exact_minimization(points1, points2);
-	
-	fprintf('exact_min: %s ', pv(pose));
-	
-	next_phi = current_estimate(3) + pose(3);
-	next_t  = transform(current_estimate(1:2,1), pose);
-	next = [next_t; next_phi];
-	
-	fprintf('Pose: %s  error: %f\n', pv(next), e);
-	
-function plot_line(a,b,color)
-	plot([a(1) b(1)],[a(2) b(2)], color);
-
-
diff --git a/misc/matlab/icp/icp_covariance.m b/misc/matlab/icp/icp_covariance.m
deleted file mode 100644
index ad2732d746fdc6a4857bbfe4823993cc3cd80d92..0000000000000000000000000000000000000000
--- a/misc/matlab/icp/icp_covariance.m
+++ /dev/null
@@ -1,154 +0,0 @@
-
-function res = icp_covariance(params, current_estimate, P, valids, jindexes)
-	% res = icp_covariance(params, current_estimate, P, valids, jindexes)
-	%
-	% Compute the covariance of the ICP estimate.
-	%
-	% params.laser_sens  laser data structure describing sensor scan 
-	% params.laser_ref   laser data structure describing reference scan
-	%
-	%   Fields used:
-	%     laser_*.nrays    number of rays
-	%     laser_*.points   2xnrays vector of readings in cartesian coordinates
-	%
-	% params.sigma       sigma of noise on readings
-	% current_estimate   solution found by ICP: pose of laser_sens in laser_ref reference frame
-	% valids             nrays x 1 vector: valids(i) == 1 if the i-th point in laser_sens has valid correspondences
-	% jindexes           nrays x 2  correspondences:  jindexes(i,1), jindexes(i,2) are the indices
-	%                    of the closest points in laser_ref of the i-th point in laser_sens
-	% 
-	%  P                 unused (probably legacy from some old code)
-	%  
-	k=1; 
-	
-	Etot = 0;
-	Gtot = [0;0;0];
-	G2tot = zeros(3,3);
-	MMtot = zeros(3,3);
-	
-	x=current_estimate(1);
-	y=current_estimate(2);
-	theta=current_estimate(3);
-	
-	%% These are the interval to approximate the derivatives with 
-	%% the increments.
-	eps_xy = 0.000001;
-	eps_t = deg2rad(0.01);
-	
-	center = zeros(3);
-	
-	dgE_di = zeros(3, params.laser_sens.nrays);
-	dgE_dj = zeros(3, params.laser_ref.nrays);
-	
-	% let's iterate on the "valid" points of laser_sens
-	for a=find(valids)
-		% index of point in laser_sens
-		i = a;
-		% indices of the two corresponding points in laser_ref
-		j1 = jindexes(i,1);
-		j2 = jindexes(i,2);
-		
-		p_i  = params.laser_sens.points(:,a);
-		p_j1 = params.laser_ref.points(:,j1);
-		p_j2 = params.laser_ref.points(:,j2);
-		
-		rho_i = norm(p_i);
-		rho_j1 = norm(p_j1);
-		rho_j2 = norm(p_j2);
-		v_i = p_i / norm(p_i);
-		v_j1 = p_j1 / norm(p_j1);
-		v_j2 = p_j2 / norm(p_j2);
-		
-		%% The following is ugly but conceptually simple:
-		%% we define an error function E_k and then we derive it numerically.
-		
-		%% Note that we use the Matlab lambda-notation 
-		%%    func = @(x) x^2
-		%% who would have thought that also Matlab can be Lispy? :-)
-		
-		%% The error function is the traditional point-to-segment distance (squared)
-		E_k = @(rho_i_, rho_j1_, rho_j2_, x_, y_, theta_) ...
-			norm(...
-				transform(v_i*rho_i_, [x_;y_;theta_])  ... 
-				- ...
-				closest_point_on_segment(v_j1*rho_j1_, v_j2*rho_j2_, ...
-					transform(v_i*rho_i_, [x_;y_;theta_])) ...
-			)^(2);
-				%% first point p_i transformed by current estimate
-				%% and the closest point on the segment
-	
-		%% First derivative
-		gradEk = @(rho_i_, rho_j1_, rho_j2_, x_, y_, theta_) ...
-			[ deriv(@(xx)E_k(rho_i_,rho_j1_,rho_j2_,xx,y_,theta_), x_, eps_xy); ...
-			  deriv(@(yy)E_k(rho_i_,rho_j1_,rho_j2_,x_,yy,theta_), y_, eps_xy); ...
-			  deriv(@(tt)E_k(rho_i_,rho_j1_,rho_j2_,x_,y_,tt), theta_, eps_t)];
-			
-		%% Second derivative
-		d2Ek_dx2 = @(rho_i_, rho_j1_, rho_j2_, x_, y_, theta_) ...
-			[ deriv(@(xx)gradEk(rho_i_,rho_j1_,rho_j2_,xx,y_,theta_), x_, eps_xy) ...
-			  deriv(@(yy)gradEk(rho_i_,rho_j1_,rho_j2_,x_,yy,theta_), y_, eps_xy) ...
-			  deriv(@(tt)gradEk(rho_i_,rho_j1_,rho_j2_,x_,y_,tt), theta_, eps_t)];
-
-		%% The noise has three components: epsilon_i, epsilon_j1, epsilon_j2
-		d2Ek_dxdei = @(rho_i_, rho_j1_, rho_j2_, x_, y_, theta_) ...
-			deriv(@(ei)gradEk(ei,rho_j1_,rho_j2_,x_,y_,theta_), rho_i_, eps_xy);
-	
-		d2Ek_dxdej1 = @(rho_i_, rho_j1_, rho_j2_, x_, y_, theta_) ...
-			deriv(@(ej1)gradEk(rho_i_,ej1,rho_j2_,x_,y_,theta_), rho_j1_, eps_xy);
-	
-		d2Ek_dxdej2 = @(rho_i_, rho_j1_, rho_j2_, x_, y_, theta_) ...
-			deriv(@(ej2)gradEk(rho_i_,rho_j1_,ej2,x_,y_,theta_), rho_j2_, eps_xy);
-			
-		Etot = Etot + E_k(rho_i, rho_j1, rho_j2, x,y,theta);
-		
-		Gtot = Gtot+ gradEk(rho_i,  rho_j1, rho_j2, x,y,theta);
-		G2tot = G2tot+ d2Ek_dx2(rho_i,  rho_j1, rho_j2, x,y,theta);
-		
-		di = d2Ek_dxdei(rho_i,  rho_j1, rho_j2, x,y,theta);
-		dj1 = d2Ek_dxdej1(rho_i,  rho_j1, rho_j2, x,y,theta);
-		dj2 = d2Ek_dxdej2(rho_i,  rho_j1, rho_j2, x,y,theta);
-	
-		dgE_di(:,i) = dgE_di(:,i) + di;
-		dgE_dj(:,j1) = dgE_dj(:,j1) + dj1;
-		dgE_dj(:,j2) = dgE_dj(:,j2) + dj2;
-		
-		Mk = [eye(2) (rot(theta+pi/2)*p_i)] ;
-		MMtot = MMtot + Mk' * Mk;
-		
-		k=k+1;
-	end
-	                                                
-	dA_dz = inv(G2tot) * [dgE_di dgE_dj];
-	
-	%Etot
-	%Gtot
-	%G2tot
-
-	
-	sigma = params.sigma;
-	% dgE_di
-	% dgE_dj
-	% dA_dz
-	
-	fprintf('icp_covariance: Using sigma: %f', sigma);
-	
-	R = sigma^2 * eye(params.laser_ref.nrays+params.laser_sens.nrays);
-	
-	res.sm_cov_censi = dA_dz * R * dA_dz';
-	
-	s2 = Etot / (k-3);
-	res.sm_cov_bengtsson = 2 * s2 * inv(G2tot);
-	
-	
-	dA_dz1 = inv(G2tot) * [dgE_di ];
-	R1 = sigma^2 * eye(params.laser_sens.nrays);
-	res.loc_cov_censi = dA_dz1 * R1 * dA_dz1';
-	
-	res.sm_cov_bengtsson_improved =  s2 * inv( MMtot );
-	
-	fprintf('Bengtsson, improved:');
-	res.sm_cov_bengtsson_improved 
-	fprintf('Bengtsson, original:')
-	res.sm_cov_bengtsson 
-	
-	%res
diff --git a/misc/matlab/icp/icp_get_correspondences.m b/misc/matlab/icp/icp_get_correspondences.m
deleted file mode 100644
index ae81b06066f9a471c5f46956caa3c750e3062603..0000000000000000000000000000000000000000
--- a/misc/matlab/icp/icp_get_correspondences.m
+++ /dev/null
@@ -1,70 +0,0 @@
-
-function [P,valid,jindexes] = icp_get_correspondences(params,current_estimate)
-	debug = 0;
-	for i=1:params.laser_sens.nrays
-		p_i = params.laser_sens.points(:,i);
-		p_i_w = transform(p_i, current_estimate);
-
-		[from, to] = icp_possible_interval(p_i_w, params.laser_ref,...
-			params.maxAngularCorrectionDeg, params.maxLinearCorrection);
-		
-		%% Find best correspondence
-		best_j = 0; best_dist = 0;
-		for j=from:to
-			% Find compatible interval in the other scan. 
-			p_j = params.laser_ref.points(:,j);
-			
-			dist = norm( p_i_w - p_j);
-			if dist < params.maxCorrespondenceDist
-				if (best_j==0) || (dist < best_dist)
-					best_j = j; best_dist = dist;
-				end
-			end
-		end
-
-		if (best_j == 0) || ...
-			(params.dont_consider_extrema && ...
-				((best_j==1) || (best_j==params.laser_ref.nrays)))
-			P(:,i) = [nan;nan];
-			valid(i) = 0;
-			jindexes(i,:)=[nan;nan];
-		else
-			%% Find other point to interpolate
-			if best_j==1
-				other_j = best_j + 1;
-				other = params.laser_ref.points(:,best_j+1);
-			elseif best_j == params.laser_ref.nrays
-				other_j = best_j - 1;
-				other = params.laser_ref.points(:,best_j-1);
-			else
-				p_prev = params.laser_ref.points(:,best_j-1);
-				p_next = params.laser_ref.points(:,best_j+1);
-				dist_prev = norm( p_prev-p_i_w);
-				dist_next = norm( p_next-p_i_w);
-				if dist_prev < dist_next
-					other_j = best_j -1;
-					other = p_prev;
-				else
-					other_j = best_j +1;
-					other = p_next;
-				end
-			end
-			
-			%% Find the point which is closest to segment.
-			interpolate = closest_point_on_segment(...
-				params.laser_ref.points(:,best_j),other, p_i_w);
-	
-			dist = norm(interpolate-p_i_w);
-			if dist < params.maxCorrespondenceDist
-				P(:,i) = interpolate;
-				valid(i) = 1;
-				jindexes(i,:) = [best_j;other_j];
-			else
-				P(:,i) = [nan;nan];
-				valid(i) = 0;
-				jindexes(i,:) = [nan;nan];
-			end
-		end
-			
-	end % i in first scan 
-	
diff --git a/misc/matlab/icp/icp_possible_interval.m b/misc/matlab/icp/icp_possible_interval.m
deleted file mode 100644
index 084758f1914444da558f344d65c474f0522fafff..0000000000000000000000000000000000000000
--- a/misc/matlab/icp/icp_possible_interval.m
+++ /dev/null
@@ -1,22 +0,0 @@
-
-function [from, to] = icp_possible_interval(P, ld, maxAngularCorrectionDeg, maxLinearCorrection)
-	debug = 0;
-	
-	delta = abs(deg2rad(maxAngularCorrectionDeg)) + ...
-		        abs(atan(maxLinearCorrection/norm(P)));
-	
-	n = ld.nrays;
-	fov = abs(ld.theta(n)-ld.theta(1));
-	angleRes = fov/n;
-	start_theta = atan2(P(2),P(1));
-	start_cell  = ((start_theta - ld.theta(1)) / fov) * n;
-	range = ceil(delta/angleRes);
-
-	from = min(n, max( floor(start_cell-range),1));
-	to = max(1, min(ceil(start_cell+range),n));
-
-	if debug
-		fprintf('start_theta: %f delta: %f start_cell: %d from: %d to: %d\n',...
-			rad2deg(start_theta), rad2deg(delta), start_cell, from, to);
-		pause(0.001);
-	end
diff --git a/misc/matlab/icp/test_icp_1.m b/misc/matlab/icp/test_icp_1.m
deleted file mode 100644
index 6919b7d33167825ef5f29abc90ffaa5b2b5d58cb..0000000000000000000000000000000000000000
--- a/misc/matlab/icp/test_icp_1.m
+++ /dev/null
@@ -1,5 +0,0 @@
-  
-  step = [0.1;0;0]
-  params1 = ts_square([5], [0;0;0], step);
-  res = icp(params1);
-  
diff --git a/misc/matlab/icpcov/derivn.m b/misc/matlab/icpcov/derivn.m
deleted file mode 100644
index 9f37d19c90a1a6ced835d06878de4f832aeeafb2..0000000000000000000000000000000000000000
--- a/misc/matlab/icpcov/derivn.m
+++ /dev/null
@@ -1,10 +0,0 @@
-%% Numerical derivation with step \verb|epsilon|
-function res = deriv(fh, x, epsilon)
-	% deriv(fh, x, epsilon)
-	%  fh: function handle
-	%   x: point to derive
-	% epsilon: interval
-	f1 = fh(x+epsilon/2);
-	f0 = fh(x-epsilon/2);
-	res= (f1-f0)/epsilon;
-
diff --git a/misc/matlab/matlab_new/display/display_cov.m b/misc/matlab/matlab_new/display/display_cov.m
deleted file mode 100644
index 3898395d98ac007360ec01cf85cca220faaf9c9d..0000000000000000000000000000000000000000
--- a/misc/matlab/matlab_new/display/display_cov.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function res = display_cov(cov)
-
-	std_x = sqrt(cov(1,1));
-	std_y = sqrt(cov(2,2));
-	std_th = sqrt(cov(3,3));
-	rho_xy = cov(1,2) / (std_x * std_y);
-	rho_xth = cov(1,3) / (std_x * std_th);
-	rho_yth = cov(2,3) / (std_y * std_th);
-	
-	res = [std_x, std_y, std_th, rho_xy, rho_xth, rho_yth];
\ No newline at end of file
diff --git a/misc/matlab/matlab_new/ld_fisher0.m b/misc/matlab/matlab_new/ld_fisher0.m
deleted file mode 100644
index 2d5e527b71b85c5faf98b0224ca2ab85160b9e9b..0000000000000000000000000000000000000000
--- a/misc/matlab/matlab_new/ld_fisher0.m
+++ /dev/null
@@ -1,33 +0,0 @@
-function I0 = ld_fisher0(ld)
-% This function computes Fisher's information matrix, in robot coordinates.
-% Uses field 'true_alpha' (and 'theta', 'readings').  
-% 
-% For details about the Fisher's information matrix for localization,
-% please see this paper: http://purl.org/censi/2006/accuracy
-
-I0 = zeros(3,3);
-
-for i=1:ld.nrays
-	alpha_i = ld.true_alpha(i);
-	r = ld.readings(i);
-
-	if isnan(alpha_i) | isnan(r) 
-		continue;
-	end
-	
-	phi_i   = ld.theta(i);
-	beta_i  = alpha_i - (phi_i);
-	
-	% dr_dt = v(beta_i)' / cos(beta_i);
-	dr_dt = (v(phi_i) + v(phi_i+pi/2) * tan(beta_i))';
-	dr_dt = v(alpha_i)' / cos(beta_i);
-	dr_dtheta = r * tan(beta_i);
-	
-	I0(1:2,1:2) = I0(1:2,1:2) + (dr_dt' * dr_dt);
-	I0(1:2,3) = I0(1:2,3) + (dr_dt' * dr_dtheta);
-	I0(3,1:2) = I0(3,1:2) + (dr_dt * dr_dtheta);
-	I0(3,3) = I0(3,3) + dr_dtheta * dr_dtheta;
-end
-
-function res = v(a)
-	res = [cos(a); sin(a)];
diff --git a/misc/matlab/matlab_new/ld_fisher_ext.m b/misc/matlab/matlab_new/ld_fisher_ext.m
deleted file mode 100644
index da9a9c825fb05da130da2529805e1bbad4a5ee94..0000000000000000000000000000000000000000
--- a/misc/matlab/matlab_new/ld_fisher_ext.m
+++ /dev/null
@@ -1,48 +0,0 @@
-function I0 = ld_fisher_ext(ld, vars)
-% This is an extension of function ld_fisher0 which takes into account
-% different variances for each ray. It also does not count rays
-% for which ld.valid(i) is set to 0.
-%
-% This function computes Fisher's information matrix, in robot coordinates.
-% Uses field 'true_alpha' (and 'theta', 'readings').  
-% If true_alpha is NAN, it tries to use alpha.
-% 
-% For details about the Fisher's information matrix for localization,
-% please see this paper: http://purl.org/censi/2006/accuracy
-
-I0 = zeros(3,3);
-
-nused = 0;
-for i=1:ld.nrays
-	alpha_i = NaN;
-	if isfield(ld, 'true_alpha')
-		alpha_i = ld.true_alpha(i);
-	end
-	if isnan(alpha_i)
-		alpha_i = ld.alpha(i);
-	end
-	
-	r = ld.readings(i);
-
-	if isnan(alpha_i) | isnan(r) | not(ld.valid(i))
-		continue;
-	end
-	
-	phi_i   = ld.theta(i);
-	beta_i  = alpha_i - (phi_i);
-	
-	dr_dt = v(alpha_i)' / cos(beta_i);
-	dr_dtheta = r * tan(beta_i);
-	
-	mult = 1 / vars(i);
-	I0(1:2,1:2) = I0(1:2,1:2) + mult * (dr_dt' * dr_dt);
-	I0(1:2,3) = I0(1:2,3) +  mult * (dr_dt' * dr_dtheta);
-	I0(3,1:2) = I0(3,1:2) +  mult *(dr_dt * dr_dtheta);
-	I0(3,3) = I0(3,3) +  mult * (dr_dtheta * dr_dtheta);
-	
-	nused = nused +1;
-end
-fprintf('FIM computed using %d rays.\n', nused);
-
-function res = v(a)
-	res = [cos(a); sin(a)];
diff --git a/misc/matlab/matlab_new/ld_fisher_ext2.m b/misc/matlab/matlab_new/ld_fisher_ext2.m
deleted file mode 100644
index 42cae0fe0710e6df9fec8277f6fc22cc9ecbacbd..0000000000000000000000000000000000000000
--- a/misc/matlab/matlab_new/ld_fisher_ext2.m
+++ /dev/null
@@ -1,40 +0,0 @@
-function I0 = ld_fisher_ext(ld)
-% This is an extension of function ld_fisher0 which does not use the 
-% (1/cos(beta)) factor.
-%
-% This function computes Fisher's information matrix, in robot coordinates.
-% Uses field 'true_alpha' (and 'theta', 'readings').  
-% 
-% For details about the Fisher's information matrix for localization,
-% please see this paper: http://purl.org/censi/2006/accuracy
-
-
-I0 = zeros(3,3);
-
-nused = 0;
-for i=1:ld.nrays
-	alpha_i = ld.true_alpha(i);
-	r = ld.readings(i);
-
-	if isnan(alpha_i) | isnan(r) | not(ld.valid(i))
-		continue;
-	end
-	
-	phi_i   = ld.theta(i);
-	beta_i  = alpha_i - (phi_i);
-	
-	% do not use the 1/cos(beta)
-	dr_dt = v(alpha_i)';
-	dr_dtheta = r * sin(beta_i);
-	
-	I0(1:2,1:2) = I0(1:2,1:2) + (dr_dt' * dr_dt);
-	I0(1:2,3) = I0(1:2,3) +   (dr_dt' * dr_dtheta);
-	I0(3,1:2) = I0(3,1:2) +  (dr_dt * dr_dtheta);
-	I0(3,3) = I0(3,3) +  (dr_dtheta * dr_dtheta);
-	
-	nused = nused +1;
-end
-fprintf('FIM computed using %d rays.\n', nused);
-
-function res = v(a)
-	res = [cos(a); sin(a)];
diff --git a/misc/matlab/matlab_new/structs/collect.m b/misc/matlab/matlab_new/structs/collect.m
deleted file mode 100644
index 2801b9f4ddbf4c8f981c50581821194813b3f686..0000000000000000000000000000000000000000
--- a/misc/matlab/matlab_new/structs/collect.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function res = collect(cells, field)
-	res = {};
-	k = 1;
-	for i=1:size(cells,2) 
-		s = cells{i};
-		if isfield(s, field)
-			res{k} = s.(field);
-		else
-			ref{k} = nan;
-		end
-		k = k + 1;
-	end
\ No newline at end of file
diff --git a/misc/matlab/matlab_new/structs/join.m b/misc/matlab/matlab_new/structs/join.m
deleted file mode 100644
index a551ebb2fad2d6636c82503517e60d5a09b030b3..0000000000000000000000000000000000000000
--- a/misc/matlab/matlab_new/structs/join.m
+++ /dev/null
@@ -1,13 +0,0 @@
-function res = join(cells)
-	columns = size(cells,2);
-	rows = size(cells{1},1);
-	res = zeros(rows, columns);
-	for j=1:columns
-		if size(cells{j},1) > 0
-			res(1:rows,j) = cells{j};
-		else
-			fprintf('No value for cell %d\n', j);
-			pause(0.01);
-			res(1:rows,j) = zeros(rows,1) * NaN;
-		end
-	end
diff --git a/misc/matlab/mbicp/MbICP.m b/misc/matlab/mbicp/MbICP.m
deleted file mode 100644
index 93206c6847df81c1472379e8422d1138b959b58a..0000000000000000000000000000000000000000
--- a/misc/matlab/mbicp/MbICP.m
+++ /dev/null
@@ -1,271 +0,0 @@
-% Test implementation of Minguez et al Metric Based ICP
-% by Patric Jensfelt, 2006-03-28
-%
-% refScan - 361 range readings from reference scan
-% newScan - 361 range readings from reference scan
-% initQ   - initial estimate of transformation from ref to new scan
-% 
-function transf = MbICP(refScan, newScan, initQ, interactive)
-
-  global ang;
-  global cx;
-  global cy;
-  global assoc;
-  global n_assoc;
-  
-  % Parameters
-  global L;
-  global Max_Dist;
-  global Min_error;
-
-  % Values of the parameters
-  L = 3.0;
-  Max_Dist = 1;
-  Min_error = 1e-4;
-  
-  nrays = length(refScan)
-  %ang = (0:0.5:180)*pi/180;
-  ang = (1:nrays)*(pi/nrays);
-  ang = (1:nrays)*(pi/nrays)-pi/2;
-  
-  if nargin < 3
-    disp('Usgae: MbICP(refScan, newScan, initQ)');
-    return
-  end
-
-  if checkArgs(refScan, newScan, initQ)
-    return
-  end
-
-  px = refScan .* cos(ang);
-  py = refScan .* sin(ang);
-
-  % Define array to hold Cartesian coordinates for transformed new scan
-  cx = zeros(1,nrays);
-  cy = zeros(1,nrays);
-
-  % The transformation from the reference scan to the new scan
-  q = initQ;
-
-  for k = 1:500
-    disp(sprintf('Iteration %d', k))
-
-    calcTransfNewScanPts(newScan, q);
-    clf, hold on
-    dispScan(px,py,'r')
-    dispScan(cx,cy,'b')
-    drawnow
-
-	if interactive
-	    disp('Get associations')
-	end
-	
-	n_assoc = 0;
-    getAssociations(px,py,cx,cy);
-
-	 if interactive
-  	  dispAssociations(px,py,cx,cy,assoc,n_assoc);
-      	disp('Getting best transformation')
-	 end
-	 
-    q_min = getQmin(px,py,cx,cy,assoc, n_assoc)
-
-    q = compound(q_min, q)
-
-    if (max(abs(q_min)) < Min_error) 
-      disp(sprintf('Converged in iteration %d', k))
-      break
-    end
-  
-	 if interactive
-    disp(sprintf('Press enter for iteration %d', k+1))
-    pause
-	 end
-  end
-
-  dispAssociations(px,py,cx,cy,assoc,n_assoc);
-  disp('Final transformation:');
-  q
-
-  transf=q;
-  
-  return;
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-function err = checkArgs(refScan, newScan, initQ)
-  
-	err = 0
-	
-	if length(refScan) < 10
-    disp('Need at least 10 ranges for ref scan');
-    err = 1;
-    return;
-  end
-
-  if  not(length(newScan) == length(refScan)) 
-    disp('Need ref scan and new scan of same size');
-    err = 1;
-    return;
-  end
-
-  if length(initQ) < 3
-    disp('Need 3 values for initial transformation');
-    err = 1;
-    return;
-  end
-
-  return;
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-function calcTransfNewScanPts(newScan, q)
-  global cx;
-  global cy;
-  global ang;
-
-  R = [cos(q(3)) -sin(q(3)); sin(q(3)) cos(q(3))];
-  xy = R * [newScan .* cos(ang); newScan .* sin(ang)];
-  cx = xy(1,:) + q(1);
-  cy = xy(2,:) + q(2);
-
-  return;
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-function dispScan(x,y,col)
-  plot(x,y,[col '.'])
-return
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-function getAssociations(px,py,cx,cy)
-  global assoc
-  global n_assoc
-  global Max_Dist
-
-  for ic = 1:length(cx)
-    
-    minD2 = 1e10;
-    minIndex = -1;
-
-    for ip = 1:length(px)
-
-      d2 = getMbDistSqr(px(ip),py(ip),cx(ic),cy(ic));
-      if d2 < minD2
-        minD2 = d2;
-        minIndex = ip;
-      end
-    end
-
-    % Add this association (not very clever to reallocate every time...)
-    if minD2 < Max_Dist,
-      n_assoc = n_assoc + 1;
-      assoc(n_assoc,1) = minIndex;
-      assoc(n_assoc,2) = ic;
-    end
-
-  end
-
-  return
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-function d2 = getMbDistSqr(p2x, p2y, p1x, p1y)
-  global L;
-
-  dx = p2x - p1x;
-  dy = p2y - p1y;
-
-  tmp = dx * p1y - dy * p1x;
-  d2 = dx*dx + dy*dy - (tmp * tmp / (p1y*p1y + p1x*p1x + L*L));
-
-  return
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-function dispAssociations(px,py,cx,cy,assoc, n_assoc)
-
-  for k=1:n_assoc
-     plot([px(assoc(k,1)) cx(assoc(k,2))], [py(assoc(k,1)) cy(assoc(k,2))])
-  end
-
-  return
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-function q_min = getQmin(px,py,cx,cy,assoc, n_assoc)
-
-  global L;
-
-  A = zeros(3,3);
-  b = zeros(3,1);
-  
-  for k = 1:n_assoc
-    pix = px(assoc(k,1));
-    piy = py(assoc(k,1));
-    cix = cx(assoc(k,2));
-    ciy = cy(assoc(k,2));
-
-    ki = pix * pix + piy * piy + L * L;
-
-    cxpxPcypy = cix * pix + ciy * piy;
-    cxpyMcypx = cix * piy - ciy * pix;
-
-    A(1,1) = A(1,1) + 1.0 - piy * piy / ki;
-    A(1,2) = A(1,2) + pix * piy / ki;
-    A(1,3) = A(1,3) - ciy + piy / ki * cxpxPcypy; 	
-    A(2,2) = A(2,2) + 1.0 - pix * pix / ki; 			
-    A(2,3) = A(2,3) + cix - pix / ki * cxpxPcypy;
-    A(3,3) = A(3,3) + cix*cix + ciy*ciy - cxpxPcypy*cxpxPcypy / ki;
-
-    b(1,1) = b(1,1) + cix - pix - piy / ki * cxpyMcypx;
-    b(2,1) = b(2,1) + ciy - piy + pix / ki * cxpyMcypx;
-    b(3,1) = b(3,1) + (cxpxPcypy / ki - 1.0) * cxpyMcypx;
-  end
-
-  % Complete the A-matrix by assigning the symmetric portions of it
-  A(2,1) = A(1,2);
-  A(3,1) = A(1,3);
-  A(3,2) = A(2,3);
-
-  q_min = - inv(A) * b; 
-
-
-  return
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-function t_ret = compound(t1, t2)
-
-  t_ret = zeros(3,1);
-
-  t_ret(1) = t2(1) * cos(t1(3)) - t2(2) * sin(t1(3)) + t1(1);
-  t_ret(2) = t2(1) * sin(t1(3)) + t2(2) * cos(t1(3)) + t1(2);
-  t_ret(3) = t1(3) + t2(3);
-
-  % Make angle [-pi,pi)
-  while (t_ret(3) >= pi)
-    t_ret(3) = t_ret(3) - 2*pi;
-  end
-  while (t_ret(3) < -pi)
-    t_ret(3) = t_ret(3) + 2*pi;
-  end
-
-  return;
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-function t_ret = inv_compound(t)
-
-  t_ret = zeros(3,1);
-
-  t_ret(1) = -t(1) * cos(t(3)) - t(2) * sin(t(3));
-  t_ret(2) =  t(1) * sin(t(3)) - t(3) * cos(t(3));
-  t_ret(3) = -t(3);
-
-  return
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
diff --git a/misc/matlab/mbicp/datos.off b/misc/matlab/mbicp/datos.off
deleted file mode 100644
index df1164daca77bdf3ccc3c16f9a24ddadbb356a70..0000000000000000000000000000000000000000
--- a/misc/matlab/mbicp/datos.off
+++ /dev/null
@@ -1,3 +0,0 @@
-6.247 6.239 6.255 6.249 6.256 6.261 6.265 6.269 6.279 6.284 6.285 6.298 6.296 6.302 6.302 6.313 6.339 5.976 5.926 5.896 5.891 5.888 5.902 5.937 6.061 6.27 6.262 6.281 6.301 6.311 5.305 4.809 4.585 4.41 4.278 4.155 4.055 3.967 3.882 3.801 3.733 3.672 3.61 3.55 3.499 3.45 3.41 3.358 3.313 3.284 3.25 3.211 3.182 3.14 3.115 3.081 3.053 3.02 2.997 3.013 3.041 3.07 4.434 4.31 4.253 4.205 4.177 4.128 4.078 4.032 3.977 3.931 3.893 3.865 3.869 3.9 3.922 3.964 3.988 4.025 4.051 4.1 4.129 4.189 4.171 4.207 4.241 4.491 4.472 4.441 2.175 2.155 2.135 2.125 2.107 2.088 2.068 2.059 2.039 2.029 2.01 2 1.991 1.981 1.961 1.951 1.941 1.921 1.911 1.902 1.892 1.882 1.873 1.862 1.852 1.841 1.755 1.744 1.734 1.725 1.725 1.715 1.705 1.695 1.695 1.686 1.676 1.676 1.665 1.655 1.645 1.645 1.635 1.635 1.625 1.617 1.617 1.607 1.608 1.598 1.598 1.587 1.6 1.654 1.695 1.687 1.68 1.68 1.679 1.669 1.672 1.662 1.663 1.663 1.655 1.656 1.657 1.647 1.649 1.648 1.639 1.639 1.64 1.639 1.64 1.64 1.64 1.63 1.631 1.631 1.632 1.622 1.632 1.622 1.622 1.621 1.573 1.572 1.573 1.582 1.573 1.574 1.583 1.574 1.575 1.575 1.585 1.585 1.585 1.584 1.584 1.584 1.594 1.594 1.594 1.594 1.604 1.593 1.604 1.603 1.613 1.613 1.613 1.623 1.622 1.622 1.631 1.635 1.636 1.585 1.581 1.595 1.598 1.607 1.605 1.614 1.613 1.624 1.623 1.631 1.631 1.641 1.64 1.648 1.657 1.654 1.667 1.677 1.675 1.685 1.687 1.7 1.712 1.716 1.731 1.729 1.742 1.752 1.765 1.777 1.787 1.797 1.798 1.814 1.813 1.823 1.837 1.843 1.862 1.863 1.865 1.893 1.906 1.926 1.938 1.947 1.967 1.976 1.986 2.005 2.024 2.035 2.053 2.063 2.081 2.101 2.12 2.128 2.148 2.167 2.186 2.215 2.234 2.244 2.274 2.294 2.313 2.335 2.356 2.384 2.404 2.434 2.462 2.491 2.52 2.539 2.577 2.617 2.647 2.687 2.719 2.759 2.787 2.837 2.876 2.913 2.96 3.017 3.065 3.121 3.169 3.164 3.144 3.163 3.323 3.438 3.497 3.562 3.624 3.694 3.764 3.852 3.908 4.084 3.96 4.028 4.931 4.913 4.895 4.874 4.868 4.863 4.868 4.864 5.277 5.435 5.613 5.804 5.987 6.171 6.424 6.647 6.883 7.766 7.757 7.789 8.148 8.188 4.804 5.022 5.289 5.603 5.965 6.374 6.805 7.349 7.991 8.188 8.188 8.188 8.188 8.188 8.191 8.191 8.188 8.191 8.188 2.835 2.396 2.316 1.987
-6.241 6.235 6.253 8.191 8.191 8.191 8.191 8.191 8.191 8.191 8.191 8.191 8.191 6.351 8.191 6.291 6.293 6.296 5.97 5.906 5.873 5.859 5.852 5.857 5.887 5.926 6.295 6.226 6.24 6.25 6.269 5.259 4.759 4.516 4.32 4.2 4.065 3.968 3.871 3.792 3.713 3.64 3.57 3.509 3.458 3.408 3.351 3.312 3.272 3.228 3.191 3.15 3.111 3.081 3.052 3.014 2.989 2.963 2.941 2.967 2.984 3.016 4.431 4.373 4.243 4.192 4.141 4.116 4.053 4.005 3.953 3.908 3.861 3.813 3.789 3.799 3.83 3.848 3.887 3.904 3.933 3.972 4.005 4.046 4.103 4.13 4.117 4.147 4.208 2.141 2.066 2.057 2.037 2.017 1.998 1.989 1.968 1.959 1.939 1.929 1.919 1.899 1.889 1.869 1.858 1.839 1.839 1.818 1.807 1.798 1.788 1.777 1.767 1.757 1.746 1.68 1.658 1.649 1.64 1.629 1.619 1.609 1.599 1.6 1.589 1.58 1.57 1.56 1.56 1.551 1.541 1.541 1.531 1.531 1.521 1.512 1.512 1.503 1.502 1.494 1.484 1.482 1.482 1.472 1.547 1.557 1.574 1.563 1.552 1.552 1.543 1.544 1.544 1.532 1.533 1.526 1.527 1.528 1.53 1.524 1.524 1.515 1.515 1.519 1.515 1.508 1.507 1.507 1.508 1.508 1.509 1.5 1.509 1.502 1.51 1.5 1.498 1.5 1.497 1.467 1.459 1.459 1.451 1.462 1.452 1.461 1.461 1.463 1.462 1.463 1.462 1.463 1.461 1.461 1.469 1.461 1.468 1.468 1.467 1.468 1.477 1.478 1.475 1.478 1.484 1.485 1.484 1.493 1.491 1.491 1.5 1.5 1.498 1.508 1.498 1.462 1.462 1.463 1.465 1.465 1.475 1.485 1.484 1.485 1.494 1.505 1.504 1.514 1.524 1.524 1.533 1.533 1.543 1.553 1.562 1.572 1.572 1.582 1.592 1.592 1.603 1.613 1.612 1.623 1.633 1.644 1.654 1.653 1.675 1.675 1.684 1.694 1.705 1.724 1.735 1.744 1.755 1.764 1.783 1.798 1.822 1.824 1.836 1.856 1.866 1.876 1.896 1.905 1.925 1.935 1.964 1.974 1.993 2.002 2.032 2.041 2.06 2.079 2.099 2.126 2.144 2.163 2.182 2.2 2.23 2.249 2.279 2.299 2.332 2.352 2.381 2.409 2.439 2.469 2.513 2.533 2.573 2.614 2.664 2.695 2.735 2.774 2.833 2.871 2.918 2.965 3.032 3.08 3.134 3.093 3.08 3.134 3.36 3.43 3.503 3.549 3.642 3.71 3.814 3.856 4.031 3.914 4.026 4.876 4.866 4.847 4.839 4.821 4.838 4.83 5.182 5.053 5.565 5.752 5.989 6.136 6.453 6.674 7.46 7.743 7.703 7.953 8.188 8.188 8.188 4.81 5.209 5.514 5.955 6.388 7.02 7.631 8.188 8.188 8.188 8.188 8.188 8.191 8.188 8.191 8.191
-
diff --git a/misc/matlab/mbicp/testMbICP.m b/misc/matlab/mbicp/testMbICP.m
deleted file mode 100644
index c8091887b3a4255ac8274df37f7350fff16a0e96..0000000000000000000000000000000000000000
--- a/misc/matlab/mbicp/testMbICP.m
+++ /dev/null
@@ -1,18 +0,0 @@
-clear all
-close all
-disp('hola')
-
-load datos.off -ascii
-
-% ----------
-% Try same scans
-%scanRef=datos(1,:);
-%scanNew=datos(1,:);
-
-% ----------
-% Try different scans
-scanRef=datos(1,:);
-scanNew=datos(2,:);
-
-transf = MbICP(scanRef, scanNew, [0.3,0.3,0.7], false)
-
diff --git a/misc/matlab/msm/ld_alloc.m b/misc/matlab/msm/ld_alloc.m
deleted file mode 100644
index 791e4b4e836081eeb4179511b98941e25ec7045c..0000000000000000000000000000000000000000
--- a/misc/matlab/msm/ld_alloc.m
+++ /dev/null
@@ -1,45 +0,0 @@
-function ld = ld_alloc(min_max_theta, readings)
-	% Fills default fields of a LaserData struct
-	ld.nrays    = size(readings, 1);
-	
-	
-	ld.min_theta = min_max_theta(1);
-	ld.max_theta = min_max_theta(2);	
-	for i=1:ld.nrays
-		ld.theta(i,1) = ld.min_theta + (i-1) / (ld.nrays-1) * (ld.max_theta-ld.min_theta);
-	end
-
-	for i=1:ld.nrays
-		if isnan(readings(i)) || (readings(i)==0)
-			ld.valid(i,1) = uint8(0);
-			ld.readings(i,1) = nan;
-		else
-			ld.valid(i,1) = uint8(1);
-			ld.readings(i,1) = readings(i);
-		end
-	end
-
-	ld.odometry = [nan; nan; nan];
-	ld.estimate = [nan; nan; nan];
-	
-%	@nrays      = nrays
-%	@valid       = [false  ] * nrays
-%	@readings    = [GSL::NAN] * nrays
-%	@theta       = [GSL::NAN] * nrays
-%	@alpha_valid = [false  ] * nrays
-%	@alpha       = [GSL::NAN] * nrays
-%	@cov_alpha   = [GSL::NAN] * nrays
-%	@cluster     = [-1] * nrays
-	
-%	@odometry    = Vector[GSL::NAN,GSL::NAN,GSL::NAN].col
-%	@estimate    = Vector[GSL::NAN,GSL::NAN,GSL::NAN].col
-%	@p = []; @corr = [];
-%	for i in 0..nrays-1
-%		@p[i] = Vector[GSL::NAN,GSL::NAN].col
-%		@corr[i] = Correspondence.new;
-%		@corr[i].valid = false;
-%		@corr[i].j1 = -1;
-%		@corr[i].j2 = -1;
-%	end
-	
-%
\ No newline at end of file
diff --git a/misc/matlab/msm/ld_clustering.m b/misc/matlab/msm/ld_clustering.m
deleted file mode 100644
index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000
--- a/misc/matlab/msm/ld_clustering.m
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/misc/matlab/msm/ld_to_json.m b/misc/matlab/msm/ld_to_json.m
deleted file mode 100644
index 9859ad7c5471bb8af3ae21528e3f95e4692b7e4c..0000000000000000000000000000000000000000
--- a/misc/matlab/msm/ld_to_json.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function s = ld_to_json(ld, pretty)
-
-	ld.nrays = uint16(ld.nrays);
-	ld.valid = uint16(ld.valid);
-	s = matlab_to_json(ld, pretty);
-	
-	
-	
diff --git a/misc/matlab/msm/matlab_to_json.m b/misc/matlab/msm/matlab_to_json.m
deleted file mode 100644
index 3a8ae9a285567cc33d368028c3d5ac91d45ce3dd..0000000000000000000000000000000000000000
--- a/misc/matlab/msm/matlab_to_json.m
+++ /dev/null
@@ -1,61 +0,0 @@
-function s = matlab_to_json(ob, pretty)
-	s = '!';
-	
-	if isnumeric(ob)
-		if (size(ob,1) == 1) && (size(ob,2) == 1) 
-			if isnan(ob)
-				s = 'null';
-			else
-				if isinteger(ob)
-					s = sprintf('%d', ob);
-				else
-					s = sprintf('%f', ob);
-				end
-			end
-		else
-			% XXXXXXX non funziona se row=1 col>1
-			% array
-			s = '[';
-			rows = size(ob, 1);
-			for row=1:rows
-				v = ob(row,:);
-				s = strcat(s, matlab_to_json(v) );
-				if row < rows
-					s = strcat(s, ', ');
-				end
-				
-				if (rows>1) && (size(ob,2) >1) && pretty
-					s = strcat(s, '\n');
-				end
-				
-			end
-			s = strcat(s, ']');
-		end
-		return;
-	end
-	
-	if isstruct(ob)
-		s = '{ ';
-		names = fieldnames(ob);
-		for i=1:size(names,1)
-			key = names{i};
-			value = matlab_to_json( getfield(ob, key) );
-			s = strcat(s, '"', key, '": ', value);
-			if i < size(names, 1) 
-				s = strcat(s, ', ');
-				
-				if pretty
-					s = strcat(s, '\n');
-				end
-			end
-		end
-		s = strcat(s, '}');
-		return;
-	end
-	
-	s = '?';
-	
-
-
-
-
diff --git a/misc/matlab/octave_compat/deg2rad.m b/misc/matlab/octave_compat/deg2rad.m
deleted file mode 100644
index e71b27996497ebb51a566334d202e67e5246ebb1..0000000000000000000000000000000000000000
--- a/misc/matlab/octave_compat/deg2rad.m
+++ /dev/null
@@ -1,2 +0,0 @@
-function r = deg2rad(d)
-	r = pi * d / 180;
diff --git a/misc/matlab/orientation/arras_fit.m b/misc/matlab/orientation/arras_fit.m
deleted file mode 100644
index 05307fe5e6c36f70d522a36d9095e16fdf5d3e77..0000000000000000000000000000000000000000
--- a/misc/matlab/orientation/arras_fit.m
+++ /dev/null
@@ -1,35 +0,0 @@
-function [alpha,alpha_var] = arras_fit( thetas , rhos , var)
-
-	n = size(thetas,2);
-	
-	xw=0; yw=0; 
-	
-	for i=1:n
-		w(i) = 1/var;
-	end
-	
-	
-	for i=1:n
-		
-	end
-
-	x = rhos .* cos(thetas);
-	y = rhos .* sin(thetas);
-	
-	xw = sum( w.*x) / sum(w);
-	yw = sum( w.*y) / sum(w);
-	
-	num = -2 * sum((yw-y).*(xw-x).*w);
-	den = sum( w.* ( (yw-y).^2 -(xw-x).^2 ) );
-	
-	alpha = 0.5 * atan(num/den);
-	r = xw * cos(alpha)+yw*sin(alpha);
-	
-	if r<0
-		alpha = alpha- pi;
-	end
-	
-	
-	alpha_var = 1;
-	
-	
diff --git a/misc/matlab/orientation/computeSurfaceNormals.m b/misc/matlab/orientation/computeSurfaceNormals.m
deleted file mode 100644
index 57d18c63936379b1554b8f1df05163822e61fab5..0000000000000000000000000000000000000000
--- a/misc/matlab/orientation/computeSurfaceNormals.m
+++ /dev/null
@@ -1,59 +0,0 @@
-function ld = computeSurfaceNormals(ld, maxDist)
-
-n = size(ld.points,2);
-
-for i=1:n
-
-	% consider all points in a ball of radius maxDist 
-	imin=i; stop=0;
-	while stop == 0 & imin>1 
-		if norm(ld.points(:,i)-ld.points(:,imin-1)) < maxDist
-			imin = imin -1;
-		else
-			stop=1;
-		end
-	end
-	
-	imax=i; stop=0;
-	while stop==0 & imax<n
-		if norm(ld.points(:,i)-ld.points(:,imax+1)) < maxDist
-			imax=imax+1;
-		else 
-			stop = 1;
-		end
-	end
-
-	num=imax-imin+1;
-
-	if num>1 
-		%[theta; rho; error] 
-		[alpha,rho,error] = regression(ld.points(:,imin:imax));
-	
-		ld.alpha(i) =  normalize(alpha);
-		ld.alpha_valid(i) = 1;
-		ld.alpha_error(i) = sqrt(error/num);
-		
-		if num==2
-			ld.alpha_error(i) = 0.1;
-		end
-		
-		%fprintf('n = %d alpha %3.3f rho %5.5f error %f\n', ...
-		%imax-imin+1, alpha,rho,ld.alpha_error(i)); 
-	else
-		fprintf('ops! %d\n',i);
-		ld.alpha(i) = nan;
-		ld.alpha_valid(i) = 0;
-		ld.alpha_error(i) = nan;
-	end
-	
-end
-
-function res = normalize(alpha)
-	while alpha > 2*pi
-		alpha = alpha - 2*pi;
-	end
-	while alpha < 0
-		alpha = alpha + 2*pi;
-	end
-	res = alpha;
-	
diff --git a/misc/matlab/orientation/computeSurfaceNormals_sound.m b/misc/matlab/orientation/computeSurfaceNormals_sound.m
deleted file mode 100644
index c5872b220389e907936a829390079ed8b64d789f..0000000000000000000000000000000000000000
--- a/misc/matlab/orientation/computeSurfaceNormals_sound.m
+++ /dev/null
@@ -1,114 +0,0 @@
-% params.sigma
-% params.curv 
-% params.max_points
-% params.threshold
-% params.min_dist
-
-function ld = computeSurfaceNormals_sound(ld)
-
-	params.max_points=10; 
-	params.threshold=2;
-	params.min_dist = 0.24;
-	params.curv = 0;
-	params.sigma = 0.01;
-	
-curv = params.curv;
-var = params.sigma ^ 2;
-MAX = params.max_points;
-MIN_DIST = params.min_dist;
-THRESHOLD = params.threshold;
-
-n = size(ld.points,2);
-
-for i=1:n
-
-
-	if i==1 
-		min_dist = norm(ld.points(:,i)-ld.points(:,i+1));
-	else
-		if i==n
-			min_dist = norm(ld.points(:,i)-ld.points(:,i-1));
-		else
-			min_dist = min( norm(ld.points(:,i)-ld.points(:,i-1)), ...
-								 norm(ld.points(:,i)-ld.points(:,i+1)));
-		end
-	end
-	
-	min_dist = max(min_dist,MIN_DIST);
-	
-	imax=i;
-	% vediamo quanto allungare
-	for j=min(i+1,n):min(i+MAX,n)
-		d = norm( ld.points(:,j)- ld.points(:,j-1) );
-		if d > THRESHOLD * min_dist
-			break;
-		end
-		imax = j;
-	end
-	
-	imin=i;
-	for j=max(1,i-1):-1:max(1,i-MAX)
-		d = norm( ld.points(:,j)- ld.points(:,j+1) );
-		if d > THRESHOLD * min_dist
-			break;
-		end
-		imin=j;
-	end
-	
-%	imin = max(1, i-3);
-%	imax = min(n, i+3);
-	
-	ni=imax-imin+1;
-
-	if ni>2 
-		indexes=[imin:i-1 i+1:imax];
-		
-		t = ld.theta(indexes);
-		f = ld.readings(indexes);
-		fvar = ones(1,ni) * var;
-		fd_guess = zeros(1,ni);
-		
-		t0 = ld.theta(i);
-		f0 = ld.readings(i);
-		fvar0 = var;
-		fd_guess0 = 0;
-		
-		curvf = 0;
-		
-		[fd0,fd0_var] = estimate_derivative_single( ...
-			t,f,fvar,fd_guess, ...
-			t0,f0,fvar0,fd_guess0,curvf);
-
-		alpha = t0 - atan(fd0/f0);
-		curvf = curv *(abs(f0 * tan(t0-alpha))^2);
-				
-		[fd0,fd0_var] = estimate_derivative_single( ...
-			t,f,fvar,fd_guess, ...
-			t0,f0,fvar0,fd_guess0,curvf);
-
-		
-		theta = t0;
-		
-		%q = fd0 / f0;
-		%alpha = atan(  (cos(theta)+q*sin(theta)) / (-sin(theta)+q*cos(theta)) );
-		
-		alpha = theta - atan(fd0/f0);
-		alpha_var =  fd0_var * (( f0 / (f0.^2 + fd0.^2) ).^2) ...
-		            + var *  (( fd0 / (f0.^2 + fd0.^2) ).^2) ;
-		
-		ld.alpha(i) =  alpha-pi; % rivolta verso dentro
-		ld.alpha_valid(i) = 1;
-		ld.alpha_error(i) = alpha_var;
-		
-		
-		indexes=[imin:imax];
-		[ld.ar_alpha(i), ld.ar_alpha_error(i)] = ...
-			arras_fit( ld.theta(indexes), ld.readings(indexes), var);
-	else
-		ld.alpha(i) = nan;
-		ld.alpha_valid(i) = 0;
-		ld.alpha_error(i) = nan;
-	end
-	
-end
-
diff --git a/misc/matlab/orientation/estimate_derivative.m b/misc/matlab/orientation/estimate_derivative.m
deleted file mode 100644
index 1f5d147a4e8c0bc7c97bef0fa8c88738f56ff5ef..0000000000000000000000000000000000000000
--- a/misc/matlab/orientation/estimate_derivative.m
+++ /dev/null
@@ -1,66 +0,0 @@
-function [f1_guess, f1_var] = estimate_derivative(t, f0, f0cov, curv, f1guess, interval)
-
-left=interval; right=interval;
-
-N = size(f0,2);
-% for each point
-for k=1:N
-	start = max(k-left,1);
-	stop   = min(k+right,N);
-	
-	% number of observations
-	n = stop-start+1 -1;
-	% 2*n+1 noises
-	R = zeros(n,2*n+1);
-	Z = zeros(2*n+1,2*n+1);
-	Y = zeros(n,1);
-	L = zeros(n,1);
-	
-	index=1;
-	for i=start:1:stop
-		if i==k
-			continue
-		end
-		
-		d = t(k)-t(i);
-		
-		% stima derivata seconda
-		f2 = (f1guess(k)-f1guess(i)) / d; 
-		Y(index, 1) = (f0(k)-f0(i)) / d + d.^2 * f2 / 2;
-		L(index, 1) = 1;
-		
-		% rumore con i-esimo
-		R(index, index) = 1 / d;
-		Z(index, index) = f0cov(i);
-		% rumore con me
-		R(index, 2*n +1 ) = 1 / d;
-		% rumore con curvatura
-		R(index, index+n) = d.^2 / 2;
-		Z(index+n, index+n) = curv;
-		index = index +1;
-	end
-	
-	Z(2*n+1,2*n+1) = f0cov(k);
-
-	% rumore 
-	qR = R*Z*R';
-	iR = inv(qR);
-
-	f1_guess(k)  = inv(L' * iR * L) * L' * iR * Y;
-	f1_var(k) = inv(L' * iR * L);
-	
-	if k == 2
-		n
-		L
-		Z
-		Y
-		R
-		qR
-		f1_var(k)
-		f1_guess(k)
-		iR
-		f0(start:stop)
-	end
-end
-
-
diff --git a/misc/matlab/orientation/estimate_derivative_single.m b/misc/matlab/orientation/estimate_derivative_single.m
deleted file mode 100644
index 1e7d9eb283be8ccded13a5852d30134545d64ff9..0000000000000000000000000000000000000000
--- a/misc/matlab/orientation/estimate_derivative_single.m
+++ /dev/null
@@ -1,37 +0,0 @@
-function [fd0,fd0_var] = estimate_derivative_single(t,f,fvar,fd_guess, t0,f0,fvar0,fd_guess0,curv)
-	% number of observations
-	n = size(t,2);
-	% 2*n+1 noises
-	R = zeros(n,2*n+1);
-	Z = zeros(2*n+1,2*n+1);
-	Y = zeros(n,1);
-	L = zeros(n,1);
-	
-	for i=1:n
-		
-		d = t0-t(i);
-		
-		% stima derivata seconda
-		f2 = (fd_guess0-fd_guess(i)) / d; 
-		Y(i, 1) = (f0-f(i)) / d + d.^2 * f2 / 2;
-		L(i, 1) = 1;
-		
-		% rumore con i-esimo
-		R(i, i) = 1 / d;
-		Z(i, i) = fvar(i);
-		% rumore con me
-		R(i, 2*n +1 ) = 1 / d;
-		% rumore con curvatura
-		R(i, i+n) = d.^2 / 2;
-		Z(i+n, i+n) = curv;
-	end
-	
-	Z(2*n+1,2*n+1) = fvar0;
-
-	% rumore 
-	qR = R*Z*R';
-	iR = inv(qR);
-
-	fd0  = inv(L' * iR * L) * L' * iR * Y;
-	fd0_var = inv(L' * iR * L);
-	
diff --git a/misc/matlab/orientation/ld_compute_orientation.m b/misc/matlab/orientation/ld_compute_orientation.m
deleted file mode 100644
index dba76289cd59d9f3326ecf901d286d30a6974828..0000000000000000000000000000000000000000
--- a/misc/matlab/orientation/ld_compute_orientation.m
+++ /dev/null
@@ -1,131 +0,0 @@
-% params.sigma
-% params.curv 
-% params.max_points
-% params.threshold
-% params.min_dist
-
-function ld = ld_compute_orientation(ld)
-
-	params.max_points=10; 
-	params.threshold=2;
-	params.min_dist = 0.24;
-	params.curv = 0;
-	params.sigma = 0.01;
-	
-curv = params.curv;
-var = params.sigma ^ 2;
-MAX = params.max_points;
-MIN_DIST = params.min_dist;
-THRESHOLD = params.threshold;
-
-ld.points = [ cos(ld.theta') .* ld.readings'; sin(ld.theta').* ld.readings'];
-n = size(ld.points,2);
-
-for i=1:n
-    if ld.valid(i) == 0
-        ld.alpha(i) = nan;
-		ld.alpha_valid(i) = 0;
-		ld.alpha_error(i) = nan;
-	    continue;
-    end
-
-	if i==1 
-		min_dist = norm(ld.points(:,i)-ld.points(:,i+1));
-	else
-		if i==n
-			min_dist = norm(ld.points(:,i)-ld.points(:,i-1));
-		else
-			min_dist = min( norm(ld.points(:,i)-ld.points(:,i-1)), ...
-				 norm(ld.points(:,i)-ld.points(:,i+1)));
-		end
-	end
-	
-	min_dist = max(min_dist,MIN_DIST);
-	
-	imax=i;
-	% vediamo quanto allungare
-	for j=min(i+1,n):min(i+MAX,n)
-		d = norm( ld.points(:,j)- ld.points(:,j-1) );
-		if d > THRESHOLD * min_dist
-			break;
-		end
-		imax = j;
-	end
-	
-	imin=i;
-	for j=max(1,i-1):-1:max(1,i-MAX)
-	
-		d = norm( ld.points(:,j)- ld.points(:,j+1) );
-		if d > THRESHOLD * min_dist
-			break;
-		end
-		imin=j;
-	end
-	
-	
-	ni=imax-imin+1;
-
-	if ni>2 
-		indexes=[imin:i-1 i+1:imax];
-		
-		t = ld.theta(indexes);
-		f = ld.readings(indexes);
-		fvar = ones(1,ni) * var;
-		fd_guess = zeros(1,ni);
-		
-		t0 = ld.theta(i);
-		f0 = ld.readings(i);
-		fvar0 = var;
-		fd_guess0 = 0;
-		
-		curvf = 0;
-		
-		[fd0,fd0_var] = estimate_derivative_single( ...
-			t,f,fvar,fd_guess, ...
-			t0,f0,fvar0,fd_guess0,curvf);
-
-		alpha = t0 - atan(fd0/f0);
-		curvf = curv *(abs(f0 * tan(t0-alpha))^2);
-				
-		[fd0,fd0_var] = estimate_derivative_single( ...
-			t,f,fvar,fd_guess, ...
-			t0,f0,fvar0,fd_guess0,curvf);
-
-		
-		theta = t0;
-		
-		%q = fd0 / f0;
-		%alpha = atan(  (cos(theta)+q*sin(theta)) / (-sin(theta)+q*cos(theta)) );
-		
-		alpha = theta - atan(fd0/f0);
-		alpha_var =  fd0_var * (( f0 / (f0.^2 + fd0.^2) ).^2) ...
-		            + var *  (( fd0 / (f0.^2 + fd0.^2) ).^2) ;
-		
-		if isnan(alpha)
-		    fprintf('bug here... \n')
-		    pause
-		end
-		
-		ld.alpha(i) =  alpha-pi; % rivolta verso dentro
-		ld.alpha_valid(i) = 1;
-		ld.alpha_error(i) = alpha_var;
-		
-		
-		indexes=[imin:imax];
-		[ld.ar_alpha(i), ld.ar_alpha_error(i)] = ...
-			arras_fit( ld.theta(indexes), ld.readings(indexes), var);
-	else
-		ld.alpha(i) = nan;
-		ld.alpha_valid(i) = 0;
-		ld.alpha_error(i) = nan;
-	end
-	
-end
-
-ld.alpha = ld.alpha';
-ld.alpha_valid = ld.alpha_valid';
-ld.alpha_error = ld.alpha_error';
-ld.ar_alpha = ld.ar_alpha';
-ld.ar_alpha_error = ld.ar_alpha_error';
-
-
diff --git a/misc/matlab/orientation/ld_quality_of_orientation.m b/misc/matlab/orientation/ld_quality_of_orientation.m
deleted file mode 100644
index 57ecf2ed4b9649a479976f74eea693d797101d0b..0000000000000000000000000000000000000000
--- a/misc/matlab/orientation/ld_quality_of_orientation.m
+++ /dev/null
@@ -1,20 +0,0 @@
-function ld_quality_of_orientation(ld)
-
-	e = rad2deg(normAngle(ld.alpha-ld.true_alpha));
-	
-	for i=1:size(e,2)
-		if abs(e(1)) > 10
-			e(i) = 0;
-		end
-	end
-	
-	fprintf('Bias: %f deg \n', mean(e));
-	fprintf('Deviation: %f deg \n', sqrt(var(e)));
-	
-	
-	fprintf('Mean error: %f deg \n', rad2deg(sqrt(max(ld.alpha_error))));
-	
-	
-	figure
-	plot(e,'r.')
-	title('errors (degree)');
diff --git a/misc/matlab/orientation/regression.m b/misc/matlab/orientation/regression.m
deleted file mode 100644
index 0ada1a72ac6058ca552545357da75b8d8a9dc108..0000000000000000000000000000000000000000
--- a/misc/matlab/orientation/regression.m
+++ /dev/null
@@ -1,35 +0,0 @@
-
-function [theta, rho, sumOfSqError] = regression(points)
-
-	n = size(points,2);
-	if n<2
-		error('I need at least 2 points');
-	end
-	
-	mu = mean(points,2);
-	
-	s_x2 = 0;
-	s_y2 = 0;
-	s_xy = 0;
-	
-	for i=1:n
-		s_x2 = s_x2 + (points(1,i)-mu(1))*(points(1,i)-mu(1));
-		s_y2 = s_y2 + (points(2,i)-mu(2))*(points(2,i)-mu(2));
-		s_xy = s_xy + (points(1,i)-mu(1))*(points(2,i)-mu(2));
-	end
-	
-	theta = 0.5 * atan2(-2*s_xy, s_y2-s_x2);
-	rho = mu(1) * cos(theta) + mu(2) * sin(theta);
-
-	if rho>0
-		rho = - rho;
-		theta = theta + pi;
-	end
-	
-	% compute error
-	sumOfSqError = 0;
-	for i=1:n
-		% distance to line
-		dist = rho - (cos(theta) * points(1,i) + sin(theta) * points(2,i));
-		sumOfSqError = sumOfSqError + dist*dist; 
-	end
diff --git a/misc/matlab/orientation/test_deriv.m b/misc/matlab/orientation/test_deriv.m
deleted file mode 100644
index d16a69967d66ad71c47aa6f993007e3133ddcd46..0000000000000000000000000000000000000000
--- a/misc/matlab/orientation/test_deriv.m
+++ /dev/null
@@ -1,96 +0,0 @@
-function test_deriv
-
-% punti casuali
-pt=[-1 -0.3 0 0.1  0.3 1];
-rand('seed',8);
-st=cos(15.32*pt);
-%rand(1, size(pt,2))*4;
-
-% polinomio casuale
-P = polyfit(pt,st, min(3,size(pt,2)-1) );
-Pd = polyder(P);
-Pdd = polyder(Pd);
-
-t=-1:0.01:1;
-f0=polyval(P,t);
-fd=polyval(Pd,t);
-f2=polyval(Pdd,t);
-
-if true
-	vu = 7;
-	
-	f0 = sin(vu*t) + 0 * sin(vu*10*t)*0.1;
-	fd = vu * cos(vu*t)+ 0 * cos(vu*10*t);
-	f2 = - vu * vu * sin(vu*t);
-end
-
-if false
-	W = 100;
-	[f0,fd,f2] = randf2(t, W);
-end
-if false
-	f0 =  zeros(1,size(t,2));
-	fd =  zeros(1,size(t,2));
-	f2 =  zeros(1,size(t,2));
-end
-
-if false
-	f0 = t; % zeros(1,size(t,2));
-	fd = 1 * ones(1,size(t,2));
-	f2 = zeros(1,size(t,2));
-end
-
-curv= sum(f2.*f2) / size(f2,2);
-
-curv=0;
-sigma=0.1; 
-randn('seed',4);
-y= f0 + sigma*randn(1,size(t,2));
-
-f0cov = ones(1,size(t,2)) * sigma*sigma;
-myf1guess = zeros(1,size(t,2));
-interval = 4;
-[est_fd, est_var] = estimate_derivative(t, y, f0cov, curv, myf1guess, interval);
-[est_fd2, est_var2] = estimate_derivative(t, y, f0cov, curv, est_fd, interval);
-
-
-% percentuale entro 95%
-white = (est_fd-fd) ./ sqrt(est_var);
-
-fprintf('Curv: %f\n',curv);
-
-for p=1:3
-	perc = sum( abs(white) < p ) / size(white,2);
-	fprintf('Perc: %d %f\n',p,perc);
-end
-
-
-fprintf('mean sigma= %f \n',mean(sqrt(est_var)));
-
-% errore
-
-fprintf('errore quadr. medio 1: %f \n', norm(est_fd-fd));
-fprintf('errore quadr. medio 2: %f \n', norm(est_fd2-fd));
-
-
-f=figure;
-subplot(3,1,1);
-hold on;
-plot(t,f0,'r.');
-plot(t,y,'bd');
-
-subplot(3,1,2);
-hold on;
-U = sqrt(est_var)*3;
-%plot(t,est_fd,'kd');
-errorbar(t,est_fd,U,U,'k');
-plot(t,fd,'g.');
-%plot(t,est_fd2,'b.');
-
-subplot(3,1,3);
-plot(t, white);
-
-%plot(t,f2,'b.');
-hold off;
-
-%legend('poli', 'deriv', 'misure', 'stima deriv');
diff --git a/misc/matlab/orientation/test_est_deriv_log.m b/misc/matlab/orientation/test_est_deriv_log.m
deleted file mode 100644
index 9ecebfd6f56336ff600cfea7b9229329c4d8665f..0000000000000000000000000000000000000000
--- a/misc/matlab/orientation/test_est_deriv_log.m
+++ /dev/null
@@ -1,84 +0,0 @@
-function sd = test_est_deriv_log(k)
-
-sigma=0.02;
-
-if true
-	S=load('logs/bighouse_half.mat');
-	log = S.log_bighouse_half;
-	sd = log{k}
-	sd.readings = sd.readings + sigma * randn(1,sd.nrays);
-	sd.points = [sd.readings .* cos(sd.theta);  sd.readings .* sin(sd.theta)]; 
-end
-
-
-
-%sd = straight(150, pi*0.5, 5, sigma);
-sd = circ(150, pi*0.9, 5, sigma);
-
-
-var = sigma^2;
-curv = 10;
-maxDist = 0.15;
-
-
-sd = computeSurfaceNormals_sound(sd, var, curv, maxDist);
-
-f = figure;
-params.plotNormals = true;
-plotLaserData(sd,params);
-axis('equal');
-
-f = figure;
-subplot(3,1,1);
-hold on
-U = 3*rad2deg(sqrt(sd.alpha_error));
-errorbar(rad2deg(sd.theta),rad2deg(sd.alpha),U,U,'k.');
-plot(rad2deg(sd.theta),rad2deg(sd.ar_alpha),'g.');
-
-subplot(3,1,2);
-
-plot(rad2deg(sd.theta),U/3);
-
-subplot(3,1,3);
-
-plot(rad2deg(sd.theta),rad2deg(sd.alpha-sd.true_alpha)./U);
-
-indexes=10:140;
-writeStats(sd.alpha(indexes),sd.true_alpha(indexes),sd.alpha_error(indexes));
-
-function writeStats(x,tr,var) 
-	% percentuale entro 95%
-	white = (x-tr) ./ sqrt(var);
-	for p=1:3
-		perc = sum( abs(white) < p ) / size(white,2);
-		fprintf('Perc: %d %f\n',p,perc);
-	end
-	
-
-
-
-
-function ld=straight(nrays,fov, dist, sigma)
-
-	ld.nrays=nrays;
-
-	for i=1:nrays
-		ld.theta(i) = -fov/2 + fov * i / nrays;
-		ld.readings(i) = dist / cos(ld.theta(i));
-		ld.readings(i) = ld.readings(i) + sigma * randn(1,1);
-		ld.points(:,i) = [cos(ld.theta(i)) sin(ld.theta(i))]' * ld.readings(i);
-		ld.true_alpha(i) = 0; 
-	end
-
-function ld=circ(nrays,fov, dist, sigma)
-
-	ld.nrays=nrays;
-
-	for i=1:nrays
-		ld.theta(i) = -fov/2 + fov * i / nrays;
-		ld.readings(i) = dist;
-		ld.readings(i) = ld.readings(i) + sigma * randn(1,1);
-		ld.points(:,i) = [cos(ld.theta(i)) sin(ld.theta(i))]' * ld.readings(i);
-		ld.true_alpha(i) = ld.theta(i); 
-	end
-
diff --git a/misc/matlab/point-to-line/deg2rad.m b/misc/matlab/point-to-line/deg2rad.m
deleted file mode 100644
index e71b27996497ebb51a566334d202e67e5246ebb1..0000000000000000000000000000000000000000
--- a/misc/matlab/point-to-line/deg2rad.m
+++ /dev/null
@@ -1,2 +0,0 @@
-function r = deg2rad(d)
-	r = pi * d / 180;
diff --git a/misc/matlab/point-to-line/general_minimization.m b/misc/matlab/point-to-line/general_minimization.m
deleted file mode 100644
index eb947c2019a3d304734b13020fb3a5a6ba3f857a..0000000000000000000000000000000000000000
--- a/misc/matlab/point-to-line/general_minimization.m
+++ /dev/null
@@ -1,88 +0,0 @@
-
-function res = general_minimization(corr)
-	% Input is:
-	%   corr{k}.C
-	%   corr{k}.p
-	%   corr{k}.q
-	
-
-	%% First we put the problem in a quadratic+constraint form.
-	M = zeros(4,4);
-	g = zeros(4,1);
-	
-	for k=1:size(corr,2)
-		M_k = [eye(2) [corr{k}.p (rot(pi/2)*corr{k}.p)]];
-		M = M + M_k'* corr{k}.C *M_k;
-		g = g + (- 2 * corr{k}.q' * corr{k}.C * M_k)';
-	end
-	
-	W = [ zeros(2,2) zeros(2,2); zeros(2,2) eye(2)];
-	
-	%% This is the function that we want to minimize 
-	h = @(l) g' * inv(M+2*l*W) * W * inv(M+2*l*W)' * g - 1;
-	
-	%% Partition M in 4 submatrixes:
-	
-	M = 2*M;
-	% M = [A B; C D]
-	A = M(1:2,1:2)
-	B = M(1:2,3:4)
-	D = M(3:4,3:4)
-	
-	S = D - B' * inv(A) * B;
-	Sa = inv(S) * det(S);
-		
-	g1 = g(1:2); g2=g(3:4);
-
-   p7 = [( g1'*(inv(A)*B*  4    *B'*inv(A))*g1 + 2*g1'*(-inv(A)*B*  4   )*g2  + g2'*( 4   )*g2) ...
-	      ( g1'*(inv(A)*B*  4*Sa *B'*inv(A))*g1 + 2*g1'*(-inv(A)*B*  4*Sa)*g2  + g2'*( 4*Sa)*g2) ...
-			( g1'*(inv(A)*B* Sa*Sa *B'*inv(A))*g1 + 2*g1'*(-inv(A)*B* Sa*Sa)*g2  + g2'*(Sa*Sa)*g2)];
-			
-	p_lambda = [4 (2*S(1,1)+2*S(2,2)) (S(1,1)*S(2,2)-S(2,1)*S(1,2))];
-	Ptot = polyadd(p7, -conv(p_lambda,p_lambda)) ;
-
-	% Find largest real root of Ptot
-	r = roots(Ptot);
-	lambda = 0;
-	for i=1:4
-		if isreal(r(i)) & (r(i)>0)
-			lambda = max(lambda, r(i));
-		end
-	end
-	
-	x = -inv(M + 2 * lambda * W) * g;
-	theta = atan2(x(4),x(3));
-	
-	
-	res.x = [x(1); x(2); theta]
-	
-	
-	
-	
-%	Q = @(l) (S+2*l*eye(2))
-%	h2 = @(l) g' * [ inv(A)*B*inv(Q(l))*inv(Q(l))*B'*inv(A)'  -inv(A)*B*inv(Q(l))*inv(Q(l)); ...
-%	(-inv(A)*B*inv(Q(l))*inv(Q(l)))' inv(Q(l))*inv(Q(l))] * g - 1;
-	
-	
-%	h8 = @(l) polyval(p7,l)- polyval(p_lambda,l)^2;
-		
-	%QQ = @(l) (Sa*Sa+4*(l^2)*eye(2)+4*l*Sa) / ( polyval(p_lambda,l)^2)
-	
-	
-	%h3 = @(l) g' * [ inv(A)*B*QQ(l)*B'*inv(A)'  -inv(A)*B*QQ(l); ...
-	 %              (-inv(A)*B*QQ(l))' QQ(l)] * g - 1;
-	
-%	h4 = @(l) g1'* inv(A)*B*QQ(l)*B'*inv(A)'*g1 + g1'*-inv(A)*B*QQ(l)*g2 +  ...
-%	               g2' * (-inv(A)*B*QQ(l))'*g1 +g2'*QQ(l)*g2 - 1;
-
-%	h5 = @(l) g1'* inv(A)*B*(Sa*Sa+4*(l^2)*eye(2)+4*l*Sa)*B'*inv(A)'*g1 + g1'*-inv(A)*B*(Sa*Sa+4*(l^2)*eye(2)+4*l*Sa)*g2 +  ...
-%	               g2' * (-inv(A)*B*(Sa*Sa+4*(l^2)*eye(2)+4*l*Sa))'*g1 +g2'*(Sa*Sa+4*(l^2)*eye(2)+4*l*Sa)*g2 - polyval(p_lambda,l)^2;
-
-%	h6 = @(l) g1'* inv(A)*B*(Sa*Sa+4*(l^2)*eye(2)+4*l*Sa)*B'*inv(A)*g1 ...
-%	          + 2*g1'*-inv(A)*B*(Sa*Sa+4*(l^2)*eye(2)+4*l*Sa)*g2 +  ...
-%	             +g2'*(Sa*Sa+4*(l^2)*eye(2)+4*l*Sa)*g2 - polyval(p_lambda,l)^2;
-	
-%	h7 = @(l) (l^2) * ( g1'*(inv(A)*B*  4    *B'*inv(A))*g1 + 2*g1'*(-inv(A)*B*  4   )*g2  + g2'*( 4   )*g2) + ...
-%	          (l)   * ( g1'*(inv(A)*B*  4*Sa *B'*inv(A))*g1 + 2*g1'*(-inv(A)*B*  4*Sa)*g2  + g2'*( 4*Sa)*g2) + ...
-%	                  ( g1'*(inv(A)*B* Sa*Sa *B'*inv(A))*g1 + 2*g1'*(-inv(A)*B* Sa*Sa)*g2  + g2'*(Sa*Sa)*g2) - polyval(p_lambda,l)^2;
-
diff --git a/misc/matlab/point-to-line/gm_test.m b/misc/matlab/point-to-line/gm_test.m
deleted file mode 100644
index 705698dc049eca4a83800753f726be77e773a59f..0000000000000000000000000000000000000000
--- a/misc/matlab/point-to-line/gm_test.m
+++ /dev/null
@@ -1,19 +0,0 @@
-theta = deg2rad(4);
-t = [0.3; -0.2];
-
-p = [1 0; 0 1; -1 0; 2 1; 4 2]';
-alpha = [deg2rad(0);deg2rad(10);deg2rad(20);deg2rad(50);deg2rad(-20);];
-
-noise = 0
-for i=1:size(p,2)
-	corr{i}.p = p(:,i);
-	corr{i}.q = (rot(theta)*p(:,i)+t) + randn(2,1)*noise;
-	corr{i}.C = vers(alpha(i))*vers(alpha(i))';
-%	corr{i}.C = eye(2);
-end
-
-res = general_minimization(corr);
-
-res.x
-
-
diff --git a/misc/matlab/point-to-line/icp2.m b/misc/matlab/point-to-line/icp2.m
deleted file mode 100644
index 1a6bc6da114e070ed280cc697dc91ead60c04e8d..0000000000000000000000000000000000000000
--- a/misc/matlab/point-to-line/icp2.m
+++ /dev/null
@@ -1,213 +0,0 @@
-% Dependences of this script:
-% Requires: params_required, params_set_default, icp_get_correspondences
-% Requires: ld_plot, icp_covariance, exact_minimization, transform
-% Requires: icp_possible_interval
-
-function res = icp2(params)
-% Note: it is assumed that params.laser_ref has a radial uniform scan 
-% params.laser_ref                - first scan
-% params.laser_sens               - second scan
-% params.maxAngularCorrectionDeg  - search space bound for phi, in degrees
-% params.maxLinearCorrection      - search space bound for |t|, in degrees
-	
-	
-	params_required(params, 'laser_sens');
-	params_required(params, 'laser_ref');
-	params = params_set_default(params, 'maxAngularCorrectionDeg', 105);
-	params = params_set_default(params, 'maxCorrespondenceDist', 4);
-	params = params_set_default(params, 'maxLinearCorrection',    2);
-	params = params_set_default(params, 'maxIterations',           40);
-	params = params_set_default(params, 'firstGuess',         [0;0;0]);
-	params = params_set_default(params, 'interactive',  false);
-	params = params_set_default(params, 'epsilon_xy',  0.0001);
-	params = params_set_default(params, 'epsilon_theta',  deg2rad(0.001));
-	params = params_set_default(params, 'sigma',  0.01);
-	params = params_set_default(params, 'do_covariance', false);
-
-	%% If true, consider as null correspondences with first or last point
-	%% in the reference scan.
-	params = params_set_default(params, 'dont_consider_extrema', true);
-	
-	%params.laser_ref = computeSurfaceNormals(params.laser_ref);
-
-	current_estimate = params.firstGuess;
-	params.laser_sens.estimate = current_estimate;
-	
-	if params.interactive
-		f = figure; hold on
-	end
-
-	
-	estimated_cov = eye(3);	
-	
-	for n=1:params.maxIterations
-		estimates{n} = current_estimate;
-		
-		%% If in interactive mode, show partial solution.
-		if params.interactive
-			clf
-			pl.color = 'b.';
-			ld_plot(params.laser_ref,pl);
-			pl.color = 'r.';
-			params.laser_sens.estimate = ...
-				rtcat(params.laser_ref.estimate, current_estimate);
-			ld_plot(params.laser_sens,pl);
-			axis('equal');
-		
-		
-			%for i=find(valids)
-	
-	%			plotVectors(params.laser_sens.estimate, [params.laser_sens.points(:,i) P(:,i)] , 'k');
-	
-			%end
-		end
-	
-
-		[P, valids, jindexes] = icp_get_correspondences(params, current_estimate);
-		
-		fprintf('Valid corr.: %d\n', sum(valids));
-		next_estimate = next_estimate(params, current_estimate, P, valids, jindexes);
-
-		delta = next_estimate-current_estimate;
-	
-		
-		current_estimate = next_estimate;
-		
-		fprintf('Delta: %s\n', pv(delta));
-		fprintf('Estimate: %s\n', pv(current_estimate));
-		
-		if (norm(delta(1:2)) < params.epsilon_xy) & ...
-			(norm(delta(3))   < params.epsilon_theta) 
-			
-			break;
-		end
-		
-		if params.interactive
-			pause
-		end
-		
-		pause(0.01)
-	end % iterations
-fprintf('Converged at iteration %d.\n', n);
-
-	res = params;
-	
-	if(params.do_covariance)		
-		estimated_cov = icp_covariance(params, current_estimate, P, valids, jindexes);	
-		res.sm_cov_bengtsson = estimated_cov.sm_cov_bengtsson;
-		res.loc_cov_censi = estimated_cov.loc_cov_censi;
-		res.sm_cov_censi = estimated_cov.sm_cov_censi;
-	end
-	
-	
-	res.X = current_estimate;
-	res.iteration = n;
-	estimates{n+1} = current_estimate;
-	res.estimates = estimates;
-	
-	
-function next = next_estimate(params, current_estimate, P, valids, jindexes)
-% Requires: transform
-	if sum(valids) < 2
-		error('icp:run', sprintf('Only %d correspondences found.',sum(valids)));
-	end
-
-	next = current_estimate;
-
-	corr={};
-	k=0; e = 0;
-	for i=find(valids)
-		k=k+1;
-		p_k = transform(params.laser_sens.points(:,i), current_estimate);
-		q_k = P(:,i);
-		
-		j1 = jindexes(i,1);
-		j2 = jindexes(i,2);
-
-		p_j1 = params.laser_ref.points(:,j1);
-		p_j2 = params.laser_ref.points(:,j2);
-		
-		v_alpha = rot(pi/2) * (p_j1-p_j2);
-		v_alpha = v_alpha / norm(v_alpha);
-		
-		corr{k}.p = p_k;
-		corr{k}.q = q_k;
-		corr{k}.C = v_alpha * v_alpha';
-	%% For point-to-point:
-	%	corr{k}.C = eye(2);
-		
-		 
-			
-		if params.interactive
-			a = transform(params.laser_sens.points(:,i), ...
-				rtcat(params.laser_ref.estimate, current_estimate));
-			b = transform(q_k, ...
-					params.laser_ref.estimate);
-		
-			plot_line(a,b,'g-');
-		end
-		
-		e = e + norm(p_k-q_k);
-	end
-
-	
-	res = general_minimization(corr);
-	pose = res.x;
-
-	fprintf('exact min. (p2l): %s \n', pv(pose));
-	
-	if true
-		npos = 0; nneg = 0;
-		k2 = 0; corr2={};
-		k3 = 0; corr3={};
-		
-		for k=1:size(corr,2)
-			theta = pose(3); t =pose(1:2);
-			grad = (rot(theta)*corr{k}.p + t - corr{k}.q)' * ...
-			corr{k}.C * [eye(2) (rot(theta+pi/2) * corr{k}.p)];
-			
-			if grad * pose < 0
-				k2 = k2 +1;
-				corr2{k2} = corr{k};
-				nneg = nneg + 1;
-			else
-				k3 = k3 +1;
-				corr3{k3} = corr{k};
-				npos = npos + 1;
-				if params.interactive
-					a = transform(corr{k}.p, params.laser_ref.estimate);
-					b = transform(corr{k}.q, params.laser_ref.estimate);
-					plot_line(a,b,'k-');
-				end
-			end
-		end
-
-		fprintf('pos: %d neg: %d\n', npos, nneg);	
-		threshold = 0.1;
-		if npos < threshold * nneg
-			fprintf('Doing the trick!\n')
-			res = general_minimization(corr2);
-			pose = res.x;
-			fprintf('exact min. after trick (p2l): %s \n', pv(pose));
-		end
-		if nneg < threshold * npos
-			fprintf('Doing the trick! (other) \n')
-			res = general_minimization(corr3);
-			pose = res.x;
-			fprintf('exact min. after trick (p2l): %s \n', pv(pose));		
-		end
-		if npos > nneg
-			fprintf('Finished trick!\n')
-		end
-	end
-	
-	next_phi = current_estimate(3) + pose(3);
-	next_t  = transform(current_estimate(1:2,1), pose);
-	next = [next_t; next_phi];
-	
-	fprintf('Pose: %s  error: %f\n', pv(next), e);
-	
-function plot_line(a,b,color)
-	plot([a(1) b(1)],[a(2) b(2)], color);
-
-
diff --git a/misc/matlab/point-to-line/polyadd.m b/misc/matlab/point-to-line/polyadd.m
deleted file mode 100644
index 1233d9fca303431e8b1b51efca0f10ce04390589..0000000000000000000000000000000000000000
--- a/misc/matlab/point-to-line/polyadd.m
+++ /dev/null
@@ -1,16 +0,0 @@
-function[poly]=polyadd(poly1,poly2)
-%Copyright 1996 Justin Shriver
-%polyadd(poly1,poly2) adds two polynominals possibly of uneven length
-if length(poly1)<length(poly2)
-  short=poly1;
-  long=poly2;
-else
-  short=poly2;
-  long=poly1;
-end
-mz=length(long)-length(short);
-if mz>0
-  poly=[zeros(1,mz),short]+long;
-else
-  poly=long+short;
-end
diff --git a/misc/matlab/point-to-line/rad2deg.m b/misc/matlab/point-to-line/rad2deg.m
deleted file mode 100644
index 1195b0f05111c122dfadac3bd552dc99b5959a4a..0000000000000000000000000000000000000000
--- a/misc/matlab/point-to-line/rad2deg.m
+++ /dev/null
@@ -1,2 +0,0 @@
-function r = rad2deg(d)
-	r = d * 180 /  pi;
diff --git a/misc/matlab/point-to-line/rot.m b/misc/matlab/point-to-line/rot.m
deleted file mode 100644
index 06ea72f6f83e9aebc64a7c35ebaae29b9dea8465..0000000000000000000000000000000000000000
--- a/misc/matlab/point-to-line/rot.m
+++ /dev/null
@@ -1,3 +0,0 @@
-function r=rot(theta) 
-% rot(theta) rotation matrix of order two
-	r = [cos(theta) -sin(theta); sin(theta) cos(theta)];
diff --git a/misc/matlab/point-to-line/test_icp2.m b/misc/matlab/point-to-line/test_icp2.m
deleted file mode 100644
index 716f80aca879e19484b68298d222a6712aef2bdc..0000000000000000000000000000000000000000
--- a/misc/matlab/point-to-line/test_icp2.m
+++ /dev/null
@@ -1,32 +0,0 @@
-% Requires: rtcat
-
-	%% First pose.
-	params.position = [-0.3;0.1;deg2rad(10)];
-	%% Step.
-	truth_cov = diag([0.35^2 0.35^2 deg2rad(17.5)^2]);
-	params.truth = sample_normal([0;0;0], truth_cov, 1);
-	%% Covariance of the first guess.
-	params.guess_cov = diag([0.35^2 0.35^2 deg2rad(7.5)^2]);
-	params.fov = 1.4*pi;
-	params.nrays = 180;
-	params.sigma = 0.01;
-	
-	%% Second pose.
-	params.position2 = rtcat(params.position, params.truth);
-
-	L = 5;
-	seglist = { 0.4*L*[-1.2 1; -1 -1]', L*[1.5 1; 1 -1]', ...
-			0.3*L*[1 -1.3; -1 -1]', L*[1.4 1; -1 1]'}
-	 
-	params.laser_ref  = ...
-		ray_tracing_polygon(seglist, params.position, 180, params.fov, inf);
-	params.laser_sens = ...
-		ray_tracing_polygon(seglist, params.position2, params.nrays, params.fov, inf);
-
-	params.interactive = false;
-	
-	params.laser_sens = ld_add_noise(params.laser_sens, params.sigma);
-	params.laser_ref = ld_add_noise(params.laser_ref, params.sigma);
-	
-	
-	res = icp2(params);	
diff --git a/misc/matlab/point-to-line/vers.m b/misc/matlab/point-to-line/vers.m
deleted file mode 100644
index 3c3c2fd9c35ef03d522d8e3ebc63f0850022b6c7..0000000000000000000000000000000000000000
--- a/misc/matlab/point-to-line/vers.m
+++ /dev/null
@@ -1,4 +0,0 @@
-function v = vers(theta)
-% returns 2d versor of direction theta
-        v = [cos(theta); sin(theta)];
-
diff --git a/misc/matlab/ray_tracing/countour_circle.m b/misc/matlab/ray_tracing/countour_circle.m
deleted file mode 100644
index 301c07c248e7cac5c02e41383fcec9a4ee28e0f9..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/countour_circle.m
+++ /dev/null
@@ -1,18 +0,0 @@
-function [p, alpha] = countour_circle(params, tau)
-	radius = params{1};
-	
-	if size(radius,2) == 2
-		x_radius = radius(1);
-		y_radius = radius(2);
-	else
-		x_radius = radius;
-		y_radius = radius;
-	end
-	
-	theta = 2 * pi * tau;
-	
-	p = [x_radius*cos(theta); y_radius*sin(theta)];
-
-	alpha = atan2(x_radius*sin(theta),y_radius*cos(theta));
-	
-
diff --git a/misc/matlab/ray_tracing/countour_flower.m b/misc/matlab/ray_tracing/countour_flower.m
deleted file mode 100644
index 45f8e0a5825e57dcadb8bd6921c2f514532167cf..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/countour_flower.m
+++ /dev/null
@@ -1,13 +0,0 @@
-function [p, alpha] = countour_flower(params, tau)
-	r1 = params{1};
-	r2 = params{2};
-	v  = params{3};
-	
-	theta = -pi + 2 * pi * tau;
-	rho = r1 + r2 * cos(theta*v);
-
-	p = rho * [cos(theta);sin(theta)];
-
-	alpha = nan;	
-	
-
diff --git a/misc/matlab/ray_tracing/countour_sine.m b/misc/matlab/ray_tracing/countour_sine.m
deleted file mode 100644
index 718011dbd2459095a9273950a87270129bc2c740..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/countour_sine.m
+++ /dev/null
@@ -1,24 +0,0 @@
-function [p, alpha] = countour_sine(params, tau)
-	% params = {rho, amplitude, periods_in_circle}
-
-	rho = params{1};
-	amplitude = params{2};
-	periods = params{3};
-	
-	theta = 2 * pi * tau;
-	
-	p = sine(theta,rho,amplitude, periods);
-	
-	epsilon = 0.001;
-	p1 = sine(theta-epsilon,rho,amplitude, periods);
-	p2 = sine(theta+epsilon,rho,amplitude, periods);
-	
-	v_alpha = rot(pi/2)*(p2-p1);
-	alpha = atan2(v_alpha(2),v_alpha(1));
-	
-
-function p = sine(theta, rho, amplitude, periods)
-	s = theta * rho;
-	dist = rho + amplitude * cos(s * periods/rho );
-	p = dist * [cos(theta);sin(theta)];
-
diff --git a/misc/matlab/ray_tracing/countour_straight.m b/misc/matlab/ray_tracing/countour_straight.m
deleted file mode 100644
index b9f16546c4f0ce04f93694028a39eed2897dd328..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/countour_straight.m
+++ /dev/null
@@ -1,45 +0,0 @@
-function [p, alpha] = countour_straight(params, tau)
-
-points = params{1};
-	K = size(points,2);
-
-	if K < 2
-		error('2 points needed');
-	end 	
-	
-	
-	if tau>1
-		while tau>1
-			tau = tau -1;
-		end
-	end
-	
-	if tau<0
-		while tau<0
-			tau = tau +1;
-		end
-	end
-	
-	if tau==0
-		p = points(:,1);
-		return
-	end
-	
-	if tau==1
-		p = points(:,K);
-		return;
-	end
-
-	
-	index = ceil(tau * (K-1));
-	
-	
-	index_tau = (index-1.0) / (K-1);
-	tau2 = (tau-index_tau) * (K-1);
-	
-	p1 = points(:,index);
-	p2 = points(:,index+1);
-	
-	p = p2 * tau2 + (1-tau2) * p1;
-	alpha = pi/2 + atan2( p1(2)-p2(2), p1(1)-p2(1));
-	
diff --git a/misc/matlab/ray_tracing/ld_circle.m b/misc/matlab/ray_tracing/ld_circle.m
deleted file mode 100644
index 8721e71ef92c54a062be467e2b9647896381d96c..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/ld_circle.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function ld = ld_circle(radius, pose, rays, fov)
-%   ld = ld_circle(radius, pose, rays, fov)
-%   Circle at (0,0)
-
-	ld = ray_tracing( pose, fov, rays, 'countour_circle', {radius},0.001);
-	
-
-
-
-
diff --git a/misc/matlab/ray_tracing/ld_oval.m b/misc/matlab/ray_tracing/ld_oval.m
deleted file mode 100644
index aaca1f50b44e1ddc80e6867c00e4c93e9b0ed684..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/ld_oval.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function ld = ld_circle(x_radius, y_radius, pose, rays, fov)
-%   ld = ld_circle(x_radius, y_radius, pose, rays, fov)
-%   Oval at (0,0)
-
-	ld = ray_tracing( pose, fov, rays, 'countour_circle', {[x_radius y_radius]},0.001);
-	
-
-
-
-
diff --git a/misc/matlab/ray_tracing/ld_sine.m b/misc/matlab/ray_tracing/ld_sine.m
deleted file mode 100644
index e63ddad795ba2c88f897c02628dd53d6da76229b..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/ld_sine.m
+++ /dev/null
@@ -1,9 +0,0 @@
-function ld = ld_sine(rho, amplitude, periods, pose, rays, fov)
-%   ld = ld_sine(rho, amplitude, periods, pose, rays, fov)
-
-	ld = ray_tracing( pose, fov, rays, 'countour_sine', {rho, amplitude, periods},0.00001);
-	
-
-
-
-
diff --git a/misc/matlab/ray_tracing/ld_square.m b/misc/matlab/ray_tracing/ld_square.m
deleted file mode 100644
index 0d197887211c087800c2f5e9e4daf891420f96e9..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/ld_square.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function ld = ld_square(L, pose, rays, fov)
-%   ld = ld_square(L, pose, rays, fov)
-%   L: length of square side
-
-	square = [-1 -1; 1 -1; 1 1; -1 1; -1 -1]' * L;
-
-	ld = ray_tracing( pose, fov, rays, 'countour_straight', {square},0.00001);
-	
-
-
-
-
diff --git a/misc/matlab/ray_tracing/ray_tracing.m b/misc/matlab/ray_tracing/ray_tracing.m
deleted file mode 100644
index deca81dba6de376ed2c40d7062e346345296d969..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/ray_tracing.m
+++ /dev/null
@@ -1,130 +0,0 @@
-function ld = ray_tracing(pose, fov, nrays, countour, countour_params, precision)
-
-	debug = true;
-	
-	t = pose(1:2);
-	ld.nrays = nrays;
-	for i=1:nrays
-		if(debug)
-			fprintf('@');
-			if 0 == mod(i,32)
-				fprintf(' %d \n', i);
-			end
-		end
-		
-		theta = -fov/2 + fov * (i-1)/(nrays-1);
-		ld.theta(i) = theta;
-		params = {t, pose(3)+ld.theta(i), countour, countour_params};
-			
-		% cerchiamo approssimativamente quello che gli si avvicina di pių
-		% e sarā il nostro a di partenza
-		delta_a = 0.05;
-		test_a = 0.001:delta_a:0.99;
-		
-		for j =1:size(test_a,2)
-		    test_a_theta(j) = feval('eval_delta', params, test_a(j));
-		end
-		
-		[Y,index] = min(abs(test_a_theta));
-		best_a = test_a(index(1));
-		best_a_val = test_a_theta(index(1));
-		
-		% una volta trovato a cerchiamo un b
-
-			good_b = best_a;
-			while true
-				good_b = good_b - sign(best_a_val)*delta_a;
-				val = feval('eval_delta', params, good_b);
-				if sign(val) * sign(best_a_val) < 0
-					break
-				end
-			end
-		
-		if best_a > good_b
-			a = good_b;
-			b = best_a;
-		else
-			b = good_b;
-			a = best_a;
-		end
-		
-		% do the rest with bisection
-		tau = rfBisection( 'eval_delta', params, a, b,precision);
-		[point, alpha] = feval(countour, countour_params, tau);
-		ld.readings(i) = norm(point-t);
-		%fprintf('i=%d theta=%d° reading=%f\n', i, rad2deg(ld.theta(i)), ld.readings(i));
-
-		if cos(alpha - (pose(3)+ld.theta(i)) ) > 0
-			alpha = alpha + pi;
-		end
-
-		ld.true_alpha(i) = alpha-pose(3); % local coordinates
-		ld.true_alpha_abs(i) = alpha; % local coordinates
-		
-		if rand>0.95
-			pause(0.02)
-		end
-	end
-	if debug
-		fprintf('\n');
-	end
-	
-	ld.odometry = pose;
-	ld.estimate = pose;
-	ld.timestamp1 = '0';
-	ld.timestamp2 = '0';
-	ld.hostname = 'matlab';
-	ld.points = [ cos(ld.theta) .* ld.readings; sin(ld.theta).* ld.readings];
-	
-function delta = eval_delta(params, tau)
-	
-	% secondo parametro: t
-	t = params{1};
-	theta = params{2};
-	curve = params{3};
-	curve_params = params{4};
-	point = feval(curve, curve_params, tau);
-	phi = angle(point-t);
-	delta = normAngle(phi-theta);
-
-%	fprintf('tau = %f  point = %f %f theta=%f phi=%d delta=%f\n', ...
-%		tau, point(1), point(2), theta, phi, delta);
-	
-function a = angle(v)
-	a = atan2(v(2),v(1));
-
-function root = rfBisection( func, func_params, a, b, epsilon)
-
-    f_a = feval(func, func_params, a);
-    f_b = feval(func, func_params, b);
-    
-    s = sign(f_a) * sign(f_b);
-    if  not ( s == -1 )  
-        error('Sign is equal for a = %g ( f(a)=%g ) and b = %g ( f(b)=%g ) ',  a, f_a, b, f_b);
-    end
-    
- %   fprintf('Root finding (Bisection method)\n');
- %   fprintf('  k\t a \t b \t c \t b-c \t f(c)\n');
-    k = 1;
-    while 1  
-        c = a + (b-a)/2;
-
-        f_b = feval(func, func_params, b);
-        f_c = feval(func, func_params, c);
-  %      fprintf('  %d\t%.6g\t%.6g\t%.6g\t%.6g\t%.6g\n',...
-  %          k, a, b, c, b-c, f_c)
-        
-         if b - c <= epsilon
-            root = c;
-            break
-         end
-         
-         if sign(f_b) * sign(f_c) <= 0
-             a = c;
-         else
-             b = c;
-         end
-         
-         k = k+1;
-    end
-    
diff --git a/misc/matlab/ray_tracing/ray_tracing_polygon.m b/misc/matlab/ray_tracing/ray_tracing_polygon.m
deleted file mode 100644
index 07f39a745168bd6901eae6bff327032a484fe6e1..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/ray_tracing_polygon.m
+++ /dev/null
@@ -1,96 +0,0 @@
-% polylist = { [p0;p1], [p1;p2] }
-function ld = ray_tracing_polygon(seglist, pose, nrays, fov, max_reading)
-
-	t = pose(1:2);
-	ld.nrays = nrays;
-	for i=1:nrays
-		theta = -fov/2 + fov * (i-1)/(nrays-1);
-		ld.theta(i) = theta;
-
-		[valid, reading, alpha] = try_segment_list(seglist, pose(1:2), pose(3)+theta, max_reading);
-		
-		if valid
-			ld.readings(i) = reading;
-			ld.readings_valid(i) = true;
-			ld.true_alpha(i) = alpha-pose(3);
-			ld.true_alpha_abs(i) = alpha;
-		else
-			ld.readings(i) = nan;
-			ld.readings_valid(i) = false;
-			ld.true_alpha(i) = nan;
-			ld.true_alpha_abs(i) = nan;
-		end
-
-		ld.true_alpha(i) = alpha-pose(3); % local coordinates
-		ld.true_alpha_abs(i) = alpha; % local coordinates
-		
-		if rand>0.95
-			pause(0.02)
-		end
-	end
-	
-	
-	ld.odometry = pose;
-	ld.estimate = pose;
-	ld.timestamp1 = '0';
-	ld.timestamp2 = '0';
-	ld.hostname = 'matlab';
-	ld.points = [ cos(ld.theta) .* ld.readings; sin(ld.theta).* ld.readings];
-	
-function [valid, reading, alpha] = try_segment_list(seglist, position, direction, max_reading)
-	valid = false;
-	reading = nan;
-	alpha = nan;
-	for i=1:size(seglist,2)
-		AB = seglist{i};
-		[valid_i, reading_i, alpha_i] = try_segment(AB(:,1),AB(:,2),position, direction, max_reading);
-		better = valid_i & ( (~valid) | (reading_i < reading));
-		if better
-			valid = true;
-			reading = reading_i;
-			alpha = alpha_i;
-		end
-	end
-
-function [valid, reading, alpha] = try_segment(A, B, position, direction, max_reading)
-	valid = false;
-	reading = nan;
-	alpha = nan;
-
-	% Direction of view
-	N = vers(direction);
-	
-	% normal to segment
-	S = rot(pi/2) * (A-B);
-	
-	epsilon = 0.0000001;
-	if abs(S'*N) < epsilon
-		return;
-	end
-	
-	dist = (S'*(A-position)) / (S'*N);
-	if dist < 0
-		return
-	end
-
-	% Now we check whether the crossing point
-	% with the line lies within the segment
-	crossingPoint = position + N * dist;
-	% distance from segment center to crossing point
-	rad = norm(crossingPoint - ( 0.5*A + 0.5*B));
-	if rad > norm(A-B)/2  
-		return;
-	end		
-	
-	if(max_reading == 0) | (dist < max_reading)
-		reading = dist;
-		valid = true;
-		alpha = atan2(S(2),S(1));
-		if vers(alpha)' * N > 0
-			alpha = alpha + pi;
-		end
-		if alpha > 2*pi
-			alpha = alpha - 2*pi;	
-		end
-	end
-	
diff --git a/misc/matlab/ray_tracing/ts_flower.m b/misc/matlab/ray_tracing/ts_flower.m
deleted file mode 100644
index aacbd3fe92f5e23e485e825b00162502a7cf982e..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/ts_flower.m
+++ /dev/null
@@ -1,15 +0,0 @@
-function ts = ts_flower(r1, r2, v, pose, step)
-% ts = ts_flower(r1,r2,v,pose,step)
-%
-% returns ts.laser_ref and ts.laser_sens
-%
-% r1,r2,v give the flower shape
-% pose2 = pose (+) step
-
-	pose1 = pose;
-	pose2 = rtcat(pose1,step);
-	
-	ts.laser_ref  = ray_tracing( pose1, pi, 181, 'countour_flower', {r1,r2,v},0.000001);
-	ts.laser_sens = ray_tracing( pose2, pi, 181, 'countour_flower', {r1,r2,v},0.000001);
-
-
diff --git a/misc/matlab/ray_tracing/ts_square.m b/misc/matlab/ray_tracing/ts_square.m
deleted file mode 100644
index c1c7c18526b04a2399cc659d501104856e67e2a5..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/ts_square.m
+++ /dev/null
@@ -1,23 +0,0 @@
-function ts = ts_square(L, pose, step)
-%   ts = ts_square(L, pose, step)
-%   L: length of square side or if size(L)=2 then it is [Lx Ly]
-%   pose2 = pose (+) step
-
-	if size(L) == 1
-		M = L;
-	else
-		M = diag(L);
-	end
-	
-	square = M * [-1 -1; 1 -1; 1 1; -1 1; -1 -1]';
-	
-	pose1 = pose;
-	pose2 = rtcat(pose1,step);
-	
-	ts.laser_ref  = ray_tracing( pose1, pi, 181, 'countour_straight', {square},0.00001);
-	ts.laser_sens = ray_tracing( pose2, pi, 181, 'countour_straight', {square},0.00001);
-	
-
-
-
-
diff --git a/misc/matlab/ray_tracing/ts_square2.m b/misc/matlab/ray_tracing/ts_square2.m
deleted file mode 100644
index 4b19b2b2ebd534dba8a65501fb37213446c588a7..0000000000000000000000000000000000000000
--- a/misc/matlab/ray_tracing/ts_square2.m
+++ /dev/null
@@ -1,23 +0,0 @@
-function ts = ts_square(L, pose, step, nrays, fov)
-%   ts = ts_square(L, pose, step)
-%   L: length of square side or if size(L)=2 then it is [Lx Ly]
-%   pose2 = pose (+) step
-
-	if size(L) == 1
-		M = L;
-	else
-		M = diag(L);
-	end
-	
-	square = M * [-1 -1; 1 -1; 1 1; -1 1; -1 -1]';
-	
-	pose1 = pose;
-	pose2 = rtcat(pose1,step);
-	
-	ts.laser_ref  = ray_tracing( pose1, fov, nrays, 'countour_straight', {square},0.00001);
-	ts.laser_sens = ray_tracing( pose2, fov, nrays, 'countour_straight', {square},0.00001);
-	
-
-
-
-
diff --git a/misc/matlab/scripts/collate.rb b/misc/matlab/scripts/collate.rb
deleted file mode 100755
index b850431ee28d7a481f5e6f5ee2becdb58d1e6f9c..0000000000000000000000000000000000000000
--- a/misc/matlab/scripts/collate.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env ruby
-
-block = Array.new
-block_indent = '';
-
-$stdin.each_line do |l|
-	if l =~ /^(\s*)%%(.*)$/
-		if block.size == 0
-			block_indent = $1;
-		end
-		block.push $2
-	else
-		# flush block
-		if block.size > 0
-			sub_blocks = Array.new
-			sub_blocks.push Array.new
-			
-			block.each do |m|
-				if m.strip.size == 0
-					sub_blocks.push Array.new
-				else
-					sub_blocks.last.push m
-				end
-			end
-			
-			sub_blocks.each do |s|
-				if s.size>0
-					$stdout.puts block_indent + "%% " + s.join;
-				end
-			end
-			
-			block.clear
-		end
-		# and write last line
-		$stdout.puts l
-	end
-end
diff --git a/misc/matlab/scripts/create_package.rb b/misc/matlab/scripts/create_package.rb
deleted file mode 100755
index 2897ec631737cd5682e653cb360aea281ffb984e..0000000000000000000000000000000000000000
--- a/misc/matlab/scripts/create_package.rb
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'getoptlong'
-
-class DB
-	attr_accessor :required
-	
-	def initialize()
-		@name2file = Hash.new
-		@required = Array.new
-	end
-
-	def explore_directory(d)
-		pwd = Dir.pwd
-		Dir.chdir(d)
-		Dir.glob('**/*.m').each do |x| 
-			name = File.basename(x,'.m');
-			@name2file[name]=File.join(d, x);
-		#	puts "Found function #{name} in file #{x}."
-		end
-		Dir.chdir(pwd)
-	end
-	
-	def need_function(n)
-		return if @required.include?(@name2file[n])
-	
-		if @name2file.has_key?(n) 
-			@required.push @name2file[n]
-			parse_file(@name2file[n]);
-		else
-			$stderr.puts "Dependency '#{n}' not found."
-		end
-	end
-	
-	def parse_file(file)
-		# TODO: se e' directory falli tutti
-		File.open(file,'r') do |f| parse_io(f) end
-	end
-	
-	def parse_io(io)
-		io.each_line do |l|
-			if l =~ /^\s*%\s*Requires:\s*(.*)$/
-				$1.split(",").each do |x| 
-					need_function(x.strip) 
-				end
-			end
-		end
-	end
-end
-
-def print_usage(error)
-	puts "create_package [--directory <dir1>,<dir2>,...]*" 
-
-end
-
-def go
-	version = 0.1;
-	
-	opts = GetoptLong.new(
-		[ "--directory", "-d",   GetoptLong::REQUIRED_ARGUMENT ],
-		[ "--help",      "-h",   GetoptLong::NO_ARGUMENT ],
-		[ "--version",   "-v",   GetoptLong::NO_ARGUMENT ]
-	)
-	 	 
-
-	directories = Array.new
-	begin
-		ndirectory = 0;
-		opts.each do |opt, arg|
-			case opt
-				when "--directory"
-					arg.split(",").each do |single|
-						directories.push(File.expand_path(single))  
-					end
-					ndirectory += 1
-				 when "--help"
-					  print_usage(0); exit(0);
-				 when "--usage"
-					  print_usage(0); exit(0);
-				 when "--version"
-					  print "csvt, version ", version, "\n"
-					  exit(0)
-			end
-		end
-
-	rescue 
-		print_usage(1)
-	end
-		
-	directories.push File.expand_path('.') if directories.size == 0
-	
-	db = DB.new
-	directories.each do |d|
-		db.explore_directory(d)
-	end
-
-	files = ARGV;
-	
-	if files.empty?
-		db.parse_io($stdin);
-	else
-		files.each do |x|
-			db.parse_file(x)
-		end
-	end
-	
-	db.required.each do|r|
-		puts r
-	end
-	
-end
-
-go
diff --git a/misc/matlab/scripts/find_dependencies.rb b/misc/matlab/scripts/find_dependencies.rb
deleted file mode 100755
index 729285ff43f97fe8ce1500f58948e943742522c1..0000000000000000000000000000000000000000
--- a/misc/matlab/scripts/find_dependencies.rb
+++ /dev/null
@@ -1,170 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'getoptlong'
-
-def help
-<<EOF
-
-	This script parses a Matlab script and finds its dependencies on
-	other scripts.
-
-EOF
-end
-
-class DB
-	# Files required (full path)
-	attr_accessor :required
-	# Functione whose file was not found
-	attr_accessor :notfound
-	
-	def initialize()
-		@name2file = Hash.new
-		@required = Array.new
-		@notfound = Array.new
-	end
-
-	def explore_directory(d)
-		pwd = Dir.pwd
-		Dir.chdir(d)
-		Dir.glob('**/*.m').each do |x| 
-			name = File.basename(x,'.m');
-			@name2file[name]=File.join(d, x);
-#			puts "Found function '#{name}' in file #{x}."
-		end
-		Dir.chdir(pwd)
-	end
-	
-	def need_function(n)
-		if @required.include?(@name2file[n])
-#			$stderr.puts "Dependency '#{n}' already got."
-			return
-		end
-		
-		if @name2file.has_key?(n) 
-#			$stderr.puts "Dependency '#{n}' Found!"
-			@required.push @name2file[n]
-			parse_file(@name2file[n]);
-		else
-			@notfound.push n if not @notfound.include? n
-#			$stderr.puts "Dependency '#{n}' not found."
-		end
-	end
-	
-	def parse_file(file)
-		# TODO: se e' directory falli tutti
-		File.open(file,'r') do |f| parse_io(f) end
-	end
-	
-	def parse_io(io)
-		# variables used 
-		variables = Array.new
-		# functions defined in file
-		functions = Array.new
-		
-		# add built-ins
-		functions.push(*['find','if','eye','fprintf','sum','axis',
-			'norm','error','plot','pause','sprintf'])
-		
-		doRequires = true
-		io.each_line do |l|
-			if false
-			if l =~ /\s*function .*=\s*(\w+)/  ||
-			   l =~ /\s*function\s*(\w+)/
-				# puts "Defined function #{$1}"
-				functions.push $1
-			end
-			l.split(';').each do |statement|
-				if statement =~ %r|\s*(\w+)\s*=| ||
-				   statement =~ %r|(\w+)(\(.*\))*\s*=|
-					# puts "Is #{$1} a variable in this? #{statement}"
-					variables.push $1
-				end
-			end
-			
-			# TODO: ignore after comments
-			# TODO: parse strings (ex: fprintf('False(%s,%s;%s)'))
-			l.scan(/(\w+)\(/) { |a| f=a[0];
-				need_function(f) unless variables.include?(f) or
-					functions.include?(f)
-			}
-
-			if l =~ /^\s*%\s*Requires:\s*(.*)$/
-				$1.split(",").each do |x| 
-					need_function(x.strip) 
-				end
-			end
-			end
-			l.scan(/([A-Za-z_]\w*)/) { |a| f=a[0];
-				need_function(f)			
-			}
-		end
-	end
-end
-
-def print_usage(error)
-	puts "create_package [--directory <dir1>,<dir2>,...]*" 
-	puts help
-end
-
-def go
-	version = 0.1;
-	
-	opts = GetoptLong.new(
-		[ "--directory", "-d",   GetoptLong::REQUIRED_ARGUMENT ],
-		[ "--help",      "-h",   GetoptLong::NO_ARGUMENT ],
-		[ "--version",   "-v",   GetoptLong::NO_ARGUMENT ]
-	)
-	 	 
-
-	directories = Array.new
-	begin
-		ndirectory = 0;
-		opts.each do |opt, arg|
-			case opt
-				when "--directory"
-					arg.split(",").each do |single|
-						directories.push(File.expand_path(single))  
-					end
-					ndirectory += 1
-				 when "--help"
-					  print_usage(0); exit(0);
-				 when "--usage"
-					  print_usage(0); exit(0);
-				 when "--version"
-					  print "csvt, version ", version, "\n"
-					  exit(0)
-			end
-		end
-
-	rescue 
-		print_usage(1)
-	end
-		
-	directories.push File.expand_path('.') if directories.size == 0
-	
-	db = DB.new
-	directories.each do |d|
-		db.explore_directory(d)
-	end
-
-	files = ARGV;
-	
-	if files.empty?
-		db.parse_io($stdin);
-	else
-		files.each do |x|
-			db.required.push(Filename.expand(x))
-			db.parse_file(x)
-		end
-	end
-	
-	db.required.each do|r|
-		puts r
-	end
-
-#	$stderr.puts "Found #{db.required.size} deps. Not found: " + 
-#		db.notfound.join(", ") + "."
-	
-end
-
-go
diff --git a/misc/matlab/scripts/matlab2pdf.rb b/misc/matlab/scripts/matlab2pdf.rb
deleted file mode 100644
index 80ba031879ff02556055d01aa12089356ea7e241..0000000000000000000000000000000000000000
--- a/misc/matlab/scripts/matlab2pdf.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env ruby
-
-def go(filename)
-
-	latex=<<EOF
-\documentclass{article}
-\usepackage{amsmath}
-\usepackage{xcolor}
-\usepackage{listings}
-
-\begin{document}
-\lstset{% general command to set parameter(s)
-	basicstyle=\footnotesize\ttfamily, % print whole listing small
-	keywordstyle=\color{blue}\bfseries,
-	% underlined bold black keywords
-	identifierstyle=, % nothing happens
-	commentstyle=\color{green}, % white comments
-	stringstyle=\color{red}\ttfamily, % typewriter type for strings
-	tabsize=4,
-	language=matlab,
-	escapeinside={\%\%}{\^^M},
-	%escapeinside={\%\%\%}{M\%\%\%},
-	escapebegin=\begin{commentline},
-	escapeend=\end{commentline},
-	showstringspaces=false} % no special string spaces
-
-\newenvironment{commentline}{\begin{minipage}{\textwidth}\color{violet}\rmfamily}{\end{minipage}}
-
-\lstinputlisting[tabsize=4,language=matlab]{test_gpm.m}
-\end{document}
-EOF
-
-
-	temp_dir = ...
-	temp_file = Fi
-end
diff --git a/misc/matlab/setall.m b/misc/matlab/setall.m
deleted file mode 100644
index 9cf6cfe642e3b2489cf92a9ab0e45cc2a2d210a0..0000000000000000000000000000000000000000
--- a/misc/matlab/setall.m
+++ /dev/null
@@ -1,2 +0,0 @@
-
-path(path,genpath(pwd));
diff --git a/misc/matlab/show_ci.m b/misc/matlab/show_ci.m
deleted file mode 100644
index 4356549e46801578d77de6bf0704e11dff151239..0000000000000000000000000000000000000000
--- a/misc/matlab/show_ci.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function show_ci(matrices)
-
-	cim = ci(matrices);
-
-	figure; hold on;
-
-	for i=1:size(matrices,2)
-		plotGauss2Db([0;0], matrices{i}, 'k');
-	end
-
-	plotGauss2Db([0;0], cim, 'r');
-	
diff --git a/misc/matlab/test_ci.m b/misc/matlab/test_ci.m
deleted file mode 100644
index 0ccb4644a91bd681f80ec6e7df9c9f32c5b9c46c..0000000000000000000000000000000000000000
--- a/misc/matlab/test_ci.m
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-M = {{[0.0229765, -0.0149166; -0.0149166, 0.0656807], [0.0282244, -0.03318; -0.03318, 0.0462785], [0.0636718, -0.0203679; -0.0203679, 0.027945]},{[0.0716384, -0.000573107; -0.000573107, 0.0433797], [0.0255015, -0.0149166; -0.0149166, 0.0682057], [0.0365894, -0.040821; -0.040821, 0.0588011]}, {[0.0714078, -0.00365251; -0.00365251, 0.0165718], [0.0505588, -0.0316832; -0.0316832, 0.0240555], [0.0365894, -0.040821; -0.040821, 0.0588011]},{[0.0626201, -0.0246348; -0.0246348, 0.0138652], [0.0348738, 0.0339196; 0.0339196, 0.0426435], [0.00283792, 0; 0, 0.0729]},{[0.0503681, -0.0317826; -0.0317826, 0.0241856], [0.0375459, 0.0341964; 0.0341964, 0.0373611], [0.00145432, 0; 0, 0.07165]},{[0.00145432, 0; 0, 0.0729], [0.0729, 0; 0, 0.000957015], [0.0519886, 0.0324478; 0.0324478, 0.0225514]},{[0.0628428, -0.0244156; -0.0244156, 0.013627], [0.0564294, 0.0292007; 0.0292007, 0.02113], [0.00362348, 0; 0, 0.0711234]},{[0.0348738, 0.0339196; 0.0339196, 0.0426435], [0.00283792, 0; 0, 0.0729], [0.0365894, -0.040821; -0.040821, 0.0588011]},{[0.0264557, -0.033174; -0.033174, 0.0445065], [0.0237598, -0.0150674; -0.0150674, 0.0668957], [0.0636718, -0.0203679; -0.0203679, 0.027945]},{[0.0448063, -0.0346394; -0.0346394, 0.0301898], [0.0365894, -0.040821; -0.040821, 0.0588011]}};
-
-M2 = {{[0.0622859, 0; 0, 0.0188791], [0.0134384, 0.011938; 0.011938, 0.0607043]}, {[0.0622859, 0; 0, 0.0188791], [0.013466, 0.0120539; 0.0120539, 0.0611908], [0.0541466, 0.0225964; 0.0225964, 0.019648]}};
-
-M = M2;
-
-figure; hold on;
-
-colors = {'b','r','g','k','m'}
-n = min(size(colors,2),size(M,2));
-n = 1;
-for node=1:n
-	covs  = M{node};
-	
-	for i = 1:size(covs,2)
-		covs{i}
-		plotGauss2Db([0;0], covs{i}, colors{node});
-	end
-end
diff --git a/misc/matlab/unsorted/mdisplay.m b/misc/matlab/unsorted/mdisplay.m
deleted file mode 100644
index 2eea636a7578f39c2dcabb35b1ee5aaf64573814..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/mdisplay.m
+++ /dev/null
@@ -1,2 +0,0 @@
-function mdisplay(m)
-	image(255* abs(m) / max(max(abs(m))));
diff --git a/misc/matlab/unsorted/normalize.m b/misc/matlab/unsorted/normalize.m
deleted file mode 100755
index b8861b4242fc4a647654cfe5c00be1ce573867f0..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/normalize.m
+++ /dev/null
@@ -1,6 +0,0 @@
-% Normalizes a vector in the [0,1] range
-function b = normalize(a)
-	minimum = min(a);
-	maximum = max(a);
-	b = (a - minimum) / (maximum-minimum);
-
diff --git a/misc/matlab/unsorted/prepareSampling.m b/misc/matlab/unsorted/prepareSampling.m
deleted file mode 100644
index f1e873f53b185c97fccb0f4fef52778e33d1afb3..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/prepareSampling.m
+++ /dev/null
@@ -1,26 +0,0 @@
-function result = prepareSampling(set, weights)
-	threshold=0.1;
-	resolution = min(weights(find(weights>threshold))) / 5
-	totWeight = sum(weights);
-	spaces = ceil(totWeight/resolution)
-	fprintf('prepareSampling: n=%d', spaces);
-	setIndex = 1;
-	setTotal = weights(1);
-	 myTotal = 0;
-	
-	for i=1:spaces
-		result(i) = setIndex;
-		
-		if myTotal>setTotal  & setIndex < size(weights,2)
-			setIndex = setIndex +1 ;
-			setTotal = setTotal + weights(setIndex);
-		end
-		
-		myTotal = myTotal + resolution;
-		
-	end
-	
-	myTotal
-	setTotal
-	
-
diff --git a/misc/matlab/unsorted/randf2.m b/misc/matlab/unsorted/randf2.m
deleted file mode 100644
index b1bad1666d53ef4b0756c33ea7c95e0889a8377b..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/randf2.m
+++ /dev/null
@@ -1,29 +0,0 @@
-function [f0,f1,f2] = randf2(t,w)
-
-	n = size(t,2);
-	f2 = w * randn(1,n+2);
-	
-	f1(1)=0;
-	for i=2:n
-		f1(i) = f1(i-1) + f2(i-1) * (t(i)-t(i-1));
-	end
-
-	f0(1)=0;
-	for i=2:n
-		f0(i) = f0(i-1) + f1(i-1) * (t(i)-t(i-1));
-	end
-	
-	f2 = f2(1:n);
-	f1 = f1(1:n);
-	f0 = f0(1:n);
-	
-	
-	
-	figure 
-	hold on
-	
-	plot(1:n, f0, 'r.');
-	plot(1:n, f1, 'g.');
-	plot(1:n, f2, 'b.');
-	
-	hold off
diff --git a/misc/matlab/unsorted/rtcat.m b/misc/matlab/unsorted/rtcat.m
deleted file mode 100644
index 5eb277c7a758ffa056a639b697a2eaf547602bd5..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/rtcat.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function d = rtcat(ref, delta)
-	%% Adds a rototranslation. ref is the starting point and
-	%% delta is (x,y,theta). 
-	d(1:2) = ref(1:2) + rot(ref(3)) * delta(1:2); 
-	d(3) = ref(3) + delta(3);
-	d = d';
-
diff --git a/misc/matlab/unsorted/sampleIndex.m b/misc/matlab/unsorted/sampleIndex.m
deleted file mode 100644
index b9a8916bbf4ed251da6c1e9c432b798b6ad0d019..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/sampleIndex.m
+++ /dev/null
@@ -1,4 +0,0 @@
-function index = sampleIndex(prepared)
-	n = size(prepared,2);
-	i = min(max(1, floor(rand*(n-1))), n);
-	index = prepared(i);
diff --git a/misc/matlab/unsorted/sample_normal.m b/misc/matlab/unsorted/sample_normal.m
deleted file mode 100644
index ea1791d3f4e0a01d2eaaee0e51eeb2d1ec1290a8..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/sample_normal.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function rnorm = sample_normal(mean,Sigma,N)
-% sample_normal(mean,Sigma,N)
-%  sampleNormal generates a pxN array  of normal draws
-%  from the p-dim N(mean,Sigma)
-	p=length(mean); 
-	rnorm = repmat(reshape(mean,p,1),1,N) +chol(Sigma)'*randn(p,N);
-
diff --git a/misc/matlab/unsorted/simpleLowPassFilter.m b/misc/matlab/unsorted/simpleLowPassFilter.m
deleted file mode 100755
index c608dc1edfb5823e57c3055644e474f91b06455c..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/simpleLowPassFilter.m
+++ /dev/null
@@ -1,5 +0,0 @@
-% Simple low-pass filter with a gaussian mask
-function b = simpleLowPassFilter(a, sigma)
-	amp=2*sigma; filter=exp(-((-amp:amp).^2)/sigma^2);
-	b = normalize(convn(a,filter,'same'));
-
diff --git a/misc/matlab/unsorted/simpleLowPassFilter2.m b/misc/matlab/unsorted/simpleLowPassFilter2.m
deleted file mode 100755
index 47a1f9f2200720a62591c88c69351addbbc4eeef..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/simpleLowPassFilter2.m
+++ /dev/null
@@ -1,13 +0,0 @@
-% Simple low-pass filter with a gaussian mask (bidimensional version)
-function b = simpleLowPassFilter2(a, sigma)
-	amp=2*sigma+1; 
-	mask=zeros(amp,amp);
-	
-	for i=1:amp
-	for j=1:amp
-		mask(i,j) = exp(-((i-sigma-1)^2+(j-sigma-1)^2)/sigma^2);
-	end
-	end
-	
-	b = conv2(a,mask,'same');
-
diff --git a/misc/matlab/unsorted/simpleLowPassFilterCircular.m b/misc/matlab/unsorted/simpleLowPassFilterCircular.m
deleted file mode 100755
index d711d41a6e495230b05e1dbde5d15826f0bf26c1..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/simpleLowPassFilterCircular.m
+++ /dev/null
@@ -1,7 +0,0 @@
-% Simple low-pass filter with a gaussian mask, for a circular buffer
-function b = simpleLowPassFilterCircular(a, sigma)
-	extended=[a a a];
-	extendedb=simpleLowPassFilter(extended,sigma);
-	b = extendedb(size(a,2)+1:end-size(a,2));
-	b = normalize(b);
-
diff --git a/misc/matlab/unsorted/test_boh.m b/misc/matlab/unsorted/test_boh.m
deleted file mode 100644
index 88d904c410f2d442c09c519ee38ef85242841bcf..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/test_boh.m
+++ /dev/null
@@ -1,21 +0,0 @@
-function f = test_boh
-
-th=0:0.001:2*pi;
-
-G = [.5 4; 0 .5]; rand(2,2);
-k = 100*rand(2,1);
-k =[-1;0];
-
-for i=1:size(th,2)
-
-	f(i) = vers(th(i))' * G * vers(th(i)) + k'*vers(th(i));
-
-end
-
-fi=figure;
-plot(rad2deg(th),f);
-
-
-
-function v = vers(t)
-	v=[cos(t);sin(t)];
diff --git a/misc/matlab/unsorted/test_inversa.m b/misc/matlab/unsorted/test_inversa.m
deleted file mode 100644
index ff6de9a632951a486afc648653b3a45d49d99124..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/test_inversa.m
+++ /dev/null
@@ -1,25 +0,0 @@
- n = 360; m = rand(n,n); P = m * m'; 
- 
- Q = P;
- G = rand(n,n);
- H = G;
- 
- band=30; 
- 
- for i=1:n
-	 for j=1:n
-	 	if abs(i-j)>band 
-			Q(i,j)=0; G(i,j)=0;
-		end; 
-	end; 
-end
-
-
-
- tic; inv(P); toc
- tic; inv(Q); toc
- 
-tic; inv(G); toc
-
-tic; inv(H); toc
-
diff --git a/misc/matlab/unsorted/test_lag.m b/misc/matlab/unsorted/test_lag.m
deleted file mode 100644
index ced657686b2c167b7d10c9ba52c7125ce1ed0b03..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/test_lag.m
+++ /dev/null
@@ -1,168 +0,0 @@
-function test_lag
-
-	t_true = randn(2,1)*4;
-	theta_true = deg2rad(rand*90-45);
-	theta_true = deg2rad(170);
-	pose_true = [t_true; theta_true];
-	
-	x_true = [t_true; cos(theta_true); sin(theta_true)];
-	
-	N=400
-	points1 = rand(2,N);
-	%points1 = [-1 -1; -1 1; 1 1; 1 -1]';
-	points2 = rot(theta_true) * points1 + repmat(t_true,1,N) ; 
-	points2 = points2 + 0.01*randn(2,N);
-
-	f=figure;	
-	plot_lambda(points1,points2,-70:0.1:20);
-	
-	
-	f = figure;
-	hold on
-	plotVectors([0;0;0], points1, 'k.');
-	plotVectors([0;0;0], points2, 'g.');
-	axis('equal');
-
-	tic
-	[pose, L, Y] = exact_minimization_cf(points1,points2);
-	toc
-	
-	e_t = pose(1:2)-t_true
-	e_th = rad2deg(pose(3)-theta_true)
-	
-	plotVectors(pose, points1, 'r.');
-	hold off;
-	
-function plot_lambda(points1,points2,interval)
-	[L,Y] = create_system(points1, points2);
-	ls = interval;
-	size(ls,2)
-	for i=1:size(ls,2)
-		fu(i) = constraint({L'*L,L'*Y}, ls(i));
-	end
-	
-	pos_index = find(fu>0);
-	neg_index = find(fu<0);
-	
-	f = figure;
-	hold on
-	plot(ls(pos_index), fu(pos_index), 'b.');
-	plot(ls(neg_index),fu(neg_index),'r.');
-	hold off;
-	
-
-function pose = exact_minimization(points1, points2)
-	[L,Y] = create_system(points1,points2);	
-	
-	M = diag([0 0 1 1]);
-	A = (L'*L);
-	B = L'*Y;
-	lA = A(1:2,1:2);
-	lB = A(1:2,3:4);
-	lC = A(3:4,3:4);
-	
-	S = lC - lB' * inv(lA) * lB
-	e = eig(S);
-	start = - e(1)
-	big_interval = 20;
-	small_interval = 0.01;
-	
-	lambda_right = rfBisection('constraint', {L'*L,L'*Y}, ...
-		start+small_interval, start+big_interval, 0.00000001)
-	lambda_left = rfBisection('constraint', {L'*L,L'*Y}, ...
-		start-big_interval, start-small_interval, 0.00000001)
-		
-	L2 = (L'*L + lambda_right * M);
-	Y2 = L'*Y;
-	x_hat = inv(L2) * Y2;
-	
-	theta_hat = atan2(x_hat(4),x_hat(3));
-	pose = [x_hat(1); x_hat(2); theta_hat];
-	
-
-function [L,Y] = create_system(points1, points2)
-	N = size(points1,2);
-	L = zeros(2*N,4);
-	Y = zeros(2*N,1);
-	for i=1:N
-		for j=max(1,i):min(i,N)
-		p_i = points1(:,i);
-		p_j = points2(:,j);
-		Lk = [ eye(2) p_i rot(pi/2)*p_i ];
-		Yk = p_j;
-	
-		L((i-1)*2+1:(i-1)*2+2,1:4) = Lk;
-		Y((i-1)*2+1:(i-1)*2+2,1)   = Yk;
-		end
-	end
-	
-function [pose, L, Y] = exact_minimization_cf(points1, points2)
-	[L,Y] = create_system(points1,points2);
-	
-	B = L'*Y;
-	x1 = B(1:2); 
-	x2 = B(3:4);
-
-	A = (L'*L);
-	lB = A(1:2,3:4);
-	bt=lB'*lB;
-	b=bt(1,1);
-	
-	% closed form solution
-	n = A(1,1);
-	c = A(3,3);
-	
-	pol = [ (b* x1'*x1+n^2 * x2'*x2 -2*n*x1'*lB*x2) 0 (-1)];
-	r = roots(pol);
-	la1 = (1/n) * (1/r(1) -n*c+b);
-	la2 = (1/n) * (1/r(2) -n*c+b);
-	
-	M = diag([0 0 1 1]);
-	L2 = (L'*L + la1 * M);
-	Y2 = L'*Y;
-	x_hat = inv(L2) * Y2;
-	
-	theta_hat = atan2(x_hat(4),x_hat(3));
-	pose = [x_hat(1); x_hat(2); theta_hat];
-	
-	
-function m = constraint(params, la)
-	A = params{1};
-	B = params{2};
-	M = diag([0 0 1 1]);
-	m = B' * inv(A+la*M)'*M*inv(A+la*M)*B - 1;
-	
-function root = rfBisection( func, func_params, a, b, epsilon)
-
-    f_a = feval(func, func_params, a);
-    f_b = feval(func, func_params, b);
-    
-    s = sign(f_a) * sign(f_b);
-    if  not ( s == -1 )  
-        error('Sign is equal for a = %g ( f(a)=%g ) and b = %g ( f(b)=%g ) ',  a, f_a, b, f_b);
-    end
-    
-    fprintf('Root finding (Bisection method)\n');
-   fprintf('  k\t a \t b \t c \t b-c \t f(c)\n');
-    k = 1;
-    while 1  
-        c = a + (b-a)/2;
-
-        f_b = feval(func, func_params, b);
-        f_c = feval(func, func_params, c);
-        fprintf('  %d\t%.6g\t%.6g\t%.6g\t%.6g\t%.6g\n', k, a, b, c, b-c, f_c)
-        
-         if b - c <= epsilon
-            root = c;
-            break
-         end
-         
-         if sign(f_b) * sign(f_c) <= 0
-             a = c;
-         else
-             b = c;
-         end
-         
-         k = k+1;
-    end
-    
diff --git a/misc/matlab/unsorted/test_yasmine.m b/misc/matlab/unsorted/test_yasmine.m
deleted file mode 100644
index 2bb19590ba1847325ccb1986820dd3e5933b0495..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/test_yasmine.m
+++ /dev/null
@@ -1,28 +0,0 @@
-function res = test_yasmine(k)
-
-sigma=0.00001;
-
-	S=load('logs/bighouse_half.mat');
-	log = S.log_bighouse_half;
-
-	params.laser_ref = log{k};
-	params.laser_ref = add_noise(params.laser_ref, sigma);
-	params.laser_sens = log{k};
-	params.laser_sens = add_noise(params.laser_sens, sigma);
-	params.maxAngularCorrectionDeg = 15;
-	params.maxLinearCorrection = 0.5;
-	params.sigma = sigma;
-	res.params = params;
-
-	tic
-	result = yasmine2(params);
-	toc
-	
-	res.result = result;
-		
-		
-function res = add_noise(ld, sigma) 
-	res = ld;
-	res.readings = res.readings + sigma * randn(1,res.nrays);
-	res.points = [res.readings .* cos(res.theta);  res.readings .* sin(res.theta)]; 
-	res = computeSurfaceNormals_sound(res);
diff --git a/misc/matlab/unsorted/test_yasmine2.m b/misc/matlab/unsorted/test_yasmine2.m
deleted file mode 100644
index 35328b5fd601a6092cc75a41e43730116e0fb84a..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/test_yasmine2.m
+++ /dev/null
@@ -1,56 +0,0 @@
-function res = test_yasmine2(k)
-
-	%x_true = [1;-2;deg2rad(-10.5)];
-	%x_true = [0.2;0;deg2rad(5.5)];
-	%ts = ts_square(8, [1;-4;0], x_true);
-	%ts = ts_flower(4, 1, 10, [0;0;0], x_true);
-	
-	x_true = [1;0;0];
-	ts = ts_flower(4, .5, 10, [0;0;0], x_true);
-	sigma=0.005;
-	odometry_cov = diag( [0.2 0.2 deg2rad(5)].^2 );
-
-	ts.laser_ref = add_noise(ts.laser_ref, sigma);
-	ts.laser_sens = add_noise(ts.laser_sens, sigma);
-	ts.laser_sens.estimate = [0;0;0];
-	ts.laser_sens.odometry = [0;0;0];
-	
-	
-	ts.maxAngularCorrectionDeg = 40;
-	ts.maxLinearCorrection = 2;
-	ts.sigma = sigma;
-
-	ts.odometry = sample_normal(x_true, odometry_cov, 1)
-	ts.odometry_cov = odometry_cov;
-
-	ts.trim = 0.05;
-	ts.chi_perc = 0.95;
-	ts.chi_limit = 20;
-
-	tic
-	result = yasmine2(ts);
-	toc
-	
-	res.result = result;
-	res.ts = ts;
-	
-	e = res.result.x_hat - x_true
-		
-	f = figure;
-		params.plotNormals = true;	
-		params.rototranslated = true;
-
-		params.color = 'b.';
-		plotLaserData(ts.laser_ref, params);
-		params.color = 'r.';
-		ld2 = ts.laser_sens;
-		ld2.estimate = rtcat(ts.laser_ref.estimate, result.x_hat);
-		plotLaserData(ld2, params);
-		
-	axis('equal');
-
-function res = add_noise(ld, sigma) 
-	res = ld;
-	res.readings = res.readings + sigma * randn(1,res.nrays);
-	res.points = [res.readings .* cos(res.theta);  res.readings .* sin(res.theta)]; 
-	res = computeSurfaceNormals_sound(res);
diff --git a/misc/matlab/unsorted/test_yasmine3.m b/misc/matlab/unsorted/test_yasmine3.m
deleted file mode 100644
index ba0ba63948d9cb60c884d2e6f5715d8098b2a837..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/test_yasmine3.m
+++ /dev/null
@@ -1,42 +0,0 @@
-function res = test_yasmine3(k)
-	% systematic experiments
-
-	x_true = [1;0;deg2rad(-10.5)];
-	ts0 = ts_square(8, [1;-2;deg2rad(10)], x_true );
-%	ts0 = ts_flower(8, 2, 10, [0;0;0], x_true);
-	sigma=0.005;
-	odometry_cov = diag( [0.2 0.2 deg2rad(5)].^2 );
-
-	odometry_cov = diag( [0.5 0.5 deg2rad(5)].^2 );
-
-	N = 50;
-	
-	for i=1:N
-		ts{i} = ts0;
-		
-		ts{i}.input.laser_ref = add_noise(ts0.laser_ref, sigma);
-		ts{i}.input.laser_sens = add_noise(ts0.laser_sens, sigma);
-		
-		ts{i}.input.maxAngularCorrectionDeg = 40;
-		ts{i}.input.maxLinearCorrection = 2;
-		ts{i}.input.sigma = sigma;
-		
-		ts{i}.input.trim = 0.05;
-		ts{i}.input.chi_perc = 0.95;
-		ts{i}.input.chi_limit = 50;
-		ts{i}.input.odometry = sample_normal(x_true, odometry_cov, 1);
-		ts{i}.input.odometry_cov = odometry_cov;
-
-		tic
-		ts{i}.output = yasmine2(ts{i}.input);
-		toc
-			
-	end
-
-	res = ts;
-	
-function res = add_noise(ld, sigma) 
-	res = ld;
-	res.readings = res.readings + sigma * randn(1,res.nrays);
-	res.points = [res.readings .* cos(res.theta);  res.readings .* sin(res.theta)]; 
-	res = computeSurfaceNormals_sound(res);
diff --git a/misc/matlab/unsorted/test_yasmine3_an.m b/misc/matlab/unsorted/test_yasmine3_an.m
deleted file mode 100644
index 031227479daafe743d8ca2386f0a18c0a67a0c7b..0000000000000000000000000000000000000000
--- a/misc/matlab/unsorted/test_yasmine3_an.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function [dist,white] = test_yasmine3_an(f)
-
-	for i=1:size(f,2)
-		dist(:,i) = f{i}.output.x_hat;
-		cov = f{i}.output.Cov;
-		A = inv(chol(cov))';
-		white(:,i) = A * (f{i}.output.x_hat-[1;0;-10.5]);
-	end
diff --git a/misc/matlab/utils/deriv.m b/misc/matlab/utils/deriv.m
deleted file mode 100644
index 9f37d19c90a1a6ced835d06878de4f832aeeafb2..0000000000000000000000000000000000000000
--- a/misc/matlab/utils/deriv.m
+++ /dev/null
@@ -1,10 +0,0 @@
-%% Numerical derivation with step \verb|epsilon|
-function res = deriv(fh, x, epsilon)
-	% deriv(fh, x, epsilon)
-	%  fh: function handle
-	%   x: point to derive
-	% epsilon: interval
-	f1 = fh(x+epsilon/2);
-	f0 = fh(x-epsilon/2);
-	res= (f1-f0)/epsilon;
-
diff --git a/misc/matlab/utils/file_exists.m b/misc/matlab/utils/file_exists.m
deleted file mode 100644
index 6b2c36c7becc00d8c0d2f8e9fbdefba58cdc149c..0000000000000000000000000000000000000000
--- a/misc/matlab/utils/file_exists.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function res = file_exists(filename)
-	fid = fopen(filename);
-	if -1 == fid
-		res = false;
-	else
-		res = true;
-		fclose(fid);
-	end
diff --git a/misc/matlab/utils/normAngle.m b/misc/matlab/utils/normAngle.m
deleted file mode 100644
index 24cdc606813c0d27c2f91287b78451b9f9ff0ce0..0000000000000000000000000000000000000000
--- a/misc/matlab/utils/normAngle.m
+++ /dev/null
@@ -1,13 +0,0 @@
-function res = normAngle(theta)
-
-	for i=1:size(theta,2)
-		while theta(i)>pi
-			 theta(i) = theta(i) - 2*pi;
-		end
-		
-		while theta(i)<-pi
-			 theta(i) = theta(i) + 2*pi;
-		end
-	end
-	
-res = theta;
\ No newline at end of file
diff --git a/misc/matlab/utils/params_required.m b/misc/matlab/utils/params_required.m
deleted file mode 100644
index 77f7a7e4077cb35ed714af33e5b9a5d2a0a0f654..0000000000000000000000000000000000000000
--- a/misc/matlab/utils/params_required.m
+++ /dev/null
@@ -1,6 +0,0 @@
-
-function params_required(p, field)
-	if not(isfield(p, field))
-		error('icp:bad_paramater',sprintf('I need field %s.', field));
-	end
-
diff --git a/misc/matlab/utils/params_set_default.m b/misc/matlab/utils/params_set_default.m
deleted file mode 100644
index d1f3a62939ec129dfd823257ea279f3c01516f10..0000000000000000000000000000000000000000
--- a/misc/matlab/utils/params_set_default.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function res = params_set_default(p, field, default_value)
-	% Checks whether the field is contained in p; if not, it adds the default_value.
-	if not(isfield(p, field))
-		p = setfield(p, field, default_value);
-	%	fprintf('Setting default for %s = ', field);
-	%	fprintf('%f ', default_value);
-	%	fprintf('\n');
-	end
-	res = p;
-
diff --git a/misc/matlab/utils/pv.m b/misc/matlab/utils/pv.m
deleted file mode 100644
index 0f5630cdeb7ff28dab3cb72f71cb9bad1cf90516..0000000000000000000000000000000000000000
--- a/misc/matlab/utils/pv.m
+++ /dev/null
@@ -1,15 +0,0 @@
-function s = pv(v)
-% prints v=(x,y,theta) as a string, with theta in degrees
-
-if size(v,1)==3
-s= sprintf('(%f,%f,%f)', v(1), v(2), rad2deg(v(3)));
-end
-
-if size(v,1)==2
-s= sprintf('(%f,%f)', v(1), v(2));
-end
-
-if size(v,1)==1
-s= sprintf('(%f)', v(1));
-end
-
diff --git a/misc/matlab/utils/rot.m b/misc/matlab/utils/rot.m
deleted file mode 100644
index 06ea72f6f83e9aebc64a7c35ebaae29b9dea8465..0000000000000000000000000000000000000000
--- a/misc/matlab/utils/rot.m
+++ /dev/null
@@ -1,3 +0,0 @@
-function r=rot(theta) 
-% rot(theta) rotation matrix of order two
-	r = [cos(theta) -sin(theta); sin(theta) cos(theta)];
diff --git a/misc/matlab/utils/transform.m b/misc/matlab/utils/transform.m
deleted file mode 100644
index c471b339c92690142c53d1e38d5c4f17a042e47e..0000000000000000000000000000000000000000
--- a/misc/matlab/utils/transform.m
+++ /dev/null
@@ -1,5 +0,0 @@
-
-function point = transform(point, dx)
-% rotate then translate point
-	point = dx(1:2,1) + rot(dx(3)) * point;
-
diff --git a/misc/matlab/utils/vers.m b/misc/matlab/utils/vers.m
deleted file mode 100644
index 3c3c2fd9c35ef03d522d8e3ebc63f0850022b6c7..0000000000000000000000000000000000000000
--- a/misc/matlab/utils/vers.m
+++ /dev/null
@@ -1,4 +0,0 @@
-function v = vers(theta)
-% returns 2d versor of direction theta
-        v = [cos(theta); sin(theta)];
-
diff --git a/misc/matlab/vis/createAnimation.m b/misc/matlab/vis/createAnimation.m
deleted file mode 100644
index a7699e0a089a3fbd4f5a9588ca562eab65eb8e02..0000000000000000000000000000000000000000
--- a/misc/matlab/vis/createAnimation.m
+++ /dev/null
@@ -1,41 +0,0 @@
-function createAnimation0(lds, filename, makeVideo)
-
-	horizon = 3;
-	fps=5;
-	
-	% Settings for video
-	fig1=figure;
-	winsize= get(fig1,'Position');
-	winsize(1:2) = [0 0];
-	outfile=sprintf('%s',filename);
-	mov=avifile(outfile, 'fps', fps, 'quality', 75);
-	%set(fig1, 'NextPlot', 'replacechildren');
-	        
-	set(fig1,'DoubleBuffer','on'); 
-	
-	n = size(lds,2);
-	for i=1:n
-		if i>1 & ( vectorNorm2(lds(i).odometry-lds(i-1).odometry) < 0.01 )
-			continue
-		end
-		
-		clf
-		hold on;
-		plotLaserData(lds(i));
-		axis('equal');
-		hold off
-		
-		%axis([0 horizon -horizon horizon]); 
-		
-		if makeVideo
-			% Add frame to movie
-			mov = addframe(mov,getframe);
-		end
-		
-		% update the screen
-		drawnow
-	end
-
-	
-	% That's all, folks!
-	mov = close(mov);
diff --git a/misc/matlab/vis/ld_plot.m b/misc/matlab/vis/ld_plot.m
deleted file mode 100644
index 3a6a424dd44d7036feb72bfa2a980216637d6f6e..0000000000000000000000000000000000000000
--- a/misc/matlab/vis/ld_plot.m
+++ /dev/null
@@ -1,135 +0,0 @@
-
-function res = ld_plot(ld, params)
-%  plotLaserData(ld, params)
-%		Draws on current figure
-%		
-%		params.plotNormals = false;	
-%		params.color = 'r.';
-%		params.rototranslated (= true); if true, the scan is drawn
-%			rototranslated at ld.estimate, else is drawn at 0;
-%		params.rototranstated_odometry = false;
-%
-%   ld.dr -> tangent vector
-	
-	ld.points = [ cos(ld.theta') .* ld.readings'; sin(ld.theta').* ld.readings'];
-	
-	if(nargin==1)
-		params.auto = false;
-	end
-	
-	
-	params = params_set_default(params, 'plotNormals', false);
-	params = params_set_default(params, 'color',    'r.');
-	
-	params = params_set_default(params, 'rototranslated',  true);	
-	params = params_set_default(params, 'rototranslated_odometry',  false);	
-	
-	params = params_set_default(params, 'plot_true_alpha', false);
-	params = params_set_default(params, 'plot_true_alpha_length', 0.4);
-	params = params_set_default(params, 'plot_true_alpha_color', 'g-');
-	
-	params = params_set_default(params, 'plot_rays', false);
-	params = params_set_default(params, 'plot_rays_color', 'b-');
-	params = params_set_default(params, 'plot_rays_interval', 10);
-
-	if(params.rototranslated_odometry)
-		reference = ld.odometry;	
-	else
-		if(params.rototranslated)
-			reference = ld.estimate;	
-		else
-			reference = [0 0 0]';
-		end
-	end
-	
-	if isnan(reference(1)) || isnan(reference(2)) || isnan(reference(3))
-		fprintf('ld_plot: Invalid reference.\n');
-		return;
-	end
-	
-	hold on
-	
-	if isfield(ld,'valid') == 0
-		ld.valid = ones(ld.nrays,1);
-	end
-	
-	for i=1:ld.nrays
-		if 0 == ld.valid(i)
-			continue
-		end
-		theta = ld.theta(i);
-		readings = ld.readings(i);
-		p = readings*[cos(theta);sin(theta)];
-		plotVectors(reference, p, params.color);
-	end
-	
-%	res.points = plotVectors(reference, ld.points, params.color);
-	
-	if params.plot_rays
-		for i=1:params.plot_rays_interval:ld.nrays
-			plotVectors(reference, [0 0; ld.points(:,i)']', params.plot_rays_color);
-		end
-	end
-	
-	if params.plotNormals 
-		% disegno normali
-		maxLength = 0.1;
-		
-		valids = find(ld.alpha_valid);
-        if not(isfield(ld,'alpha_error'))
-            ld.alpha_error = ones(1, ld.nrays);
-        end
-		
-		valid_points = ld.points(:,valids);
-		valid_alpha  = ld.alpha(valids);
-		valid_errors = rad2deg(sqrt(ld.alpha_error(valids)));;
-		emin = min(valid_errors);
-		emax = max(valid_errors);
-		
-		for i=1:size(valids,1)
-			%weight = 1 + valid_errors(i) * maxLength;
-			weight = maxLength;
-            
-			alpha = valid_alpha(i);
-			v = [cos(alpha); sin(alpha)] * weight;
-			from = valid_points(:,i);
-			to = from + v;
-			plotVectors( reference, [from to] , 'g-');
-		end
-	end
-	
-	if params.plot_true_alpha
-		% disegno normali
-		length = params.plot_true_alpha_length;
-		color = params.plot_true_alpha_color;
-		
-		for i=1:ld.nrays
-			v = [cos(ld.true_alpha(i)); sin(ld.true_alpha(i))] * length;
-			from = ld.points(:,i);
-			to = from + v;
-			plotVectors( reference, [from to] , color);
-		end
-	end
-	
-	if isfield(ld,'dr')
-    	% disegno normali
-		maxLength = 0.3;
-		
-		dr = ld.dr / max(abs(ld.dr)) * maxLength;
-		
-		for i=1:ld.nrays
-			theta = ld.theta(i);
-    		readings = ld.readings(i);
-    		alpha = ld.alpha(i);
-    		
-    		%len = [cos(theta);sin(theta)]' *  [cos(alpha);sin(alpha)] * dr(i);
-    		%dir = alpha;
-    		len = dr(i);
-    		dir = theta;
-    		
-    		from = readings*[cos(theta);sin(theta)];
-    	    to = from + [cos(dir);sin(dir)] * len;
-			plotVectors( reference, [from to] , 'g-');
-		end
-	end
-	
diff --git a/misc/matlab/vis/plot3bars.m b/misc/matlab/vis/plot3bars.m
deleted file mode 100644
index 2049cb5f3cba9b39f28726bdf59a9bb21c72a129..0000000000000000000000000000000000000000
--- a/misc/matlab/vis/plot3bars.m
+++ /dev/null
@@ -1,18 +0,0 @@
-function plot3bars(x,col1,v_alpha,d,col2,col3)
-
-col1
-col2
-col3
-	hold on;
-	plot3(x(1,:),x(2,:),x(3,:),col1);
-	
-	%% Now project x along plane 
-	
-	y = repmat(d*v_alpha,1,size(x,2)) + (eye(3)-v_alpha*v_alpha') * x;
-	size(y,2)
-	
-	for i=1:size(y,2)
-		plot3( [x(1,i) y(1,i)],[x(2,i) y(2,i)],[x(3,i) y(3,i)],col3);
-		plot3( y(1,i),y(2,i), y(3,i),col2);
-	
-	end
diff --git a/misc/matlab/vis/plotGPM1.m b/misc/matlab/vis/plotGPM1.m
deleted file mode 100644
index e97301f780a88189a20a8e76b5f06b27d3af409b..0000000000000000000000000000000000000000
--- a/misc/matlab/vis/plotGPM1.m
+++ /dev/null
@@ -1,25 +0,0 @@
-function plotGPM1(result)
-	hold on
-	
-	n = size(result.T, 2);
-
-	for i=1:n	
-		if result.weight(i) < 0.8
-			continue
-		end
-		
-		T = result.T(:, i);
-		phi = result.phi(i);
-		gamma = result.alpha(i);
-		
-		length = 0.5;
-		p1 = T + vers(gamma-pi/2) * length;
-		p2 = T + vers(gamma+pi/2) * length;
-		
-		plot([p1(1) p2(1)],[p1(2) p2(2)],'b-');
-		%plot(T(1),T(2),'r.');
-		
-	end
-	
-function v = vers(theta)
-	v = [cos(theta) sin(theta)]';
diff --git a/misc/matlab/vis/plotGauss2Db.m b/misc/matlab/vis/plotGauss2Db.m
deleted file mode 100644
index ab786c90ecf540616dc3627631b0c14e64fcd791..0000000000000000000000000000000000000000
--- a/misc/matlab/vis/plotGauss2Db.m
+++ /dev/null
@@ -1,30 +0,0 @@
-% Non disegna il punto
-function res = plotGauss2Db(mu,sigma,color)
-
-if (size(mu,2) ~= 1)
-    mu = mu';
-    if (size(mu,2) ~= 1)
-        error('mu deve essere un vettore');
-    end
-end
-if (size(mu,2) ~= 1)
-    error('mu deve essere un vettore bidimensionale');
-end
-if (size(sigma,1) ~= size(sigma,2))
-    error('sigma deve essere quadrata');
-end
-if (size(sigma,1) ~= 2)
-    error('la funzione plotGauss2D serve solo per plottare in 2 dimensioni');
-end
-
-res = ellipse(mu,sigma,color);
-
-function res = ellipse(mean,Sigma,color)
-	MahlDist = 6;
-	npoints = 100;
-	% Prende un cerchio e fa una trasformazione affine
-	theta=(0:1:npoints)*(2*pi/npoints);
-	[V,D] = eig(Sigma);
-	points= repmat(mean,1,npoints+1) + ...
-		V * sqrt(D) * sqrt(MahlDist) * [cos(theta); sin(theta)];
-	res = plot(points(1,:),points(2,:),color);
diff --git a/misc/matlab/vis/plotLaserData.m b/misc/matlab/vis/plotLaserData.m
deleted file mode 100644
index 9239b1b51928e58d3e4c3f68ed054aac2fb223fb..0000000000000000000000000000000000000000
--- a/misc/matlab/vis/plotLaserData.m
+++ /dev/null
@@ -1,52 +0,0 @@
-function plotLaserData(ld, params)
-%  plotLaserData(ld, params)
-%		Draws on current figure
-%		
-%		params.plotNormals = false;	
-%		params.color = 'r.';
-%		params.rototranslated (= true); if true, the scan is drawn
-%			rototranslated at ld.estimate, else is drawn at 0;
-%		params.rototranstated_odometry = false;
-	
-	if(nargin==1)
-		params.plotNormals = false;	
-		params.color = 'r.';
-		params.rototranslated = true;
-		params.rototranslated_odometry = false;
-	end
-	
-	if(params.rototranslated_odometry)
-		reference = ld.odometry;	
-	else
-		if(params.rototranslated)
-			reference = ld.estimate;	
-		else
-			reference = [0 0 0]';
-		end
-	end
-		
-	hold on
-	
-	plotVectors(reference, ld.points, params.color);
-	
-	if params.plotNormals 
-		% disegno normali
-		maxLength = 0.05;
-		
-		valids = find(ld.alpha_valid);
-		
-		valid_points = ld.points(:,valids);
-		valid_alpha  = ld.alpha(valids);
-		valid_errors = rad2deg(sqrt(ld.alpha_error(valids)));;
-		emin = min(valid_errors);
-		emax = max(valid_errors);
-		
-		for i=1:size(valids,2)
-			weight = 1 + valid_errors(i) * maxLength;
-			
-			v = [cos(valid_alpha(i)); sin(valid_alpha(i))] * weight;
-			from = valid_points(:,i);
-			to = from + v;
-			plotVectors( reference, [from to] , 'g-');
-		end
-	end
diff --git a/misc/matlab/vis/plotVectors.m b/misc/matlab/vis/plotVectors.m
deleted file mode 100644
index e839aa223a11f8caea1d25ddb3422a8d9ffbb45d..0000000000000000000000000000000000000000
--- a/misc/matlab/vis/plotVectors.m
+++ /dev/null
@@ -1,15 +0,0 @@
-
-function handle = plotVectors(ref, points, color)
-	% TODO: add check on dimensions
-	t = ref(1:2);
-	points2 = rot(ref(3)) * points;
-	
-	%size(points)
-	%t
-	%repmat(t,1,size(points,2))
-	%size(repmat(t,1,size(points,2)))
-	%size(points2)
-	
-	points2 = points2 + repmat(t,1,size(points,2));
-	handle = plot(points2(1,:),points2(2,:),color);
-
diff --git a/misc/matlab/vis/plot_xyt.m b/misc/matlab/vis/plot_xyt.m
deleted file mode 100644
index ef0591a966b2318934b461a9a465d297fbbba803..0000000000000000000000000000000000000000
--- a/misc/matlab/vis/plot_xyt.m
+++ /dev/null
@@ -1,126 +0,0 @@
-
-function fs = plot_xyt(m) 
-	
-		p.datasets = m.datasets;
-		p.covariances = m.covariances;
-		p.scale = diag([1000 1000 180/pi]);
-		p.format = m.format;
-		p.legend = m.legend;
-		
-	
-		p.use_legend = true;
-		
-		p.select = [1 0 0; 0 1 0];;
-		p.equal = true;
-		p.xlabel = 'x (mm)';
-		p.ylabel = 'y (mm)';
-		p.title = sprintf('%s x, y',m.title);
-		p.filename = sprintf('%s_xy.%s',m.prefix,m.extension);
-		f1= draw_data_single(p);
-		
-		p.use_legend = false;
-		
-		p.select = [1 0 0; 0 0 1];
-		p.equal = false;
-		p.xlabel = 'x (mm)';
-		p.ylabel = '\theta (deg)';
-		p.title = sprintf('%s x, \\theta',m.title);
-		p.filename = sprintf('%s_xt.%s',m.prefix,m.extension);
-		f2=draw_data_single(p);
-	
-		p.select = [0 0 1; 0 1 0];
-		p.equal = false;
-		p.xlabel = '\theta (deg)';
-		p.ylabel = 'y (mm)';
-		p.title = sprintf('%s \\theta, y',m.title);
-		p.filename = sprintf('%s_ty.%s',m.prefix,m.extension);
-		
-		f3=draw_data_single(p);
-	
-		fs=[f1 f2 f3];
-
-function f = draw_data_single(p)
-	f = figure;
-	
-	fsize = 7;
-	set(f,'Units','centimeters'); 
-	set(f,'Position',[0 0 fsize fsize]); 
-	set(f,'PaperUnits','centimeters'); 
-	set(f,'PaperPosition',[0 0 fsize fsize]); 
-	set(f,'PaperSize',[fsize fsize])
-		
-	hold on;
-	select = p.select;
-	scale = p.scale;
-		for i=1:size(p.datasets,2)
-			points = p.datasets{i}.points;
-			color = p.datasets{i}.color;
-			my_points(plot_points( select*scale*points, color ));
-		end
-		
-		for i=1:size(p.covariances,2)
-			mean = p.covariances{i}.mean;
-			cov  = p.covariances{i}.cov;
-			color = p.covariances{i}.color;
-			bold_lines(plotGauss2Db(select*scale*mean, ...
-			  select*scale*cov*scale'*select', color)); 
-		end
-		
-		if p.use_legend
-			l = legend(p.legend);
-			set(l, 'Orientation', 'vertical');
-			set(l, 'Location','NorthWest');
-			%get(l)
-			my_fonts(l);
-		end
-		
-		if p.equal
-			axis('equal');
-		end
-		
-		my_fonts(xlabel(p.xlabel));
-		my_fonts(ylabel(p.ylabel));
-		my_fonts_large(title(p.title));
-		my_fonts_small(gca);
-	
-		for i=1:size(p.covariances,2)
-			mean = p.covariances{i}.mean;
-			color = p.covariances{i}.color;
-			bold_lines(plot_cross(select*scale*mean,color));
-		end
-	
-		print(p.format,p.filename);
-		
-function res = plot_points(points, color)
-	res = plot(points(1,:),points(2,:),color);
-	
-function res = plot_cross(mean, color)
-		A = axis;
-		res(1) = plot([A(1) A(2)],[mean(2) mean(2)],color);
-		res(2) = plot([mean(1) mean(1)], [A(3) A(4)],color);
-		%res
-		%size(res)
-
-function bold_lines(h)
-	for i=1:size(h,2)
-		set(h(i), 'LineWidth', 2);	
-	end
-
-function my_fonts(h)
-	set(h, 'fontunits', 'points');
-	set(h, 'fontsize', 10);
-	set(h, 'fontname', 'Times');
-
-function my_fonts_large(h)
-	set(h, 'fontunits', 'points');
-	set(h, 'fontsize', 10);
-	set(h, 'fontname', 'Times');
-
-function my_fonts_small(h)
-	set(h, 'fontunits', 'points');
-	set(h, 'fontsize', 9);
-	set(h, 'fontname', 'Times');
-
-function my_points(h)
-	set(h,'MarkerSize',10);
-
diff --git a/misc/matlab/vis/plot_yasmine.m b/misc/matlab/vis/plot_yasmine.m
deleted file mode 100644
index 0bde3702102cf7512f0b0bac4cb970ecf5e33646..0000000000000000000000000000000000000000
--- a/misc/matlab/vis/plot_yasmine.m
+++ /dev/null
@@ -1,32 +0,0 @@
-function plot_yasmine(f, mmin, mmax)
-	
-
-	length = 0.5;
-	hold on
-	
-	% number of correspondences
-	Ktot = size(f.result.s, 2);
-
-	drawn=0;
-	for k=1:Ktot
-	%	if f.result.s{k}.m  > mmax 
-	%		continue
-	%	end
-		
-		drawn = drawn + 1;
-		
-		T = f.result.s{k}.T;
-		alpha = f.result.s{k}.alpha;
-		
-		p1 = T + vers(alpha-pi/2) * length;
-		p2 = T + vers(alpha+pi/2) * length;
-		
-		reference = f.ts.laser_ref.estimate;
-		plotVectors(reference, [p1 p2], 'b-');
-		
-	end
-	
-	fprintf('drawn %d/%d\n', drawn, Ktot);
-	
-function v = vers(theta)
-	v = [cos(theta) sin(theta)]';
diff --git a/misc/rsm/carmen2pic.rb b/misc/rsm/carmen2pic.rb
deleted file mode 100644
index a29be0c1465f2a779396fdd987dc0c77768e8881..0000000000000000000000000000000000000000
--- a/misc/rsm/carmen2pic.rb
+++ /dev/null
@@ -1,168 +0,0 @@
-#!/usr/bin/env ruby
-require 'rsm'
-require 'logreader'
-require 'stringio'
-
-class LaserData
-	def valid_cartesian_points
-		(0..nrays-1).map{|i|
-			valid[i] ? p[i] : nil
-		}.compact
-	end
-end
-
-module MathUtils
-	def transform_vector(v, x)
-		v.map{|p| transform(p,x) }
-	end
-	
-	def compute_bbox(points)
-		points = points.compact
-		bmin = Vector[points[0][0],points[0][1]].col
-		bmax = Vector[points[0][0],points[0][1]].col
-		points.each {|p|
-			bmin[0] = min(bmin[0], p[0])
-			bmin[1] = min(bmin[1], p[1])
-			bmax[0] = max(bmax[0], p[0])
-			bmax[1] = max(bmax[1], p[1])
-		}
-		return bmin, bmax
-	end
-end
-
-require 'cairo'
-
-class Canvas 
-	def initialize(output, bbox_min, bbox_max)
-		@bmin = bbox_min
-		@bmax = bbox_max
-
-		format = Cairo::FORMAT_ARGB32
-		@width = 500
-		@height = @width *( @bmax[1]-@bmin[1])/( @bmax[0]-@bmin[0])
-		@output = StringIO.new
-		surface = Cairo::PDFSurface.new(output, @width, @height)
-		@cr = Cairo::Context.new(surface)
-
-		# fill background with white
-		@cr.set_source_rgba(1.0, 1.0, 1.0, 0.8)
-		@cr.paint
-
-		@cr.set_line_join(Cairo::LINE_JOIN_MITER)
-		@cr.set_line_width 1
-		
-		@colors = [ 
-			[1,0,0],[0.8,0,0],[0.7,0,0],[0.6,0,0],[0.5,0,0],
-			[0,1,0],[0,0.8,0],[0,0.7,0],[0,0.6,0],[0,0.5,0],
-		]
-		@current_color = 0
-		next_color
-	end
-	
-	def save
-		@cr.show_page
-
-	 	@cr.target.finish  
-#		@cr.target.write_to_png(file)		
-	end
-	
-	def w2b(p)
-		x = (p[0] - @bmin[0]) / (@bmax[0]-@bmin[0]) * @width
-		y = (p[1] - @bmin[1]) / (@bmax[1]-@bmin[1]) * @height
-		[x, y]
-	end
-	
-	def move_to(p)
-		buf = w2b(p)
-		@cr.move_to(buf[0],buf[1])
-	end
-
-	def line_to(p)
-		buf = w2b(p)
-		@cr.line_to(buf[0],buf[1])
-	end
-	
-	def next_color
-		@current_color = (@current_color+1) % @colors.size
-		rgb = @colors[@current_color]
-		@cr.set_source_rgb(rgb[0],rgb[1],rgb[2])
-	end
-	
-	def write_points(points)
-		return if points.empty?
-		@cr.set_line_cap(Cairo::LINE_CAP_ROUND)
-		@cr.set_line_width(1)
-		next_color
-		move_to(w2b(points[0]))
-		points.each do |p|
-			b = w2b(p)
-#			@cr.arc( b[0], b[1], 1, 0, 2*M_PI);
-#			@cr.fill
-			@cr.move_to(b[0],b[1])
-			@cr.close_path
-			@cr.stroke
-		end
-	end
-	def cr; @cr end
-end
-
-def carmen2pic(input,output_file)
-	include MathUtils
-	
-	count = 0; interval = 10
-	lds = []
-	until input.eof? 
-		ld = LogReader.shift_laser(input)
-		
-		break if ld.nil? 
-		
-		if count%interval == 0
-			puts count
-			lds.push ld
-		end
-		count+=1
-	end
-	
-	puts "Read #{lds.size} laser scans."
-	
-	bbox_min = nil
-	bbox_max = nil
-	all_points = []
-	
-	lds.each_index do |i|
-		ld = lds[i]
-		ld.compute_cartesian
-		points = ld.valid_cartesian_points
-		points = transform_vector(points, ld.estimate)
-		bbox_min, bbox_max = compute_bbox(points+[bbox_min,bbox_max]) 
-		all_points << points
-	end
-	puts "bbox: #{bbox_min.row} to #{bbox_max}"
-	
-	output = File.open(output_file ,"wb")
-	ca = Canvas.new(output, bbox_min, bbox_max)
-
-	ca.cr.set_line_width(2)
-	ca.move_to(lds[0].estimate)
-		lds.each_index do |i|
-			ca.line_to(lds[i].estimate)
-		end
-	ca.cr.stroke
-
-	lds.each_index do |i|
-		ca.write_points(all_points[i])
-	end
-	
-	ca.save()
-end
-
-if ARGV.size < 2
-	puts "carmen2pic <input> <output> "
-	exit 1
-end
-
-
-input = File.open ARGV[0]
-output_file = ARGV[1]
-
-carmen2pic(input,output_file)
diff --git a/misc/rsm/fix_json.rb b/misc/rsm/fix_json.rb
deleted file mode 100644
index 6b1414f55b1e2bae20f51c663ee8b4fbf08fea43..0000000000000000000000000000000000000000
--- a/misc/rsm/fix_json.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-require 'strscan'
-
-require 'json/pure'
-
-# This allows to parse multiple objects from the same stream.
-
-class Float
-
-   def to_json(*) 
-		return 'null' if nan?
-		if not inf = infinite?
-			return to_s
-		else
-			return to_s.to_json
-		end
-	end
-end
-
-module JSON
-  module Pure
-
-	class Parser
-     def initialize(source, opts = {})
-       super
-       if !opts.key?(:max_nesting) # defaults to 19
-         @max_nesting = 19
-       elsif opts[:max_nesting]
-         @max_nesting = opts[:max_nesting]
-       else
-         @max_nesting = 0
-       end
-       @create_id = JSON.create_id
-       reset
-     end
-
-
-     # Parses the current JSON string _source_ and returns the complete data
-     # structure as a result.
-     def parse
-       obj = nil
-       until eos? || obj
-         case
-         when scan(OBJECT_OPEN)
-           obj and raise ParserError, "source '#{peek(20)}' not in JSON!"
-           @current_nesting = 1
-           obj = parse_object
-         when scan(ARRAY_OPEN)
-           obj and raise ParserError, "source '#{peek(20)}' not in JSON!"
-           @current_nesting = 1
-           obj = parse_array
-         when skip(IGNORE)
-           ;
-         else
-           raise ParserError, "source '#{peek(20)}' not in JSON!"
-         end
-       end
-       obj or raise ParserError, "source did not contain any JSON!"
-       obj
-     end
-
-	end
-
-  end
-end
-
diff --git a/misc/rsm/json_utils.rb b/misc/rsm/json_utils.rb
deleted file mode 100644
index 2e02c93fc3665b0024d0ec3782735fb578f67909..0000000000000000000000000000000000000000
--- a/misc/rsm/json_utils.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'fix_json'
-
-def read_all_objects(string, progress_string=nil)
-	a = []
-	j = JSON::Pure::Parser.new(string)
-	while true
-		j.scan(/\s*/) 
-		break if j.eos?
-		begin
-			a.push j.parse
-			$stderr.write progress_string if progress_string
-		rescue Exception => e
-			$stderr.puts "After #{a.size} objects: #{e}" 
-			return a
-		end
-	end	
-	a
-end
diff --git a/misc/rsm/lib/gpc.rb b/misc/rsm/lib/gpc.rb
deleted file mode 100644
index f48324755dbff2960b93e00f64dc8df4397d7511..0000000000000000000000000000000000000000
--- a/misc/rsm/lib/gpc.rb
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/usr/bin/env ruby
-
-# GPC: A library for the solution of General Point Correspondence problems.
-# Copyright (C) 2006 Andrea Censi (andrea at censi dot org)
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-require 'gsl'
-
-module GPC
-	include Math
-	include GSL
-
-	class PointCorrespondence
-		attr_accessor :p
-		attr_accessor :q
-		attr_accessor :C
-	end
-	
-	DEBUG = false
-
-	def GPC.gpc(corr)
-
-		# First we put the problem in a quadratic+constraint form.
-		bigM = Matrix.alloc(4, 4).set_zero
-		   g = Matrix.alloc(4, 1).set_zero
-
-		for c in corr
-			bigM_k = Matrix[[1, 0,  c.p[0], -c.p[1]],
-			                [0, 1,  c.p[1],  c.p[0]]]
-			
-			bigM = bigM + 2*bigM_k.trans * c.C * bigM_k;
-			g = g - 2 * (c.q.trans.to_m(1,2) * c.C * bigM_k).trans;
-			if DEBUG
-				puts "M_k=\n#{bigM_k}\n"
-				puts "q_k=\n#{c.q}\n"
-				puts "C_k=\n#{c.C}\n"
-				puts "now M is \n#{bigM}\n"
-				puts "now g is \n#{g}\n"
-			end
-		end
-		
-		if DEBUG
-			puts "M=#{bigM}"
-		end
-		
-		# Partition M in 4 submatrixes:
-		# M = [A B; B' D]
-		mA = bigM.submatrix(0,0,2,2)
-		mB = bigM.submatrix(0,2,2,2)
-		mD = bigM.submatrix(2,2,2,2)
-		
-		mS = mD - mB.trans * mA.inv * mB;
-		mSa = mS.inv * mS.det;
-
-		if DEBUG
-			puts "mA=#{mA}"
-			puts "mB=#{mB}"
-			puts "mD=#{mD}"
-			puts "mS=#{mS}"
-			puts "mSa=#{mSa}"
-		end
-
-		# split g in two
-		g1 = g.submatrix(0,0,2,1)
-		g2 = g.submatrix(2,0,2,1)
-
-		p2 = g1.trans*mA.inv*mB*4*mB.trans*mA.inv*g1 -
-		     2*g1.trans*mA.inv*mB*4*g2 + g2.trans*4*g2
-		p1 = g1.trans*mA.inv*mB*4*mSa*mB.trans*mA.inv*g1 -
-		     2*g1.trans*mA.inv*mB*4*mSa*g2 +g2.trans*4*mSa*g2
-		p0 = g1.trans*mA.inv*mB*mSa*mSa*mB.trans*mA.inv*g1 -
-		     2*g1.trans*mA.inv*mB*mSa*mSa*g2 + g2.trans*mSa*mSa*g2
-
-
-		p_lambda = Poly[mS[0,0]*mS[1,1]-mS[1,0]*mS[0,1],  2*mS[0,0]+2*mS[1,1],  4]
-
-
-		p7 = Poly.alloc(p0[0,0],p1[0,0],p2[0,0])
-		ptot = p7 - p_lambda * p_lambda
-
-		r = ptot.roots
-		lambda = 0
-		## Find greatest real root
-		for i in 0..3
-			root = r[i]
-			next if root.im!=0 
-			lambda = [lambda, root.real].max
-		end
-
-		if DEBUG
-			puts "p = [#{p2} #{p1} #{p0}]"
-			puts "p_l = [#{p_lambda[2]} #{p_lambda[1]} #{p_lambda[0]}]"
-			q = p_lambda * p_lambda;
-			puts "p_l*p_l = #{q[4]}*x^4 +#{q[3]}*x^3 +#{q[2]}*x^2 +#{q[1]}*x +#{q[0]} "
-			puts "ptot = #{ptot}"
-			puts "roots = #{r[0]} #{r[1]} "
-			puts "lambda = #{lambda}"
-		end
-
-		mW = Matrix[[0,0,0,0],
-		           [0,0,0,0],
-		           [0,0,1,0],
-		           [0,0,0,1]]
-		x = -(bigM + 2 * lambda * mW).inv * g;
-		theta = Math.atan2(x[3,0],x[2,0]);
-
-		return Vector.alloc(x[0,0],x[1,0],theta).col
-	end
-
-end
-
diff --git a/misc/rsm/logreader.rb b/misc/rsm/logreader.rb
deleted file mode 100755
index b4493b689ffb2643a8b25048656a586d1039dcd9..0000000000000000000000000000000000000000
--- a/misc/rsm/logreader.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require 'rsm_laserdata'
-
-class LogReader
-	QUIET = true
-	ShowProgress = true
-	
-	def LogReader.read_log(io)
-		events = Array.new 
-		io.each_line do |l|
-			e = convert_line(l)
-			events.push(e) if not e.nil?
-			if ShowProgress then $stderr.write '.' end
-		end
-		events
-	end
-	
-	def LogReader.shift_laser(io)
-		until io.eof?
-			e = convert_line(io.gets)
-			return e if e.kind_of? LaserData
-		end
-		nil
-	end
-	
-	def LogReader.convert_line(l)
-		type = l.split[0]
-		
-		case type
-			when 'FLASER' 
-				$stderr.write 'l'
-				ld = LaserData.convert_line(l);
-				return ld
-			else
-				unless QUIET then $stderr.puts "Type '#{type}' not found." end
-				return nil
-		end
-	end
-	
-end
-
-#LogReader.read_log($stdin)
diff --git a/misc/rsm/matlab_to_rbgsl.txt b/misc/rsm/matlab_to_rbgsl.txt
deleted file mode 100644
index 27d1c12458e6535b7c316a2e050f5a7f4c08d3c2..0000000000000000000000000000000000000000
--- a/misc/rsm/matlab_to_rbgsl.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-I vettori sono righe, usare col.
-
-Bug bug_gsl.rb
-
-Si conta da 0 e non da 1
\ No newline at end of file
diff --git a/misc/rsm/mt/mt.rb b/misc/rsm/mt/mt.rb
deleted file mode 100755
index a869bc8d167a175df19685c24f6e85fb04ae358c..0000000000000000000000000000000000000000
--- a/misc/rsm/mt/mt.rb
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'rsm_sm_loop'
-
-
-class Panorama < LaserData
-	SIGMA = 0.005
-	COMP_THRESHOLD = SIGMA * 5
-	SCALE = 1
-	
-	attr_accessor :parent
-	
-	def angle2ray(phi)
-		i = (phi-@min_theta) / (@max_theta-@min_theta) * @nrays
-		i = i.round 
-		i < 0 || i >= @nrays ? nil : i
-	end
-	
-	def initialize(estimate, odometry)
-		super(721)
-		
-		@min_theta = -Math::PI
-		@max_theta = +Math::PI
-		for i in 0..@nrays-1
-			@theta[i] = @min_theta + (@max_theta-@min_theta) *
-			 	i / (@nrays-1);
-		end
-		@estimate = estimate.clone
-		@odometry = odometry.clone
-	end
-
-	def merge(ld)
-		count = 0
-		ld.compute_cartesian
-		# pose of second scan in first scan's frame
-		diff = pose_diff(ld.estimate, self.estimate)
-		for i in 0 ... ld.nrays-1
- 			if not ld.valid? i
-#				$stderr.puts "Skipping #{i}"
-				next
-			end
-			# coordinates of point i of second scan 
-			# relative to first scan frame
-			p = transform(ld.p[i], diff)
-			
-			phi = atan2(p[1], p[0])
-			rho = p.nrm2
-			
-			if j = angle2ray(phi)
-				old_rho = @readings[j]
-				new_rho = nil
-				
-				if old_rho.nan? 
-					@readings[j] = rho
-					@cov_readings[j] = SIGMA**2;
-					@valid[j] = true
-#					$stderr.puts "#{i}: Init #{j}"
-					count += 1
-					next
-				end
-				
-				compatible = (rho-old_rho).abs < COMP_THRESHOLD
-				if compatible
-					
-					dist = sin( (phi-@theta[j]).abs ) * rho
-					
-					cov_rho = (SIGMA**2) + (dist**2) / SCALE
-					cov_old_rho = @cov_readings[j]
-					cov_new_rho = 1 /( 1 / cov_old_rho + 1 / cov_rho)
-					new_rho = cov_new_rho * (old_rho / cov_old_rho + rho / cov_rho);
-
-					@readings[j] = new_rho
-					@cov_readings[j] = cov_new_rho
-					count += 1
-				end
-#				$stderr.puts "#{i} #{j}, #{old_rho} => #{new_rho}"
-			else
-#				$stderr.puts "#{i} no index for phi = #{phi}"
-			end
-		end
-		count
-	end
-	
-end
-
-
-
-def quick_match(scan_matcher_klass, params, ref, sens, guess)
-	sm = scan_matcher_klass.new
-	sm.params = params
-	sm.params = params 
-	sm.params[:laser_ref] = ref;
-	sm.params[:laser_sens] = sens;
-	sm.params[:firstGuess] = guess
-	res = sm.scan_matching
-	res
-end
-
-def go_mt
-	if ARGV.size < 3
-		puts "sm <SCANMATCHER> '[]' <input> <output> "
-		exit 1
-	end
-
-	scan_matcher_klass = eval ARGV[0]
-	scan_list = eval ARGV[1]
-
-	#puts "Scan_list = #{scan_list}"
-
-	input = File.open ARGV[2]
-	output = File.open(ARGV[3], "w")
-	output_scans = File.open(File.basename(ARGV[3]) + "_scans.log", "w")
-	
-	params = standard_parameters
-	
-	include MathUtils
-
-	first = LogReader.shift_laser(input)
-	first.estimate = first.odometry
-	panorama = Panorama.new(first.estimate, first.odometry)
-	panorama.merge(first)
-	laser_ref = first
-
-	results = []
-	count = 0
-	
-	until input.eof?
-		laser_sens = LogReader.shift_laser(input)
-		
-		res = quick_match(scan_matcher_klass, params, laser_ref, laser_sens, 
-			pose_diff(laser_sens.odometry, laser_ref.odometry))
-		break if not res[:valid]
-		error = res[:error]
-		
-		puts "mt: match laser_ref #{res[:nvalid]} #{res[:avg_error] }   #{pv(res[:x])} "
-
-		laser_sens.estimate = oplus(laser_ref.estimate, res[:x])
-	
-		n = panorama.merge(laser_sens)
-
-		if n < 200
-			if parent = panorama.parent
-				guess = pose_diff(panorama.estimate, parent.estimate);
-				res = quick_match(scan_matcher_klass, params, parent, panorama, 
-					guess)
-				if res[:valid]
-					delta = pose_diff(res[:x], guess)
-					puts "mt: Match with parent: #{res[:avg_error]} #{res[:nvalid]} #{pv(delta)}"
-					if (res[:avg_error] < 1) && (res[:nvalid] > 150)
-						puts "mt: parent-correct!"
-						panorama.estimate = oplus(panorama.estimate, delta)
-						laser_sens.estimate = oplus(laser_sens.estimate, delta)
-					end
-				end
-			end
-			
-			output.puts panorama.to_json
-			new_panorama = Panorama.new(laser_sens.estimate, laser_sens.odometry)
-			new_panorama.parent = panorama
-			new_panorama.merge(laser_sens)
-			panorama = new_panorama
-			count = 0
-			puts "mt: new panorama ##{count}: error #{error}"
-		else
-			puts "mt: continuing ##{count}: error #{error}"
-		end
-		output_scans.puts laser_sens.to_json
-		
-		puts "mt: merged #{n}"
-
-		laser_ref = laser_sens
-		count += 1
-	end
-	
-end
-
-
-go_mt
-	
-
diff --git a/misc/rsm/mt/mt.sh b/misc/rsm/mt/mt.sh
deleted file mode 100755
index a0042deaf64b4ef46c2011b4e39a3922c351700e..0000000000000000000000000000000000000000
--- a/misc/rsm/mt/mt.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-inl=../../../experiments/mbicp_tro_experiment/laserazosSM3.log
-
-ruby -I.. -rrubygems -rsm -rsm_icp mt.rb Sm::ICPC '[]' $inl out.log 2>&1
diff --git a/misc/rsm/options.rb b/misc/rsm/options.rb
deleted file mode 100644
index 09417e6f994b1c980ab3f15d7324a88cdf9266dd..0000000000000000000000000000000000000000
--- a/misc/rsm/options.rb
+++ /dev/null
@@ -1,113 +0,0 @@
-
-require 'ostruct'
-require 'optparse'
-
-class Options
-	Option = Struct.new(:name, :default, :description, :value)
-		
-	def initialize
-		@hash = {}
-		@order = []
-	end
-	
-	def add(name, default, description)
-		@hash[name] = Option.new(name, default, description, nil)
-		@order.push @hash[name]
-	end
-	
-	
-	def populate(opts)
-
-		opts.on("--config FILE", "Load config from file") do |file|
-			load_config_from_file(file)
-		end
-
-		opts.on("--config_dump", "Dump config on stdout") do 
-			$stdout.puts self.config_dump
-			exit 0
-		end
-
-		@order.each do |o|
-			s = o.default.inspect.ljust(25)
-			opts.on("--#{o.name} VALUE", "#{s} #{o.description}") do |s|
-				value = s
-				begin value = eval(s) 
-				rescue SyntaxError => ex
-				rescue => ex
-					end
-				
-				@hash[o.name].value = value
-			end
-		end
-			
-	end
-	
-	def get_ostruct
-		r = {}
-		@hash.each do |k, v| 
-			r[k] = v.value || v.default
-		end
- 		OpenStruct.new r
-	end
-	
-	def config_dump
-		s = ""
-		max_size = @hash.keys.map{|x|x.to_s.size}.max + 2
-		for o in @order
-			s += o.name.to_s.ljust(max_size) +  (o.value || o.default).inspect + "\n"
-		end
-		s
-	end
-	
-	RegComment = /^\s*\#/ 
-	RegOption  = /^\s*(\w+)\s*=?\s*(.+)$/ 
-	RegLoad    = /^\s*(?:<|source)\s*(.*)$/
-
-	def load_config_from_file(file)
-		load_config_from_string(File.open(file).read, File.dirname(file))
-	end
-	
-	def load_config_from_string(string, dir)
-		string.split("\n").each do |line|
-			next if (line.strip.size == 0) || line =~ RegComment
-			if m = RegOption.match(line)
-				name = m[1].to_sym
-				value = m[2].strip
-
-				begin
-					value = eval(value)
-				rescue 
-				end
-				
-				if o = @hash[name]
-					o.value = value
-#					$stderr.puts "#{name} = #{value}"
-				else
-					$stderr.puts "Unknown key #{name.inspect} (#{@hash.keys.inspect})"
-				end
-			elsif m = RegLoad.match(line)
-				filename = m[1]
-				filename = File.expand_path(File.join(dir, filename))
-				read_conf(File.open(filename), File.dirname(filename))
-			else
-				$stderr.puts "Line #{line.inspect} is malformed"
-				exit -1
-			end
-		end
-	end
-	
-	def parse_cmd_line!
-		opt = OptionParser.new do |opts|
-			self.populate(opts)
-		end
-
-		begin  opt.parse!
-		rescue OptionParser::InvalidOption=>e
-			$stderr.puts e
-			$stderr.puts opt
-			exit -1
-		end
-	end
-	
-
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm.rb b/misc/rsm/rsm.rb
deleted file mode 100644
index 8e9a7dc0c790449df8c954332a2630cb05bb9b81..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-#require 'gsl'
-
-require 'rsm_journal'
-require 'rsm_mathutils'
-require 'rsm_misc'
-require 'rsm_orientation'
-require 'rsm_laserdata'
-require 'rsm_laserdata_ops'
-require 'rsm_gpm'
-require 'rsm_gpmicp'
-require 'rsm_icp'
-
diff --git a/misc/rsm/rsm_clustering.rb b/misc/rsm/rsm_clustering.rb
deleted file mode 100644
index f4c0514b0ca39c188ed0212adb17e860ddda77eb..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_clustering.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require 'rsm'
-
-class LaserData
-	
-def simple_clustering(threshold)
-	count = 0;
-	last_reading = nil;
-	for i in 0..nrays-1
-		if not valid? i
-			@cluster[i] = -1
-			next
-		end
-
-		if (not last_reading.nil?) and
-			(last_reading-@readings[i]).abs > threshold
-			count += 1
-		end
-
-		@cluster[i] = count;
-		last_reading = @readings[i]
-	end
-end
-
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_gpm.rb b/misc/rsm/rsm_gpm.rb
deleted file mode 100644
index be5e5a59ff6516060d684f1aea863aaa8dee0be8..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_gpm.rb
+++ /dev/null
@@ -1,195 +0,0 @@
-require 'rsm'
-require 'rsm_clustering'
-require 'rsm_orientation'
-
-class GPM
-	include MathUtils
-	include Math
-	include Journal
-	attr_accessor :params
-
-	def name; "GPM" end
-	
-	def scan_matching 
-		laser_ref = params[:laser_ref]
-		laser_sens = params[:laser_sens]
-		u = params[:firstGuess]
-		
-		laser_ref.compute_cartesian
-		laser_ref.simple_clustering(params[:clustering_threshold])
-		laser_ref.compute_orientation(params[:orientation_neighbourhood],params[:sigma])
-
-		laser_sens.compute_cartesian		
-		laser_sens.simple_clustering(params[:clustering_threshold])
-		laser_sens.compute_orientation(params[:orientation_neighbourhood],params[:sigma])
-
-		journal_laser 'laser_ref', laser_ref
-		journal_laser 'laser_sens',laser_sens
-		journal "odometry #{to_j(u)}"
-#		journal "odometry_cov #{to_j(params[:firstGuessCov])}"
-		
-		max_angular_correction_deg = params[:max_angular_correction_deg]
-		max_linear_correction =params[:max_linear_correction]
-		
-		theta_bin_size = deg2rad(5)
-		extend_range = deg2rad(15)
-		# Find multiple solutions for theta
-		hist = GSL::Histogram.alloc((2*PI/theta_bin_size).ceil, -PI, PI)
-		
-		ght_only_theta(u, max_linear_correction, max_angular_correction_deg, hist)
-		
-		hist.fprintf($stdout)
-		# find mode 
-		max_bin = hist.max_bin
-		new_range = hist.get_range(max_bin)
-		new_range[0] += -extend_range
-		new_range[1] += +extend_range
-		puts "New extension: #{rad2deg(new_range[0])}° to #{rad2deg(new_range[1])}°"
-		u2 = u.clone; u2[2] = 0.5*(new_range[1]+new_range[0]);
-		
-		newAngularCorrectionDeg =  rad2deg(0.5*(new_range[1]-new_range[0]))
-		matches2 = ght(u2, max_linear_correction,newAngularCorrectionDeg)
-		puts "Found #{matches2.size} matches."
-		result = solve_lse(matches2, u2, 6)
-		puts "Result #{pv(result)}."
-
-		
-		
-		journal "iteration 0"
-		journal     "x_old #{to_j(u)}"
-		journal "iteration 1"
-		journal     "x_old #{to_j(u2)}"
-		journal "iteration 2"
-		journal     "x_old #{to_j(result)}"
-		
-		
-		res = Hash.new
-		res[:x] = result
-		res[:iterations] = 0
-		#res[:dx_dy1] = dx_dy1
-		#res[:dx_dy2] = dx_dy2
-		
-		return res
-	end	
-	
-	def solve_lse(matches, x_old, iterations)		
-		iterations.times do 
-			z = Matrix.alloc(3,1); z.set_all(0);
-			w = Matrix.alloc(3,3); w.set_all(0);
-			for m in matches
-				v_alpha = vers(m.alpha)
-				# Y = L x
-				y = Matrix[ [v_alpha.trans * m.t],
-								[m.theta]];
-				l = Matrix[ 
-					[ v_alpha[0], v_alpha[1], 0],
-					[0, 0, 1]];
-				weight = m.weight * exp(-(m.t-x_old[0,1]).nrm2**2 - 5 * (m.theta-x_old[2]).abs**2)
-				z = z + weight * l.trans * y;
-				w = w + weight * l.trans * l;
-			end
-			x = w.inv * z
-			x_old = Vector.alloc(x[0,0],x[1,0],x[2,0])
-			puts "Iteration: #{pv(x_old)}"
-		end
-		x_old
-	end
-	
-	
-	
-	
-	class Match
-		attr_accessor :t
-		attr_accessor :theta
-		attr_accessor :alpha
-		attr_accessor :weight
-	end
-	
-	
-	def ght(x0,max_linear_correction,max_angular_correction_deg)
-		puts "ght: x0=#{x0}, limits: #{max_linear_correction}, #{max_angular_correction_deg}°"
-		laser_ref = params[:laser_ref];
-		laser_sens = params[:laser_sens];
-		
-		t0 = Vector[x0[0],x0[1]]
-		matches = Array.new
-		for i in 0..laser_sens.nrays-1
-			next if not laser_sens.alpha_valid? i
-
-			p_i = laser_sens.p[i]
-			alpha_i = laser_sens.alpha[i]
-
-			from, to = possible_interval(p_i, laser_ref, 
-				max_angular_correction_deg, max_linear_correction)
-			
-			for j in from..to
-				next if not laser_ref.alpha_valid? j
-				
-				p_j = laser_ref.p[j]
-				alpha_j = laser_ref.alpha[j]
-
-				theta = angleDiff(alpha_j, alpha_i)
-				
-				next if (theta-x0[2]).abs > deg2rad(max_angular_correction_deg)
-				
-				t = p_j - rot(theta) * p_i;
-				
-				next if (t-t0).nrm2 > max_linear_correction
-				
-				m = Match.new
-				m.t = t; 
-				m.theta=theta;
-				m.alpha = alpha_j
-				w = laser_ref.cov_alpha[j] + laser_sens.cov_alpha[i]
-				m.weight = 1/w
-				matches.push m
-			end 
-			
-		end 
-
-		matches
-	end
-
-	def ght_only_theta(x0,max_linear_correction,max_angular_correction_deg,hist)
-		laser_ref = params[:laser_ref];
-		laser_sens = params[:laser_sens];
-
-		t0 = Vector[x0[0],x0[1]]
-		for i in 0..laser_sens.nrays-1
-			next if not laser_sens.alpha_valid? i
-
-			p_i = laser_sens.p[i]
-			alpha_i = laser_sens.alpha[i]
-
-			from, to = possible_interval(p_i, laser_ref, 
-				max_angular_correction_deg, max_linear_correction)
-			
-			for j in from..to
-				next if not laser_ref.alpha_valid? j
-				
-				p_j = laser_ref.p[j]
-				alpha_j = laser_ref.alpha[j]
-
-				theta = angleDiff(alpha_j, alpha_i)
-				
-				next if (theta-x0[2]).abs > deg2rad(max_angular_correction_deg)			
-								
-				t = p_j - rot(theta) * p_i;
-				
-				next if (t-t0).nrm2 > max_linear_correction
-				
-				hist.increment(theta)
-			end 
-			
-		end 
-	end
-
-end
-
-
-
-
-
-
-
-
diff --git a/misc/rsm/rsm_gpmicp.rb b/misc/rsm/rsm_gpmicp.rb
deleted file mode 100644
index ade8636761f137f6bb086e961e6d87d2f6b3a940..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_gpmicp.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-require 'sm_icp'
-require 'sm_gpm'
-
-class GPM_then_ICP
-	attr_accessor :params
-	
-	def initialize
-		@params = Hash.new
-		@journal = nil
-	end
-	
-	def name
-		'GPM+ICP'
-	end
-	
-	def journal_open(file)
-		@journal = file
-	end
-	
-	def scan_matching
-		gpm = Sm::GPMC.new
-		gpm.params = params
-		if not @journal.nil?
-			gpm.journal_open(@journal+"_gpm")
-		end
-		
-		res_gpm =gpm.scan_matching 
-		
-		if not res_gpm[:valid]
-			$stderr.puts "GPM was not successful"
-			return res_gpm
-		end
-		gpm_x = res_gpm[:x]
-			
-		p res_gpm
-		puts "GPM_then_ICP: gpm res is #{pv(gpm_x)}"
-		icpc = Sm::ICPC.new
-		icpc.params = params;
-		icpc.params[:firstGuess] = gpm_x
-
-		if not @journal.nil?
-			puts "opening"
-			icpc.journal_open(@journal+"_icp")
-		end
-		
-		res = icpc.scan_matching;
-
-		res
-	end
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_icp.rb b/misc/rsm/rsm_icp.rb
deleted file mode 100644
index d147d264882664c7196c608c23444d528cc03bd5..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_icp.rb
+++ /dev/null
@@ -1,174 +0,0 @@
-
-require 'rsm'
-require 'rsm_icp_corr_dumb'
-require 'rsm_icp_corr_tricks'
-require 'rsm_icp_cov_numeric'
-require 'rsm_icp_cov_exact'
-require 'lib/gpc.rb'
-
-class ICP
-	include GSL
-	include MathUtils	
-	include Journal
-	include Math
-	
-	attr_accessor :params
-	
-	def initialize
-		@params = standard_parameters
-	end
-
-	def name; "ICP" end
-		
-	def scan_matching
-		laser_ref = params[:laser_ref]
-		laser_sens = params[:laser_sens]
-		
-		laser_ref.compute_cartesian
-		laser_ref.simple_clustering(params[:clustering_threshold])
-		laser_ref.compute_orientation(params[:orientation_neighbourhood],params[:sigma])
-
-		laser_sens.compute_cartesian		
-		laser_sens.simple_clustering(params[:clustering_threshold])
-		laser_sens.compute_orientation(params[:orientation_neighbourhood],params[:sigma])
-		
-		laser_ref.create_jump_tables
-		
-		journal_laser 'laser_ref', laser_ref 
-		journal_laser 'laser_sens', laser_sens 
-		journal "odometry #{to_j(params[:firstGuess])}"
-		journal "odometry_cov #{to_j(params[:firstGuessCov])}"
-
-		x_old = params[:firstGuess]
-		delta = Vector.alloc(0,0,0).col
-		
-		hashes = []
-		for iteration in 1..params[:max_iterations]
-			journal "iteration #{iteration}"
-			journal     "x_old #{to_j(x_old)}"
-
-			if params[:use_corr_tricks] == 1
-				find_correspondences_tricks(x_old)
-			else
-				find_correspondences(x_old)
-			end
-		
-			x_new = compute_next_estimate(x_old)
-
-			sigma = params[:sigma]
-			
-
-			journal     "x_new #{to_j(x_new)}"
-
-			new_delta = pose_diff(x_new, x_old)
-			journal     "delta #{to_j(new_delta)}"
-			
-			puts "#{iteration} x_old = #{pv(x_old)} x_new = #{pv(x_new)} "
-			
-			delta = new_delta
-		
-			if delta[0,1].nrm2 < params[:epsilon_xy] &&
-			   delta[2].abs < params[:epsilon_theta]
-				break
-			end
-			
-			hash = laser_sens.correspondences_hash
-			if hashes.include? hash
-				cycle = hashes.size-hashes.find{|h|h==hash}
-				puts "Found cycle lenght = #{cycle}"
-				break
-			else
-				hashes.push hash
-			end
-			
-			x_old = x_new
-		end
-		
-		
-		dx_dy1=Matrix.alloc(3,laser_ref.nrays)
-		dx_dy2=Matrix.alloc(3,laser_sens.nrays)
-
-
-		if 1 == params[:do_compute_covariance] 
-			dx_dy1, dx_dy2 = 
-				compute_covariance_exact(laser_ref, laser_sens,  x_new)
-
-		end
-
-		cov_x = (sigma*sigma) * dx_dy1 * (dx_dy1.trans) +
-		        (sigma*sigma) * dx_dy2 * (dx_dy2.trans);
-		
-		puts "sigma : #{sigma}"
-	#	puts "dx_dy1 : #{dx_dy1}"
-	#	puts "dx_dy2 : #{dx_dy2}"
-		puts "cov_x : #{cov_x}"
-		
-		if false
-		
-			num_dx_dy1, num_dx_dy2 = 
-				compute_covariance(laser_ref, laser_sens, x_new)
-		
-			num_cov_x = (sigma*sigma) * num_dx_dy1 * (num_dx_dy1.trans) +
-				        (sigma*sigma) * num_dx_dy2 * (num_dx_dy2.trans)
-
-			puts "num_dx_dy1 : #{num_dx_dy1}"
-			puts "num_dx_dy2 : #{num_dx_dy2}"
-			puts "num_cov_x : #{num_cov_x}"
-		end
-
-		res = Hash.new
-		res[:x] = x_new
-		res[:iterations] = iteration
-		res[:dx_dy1] = dx_dy1
-		res[:dx_dy2] = dx_dy2
-		
-		return res
-	end
-	
-	
-	# f should be a Proc
-#	def deriv(f, x,eps)
-#		(f.call(x+eps)-f.call(x-eps))/(2*eps)
-	#end
-	
-	def compute_next_estimate(x_old)
-		
-		laser_ref = params[:laser_ref];
-		laser_sens = params[:laser_sens];
-
-		## current distances
-		dists = []
-		@total_error = 0
-		corrs = []
-		for i in 0..laser_sens.nrays-1
-			next if not laser_sens.corr[i].valid
-			p_i  = laser_sens.p[i ]
-			p_j1 = laser_ref.p[laser_sens.corr[i].j1]
-			p_j2 = laser_ref.p[laser_sens.corr[i].j2]
-			
-			c2 = GPC::PointCorrespondence.new
-			c2.p = p_i
-			c2.q = p_j1
-			v_alpha = rot(PI/2) * (p_j1-p_j2)
-			v_alpha = v_alpha / v_alpha.nrm2
-			c2.C = v_alpha*v_alpha.trans
-		
-			corrs[i] = c2
-
-			dists[i] =
-				(transform(c2.p, x_old)-c2.q).trans * c2.C *
-				(transform(c2.p, x_old)-c2.q)
-			@total_error += dists[i]
-	#		dists[c.i] = sqrt(dists[c.i])
-		end
-
-#	journal_correspondences("candidate", correspondences)
-	journal_correspondences("correspondences", laser_sens.corr)
-	
-		corrs = corrs.compact
-		puts "Found #{corrs.size} correspondences."
-		x_new = GPC.gpc(corrs)
-		return x_new
-	end
-
-end
diff --git a/misc/rsm/rsm_icp_corr_dumb.rb b/misc/rsm/rsm_icp_corr_dumb.rb
deleted file mode 100644
index b9ece7ed159a808074f16d7e14fad439529e46f7..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_icp_corr_dumb.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-
-class ICP
-	
-	def find_correspondences(x_old)
-		correspondences = Array.new
-		max_angular_correction_deg = params[:max_angular_correction_deg]
-		max_linear_correction=params[:max_linear_correction]
-		maxDist = params[:max_correspondence_dist]
-		laser_ref = params[:laser_ref];
-		laser_sens = params[:laser_sens];
-
-		for i in 0..laser_sens.nrays-1
-			if not laser_sens.valid? i 
-				laser_sens.set_null_corr(i)
-				next
-			end
-
-			p_i = laser_sens.p[i]
-			p_i_w = transform(p_i, x_old);
-			p_i_w_nrm2 = p_i_w.nrm2
-
-		#	puts "p_i = #{p_i.trans}"
-			from, to = 
-				possible_interval(p_i_w, laser_sens, 
-					max_angular_correction_deg, max_linear_correction)
-
-			## Find best correspondence by considering all points in (from, to)
-			best_j = nil;
-			best_j_dist = 0;
-			$stderr.write "#{i}: " if DESCRIBE
-			for j in from..to
-				$stderr.write "#{j}" if DESCRIBE
-				if not laser_ref.valid? j
-					$stderr.write "N" if DESCRIBE
-					next
-				end
-
-				## Find compatible interval in the other scan. 
-				dist = (p_i_w - laser_ref.p[j]).nrm2
-		#		puts "j = #{j} p_j = #{p_j[j].trans}  dist = #{dist}"
-				if dist > maxDist
-					$stderr.write "M" if DESCRIBE
-					next
-				end
-				if (best_j.nil?) || (dist < best_j_dist)
-					$stderr.write "*" if DESCRIBE
-					best_j = j; best_j_dist = dist;
-				end
-			end
-
-			if best_j.nil?
-				$stderr.write " -> NO CORR. \n" if DESCRIBE
-			else	
-				$stderr.write " -> #{best_j} (#{i-best_j})\n" if DESCRIBE
-#				puts " #{i} -> #{best_j} (#{best_j_dist}) p_j = #{p_j[best_j].trans} p_i_w = #{p_i_w.trans}" 
-			end
-
-			#
-			## If no point is close enough, or closest point is one 
-			## of the extrema, then discard
-			if [nil, 0, laser_ref.nrays-1].include? best_j
-				laser_sens.set_null_corr(i)
-				next
-			else
-				## Find other point to interpolate. See if we are closed
-				## to prev or next
-		
-				# FIXME: here we assume that all points are valid
-				j_up = laser_ref.next_valid_up(best_j)
-				j_down = laser_ref.next_valid_down(best_j)
-				if j_up.nil? and j_down.nil?
-					laser_sens.set_null_corr(i)
-				else
-					other_j =
-					if j_up.nil? or j_down.nil?
-						[j_up,j_down].compact[0]
-					else	
-						p_prev = laser_ref.p[j_up]
-						p_next = laser_ref.p[j_down]
-						dist_prev = (p_prev-p_i_w).nrm2;
-						dist_next = (p_next-p_i_w).nrm2;
-						if dist_prev < dist_next then j_down else j_up end
-					end
-					laser_sens.corr[i].valid = true
-					laser_sens.corr[i].j1 = best_j
-					laser_sens.corr[i].j2 = other_j
-				end
-			end
-		end # i in first scan 
-	end
-
-	
-	
-	
-	
-	
-	
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_icp_corr_tricks.rb b/misc/rsm/rsm_icp_corr_tricks.rb
deleted file mode 100644
index 6cce4b3622f8299adcaa4ad7dbf9301e1214474f..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_icp_corr_tricks.rb
+++ /dev/null
@@ -1,292 +0,0 @@
-
-class ICP
-	DESCRIBE = false
-	VERIFY_EXACT = true
-	JUMP_TRICK = true
-	
-	# log search into journal
-	JOURNAL_SEARCH = false
-	
-	def find_correspondences_tricks(x_old)
-		# Some parameters
-		max_angular_correction_deg = params[:max_angular_correction_deg]
-		max_linear_correction=params[:max_linear_correction]
-		maxDist = params[:max_correspondence_dist]	
-
-		journal "param max_correspondence_dist #{maxDist}"
-		journal "param max_angular_correction_deg #{max_angular_correction_deg}"
-		journal "param max_linear_correction #{max_linear_correction}"
-
-		laser_ref = params[:laser_ref];
-		laser_sens = params[:laser_sens];
-
-		down_bigger  = laser_sens.down_bigger
-		up_bigger    = laser_sens.up_bigger
-		down_smaller = laser_sens.down_smaller
-		up_smaller   = laser_sens.up_smaller
-		
-		
-		# If true, we compare the result with the slow algorithm, for correctness
-		if VERIFY_EXACT
-			find_correspondences(x_old)
-			exact = laser_sens.corr.clone
-		end
-		
-		dbg_num_a1 = 0
-		last_best = nil
-		for i in 0..laser_sens.nrays-1
-			if not laser_sens.valid? i 
-				laser_sens.set_null_corr(i)
-				next
-			end
-		
-			p_i = laser_sens.p[i]
-			p_i_w = transform(p_i, x_old);
-			p_i_w_nrm2 = p_i_w.nrm2
-
-			from, to, start_cell = 
-				possible_interval(p_i_w, laser_sens,
-					max_angular_correction_deg, max_linear_correction)
-	
-			we_start_at = last_best.nil? ? start_cell : last_best
-		
-			we_start_at = [from, we_start_at].max
-			we_start_at = [to,   we_start_at].min
-		
-			up =  we_start_at+1; up_stopped = false;
-			down = we_start_at; down_stopped = false;
-			last_dist_up = -1; # first is up
-			last_dist_down = 0;	
-			best = nil
-			best_dist = 1000
-			
-			@js_string = ""
-			def js(s)
-				@js_string << s
-			#	$stderr.puts '>>>>>>>>>' if @js_string.size == 0
-			#	$stderr.write s
-			end
-			
-			js  "[from #{from} down #{down} mid #{start_cell} up #{up} to #{to}]"
-			
-			while (not up_stopped) or (not down_stopped)
-			
-				now_up =   up_stopped ? false : 
-				         down_stopped ? true  : last_dist_up < last_dist_down
-			
-				js(" |")
-			
-				if now_up then                                            js "up=#{up} " 
-					if up > to then                                       js "down:stop" 
-						up_stopped = true; next 
-					end
-					if laser_ref.p[up].nil? then                                  js "invalid" 
-						up+=1; next 
-					end
-			
-					dbg_num_a1 += 1
-					last_dist_up = (p_i_w - laser_ref.p[up]).nrm2
-					
-					if (last_dist_up<maxDist) && (last_dist_up < best_dist) then     js  "*" 
-						best = up; best_dist = last_dist_up;
-					end
-					
-					if JUMP_TRICK && (up>start_cell)
-						if laser_ref.readings[up] < p_i_w_nrm2 && 
-							(not up_bigger[up].nil?) then                  js " J+(#{up_bigger[up]})" 
-							up += up_bigger[up]
-							next
-						else
-						if laser_ref.readings[up] > p_i_w_nrm2 && 
-							(not up_smaller[up].nil?) then                 js  " J-(#{up_smaller[up]})"
-							up += up_smaller[up]
-							next
-						else
-							up+=1
-						end
-						end
-					else
-						up+= 1
-					end
-					
-					delta_theta = ([up-start_cell,0].max).abs * (PI/laser_ref.nrays)
-					min_dist_up = sin(delta_theta) * p_i_w_nrm2
-					if min_dist_up > best_dist then                       js  "up:early_stop"
-						up_stopped = true
-						next 
-					end
-					
-				else                                                     js  "dn=#{down} " 
-					if down < from then
-						js "down:stop" 
-						down_stopped = true; 
-						next 
-					end
-					if not laser_ref.valid? down then 
-						js "invalid" 
-						down-=1; 
-						next 
-					end
-
-					dbg_num_a1 += 1
-					last_dist_down = (p_i_w - laser_ref.p[down]).nrm2
-					if (last_dist_down<maxDist) && (last_dist_down < best_dist)
-						js "*"
-						best = down; 
-						best_dist = last_dist_down;
-					end
-
-					delta_theta = ([start_cell-down,0].max).abs*(PI/laser_ref.nrays)
-					min_dist_down = sin(delta_theta) * p_i_w_nrm2
-					if min_dist_down > best_dist then 
-						js  "down:early_stop"
-						down_stopped = true
-						next 
-					end
-					
-					if JUMP_TRICK && (down<start_cell)
-						if laser_ref.readings[down] < p_i_w_nrm2 &&
-							(not down_bigger[down].nil?) then
-							js " Jump+(#{down_bigger[down]})"
-							down += down_bigger[down]
-						else
-							if laser_ref.readings[down] >  p_i_w_nrm2 &&
-								(not down_smaller[down].nil?) then
-								js " Jump-(#{down_smaller[down]})"
-								down += down_smaller[down]
-								next
-							else 
-								down-= 1
-							end
-						end
-					else
-						js "$" 
-						down-= 1
-					end
-					
-				end
-			end
-		
-			last_best = best;
-		
-			js " FINAL #{i} --> #{best} " 
-		
-			if JOURNAL_SEARCH
-				journal "tricks #{i}   #{@js_string}"
-			end
-			
-			#
-			## If no point is close enough, or closest point is one 
-			## of the extrema, then discard
-			if [nil, 0, laser_ref.nrays-1].include? best
-				laser_sens.set_null_corr(i)
-				next
-			else
-				## Find other point to interpolate. See if we are closed
-				## to prev or next
-		
-				# FIXME: here we assume that all points are valid
-				j_up = laser_ref.next_valid_up(best)
-				j_down = laser_ref.next_valid_down(best)
-				if j_up.nil? and j_down.nil?
-					laser_sens.set_null_corr(i)
-				else
-					other_j =
-					if j_up.nil? or j_down.nil?
-						[j_up,j_down].compact[0]
-					else	
-						p_prev = laser_ref.p[j_down]
-						p_next = laser_ref.p[j_up]
-						dist_prev = (p_prev-p_i_w).nrm2;
-						dist_next = (p_next-p_i_w).nrm2;
-						if dist_prev < dist_next then j_down else j_up end
-					end
-					laser_sens.corr[i].valid = true
-					laser_sens.corr[i].j1 = best
-					laser_sens.corr[i].j2 = other_j
-				end
-			end
-
-			# This checks whether the solution is the same without tricks
-			if VERIFY_EXACT
-				
-				if (not exact[i].valid) and (laser_sens.corr[i].valid)
-					$stderr.puts "He did not find a correspondence!"
-					puts "exact = " + (exact.map{|c| c.nil? ? 'NIL': c.j1 }.join(','))
-					
-					puts "i = #{i}, best = #{correspondences[i].j1}, dist = #{best_dist}"
-					puts "#{js}"
-					exit
-				end
-				
-				if (exact[i].valid) and (not laser_sens.corr[i].valid)
-					$stderr.puts "I did not find a correspondence!"
-					exit
-				end
-				
-				if exact[i].j1 != laser_sens.corr[i].j1
-					
-					 my_corr = laser_ref.p[j1]
-					 my_dist =  (my_corr - p_i_w).nrm2
-					his_corr = laser_ref.p[exact[i].j1]
-					his_dist = (his_corr - p_i_w).nrm2
-					
-					if his_dist < my_dist
-						$stderr.puts "Optimal is #{exact[i].j1} (dist= #{his_dist}), " +
-							", while I found #{correspondences[i].j1} (dist = #{my_dist})"
-						$stderr.puts "Search was: #{@js_string}"
-					end
-
-#					for j in ([best_j-15,0].max)..([best_j+15,laser_ref.nrays].min)
-#						puts "ray #{j} reading #{@p_j[j].nil? ? 'nil' : @p_j[j].nrm2}"+
-#						" upBig #{@up_bigger[j]} upS #{@up_smaller[j]} "+
-#						" dnBig #{@down_bigger[j]} dnS #{@down_smaller[j]} "
-#					end
-
-				end
-			end
-
-		end # i in first scan 
-
-	#	puts "Total number: #{dbg_num_a1}"
-	end
-end
-	
-class LaserData	
-	def create_jump_tables
-		
-		for i in 0..nrays-1
-			j = i + 1;
-			while (valid? j) and readings[j]<=readings[i]
-				j += 1;
-			end
-			@up_bigger[i] = j-i;
-
-			j = i + 1;
-			while (valid? j) and readings[j]>=readings[i]
-				j += 1;
-			end
-			@up_smaller[i] = j-i;
-
-			j = i - 1;
-			while (valid? j) and readings[j]>=readings[i]
-				j -= 1;
-			end
-			@down_smaller[i] = j-i;
-	
-			j = i - 1;
-			while (valid? j) and readings[j]<=readings[i]
-				j -= 1;
-			end
-			@down_bigger[i] = j-i;
-		end
-	end	
-=begin
-		if JOURNAL_SEARCH
-			journal "down_bigger #{@down_bigger. join(' ')}"
-			journal "down_smaller #{@down_smaller.join(' ')}"
-			journal "up_bigger #{  @up_bigger .join(' ')}"
-			journal "up_smaller #{  @up_smaller.join(' ')}"
-		end
-=end
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_icp_cov_exact.rb b/misc/rsm/rsm_icp_cov_exact.rb
deleted file mode 100644
index 1fcf10fcdb8393cb15ef29dde1ecdd9ed17ac497..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_icp_cov_exact.rb
+++ /dev/null
@@ -1,161 +0,0 @@
-class ICP
-	def compute_covariance_exact(laser_ref, laser_sens, x)
-		y1 = Vector.alloc(laser_ref.readings).col
-		y2 = Vector.alloc(laser_sens.readings).col
-
-		d2J_dxdy2 = Matrix.alloc(3, laser_sens.nrays)
-		d2J_dxdy1 = Matrix.alloc(3, laser_ref.nrays)
-		
-		t = Vector.alloc(x[0],x[1]).col
-		theta = x[2].to_f;
-		
-		# the three pieces of d2J_dx2
-		d2J_dt2       = Matrix.alloc(2,2)
-		d2J_dt_dtheta = Vector.alloc(0,0).col
-		d2J_dtheta2   = 0
-		
-		for i in 0..laser_sens.nrays-1
-			next if not laser_sens.corr[i].valid
-			j1 = laser_sens.corr[i].j1
-			j2 = laser_sens.corr[i].j2
-			
-			p_k  = laser_sens.p[i ]
-			q_k  = laser_ref .p[j1]
-
-			other  = laser_ref.p[j2]
-			v_alpha = rot(PI/2) * (q_k-other)
-			v_alpha = v_alpha / v_alpha.nrm2
-			m = v_alpha*v_alpha.trans
-			
-			d2J_dt2_k = 2*m
-			d2J_dt_dtheta_k = 2 * (rot(theta+PI/2)*p_k).trans * m 
-			d2J_dtheta2_k =  2 * (rot(theta)*p_k+t-q_k).trans * 
-			   m * rot(theta+PI/2) * p_k + 2 * (rot(theta+PI/2)*p_k).trans * m *
-				rot(theta+PI/2) * p_k
-							
-			if i == 45 
-				d2J_dtheta2_k_1 = 2 * (rot(theta)*p_k+t-q_k).trans * 
-				   m * rot(theta+PI/2) * p_k;
-				d2J_dtheta2_k_2 = 2 * (rot(theta+PI/2)*p_k).trans * m *
-					rot(theta+PI/2) * p_k;
-				
-					puts "d2J_dtheta2_k =\n #{d2J_dtheta2_k}"
-					puts "d2J_dtheta2_k_1 =\n #{d2J_dtheta2_k_1}"
-					puts "d2J_dtheta2_k_2 =\n #{d2J_dtheta2_k_2}"
-
-					puts "t = #{t}" 
-					puts "theta = #{theta}" 
-					puts "p_k = #{p_k}" 
-					puts "q_k = #{q_k}" 
-					
-					
-					puts "v2 = #{(rot(theta)*p_k+t-q_k)}"
-			end
-			
-			d2J_dt2       += d2J_dt2_k
-			d2J_dt_dtheta += d2J_dt_dtheta_k
-			d2J_dtheta2   += d2J_dtheta2_k
-				
-			###########
-			
-				
-			# for measurement rho_i  in the second scan
-			v_i = laser_sens.v(i)
-			d2Jk_dtdrho_i = 2 * (rot(theta)*v_i).trans * m
-			d2Jk_dtheta_drho_i = 2*(rot(theta)*p_k+t-q_k).trans*m*rot(theta+PI/2)*v_i +
-				2 *(rot(theta)*v_i).trans*m*rot(theta+PI/2)*p_k
-			
-			d2J_dxdy2.col(i)[0] += d2Jk_dtdrho_i[0]
-			d2J_dxdy2.col(i)[1] += d2Jk_dtdrho_i[1]
-			d2J_dxdy2.col(i)[2] += d2Jk_dtheta_drho_i
-		
-			# for measurements rho_j1, rho_j2 in the first scan
-			dC_drho_j1, dC_drho_j2 = dC_drho_j12(laser_ref, laser_sens, j1, j2)
-			
-			v_j1 = laser_ref.v(j1)
-			
-			d2Jk_dtheta_drho_j1 = 
-				2*( -v_j1.trans*m+(rot(theta)*p_k+t-q_k).trans*dC_drho_j1)*rot(theta+PI/2)*p_k
-			d2Jk_dt_drho_j1 = 2 * (-v_j1.trans*m+(rot(theta)*p_k+t-q_k).trans*dC_drho_j1)
-			
-			d2J_dxdy1.col(j1)[0] += d2Jk_dt_drho_j1[0]
-			d2J_dxdy1.col(j1)[1] += d2Jk_dt_drho_j1[1]
-			d2J_dxdy1.col(j1)[2] += d2Jk_dtheta_drho_j1
-			
-			# for measurement rho_j2
-			d2Jk_dtheta_drho_j2 = 2*(rot(theta)*p_k+t-q_k).trans * dC_drho_j2 *
-				rot(theta+PI/2)*p_k;
-				
-			d2Jk_dt_drho_j2 = 2*(rot(theta)*p_k+t-q_k).trans * dC_drho_j2 
-			
-			d2J_dxdy1.col(j2)[0] += d2Jk_dt_drho_j2[0]
-			d2J_dxdy1.col(j2)[1] += d2Jk_dt_drho_j2[1]
-			d2J_dxdy1.col(j2)[2] += d2Jk_dtheta_drho_j2
-			
-			if i==45 then
-				puts "Corr i=#{i} j1=#{j1} j2=#{j2}"
-				puts "C_k=\n#{m}";
-				puts "dC_drho_j1=\n#{dC_drho_j1}"
-				puts "dC_drho_j2=\n#{dC_drho_j2}"
-				d = 
-				 2 * (rot(theta)*p_k+t-q_k).trans * 
-				   m * rot(theta+PI/2) * p_k + 2 * (rot(theta+PI/2)*p_k).trans * m *
-					rot(theta+PI/2) * p_k
-				puts "Contribution = \n#{d}"
-			end
-		end
-		
-		# put the pieces together
-		d2J_dx2 = Matrix.alloc(3,3)
-		d2J_dx2[0,0]=d2J_dt2[0,0]
-		d2J_dx2[1,0]=d2J_dt2[1,0]
-		d2J_dx2[1,1]=d2J_dt2[1,1]
-		d2J_dx2[0,1]=d2J_dt2[0,1]
-		d2J_dx2[2,0]=d2J_dx2[0,2]=d2J_dt_dtheta[0]
-		d2J_dx2[2,1]=d2J_dx2[1,2]=d2J_dt_dtheta[1]
-		d2J_dx2[2,2] = d2J_dtheta2
-
-		puts "d2J_dx2 = #{d2J_dx2}"
-		puts "inv(d2J_dx2) = #{d2J_dx2.inv}"
-		
-		dx_dy1 =  -d2J_dx2.inv * d2J_dxdy1
-		dx_dy2 =  -d2J_dx2.inv * d2J_dxdy2
-		
-		j1=laser_sens.corr[24].j1
-		j2=laser_sens.corr[24].j2
-
-		puts "cov0_x = #{dx_dy1*dx_dy1.trans+dx_dy2*dx_dy2.trans}"
-
-		return dx_dy1, dx_dy2
-	end
-	
-	def getC(rho_j1,v_j1,rho_j2,v_j2)
-		p_j1 = v_j1 * rho_j1
-		p_j2 = v_j2 * rho_j2
-		v_alpha = rot(PI/2) * (p_j1-p_j2)
-		v_alpha = v_alpha / v_alpha.nrm2
-		m = v_alpha*(v_alpha.trans)
-		m
-	end
-	
-	def dC_drho_j12(laser_ref, laser_sens, j1, j2)
-		
-		rho_j1 = laser_ref.readings[j1]
-		  v_j1 = laser_ref.v(j1)
-		rho_j2 = laser_ref.readings[j2]
-		  v_j2 = laser_ref.v(j2)
-	
-		eps = 0.001;
-		
-		dC_drho_j1 = 
-		  (getC(rho_j1+eps,v_j1,rho_j2,v_j2)-
-			getC(rho_j1    ,v_j1,rho_j2,v_j2))/eps;
-
-		dC_drho_j2 = 
-		  (getC(rho_j1,v_j1,rho_j2+eps,v_j2)-
-			getC(rho_j1,v_j1,rho_j2    ,v_j2))/eps;
-	
-		return dC_drho_j1, dC_drho_j2
-		
-	end
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_icp_cov_numeric.rb b/misc/rsm/rsm_icp_cov_numeric.rb
deleted file mode 100644
index d33ed82508366a936b10e05f30ae2ec693f55c03..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_icp_cov_numeric.rb
+++ /dev/null
@@ -1,106 +0,0 @@
-class ICP
-	def compute_covariance(laser_ref, laser_sens, x_new)
-		fJ = create_J_function(laser_ref, laser_sens)
-
-		mx  = x_new
-		my1 = Vector.alloc(laser_ref.readings).col
-		my2 = Vector.alloc(laser_sens.readings).col
-
-#		tot = fJ.call(x,y1,y2)
-#		puts "tot= #{tot} , total_error = #{@total_error}"
-
-	 eps_x =0.001; eps_th = deg2rad(0.00001)
-		d0 = Vector[eps_x,0, 0].col;
-		d1 = Vector[0,eps_x, 0].col;
-		d2 = Vector[0,0,eps_th].col;
-		
-		dJ_dx = Proc.new { |x,y1,y2|
-			dJ_dx0 = (fJ.call(x,y1,y2)-fJ.call(x-d0,y1,y2))/(eps_x)
-			dJ_dx1 = (fJ.call(x,y1,y2)-fJ.call(x-d1,y1,y2))/(eps_x)
-			dJ_dx2 = (fJ.call(x,y1,y2)-fJ.call(x-d2,y1,y2))/(eps_th)
-			Vector.alloc(dJ_dx0,dJ_dx1,dJ_dx2).col
-		}
-		d2J_dx2 = Proc.new { |x,y1,y2|
-			d2J_dx0 = (dJ_dx.call(x,y1,y2)-dJ_dx.call(x-d0,y1,y2))/(eps_x);
-			d2J_dx1 = (dJ_dx.call(x,y1,y2)-dJ_dx.call(x-d1,y1,y2))/(eps_x);
-			d2J_dx2 = (dJ_dx.call(x,y1,y2)-dJ_dx.call(x-d2,y1,y2))/(eps_th);
-			m = Matrix.alloc(3,3)
-			m.set_col(0, d2J_dx0)
-			m.set_col(1, d2J_dx1)
-			m.set_col(2, d2J_dx2)
-			m
-		}
-		
-		d2J_dxdi = Proc.new { |x,y1,y2,i|
-			delta_i = Vector.alloc(laser_sens.nrays).col
-			delta_i.set_basis(i)
-			delta_i = delta_i*eps_x;
-			d = (dJ_dx.call(x,y1,y2+delta_i)-
-				dJ_dx.call(x,y1,y2))/(eps_x);
-				
-			puts "d=#{d}"
-			d
-		}
-		
-		d2J_dxdj = Proc.new { |x,y1,y2,j|
-			delta_j = Vector.alloc(laser_ref.nrays).col
-			delta_j.set_basis(j)
-			delta_j = delta_j *eps_x;
-		#	puts "delta_j=#{delta_j}"
-			x = (dJ_dx.call(x,y1+delta_j,y2)-
-				dJ_dx.call(x,y1,y2))/(eps_x);
-				
-			puts "x= #{x}"
-			x
-		}
-	
-		d2J_dxdy2 = Matrix.alloc(3, laser_sens.nrays)
-		for i in 0..laser_sens.nrays-1
-			d2J_dxdy2.set_column(i, d2J_dxdi.call(mx,my1,my2,i))
-		end
-
-		d2J_dxdy1 = Matrix.alloc(3, laser_ref.nrays)
-		for j in 0..laser_sens.nrays-1
-			d2J_dxdy1.set_column(j, d2J_dxdj.call(mx,my1,my2,j))
-		end
-		
-		dJ_dxee=  dJ_dx.call(mx,my1,my2)
-		puts "deriv= #{dJ_dxee}"
-
-		d2 = d2J_dx2.call(mx,my1,my2)
-		puts "d2J_dx2 =\n #{d2}"
-
-		d2 = 0.5*(d2.trans + d2)
-		puts "sane =\n #{d2}"
-
-		puts "d2J_dxdy1 = #{d2J_dxdy1.trans}"
-		puts "d2J_dxdy2 = #{d2J_dxdy2.trans}"
-		
-		dx_dy1 = - d2.inv * d2J_dxdy1
-		dx_dy2 = - d2.inv * d2J_dxdy2
-		
-		return dx_dy1, dx_dy2
-	end
-	
-	def create_J_function(laser_ref, laser_sens)
-		Proc.new { |x,y1,y2|
-			fJtot = 0;
-			
-			for i in 0..laser_sens.nrays-1
-				next if not laser_sens.corr[i].valid
-				j1 = laser_sens.corr[i].j1
-				j2 = laser_sens.corr[i].j2
-				p_i  = laser_sens.v(i) * y2[i]
-				p_j1 = laser_ref.v(j1) * y1[j1]
-				p_j2 = laser_ref.v(j2) * y1[j2]
-
-				v_alpha = rot(PI/2) * (p_j1-p_j2)
-				v_alpha = v_alpha / v_alpha.nrm2
-				m = v_alpha*v_alpha.trans
-				p_i_w = transform(p_i, x)
-				fJtot +=	(p_i_w-p_j1).trans * m * (p_i_w-p_j1)
-			end
-			fJtot 
-		}
-	end
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_icp_outliers.rb b/misc/rsm/rsm_icp_outliers.rb
deleted file mode 100644
index 70783d706d6496482a67ccd2e1896fc5f9f0b2bc..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_icp_outliers.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-class ICP
-	def kill_outliers(laser_ref, laser_sens)
-		
-		dists = (0..laser_ref.nrays-1).map { |i| 
-			if
-		}
-		max_bin = 0.5;
-		bins = 100
-		perc = 0.4
-		safe_level = 5
-
-		hist = GSL::Histogram.alloc(bins, 0, max_bin)
-		dists.each do |d| hist.fill2 d unless d.nil? end
-		int = hist.integrate.scale(1.0/dists.compact.size)
-		# XXX sono 
-		#puts "Histo:"
-
-#		for i in 0..bins-1
-#			$stdout.write " #{hist[i]} "
-#		end
-
-		for i in 0..bins-1
-			if int[i] > perc
-				superato = i
-				break
-			end
-		end
-
-		nkilled = 0
-		dists.each_index do |i|
-			next if corrs[i].nil?
-			bin = (dists[i]/max_bin)*bins;
-	#		puts "#{i} bin=#{bin} dist=#{dists[i]}"
-			if bin > (superato+1) * safe_level
-#				puts "kill #{i} (d=#{dists[i]})"
-				corrs[i] = nil;
-				correspondences[i] = nil;
-				nkilled += 1
-			end
-		end
-		
-		puts "killed #{nkilled}/#{corrs.size}"
-	end
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_journal.rb b/misc/rsm/rsm_journal.rb
deleted file mode 100644
index 5cd7e38df83397c9d961d29b4791deab3e2569e9..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_journal.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-
-module Journal
-	def initialized
-		@open = false
-	end
-	
-	def journal_laser(which, ld)
-		return if not @open
-		journal "laser #{which} nrays #{ld.nrays}" 
-		journal "laser #{which} min_theta #{ld.min_theta}"
-		journal "laser #{which} max_theta #{ld.max_theta}"
-		journal "laser #{which} valid " + ld.valid.map{|x| x ? 1 : 0}.join(" ")
-		journal "laser #{which} readings " + ld.readings.join(" ")
-		journal "laser #{which} cluster " + ld.cluster.join(" ")
-		journal "laser #{which} alpha_valid " + ld.alpha_valid.map{|x| x ? 1 : 0}.join(" ")
-		journal "laser #{which} alpha "       + ld.alpha.join(" ")
-		journal "laser #{which} cov_alpha "   + ld.cov_alpha.join(" ")
-	end 
-
-	def journal_comment(line)
-		return if not @open
-		journal "# "+ line
-	end
-	
-	def journal(line)
-		return if not @open
-		@file.puts line
-	end
-	
-	def journal_open(fileName)
-		@file = File.open( fileName, "w" )
-		@open = true
-		#$stderr.puts "Opened journal #{fileName}."
-	end
-	
-	def journal_correspondences(s, corrs)
-		return if not @open
-		journal "#{s} " + 
-			corrs.map{ |c| c.nil? ? '-1' : c.j1}.join(" ")
-	end
-
-	def journal_array(s, a)
-		return if not @open
-		journal "#{s} " + 
-			a.map{ |c| c.nil? ? '-1' : c.j1}.join(" ")
-	end
-	
-	def to_j(x)
-		return "undefined" if x.nil? 
-		
-		if x.kind_of? GSL::Matrix
-			out = ""
-			x.each_row do |r|
-				r.each do |e|
-					out << e << " "
-				end
-				out << "    "
-			end
-		end
-
-		"#{x[0]} #{x[1]} #{x[2]}"
-	end
-end
diff --git a/misc/rsm/rsm_json_journal.rb b/misc/rsm/rsm_json_journal.rb
deleted file mode 100644
index 971234a888bddb23056575e00b605a9c2a66c897..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_json_journal.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-
-module JSON_journal
-	def jj_context_enter(name)
-
-	end
-	
-	def jj_context_exit()
-		
-	end
-	
-	def jj_loop_enter(name)
-		
-	end
-	
-	def jj_loop_iteration(name)
-		
-	end
-	
-	def jj_loop_exit()
-		
-	end
-	# 
-	# void jj_add_int(const char*name, int);
-	# void jj_add_double(const char*name, double);
-	# void jj_add_double_array(const char*name, double*,int);
-	# void jj_add_int_array(const char*name, int*,int);
-	# void jj_add(const char*name, JO);
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_laserdata.rb b/misc/rsm/rsm_laserdata.rb
deleted file mode 100644
index 0f5addd6195eb356b48c5db0c2d49ab47ffe3873..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_laserdata.rb
+++ /dev/null
@@ -1,170 +0,0 @@
-require 'rsm_mathutils'
-
-class Correspondence
-	attr_accessor :valid
-	attr_accessor :j1
-	attr_accessor :j2
-end
-
-class LaserData
-	include Math
-	
-	attr_accessor :nrays
-	attr_accessor :min_reading
-	attr_accessor :max_reading
-	attr_accessor :min_theta
-	attr_accessor :max_theta
-	
-	attr_accessor :readings
-	attr_accessor :valid
-	attr_accessor :theta
-	
-	attr_reader :alpha
-	attr_accessor :alpha_valid
-	attr_accessor :cov_alpha
-
-	attr_accessor :cluster
-	attr_accessor :p
-	
-	attr_accessor :cov_readings
-
-	attr_accessor :odometry
-	attr_accessor :estimate
-	attr_accessor :true_pose
-
-	attr_accessor :timestamp
-	attr_accessor :ipc_timestamp
-	attr_accessor :hostname
-	
-	attr_accessor :up_bigger
-	attr_accessor :up_smaller
-	attr_accessor :down_bigger
-	attr_accessor :down_smaller
-
-	attr_accessor :corr
-	
-	def initialize(nrays)
-		@nrays      = nrays
-		@valid       = [false  ] * nrays
-		@readings    = [GSL::NAN] * nrays
-		@theta       = [GSL::NAN] * nrays
-		@alpha_valid = [false  ] * nrays
-		@alpha       = [GSL::NAN] * nrays
-		@cov_alpha   = [GSL::NAN] * nrays
-		@cluster     = [-1] * nrays
-		@cov_readings = [GSL::NAN]* nrays
-		
-		@odometry    = [GSL::NAN,GSL::NAN,GSL::NAN].to_gv.col
-		@estimate    = [GSL::NAN,GSL::NAN,GSL::NAN].to_gv.col
-		@true_pose   = [GSL::NAN,GSL::NAN,GSL::NAN].to_gv.col
-		
-		@p = []; @corr = [];
-		for i in 0..nrays-1
-			@p[i] = Vector[GSL::NAN,GSL::NAN].col
-			@corr[i] = Correspondence.new;
-			@corr[i].valid = false
-			@corr[i].j1 = -1
-			@corr[i].j2 = -1
-		end
-		
-		# jump tables
-		@up_bigger = [nil]*nrays
-		@up_smaller = [nil]*nrays
-		@down_bigger = [nil]*nrays
-		@down_smaller = [nil]*nrays
-		
-		# min_theta ? 
-	end	
-	
-	def alpha_valid?(i); i>=0 && i<nrays && @alpha_valid[i] end
-	def valid?(i); i>=0 && i<nrays && @valid[i] end
-	def v(i); MathUtils.vers(theta[i]) end
-#	def cartesian; MathUtils.vers(theta[i])*reading; end
-	
-	def set_null_corr(i)
-		@corr[i].valid = false
-		@corr[i].j1 = -1
-		@corr[i].j2 = -1 
-	end
-	
-	def next_valid_down(i); next_valid(i,-1) end
-	def next_valid_up  (i); next_valid(i,+1) end
-	def next_valid(i, direction)
-		i += direction
-		while i>=0 && i<nrays
-			return i if valid? i
-			i += direction
-		end
-		nil
-	end
-	
-	def correspondences_hash
-		indexes = @corr.map{|c| c.j1}
-		indexes.hash
-	end
-end
-
-def standard_parameters
-	p = Hash.new
-	p[:max_angular_correction_deg]= 90
-	p[:max_linear_correction]=    2
-	p[:max_correspondence_dist]=   2
-	p[:max_iterations]=           40
-	p[:epsilon_xy]=  0.0001
-	p[:epsilon_theta]=   0.0001
-	p[:sigma]=           0.01
-	p[:restart]=         1
-	p[:restart_threshold_mean_error] = 3.0 / 300.0
-	p[:restart_dt]=      0.1
-	p[:restart_dtheta]=  0.026;#  1.5 * 3.14 /180
-	
-	p[:clustering_threshold] = 0.05
-	p[:orientation_neighbourhood] = 3
-	p[:use_corr_tricks] = 1;
-	p[:do_compute_covariance] = 0;
-		
-	p[:do_alpha_test] = 0
-	p[:do_alpha_test_thresholdDeg]=20
-	
-	p[:outliers_maxPerc] = 0.95;
-	p[:outliers_adaptive_order] = 0.7; 
-	p[:outliers_adaptive_mult] = 2; 
-	
-	p[:do_visibility_test] = 0
-	p
-end
-
-
-def tro_parameters
-	p = Hash.new
-	p[:max_angular_correction_deg]= 30
-	p[:max_linear_correction]=    0.5
-	p[:max_correspondence_dist]=   2
-	p[:max_iterations]=           40
-	p[:epsilon_xy]=  0.0001
-	p[:epsilon_theta]=   0.0001
-	p[:sigma]=           0.01
-	p[:restart]=         1
-	p[:restart_threshold_mean_error] = 3.0 / 300.0
-	p[:restart_dt]=      0.01
-	p[:restart_dtheta]=  0.027 #1.5 * 3.14 /180
-	
-	p[:clustering_threshold] = 0.05
-	p[:orientation_neighbourhood] = 3
-	p[:use_corr_tricks] = 1;
-	p[:do_compute_covariance] = 0;
-		
-	p[:do_alpha_test] = 0
-	p[:do_alpha_test_thresholdDeg]=20
-	
-	p[:outliers_maxPerc] = 0.95;
-	p[:outliers_adaptive_order] = 0.7; 
-	p[:outliers_adaptive_mult] = 2; 
-	
-	p[:do_visibility_test] = 0
-	p
-end
-
-require 'rsm_laserdata_ops'
-require 'rsm_laserdata_carmen'
-require 'rsm_laserdata_json'
diff --git a/misc/rsm/rsm_laserdata_carmen.rb b/misc/rsm/rsm_laserdata_carmen.rb
deleted file mode 100644
index 839836b26e72d49cfc45ef19911b8c2131c1b54e..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_laserdata_carmen.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-
-class LaserData
-	# Parses a CARMEN line
-	def LaserData.convert_line(l)
-		tokens = l.split
-		tokens.shift
-		nrays = tokens.shift.to_i
-
-		if nrays <= 0
-			raise "Bad no. of rays (#{ld.nrays}) in '#{l}'"  end
-		if tokens.size < nrays+9 
-			then raise "Line incomplete: '#{l}'" end
-		
-		ld = LaserData.new(nrays)
-				
-		ld.min_reading   = 0.001;
-		ld.max_reading   = 49;
-		ld.min_theta     = -PI/2;
-		ld.max_theta     =  PI/2;
-
-		for i in 0..nrays-1
-			if tokens.empty? 
-				raise "Could not read ray#{a} in '#{l}'" end
-	
-			reading = tokens.shift.to_f
-			
-			
-			if (not reading) || (reading<0)
-				raise "Bad value (#{p.reading}) for ray#{a} in '#{l}'"
-			end
-			
-			ld.theta[i] = ld.min_theta + i * (ld.max_theta) / (ld.nrays-1)
-			ld.valid[i] = (reading < ld.max_reading) && (reading > ld.min_reading)
-			ld.readings[i] = ld.valid[i] ? reading : GSL::NAN
-
-		end
-		
-		ld.estimate      = parse_tokens(tokens);
-		ld.odometry      = parse_tokens(tokens);
-		ld.ipc_timestamp = tokens.shift
-		ld.timestamp     = tokens.shift
-		ld.hostname      = tokens.shift
-		ld
-	end
-	
-	def to_carmen
-		line = "FLASER #{nrays} " + readings.join(' ') +
-			"\t #{estimate[0]} #{estimate[1]} #{estimate[2]} "+
-			"\t #{odometry[0]} #{odometry[1]} #{odometry[2]} "+
-			"\t #{ipc_timestamp} #{timestamp} #{hostname}"
-	end
-	
-end
-
-def parse_tokens(tokens)
-	v = GSL::Vector.alloc(GSL::NAN,GSL::NAN,GSL::NAN).col
-	v[0] = tokens.shift.to_f
-	v[1] = tokens.shift.to_f
-	v[2] = tokens.shift.to_f
-	v
-end
-
-
-
-
-
-
diff --git a/misc/rsm/rsm_laserdata_json.rb b/misc/rsm/rsm_laserdata_json.rb
deleted file mode 100644
index b216baa14dcfcc645530648315896c9d30e6c891..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_laserdata_json.rb
+++ /dev/null
@@ -1,103 +0,0 @@
-begin
-require 'rubygems'
-rescue => ex
-	$stderr.puts  "Rubygems not available"
-end
-
-require 'json/pure'
-
-class Array
-	def nan_to_nil!
-		for i in 0..size-1
-			v = self[i]
-			self[i] = nil if v.kind_of? Float and v.nan?
-			self[i] = self[i].to_f  if self[i]
-		end
-		self
-	end
-	
-	def nil_to_nan!
-		for i in 0..size-1
-			self[i] = self[i] || GSL::NAN
-		end
-		self
-	end
-	
-	def all_nan?
-		all? {|v| v.kind_of? Float and v.nan?}
-	end
-end
-
-class GSL::Vector
-	def to_json(*a)
-		to_a.nan_to_nil!.to_json(*a)
-	end
-end
-
-class LaserData
-	
-	def to_json(*a)
-#		puts @odometry.to_s
-		h = {
-			'nrays'       => @nrays,
-			'min_theta'   => @min_theta,
-			'max_theta'   => @max_theta,
-
-			'valid'       => @valid.map{|x| x ? 1 : 0},
-			'readings'    => @readings.clone.nan_to_nil!,
-			'theta'       => @theta   .clone.nan_to_nil!,
-
-			'odometry'    => @odometry,
-			'estimate'    => @estimate,
-			'true_pose'   => @true_pose
-		}
-		
-		h['cluster']     = @cluster unless @cluster.all?{|x| x == -1}
-		h['alpha_valid'] = @alpha_valid.map{|x| x ? 1 : 0} unless @alpha_valid.all?{|x| not x}
-		h['alpha'] = @alpha.clone.nan_to_nil! unless @alpha.all_nan?
-		h['cov_alpha'] = @cov_alpha.clone.nan_to_nil! unless @cov_alpha.all_nan?
-		h['cov_readings'] = @cov_readings.clone.nan_to_nil! unless @cov_readings.all_nan?
-		
-#		corrd = corr.map{|x| x.valid ? [x.j1, x.j2] : nil }
-#		h['corresponde] = c
-		h.to_json(*a)
-	end
-
-	def from_hash(h)
-		self.min_theta = h['min_theta'].to_f
-		self.max_theta = h['max_theta'].to_f
-		self.valid     = h['valid'].map{ |x| (x == 0 || !x ) ? false : true } 
-		self.readings  = h['readings'].clone.nil_to_nan!
-		self.theta     = h['theta'].clone.nil_to_nan!
-		
-		self.cluster = h['cluster'].clone if h['cluster']
-		self.alpha_valid = h['alpha_valid'].clone if h['alpha_valid']
-		self.alpha = h['alpha'].clone.nil_to_nan! if h['alpha']
-		self.cov_alpha = h['cov_alpha'].clone.nil_to_nan! if h['cov_alpha']
-		self.cov_readings = h['cov_readings'].clone.nil_to_nan! if h['cov_readings']	
-	end
-end
-
-
-if File.basename($0) == 'rsm_laserdata_json.rb' 
-	# testing
-	ld = LaserData.new(10)
-	ld.readings[8] = 42
-	# ld.corr[i].valid = true
-	# ld.corr[i].j1 = 12
-	# ld.corr[i].j2 = 13
-	
-	require 'sm'
-	include Sm
-	json = ld.to_json
-	puts "\nLaserData.to_json:\n"
-	p json
-	c_jo = json_parse(json)
-	puts "\nLaserData.to_json -> c_jo = json_parse -> json_write(c_jo) :\n"
-	p json_write(c_jo)
-	c_ld = json_to_ld(c_jo)
-	puts "\nLaserData.to_json -> json_parse -> json_to_ld -> ld_to_json: \n"
-	c_jo2 = ld_to_json(c_ld)
-	p json_write(c_jo2)
-	
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_laserdata_ops.rb b/misc/rsm/rsm_laserdata_ops.rb
deleted file mode 100644
index b5348cc1af3e6bdc28496464e04a6161c9f61aa2..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_laserdata_ops.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require 'rsm_laserdata'
-
-
-class LaserData
-	
-	def add_noise!(sigma, rng)
-		readings.map! { |x| 
-			x + rng.gaussian(sigma)
-		}
-	end
-	
-	def LaserData.from_json(json_string)
-		h = JSON.parse(json_string)
-		ld = LaserData.new(h['nrays'])
-		ld.from_hash(h)
-		ld
-	end
-	
-	def deep_copy
-		LaserData.from_json(self.to_json)
-	end
-	
-	def compute_cartesian
-		for i in 0..nrays-1
-			next if not valid? i
-			@p[i] = v(i) * readings[i]
-		end
-	end
-end
diff --git a/misc/rsm/rsm_mathutils.rb b/misc/rsm/rsm_mathutils.rb
deleted file mode 100644
index f5e605702d3ec999e1a21f38490a03a4f854f97b..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_mathutils.rb
+++ /dev/null
@@ -1,148 +0,0 @@
-require 'gsl'
-
-module GSL
-	class Vector
-		def marshal_dump
-			to_a
-		end
-		
-		def marshal_load(a)
-	#		puts "A is a #{a.class}: #{a}"
-			a.each_index { |i| 
-	#			puts "i=#{i.class} a(i) = #{a[i].class}"
-			}
-		end
-		
-		def any_nan?
-			for i in 0..size-1
-				return true if self[i].nan?
-			end
-			false
-		end
-		
-	end
-end
-
-module MathUtils 
-	public
-	def deg2rad(d)
-		 d * Math::PI / 180
-	end
-	
-	def rad2deg(d)
-		 d / Math::PI * 180
-	end
-	
-	## versor
-	def vers(a) 
-		GSL::Vector.alloc(Math.cos(a), Math.sin(a)).col
-	end
-
-	def two_decimals(x)
-		x.nan? ? GSL::NAN : (x*100).round/100.0;
-	end
-	
-	def pv(x)
-		"[#{two_decimals(x[0]*1000) }mm,#{two_decimals(x[1]*1000)}mm,"+
-		"#{two_decimals(rad2deg(x[2]))}deg]"
-	end
-
-	def pm(m)
-		std_x = (sqrt(m[0,0])*100000).round/100.0 # in mm
-		std_y = (sqrt(m[1,1])*100000).round/100.0 # in mm
-		std_th = (rad2deg(sqrt(m[2,2]))*100).round/100.0
-		"[+-#{2*std_x}mm,+-#{2*std_y}mm,+-#{2*std_th}]deg"
-	end
-	## 2x2 rotation matrix
-	def rot(a)
-		GSL::Matrix[[Math.cos(a), -Math.sin(a)], [Math.sin(a), Math.cos(a)]]
-	end
-	
-	def transform(point, x)
-		t = x[0,1]; theta = x[2];
-		rot(theta)*point + t
-	end
-
-	
-	def pose_diff(to,from)
-		oplus(ominus(from), to)
-	end
-	
-	def oplus(x1,x2)
-		theta = x1[2];
-		GSL::Vector.alloc(
-			x1[0] + x2[0]*Math.cos(theta) - x2[1]*Math.sin(theta),
-			x1[1] + x2[0]*Math.sin(theta) + x2[1]*Math.cos(theta),
-			x1[2] + x2[2]).col
-	end
-	
-	def ominus(x)
-		th = x[2]
-		GSL::Vector.alloc(
-			-x[0]*Math.cos(th) - x[1]*Math.sin(th),
-			 x[0]*Math.sin(th) - x[1]*Math.cos(th),
-			-x[2]).col
-	end
-	
-	def J1(x1,x2)
-		Matrix[
-			[1, 0, -x2[0]*sin(x1[2])-x2[1]*cos(x1[2])],
-			[0, 1,  x2[0]*cos(x1[2])-x2[1]*sin(x1[2])],
-			[0, 0, 1]
-		]
-	end
-	
-	def J2(x1,x2)
-		Matrix[
-			[cos(x1[2]), -sin(x1[2]), 0],
-			[sin(x1[2]),  cos(x1[2]), 0],
-			[0, 0, 1]
-		]
-	end
-	
-	
-	def angleDiff(a,b)
-		d = a - b
-		
-		while d < -PI; d+=2*PI; end
-		while d >  PI; d-=2*PI; end
-		d
-	end
-	
-	# from, to, start_cell, range = 
-	def possible_interval(point, ld, max_angular_correction_deg, 
-		max_linear_correction)
-		
-		angleRes =  (ld.max_theta-ld.min_theta)/ld.nrays;
-
-		# Delta for the angle
-		delta = deg2rad(max_angular_correction_deg).abs +
-		        Math.atan(max_linear_correction/point.nrm2).abs;
-
-		# Dimension of the cell range
-		range = (delta/angleRes).ceil;
-		
-		# To be turned into an interval of cells
-		start_theta = Math.atan2(point[1],point[0]);
-		
-		start_cell  = 
-			(start_theta - ld.min_theta) / (ld.max_theta-ld.min_theta) * ld.nrays;
-	
-		start_cell = start_cell.ceil
-		
-		# Pay attention to minimum and maximum
-		from = min(ld.nrays-1, max( (start_cell-range).floor,0));
-		to = max(0, min((start_cell+range).ceil,ld.nrays-1));
-	
-		if false
-			puts "start_theta=#{rad2deg(start_theta)}°, "+
-			     "range = #{range} cells,"+
-			     "start_cell=#{rad2deg(start_cell)},"+
-				  "fromto=#{from}->#{to}"
-		end
-		
-		return from, to, start_cell, range
-	end
-	
-	
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_misc.rb b/misc/rsm/rsm_misc.rb
deleted file mode 100755
index 841b72f9ee15cc90367fdd4524bcc7f33e53fb86..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_misc.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require 'rsm_mathutils'
-
-
-module Pose 
-
-	
-end
-
-
diff --git a/misc/rsm/rsm_orientation.rb b/misc/rsm/rsm_orientation.rb
deleted file mode 100644
index dc73f31c1b31f99baba1407306bd88ea98ff0734..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_orientation.rb
+++ /dev/null
@@ -1,104 +0,0 @@
-require 'rsm'
-
-class LaserData
-	# Computes alpha for each point
-	def compute_orientation(neighbourhood, sigma)
-		for i in 0..nrays-1
-
-			if not valid? i
-				@alpha[i] = GSL::NAN
-				@alpha_valid[i]= false
-				@cov_alpha[i] = GSL::NAN
-				next
-			end
-			
-			# list of index
-			neighbours = find_neighbours(i,neighbourhood)
-			
-#			puts "i = #{i} neigbours = #{neighbours.join(', ')}"
-
-			if neighbours.size == 0
-				@alpha_valid[i]= false
-				@alpha[i] = GSL::NAN
-				@cov_alpha[i] = GSL::NAN
-				next
-			end
-			
-#			puts "neighbours for i=#{i} = #{neighbours.join(', ')}"
-			thetas = neighbours.map{|j| @theta[j]}
-			readings = neighbours.map{|j| @readings[j]}
-
-			@alpha[i], @cov_alpha[i] = filter_orientation(@theta[i],@readings[i],thetas,readings,1);
-			@cov_alpha[i]  *= sigma**2
-
-#			puts "------- i = #{i} alpha = #{}"
-			@alpha_valid[i] = @alpha[i].nan? ? false : true
-			if @alpha[i].nan?
-#				puts "We have a problem.."
-			end
-		end
-	end
-	
-	def filter_orientation(theta0, rho0, thetas, rhos, curv)
-		n = thetas.size
-		# y = l x + r epsilon
-		y = Matrix.alloc(n, 1)
-		l = Matrix.alloc(n, 1)
-		r = Matrix.alloc(n, n+1)
-		
-		r.set_all(0.0)
-		l.set_all(1.0);
-		
-		for i in 0..n-1
-		#	puts "theta0 = #{theta0}  thetas[i] = #{thetas[i]}"
-			y[i,0]   = (rhos[i]-rho0)/(thetas[i]-theta0)
-			r[i,0]   = -1/(thetas[i]-theta0);
-			r[i,i+1] =  1/(thetas[i]-theta0);
-		end
-		
-#		puts "y = \n#{y}"
-#		puts "l = \n#{l}"
-#		puts "r = \n#{r}"
-		
-		bigR = r*r.trans;
-		# x = (l^t R^-1 l)^-1 l^t R^-1 y
-		cov_f1 = ((l.trans * bigR.inv * l).inv)[0,0]
-		f1 = (cov_f1 * l.trans * bigR.inv * y)[0,0]
-	
-#		puts "f1 = #{f1}"
-		#alpha = theta0 + PI/2 + Math.atan(rho0/f1)
-		alpha = theta0 - Math.atan(f1/rho0)
-		
-		
-		dalpha_df1  = rho0 / (rho0**2 + f1**2)
-		dalpha_drho = -f1 / (rho0**2 + f1**2)
-		cov0_alpha = (dalpha_df1**2) * cov_f1 + (dalpha_drho**2)
-
-
-#		puts " cov_f1 = #{cov_f1} dalpha_df1 #{dalpha_df1**2} dalpha_drho #{dalpha_drho**2} "+
-#			" cov0_alpha = #{cov0_alpha}"
-#		puts "sotto = #{(rho0**2 + f1**2)}"
-			
-		if cos(alpha)*cos(theta0)+sin(alpha)*sin(theta0)>0
-			alpha = alpha + PI
-		end
-		
-		return alpha, cov0_alpha
-	end
-	
-	# uses params[:gpm_neighbours]?
-	def find_neighbours(i, neighbourhood)
-		up = i; 
-		while (up+1 <= i+neighbourhood) and (up+1<nrays) and (valid? up+1) and 
-				(cluster[up+1] == cluster[i])
-			up+=1; 
-		end
-		down = i; 
-		while (down >= i-neighbourhood) and (down-1>=0) and (valid? down-1) and 
-				(cluster[down-1] == cluster[i])
-			down-=1;
-		end
-		(down..(i-1)).to_a + ((i+1)..up).to_a
-	end
-	
-end
\ No newline at end of file
diff --git a/misc/rsm/rsm_sm.rb b/misc/rsm/rsm_sm.rb
deleted file mode 100755
index e9c11cf904782ef433f22b57ad03b6cc963e7f54..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_sm.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'rsm_sm_loop'
-
-	
-	if ARGV.size < 3
-		puts "sm <SCANMATCHER> '[]' <input> <output> "
-		exit 1
-	end
-
-	scan_matcher = eval ARGV[0]
-	scan_list = eval ARGV[1]
-
-	puts "Scan_list = #{scan_list}"
-
-# Read from standard input if no arguments are passed
-#io = ARGV.size>0 ? File.open(ARGV[0]) : $stdin 
-
-	input = File.open ARGV[2]
-	output = File.open ARGV[3], "w"
-
-	params = standard_parameters
-	
-#	begin
-		scan_matching(scan_matcher,scan_list,input,output,params)
-	# rescue => ex
-	# 	puts "bam"
-	# 	puts ex, ex.backtrace
-	# end
-	
-	
-
diff --git a/misc/rsm/rsm_sm_cov.rb b/misc/rsm/rsm_sm_cov.rb
deleted file mode 100755
index 3d4a12745c7d9b465f5378f6f852e1b42105642b..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_sm_cov.rb
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/usr/bin/env ruby
-require 'rsm'
-
-class Matching 
-	attr_accessor :x
-	attr_accessor :cov_x
-	
-	attr_accessor :dx_dy1
-	attr_accessor :dx_dy2
-
-	attr_accessor :J1
-	attr_accessor :J2
-end
-
-def scan_matching(io, scan_matcher)
-	include MathUtils
-	
-	laser_ref = LogReader.shift_laser(io)
-	
-	count = 0
-	
-	pose = Vector[0,0,0].col
-	cov_pose = Matrix[[0,0,0],[0,0,0],[0,0,0]]
-	cov_pose_b = cov_pose
-	sigma = 0.01;
-	
-	history = Array.new
-	until io.eof? 
-		count+=1 
-		laser_sens = LogReader.shift_laser(io)
-		min_step = -0.001
-		min_theta_step_deg =- 0.01
-
-		u =  pose_diff(laser_sens.odometry, laser_ref.odometry)
-	#	puts "u: #{pv(u)}"
-		
-		if (u[0,1]).nrm2 <= min_step && (u[2].abs <deg2rad(min_theta_step_deg))
-			
-			# todo: merge readings
-			#puts "Skipping (same odometry)"
-			next
-		end
-
-	#	puts "Ref: #{pv(laser_ref.odometry)}"
-	#	puts "New: #{pv(laser_sens.odometry)}"
-
-		icp = scan_matcher.new
-		# Write log of the icp operation
-	#	icp.journal_open("icp_sm.rb-sm#{count}.txt")
-
-		icp.params[:max_angular_correction_deg]= 10
-		icp.params[:max_linear_correction]=  2
-		icp.params[:laser_ref] = laser_ref;
-		icp.params[:laser_sens] = laser_sens;
-		icp.params[:firstGuess] = u
-		icp.params[:max_iterations] = 20
-
-
-		m = Matching.new
-		
-		m.x, m.dx_dy1, m.dx_dy2 = icp.scan_matching
-		m.J1 = J1(pose,m.x);
-		m.J2 = J2(pose,m.x);
-		
-		
-		pose_new = oplus(pose, m.x);
-		m.cov_x = (sigma*sigma) * m.dx_dy1 * (m.dx_dy1.trans) +
-		          (sigma*sigma) * m.dx_dy2 * (m.dx_dy2.trans);
-		
-		
-		cov_pose_new = m.J1 * cov_pose * m.J1.trans +  m.J2 * m.cov_x * m.J2.trans
-
-		if true
-			if history.empty?
-				cov_pose_b_new = m.J1 * cov_pose_b * m.J1.trans +  m.J2 * m.cov_x * m.J2.trans
-			else
-				d = (sigma*sigma) * m.J1 * history[-1].J2 * history[-1].dx_dy2 * m.dx_dy1.trans * m.J2.trans;
-				puts " D = \nd"
-				cov_pose_b_new = m.J1 * cov_pose_b * m.J1.trans +  m.J2 * m.cov_x * m.J2.trans + d + d.trans
-			end
-		end
-		
-		
-#		puts "j1 =\n #{j1}"
-#		puts "j2 =\n #{j2}"
-#		puts "j1*j1' =\n #{j1*j1.trans}"
-#		puts "j2*j2' =\n #{j2*j2.trans}"
-		puts "PPP pose = #{pv(pose)} \ncov  = #{pm(cov_pose_new)}"
-		puts "cov2 = #{pm(cov_pose_b_new)}"
-		puts "cov = \n#{cov_pose_new}"
-		puts "cov2= \n#{cov_pose_b_new}"
-		puts "cov-cov2 = \n#{cov_pose_new-cov_pose_b_new}"
-		
-		history.push m
-		pose = pose_new;
-		cov_pose = cov_pose_new;
-		cov_pose_b = cov_pose_b_new;
-		laser_ref = laser_sens;
-	end
-end
-
-# Read from standard input if no arguments are passed
-io = ARGV.size>0 ? File.open(ARGV[0]) : $stdin 
-
-scan_matching(io)
-
diff --git a/misc/rsm/rsm_sm_loop.rb b/misc/rsm/rsm_sm_loop.rb
deleted file mode 100644
index 9a339997fedf37edb602f6c10d13921fc608b741..0000000000000000000000000000000000000000
--- a/misc/rsm/rsm_sm_loop.rb
+++ /dev/null
@@ -1,85 +0,0 @@
-require 'logreader'
-require 'benchmark'
-
-def scan_matching(klass,scan_list,input,output,params)
-	include MathUtils
-	
-	laser_ref = LogReader.shift_laser(input)
-	laser_ref.estimate = Vector[0,0,0].col
-	output.puts laser_ref.to_json
-	
-	results = []
-	count = 0
-	until input.eof?
-		
-		laser_sens = LogReader.shift_laser(input)
-		min_step = -0
-		min_theta_step_deg = -5;
-
-		u =  pose_diff(laser_sens.odometry, laser_ref.odometry)
-		
-		if (u[0,1]).nrm2 <= min_step && (u[2].abs <deg2rad(min_theta_step_deg))
-			
-			# todo: merge readings
-			#puts "Skipping (same odometry)"
-			next
-		end
-
-#		puts "Ref: #{pv(laser_ref.odometry)}"
-#		puts "New: #{pv(laser_sens.odometry)}"
-
-		if (not scan_list.empty?) && (not scan_list.include? count)
-			break if count > scan_list.max
-			count+=1
-			laser_ref = laser_sens;
-			next
-		end
-		
-		sm = klass.new
-		# Write log of the icp operation
-	
-		if scan_list.include? count
-			sm.journal_open("rsm_sm.#{sm.name}.#{count}.txt")
-		end
-		
-		sm.params = params 
-		sm.params[:laser_ref] = laser_ref;
-		sm.params[:laser_sens] = laser_sens;
-		sm.params[:firstGuess] = u
-
-		if false
-			sm.params[:laser_sens] = laser_ref;
-			sm.params[:firstGuess] = GSL::Vector.alloc(0,0,0)
-		end
-		
-		res = nil
-		realtime = Benchmark.realtime do
-			res = sm.scan_matching
-		end
-		res[:u] = u
-		res[:time] = realtime
-		results.push res
-		
-		if not res[:valid]
-			break
-		end	
-		
-		x = res[:x]
-		if x.any_nan? 
-			raise "Found nans in answer x = #{x.inspect}"
-		end
-		error = res[:error]
-		iterations = res[:iterations]
-		
-		laser_sens.estimate = oplus(laser_ref.estimate, x)
-		output.puts laser_sens.to_json
-
-		q = laser_sens.estimate
-		$stderr.puts "rsm_sm.rb: #{count} time=#{realtime} error = #{error} it = #{iterations} x = #{pv(x)} u = #{pv(u)} q = #{pv(q)}"
-		
-		
-		laser_ref = laser_sens;
-		count += 1
-	end
-	results
-end
diff --git a/misc/rsm/sm_display.m b/misc/rsm/sm_display.m
deleted file mode 100644
index db08fdd70a1a8446baa543a0120344ec70f04750..0000000000000000000000000000000000000000
--- a/misc/rsm/sm_display.m
+++ /dev/null
@@ -1,156 +0,0 @@
-function [laser_ref, laser_sens] = sm_display(file)
-
-cells = readFileInCells(file);
-%global cells
-[rows, columns] = size(cells)
-
-% todo: remove comments
-
-r = 1
-
-r = skip_to(cells, r,'laser')
-[r, laser_ref] = read_laser_data(cells, r);
-
-r = skip_to(cells, r,'laser')
-[r, laser_sens] = read_laser_data(cells, r);
-
-f =  figure; hold on; axis('equal')
-
-while true
-	r = skip_to(cells, r,'iteration');
-	if r > rows 
-		break
-	end
-	
-	r = skip_to(cells, r,'x_old');
-	x_old = cells_to_vector(cells, r, 2);
-
-	[corr_exist, r] = exist_this_iteration(cells, r,'correspondences');
-    if corr_exist
-        for i=1:laser_sens.nrays
-            corr(i) = str2num(cells{r,1+i});
-            if corr(i) == -1
-                corr(i) = nan;
-            else 
-                % matlab counts from 1.. (yuk!)
-                corr(i) = corr(i) + 1;
-            end
-        end
-    end
-
-	laser_ref.estimate = [0;0;0];
-	laser_sens.estimate = x_old;
-
-	params.plotNormals = true;
-	params.color = 'r.';
-	ld_plot(laser_ref, params);
-	
-	params.plotNormals = true;
-	params.color = 'g.';
-	ld_plot(laser_sens, params);
-	
-   if corr_exist
-	for i=1:size(corr,2)
-		if isnan(corr(i))
-			continue
-		end
-		plot_line(transform(laser_sens.points(:,i),x_old), ...
-			laser_ref.points(:,corr(i)),'k-');
-    end
-    end
-
-	pause
-	old_axis = axis
-	clf
-	axis(old_axis)
-		
-	%r = skip_to(cells, r,'x_new');
-	%x_new = cells_to_vector(cells, r, 2)
-
-end
-
-function plot_line(a,b,color)
-	plot([a(1) b(1)],[a(2) b(2)],color);
-
-function x = cells_to_vector(cells, r, cell)
-	for i=1:3
-		x(i,1) = str2double(cells{r, cell+i-1});
-	end
-
-% Finds next row in cells whose first cell is equal to "cellname"
-function r = skip_to(cells, r, cellname)
-	while  (r<=size(cells,1)) && (0==strcmp(cells{r,1}, cellname))
-		r = r +1;
-    end
-
-function [exist, r] = exist_this_iteration(cells, r, cellname);
-	start =r;
-    next_iteration = skip_to(cells, r, 'iteration');
-    r = skip_to(cells, r, cellname)
-    if r < next_iteration
-        exist = true;
-    else
-			r = start;
-        exist = false;
-    end
-        
-
-function [next_r, laser_data] = read_laser_data(cells, r)
-
-	name = cells{r, 2}
-	ld = struct;
-	ld.estimate = [0;0;0]
-	ld.odometry = [0;0;0]
-	while (r<=size(cells,1)) && strcmp(cells{r, 1},'laser') && strcmp(cells{r, 2},name)
-		fprintf('at %s %s %s\n',cells{r,1},cells{r,2},cells{r,3})
-		if strcmp(cells{r, 3}, 'min_theta')
-			min_theta = str2double(cells{r,4});
-		end
-		if strcmp(cells{r, 3}, 'max_theta')
-			max_theta = str2double(cells{r,4});
-		end
-		if strcmp(cells{r, 3}, 'nrays')
-			ld.nrays = str2double(cells{r,4});
-		end
-		if strcmp(cells{r, 3}, 'valid')
-			for i=1:ld.nrays
-				ld.valid(i) = str2num(cells{r,3+i});
-			end
-		end
-		if strcmp(cells{r, 3}, 'readings')
-			for i=1:ld.nrays
-				ld.readings(i) = str2double(cells{r,3+i});
-				ld.theta(i) = min_theta + (max_theta-min_theta)*i/ld.nrays;
-			end
-		end
-		if strcmp(cells{r, 3}, 'alpha_valid')
-			for i=1:ld.nrays
-				ld.alpha_valid(i) = str2num(cells{r,3+i});
-			end
-		end
-		if strcmp(cells{r, 3}, 'alpha')
-			for i=1:ld.nrays
-				ld.alpha(i) = str2double(cells{r,3+i});
-			end
-		end
-		if strcmp(cells{r, 3}, 'cov_alpha')
-			for i=1:ld.nrays
-				ld.cov_alpha(i) = str2double(cells{r,3+i});
-			end
-		end
-		if strcmp(cells{r, 3}, 'cluster')
-			for i=1:ld.nrays
-				ld.cluster(i) = str2num(cells{r,3+i});
-			end
-		end
-		r = r+1;
-	end 
-	
-	ld.points = [cos(ld.theta) .* ld.readings; sin(ld.theta) .* 	ld.readings];
-	
-	next_r = r;
-	laser_data =ld;
-	
-	
-	
-	
\ No newline at end of file
diff --git a/misc/rsm/test_json.rb b/misc/rsm/test_json.rb
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/misc/rsm/test_mathutils.rb b/misc/rsm/test_mathutils.rb
deleted file mode 100644
index 05dd2ded4eea70031ac8e6a00f4ada22888e86e7..0000000000000000000000000000000000000000
--- a/misc/rsm/test_mathutils.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-require 'rsm_mathutils'
-
-include MathUtils 
-include GSL
-
-pose1 = Vector[1, 2, 3]
-pose2 = Vector[1.5, 2.1, 2.4]
-
-puts "pose1\t #{pv(pose1)}"
-puts "pose2\t #{pv(pose2)}"
-diff = pose_diff(pose2, pose1)
-puts "diff\t #{pv(diff)}"
-pose2b = oplus(pose1, diff)
-puts "pose2b\t #{pv(pose2b)}"
diff --git a/misc/rsm/tmp.rb b/misc/rsm/tmp.rb
deleted file mode 100644
index 8b7ef91c5320d9de5cdc14fa79fe14b303a9c777..0000000000000000000000000000000000000000
--- a/misc/rsm/tmp.rb
+++ /dev/null
@@ -1,3 +0,0 @@
- require 'point2line'
-include MathUtils
- test_gm2
diff --git a/misc/sm_ruby_wrapper/extconf.rb b/misc/sm_ruby_wrapper/extconf.rb
deleted file mode 100644
index f0c2497a7201277e2790ad861d63734898dd5355..0000000000000000000000000000000000000000
--- a/misc/sm_ruby_wrapper/extconf.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-require 'mkmf'
-
-GSL_CONFIG = "gsl-config"
-
-# Taken from rb-gsl
-def gsl_config()
-  print("checking gsl cflags... ")
-  IO.popen("#{GSL_CONFIG} --cflags") do |f|
-    cflags = f.gets.chomp
-    puts(cflags)
-    $CFLAGS += " " + cflags
-  end
-   
-  IO.popen("#{GSL_CONFIG} --libs") do |f|
-    libs = f.gets.chomp
-    dir_config("cblas")
-    dir_config("atlas")
-    if have_library("cblas") and have_library("atlas")
-      libs.gsub!("-lgslcblas", "-lcblas -latlas")
-      $LOCAL_LIBS += " " + libs.gsub(" -lgslcblas", "")
-      print("checking gsl libs... ")
-      puts(libs)
-    else
-      print("checking gsl libs... ")
-      puts(libs)
-      $LOCAL_LIBS += " " + libs
-    end
-  end
-
-end
-
-def crash(str)
-  print " extconf failure: #{str}\n"
-  exit 1
-end
-
-
-if (not have_library('csm')) #or (not find_header('icp.h','/usr/local/include'))
-	$stderr.puts "Error: not having library 'csm'"
-	exit
-else
-	$LOCAL_LIBS += ' -lcsm'
-end
-
-$CPPFLAGS += " -Wall -W -Wmissing-prototypes -Wconversion "
-$CPPFLAGS += " -Wunreachable-code "
-$CPPFLAGS += " -DRUBY"
-gsl_config();
-
-srcs = %w(rb_sm sm_wrap) 
-$objs = srcs.collect{|i| i+".o"}
-
-create_makefile('sm')
-if false
-File.open("Makefile","a") do |f|
-	f.puts <<-EOF
-# Copy other sources from other directory
-%.o: ../%.o
-	cp $< $@
-	
-EOF
-
-end end
diff --git a/misc/sm_ruby_wrapper/go.sh b/misc/sm_ruby_wrapper/go.sh
deleted file mode 100755
index f8440d5d2560278d742c2a1208877a61269d358c..0000000000000000000000000000000000000000
--- a/misc/sm_ruby_wrapper/go.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-swig -ruby sm.i
-ruby extconf.rb --with-opt-dir=../deploy
-make clean
-make 2>&1  | egrep -v 'never|function|argv|self'
-make install
-echo "puts require('sm')" | ruby
diff --git a/misc/sm_ruby_wrapper/lib/sm_gpm.rb b/misc/sm_ruby_wrapper/lib/sm_gpm.rb
deleted file mode 100644
index 5090bdb148411590ad7c7e83eef3a12c0494d6b3..0000000000000000000000000000000000000000
--- a/misc/sm_ruby_wrapper/lib/sm_gpm.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require 'sm'		
-require 'sm_icp'
-
-require 'rsm'
-
-module Sm
-	
-	class GPMC
-		include MathUtils	
-		include Math
-	
-		attr_accessor :params
-	
-		def initialize
-			@params = standard_parameters
-		end
-	
-		def name 
-			"GPMC"
-		end
-
-		def scan_matching
-		
-			Sm.put_params_in_c_structures(params)
-		
-			Sm::rb_sm_gpm()
-		
-			res = Sm.get_result_from_c_structures()
-		
-			Sm::rb_sm_cleanup()
-		
-			res
-		end
-	
-	
-		def journal_open(filename)
-			Sm::rb_sm_init_journal(filename)
-		end
-	end
-
-end
\ No newline at end of file
diff --git a/misc/sm_ruby_wrapper/lib/sm_icp.rb b/misc/sm_ruby_wrapper/lib/sm_icp.rb
deleted file mode 100644
index cae9f35c57a845da067b7eae8e50a94fd24b297b..0000000000000000000000000000000000000000
--- a/misc/sm_ruby_wrapper/lib/sm_icp.rb
+++ /dev/null
@@ -1,104 +0,0 @@
-#begin
-	require 'sm'
-	require 'rsm'
-# rescue => ex
-# 	puts ex, ex.backtrace
-# end
-
-module Sm
-	
-# pass parameters 
-def Sm.params2method(params, ob)
-	params.keys.map{|x|x.to_s}.sort.map{|x|x.to_sym}.
-	each { |param| value = params[param]
-		method = "#{param}="
-		if ob.methods.include? method
-			old_value = ob.__send__(param.to_s)
-#			ob.__send__(method, value)
-			if old_value  != value
-				$stderr.puts "Setting #{method} #{value} (#{old_value})" 
-		
-				if 0 == rb_sm_set_configuration(param.to_s, value.to_s);
-					raise "Error setting #{param.inspect}"
-				end
-			end
-		else
-			raise "Structure does not have method #{method}"
-		end
-	}
-end
-
-def Sm.put_params_in_c_structures(params)
-# pass all parameters to extension library
-
-	s = params[:laser_ref].to_json
-	rb_set_laser_ref(s);
-	
-	s = params[:laser_sens].to_json
-	rb_set_laser_sens(s);
-
-	u = params[:firstGuess];
-	rb_sm_odometry(u[0],u[1],u[2]);
-
-	remove = [:laser_ref, :firstGuess, :laser_sens]
-	filtered = params.clone.delete_if {|k,v| remove.include? k }
-	Sm.params2method(filtered, Sm::rb_sm_params)
-end
-
-def Sm.get_result_from_c_structures()
-	
-#	ld_free(rb_sm_params.laser_sens);
-#	ld_free(rb_sm_params.laser_ref);
-	
-	
-	res = JSON.parse(rb_result_to_json)
-
-	res2 = {}
-	res.keys.each do |k|
-		res2[k.to_sym] = res[k]
-	end
-	res = res2
-	
-#	p res
-	res[:valid] = res[:valid] == 1
-	if res[:valid]
-		res[:x] = Vector[*res[:x]].col
-		res[:avg_error] = res[:error] / res[:nvalid]
-	end
-	res
-	
-end
-
-	class ICPC
-		include MathUtils	
-		include Math
-
-		attr_accessor :params
-	
-		def initialize
-			@params = standard_parameters
-		end
-	
-		def name 
-			"ICPC"
-		end
-
-		def scan_matching
-			Sm.put_params_in_c_structures(params)
-	
-			Sm::rb_sm_icp()
-
-			res = Sm.get_result_from_c_structures()
-			
-			Sm::rb_sm_cleanup
-		
-			res
-		end
-	
-	
-		def journal_open(filename)
-			Sm::rb_sm_init_journal(filename)
-		end
-	end
-
-end
\ No newline at end of file
diff --git a/misc/sm_ruby_wrapper/rb_sm.c b/misc/sm_ruby_wrapper/rb_sm.c
deleted file mode 100644
index 53da151003c1a66147e415ea9cf24a085bdf6efe..0000000000000000000000000000000000000000
--- a/misc/sm_ruby_wrapper/rb_sm.c
+++ /dev/null
@@ -1,96 +0,0 @@
-#include "rb_sm.h"
-#include <stdio.h>
-#include <gsl/gsl_nan.h>
-#include <options/options.h>
-
-struct sm_params rb_sm_params; 
-struct sm_result rb_sm_result;
-
-void rb_sm_init_journal(const char*journal_file) {
-	jj_set_stream(open_file_for_writing(journal_file));
-/*	sm_journal_open(journal_file);*/
-}
-
-void rb_sm_close_journal() {
-	FILE * s = jj_get_stream();
-	if(s) fclose(s);
-	
-	jj_set_stream(0);
-}
-
-void rb_sm_odometry(double x, double y, double theta){
-	rb_sm_params.first_guess[0]=x;
-	rb_sm_params.first_guess[1]=y;
-	rb_sm_params.first_guess[2]=theta;
-}
-
-void rb_sm_odometry_cov(double cov_x, double cov_y, double cov_theta){
-	
-}
-
-struct option* ops = 0;
-
-int rb_sm_set_configuration(const char*name, const char*value) {
-	if(!ops) { 
-		ops = options_allocate(30);
-		sm_options(&rb_sm_params, ops);
-	}
-	
-	if(!options_try_pair(ops, name, value)) {
-
-		return 0;
-	} else
-	return 1;
-}
-
-const char *rb_result_to_json() {
-	static char buf[5000];
-	JO jo = result_to_json(&rb_sm_params, &rb_sm_result);
-	strcpy(buf, jo_to_string(jo));
-	jo_free(jo);
-	return buf;
-}
-
-int rb_sm_icp() {
-	sm_icp(&rb_sm_params, &rb_sm_result);
-	return rb_sm_result.valid;
-}
-
-int rb_sm_gpm() {	
-	sm_gpm(&rb_sm_params, &rb_sm_result);
-	return rb_sm_result.valid;
-}
-
-void rb_set_laser_ref(const char*s) {
-	rb_sm_params.laser_ref = string_to_ld(s);
-/*	fprintf(stderr, "Set laser_ref to %p\n ", rb_sm_params.laser_ref );*/
-}
-
-void rb_set_laser_sens(const char*s) {
-	rb_sm_params.laser_sens = string_to_ld(s);
-/*	fprintf(stderr, "Set laser_sens to %p\n ", rb_sm_params.laser_sens );*/
-}
-
-void rb_sm_cleanup() {
-	if(rb_sm_params.laser_ref)
-	ld_free(rb_sm_params.laser_ref);
-	if(rb_sm_params.laser_sens)
-	ld_free(rb_sm_params.laser_sens);
-}
-
-LDP string_to_ld(const char*s) {
-	JO jo = json_parse(s);
-	if(!jo) {
-		fprintf(stderr, "String passed from Ruby is invalid JSON: \n\n%s\n", s);
-		return 0;
-	}
-	LDP ld = json_to_ld(jo);
-	if(!ld) {
-		fprintf(stderr, "String passed from Ruby is valid JSON, "
-			"but can't load laser_data. \n\n%s\n", s);
-		return 0;
-	}
-	jo_free(jo);
-	return ld;
-}
-
diff --git a/misc/sm_ruby_wrapper/rb_sm.h b/misc/sm_ruby_wrapper/rb_sm.h
deleted file mode 100644
index 898b61d0e6b0e459931dd1eadb7c7473b0374927..0000000000000000000000000000000000000000
--- a/misc/sm_ruby_wrapper/rb_sm.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef H_SM_RUBY_WRAPPER
-#define H_SM_RUBY_WRAPPER
-
-#include <csm/csm.h>
-
-/** Interface for Ruby: there are no pointers around. */
-
-int rb_sm_set_configuration(const char*name, const char*value);
-
-
-void rb_sm_odometry(double x, double y, double theta);
-void rb_sm_odometry_cov(double cov_x, double cov_y, double cov_theta);
-
-int rb_sm_icp();
-int rb_sm_gpm();
-
-const char *rb_result_to_json();
-
-LDP string_to_ld(const char*s);
-
-
-void rb_set_laser_ref(const char*s);
-void rb_set_laser_sens(const char*s);
-
-void rb_sm_cleanup();
-
-
-
-void rb_sm_init_journal(const char*journal_file);
-void rb_sm_close_journal();
-
-#include <csm/csm.h>
-
-extern struct sm_params rb_sm_params;
-extern struct sm_result rb_sm_result;
-
-#endif
diff --git a/misc/sm_ruby_wrapper/sm.i b/misc/sm_ruby_wrapper/sm.i
deleted file mode 100644
index 8af4e0d8b54ef0277bd79ac4c4109b0a9a55f6fc..0000000000000000000000000000000000000000
--- a/misc/sm_ruby_wrapper/sm.i
+++ /dev/null
@@ -1,83 +0,0 @@
-%module sm
-
-%header %{
-	#include "rb_sm.h"
-%}
-
-struct sm_params {
-	LDP laser_ref;
-	LDP laser_sens;
-
-	double max_angular_correction_deg;
-	double max_linear_correction;
-	int max_iterations;
-	double epsilon_xy;
-	double epsilon_theta; 
-	double max_correspondence_dist;
-	
-	int restart;
-	double restart_threshold_mean_error;
-	double restart_dt;
-	double restart_dtheta;
-	
-	double sigma;
-	
-	double clustering_threshold;
-	int orientation_neighbourhood;
-	
-	int do_alpha_test;
-	double do_alpha_test_thresholdDeg;
-	
-	double outliers_maxPerc;
-	double outliers_adaptive_order; 
-	double outliers_adaptive_mult; 
-	
-	int do_visibility_test;
-	int use_corr_tricks;
-	int do_compute_covariance;
-	
-};
-
-struct sm_result {
-	int valid;
-	
-	double x[3];
-	int iterations;
-	double error;
-	int nvalid;
-};
-
-
-JO ld_to_json(LDP);
-LDP json_to_ld(JO);
-
-const char *rb_result_to_json();
-
-LDP string_to_ld(const char*s);
-void ld_free(LDP);
-void jo_free(JO);
-
-JO json_parse(const char*str);
-const char* json_write(JO jo);
-
-
-int rb_sm_set_configuration(const char*name, const char*value);
-void rb_sm_init_journal(const char*journal_file);
-void rb_sm_close_journal();
-
-
-void rb_set_laser_ref(const char*);
-void rb_set_laser_sens(const char*);
-
-void rb_sm_odometry(double x, double y, double theta);
-void rb_sm_odometry_cov(double cov_x, double cov_y, double cov_theta);
-
-int rb_sm_icp();
-int rb_sm_gpm();
-
-void rb_sm_cleanup();
-
-%inline {
-extern struct sm_params rb_sm_params;
-extern struct sm_result rb_sm_result;
-}
\ No newline at end of file
diff --git a/misc/tests/failure1/Makefile b/misc/tests/failure1/Makefile
deleted file mode 100644
index 4b042b20b6b6cbb598f7cd456f8dd7ea8d8ec405..0000000000000000000000000000000000000000
--- a/misc/tests/failure1/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-
-only_corr=-sens_countour_draw 0 -ref_countour_draw 0 -sens_points_draw 0 -ref_points_draw 0 -sens_rays_draw 0 -ref_rays_draw 0 -write_info 1
-
-all:
-	json_extract -nth 0 -in stallo2.log -out stallo2-0.json
-	json_extract -nth 1 -in stallo2.log -out stallo2-1.json
-	log2pdf -config hokuyo.config -use odometry -in stallo2-0.json
-	log2pdf -config hokuyo.config -use odometry -in stallo2-1.json
-	log2pdf -config hokuyo.config -use odometry -in stallo2.log -distance_xy 0
-	sm2 -restart 0 -in stallo2.log -out stallo2_plicp.log -max_iterations 10 -file_jj stallo2_plicp.journal
-	sm_animate $(only_corr) -in  stallo2_plicp.journal -out 'stallo2_plicp_%02d.pdf'
-	sm2 -restart 0  -in stallo2.log -out stallo2_icp.log  -use_point_to_line_distance  0 -max_iterations 10 -file_jj stallo2_icp.journal
-	sm_animate $(only_corr) -in  stallo2_icp.journal -out 'stallo2_icp_%02d.pdf'
-	sm2    -in stallo2.log -out stallo2_gpm.log  -algo 1 -file_jj stallo2_gpm.journal
-	log2pdf -config hokuyo.config -use estimate -in stallo2_gpm.log
-	sm2  -restart 0 -max_correspondence_dist  0.2 -in stallo2.log -out stallo2_plicp2.log -max_iterations 10 -file_jj stallo2_plicp2.journal
-	sm_animate $(only_corr) -in  stallo2_plicp2.journal -out 'stallo2_plicp2_%02d.pdf'
-	sm2  -restart 0 -max_correspondence_dist  0.2 -in stallo2.log -out stallo2_icp2.log -max_iterations 10 -file_jj stallo2_icp2.journal  -use_point_to_line_distance  0
-	sm_animate $(only_corr) -in  stallo2_icp2.journal -out 'stallo2_icp2_%02d.pdf'
-
diff --git a/misc/tests/failure1/hokuyo.config b/misc/tests/failure1/hokuyo.config
deleted file mode 100644
index 5647a0eb1bf42f9defb8b990ba16aee0c9b67bc3..0000000000000000000000000000000000000000
--- a/misc/tests/failure1/hokuyo.config
+++ /dev/null
@@ -1,29 +0,0 @@
-padding                  0.2       
-dimension                500       
-offset_theta_deg         0         
-distance_xy              5         
-distance_th_deg          45        
-start_pose_width         0.01       
-laser_rays_draw          1         
-laser_rays_color         #f00      
-laser_rays_width         0.0002    
-laser_countour_draw      1         
-laser_countour_color     black     
-laser_countour_width     0.002      
-laser_points_draw        0         
-laser_points_color       #f00      
-laser_points_width       0.002     
-laser_points_radius      0.003     
-laser_pose_draw          1         
-laser_pose_color         #f73      
-laser_pose_width         0.002     
-laser_pose_radius        0.01      
-laser_normals_draw       0         
-laser_normals_color      black     
-laser_normals_width      0.002     
-laser_normals_length     0.1       
-laser_connect_threshold  0.4       
-laser_horizon            10        
-path_draw                1         
-path_color               #f00      
-path_width               0.01       
diff --git a/misc/tests/failure1/stallo2.log b/misc/tests/failure1/stallo2.log
deleted file mode 100644
index 541f57a95a97764029a4e4a034d2c5cd1a14d290..0000000000000000000000000000000000000000
--- a/misc/tests/failure1/stallo2.log
+++ /dev/null
@@ -1,2 +0,0 @@
-{ "nrays": 1024, "min_theta": 0.003100, "max_theta": 6.280100, "theta": [ 0.003100, 0.009236, 0.015372, 0.021508, 0.027643, 0.033779, 0.039915, 0.046051, 0.052187, 0.058323, 0.064459, 0.070595, 0.076730, 0.082866, 0.089002, 0.095138, 0.101274, 0.107410, 0.113546, 0.119682, 0.125817, 0.131953, 0.138089, 0.144225, 0.150361, 0.156497, 0.162633, 0.168769, 0.174904, 0.181040, 0.187176, 0.193312, 0.199448, 0.205584, 0.211720, 0.217856, 0.223991, 0.230127, 0.236263, 0.242399, 0.248535, 0.254671, 0.260807, 0.266943, 0.273078, 0.279214, 0.285350, 0.291486, 0.297622, 0.303758, 0.309894, 0.316030, 0.322165, 0.328301, 0.334437, 0.340573, 0.346709, 0.352845, 0.358981, 0.365117, 0.371252, 0.377388, 0.383524, 0.389660, 0.395796, 0.401932, 0.408068, 0.414204, 0.420339, 0.426475, 0.432611, 0.438747, 0.444883, 0.451019, 0.457155, 0.463291, 0.469426, 0.475562, 0.481698, 0.487834, 0.493970, 0.500106, 0.506242, 0.512378, 0.518513, 0.524649, 0.530785, 0.536921, 0.543057, 0.549193, 0.555329, 0.561465, 0.567600, 0.573736, 0.579872, 0.586008, 0.592144, 0.598280, 0.604416, 0.610552, 0.616687, 0.622823, 0.628959, 0.635095, 0.641231, 0.647367, 0.653503, 0.659639, 0.665774, 0.671910, 0.678046, 0.684182, 0.690318, 0.696454, 0.702590, 0.708726, 0.714861, 0.720997, 0.727133, 0.733269, 0.739405, 0.745541, 0.751677, 0.757813, 0.763948, 0.770084, 0.776220, 0.782356, 0.788492, 0.794628, 0.800764, 0.806900, 0.813035, 0.819171, 0.825307, 0.831443, 0.837579, 0.843715, 0.849851, 0.855987, 0.862122, 0.868258, 0.874394, 0.880530, 0.886666, 0.892802, 0.898938, 0.905074, 0.911209, 0.917345, 0.923481, 0.929617, 0.935753, 0.941889, 0.948025, 0.954161, 0.960296, 0.966432, 0.972568, 0.978704, 0.984840, 0.990976, 0.997112, 1.003248, 1.009383, 1.015519, 1.021655, 1.027791, 1.033927, 1.040063, 1.046199, 1.052335, 1.058470, 1.064606, 1.070742, 1.076878, 1.083014, 1.089150, 1.095286, 1.101422, 1.107557, 1.113693, 1.119829, 1.125965, 1.132101, 1.138237, 1.144373, 1.150509, 1.156644, 1.162780, 1.168916, 1.175052, 1.181188, 1.187324, 1.193460, 1.199596, 1.205731, 1.211867, 1.218003, 1.224139, 1.230275, 1.236411, 1.242547, 1.248683, 1.254818, 1.260954, 1.267090, 1.273226, 1.279362, 1.285498, 1.291634, 1.297770, 1.303905, 1.310041, 1.316177, 1.322313, 1.328449, 1.334585, 1.340721, 1.346857, 1.352992, 1.359128, 1.365264, 1.371400, 1.377536, 1.383672, 1.389808, 1.395944, 1.402079, 1.408215, 1.414351, 1.420487, 1.426623, 1.432759, 1.438895, 1.445031, 1.451166, 1.457302, 1.463438, 1.469574, 1.475710, 1.481846, 1.487982, 1.494118, 1.500253, 1.506389, 1.512525, 1.518661, 1.524797, 1.530933, 1.537069, 1.543205, 1.549340, 1.555476, 1.561612, 1.567748, 1.573884, 1.580020, 1.586156, 1.592292, 1.598427, 1.604563, 1.610699, 1.616835, 1.622971, 1.629107, 1.635243, 1.641379, 1.647514, 1.653650, 1.659786, 1.665922, 1.672058, 1.678194, 1.684330, 1.690466, 1.696601, 1.702737, 1.708873, 1.715009, 1.721145, 1.727281, 1.733417, 1.739553, 1.745688, 1.751824, 1.757960, 1.764096, 1.770232, 1.776368, 1.782504, 1.788640, 1.794775, 1.800911, 1.807047, 1.813183, 1.819319, 1.825455, 1.831591, 1.837727, 1.843862, 1.849998, 1.856134, 1.862270, 1.868406, 1.874542, 1.880678, 1.886814, 1.892949, 1.899085, 1.905221, 1.911357, 1.917493, 1.923629, 1.929765, 1.935901, 1.942036, 1.948172, 1.954308, 1.960444, 1.966580, 1.972716, 1.978852, 1.984988, 1.991123, 1.997259, 2.003395, 2.009531, 2.015667, 2.021803, 2.027939, 2.034075, 2.040210, 2.046346, 2.052482, 2.058618, 2.064754, 2.070890, 2.077026, 2.083162, 2.089297, 2.095433, 2.101569, 2.107705, 2.113841, 2.119977, 2.126113, 2.132249, 2.138384, 2.144520, 2.150656, 2.156792, 2.162928, 2.169064, 2.175200, 2.181336, 2.187471, 2.193607, 2.199743, 2.205879, 2.212015, 2.218151, 2.224287, 2.230423, 2.236558, 2.242694, 2.248830, 2.254966, 2.261102, 2.267238, 2.273374, 2.279510, 2.285645, 2.291781, 2.297917, 2.304053, 2.310189, 2.316325, 2.322461, 2.328597, 2.334732, 2.340868, 2.347004, 2.353140, 2.359276, 2.365412, 2.371548, 2.377684, 2.383819, 2.389955, 2.396091, 2.402227, 2.408363, 2.414499, 2.420635, 2.426771, 2.432906, 2.439042, 2.445178, 2.451314, 2.457450, 2.463586, 2.469722, 2.475858, 2.481993, 2.488129, 2.494265, 2.500401, 2.506537, 2.512673, 2.518809, 2.524945, 2.531080, 2.537216, 2.543352, 2.549488, 2.555624, 2.561760, 2.567896, 2.574032, 2.580167, 2.586303, 2.592439, 2.598575, 2.604711, 2.610847, 2.616983, 2.623119, 2.629254, 2.635390, 2.641526, 2.647662, 2.653798, 2.659934, 2.666070, 2.672206, 2.678341, 2.684477, 2.690613, 2.696749, 2.702885, 2.709021, 2.715157, 2.721293, 2.727428, 2.733564, 2.739700, 2.745836, 2.751972, 2.758108, 2.764244, 2.770380, 2.776515, 2.782651, 2.788787, 2.794923, 2.801059, 2.807195, 2.813331, 2.819467, 2.825602, 2.831738, 2.837874, 2.844010, 2.850146, 2.856282, 2.862418, 2.868554, 2.874689, 2.880825, 2.886961, 2.893097, 2.899233, 2.905369, 2.911505, 2.917641, 2.923776, 2.929912, 2.936048, 2.942184, 2.948320, 2.954456, 2.960592, 2.966728, 2.972863, 2.978999, 2.985135, 2.991271, 2.997407, 3.003543, 3.009679, 3.015815, 3.021950, 3.028086, 3.034222, 3.040358, 3.046494, 3.052630, 3.058766, 3.064902, 3.071037, 3.077173, 3.083309, 3.089445, 3.095581, 3.101717, 3.107853, 3.113989, 3.120124, 3.126260, 3.132396, 3.138532, 3.144668, 3.150804, 3.156940, 3.163076, 3.169211, 3.175347, 3.181483, 3.187619, 3.193755, 3.199891, 3.206027, 3.212163, 3.218298, 3.224434, 3.230570, 3.236706, 3.242842, 3.248978, 3.255114, 3.261250, 3.267385, 3.273521, 3.279657, 3.285793, 3.291929, 3.298065, 3.304201, 3.310337, 3.316472, 3.322608, 3.328744, 3.334880, 3.341016, 3.347152, 3.353288, 3.359424, 3.365559, 3.371695, 3.377831, 3.383967, 3.390103, 3.396239, 3.402375, 3.408511, 3.414646, 3.420782, 3.426918, 3.433054, 3.439190, 3.445326, 3.451462, 3.457598, 3.463733, 3.469869, 3.476005, 3.482141, 3.488277, 3.494413, 3.500549, 3.506685, 3.512820, 3.518956, 3.525092, 3.531228, 3.537364, 3.543500, 3.549636, 3.555772, 3.561907, 3.568043, 3.574179, 3.580315, 3.586451, 3.592587, 3.598723, 3.604859, 3.610994, 3.617130, 3.623266, 3.629402, 3.635538, 3.641674, 3.647810, 3.653946, 3.660081, 3.666217, 3.672353, 3.678489, 3.684625, 3.690761, 3.696897, 3.703033, 3.709168, 3.715304, 3.721440, 3.727576, 3.733712, 3.739848, 3.745984, 3.752120, 3.758255, 3.764391, 3.770527, 3.776663, 3.782799, 3.788935, 3.795071, 3.801207, 3.807342, 3.813478, 3.819614, 3.825750, 3.831886, 3.838022, 3.844158, 3.850294, 3.856429, 3.862565, 3.868701, 3.874837, 3.880973, 3.887109, 3.893245, 3.899381, 3.905516, 3.911652, 3.917788, 3.923924, 3.930060, 3.936196, 3.942332, 3.948468, 3.954603, 3.960739, 3.966875, 3.973011, 3.979147, 3.985283, 3.991419, 3.997555, 4.003690, 4.009826, 4.015962, 4.022098, 4.028234, 4.034370, 4.040506, 4.046642, 4.052777, 4.058913, 4.065049, 4.071185, 4.077321, 4.083457, 4.089593, 4.095729, 4.101864, 4.108000, 4.114136, 4.120272, 4.126408, 4.132544, 4.138680, 4.144816, 4.150951, 4.157087, 4.163223, 4.169359, 4.175495, 4.181631, 4.187767, 4.193903, 4.200038, 4.206174, 4.212310, 4.218446, 4.224582, 4.230718, 4.236854, 4.242990, 4.249125, 4.255261, 4.261397, 4.267533, 4.273669, 4.279805, 4.285941, 4.292077, 4.298212, 4.304348, 4.310484, 4.316620, 4.322756, 4.328892, 4.335028, 4.341164, 4.347299, 4.353435, 4.359571, 4.365707, 4.371843, 4.377979, 4.384115, 4.390251, 4.396386, 4.402522, 4.408658, 4.414794, 4.420930, 4.427066, 4.433202, 4.439338, 4.445473, 4.451609, 4.457745, 4.463881, 4.470017, 4.476153, 4.482289, 4.488425, 4.494560, 4.500696, 4.506832, 4.512968, 4.519104, 4.525240, 4.531376, 4.537512, 4.543647, 4.549783, 4.555919, 4.562055, 4.568191, 4.574327, 4.580463, 4.586599, 4.592734, 4.598870, 4.605006, 4.611142, 4.617278, 4.623414, 4.629550, 4.635686, 4.641821, 4.647957, 4.654093, 4.660229, 4.666365, 4.672501, 4.678637, 4.684773, 4.690908, 4.697044, 4.703180, 4.709316, 4.715452, 4.721588, 4.727724, 4.733860, 4.739995, 4.746131, 4.752267, 4.758403, 4.764539, 4.770675, 4.776811, 4.782947, 4.789082, 4.795218, 4.801354, 4.807490, 4.813626, 4.819762, 4.825898, 4.832034, 4.838169, 4.844305, 4.850441, 4.856577, 4.862713, 4.868849, 4.874985, 4.881121, 4.887256, 4.893392, 4.899528, 4.905664, 4.911800, 4.917936, 4.924072, 4.930208, 4.936343, 4.942479, 4.948615, 4.954751, 4.960887, 4.967023, 4.973159, 4.979295, 4.985430, 4.991566, 4.997702, 5.003838, 5.009974, 5.016110, 5.022246, 5.028382, 5.034517, 5.040653, 5.046789, 5.052925, 5.059061, 5.065197, 5.071333, 5.077469, 5.083604, 5.089740, 5.095876, 5.102012, 5.108148, 5.114284, 5.120420, 5.126556, 5.132691, 5.138827, 5.144963, 5.151099, 5.157235, 5.163371, 5.169507, 5.175643, 5.181778, 5.187914, 5.194050, 5.200186, 5.206322, 5.212458, 5.218594, 5.224730, 5.230865, 5.237001, 5.243137, 5.249273, 5.255409, 5.261545, 5.267681, 5.273817, 5.279952, 5.286088, 5.292224, 5.298360, 5.304496, 5.310632, 5.316768, 5.322904, 5.329039, 5.335175, 5.341311, 5.347447, 5.353583, 5.359719, 5.365855, 5.371991, 5.378126, 5.384262, 5.390398, 5.396534, 5.402670, 5.408806, 5.414942, 5.421078, 5.427213, 5.433349, 5.439485, 5.445621, 5.451757, 5.457893, 5.464029, 5.470165, 5.476300, 5.482436, 5.488572, 5.494708, 5.500844, 5.506980, 5.513116, 5.519252, 5.525387, 5.531523, 5.537659, 5.543795, 5.549931, 5.556067, 5.562203, 5.568339, 5.574474, 5.580610, 5.586746, 5.592882, 5.599018, 5.605154, 5.611290, 5.617426, 5.623561, 5.629697, 5.635833, 5.641969, 5.648105, 5.654241, 5.660377, 5.666513, 5.672648, 5.678784, 5.684920, 5.691056, 5.697192, 5.703328, 5.709464, 5.715600, 5.721735, 5.727871, 5.734007, 5.740143, 5.746279, 5.752415, 5.758551, 5.764687, 5.770822, 5.776958, 5.783094, 5.789230, 5.795366, 5.801502, 5.807638, 5.813774, 5.819909, 5.826045, 5.832181, 5.838317, 5.844453, 5.850589, 5.856725, 5.862861, 5.868996, 5.875132, 5.881268, 5.887404, 5.893540, 5.899676, 5.905812, 5.911948, 5.918083, 5.924219, 5.930355, 5.936491, 5.942627, 5.948763, 5.954899, 5.961035, 5.967170, 5.973306, 5.979442, 5.985578, 5.991714, 5.997850, 6.003986, 6.010122, 6.016257, 6.022393, 6.028529, 6.034665, 6.040801, 6.046937, 6.053073, 6.059209, 6.065344, 6.071480, 6.077616, 6.083752, 6.089888, 6.096024, 6.102160, 6.108296, 6.114431, 6.120567, 6.126703, 6.132839, 6.138975, 6.145111, 6.151247, 6.157383, 6.163518, 6.169654, 6.175790, 6.181926, 6.188062, 6.194198, 6.200334, 6.206470, 6.212605, 6.218741, 6.224877, 6.231013, 6.237149, 6.243285, 6.249421, 6.255557, 6.261692, 6.267828, 6.273964, 6.280100 ], "readings": [ 0.653740, 0.655940, 0.654140, 0.657610, 0.659990, 0.661120, 0.665500, 0.665920, 0.666580, 0.672090, 0.669020, 0.676430, 0.677770, 0.678930, 0.680820, 0.683360, 0.686250, 0.688910, 0.690010, 0.693820, 0.692510, 0.695700, 0.702650, 0.700860, 0.705410, 0.706910, 0.716390, 0.717180, 0.717330, 0.721380, 0.720940, 0.729810, 0.730530, 0.732310, 0.734860, 0.743450, 0.746830, 0.748300, 0.753110, 0.755920, 0.758180, 0.763210, 0.765080, 0.768400, 0.773240, 0.774460, 0.781750, 0.787740, 0.790240, 0.793180, 0.799000, 0.806090, 0.808760, 0.808790, 0.813450, 0.820290, 0.827070, 0.832550, 0.836450, 0.841030, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0.166720, 0.164870, 0.166580, 0.163650, 0.162140, 0.166100, 0.161530, 0.161070, 0.161740, 0.160590, 0.162720, 0.161770, 0.159530, 0.156740, 0.156790, 0.153970, 0.155820, 0.156710, 0.155970, 0.154660, 0.155960, 0.154230, 0.151930, 0.155930, 0.151950, 0.153930, 0.149430, 0.152420, 0.152510, 0.147780, 0.146880, 0.152120, 0.146600, 0.148850, 0.146490, 0.147780, 0.146200, 0.148180, 0.145120, 0.149800, 0.144440, 0.147840, 0.142480, 0.143730, 0.142380, 0.144560, 0.144120, 0.143000, 0.140390, 0.144910, 0.145640, 0.143960, 0.142240, 0.144650, 0.145480, 0.142390, 0.137550, 0.138480, 0.142130, 0.140180, 0.142430, 0.138650, 0.137120, 0.139520, 0.142810, 0.138060, 0.140300, 0.136980, 0.135890, 0.136960, 0.140430, 0.136270, 0.136460, 0.138380, 0.141030, 0.140850, 0.137620, 0.139100, 0.137950, 0.136090, 0.140620, 0.137760, 0.138120, 0.137940, 0.135240, 0.139050, 0.138380, 0.137380, 0.137650, 0.137390, 0.137840, 0.136580, 0.138990, 0.136360, 0.133460, 0.137560, 0.135530, 0.135800, 0.136980, 0.139160, 0.134780, 0.137100, 0.133810, 0.136000, 0.133380, 0.138440, 0.139400, 0.137070, 0.137700, 0.137720, 0.137430, 0.135180, 0.135750, 0.138580, 0.137550, 0.139680, 0.136420, 0.137350, 0.136710, 0.139700, 0.140950, 0.136520, 0.135140, 0.138560, 0.137110, 0.136600, 0.138640, 0.137360, 0.139100, 0.139380, 0.140620, 0.143290, 0.143310, 0.140890, 0.141010, 0.141310, 0.142430, 0.142260, 0.141740, 0.139100, 0.140280, 0.140310, 0.140270, 0.142780, 0.141320, 0.142340, 0.144620, 0.143950, 0.143830, 0.141390, 0.143320, 0.141600, 0.143770, 0.142360, 0.146020, 0.144460, 0.143800, 0.145640, 0.144590, 0.145450, 0.147950, 0.148930, 0.146590, 0.146300, 0.148950, 0.148920, 0.147020, 0.146930, 0.150160, 0.150220, 0.151460, 0.148300, 0.151300, 0.152620, 0.153110, 0.153960, 0.152080, 0.154270, 0.154650, 0.157240, 0.154830, 0.156920, 0.152800, 0.157990, 0.159560, 0.155490, 0.158150, 0.158470, 0.162400, 0.162520, 0.161650, 0.161670, 0.160940, 0.163620, 0.166920, 0.164190, 0.163010, 0.165510, 0.169120, 0.167690, 0.167930, 0.167620, 0.170210, 0.172010, 0.170320, 0.176060, 0.171760, 0.173430, 0.174130, 0.176800, 0.178630, 0.174460, 0.177180, 0.179200, 0.176480, 0.183870, 0.183560, 0.181400, 0.184930, 0.184290, 0.185390, 0.186900, 0.187900, 0.185810, 0.192360, 0.193170, 0.418620, 0.419770, 0.424890, 0.426030, 0.428280, 0.432960, 0.437440, 0.439390, 0.443400, 0.444610, 0.446980, 0.449370, 0.451180, 0.454420, 0.459970, 0.464370, 0.466860, 0.470490, 0.472150, 0.477200, 0.479250, 0.482620, 0.488110, 0.494070, 0.495930, 0.501940, 0.504930, 0.507840, 0.513410, 0.519440, 0.522410, 0.525360, 0.532870, 0.536180, 0.538670, 0.546350, 0.549030, 0.556250, 0.565750, 0.567960, 0.571460, 0.578370, 0.586410, 0.590720, 0.601750, 0.604190, 0.612450, 0.620800, 0.622370, 0.635590, 0.639990, 0.645070, 0.653040, 0.661490, 0.671410, 0.680640, 0.686810, 0.697850, 0.708520, 0.717260, 0.728880, 0.735500, 0.743570, 0.758790, 0.765370, 0.782990, 0.789270, 0.804380, 0.814880, 0.828450, 0.847700, 0.860240, 0.876100, 0.888090, 0.905020, 0.918670, 0.936810, 0.952870, 0.971690, 0.991730, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0.204720, 0.202570, 0.204860, 0.203350, 0.198920, 0.200580, 0.195210, 0.196810, 0.197820, 0.194420, 0.192770, 0.195310, 0.191210, 0.188460, 0.191240, 0.191690, 0.189610, 0.188470, 0.187080, 0.183440, 0.182270, 0.185850, 0.183740, 0.179370, 0.184090, 0.182800, 0.181720, 0.183450, 0.181730, 0.177150, 0.179000, 0.175710, 0.176080, 0.174820, 0.174550, 0.177730, 0.176130, 0.173240, 0.171330, 0.174500, 0.172350, 0.168770, 0.170970, 0.172350, 0.170620, 0.167830, 0.167470, 0.171560, 0.166380, 0.164000, 0.170620, 0.165350, 0.168140, 0.163570, 0.166190, 0.162390, 0.162590, 0.160660, 0.163550, 0.167100, 0.161980, 0.166410, 0.160700, 0.159030, 0.160480, 0.162950, 0.161740, 0.161260, 0.163240, 0.158440, 0.161040, 0.157610, 0.159490, 0.159340, 0.162310, 0.160510, 0.155730, 0.158890, 0.158990, 0.155450, 0.159140, 0.156230, 0.156770, 0.158860, 0.157360, 0.153550, 0.152440, 0.153090, 0.157250, 0.157320, 0.154700, 0.153720, 0.151470, 0.157830, 0.154220, 0.156430, 0.152990, 0.153840, 0.152560, 0.158200, 0.152010, 0.152030, 0.153290, 0.150390, 0.152700, 0.155750, 0.156230, 0.150960, 0.153920, 0.155140, 0.154540, 0.156740, 0.152070, 0.152530, 0.150320, 0.154510, 0.156910, 0.155280, 0.152640, 0.150670, 0.154030, 0.151460, 0.153670, 0.149720, 0.152590, 0.155550, 0.153660, 0.149730, 0.151040, 0.153050, 0.154030, 0.155910, 0.154310, 0.154090, 0.153810, 0.157480, 0.151700, 0.156200, 0.155220, 0.157460, 0.157170, 0.152590, 0.155910, 0.156300, 0.157020, 0.154680, 0.154310, 0.155540, 0.153810, 0.156770, 0.156410, 0.157930, 0.158880, 0.157930, 0.158540, 0.158240, 0.161640, 0.158740, 0.158340, 0.158360, 0.159190, 0.161380, 0.162330, 0.158950, 0.162280, 0.160820, 0.161190, 0.160910, 0.158430, 0.160020, 0.162940, 0.162920, 0.161910, 0.164350, 0.161400, 0.163220, 0.166680, 0.162490, 0.164790, 0.165130, 0.166740, 0.167600, 0.165860, 0.164920, 0.166540, 0.167260, 0.170500, 0.169190, 0.168190, 0.170820, 0.170110, 0.170530, 0.172040, 0.170600, 0.174530, 0.172260, 0.173980, 0.172810, 0.174880, 0.174430, 0.177340, 0.179920, 0.176880, 0.179140, 0.175580, 0.179170, 0.181050, 0.181890, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0.990140, 0.982070, 0.973160, 0.968150, 0.961540, 0.950540, 0.945040, 0.940500, 0.929700, 0.924980, 0.920310, 0.909460, 0.905400, 0.897430, 0.891940, 0.887590, 0.882750, 0.876900, 0.870910, 0.865300, 0.861540, 0.851240, 0.848690, 0.841240, 0.836340, 0.829880, 0.826040, 0.819970, 0.817150, 0.810050, 0.806410, 0.804370, 0.801010, 0.791060, 0.791070, 0.784540, 0.781070, 0.774100, 0.776010, 0.769570, 0.766640, 0.761060, 0.756260, 0.754170, 0.752260, 0.748410, 0.744440, 0.740900, 0.737540, 0.734800, 0.733580, 0.725500, 0.721530, 0.720960, 0.716050, 0.711990, 0.712510, 0.713440, 0.706800, 0.704860, 0.700360, 0.697840, 0.695090, 0.693490, 0.688950, 0.687890, 0.689540, 0.687360, 0.681070, 0.678640, 0.676890, 0.676220, 0.674970, 0.670380, 0.669220, 0.664220, 0.663570, 0.661690, 0.663610, 0.659170, 0.657790, 0.654520, 0.651720, 0.649440, 0.646070, 0.649310, 0.642800, 0.643150, 0.641780, 0.644320, 0.637580, 0.636980, 0.636720, 0.637150, 0.634830, 0.630200, 0.628850, 0.627710, 0.628390, 0.624680, 0.624320, 0.627350, 0.622510, 0.618340, 0.621800, 0.616200, 0.621580, 0.613810, 0.615050, 0.612270, 0.616950, 0.630860, 0.648730, 0.662330, 0.682180, 0.698120, 0.720660, 0.743120, 0.765000, 0.785090, 0.812900, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0.795830, 0.770900, 0.748170, 0.721550, 0.700320, 0.681730, 0.659260, 0.639870, 0.621370, 0.608260, 0.609500, 0.611740, 0.612290, 0.617690, 0.613110, 0.617960, 0.617930, 0.617780, 0.620670, 0.621870, 0.621270, 0.619540, 0.626280, 0.628310, 0.623570, 0.626170, 0.632610, 0.630980, 0.628560, 0.632960, 0.636120, 0.635080, 0.635730, 0.641060, 0.640170, 0.642670, 0.641800, 0.645030, 0.649650, 0.650340, 0.652180 ], "valid": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], "odometry": [ -0.275, -0.3696, 1.9638 ], "estimate": [ null, null, null ], "true_pose": [ null, null, null ]  }
-{ "nrays": 1024, "min_theta": 0.003100, "max_theta": 6.280100, "theta": [ 0.003100, 0.009236, 0.015372, 0.021508, 0.027643, 0.033779, 0.039915, 0.046051, 0.052187, 0.058323, 0.064459, 0.070595, 0.076730, 0.082866, 0.089002, 0.095138, 0.101274, 0.107410, 0.113546, 0.119682, 0.125817, 0.131953, 0.138089, 0.144225, 0.150361, 0.156497, 0.162633, 0.168769, 0.174904, 0.181040, 0.187176, 0.193312, 0.199448, 0.205584, 0.211720, 0.217856, 0.223991, 0.230127, 0.236263, 0.242399, 0.248535, 0.254671, 0.260807, 0.266943, 0.273078, 0.279214, 0.285350, 0.291486, 0.297622, 0.303758, 0.309894, 0.316030, 0.322165, 0.328301, 0.334437, 0.340573, 0.346709, 0.352845, 0.358981, 0.365117, 0.371252, 0.377388, 0.383524, 0.389660, 0.395796, 0.401932, 0.408068, 0.414204, 0.420339, 0.426475, 0.432611, 0.438747, 0.444883, 0.451019, 0.457155, 0.463291, 0.469426, 0.475562, 0.481698, 0.487834, 0.493970, 0.500106, 0.506242, 0.512378, 0.518513, 0.524649, 0.530785, 0.536921, 0.543057, 0.549193, 0.555329, 0.561465, 0.567600, 0.573736, 0.579872, 0.586008, 0.592144, 0.598280, 0.604416, 0.610552, 0.616687, 0.622823, 0.628959, 0.635095, 0.641231, 0.647367, 0.653503, 0.659639, 0.665774, 0.671910, 0.678046, 0.684182, 0.690318, 0.696454, 0.702590, 0.708726, 0.714861, 0.720997, 0.727133, 0.733269, 0.739405, 0.745541, 0.751677, 0.757813, 0.763948, 0.770084, 0.776220, 0.782356, 0.788492, 0.794628, 0.800764, 0.806900, 0.813035, 0.819171, 0.825307, 0.831443, 0.837579, 0.843715, 0.849851, 0.855987, 0.862122, 0.868258, 0.874394, 0.880530, 0.886666, 0.892802, 0.898938, 0.905074, 0.911209, 0.917345, 0.923481, 0.929617, 0.935753, 0.941889, 0.948025, 0.954161, 0.960296, 0.966432, 0.972568, 0.978704, 0.984840, 0.990976, 0.997112, 1.003248, 1.009383, 1.015519, 1.021655, 1.027791, 1.033927, 1.040063, 1.046199, 1.052335, 1.058470, 1.064606, 1.070742, 1.076878, 1.083014, 1.089150, 1.095286, 1.101422, 1.107557, 1.113693, 1.119829, 1.125965, 1.132101, 1.138237, 1.144373, 1.150509, 1.156644, 1.162780, 1.168916, 1.175052, 1.181188, 1.187324, 1.193460, 1.199596, 1.205731, 1.211867, 1.218003, 1.224139, 1.230275, 1.236411, 1.242547, 1.248683, 1.254818, 1.260954, 1.267090, 1.273226, 1.279362, 1.285498, 1.291634, 1.297770, 1.303905, 1.310041, 1.316177, 1.322313, 1.328449, 1.334585, 1.340721, 1.346857, 1.352992, 1.359128, 1.365264, 1.371400, 1.377536, 1.383672, 1.389808, 1.395944, 1.402079, 1.408215, 1.414351, 1.420487, 1.426623, 1.432759, 1.438895, 1.445031, 1.451166, 1.457302, 1.463438, 1.469574, 1.475710, 1.481846, 1.487982, 1.494118, 1.500253, 1.506389, 1.512525, 1.518661, 1.524797, 1.530933, 1.537069, 1.543205, 1.549340, 1.555476, 1.561612, 1.567748, 1.573884, 1.580020, 1.586156, 1.592292, 1.598427, 1.604563, 1.610699, 1.616835, 1.622971, 1.629107, 1.635243, 1.641379, 1.647514, 1.653650, 1.659786, 1.665922, 1.672058, 1.678194, 1.684330, 1.690466, 1.696601, 1.702737, 1.708873, 1.715009, 1.721145, 1.727281, 1.733417, 1.739553, 1.745688, 1.751824, 1.757960, 1.764096, 1.770232, 1.776368, 1.782504, 1.788640, 1.794775, 1.800911, 1.807047, 1.813183, 1.819319, 1.825455, 1.831591, 1.837727, 1.843862, 1.849998, 1.856134, 1.862270, 1.868406, 1.874542, 1.880678, 1.886814, 1.892949, 1.899085, 1.905221, 1.911357, 1.917493, 1.923629, 1.929765, 1.935901, 1.942036, 1.948172, 1.954308, 1.960444, 1.966580, 1.972716, 1.978852, 1.984988, 1.991123, 1.997259, 2.003395, 2.009531, 2.015667, 2.021803, 2.027939, 2.034075, 2.040210, 2.046346, 2.052482, 2.058618, 2.064754, 2.070890, 2.077026, 2.083162, 2.089297, 2.095433, 2.101569, 2.107705, 2.113841, 2.119977, 2.126113, 2.132249, 2.138384, 2.144520, 2.150656, 2.156792, 2.162928, 2.169064, 2.175200, 2.181336, 2.187471, 2.193607, 2.199743, 2.205879, 2.212015, 2.218151, 2.224287, 2.230423, 2.236558, 2.242694, 2.248830, 2.254966, 2.261102, 2.267238, 2.273374, 2.279510, 2.285645, 2.291781, 2.297917, 2.304053, 2.310189, 2.316325, 2.322461, 2.328597, 2.334732, 2.340868, 2.347004, 2.353140, 2.359276, 2.365412, 2.371548, 2.377684, 2.383819, 2.389955, 2.396091, 2.402227, 2.408363, 2.414499, 2.420635, 2.426771, 2.432906, 2.439042, 2.445178, 2.451314, 2.457450, 2.463586, 2.469722, 2.475858, 2.481993, 2.488129, 2.494265, 2.500401, 2.506537, 2.512673, 2.518809, 2.524945, 2.531080, 2.537216, 2.543352, 2.549488, 2.555624, 2.561760, 2.567896, 2.574032, 2.580167, 2.586303, 2.592439, 2.598575, 2.604711, 2.610847, 2.616983, 2.623119, 2.629254, 2.635390, 2.641526, 2.647662, 2.653798, 2.659934, 2.666070, 2.672206, 2.678341, 2.684477, 2.690613, 2.696749, 2.702885, 2.709021, 2.715157, 2.721293, 2.727428, 2.733564, 2.739700, 2.745836, 2.751972, 2.758108, 2.764244, 2.770380, 2.776515, 2.782651, 2.788787, 2.794923, 2.801059, 2.807195, 2.813331, 2.819467, 2.825602, 2.831738, 2.837874, 2.844010, 2.850146, 2.856282, 2.862418, 2.868554, 2.874689, 2.880825, 2.886961, 2.893097, 2.899233, 2.905369, 2.911505, 2.917641, 2.923776, 2.929912, 2.936048, 2.942184, 2.948320, 2.954456, 2.960592, 2.966728, 2.972863, 2.978999, 2.985135, 2.991271, 2.997407, 3.003543, 3.009679, 3.015815, 3.021950, 3.028086, 3.034222, 3.040358, 3.046494, 3.052630, 3.058766, 3.064902, 3.071037, 3.077173, 3.083309, 3.089445, 3.095581, 3.101717, 3.107853, 3.113989, 3.120124, 3.126260, 3.132396, 3.138532, 3.144668, 3.150804, 3.156940, 3.163076, 3.169211, 3.175347, 3.181483, 3.187619, 3.193755, 3.199891, 3.206027, 3.212163, 3.218298, 3.224434, 3.230570, 3.236706, 3.242842, 3.248978, 3.255114, 3.261250, 3.267385, 3.273521, 3.279657, 3.285793, 3.291929, 3.298065, 3.304201, 3.310337, 3.316472, 3.322608, 3.328744, 3.334880, 3.341016, 3.347152, 3.353288, 3.359424, 3.365559, 3.371695, 3.377831, 3.383967, 3.390103, 3.396239, 3.402375, 3.408511, 3.414646, 3.420782, 3.426918, 3.433054, 3.439190, 3.445326, 3.451462, 3.457598, 3.463733, 3.469869, 3.476005, 3.482141, 3.488277, 3.494413, 3.500549, 3.506685, 3.512820, 3.518956, 3.525092, 3.531228, 3.537364, 3.543500, 3.549636, 3.555772, 3.561907, 3.568043, 3.574179, 3.580315, 3.586451, 3.592587, 3.598723, 3.604859, 3.610994, 3.617130, 3.623266, 3.629402, 3.635538, 3.641674, 3.647810, 3.653946, 3.660081, 3.666217, 3.672353, 3.678489, 3.684625, 3.690761, 3.696897, 3.703033, 3.709168, 3.715304, 3.721440, 3.727576, 3.733712, 3.739848, 3.745984, 3.752120, 3.758255, 3.764391, 3.770527, 3.776663, 3.782799, 3.788935, 3.795071, 3.801207, 3.807342, 3.813478, 3.819614, 3.825750, 3.831886, 3.838022, 3.844158, 3.850294, 3.856429, 3.862565, 3.868701, 3.874837, 3.880973, 3.887109, 3.893245, 3.899381, 3.905516, 3.911652, 3.917788, 3.923924, 3.930060, 3.936196, 3.942332, 3.948468, 3.954603, 3.960739, 3.966875, 3.973011, 3.979147, 3.985283, 3.991419, 3.997555, 4.003690, 4.009826, 4.015962, 4.022098, 4.028234, 4.034370, 4.040506, 4.046642, 4.052777, 4.058913, 4.065049, 4.071185, 4.077321, 4.083457, 4.089593, 4.095729, 4.101864, 4.108000, 4.114136, 4.120272, 4.126408, 4.132544, 4.138680, 4.144816, 4.150951, 4.157087, 4.163223, 4.169359, 4.175495, 4.181631, 4.187767, 4.193903, 4.200038, 4.206174, 4.212310, 4.218446, 4.224582, 4.230718, 4.236854, 4.242990, 4.249125, 4.255261, 4.261397, 4.267533, 4.273669, 4.279805, 4.285941, 4.292077, 4.298212, 4.304348, 4.310484, 4.316620, 4.322756, 4.328892, 4.335028, 4.341164, 4.347299, 4.353435, 4.359571, 4.365707, 4.371843, 4.377979, 4.384115, 4.390251, 4.396386, 4.402522, 4.408658, 4.414794, 4.420930, 4.427066, 4.433202, 4.439338, 4.445473, 4.451609, 4.457745, 4.463881, 4.470017, 4.476153, 4.482289, 4.488425, 4.494560, 4.500696, 4.506832, 4.512968, 4.519104, 4.525240, 4.531376, 4.537512, 4.543647, 4.549783, 4.555919, 4.562055, 4.568191, 4.574327, 4.580463, 4.586599, 4.592734, 4.598870, 4.605006, 4.611142, 4.617278, 4.623414, 4.629550, 4.635686, 4.641821, 4.647957, 4.654093, 4.660229, 4.666365, 4.672501, 4.678637, 4.684773, 4.690908, 4.697044, 4.703180, 4.709316, 4.715452, 4.721588, 4.727724, 4.733860, 4.739995, 4.746131, 4.752267, 4.758403, 4.764539, 4.770675, 4.776811, 4.782947, 4.789082, 4.795218, 4.801354, 4.807490, 4.813626, 4.819762, 4.825898, 4.832034, 4.838169, 4.844305, 4.850441, 4.856577, 4.862713, 4.868849, 4.874985, 4.881121, 4.887256, 4.893392, 4.899528, 4.905664, 4.911800, 4.917936, 4.924072, 4.930208, 4.936343, 4.942479, 4.948615, 4.954751, 4.960887, 4.967023, 4.973159, 4.979295, 4.985430, 4.991566, 4.997702, 5.003838, 5.009974, 5.016110, 5.022246, 5.028382, 5.034517, 5.040653, 5.046789, 5.052925, 5.059061, 5.065197, 5.071333, 5.077469, 5.083604, 5.089740, 5.095876, 5.102012, 5.108148, 5.114284, 5.120420, 5.126556, 5.132691, 5.138827, 5.144963, 5.151099, 5.157235, 5.163371, 5.169507, 5.175643, 5.181778, 5.187914, 5.194050, 5.200186, 5.206322, 5.212458, 5.218594, 5.224730, 5.230865, 5.237001, 5.243137, 5.249273, 5.255409, 5.261545, 5.267681, 5.273817, 5.279952, 5.286088, 5.292224, 5.298360, 5.304496, 5.310632, 5.316768, 5.322904, 5.329039, 5.335175, 5.341311, 5.347447, 5.353583, 5.359719, 5.365855, 5.371991, 5.378126, 5.384262, 5.390398, 5.396534, 5.402670, 5.408806, 5.414942, 5.421078, 5.427213, 5.433349, 5.439485, 5.445621, 5.451757, 5.457893, 5.464029, 5.470165, 5.476300, 5.482436, 5.488572, 5.494708, 5.500844, 5.506980, 5.513116, 5.519252, 5.525387, 5.531523, 5.537659, 5.543795, 5.549931, 5.556067, 5.562203, 5.568339, 5.574474, 5.580610, 5.586746, 5.592882, 5.599018, 5.605154, 5.611290, 5.617426, 5.623561, 5.629697, 5.635833, 5.641969, 5.648105, 5.654241, 5.660377, 5.666513, 5.672648, 5.678784, 5.684920, 5.691056, 5.697192, 5.703328, 5.709464, 5.715600, 5.721735, 5.727871, 5.734007, 5.740143, 5.746279, 5.752415, 5.758551, 5.764687, 5.770822, 5.776958, 5.783094, 5.789230, 5.795366, 5.801502, 5.807638, 5.813774, 5.819909, 5.826045, 5.832181, 5.838317, 5.844453, 5.850589, 5.856725, 5.862861, 5.868996, 5.875132, 5.881268, 5.887404, 5.893540, 5.899676, 5.905812, 5.911948, 5.918083, 5.924219, 5.930355, 5.936491, 5.942627, 5.948763, 5.954899, 5.961035, 5.967170, 5.973306, 5.979442, 5.985578, 5.991714, 5.997850, 6.003986, 6.010122, 6.016257, 6.022393, 6.028529, 6.034665, 6.040801, 6.046937, 6.053073, 6.059209, 6.065344, 6.071480, 6.077616, 6.083752, 6.089888, 6.096024, 6.102160, 6.108296, 6.114431, 6.120567, 6.126703, 6.132839, 6.138975, 6.145111, 6.151247, 6.157383, 6.163518, 6.169654, 6.175790, 6.181926, 6.188062, 6.194198, 6.200334, 6.206470, 6.212605, 6.218741, 6.224877, 6.231013, 6.237149, 6.243285, 6.249421, 6.255557, 6.261692, 6.267828, 6.273964, 6.280100 ], "readings": [ 0.455580, 0.457450, 0.457360, 0.459330, 0.464180, 0.464420, 0.466860, 0.463460, 0.468730, 0.471080, 0.473120, 0.474470, 0.473560, 0.476140, 0.473910, 0.480080, 0.481610, 0.483900, 0.481230, 0.483490, 0.488250, 0.487980, 0.492440, 0.492720, 0.496720, 0.499550, 0.497520, 0.500540, 0.505780, 0.505060, 0.509890, 0.509660, 0.514800, 0.513940, 0.517710, 0.521770, 0.519920, 0.525700, 0.525960, 0.529320, 0.531360, 0.536360, 0.538810, 0.541510, 0.541340, 0.548970, 0.550160, 0.550230, 0.555310, 0.556560, 0.558230, 0.564240, 0.565090, 0.569970, 0.572210, 0.576880, 0.578510, 0.583280, 0.585430, 0.590390, 0.594940, 0.596820, 0.603090, 0.608430, 0.606560, 0.613840, 0.617560, 0.622030, 0.626090, 0.630580, 0.638160, 0.642280, 0.646540, 0.650380, 0.651450, 0.663040, null, null, null, null, null, null, null, 0.999610, 0.994010, 0.992320, 0.985100, 0.984520, 0.976920, 0.972890, 0.970400, 0.963920, 0.958370, 0.957020, 0.956400, 0.950390, 0.948800, 0.947060, 0.939820, 0.936310, 0.936330, 0.929100, 0.928540, 0.921890, 0.917780, 0.915810, 0.913420, 0.910920, 0.908720, 0.912710, 0.924270, 0.937450, 0.943710, 0.959190, 0.972890, 0.982550, 0.996560, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0.984390, 0.919780, 0.859150, 0.809710, 0.813990, 0.811490, 0.810280, 0.810370, 0.814410, 0.813500, 0.812820, 0.815380, 0.815030, 0.512350, 0.493270, 0.473510, 0.461800, 0.446340, 0.430590, 0.421220, 0.408200, 0.396850, 0.385780, 0.376700, 0.366180, 0.356780, 0.344960, 0.337190, 0.331140, 0.325540, 0.314810, 0.308830, 0.302910, 0.297510, 0.290810, 0.282380, 0.278640, 0.270300, 0.269450, 0.262180, 0.259340, 0.254170, 0.249140, 0.245790, 0.242740, 0.240120, 0.234850, 0.231130, 0.229600, 0.220430, 0.218640, 0.213300, 0.214770, 0.211270, 0.207630, 0.207790, 0.202320, 0.199420, 0.196790, 0.195970, 0.190320, 0.190110, 0.189850, 0.183510, 0.183490, 0.179770, 0.179150, 0.177760, 0.175900, 0.171990, 0.166850, 0.167150, 0.167270, 0.166620, 0.165760, 0.161740, 0.159810, 0.160110, 0.158600, 0.154820, 0.153500, 0.150830, 0.153150, 0.151990, 0.145550, 0.146900, 0.144550, 0.145510, 0.143460, 0.145720, 0.142170, 0.138920, 0.136530, 0.137850, 0.134800, 0.135030, 0.135010, 0.132630, 0.130660, 0.134800, 0.129870, 0.130190, 0.129720, 0.125710, 0.129510, 0.126350, 0.126150, 0.124360, 0.122400, 0.121400, 0.123390, 0.123040, 0.121330, 0.121170, 0.120140, 0.119740, 0.121170, 0.116560, 0.112430, 0.115610, 0.115070, 0.111880, 0.113610, 0.112520, 0.110530, 0.110380, 0.113080, 0.113760, 0.110460, 0.109060, 0.107450, 0.109640, 0.105230, 0.104690, 0.106060, 0.105070, 0.105800, 0.107610, 0.103360, 0.106590, 0.105280, 0.103150, 0.101940, 0.105480, 0.099900, 0.102900, 0.101350, 0.102170, 0.099780, 0.105160, 0.104480, 0.106540, 0.107900, 0.107770, 0.110620, 0.113350, 0.112260, 0.116130, 0.112030, 0.115660, 0.115260, 0.121190, 0.118600, 0.120670, 0.123800, 0.122160, 0.127090, 0.126550, 0.128330, 0.131600, 0.134740, 0.132720, 0.135000, 0.137410, 0.141640, 0.137500, 0.143370, 0.145820, 0.144950, 0.150860, 0.148700, 0.154690, 0.157040, 0.156710, 0.161060, 0.167360, 0.170040, 0.172390, 0.173710, 0.176100, 0.183420, 0.186020, 0.188380, 0.187630, 0.194360, 0.200850, 0.201850, 0.204660, 0.207610, 0.220210, 0.220760, 0.227410, 0.229850, 0.239280, 0.244230, 0.252130, 0.258680, 0.264110, 0.273210, 0.280400, 0.286630, 0.300190, 0.309670, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0.394340, 0.389420, 0.385840, 0.382730, 0.382130, 0.373990, 0.373940, 0.372710, 0.367130, 0.363880, 0.359790, 0.363040, 0.357090, 0.351930, 0.354660, 0.346290, 0.348570, 0.343750, 0.340510, 0.338660, 0.340600, 0.334330, 0.335610, 0.331980, 0.332160, 0.329640, 0.326960, 0.324260, 0.322170, 0.321600, 0.318120, 0.315270, 0.314730, 0.313640, 0.314450, 0.310200, 0.309210, 0.304440, 0.302930, 0.300160, 0.300880, 0.299760, 0.301000, 0.296020, 0.296160, 0.291460, 0.295530, 0.291840, 0.289070, 0.291450, 0.289020, 0.285280, 0.287800, 0.283590, 0.286600, 0.281470, 0.279750, 0.279660, 0.276000, 0.277760, 0.277540, 0.274720, 0.273510, 0.271300, 0.275840, 0.269160, 0.272100, 0.268270, 0.267680, 0.267660, 0.269110, 0.267260, 0.264000, 0.265180, 0.262970, 0.260230, 0.263500, 0.260260, 0.256950, 0.260270, 0.256150, 0.254840, 0.256580, 0.258010, 0.256600, 0.255550, 0.254350, 0.252730, 0.250490, 0.255090, 0.251430, 0.253590, 0.248180, 0.251660, 0.249860, 0.250790, 0.249580, 0.254520, 0.261970, 0.268940, 0.272150, 0.273890, 0.284410, 0.286890, 0.291780, 0.298070, 0.307710, 0.313620, 0.315290, 0.329040, 0.332030, 0.343130, 0.349860, 0.362780, 0.367050, 0.379840, 0.389880, 0.399280, 0.410500, 0.423270, 0.438510, 0.454820, 0.466380, 0.481460, 0.503250, 0.515940, 0.538450, 0.564280, 0.587540, 0.608270, 0.641560, 0.671730, 0.704770, 0.741850, 0.785480, 0.830280, 0.884610, 0.947750, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0.991480, 0.977300, 0.969500, 0.953000, 0.943940, 0.928640, 0.915150, 0.907480, 0.895190, 0.885780, 0.877160, 0.869560, 0.858050, 0.850150, 0.838270, 0.831380, 0.819780, 0.812790, 0.804400, 0.793400, 0.784830, 0.781010, 0.770460, 0.766220, 0.757470, 0.751790, 0.747710, 0.737070, 0.731860, 0.725130, 0.720280, 0.712970, 0.705800, 0.700270, 0.692560, 0.688450, 0.683800, 0.677900, 0.670930, 0.669260, 0.664560, 0.657130, 0.652630, 0.648510, 0.642980, 0.637810, 0.632830, 0.627010, 0.623000, 0.624080, 0.615690, 0.613170, 0.607170, 0.605680, 0.597280, 0.598700, 0.593150, 0.588800, 0.585870, 0.581000, 0.577710, 0.576150, 0.572090, 0.569270, 0.566410, 0.561920, 0.559880, 0.557150, 0.554630, 0.549700, 0.547480, 0.545560, 0.540480, 0.539660, 0.537200, 0.530080, 0.532730, 0.530650, 0.525350, 0.519400, 0.523210, 0.516350, 0.519940, 0.515850, 0.511050, 0.511080, 0.508200, 0.503800, 0.504430, 0.498310, 0.496240, 0.496340, 0.494430, 0.491180, 0.490760, 0.489400, 0.488100, 0.486830, 0.484100, 0.480840, 0.481710, 0.480960, 0.477170, 0.484330, 0.484780, 0.495110, 0.498520, 0.505280, 0.508240, 0.520280, 0.525700, 0.532420, 0.533900, 0.547790, 0.551190, 0.557690, 0.563580, 0.575960, 0.586240, 0.589810, 0.600870, 0.607240, 0.616710, 0.624180, 0.637350, 0.648320, 0.656010, 0.664550, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0.621070, 0.580260, 0.547730, 0.516890, 0.486470, 0.464000, 0.442220, 0.423310, 0.422620, 0.422810, 0.419680, 0.422980, 0.422670, 0.421460, 0.423370, 0.423520, 0.421160, 0.424520, 0.426340, 0.424230, 0.428010, 0.428110, 0.428710, 0.426130, 0.428130, 0.426070, 0.431080, 0.431670, 0.428150, 0.430560, 0.433100, 0.432360, 0.433470, 0.431770, 0.433580, 0.439450, 0.438530, 0.436090, 0.442210, 0.438140, 0.438880, 0.443420, 0.442580, 0.443360, 0.442350, 0.443820, 0.444750, 0.450800, 0.446290, 0.450820, 0.451600, 0.451210, 0.451710, 0.454390, 0.454430 ], "valid": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], "odometry": [ -0.3522, -0.1848, 1.9681 ], "estimate": [ null, null, null ], "true_pose": [ null, null, null ]  }
diff --git a/misc/tests/failure2.json b/misc/tests/failure2.json
deleted file mode 100644
index 161f333f9933500221b57891b6312e32b642e4e6..0000000000000000000000000000000000000000
--- a/misc/tests/failure2.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{ "nrays": 30, "min_theta": -1.570796, "max_theta": 1.570796, "odometry": [ 0.000000, 0.000000, 0.000000 ], "estimate": [ null, null, null ], "true_pose": [ 0.000000, 0.000000, 0.000000 ], "theta": [ -1.570796, -1.462466, -1.354135, -1.245804, -1.137473, -1.029142, -0.920812, -0.812481, -0.704150, -0.595819, -0.487489, -0.379158, -0.270827, -0.162496, -0.054165, 0.054165, 0.162496, 0.270827, 0.379158, 0.487489, 0.595819, 0.704150, 0.812481, 0.920812, 1.029142, 1.137473, 1.245804, 1.354135, 1.462466, 1.570796 ], "readings": [ 5.000779, 5.019853, 5.116651, 5.256418, 5.504004, 5.844980, 6.273660, 6.884493, 6.555530, 6.039816, 5.661363, 5.396162, 5.171709, 5.060509, 5.001907, 5.016016, 5.056834, 5.195163, 5.379970, 5.653023, 6.042297, 6.551263, 6.892441, 6.273115, 5.829970, 5.486435, 5.254229, 5.104061, 5.041641, 4.998651 ], "valid": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], "true_alpha": [ 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796 ], "timestamp": [ 46, 0 ] }
-{ "nrays": 30, "min_theta": -1.570796, "max_theta": 1.570796, "odometry": [ 0.921193, -0.029529, 0.760407 ], "estimate": [ null, null, null ], "true_pose": [ 1.000000, 0.000000, 0.785398 ], "theta": [ -1.570796, -1.462466, -1.354135, -1.245804, -1.137473, -1.029142, -0.920812, -0.812481, -0.704150, -0.595819, -0.487489, -0.379158, -0.270827, -0.162496, -0.054165, 0.054165, 0.162496, 0.270827, 0.379158, 0.487489, 0.595819, 0.704150, 0.812481, 0.920812, 1.029142, 1.137473, 1.245804, 1.354135, 1.462466, 1.570796 ], "readings": [ 5.639745, 5.147953, 4.745922, 4.463843, 4.254572, 4.112768, 4.019830, 4.007804, 4.016081, 4.079111, 4.189281, 4.362703, 4.580223, 4.918687, 5.373213, 5.993529, 6.157613, 5.734605, 5.436404, 5.217013, 5.081848, 5.023669, 5.008782, 5.052871, 5.164381, 5.336770, 5.575088, 5.943600, 6.412568, 7.069774 ], "valid": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], "true_alpha": [ 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 2.356194, 0.785398, 0.785398, 0.785398, 0.785398, 0.785398, 0.785398, 0.785398, 0.785398, 0.785398, 0.785398, 0.785398, 0.785398, 0.785398, 0.785398 ], "timestamp": [ 46, 0 ] }
-
diff --git a/scripts/cmd_utils.rb b/scripts/cmd_utils.rb
deleted file mode 100644
index 870996a82a58b5105e4722c15e944cacfab8f1b9..0000000000000000000000000000000000000000
--- a/scripts/cmd_utils.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-def execute_cmd_verb(cmd, verbose, exit_on_error)
-	$stderr.puts "$ " + cmd
-	
-	if verbose
-		system cmd
-	else
-		output = `#{cmd}`
-	end
-	
-	if exit_on_error && $?.exitstatus != 0
-		$stderr.puts "\n\n\t command:\n\n\t#{cmd.inspect}\n\n\tFAILED, exit status = #{$?.exitstatus}\n\n"
-		exit($?.exitstatus || -1)
-	end
-	
-	$?.exitstatus
-end
-
-def execute_cmd(m, exit_on_error=true); execute_cmd_verb(m, true, exit_on_error); end
-
-def search_cmd(program, additional_paths = nil)
-	if File.exists? program
-    return program
-  end
-  
-	path = ENV['PATH'].split(":") 
-	path.push File.dirname($0)
-	path.push Dir.pwd
-	path = path + [*additional_paths] if additional_paths
-	for dir in path
-		p = File.join(dir, program)
-		if File.exists? p
-#			$stderr.puts "Using #{p.inspect}"
-			return p
-		end
-	end
-	$stderr.puts "Could not find program #{program.inspect}"
-	$stderr.puts "Searched in #{path.inspect}"
-	exit -1
-end
-
-alias find_cmd search_cmd
-
-
diff --git a/scripts/create_video.rb b/scripts/create_video.rb
deleted file mode 100755
index 7dddefba022c779a165331676b0f6dc4c3cfa782..0000000000000000000000000000000000000000
--- a/scripts/create_video.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/env ruby
-require 'rubygems'
-require 'json'
-require 'fileutils'
-require 'optparse'
-
-$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
-require 'cmd_utils'
-
-def show_help()
-	cmd = File.basename($0)
-	description= <<-EOF
-#{cmd}: creates an animation from a JSON file describing the animation.
-
-Usage:
-
-	#{cmd} [options] file.desc
-
-Example animation description file:
-
-	{ 
-		"fig": "figure.fig", 
-		"common_depths": [ 100] 
-		"frames": [ 
-			{ "depths": [ 1,2 ] }, 
-			{ "depths": [ 3,4 ] } 
-		], 
-	}
-
-This is a movie created from "figure.fig", consisting of
-two frames. Depth 100 is shown in both. Frame#1 is created
-from depth 1,2 and frame #2 is created from depths 3,4.
-
-EOF
-	$stderr.puts description
-end
-
-FIG2PICS = find_cmd('fig2pics.rb')
-PDF2SWF = find_cmd('pdf2swf')
-GS = find_cmd('gs')
-
-	verbose = false
-	opt = OptionParser.new do |opts|
-		opts.on("-v", "--verbose", " be verbose") do |s| verbose=true; end
-		opts.on_tail("-h", "--help", "Show this message") do 
-			show_help()
-			$stderr.puts "Options: "
-			$stderr.puts opts
-			exit 0
-		end
-	end
-	begin opt.parse!
-	rescue OptionParser::InvalidOption=>e
-		$stderr.puts e
-		$stderr.puts opt
-		exit
-	end
-
-if(ARGV.size != 1) 
-	show_help()
-	exit -1
-end
-
-spec = ARGV[0]
-
-spec_content = File.open(spec).read 
-
-h = JSON.parse(spec_content)
-
-fig = File.join(File.dirname(spec), h['fig'])
-frames = h['frames'].map {|f| f['depths'] + h['common_depths']}
-
-dir=File.dirname(spec)
-basename=File.basename(spec,".fig.desc").sub(/^\.\//,"");
-output_pdf = "#{dir}/#{basename}.pdf"
-output_swf = "#{dir}/#{basename}.swf"
-temp_dir = "#{dir}/#{basename}"
-FileUtils.mkdir_p(temp_dir) if not File.exists? temp_dir
-
-filenames = []
-frames.each_with_index do |depths, i |
-	depths = depths.map {|x| x == -1 ? nil : x}.compact.uniq
-	opt_depths = "+" + depths.join(',')
-	filename = sprintf("#{temp_dir}/video%04d.pdf", i)
-	other = ARGV[1, ARGV.size].map{|x|x.inspect }.join(' ')
-	execute_cmd_verb("#{FIG2PICS} -f '-D #{opt_depths}' -o #{filename} #{other} #{fig}",verbose)
-	filenames.push filename
-end
-
-
-filenames = filenames.join(' ')
-cmd = "#{GS} -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=#{output_pdf} -dBATCH #{filenames}"
-execute_cmd_verb(cmd, verbose)
-
-cmd = "#{PDF2SWF} -L /usr/local/share/swftools/swfs/swft_loader.swf "+
-      " -B /usr/local/share/swftools/swfs/keyboard_viewer.swf " +
-      " #{output_pdf} -o #{output_swf}"
-execute_cmd_verb(cmd, verbose)
diff --git a/scripts/fig2pics.rb b/scripts/fig2pics.rb
deleted file mode 100755
index 14b51ded0f5e52d9a9d470507ce70b5bfa4517cf..0000000000000000000000000000000000000000
--- a/scripts/fig2pics.rb
+++ /dev/null
@@ -1,228 +0,0 @@
-#!/usr/bin/env ruby
-
-# 2009-05-03: starting tagging versions before copying over
-#
-# 2007-08-22: sostituto \usepackage{times} a \usepackage{ae,aecompl}
-#
-
-require 'tempfile'
-require 'optparse'
-require 'fileutils'
-require 'pathname'
-
-$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
-require 'cmd_utils'
-
-SCALE=4
-
-BBOX = /^%%BoundingBox: (\d+) (\d+) (\d+) (\d+)$/
-
-def eps_get_bounds(epsfile)
-	File.open(epsfile) do |f|
-		f.each do |line|
-			if line =~ BBOX then
-				bounds = [$1, $2, $3, $4].map{|x| x.to_i}
-				puts "Found #{line}" + bounds.inspect
-				f.close
-				return bounds
-			end
-		end
-	end
-	nil
-end
-
-def eps_substitute_first_line(input, output, line_reg, replacement)
-	done = false
-	input.each do |line|
-		if not done and line =~ line_reg
-			output.puts replacement
-		else
-			output.puts line
-		end
-	end
-end
-
-def change_bounds(eps, limits) 
-	bounds   = eps_get_bounds(eps)
-	if not bounds
-		$stderr.puts "Could not find bounding box in file #{eps.inspect}"
-		exit 1
-	end
-	
-	corner_x = bounds[0]
-	corner_y = bounds[1]
-	width    = bounds[2] - bounds[0]
-	height   = bounds[3] - bounds[1]
-	
-	new_bounds = [
-		corner_x + width * limits[0],
-		corner_y + height * limits[1],
-		corner_x + width * limits[2],
-		corner_y + height * limits[3]]
-		
-	$stderr.puts  "New bounds: #{new_bounds.inspect}"
-	temp_file = Tempfile.new('change_bounds')
-	eps_substitute_first_line(File.open(eps), temp_file, BBOX,
-		'%%BoundingBox: '+new_bounds.join(' '))
-	temp_file.close
-	FileUtils.cp(temp_file.path, eps)
-	temp_file.unlink
-end
-
-def fig2pics()
-	opt_preamble = nil
-	opt_fig2dev = nil
-	opt_output = nil
-	opt_bounds = nil
-	opt_verbose = false
-	opt_debug = false
-	
-	opt = OptionParser.new do |opts|
-#		opts.banner = "Usage: maruku [options] [file1.md [file2.md ..."
-#		opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
-#			MaRuKu::Globals[:verbose] = v end
-		opts.on("-v", "--verbose", "Be verbose") do opt_verbose = true; end
-
-		opts.on("-p", "--preamble PREAMBLE", "LaTeX preamble file") do |s|
-			opt_preamble = s
-			if ! File.exists?(opt_preamble) 
-				puts "Error: file #{opt_preamble.inspect} does not exist."
-				exit 2
-			end
-			$stderr.puts "Using LaTeX preamble #{s}."
-		end
-
-		opts.on("-f", "--fig-options OPTIONS", "Options to pass to fig2dev") do |s|
-			opt_fig2dev = s
-		end
-
-		opts.on("-o", "--output FILE", "Output filename") do |s|
-			opt_output = s
-		end
-
-		opts.on("-b", "--bbox BBOX", "Bounding box (4 numbers like '0 0 1 0.50')") do |s|
-			opt_bounds = s.strip.split.map{|x|x.to_f}.compact
-			if opt_bounds.size != 4
-				$stderr.puts "Malformed bounds: #{s.inspect} -> #{opt_bounds.inspect}"
-				exit 4
-			end
-			if (opt_bounds[0] >= opt_bounds[2]) || (opt_bounds[1] >= opt_bounds[3]) ||
-				 opt_bounds.any?{|x| x < 0 || x > 1 } then
-				$stderr.puts "Bounds #{opt_bounds.inspect} should respect constraints"
-				exit 4
-			end
-		end
-
-		opts.on_tail("-h", "--help", "Show this message") do
-			puts opts
-			exit
-		end
-
-	end
-
-	begin 
-	opt.parse!
-	rescue OptionParser::InvalidOption=>e
-		$stderr.puts e
-		$stderr.puts opt
-		exit
-	end
-
-	if ARGV.size == 0 
-		puts "Error: need filename"
-		exit 1
-	end
-
-	input=ARGV[0]
-	if !File.exists?(input) 
-		puts "Error: file #{input} does not exist."
-		exit 1
-	end
-
-# 
-# if ARGV.size >= 5
-# 	puts "Error: fig2pics.rb <file.fig> [<preamble.tex>] [params to fig2dev] '0 0 0.4 0'"
-# 	exit 3
-# end
-
-programs=["latex", "dvips",  "fig2dev", "epstopdf"];
-
-programs.each do |p| 
-	abs = `which #{p}`.chop
-	$stderr.puts "Using " + abs.inspect if opt_debug
-	if not FileTest.exists?(abs) then	
-		$stderr.puts "Error: command #{p} not available (abs=#{abs.inspect})"
-		exit
-	end
-end
-
-dir=File.dirname(input)
-
-basename=File.basename(input,".fig").sub(/^\.\//,"");
-$stderr.puts "dir #{basename}" if opt_debug
-$stderr.puts "basename #{basename}" if opt_debug
-outpng="#{dir}/#{basename}.png"
-outpdf="#{dir}/#{basename}.pdf"
-temp="#{dir}/#{basename}_tmp"
-
-slideprefix="#{dir}/#{basename}_slide"
-slide="#{dir}/#{basename}_slide.tex"
-slidedvi="#{dir}/#{basename}_slide.dvi"
-slideps="#{dir}/#{basename}_slide.ps"
-slidepdf="#{dir}/#{basename}_slide.pdf"
-
-abs_dir = Pathname.new("#{dir}").realpath
-absolute_img = abs_dir + "#{basename}_tmp.eps"
-
-execute_cmd "fig2dev -L pstex_t  #{opt_fig2dev} -p #{absolute_img} #{input} #{temp}.tex"
-execute_cmd "fig2dev -L pstex    #{opt_fig2dev}    #{input} #{temp}.eps"
-
-preamble_text = opt_preamble ? "\\input{#{opt_preamble}}" : "%"
-
-slidecontent=<<EOF
-		\\documentclass{article}
-		\\usepackage{amsmath}
-		\\usepackage{amsthm}
-		\\usepackage{amssymb}
-		\\usepackage{color}
-		\\usepackage{epsfig}
-		\\usepackage[T1]{fontenc}
-		\\usepackage{times}
-%  \\usepackage{ae,aecompl,aeguill}
-		#{preamble_text} 
-		\\begin{document}\\thispagestyle{empty}
-		\\input{#{abs_dir}/#{basename}_tmp.tex}
-		\\end{document}
-EOF
-
-File.open(slide,"w") do |f|
-	f.puts slidecontent 
-end
-
-execute_cmd	"latex -output-directory=#{abs_dir} #{slide}"
-execute_cmd	"dvips -q -Ppdf -E #{slidedvi} -o #{slideps}"
-
-if opt_bounds then change_bounds(slideps, opt_bounds) end
-
-if opt_output then outpdf = opt_output end
-
-
-execute_cmd("epstopdf #{slideps} --outfile=#{outpdf} --debug", exit_on_error=true)
-
-execute_cmd  "rm -f #{slide} #{slidedvi} #{slideps} #{temp}.* #{slideprefix}.*"
-
-#execute_cmd	"pstoimg -antialias -aaliastext -scale #{SCALE} -out #{outpng} #{slideps}"
-#	epstopdf #{figureeps} $WHERE/figure-$basename.eps
-#execute_cmd     "convert -density 600x600 #{slidepdf} -resize 640 #{outpng}"
-#execute_cmd "eps2eps #{basename}_tmp.eps temp.eps"
-#execute_cmd "epstopdf  temp.eps "
-#execute_cmd "cp  temp.pdf #{basename}_tmp.pdf "
-end
-
-
-fig2pics
-
-
-
-
-
diff --git a/scripts/hash_options.rb b/scripts/hash_options.rb
deleted file mode 100644
index b73219b8638f9846beceab0d1b81e701effd3d05..0000000000000000000000000000000000000000
--- a/scripts/hash_options.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-
-class Hash
-	Comment = /^\s*\#/ 
-	Option  = /^\s*(\w+)\s*=?\s*(.+)$/ 
-
-	def read_conf(io, dir)
-		io.each do |line|
-			next if (line.strip.size == 0) || line =~ Comment
-			if m = Option.match(line)
-				name = m[1]
-				value = m[2].strip
-				
-				begin
-					value = eval(value)
-				rescue
-					
-				end
-				self[name] = value
-#				$stderr.puts  "#{name} = #{value}"
-			elsif m = /^\s*<\s*(.*)$/.match(line)
-				filename = m[1]
-				filename = File.expand_path(File.join(dir, filename))
-				read_conf(File.open(filename), File.dirname(filename))
-			else
-				$stderr.puts "Line #{line.inspect} is malformed"
-				exit -1
-			end
-		end
-	end
-	
-	def config_dump
-		s = ""
-		max_size = keys.map{|x|x.to_s.size}.max + 2
-		for k in keys.sort
-			s += "#{k} " + " " * (max_size - k.to_s.size) + self[k].inspect + "\n"
-		end
-		s
-	end
-end
-
-if File.basename($0) == 'hash_options.rb'
-	h = Hash.new
-	h.read_conf $stdin
-	p h
-end
\ No newline at end of file
diff --git a/scripts/json2matlab.rb b/scripts/json2matlab.rb
deleted file mode 100755
index ae60e015c75137dd26ce62e949d7435b598eb2bf..0000000000000000000000000000000000000000
--- a/scripts/json2matlab.rb
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/usr/bin/env ruby
-for s in ['../rsm', '.']
-	$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), s))
-end
-
-require 'rubygems'
-require 'json/pure'
-
-require 'fix_json'
-require 'json_utils'
-
-class Array
-	def matrix_size?(x) [9].include?x end
-		
-	def to_matlab
-		if is_matrix?
-			write_as_matrix
-		elsif all_numbers?
-			"[  "+map{|x| x.to_matlab }.join("; ")+"]"
-		else
-			"{ ... \n "+map{|x| x.to_matlab }.join(",  ... \n")+"}"
-		end
-	end
-	
-	def all_numbers?
-		all? {|x| x.kind_of?(Numeric) or x.nil? }
-	end
-	
-	def is_matrix?
-		return false if empty? or not all? {|x| x.kind_of?(Array) && x.all_numbers?}
-		columns = first.size
-		return false if not all? {|x| x.size==columns}
-		true
-	end
-	
-	def write_as_matrix
-		"[ " + map{|row| row.join(", ")}.join("; ... \n") +  "]"
-	end
-end
-
-class Hash
-	def to_matlab
-		" struct(" +
-			keys.map{ |k|
-				v = self[k]
-				if v.kind_of?(Array) and (not v.all_numbers?) and (not v.is_matrix?)
-				"'#{k}', {#{v.to_matlab}}"
-				elsif v.kind_of?(Hash)
-				"'#{k}', {#{v.to_matlab}}"
-				else
-				"'#{k}', #{v.to_matlab}"
-				end
-			}.join(", ... \n\t") +
-		")"
-	end
-end
-
-class Object
-	def to_matlab(); to_s; end
-end
-
-class String
-	def to_matlab(); "'" + to_s + "'"; end
-end
-
-class Object 
-	def recurse_json(&block) end
-end
-
-class Hash
-	def recurse_json(&block) 
-		each do |k, v|
-			self[k]=block.call(v, self)
-			self[k].recurse_json(&block)
-		end
-	end
-end
-
-class Array
-	def recurse_json(&block) 
-		each_index do |i|
-			self[i] = block.call(self[i], self)
-			self[i].recurse_json(&block)
-		end
-	end
-end
-
-class NilClass
-	def to_matlab
-		"NaN"
-	end
-end
-
-def main_json2matlab
-	if ARGV.any? {|x| x =~ /help/}
-		$stderr.puts "Three usages:"
-		$stderr.puts " 1) without parameters, it acts as a filter; out is a Matlab structure "
-		$stderr.puts "       $ json2matlab.rb  < in.json > out.m "
-		$stderr.puts " 2) with one parameter, it creates <in>.m (a function named <in>) "
-		$stderr.puts "       $ json2matlab.rb in.json "
-		$stderr.puts " 3) with two parameters, it creates `f.m` (a function named 'f') "
-		$stderr.puts "       $ json2matlab.rb in.json f "
-		$stderr.puts "       $ json2matlab.rb - f         reading from stdin"
-		exit 0
-	end
-
-
-	io =  if ( (file = ARGV[0]) && (file != '-') ) then File.open(file) else $stdin end
-	complete_file = io.read
-
-	a = read_all_objects(complete_file)
-	$stderr.write "json2matlab: Found #{a.size} JSON objects. "
-	a = a[0] if a.size == 1 
-
-	a.recurse_json do |child, parent| 
-		if parent.kind_of?(Array) and child.nil? then
-			(0.0/0.0) 
-		else
-			 child
-		end
-	end
-
-
-	if file = ARGV[0]
-		basename = File.basename(file).gsub(/\.\w*$/,'')
-		if ARGV[1]
-			basename = ARGV[1]
-		end
-	
-		output_file = File.join(File.dirname(file), basename + ".m")
-		$stderr.puts "Writing to #{output_file.inspect}."
-		File.open(output_file, 'w') do |f|
-			f.puts "function res = #{basename}"
-			f.puts "res = ..."
-			f.puts(a.to_matlab + ";")
-		end
-	else
-		$stdout.puts(a.to_matlab + ";")	
-	end
-
-end
-
-
-main_json2matlab if File.basename($0) == 'json2matlab.rb'
-
diff --git a/scripts/parser.rb.mine b/scripts/parser.rb.mine
deleted file mode 100644
index 190b15ed790f2441fc6c1bc8ae08af799b3a09bb..0000000000000000000000000000000000000000
--- a/scripts/parser.rb.mine
+++ /dev/null
@@ -1,215 +0,0 @@
-require 'strscan'
-
-module JSON
-  module Pure
-    # This class implements the JSON parser that is used to parse a JSON string
-    # into a Ruby data structure.
-    class Parser < StringScanner
-      STRING                = /" ((?:[^\x0-\x1f"\\] |
-                                  \\["\\\/bfnrt] |
-                                  \\u[0-9a-fA-F]{4})*)
-                              "/x
-      INTEGER               = /(-?0|-?[1-9]\d*)/
-      FLOAT                 = /(-?
-                                (?:0|[1-9]\d*)
-                                (?:
-                                  \.\d+(?i:e[+-]?\d+) |
-                                  \.\d+ |
-                                  (?i:e[+-]?\d+)
-                                )
-                                )/x
-      OBJECT_OPEN           = /\{/
-      OBJECT_CLOSE          = /\}/
-      ARRAY_OPEN            = /\[/
-      ARRAY_CLOSE           = /\]/
-      PAIR_DELIMITER        = /:/
-      COLLECTION_DELIMITER  = /,/
-      TRUE                  = /true/
-      FALSE                 = /false/
-      NULL                  = /null/
-      IGNORE                = %r(
-        (?:
-         //[^\n\r]*[\n\r]| # line comments
-         /\*               # c-style comments
-         (?:
-          [^*/]|        # normal chars
-          /[^*]|        # slashes that do not start a nested comment
-          \*[^/]|       # asterisks that do not end this comment
-          /(?=\*/)      # single slash before this comment's end 
-         )*
-           \*/               # the End of this comment
-           |[ \t\r\n]+       # whitespaces: space, horicontal tab, lf, cr
-        )+
-      )mx
-
-      UNPARSED = Object.new
-
-      # Creates a new JSON::Pure::Parser instance for the string _source_.
-      def initialize(source)
-        super
-        @create_id = JSON.create_id
-        reset # added
-      end
-
-      alias source string
-
-      # Parses the current JSON string _source_ and returns the complete data
-      # structure as a result.
-      def parse
-#        reset
-        obj = nil
-        until eos? || obj    # added obj
-          case
-          when scan(OBJECT_OPEN)
-            obj and raise ParserError, "source '#{peek(20)}' not in JSON!"
-            obj = parse_object
-          when scan(ARRAY_OPEN)
-            obj and raise ParserError, "source '#{peek(20)}' not in JSON!"
-            obj = parse_array
-          when skip(IGNORE)
-            ;
-          else
-            raise ParserError, "source '#{peek(20)}' not in JSON!"
-          end
-        end
-        obj or raise ParserError, "source did not contain any JSON!"
-        obj
-      end
-
-      private
-
-      # Unescape characters in strings.
-      UNESCAPE_MAP = {
-        ?"  => '"',
-        ?\\ => '\\',
-        ?/  => '/',
-        ?b  => "\b",
-        ?f  => "\f",
-        ?n  => "\n",
-        ?r  => "\r",
-        ?t  => "\t",
-      }
-
-      def parse_string
-        if scan(STRING)
-          return '' if self[1].empty?
-          self[1].gsub(%r((?:\\[\\bfnrt"/]|(?:\\u(?:[A-Fa-f\d]{4}))+))) do |c|
-            if u = UNESCAPE_MAP[c[1]]
-              u
-            else # \uXXXX
-              bytes = ''
-              i = 0
-              while c[6 * i] == ?\\ && c[6 * i + 1] == ?u 
-                bytes << c[6 * i + 2, 2].to_i(16) << c[6 * i + 4, 2].to_i(16)
-                i += 1
-              end
-              JSON::UTF16toUTF8.iconv(bytes)
-            end
-          end
-        else
-          UNPARSED
-        end
-      rescue Iconv::Failure => e
-        raise GeneratorError, "Caught #{e.class}: #{e}"
-      end
-
-      def parse_value
-        case
-        when scan(FLOAT)
-          Float(self[1])
-        when scan(INTEGER)
-          Integer(self[1])
-        when scan(TRUE)
-          true
-        when scan(FALSE)
-          false
-        when scan(NULL)
-          nil
-        when (string = parse_string) != UNPARSED
-          string
-        when scan(ARRAY_OPEN)
-          parse_array
-        when scan(OBJECT_OPEN)
-          parse_object
-        else
-          UNPARSED
-        end
-      end
-
-      def parse_array
-        result = []
-        delim = false
-        until eos?
-          case
-          when (value = parse_value) != UNPARSED
-            delim = false
-            result << value
-            skip(IGNORE)
-            if scan(COLLECTION_DELIMITER)
-              delim = true
-            elsif match?(ARRAY_CLOSE)
-              ;
-            else
-              raise ParserError, "expected ',' or ']' in array at '#{peek(20)}'!"
-            end
-          when scan(ARRAY_CLOSE)
-            if delim
-              raise ParserError, "expected next element in array at '#{peek(20)}'!"
-            end
-            break
-          when skip(IGNORE)
-            ;
-          else
-            raise ParserError, "unexpected token in array at '#{peek(20)}'!"
-          end
-        end
-        result
-      end
-
-      def parse_object
-        result = {}
-        delim = false
-        until eos?
-          case
-          when (string = parse_string) != UNPARSED
-            skip(IGNORE)
-            unless scan(PAIR_DELIMITER)
-              raise ParserError, "expected ':' in object at '#{peek(20)}'!"
-            end
-            skip(IGNORE)
-            unless (value = parse_value).equal? UNPARSED
-              result[string] = value
-              delim = false
-              skip(IGNORE)
-              if scan(COLLECTION_DELIMITER)
-                delim = true
-              elsif match?(OBJECT_CLOSE)
-                ;
-              else
-                raise ParserError, "expected ',' or '}' in object at '#{peek(20)}'!"
-              end
-            else
-              raise ParserError, "expected value in object at '#{peek(20)}'!"
-            end
-          when scan(OBJECT_CLOSE)
-            if delim
-              raise ParserError, "expected next name, value pair in object at '#{peek(20)}'!"
-            end
-            if klassname = result[@create_id]
-              klass = JSON.deep_const_get klassname
-              break unless klass and klass.json_creatable?
-              result = klass.json_create(result)
-              result
-            end
-            break
-          when skip(IGNORE)
-            ;
-          else
-            raise ParserError, "unexpected token in object at '#{peek(20)}'!"
-          end
-        end
-        result
-      end
-    end
-  end
-end
diff --git a/sm/.gitignore b/sm/.gitignore
deleted file mode 100644
index a4ce1b20c33402cc9714c60eda704edab5a1b8a0..0000000000000000000000000000000000000000
--- a/sm/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-ld_*
-sm1
-sm2
-sm3
-test_json
-test_json_ld
-test_math_utils_sanity
-sm_animate
diff --git a/sm/AUTHORS b/sm/AUTHORS
deleted file mode 100644
index e698f8379867dbb7b61b0e68e8dc56861c69da58..0000000000000000000000000000000000000000
--- a/sm/AUTHORS
+++ /dev/null
@@ -1,10 +0,0 @@
-Most of the blame is on Andrea Censi (http://www.dis.uniroma1.it/~censi/).
-
-The json-c library is (c) Michael Clark, released under the MIT license.
- http://oss.metaparadigm.com/json-c/ 
-The copy in lib/json-c is based on version 0.7.
-
-Bounding box algorithm in file laser_data_bbox.c created by Cyrill Stachniss  (http://www.informatik.uni-freiburg.de/~stachnis/).
-
-ICP covariance bug fixes by Gian Diego Tipaldi (http://www.dis.uniroma1.it/~tipaldi/).
-
diff --git a/sm/CMakeLists.txt b/sm/CMakeLists.txt
deleted file mode 100644
index 19b9951070eac861a8bcfdcca59e74ee92909cf5..0000000000000000000000000000000000000000
--- a/sm/CMakeLists.txt
+++ /dev/null
@@ -1,239 +0,0 @@
-PROJECT (CSM C CXX)
-
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/lib)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-
-cmake_minimum_required(VERSION 2.4)
-set(csm_link_flags "-L.")
-
-SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
-
-FIND_PACKAGE(GSL REQUIRED)
-IF(GSL_FOUND)
-	MESSAGE(STATUS "Found GSL:")
-	MESSAGE(STATUS "   GSL_LIBRARIES = ${GSL_LIBRARIES}")
-	MESSAGE(STATUS "   GSL_INCLUDE_DIR = ${GSL_INCLUDE_DIR}")
-	MESSAGE(STATUS "   CMAKE_GSL_CXX_FLAGS = ${CMAKE_GSL_CXX_FLAGS}")
-	MESSAGE(STATUS "   GSL_LINK_DIRECTORIES = '${GSL_LINK_DIRECTORIES}'")
-
- 	
-	set(csm_c_flags "${csm_c_flags} -I${GSL_INCLUDE_DIR}")
-	if(GSL_LINK_DIRECTORIES)	
-#		set(csm_link_flags "${csm_link_flags}
-		set(csm_link_flags "${csm_link_flags} -L${GSL_LINK_DIRECTORIES}")
-	endif(GSL_LINK_DIRECTORIES)	
-
-	set(csm_link_flags "${csm_link_flags} ${GSL_LIBRARIES}")
-	
-ELSE(GSL_FOUND)
-	MESSAGE(FATAL_ERROR "GSL not found.")
-ENDIF(GSL_FOUND)
-
-FIND_PACKAGE(Cairo)
-IF(CAIRO_FOUND)
-	MESSAGE(STATUS "Found Cairo at.")
-	MESSAGE(STATUS "   PREFIX_CAIRO= ${PREFIX_CAIRO}")
-	MESSAGE(STATUS "   CAIRO_CFLAGS = ${CAIRO_CFLAGS}")
-	MESSAGE(STATUS "   CAIRO_LIBRARY = ${CAIRO_LIBRARY}")
-	MESSAGE(STATUS "   CAIRO_INCLUDE_DIR = ${CAIRO_INCLUDE_DIR}")
-	
-	set(csm_link_flags "${csm_link_flags} ${CAIRO_LIBRARY}")
-	SET(csm_c_flags "${csm_c_flags} ${CAIRO_CFLAGS} -I${CAIRO_INCLUDE_DIR}")
-	
-ELSE(CAIRO_FOUND)
-	MESSAGE(WARNING "* Cairo not found: plotting programs (e.g., 'log2pdf') will not be built.")
-	MESSAGE(WARNING "* install Cairo from http://cairographics.org ")
-ENDIF(CAIRO_FOUND)
-
-
-
-
-
-MESSAGE(STATUS "csm_c_flags = ${csm_c_flags}")
-MESSAGE(STATUS "csm_link_flags = ${csm_link_flags}")
-
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${csm_c_flags}")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -Wall")
-
-
-# for realpath
-IF("${CMAKE_SYSTEM}" MATCHES "Linux")
-	ADD_DEFINITIONS(-DLINUX)
-ENDIF("${CMAKE_SYSTEM}" MATCHES "Linux")
-
-########### Options ########## 
-
-SUBDIRS(lib/options)
-SUBDIRS(lib/json-c)
-SUBDIRS(lib/egsl)
-SUBDIRS(lib/gpc)
-SUBDIRS(csm)
-
-
-
-
-
-########### SM applications ########## 
-
-MACRO(new_executable exec)
-	ADD_EXECUTABLE(${exec} apps/${exec}.c)
-	TARGET_LINK_LIBRARIES(${exec} csm-static ${csm_link_flags})
-	INSTALL(PROGRAMS ${exec} DESTINATION bin)
-ENDMACRO(new_executable exec)
-
-# new_executable(sm0)
-new_executable(sm1)
-new_executable(sm2)
-new_executable(sm3)
-new_executable(json_extract)
-new_executable(json_extract_field)
-new_executable(json_decimate)
-new_executable(json_split)
-new_executable(json_pipe)
-new_executable(carmen2json)
-new_executable(json2carmen)
-new_executable(ld_noise)
-new_executable(ld_slip)
-new_executable(ld_fisher)
-new_executable(ld_smooth)
-new_executable(ld_resample)
-new_executable(ld_remove_doubles)
-new_executable(ld_alternate)
-new_executable(ld_recover)
-
-new_executable(ld_purify)
-new_executable(ld_select)
-new_executable(ld_cluster_curv)
-new_executable(ld_linearize)
-
-new_executable(json2matlab)
-
-new_executable(ld_exp_tro1)
-
-# this are some random tests
-# new_executable(ld_stats)
-# new_executable(ld_correct)
-
-new_executable(test_json_ld)
-new_executable(test_json)
-
-
-
-IF(CAIRO_FOUND)
-	new_executable(sm_animate)
-	new_executable(log2pdf)
-ENDIF(CAIRO_FOUND)
-
-
-ADD_EXECUTABLE(test_math_utils_sanity csm/test_math_utils_sanity.c)
-TARGET_LINK_LIBRARIES(test_math_utils_sanity csm-static ${GSL_LIBRARIES})
-
-ENABLE_TESTING()
-ADD_TEST(test_math_utils_sanity test_math_utils_sanity)
-
-
-SET(csm_sources 
-./csm/clustering.c
-./csm/gpm/gpm.c
-./csm/icp/icp.c
-./csm/icp/icp_corr_dumb.c
-./csm/icp/icp_corr_tricks.c
-./csm/icp/icp_covariance.c
-./csm/icp/icp_loop.c
-./csm/icp/icp_outliers.c
-./csm/icp/icp_debug.c
-./csm/mbicp/mbicp_interface.c      
-./csm/mbicp/MbICP.c      
-./csm/mbicp/calcul.c     
-./csm/mbicp/percolate.c  
-./csm/mbicp/sp_matrix.c
-./csm/hsm/hsm.c
-./csm/hsm/hsm_interface.c
-./csm/json_journal.c
-./csm/laser_data.c
-./csm/laser_data_carmen.c
-./csm/laser_data_fisher.c
-./csm/laser_data_json.c
-./csm/laser_data_load.c
-./csm/laser_data_drawing.c
-./csm/laser_data_bbox.c
-./csm/logging.c
-./csm/math_utils.c
-./csm/math_utils_gsl.c
-./csm/orientation.c
-./csm/sm_options.c
-./csm/utils.c
-./lib/egsl/egsl.c
-./lib/egsl/egsl_conversions.c
-./lib/egsl/egsl_misc.c
-./lib/egsl/egsl_ops.c
-./lib/gpc/gpc.c
-./lib/gpc/gpc_utils.c
-./lib/json-c/arraylist.c
-./lib/json-c/debug.c
-./lib/json-c/JSON_checker.c
-./lib/json-c/json_more_utils.c
-./lib/json-c/json_object.c
-./lib/json-c/json_tokener.c
-./lib/json-c/json_util.c
-./lib/json-c/linkhash.c
-./lib/json-c/printbuf.c
-./lib/options/options.c
-./lib/options/options_interface.c
-)
-
-IF(CAIRO_FOUND)
-SET(csm_sources ${csm_sources} csm/laser_data_cairo.c)
-ENDIF(CAIRO_FOUND)
-
-ADD_LIBRARY(csm-static STATIC ${csm_sources})
-TARGET_LINK_LIBRARIES(csm-static ${csm_link_flags})
-INSTALL(TARGETS csm-static ARCHIVE DESTINATION lib)
-
-ADD_LIBRARY(csm SHARED ${csm_sources})
-TARGET_LINK_LIBRARIES(csm ${csm_link_flags})
-INSTALL(TARGETS csm ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
-
-
-IF(COMPILE_HSM)
-
-INCLUDE_DIRECTORIES(/sw/include)
-LINK_DIRECTORIES(/sw/lib)
-
-ADD_EXECUTABLE(hsm_test00 ./csm/hsm/hsm_test00.c ./csm/hsm/hsm.c)
-#TARGET_LINK_LIBRARIES(hsm_test00 csm-static ${csm_link_flags} pgm pnm pbm)
-	TARGET_LINK_LIBRARIES(hsm_test00 csm-static ${csm_link_flags} netpbm)
-INSTALL(PROGRAMS hsm_test00 DESTINATION bin)
-
-ENDIF(COMPILE_HSM)
-
-
-SUBDIRS(pkg-config)
-
-if(0)
-#
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${csm_c_flags} -Wall")
-
-FILE(GLOB_RECURSE csm_headers csm/*.h)
-FILE(GLOB_RECURSE lib_headers lib/*.h)
-
-foreach(header ${csm_headers} ${lib_headers})
-	GET_FILENAME_COMPONENT(header_base ${header} NAME_WE)
-	GET_FILENAME_COMPONENT(header_dir ${header} PATH)
-
-#	MESSAGE("Ciao ${header_base} ${header_dir}")
-	
-	CONFIGURE_FILE(header_test.c.in ${header_dir}/${header_base}_header_test.cpp @ONLY)	
-	ADD_EXECUTABLE(${header_base}_header_test ${header_dir}/${header_base}_header_test.cpp)
-	SET_TARGET_PROPERTIES(${header_base}_header_test  PROPERTIES LINKER_LANGUAGE CXX)
-	TARGET_LINK_LIBRARIES(${header_base}_header_test  csm-static ${csm_link_flags})
-
-	CONFIGURE_FILE(header_test.c.in ${header_dir}/${header_base}_header_test2.c @ONLY)	
-	ADD_EXECUTABLE(${header_base}_header_test2 ${header_dir}/${header_base}_header_test2.c)
-	TARGET_LINK_LIBRARIES(${header_base}_header_test2  csm-static ${csm_link_flags})
-	
-endforeach(header ${csm_headers} ${lib_headers})
-endif(0)
diff --git a/sm/FindCairo.cmake b/sm/FindCairo.cmake
deleted file mode 100644
index 46e443a08a9312d6f84e3f7625245200524f965b..0000000000000000000000000000000000000000
--- a/sm/FindCairo.cmake
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# Find the native cairo includes and library
-#
-
-# This module defines
-# CAIRO_INCLUDE_DIR, where to find art*.h etc
-# CAIRO_LIBRARY, the libraries to link against to use cairo
-# CAIRO_FOUND, If false, do not try to use LIBART.
-# CAIRO_LIBS, link information
-# CAIRO_CFLAGS, cflags for include information
-
-
-INCLUDE(UsePkgConfig)
-
-# use pkg-config to get the directories and then use these values
-# in the FIND_PATH() and FIND_LIBRARY() calls
-PKGCONFIG(cairo _libCairoIncDir _libCairoLinkDir _libCairoLinkFlags _libCairoCflags)
-
-SET(CAIRO_LIBS ${_libCairoCflags})
-
-IF(PREFIX_CAIRO)
-	SET(PREFIX_CAIRO_INCLUDE "${PREFIX_CAIRO}/include")
-	SET(PREFIX_CAIRO_LIB "${PREFIX_CAIRO}/lib")
-	SET(PREFIX_CAIRO_BIN "${PREFIX_CAIRO}/bin")
-ENDIF(PREFIX_CAIRO)
-
-FIND_PATH(CAIRO_INCLUDE_DIR 
-NAMES cairo.h
-PATHS ${PREFIX_CAIRO_INCLUDE} ${_libCairoIncDir} /usr/local/include /usr/include
-PATH_SUFFIXES cairo
-NO_DEFAULT_PATH
-)
-
-FIND_LIBRARY(CAIRO_LIBRARY
-NAMES cairo
-PATHS ${PREFIX_CAIRO_LIB} ${_libCairoLinkDir} /usr/local/lib /usr/lib
-NO_DEFAULT_PATH
-)
-
-#If we had no cairo prefix specify it, set PREFIX_CAIRO_LIB most importantly, for the 
-# IF(NOT PREFIX_CAIRO)
-# 	GET_FILENAME_COMPONENT(CAIRO_DIR ${CAIRO_LIBRARY} PATH)
-# 	GET_FILENAME_COMPONENT(CAIRO_DIR ${CAIRO_DIR} PATH)
-# 	SET(PREFIX_CAIRO ${CAIRO_DIR})
-# 	IF(PREFIX_CAIRO)
-# 		SET(PREFIX_CAIRO_INCLUDE "${PREFIX_CAIRO}/include")
-# 		SET(PREFIX_CAIRO_LIB "${PREFIX_CAIRO}/lib")
-# 		SET(PREFIX_CAIRO_BIN "${PREFIX_CAIRO}/bin")
-# 	ENDIF(PREFIX_CAIRO)
-# ENDIF(NOT PREFIX_CAIRO)
-
-SET(CAIRO_FIND_QUIETLY 0)
-
-IF (CAIRO_LIBRARY)
-  IF (CAIRO_INCLUDE_DIR)
-    SET( CAIRO_FOUND "YES" )
-    IF(NOT CAIRO_FIND_QUIETLY)
-      MESSAGE(STATUS "Found cairo: ${CAIRO_LIBRARY}")
-    ENDIF(NOT CAIRO_FIND_QUIETLY)
-    SET( CAIRO_LIBRARIES ${CAIRO_LIBRARY} )
-#     CB: We dont use this yet anyway
-     # FIND_PROGRAM(CAIRO_CONFIG 
-     #   NAMES pkg-config
-     #   PATHS ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin
-     # )
-     # EXEC_PROGRAM(${CAIRO_CONFIG} ARGS "--libs cairo" OUTPUT_VARIABLE CAIRO_LIBS)
-     # EXEC_PROGRAM(${CAIRO_CONFIG} ARGS "--cflags cairo" OUTPUT_VARIABLE CAIRO_CFLAGS)
-  ENDIF (CAIRO_INCLUDE_DIR)
-ENDIF (CAIRO_LIBRARY)
diff --git a/sm/FindGSL.cmake b/sm/FindGSL.cmake
deleted file mode 100644
index 9e02e776b831e731179a266069c7e3cb2e4efdad..0000000000000000000000000000000000000000
--- a/sm/FindGSL.cmake
+++ /dev/null
@@ -1,130 +0,0 @@
-## 
-## Try to find gnu scientific library GSL  
-## (see http://www.gnu.org/software/gsl/)
-## Once run this will define: 
-## 
-## GSL_FOUND       = system has GSL lib
-##
-## GSL_LIBRARIES   = full path to the libraries
-##    on Unix/Linux with additional linker flags from "gsl-config --libs"
-## 
-## CMAKE_GSL_CXX_FLAGS  = Unix compiler flags for GSL, essentially "`gsl-config --cxxflags`"
-##
-## GSL_INCLUDE_DIR      = where to find headers 
-##
-## GSL_LINK_DIRECTORIES = link directories, useful for rpath on Unix
-## GSL_EXE_LINKER_FLAGS = rpath on Unix
-##
-## Felix Woelk 07/2004
-## www.mip.informatik.uni-kiel.de
-## --------------------------------
-
- IF(WIN32 AND NOT CYGWIN)
- MESSAGE(STATUS, "Finding GSL using the WIN32 code.")
-  FIND_LIBRARY(GSL_gsl_LIBRARY
-      NAMES gsl
-      PATHS "$ENV{GSL_HOME}/lib"
-      DOC "Where can the GSL (gsl.lib) library be found"
-      )
-  FIND_LIBRARY(GSL_cblas_LIBRARY
-      NAMES cblas
-      PATHS "$ENV{GSL_HOME}/lib"
-      DOC "Where can the GSL (cblas.lib) library be found"
-      )
-  SET(GSL_LIBRARIES "${GSL_cblas_LIBRARY} ${GSL_gsl_LIBRARY}")
-
-  FIND_PATH(GSL_INCLUDE_DIR gsl/gsl_linalg.h
-      $ENV{GSL_HOME}/include
-      )
-
-  IF(GSL_INCLUDE_DIR AND GSL_LIBRARIES)
-    SET(GSL_FOUND TRUE)
-  ELSE(GSL_INCLUDE_DIR AND GSL_LIBRARIES)
-    SET(GSL_FOUND FALSE) 
-  ENDIF(GSL_INCLUDE_DIR AND GSL_LIBRARIES)
-
-  MARK_AS_ADVANCED(
-    GSL_gsl_LIBRARY
-    GSL_cblas_LIBRARY
-    GSL_INCLUDE_DIR
-    GSL_LIBRARIES
-    GSL_LINK_DIRECTORIES
-  )  
-ELSE(WIN32 AND NOT CYGWIN)
-   MESSAGE("gsl home: $ENV{GSL_HOME}")
-#  IF(UNIX) 
-  SET(GSL_CONFIG_PREFER_PATH "$ENV{GSL_HOME}/bin" CACHE STRING "preferred path to GSL (gsl-config)")
-  IF(NOT GSL_CONFIG) 
-   FIND_PROGRAM(GSL_CONFIG gsl-config
-      ${GSL_CONFIG_PREFER_PATH}
-      /usr/bin/
-      )
-   ENDIF(NOT GSL_CONFIG)
-
-   MESSAGE("DBG GSL_CONFIG ${GSL_CONFIG}")
-    
-    IF (GSL_CONFIG) 
-      # set CXXFLAGS to be fed into CXX_FLAGS by the user:
-     #  SET(GSL_CXX_FLAGS "`${GSL_CONFIG} --cflags`")
-      EXEC_PROGRAM(${GSL_CONFIG} ARGS --cflags OUTPUT_VARIABLE GSL_CXX_FLAGS)
-	
-      # set INCLUDE_DIRS to prefix+include
-      EXEC_PROGRAM(${GSL_CONFIG}
-	ARGS --prefix
-	OUTPUT_VARIABLE GSL_PREFIX)
-      SET(GSL_INCLUDE_DIR ${GSL_PREFIX}/include CACHE STRING INTERNAL)
-	  
-      # set link libraries and link flags
-      # SET(GSL_LIBRARIES "`${GSL_CONFIG} --libs`")
-      EXEC_PROGRAM(${GSL_CONFIG} ARGS --libs OUTPUT_VARIABLE GSL_LIBRARIES)
-      
-      ## extract link dirs for rpath  
-      EXEC_PROGRAM(${GSL_CONFIG}
-	ARGS --libs
-	OUTPUT_VARIABLE GSL_CONFIG_LIBS )
-
-      ## split off the link dirs (for rpath)
-      ## use regular expression to match wildcard equivalent "-L*<endchar>"
-      ## with <endchar> is a space or a semicolon
-      STRING(REGEX MATCHALL "[-][L]([^ ;])+" 
-	GSL_LINK_DIRECTORIES_WITH_PREFIX 
-	"${GSL_CONFIG_LIBS}" )
-#      MESSAGE("DBG  GSL_LINK_DIRECTORIES_WITH_PREFIX=${GSL_LINK_DIRECTORIES_WITH_PREFIX}")
-      
-      ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES
-     
-      IF (GSL_LINK_DIRECTORIES_WITH_PREFIX)
-	STRING(REGEX REPLACE "[-][L]" "" GSL_LINK_DIRECTORIES ${GSL_LINK_DIRECTORIES_WITH_PREFIX} )
-      ENDIF (GSL_LINK_DIRECTORIES_WITH_PREFIX)
-      SET(GSL_EXE_LINKER_FLAGS "-Wl,-rpath,${GSL_LINK_DIRECTORIES}" CACHE STRING INTERNAL)
-#      MESSAGE("DBG  GSL_LINK_DIRECTORIES=${GSL_LINK_DIRECTORIES}")
-#      MESSAGE("DBG  GSL_EXE_LINKER_FLAGS=${GSL_EXE_LINKER_FLAGS}")
-
-      ADD_DEFINITIONS("-DHAVE_GSL")
-      SET(GSL_DEFINITIONS "-DHAVE_GSL")
-      MARK_AS_ADVANCED(
-	GSL_CXX_FLAGS
-	GSL_INCLUDE_DIR
-	GSL_LIBRARIES
-	GSL_LINK_DIRECTORIES
-	GSL_DEFINITIONS
-	)
-      MESSAGE(STATUS "Using GSL from ${GSL_PREFIX}")
-      
-    ELSE(GSL_CONFIG)
-      MESSAGE(FATAL_ERROR, "FindGSL.cmake: gsl-config not found. Please set it manually. GSL_CONFIG=${GSL_CONFIG}")
-    ENDIF(GSL_CONFIG)
-
-#  ENDIF(UNIX)
-ENDIF(WIN32 AND NOT CYGWIN)
-
-
-IF(GSL_LIBRARIES)
-  IF(GSL_INCLUDE_DIR OR GSL_CXX_FLAGS)
-
-    SET(GSL_FOUND 1)
-    
-  ENDIF(GSL_INCLUDE_DIR OR GSL_CXX_FLAGS)
-ENDIF(GSL_LIBRARIES)
-
-
diff --git a/sm/apps/carmen2json.c b/sm/apps/carmen2json.c
deleted file mode 100644
index ef8b00eb9b5a562fb3ab1eec2e4f880b01306e8b..0000000000000000000000000000000000000000
--- a/sm/apps/carmen2json.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "../csm/csm_all.h"
-
-int main(int argc, char * argv[]) {
-	sm_set_program_name(argv[0]);
-
-	LDP ld; int count=0, errors=0; 
-	while((ld = ld_read_smart(stdin))) {
-		if(!ld_valid_fields(ld))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			errors++;
-			continue;
-		}
-
-		ld_write_as_json(ld, stdout);
-		
-		ld_free(ld);
-		count++;
-	}
-	
-	return errors;
-}
diff --git a/sm/apps/carmen2pdf.c b/sm/apps/carmen2pdf.c
deleted file mode 100644
index c1be940aef43b662ae64dad3f6e78c8decd64c0e..0000000000000000000000000000000000000000
--- a/sm/apps/carmen2pdf.c
+++ /dev/null
@@ -1,400 +0,0 @@
-#include <time.h>
-#include <string.h>
-
-#ifdef LINUX
-#include <linux/limits.h>
-#endif
-
-
-#include <cairo.h>
-#include <cairo-pdf.h>
-
-#include <options/options.h>
-
-#include "../csm/csm_all.h"
-
-
-typedef enum { Invalid = 0, Odometry = 1, Estimate = 2, True_pose = 3 } reference;
-const char*reference_name[4] = { "invalid","odometry","estimate","true_pose"};
-
-struct params {
-	int interval;
-	const char*use;
-	double padding;
-	double horizon;
-	double line_threshold;
-	double dimension;
-	
-	int draw_confidence;
-	double confidence_mult;
-	
-	const char*output_filename;
-	const char*input_filename;
-
-	/**/
-	FILE*input_file;
-	reference use_reference;
-
-	double offset_theta_deg;
-};
-
-void carmen2pdf(struct params p);
-
-double offset_theta = 0;
-void ld_getbb(LDP  ld, double*x0, double*y0, double*x1, double*y1, 
-	reference use_reference, double horizon);
-
-int main(int argc, const char*argv[]) {
-	sm_set_program_name(argv[0]);
-	fprintf(stderr, "carmen2pdf:\t *** Please use log2pdf instead. ***\n\n");
-
-	struct params p;
-	
-	struct option * ops = options_allocate(12);
-	options_int(ops, "interval", &p.interval, 10, "how many to ignore");
-	options_string(ops, "in", &p.input_filename, "stdin", "input file (Carmen or JSON)");
-	options_string(ops, "out", &p.output_filename, "", "output file (if empty, input file + '.pdf')");
-	options_double(ops, "lt", &p.line_threshold, 0.2, "threshold for linking points (m)");
-	options_double(ops, "horizon", &p.horizon, 8.0, "horizon of the laser (m)");
-	options_double(ops, "padding", &p.padding, 0.2, "padding around bounding box (m)");
-	options_double(ops, "dimension", &p.dimension, 500.0, "dimension of the image (points)");
-	options_int(ops, "draw_confidence", &p.draw_confidence, 0, " Draws confidence (readings_sigma[i]) ");
-	options_double(ops, "confidence_mult", &p.confidence_mult, 3.0, " 3-sigma ");
-	options_double(ops, "offset_theta_deg", &p.offset_theta_deg, 0.0, " rotate entire map by this angle (deg) ");
-
-	options_string(ops, "use", &p.use, "estimate", "One in 'odometry','estimate','true_pose'");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		sm_error("Could not parse arguments.\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	/* If out not specified */
-	if(strlen(p.output_filename)==0) {
-		char buf[PATH_MAX];
-		sprintf(buf, "%s.pdf", p.input_filename);
-		p.output_filename = strdup(buf);
-		sm_info("Writing on file '%s'.\n", p.output_filename);
-	}
-	
-	p.use_reference = Invalid;
-	int i; for(i=1;i<=3;i++) 
-		if(!strcmp(p.use, reference_name[i]))
-			p.use_reference = (reference) i;
-	if(Invalid == p.use_reference) {
-		sm_error("Invalid reference '%s'. " 
-			"Use one in 'odometry','estimate','true_pose'.\n", p.use);
-		return -1;
-	}
-	
-	
-	
-	
-	p.input_file = open_file_for_reading(p.input_filename);
-	if(!p.input_file) return -1;
-	
-	carmen2pdf(p);
-	return 0;
-}
-
-int should_consider(struct params *p, int counter) {
-	return counter%p->interval == 0;
-}
-
-void ld_get_world(LDP ld, int i, double*x, double*y, reference use_reference);
-
-struct bounding_box {
-	/** World frame */
-	double x0,y0,x1,y1;
-	/* Paper size */
-	double width, height;
-};
-
-void bb_w2b(struct bounding_box*bb, double wx, double wy, double*bx, double*by){
-	double scale = GSL_MIN(bb->width / (bb->x1-bb->x0), bb->height / (bb->y1-bb->y0));
-	*bx = (wx-bb->x0) * scale;
-	*by = bb->height- (wy-bb->y0) * scale;
-}
-
-void ld_get_buffer_polar(double phi, double rho, const double*pose, 
-	double*x, double*y,
-	struct bounding_box*bb, double*bx,double *by);
-
-
-/** Reads all file to find bounding box */
-void get_bb(struct params*p, struct bounding_box*bb) {
-	LDP ld;
-	int counter = -1, 
-	    considered = 0;
-
-	while((ld = ld_read_smart(p->input_file))) {
-		counter++;
-		if(should_consider(p, counter))  {
-			if(!ld_valid_fields(ld))  {
-				sm_error("Invalid laser data (#%d in file)\n", counter);
-				continue;
-			}
-			
-			double x0,y0,x1,y1;
-			ld_getbb(ld,&x0,&y0,&x1,&y1, p->use_reference, p->horizon);
-			if(considered > 0) {
-				bb->x0 = GSL_MIN(x0, bb->x0);
-				bb->x1 = GSL_MAX(x1, bb->x1);
-				bb->y0 = GSL_MIN(y0, bb->y0);
-				bb->y1 = GSL_MAX(y1, bb->y1);
-			} else {
-				/* this is the first one */
-				bb->x0 = x0;
-				bb->x1 = x1;
-				bb->y0 = y0;
-				bb->y1 = y1;
-			}
-			
-			considered++;
-		}
-		ld_free(ld);
-	}
-	sm_info("Considering %d of %d scans.\n", considered, counter+1);
-	rewind(p->input_file);
-	
-	bb->x0 -= p->padding;
-	bb->x1 += p->padding;
-	bb->y0 -= p->padding;
-	bb->y1 += p->padding;
-}
-
-
-double * ld_get_reference(LDP ld, reference use_reference) {
-	double * pose;
-	switch(use_reference) {
-		case Odometry: pose = ld->odometry; break;
-		case Estimate: pose = ld->estimate; break;
-		case True_pose: pose = ld->true_pose; break;
-		default: exit(-1);
-	}
-	if(any_nan(pose, 3)) {
-		sm_error("Required field '%s' not set in laser scan.\n", 
-			reference_name[use_reference] );
-		sm_error("I will abruptly exit() because of a panic attack.\n");
-		exit(-1);
-	}
-	return pose;
-}
-
-
-void carmen2pdf(struct params p) {
-	
-	offset_theta += deg2rad(p.offset_theta_deg);
-
-	struct bounding_box bb;
-	get_bb(&p, &bb);
-
-	double wwidth = bb.x1-bb.x0;
-	double wheight= bb.y1-bb.y0;
-	if(wwidth > wheight) {
-		bb.width = p.dimension;
-		bb.height = bb.width / wwidth * wheight;
-	} else {
-		bb.height = p.dimension;
-		bb.width = bb.height / wheight * wwidth;
-	}
-	
-	sm_info("Bounding box: %f %f, %f %f\n",bb.x0,bb.y0,bb.x1,bb.y1);
-	
-	cairo_surface_t *surface;
-	cairo_t *cr;
-	cairo_status_t status;
-	
-	surface = cairo_pdf_surface_create(p.output_filename, bb.width, bb.height);
-	cr = cairo_create (surface);
-	status = cairo_status (cr);
-
-	if (status) {
-		sm_error("Failed to create pdf surface for file %s: %s\n",
-			p.output_filename, cairo_status_to_string (status));
-		return;
-	}
-	
-	int counter=0; 
-	int first_pose=1; double old_pose_bx=0,old_pose_by=0;
-	LDP ld;
-	while((ld = ld_read_smart(p.input_file))) {
-	
-		double *pose = ld_get_reference(ld, p.use_reference);
-
-		/* Draw pose */
-		{
-			double bx,by;
-			ld_get_buffer_polar(0.0,0.0,pose, 0,0, &bb, &bx, &by);
-			if(first_pose) { 
-				first_pose = 0; 
-			} else {
-				cairo_set_line_width(cr, 0.5);
-				cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);
-				cairo_move_to(cr, old_pose_bx, old_pose_by);
-				cairo_line_to(cr, bx, by);
-				cairo_close_path(cr);
-				cairo_stroke(cr);
-			}
-
-			old_pose_bx = bx;
-			old_pose_by = by;
-		}
-		
-
-		/* If should we draw this sensor scan */
-		if(should_consider(&p, counter))  {
-
-			/* Firstly, find buffer coordinates and whether to cut the stroke */
-			struct {
-				double w[2]; /* world coordinates */
-				double b[2]; /* buffer coordinates */
-				int begin_new_stroke;
-				int end_stroke;
-				int valid;
-				} draw_info[ld->nrays];
-			
-			{
-				int last_valid = -1; int first = 1;
-				int i; for(i=0;i<ld->nrays;i++) {
-
-					if( (!ld->valid[i]) || ld->readings[i]>p.horizon) {
-						draw_info[i].valid = 0;
-						continue;
-					}
-					draw_info[i].valid = 1;
-
-					ld_get_buffer_polar(ld->theta[i], ld->readings[i], 
-						pose, &(draw_info[i].w[0]), &(draw_info[i].w[1]), 
-						&bb,  &(draw_info[i].b[0]), &(draw_info[i].b[1]));
-
-					if(first) { 
-						first = 0; 
-						draw_info[i].begin_new_stroke = 1;
-						draw_info[i].end_stroke = 0;
-					} else {
-						int near = square(p.line_threshold) > 
-							distance_squared_d(draw_info[last_valid].w, draw_info[i].w);
-						draw_info[i].begin_new_stroke = near ? 0 : 1;
-						draw_info[i].end_stroke = 0;
-						draw_info[last_valid].end_stroke = draw_info[i].begin_new_stroke;
-					}
-					last_valid = i;
-				} /*for */
-				if(last_valid >= 0)
-					draw_info[last_valid].end_stroke = 1;
-			} /* find buff .. */
-			
-
-			if(p.draw_confidence) { 
-				int i;
-				/* Compute interval */
-				double interval[ld->nrays];
-				double big_interval = 0.3;
-				for(i=0;i<ld->nrays;i++) { if(draw_info[i].valid==0) continue;
-					double sigma = ld->readings_sigma[i];
-					if(!is_nan(cov)) {
-						interval[i] = p.confidence_mult * sigma;
-					} else interval[i] = big_interval;
-				}
-
-				cairo_set_source_rgb(cr, 1.0, 0.5, 0.5);
-				cairo_set_line_width(cr, 0.1);
-				/* draw one */
-				int j=0; for(j=0;j<2;j++)
-				for(i=0;i<ld->nrays;i++) { if(draw_info[i].valid==0) continue;
-					double b[2];
-					ld_get_buffer_polar(ld->theta[i], 
-						ld->readings[i] + (j ? interval[i] : -interval[i]), 
-						pose, 0, 0, &bb,  &(b[0]), &(b[1]));
-
-					if(draw_info[i].begin_new_stroke)
-						cairo_move_to(cr, b[0], b[1]);
-					else
-						cairo_line_to(cr, b[0], b[1]);
-					if(draw_info[i].end_stroke)
-						cairo_stroke(cr);
-				}
-			} /* draw confidence */
-			
-			/* draw contour: begin_new_stroke and end_stroke tell 
-			when to interrupt the stroke */
-			int i; 
-			cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
-			cairo_set_line_width(cr, 0.5);
-			for(i=0;i<ld->nrays;i++) {
-				if(draw_info[i].valid==0) continue;
-				double *b = draw_info[i].b;
-				if(draw_info[i].begin_new_stroke)
-					cairo_move_to(cr, b[0], b[1]);
-				else
-					cairo_line_to(cr, b[0], b[1]);
-				if(draw_info[i].end_stroke)
-					cairo_stroke(cr);
-			}
-
-			
-			
-		}
-		counter++;
-		ld_free(ld);
-	}
-
-	cairo_show_page (cr);
-
-	cairo_destroy (cr);
-	cairo_surface_destroy (surface);
-}
-
-void ld_get_buffer_polar(double phi, double rho, const double*pose, 
-	double*x, double*y,
-	struct bounding_box*bb, double*bx,double *by) {
-	
-	double point[2];
-	point[0] = cos(phi) * rho;
-	point[1] = sin(phi) * rho;
-
-	double frame[3] = { 0, 0, offset_theta};
-	double pose2[3];
-	oplus_d(frame, pose, pose2);
-	double pw[2];
-	transform_d(point, pose2, pw);
-	
-	if( (bb!=0) & (bx!=0) & (by!=0) )
-	bb_w2b(bb, pw[0], pw[1],  bx, by);
-	
-	if((x!=0) && (y!=0)) {
-		*x = pw[0]; *y = pw[1];
-	}
-}
-
-void ld_getbb(LDP  ld, double*x0, double*y0, double*x1, double*y1,
- 	reference use_reference, double horizon) {
-	double *pose = ld_get_reference(ld, use_reference);
-	
-	int nrays_used = 0;
-	int first=1;
-	int i; for(i=0;i<ld->nrays;i++) {
-		if(!ld->valid[i]) continue;
-		if(ld->readings[i]>horizon) continue;
-		double x,y;
-		ld_get_buffer_polar(ld->theta[i], ld->readings[i], pose, &x, &y, 0, 0,0);
-
-		if(first) {
-			*x0 = *x1 = x;
-			*y0 = *y1 = y;
-			first = 0;
-		} else {
-			*x0 = GSL_MIN(*x0, x);
-			*y0 = GSL_MIN(*y0, y);
-			*x1 = GSL_MAX(*x1, x);
-			*y1 = GSL_MAX(*y1, y);
-		}
-		nrays_used++;
-	}
-}
-
-
-
-
diff --git a/sm/apps/gtk_viewer/Makefile b/sm/apps/gtk_viewer/Makefile
deleted file mode 100644
index 7b87b1250a27e661b821452c915c56ee403a46c3..0000000000000000000000000000000000000000
--- a/sm/apps/gtk_viewer/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-
-all_targets=gtk_viewer1
-
-all: $(all_targets) 
-
-GOO_FLAGS=-I/usr/local/include/goocanvas-1.0/ -lgoocanvas
-GTK_FLAGS=`pkg-config --libs --cflags gtk+-2.0 gthread-2.0`
-CSM_FLAGS=`pkg-config --libs --cflags csm`
-
-FLAGS=$(GTK_FLAGS) $(GOO_FLAGS) $(CSM_FLAGS) -Wno-long-double -O3
-%: %.c goo_laser_data.c
-	gcc -g $(FLAGS) -o $@ $^
-
-
-clean:
-	rm $(all_targets)
\ No newline at end of file
diff --git a/sm/apps/gtk_viewer/goo_laser_data.c b/sm/apps/gtk_viewer/goo_laser_data.c
deleted file mode 100644
index f6b4fd6c3f852d2cf33e7d38a1beb26877cfbbf0..0000000000000000000000000000000000000000
--- a/sm/apps/gtk_viewer/goo_laser_data.c
+++ /dev/null
@@ -1,147 +0,0 @@
-
-#include "goo_laser_data.h"
-
-/* Use the GLib convenience macro to define the type. GooLaserData is the
-   class struct, goo_laser_data is the function prefix, and our class is a
-   subclass of GOO_TYPE_CANVAS_ITEM_SIMPLE. */
-G_DEFINE_TYPE (GooLaserData, goo_laser_data, GOO_TYPE_CANVAS_ITEM_SIMPLE)
-
-
-/* The standard object initialization function. */
-static void
-goo_laser_data_init (GooLaserData *gld)
-{
-	
-}
-
-
-/* The convenience function to create new items. This should start with a 
-   parent argument and end with a variable list of object properties to fit
-   in with the standard canvas items. */
-GooCanvasItem*
-goo_laser_data_new (GooCanvasItem      *parent, viewer_params *p, LDP ld) 
-{
-  GooCanvasItem *item;
-  GooLaserData *gld;
-
-	item = g_object_new (goo_laser_data_get_type(), NULL);
-
-	gld = (GooLaserData*) item;
-
-	ld_get_bounding_box(ld, gld->bb_min, gld->bb_max, ld->estimate, 10);
-	double padding = 1;
-	gld->bb_min[0] -= padding;
-	gld->bb_min[1] -= padding;
-	gld->bb_max[0] += padding;
-	gld->bb_max[1] += padding;
-	
-	
-	gld->p = p;
-	gld->ld = ld;
-
-	ld_get_oriented_bbox(ld, 20, &(gld->obbox) );
-	oplus_d(ld->estimate, gld->obbox.pose, gld->obbox.pose);
-
-/*  va_start (var_args, height);
-  first_property = va_arg (var_args, char*);
-  if (first_property)
-    g_object_set_valist ((GObject*) item, first_property, var_args);
-  va_end (var_args);
-*/
-  if (parent)
-    {
-      goo_canvas_item_add_child (parent, item, -1);
-      g_object_unref (item);
-    }
-
-  return item;
-}
-
-
-/* The update method. This is called when the canvas is initially shown and
-   also whenever the object is updated and needs to change its size and/or
-   shape. It should calculate its new bounds in its own coordinate space,
-   storing them in simple->bounds. */
-static void
-goo_laser_data_update  (GooCanvasItemSimple *simple,
-		       cairo_t             *cr)
-{
-  GooLaserData *gld = (GooLaserData*) simple;
-
-double padding = 0;
-  /* Compute the new bounds. */
-  simple->bounds.x1 = gld->bb_min[0] - padding;
-  simple->bounds.y1 = gld->bb_min[1] - padding;
-  simple->bounds.x2 = gld->bb_max[0] + padding;
-  simple->bounds.y2 = gld->bb_max[1] + padding;
-
-/*sm_debug("Bound %f %f %f %f\n", gld->bb_min[0],
-gld->bb_min[1],	gld->bb_max[0],
-gld->bb_max[1]);*/
-
-}
-
-/* The paint method. This should draw the item on the given cairo_t, using
-   the item's own coordinate space. */
-static void
-goo_laser_data_paint (GooCanvasItemSimple   *simple,
-		     cairo_t               *cr,
-		     const GooCanvasBounds *bounds)
-{
-	GooLaserData *gld = (GooLaserData*) simple;
-/*
-	cairo_set_line_width (cr, 0.01);
-	cairo_move_to (cr, gld->bb_min[0], gld->bb_min[1]);
-	cairo_line_to (cr, gld->bb_max[0], gld->bb_min[1]);
-	cairo_line_to (cr, gld->bb_max[0], gld->bb_max[0]);
-	cairo_line_to (cr, gld->bb_min[0], gld->bb_max[0]);
-	cairo_line_to (cr, gld->bb_min[0], gld->bb_min[1]);
-	cairo_close_path (cr);
-	cairo_set_source_rgb(cr, 0.8, 0.9, 0.8);
-	cairo_stroke (cr);
-*/
-
-	cairo_set_antialias( cr, CAIRO_ANTIALIAS_NONE );
-
-
-	cairo_set_source_rgb(cr, 0.3, 0, 1.0);
-	cairo_arc(cr, 0,0,  0.4, 0.0, 2*M_PI);
-	cairo_fill(cr);
-	
-	cr_ld_draw(cr, gld->ld, &(gld->p->laser));
-}
-
-
-/* Hit detection. This should check if the given coordinate (in the item's
-   coordinate space) is within the item. If it is it should return TRUE,
-   otherwises it should return FALSE. */
-static gboolean
-goo_laser_data_is_item_at (GooCanvasItemSimple *simple,
-			  gdouble              x,
-			  gdouble              y,
-			  cairo_t             *cr,
-			  gboolean             is_pointer_event)
-{
-  GooLaserData *gld = (GooLaserData*) simple;
-
-/*  if (x < gld->x || (x > gld->x + gld->width)
-      || y < gld->y || (y > gld->y + gld->height))*/
-    return FALSE;
-
-  return TRUE;
-}
-
-
-/* The class initialization function. Here we set the class' update(), paint()
-   and is_item_at() methods. */
-static void
-goo_laser_data_class_init (GooLaserDataClass *klass)
-{
-  GooCanvasItemSimpleClass *simple_class = (GooCanvasItemSimpleClass*) klass;
-
-  simple_class->simple_update        = goo_laser_data_update;
-  simple_class->simple_paint         = goo_laser_data_paint;
-  simple_class->simple_is_item_at    = goo_laser_data_is_item_at;
-}
-
-
diff --git a/sm/apps/gtk_viewer/goo_laser_data.h b/sm/apps/gtk_viewer/goo_laser_data.h
deleted file mode 100644
index 9565f098808afdf57b2ee615174af853618ad3e5..0000000000000000000000000000000000000000
--- a/sm/apps/gtk_viewer/goo_laser_data.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef H_GOO_LASER_DATA
-#define H_GOO_LASER_DATA
-
-#include <gtk/gtk.h>
-#include "goocanvasitemsimple.h"
-
-#include <csm/csm.h>
-
-#include "gtk_viewer.h"
-
-G_BEGIN_DECLS
-
-typedef struct _GooDemoItem       GooDemoItem;
-typedef struct _GooDemoItemClass  GooDemoItemClass;
-
-typedef struct {
-	GooCanvasItemSimple parent_object;
-
-	double bb_min[2], bb_max[2];
-	oriented_bbox obbox;
-
-	LDP ld;
-	
-	viewer_params *p;
-} GooLaserData;
-
-typedef struct {
-  GooCanvasItemSimpleClass parent_class;
-} GooLaserDataClass;
-
-GType               goo_laser_data_get_type  (void) G_GNUC_CONST;
-GooCanvasItem*      goo_laser_data_new (GooCanvasItem *parent, viewer_params *p,
-LDP ld);
-
-G_END_DECLS
-
-#endif
diff --git a/sm/apps/gtk_viewer/gtk_viewer-readme.txt b/sm/apps/gtk_viewer/gtk_viewer-readme.txt
deleted file mode 100644
index 82e31a21d332d33f0727919b1931ab08fa839104..0000000000000000000000000000000000000000
--- a/sm/apps/gtk_viewer/gtk_viewer-readme.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-
-# GTK Viewer #
-
-Just an experiment.
-
-Software prerequisites:
-
-* a recent version of GTK 
-* GooCanvas: http://sourceforge.net/projects/goocanvas
-
diff --git a/sm/apps/gtk_viewer/gtk_viewer.h b/sm/apps/gtk_viewer/gtk_viewer.h
deleted file mode 100644
index 522cbc553d09d55882c1ad204baa397217f9d898..0000000000000000000000000000000000000000
--- a/sm/apps/gtk_viewer/gtk_viewer.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef H_GTK_VIEWER
-#define H_GTK_VIEWER
-
-#include <csm/csm_all.h>
-#include <csm/laser_data_cairo.h>
-
-struct GooLaserData;
-
-typedef struct {
-	ld_style laser;
-	line_style pose_path;
-
-	const char *use;
-	ld_reference use_reference;
-	const char * input_filename;
-
-	oriented_bbox viewport;
-	
-	LDP* scans;
-	struct GooLaserData** scans_items;
-	int scans_size; 
-	int scans_num;
-	
-	double device_size[2];
-	
-	GooCanvasItem *root;
-	GooCanvas*canvas;
-} viewer_params;
-
-void compute_transformations(viewer_params*p);
-
-#endif
diff --git a/sm/apps/gtk_viewer/gtk_viewer1.c b/sm/apps/gtk_viewer/gtk_viewer1.c
deleted file mode 100644
index fd0ad505756148e9b281f9aa23a864ebd3e0540d..0000000000000000000000000000000000000000
--- a/sm/apps/gtk_viewer/gtk_viewer1.c
+++ /dev/null
@@ -1,264 +0,0 @@
-#include <stdlib.h>
-#include <goocanvas.h>
-#include "goo_laser_data.h"
-#include "gtk_viewer.h"
-
-static gboolean on_rect_button_press (GooCanvasItem  *view,
-				      GooCanvasItem  *target,
-				      GdkEventButton *event,
-				      gpointer        data);
-
-static gboolean on_delete_event      (GtkWidget      *window,
-				      GdkEvent       *event,
-				      gpointer        unused_data);
-
-void* reading_thread(void *data);
-	
-GooCanvasItem*  text_item;
-GooCanvasItem* rect_item;
-
-int main (int argc, char **argv)
-{
-	sm_set_program_name(basename(argv[0]));
-	
-	viewer_params *p = (viewer_params*) malloc(sizeof(viewer_params));
-	lds_set_defaults(&(p->laser));
-	ls_set_defaults(&(p->pose_path));
-	
-	p->laser.rays.draw = 0;
-	p->laser.points.draw = 0;
-	p->laser.normals.draw = 0;
-	p->laser.countour.width = 0.1;
-	p->pose_path.width = 0.1;
-	p->pose_path.color = "#f00";
-	
-	struct option * ops = options_allocate(100);
-	options_string(ops, "in", &(p->input_filename), "stdin", "input file (Carmen or JSON)");
-	options_string(ops, "use", &(p->use), "estimate", "One in 'odometry','estimate','true_pose'");
-	
-	lds_add_options(&(p->laser), ops, "laser_", "");
-	ls_add_options(&(p->pose_path), ops, "path_", "");
-
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "A simple experimental GTK viewer.\n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-  /* init threads */
-  g_thread_init(NULL);
-  gdk_threads_init();
-
-
-  GtkWidget *window, *scrolled_win, *canvas;
-GooCanvasItem *root;
-
-  /* Initialize GTK+. */
-  gtk_set_locale ();
-  gtk_init (&argc, &argv);
-
-  /* Create the window and widgets. */
-  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_default_size (GTK_WINDOW (window), 640, 600);
-  gtk_widget_show (window);
-  g_signal_connect (window, "delete_event", (GtkSignalFunc) on_delete_event,
-		    NULL);
-
-  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
-  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win),
-				       GTK_SHADOW_IN);
-  gtk_widget_show (scrolled_win);
-  gtk_container_add (GTK_CONTAINER (window), scrolled_win);
-
-  canvas = goo_canvas_new ();
-
-  root = goo_canvas_get_root_item (GOO_CANVAS (canvas));
-
-	p->device_size[0] = 800;
-	p->device_size[1] = 600;
-	
-	gtk_widget_set_size_request (canvas, p->device_size[0], p->device_size[1]);
-	goo_canvas_set_bounds (GOO_CANVAS (canvas), 0, 0, p->device_size[0], p->device_size[1]);
-	gtk_widget_show (canvas);
-	gtk_container_add (GTK_CONTAINER (scrolled_win), canvas);
-
-	p->root = root;
-	p->canvas = canvas;
-	
-	
-	/* Add a few simple items. */
-rect_item = goo_canvas_rect_new (root, 0, 0, 50, 50,
-				   "line-width", 10.0,
-				   "radius-x", 20.0,
-				   "radius-y", 10.0,
-				   "stroke-color", "yellow",
-				   "fill-color", "red",
-				   NULL);
-
-/*text_item = goo_canvas_text_new (root, "Hello World", 300, 300, -1,
-				   GTK_ANCHOR_CENTER,
-				   "font", "Sans 1",
-				   NULL);
-  goo_canvas_item_rotate (text_item, 45, 300, 300);
-  */
-
-	
-	GError * error;
-	if (!g_thread_create(reading_thread, p, FALSE, &error)) {
-      g_printerr ("Failed to create YES thread: %s\n", error->message);
-      return 1;
-	}
-  /* Pass control to the GTK+ main event loop. */
-  gtk_main ();
-
-}
-
-void* reading_thread(void *data) {
-	viewer_params * p = (viewer_params*) data;
-	
-	FILE * input = open_file_for_reading(p->input_filename);
-	if(!input) return 0;
-	
-	p->scans = malloc(1);
-	p->scans_items = malloc(1);
-	p->scans_size = 0;
-	p->scans_num = 0;
-	
-	LDP ld;
-	while( (ld = ld_read_smart(input)) ) {
-	   
-		if(p->scans_num >= p->scans_size) {
-			p->scans_size = 2* p->scans_size +10;
-			p->scans = realloc(p->scans, sizeof(LDP) * p->scans_size);
-			p->scans_items = realloc(p->scans_items, sizeof(LDP) * p->scans_size);
-		}
-		
-		gdk_threads_enter();
-
-		if(1) {
-			GooCanvasItem * gld = goo_laser_data_new (p->root, p, ld);
-		g_signal_connect (gld, "button_press_event",
-			    (GtkSignalFunc) on_rect_button_press, NULL);
-			p->scans[p->scans_num] = ld;
-			p->scans_items[p->scans_num] = gld;
-			p->scans_num++;
-		} else {
-
-		}
-		compute_transformations(p);
-		goo_canvas_update(p->canvas);
-/*		gdk_flush ();*/
-		
-		gdk_threads_leave();
-		/* sleep a while */
-		usleep(20);
-/*	      sleep(g_random_int_range (1, 4));*/
-	}
-
-  return 0;
-}
-
-void world_to_viewport(
-	const oriented_bbox*obbox, const double device_size[2], cairo_matrix_t*m) {
-	
-	cairo_matrix_init_identity(m);
-	
-	double scale[2] = { 
-		device_size[0] / obbox->size[0], 
-		device_size[1] / obbox->size[1]};
-		
-	double s = scale[0] < scale[1] ? scale[0] : scale[1];
-	cairo_matrix_scale(m, s, s);
-	cairo_matrix_scale(m, 1, -1);
-	cairo_matrix_rotate(m, -obbox->pose[2]);	
-	cairo_matrix_translate(m, -obbox->pose[0], -obbox->pose[1]);
-	
-}
-
-void item_to_world(const double pose[3], cairo_matrix_t*m) {
-	cairo_matrix_init_identity(m);
-	cairo_matrix_translate(m, pose[0], pose[1]);
-	cairo_matrix_rotate(m, pose[2]);	
-}
-
-void compute_transformations(viewer_params*p) {
-	int k;
-	oriented_bbox global;
-	
-	if(0) {
-		bbfind * bbf = bbfind_new();
-		int n = p->scans_num;
-/*		if(n>20) n = 20;*/
-	
-		for(k=0;k<n;k++) {
-			GooLaserData * gld = (GooLaserData*) p->scans_items[k];
-			bbfind_add_bbox(bbf, &gld->obbox);
-		}
-	
-	
-		if(bbfind_compute(bbf, &global)) {
-			sm_debug("%d Global: %s size %f %f\n", p->scans_num, friendly_pose(global.pose), 
-				global.size[0], global.size[1]);
-		} else {
-			sm_error("%d Could not compute global bounding box.\n", p->scans_num);
-		}
-		bbfind_free(bbf);
-	}else{
-	
-	global.pose[0] = -22;
-	global.pose[1] = -41;
-	global.pose[2] = M_PI/2;
-	global.size[0] = 106;
-	global.size[1] = 46;
-}
-	cairo_matrix_t m_world_to_viewport;
-	world_to_viewport(&global, p->device_size, &(m_world_to_viewport));
-
-	cairo_matrix_t *m = &m_world_to_viewport;
-	sm_info("Matrix: %f %f %f %f  %f %f\n", m->xx,m->yx,m->xy,m->yy, m->x0, m->y0);
-
-	cairo_matrix_t mm;
-	cairo_matrix_init_identity(&mm);
-/*	cairo_matrix_translate(&mm, 300, 600);*/
-	cairo_matrix_translate(&mm, 300, 600);
-	cairo_matrix_rotate(&mm, deg2rad(p->scans_num));
-	goo_canvas_item_set_transform(rect_item, &mm);
-
-	/*
-	goo_canvas_item_set_transform(text_item, &m_world_to_viewport);
-*/
-	for(k=0;k<p->scans_num;k++) {
-		GooCanvasItem * gld = p->scans_items[k];
-		
-		double * pose = p->scans[k]->estimate;
-		cairo_matrix_t m_item_to_world;
-		item_to_world(pose, &m_item_to_world);
-
-		cairo_matrix_t transform;
-		cairo_matrix_multiply(&transform, &m_item_to_world, &m_world_to_viewport);
-		goo_canvas_item_set_transform(gld, &transform);
-	}
-}
-
-/* This handles button presses in item views. We simply output a message to
-   the console. */
-static gboolean
-on_rect_button_press (GooCanvasItem  *item,
-		      GooCanvasItem  *target,
-		      GdkEventButton *event,
-		      gpointer        data)
-{
-  g_print ("rect item received button press event\n");
-  return TRUE;
-}
-
-
-/* This is our handler for the "delete-event" signal of the window, which
-   is emitted when the 'x' close button is clicked. We just exit here. */
-static gboolean
-on_delete_event (GtkWidget *window,
-		 GdkEvent  *event,
-		 gpointer   unused_data)
-{
-  exit (0);
-}
diff --git a/sm/apps/json2carmen.c b/sm/apps/json2carmen.c
deleted file mode 100644
index d4cd4b147aa79189326ebebb053fb1a035c78a5f..0000000000000000000000000000000000000000
--- a/sm/apps/json2carmen.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "../csm/csm_all.h"
-
-int main(int argc, char * argv[]) {
-	sm_set_program_name(argv[0]);
-
-	LDP ld; int count=0, errors=0; 
-	while((ld = ld_read_smart(stdin))) {
-		if(!ld_valid_fields(ld))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			errors++;
-			continue;
-		}
-
-		ld_write_as_carmen(ld, stdout);
-		
-		ld_free(ld);
-		count++;
-	}
-	
-	return errors;
-}
diff --git a/sm/apps/json2matlab.c b/sm/apps/json2matlab.c
deleted file mode 100644
index e24941e5fcfaa194924cf82bb9071c772ca14df9..0000000000000000000000000000000000000000
--- a/sm/apps/json2matlab.c
+++ /dev/null
@@ -1,286 +0,0 @@
-#include <assert.h>
-#include <string.h>
-#include "../csm/csm_all.h"
-#include <options/options.h>
-
-#include <json-c/json.h>
-#include <json-c/json_object_private.h>
-
-void jo_write_as_matlab(JO jo, FILE*out);
-
-void jo_write_as_matrix(JO jo, FILE*out);
-void jo_write_as_column_vector(JO jo, FILE* out);
-
-void jo_write_as_cell_array(JO jo, FILE* out);
-int jo_is_numeric_matrix(JO jo);
-int jo_is_numeric_array(JO jo);
-void jo_write_as_matlab_object(JO jo, FILE*out);
-
-
-const char * banner = 
-"Converts JSON stream to Matlab file. \n"
-"There are three usages: \n"
-" 1) with only one parameter, \n"
-"    $ json2matlab dir/mydata.json \n"
-"    creates a Matlab function 'mydata' inside the file 'dir/mydata.m' \n"
-" 2) with two parameters, \n"
-"     $ json2matlab dir/mydata.json dir/out.m \n" 
-"    creates a Matlab function 'out' inside the file 'dir/out.m'. \n"
-" 3) otherwise, use the options switches. \n"
-" \n"
-" By default it creates a complete script of the kind:\n"
-" \n"
-"   function res = function_name()\n"
-"      res = \n"
-"		{ ...}\n"
-" \n"
-" If complete_script is set to 0, it just outputs the meat: \n"
-" \n"
-"		{ ...}\n"
-" \n";
-
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-
-	const char * input_filename;
-	const char * out_filename;
-	const char * function;
-	int complete_script;
-	int debug;
-	
-	options_banner(banner);
-	
-	struct option* ops = options_allocate(8);
-	options_string(ops, "in", &input_filename, "stdin", "input file (JSON)");
-	options_string(ops, "out", &out_filename, "stdout", "output file (MATLAB)");
-	options_string(ops, "function", &function, "", "Matlab function name (if empty, use basename of out)");
-	options_int(ops, "complete_script", &complete_script, 1, "Write complete script 'function  res = ...'");
-	options_int(ops, "debug", &debug, 1, "Shows debug information");
-	
-	if(argc == 2 && (argv[1][0] != '-')) { 
-		/* one parameter */
-		input_filename = argv[1]; int len = strlen(input_filename) + 4;
-		char base[len], no_suffix[len], out[len];
-		my_no_suffix(input_filename, no_suffix);
-		sprintf(out, "%s.m", no_suffix);
-		my_basename_no_suffix(input_filename, base);
-		out_filename = my_strdup(out);
-		function = my_strdup(base);
-	} else if(argc == 3 && (argv[1][0] != '-') && (argv[2][0] != '-')) { 
-		input_filename = argv[1]; 
-		out_filename = argv[2];
-	} else {
-		/* FIXME help not shown */
-		if(!options_parse_args(ops, argc, argv))
-			return -1;
-	}
-
-	sm_debug_write(debug);
-
-	if(!strcmp(function,"")) {
-		int len = strlen(out_filename) + 4;
-		char base[len];
-		my_basename_no_suffix(out_filename, base);
-		function = my_strdup(base);				
-	}
-	
-	
-	FILE * out = open_file_for_writing(out_filename);
-	if(!out) return -2;
-
-	FILE * in = open_file_for_reading(input_filename);
-	if(!in) return -3;
-	
-	if(complete_script) {
-		fprintf(out, "function res = %s\n", function);
-		fprintf(out, " res = ... \n");
-	}
-	fprintf(out, " { ... \n\t");
-	
-	JO jo; 
-	int i = 0;
-	while((jo = json_read_stream(in))) {
-		if(i>0) fprintf(out, ", ...\n\t");
-		jo_write_as_matlab(jo, out);
-		jo_free(jo);
-		i++;
-	}
-
-	fprintf(out, "... \n }; \n");
-	return 0;
-}
-
-
-void jo_write_as_matlab(JO jo, FILE*out) {
-	if(!jo) { fprintf(out, "NaN"); return; } 
-	
-	switch(json_object_get_type(jo)) {
-		case json_type_null: 
-			fprintf(out, "NaN"); 
-			return;
-		
-		case json_type_boolean:
-			fprintf(out, json_object_get_boolean(jo) ? "true" : "false" );
-			return;
-		
-		case json_type_int:
-			fprintf(out, "%d", json_object_get_int(jo));		
-			return;
-
-		case json_type_double: 
-			fprintf(out, "%lg", json_object_get_double(jo));		
-			return;
-		
-		case json_type_object:
-			jo_write_as_matlab_object(jo, out);
-			return;
-		
-		case json_type_array:
-			if(jo_is_numeric_matrix(jo))
-			jo_write_as_matrix(jo, out);
-			else
-			if(jo_is_numeric_array(jo))
-			jo_write_as_column_vector(jo, out);
-			else 
-			jo_write_as_cell_array(jo, out);		
-		return;
-		
-		case json_type_string:
-			fprintf(out, "'");
-			const char* s = json_object_get_string(jo);
-			while(*s) {
-				if(*s==39) 
-				fputc('"', out);
-				else 
-				fputc(*s, out);
-				s++;
-			}
-				
-			fprintf(out, "'");
-			return;
-	}
-	
-	
-}
-
-
-
-void jo_write_as_matlab_object(JO jo, FILE*out) {
-	int i=0;
-	struct json_object_iter iter;
-	fprintf(out, "struct(");
-	
-	json_object_object_foreachC(jo, iter) {
-		if(i) fprintf(out, ", ... \n\t ");
-		fprintf(out, "'%s', ", iter.key);
-		
-		enum json_type t = json_object_get_type(iter.val);
-		if( (t == json_type_array) && (!jo_is_numeric_matrix(iter.val)) && (!jo_is_numeric_array(iter.val))) {
-			fprintf(out, "{");
-			jo_write_as_matlab(iter.val, out);
-			fprintf(out, "}");
-		} else if(t == json_type_object) {
-			fprintf(out, "{ ");
-			jo_write_as_matlab(iter.val, out);
-			fprintf(out, " }");			
-		} else jo_write_as_matlab(iter.val, out);
-
-		i++;
-	}
-	fprintf(out, ")");
-}
-
-
-int jo_is_numeric_matrix(JO jo) {
-	/* null is not a matrix */
-	if(!jo) return 0;
-	if(json_object_get_type(jo) != json_type_array) return 0;
-	int len = json_object_array_length(jo);
-	int ncolumns = -1;
-	for(int i=0;i<len;i++){
-		JO row = json_object_array_get_idx(jo, i);
-		if(!jo_is_numeric_array(row)) return 0;
-		if(i==0) 
-			ncolumns = json_object_array_length(row);
-		else
-			if(ncolumns !=  json_object_array_length(row))
-			return 0;
-	}
-	if(ncolumns==0) return 0;
-	return 1;
-}
-
-int jo_is_numeric_array(JO jo) {
-	/* null is not an array */
-	if(!jo) return 0;
-	if(json_object_get_type(jo) != json_type_array) return 0;
-	int len = json_object_array_length(jo);
-	for(int i=0;i<len;i++){
-		JO elem = json_object_array_get_idx(jo, i);
-
-		/* I consider null elements as numeric values because they can be
-		   converted into NaN */
-		if(elem==0)
-			continue;
-			
-		switch(json_object_get_type(elem)) {
-			case json_type_null: 
-			case json_type_boolean:
-			case json_type_int:
-			case json_type_double:
-			continue;
-			default:
-			return 0;
-		}
-	}
-	return 1;
-}
-
-void jo_write_as_matrix(JO jo, FILE*out) {
-//		"[ " + map{|row| row.join(", ")}.join("; ... \n") +  "]"	
-	assert(json_object_get_type(jo) == json_type_array);
-	fprintf(out, "[");
-	int len = json_object_array_length(jo);
-	for(int i=0;i<len;i++){
-		if(i>0) fprintf(out, ";  ");
-		JO row = json_object_array_get_idx(jo, i);
-		int n = json_object_array_length(row);
-		for(int j=0;j<n;j++) {
-			if(j>0) fprintf(out, ", ");
-			jo_write_as_matlab(json_object_array_get_idx(row, j), out);
-		}
-	}
-	fprintf(out, "]");		
-}
-
-void jo_write_as_column_vector(JO jo, FILE* out) {
-//	"[  "+map{|x| x.to_matlab }.join("; ")+"]"
-	assert(json_object_get_type(jo) == json_type_array);
-	fprintf(out, "[");
-	int len = json_object_array_length(jo);
-	for(int i=0;i<len;i++){
-		if(i>0) fprintf(out, "; ");
-		JO elem = json_object_array_get_idx(jo, i);
-		jo_write_as_matlab(elem, out);
-	}
-	fprintf(out, "]");
-}
-
-void jo_write_as_cell_array(JO jo, FILE* out) {
-	assert(json_object_get_type(jo) == json_type_array);
-	int len = json_object_array_length(jo);
-	if(len==0) { 
-		fprintf(out, "{}"); 
-		return; 
-	} else {	
-		fprintf(out, "{ ");
-		for(int i=0;i<len;i++){
-			if(i>0) fprintf(out, ", ");
-			JO elem = json_object_array_get_idx(jo, i);
-			jo_write_as_matlab(elem, out);
-		}
-		fprintf(out, "}");
-	}
-//		"{ ... \n "+map{|x| x.to_matlab }.join(",  ... \n")+"}"
-}
diff --git a/sm/apps/json_decimate.c b/sm/apps/json_decimate.c
deleted file mode 100644
index 5a39946a1e90d0b213dfb3fd6091768b6ab07b2c..0000000000000000000000000000000000000000
--- a/sm/apps/json_decimate.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <options/options.h>
-#include "../csm/csm_all.h"
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-    int period; int phase;
-	const char*input_filename;
-	const char*output_filename;
-	
-	struct option* ops = options_allocate(3);
-	options_int(ops, "period", &period, 1, "Period of objects to extract.");
-	options_int(ops, "phase", &phase, 0, "Phase (=0 starts with the first object)");
-	options_string(ops, "in", &input_filename, "stdin", "input file (JSON)");
-	options_string(ops, "out", &output_filename, "stdout", "output file (JSON)");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "%s : decimates a JSON stream."
-			"\n\nOptions:\n", argv[0]);
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	if(period < 1) {
-		sm_error("Period must be >= 1.\n");
-		return 2;
-	}
-	
-	FILE * input_stream = open_file_for_reading(input_filename);
-	FILE *output_stream = open_file_for_writing(output_filename);
-	
-	if(!input_stream || !output_stream) return -1;
-	
-	
-	int count = 0;
-	while(1) { 
-		JO jo = json_read_stream(input_stream);
-		if(!jo) {
-			if(feof(input_stream)) break;
-			sm_error("Malformed JSON\n");
-			return -1;
-		}
-		
-		if( (count - phase) % period == 0) {
-			const char * s = json_object_to_json_string(jo);
-			fputs(s,output_stream); fputs("\n",output_stream);
-		} 
-		
-		jo_free(jo);
-		count++;
-	}
-	
-	return 0;
-}
diff --git a/sm/apps/json_extract.c b/sm/apps/json_extract.c
deleted file mode 100644
index e3c012e28c5922f55ec252e9dabe2dae8835a03a..0000000000000000000000000000000000000000
--- a/sm/apps/json_extract.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <options/options.h>
-#include "../csm/csm_all.h"
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	int nth;
-	const char*input_filename;
-	const char*output_filename;
-	
-	struct option* ops = options_allocate(3);
-	options_int(ops, "nth", &nth, 0, "Index of object to extract.");
-	options_string(ops, "in", &input_filename, "stdin", "input file (JSON)");
-	options_string(ops, "out", &output_filename, "stdout", "output file (JSON)");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "%s : extracts n-th JSON object from stream."
-			"\n\nOptions:\n", argv[0]);
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	FILE * input_stream = open_file_for_reading(input_filename);
-	FILE *output_stream = open_file_for_writing(output_filename);
-	
-	if(!input_stream || !output_stream) return -1;
-	
-	int i; for(i=0;i<nth;i++) {
-		if(!json_stream_skip(input_stream)) {
-			sm_error("Could not skip %d-th object\n", i);
-			return -2;
-		}
-	}
-	
-	JO jo = json_read_stream(input_stream);
-	if(!jo) {
-		fprintf(stderr, "Could not read %d-th object (after skipping %d)\n", 
-			nth, i);
-		return -2;
-	}
-	
-	fputs(json_object_to_json_string(jo), output_stream);
-	fputs("\n", output_stream);
-	return 0;
-}
diff --git a/sm/apps/json_extract_field.c b/sm/apps/json_extract_field.c
deleted file mode 100644
index 8ebda07ddbc42a7701934b946b7da3bc52de7eea..0000000000000000000000000000000000000000
--- a/sm/apps/json_extract_field.c
+++ /dev/null
@@ -1,103 +0,0 @@
-#include <options/options.h>
-#include "../csm/csm_all.h"
-
-void jo_write_plain(JO jo, FILE* out);
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	const char*input_filename;
-	const char*output_filename;
-	const char*field;
-	int exit_on_error;
-	
-	struct option* ops = options_allocate(3);
-	options_string(ops, "in", &input_filename, "stdin", "input file (JSON)");
-	options_string(ops, "out", &output_filename, "stdout", "output file (JSON)");
-	options_int(ops, "exit_on_error", &exit_on_error, 0, "if true, exit if object has no field");
-	options_string(ops, "field", &field, "field_name", "field to extract from structure");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		sm_info("Extracts a field from JSON object."
-			"\n\nOptions:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	FILE * input_stream = open_file_for_reading(input_filename);
-	FILE *output_stream = open_file_for_writing(output_filename);
-	
-	if(!input_stream || !output_stream) return -1;
-	
-	int n=0;
-	while(1) {
-		n++;
-		
-		JO jo = json_read_stream(input_stream);
-		if(!jo) {
-			if(feof(input_stream)) break;
-			sm_error("Error while reading stream.\n");
-			return -2;
-		}
-		
-		JO jo_field = jo_get(jo, field);
-		if(!jo_field) {
-			if(exit_on_error) {
-				sm_error("object #%d: field '%s' not found in structure.\n", n, field);
-				return -1;
-			} else {
-				sm_error("object #%d: field '%s' not found in structure.\n", n, field);
-				continue;
-			}
-		}
-		
-		jo_write_plain(jo_field, output_stream);
-		fputs("\n", output_stream);
-		jo_free(jo);
-	};
-	
-	return 0;
-}
-
-void jo_write_plain(JO jo, FILE* out) {
-	switch(json_object_get_type(jo)) {
-		case json_type_boolean: {
-			int v = (int) json_object_get_boolean(jo);
-			fprintf(out, "%d", v);
-			break;
-		}
-		case json_type_int: {
-			int v = json_object_get_int(jo);
-			fprintf(out, "%d", v);
-			break;
-		}
-		case json_type_double: {
-			double v = json_object_get_double(jo);
-			fprintf(out, "%g", v);
-			break;
-		}
-		case json_type_string: {
-			const char * s = json_object_get_string(jo);
-			fputs(s, out);
-			break;
-		}
-		case json_type_object: {
-			fputs("{object}", out);
-			break;
-		}
-		case json_type_array: {
-			int k, len = json_object_array_length(jo);
-			for(k=0; k<len; k++) {
-				JO v = json_object_array_get_idx(jo, k);
-				jo_write_plain(v, out);
-				if(k!=len-1) fputs(" ", out);
-			}
-			break;
-		}
-
-	default:
-			sm_error("Unknown JSON type %d.\n", json_object_get_type(jo) );
-	}
-	
-}
-
diff --git a/sm/apps/json_pipe.c b/sm/apps/json_pipe.c
deleted file mode 100644
index 9c5ef4ca0351a01b6d29aa748b0a53b1bdab64d3..0000000000000000000000000000000000000000
--- a/sm/apps/json_pipe.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "../csm/csm_all.h"
-#include <options/options.h>
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	int n;
-	
-	struct option* ops = options_allocate(3);
-	options_int(ops, "n", &n, 1, "Number of copies");
-	if(!options_parse_args(ops, argc, argv)) {
-		sm_info("%s : reads a JSON stream and copies it multiplied by n."
-			"\n\nOptions:\n", (char*)argv[0]);
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	
-	while(1) { 
-		JO jo = json_read_stream(stdin);
-		if(!jo) {
-			if(feof(stdin)) break;
-			sm_error("Malformed JSON\n");
-			return -1;
-		}
-		
-		const char * s = json_object_to_json_string(jo);
-		int i; for(i=0;i<n;i++) {
-			puts(s); puts("\n");
-		}
-		jo_free(jo);
-	}
-	
-	return 0;
-}
diff --git a/sm/apps/json_split.c b/sm/apps/json_split.c
deleted file mode 100644
index 3d32713e1162a96bceef285e7dd13c3ec670700c..0000000000000000000000000000000000000000
--- a/sm/apps/json_split.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <options/options.h>
-#include <string.h>
-#include "../csm/csm_all.h"
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	const char*input_filename;
-	const char*output_pattern_op;
-	
-	struct option* ops = options_allocate(3);
-	options_string(ops, "in", &input_filename, "stdin", "input file (JSON)");
-	options_string(ops, "out", &output_pattern_op, "./ld_split^02d.json", "output pattern; printf() pattern, but write '^' instead of '%'");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "%s : splits a JSON file into many files."
-			"\n\nOptions:\n", argv[0]);
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	
-	/* Substitute "$" with "%" */
-	
-	char output_pattern[256]; strcpy(output_pattern, output_pattern_op);
-	char *f = output_pattern;
-	while(*f) {
-		if(*f=='^') *f='%';
-		f++;
-	}
-
-	fputs(output_pattern, stderr);
-	
-	FILE * input_stream = open_file_for_reading(input_filename);
-
-	int count = 0;
-	
-	JO jo;
-	while( (jo = json_read_stream(input_stream)) ) {
-		char filename[1000];
-		sprintf(filename, output_pattern, count);
-		if(!count) {
-			
-		}
-		
-		sm_debug("Writing to file (%s) %s\n", output_pattern, filename);
-		FILE * f = open_file_for_writing(filename);
-		if(!f) return -1;
-		fputs(json_object_to_json_string(jo), f);
-		jo_free(jo);
-		fclose(f);
-		
-		count++;
-	}
-	
-	
-	return 0;
-}
diff --git a/sm/apps/ld_alternate.c b/sm/apps/ld_alternate.c
deleted file mode 100644
index 925c5e10b3fe6d61f28f1ebc224f60a02c735626..0000000000000000000000000000000000000000
--- a/sm/apps/ld_alternate.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "../csm/csm_all.h"
-
-int main(int argc, const char ** argv) {
-	sm_set_program_name(argv[0]);
-
-	int every = 5;
-	int count = 0;
-	LDP ld;
-	while( (ld = ld_read_smart(stdin))) {
-		count++;
-		
-		if(!ld_valid_fields(ld))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			continue;
-		}
-
-		int i;
-		for(i=0;i<ld->nrays;i++) {
-			if( (i % every) != 0 ) {
-				ld->valid[i] = 0;
-				ld->readings[i] = NAN;
-			}
-		}
-		
-		ld_write_as_json(ld, stdout);
-		ld_free(ld);
-
-		count++;
-	}
-	
-	return 0;
-}
diff --git a/sm/apps/ld_cluster_curv.c b/sm/apps/ld_cluster_curv.c
deleted file mode 100644
index 6cc5d968011e6a53712879c75e14457884b9db8b..0000000000000000000000000000000000000000
--- a/sm/apps/ld_cluster_curv.c
+++ /dev/null
@@ -1,222 +0,0 @@
-#include <options/options.h>
-#include "../csm/csm_all.h"
-
-struct {
-	/** Scale factor */
-	double scale_deg; 
-	
-	/** How many neighbours to consider */
-	int neighbours;
-} p;
-
-void ld_cluster_curv(LDP ld) ;
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-/*	
-	struct option* ops = options_allocate(3);
-	options_double(ops, "scale_deg", &p.scale_deg, 0.0, "Scale factor (degrees) ");
-	options_int(ops, "neighbours", &p.neighbours, 1, "How many neighbours to consider (regardless of scale).");
-		
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "A simple program for smoothing a sensor scan.\n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-*/	
-/* jj_set_stream(open_file_for_writing("ld_cluster_curv.txt")); */
-
-	int errors = 0;
-	int count = -1;
-	LDP ld;
-	while( (ld = ld_read_smart(stdin)) ) {
-		count++;
-		if(!ld_valid_fields(ld))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			return -1;
-		}
-		
-		ld_cluster_curv(ld);
-
-		ld_write_as_json(ld, stdout);
-
-		ld_free(ld);
-	}
-	
-	return errors;
-}
-
-void cluster_convolve(const int*cluster,const double*original, int n, double*dest, double*filter, int filter_len, int negate_negative) 
-{
-	int i; /* index on the points */
-	int j; /* index on the filter */
-	
-	for(i=0;i<n;i++) {
-		if(cluster[i] == -1) {
-			dest[i] = GSL_NAN;
-			continue;
-		}
-		
-		dest[i] = 0;
-		for(j=-(filter_len-1);j<=(filter_len-1);j++) {
-			int i2 = i + j;
-			if(i2<0) i2=0; if(i2>=n) i2=n-1;
-			if(cluster[i2] != cluster[i]) i2 = i; 
-			double coeff = filter[abs(j)];
-			if(j<0 && negate_negative) coeff *= -1;
-			dest[i] += original[i2] * coeff;
-
-			if(is_nan(dest[i]))  
-				sm_error("i: %d; something wrong after processing i2: %d  cluster[i2]=%d original[i2] = %f \n", i, i2, cluster[i2], original[i2]);
-			
-		}
-		
-	}
-}
-
-int cluster_find_max(int*cluster, double*v, int n) {
-	int i, max = -1;
-	for(i=0;i<n;i++) {
-		if(cluster[i] == -1) continue;
-		if( (max == -1) || (v[i] > v[max]) )
-			max = i;
-	}
-	return max;
-}
-
-int find_max(int *v, int n) {
-	int i, max = -1;
-	for(i=0;i<n;i++) {
-		if( (max == -1) || (v[i] > v[max]) )
-			max = i;
-	}
-	return max;	
-}
-
-int ld_max_cluster_id(LDP ld) {
-	return ld->cluster[ find_max(ld->cluster, ld->nrays)];
-}
-
-int ld_cluster_size(LDP ld, int i0) {
-	int this_cluster = ld->cluster[i0];
-	int num = 0; int i;
-	
-	for(i=i0;i<ld->nrays;i++)
-		if(ld->cluster[i] == this_cluster)
-			num++;
-		else if(ld->cluster[i] != -1) break;
-
-	return num;
-}
-
-void ld_remove_small_clusters(LDP ld, int min_size) {
-	int i;
-	for(i=0;i<ld->nrays;) {
-		int this_cluster = ld->cluster[i];
-
-		if(this_cluster == -1) { i++; continue; }
-		int cluster_size = ld_cluster_size(ld, i);
-
-		if(cluster_size < min_size)  {
-			for(;i<ld->nrays;i++)
-				if(ld->cluster[i] == this_cluster)
-					ld->cluster[i] = -1;
-				else if(ld->cluster[i] != -1) break;
-		} else i++;
-	}
-}
-
-void ld_mark_cluster_as_invalid(LDP ld, int cluster) {
-	int i;
-	for(i=0;i<ld->nrays;i++) {
-		if(ld->cluster[i] == cluster)
-			ld->valid[i] = 0;
-	}
-}
-
-void array_abs(double*v, int n) {
-	int i=0; for(i=0;i<n;i++) v[i] = fabs(v[i]);
-}
-
-
-void ld_cluster_curv(LDP ld) {
-	int min_cluster_size = 10;
-	double sigma = 0.005; 
-	int orientation_neighbours = 4;
-	int npeaks = 5;
-	double near_peak_threshold = 0.4;
-
-	if(JJ) jj_context_enter("ld_cluster_curv");
-	int n = ld->nrays;
-	
-	
-	if(JJ) jj_add_int_array("a00valid", ld->valid, n);
-	if(JJ) jj_add_double_array("a01theta", ld->theta, n);
-	if(JJ) jj_add_double_array("a02readings", ld->readings, n);
-	
-	
-	ld_simple_clustering(ld, sigma*5);
-/*	int i=0; for(i=0;i<n;i++)
-		ld->cluster[i] = ld->valid[i] ? 1 : -1;*/
-	
-	
-	if(JJ) jj_add_int_array("a04cluster", ld->cluster, n);
-	ld_remove_small_clusters(ld, min_cluster_size);
-	ld_mark_cluster_as_invalid(ld, -1);
-	if(JJ) jj_add_int_array("a06cluster", ld->cluster, n);
-	
-	double filter[10] = {.5, .4, .3, .2, .2, .2, .2, .2, .2, .2};
-	double deriv_filter[7] = {0, .6, .3, .2, .2, .2, .1};
-	double smooth_alpha[n];
-	double deriv_alpha[n];
-
-	int p;
-	if(JJ) jj_loop_enter("it");
-	
-	for(p=0;p<npeaks;p++) {  if(JJ) jj_loop_iteration();
-		
-		if(JJ) jj_add_int_array("cluster", ld->cluster, n);
-
-		ld_compute_orientation(ld, orientation_neighbours, sigma);
-		
-		int i;
-		for(i=0;i<ld->nrays;i++) 
-			if(!ld->alpha_valid[i])
-			ld->cluster[i] = -1;
-		
-		if(JJ) jj_add_double_array("alpha", ld->alpha, n);
-		cluster_convolve(ld->cluster, ld->alpha, n, smooth_alpha, filter, 10, 0);
-		if(JJ) jj_add_int_array("alpha_valid", ld->alpha_valid, n);
-
-		if(JJ) jj_add_double_array("smooth_alpha", smooth_alpha, n);
-		cluster_convolve(ld->cluster, smooth_alpha, n, deriv_alpha, deriv_filter, 7, 1);
-		if(JJ) jj_add_double_array("deriv_alpha", deriv_alpha, n);
-		array_abs(deriv_alpha, n);
-		
-		int peak = cluster_find_max(ld->cluster, deriv_alpha, n);
-		if(JJ) jj_add_int("peak", peak);
-		
-		int peak_cluster = ld->cluster[peak];
-		int up = peak; double threshold = near_peak_threshold  * deriv_alpha[peak];
-		while(up<n-1 && (ld->cluster[up]==peak_cluster) && deriv_alpha[up+1] >  threshold) up++;
-		int down = peak;
-		while(down>1  && (ld->cluster[up]==peak_cluster) && deriv_alpha[down-1] > threshold) down--;
-		int j;
-		for(j=down;j<=up;j++) {
-			ld->cluster[j] = -1;
-			ld->valid[j] = 0;
-			ld->readings[j] = NAN;
-		}
-		
-		int next_cluster = ld_max_cluster_id(ld) + 1;
-		for(j = up+1; j<ld->nrays; j++) {
-			if(ld->cluster[j] == peak_cluster)
-				ld->cluster[j] = next_cluster;
-		}
-	}
-	if(JJ) jj_loop_exit();
-
-	if(JJ) jj_context_exit();
-}
-
-
diff --git a/sm/apps/ld_correct.c b/sm/apps/ld_correct.c
deleted file mode 100644
index 5b4e74f96f4a6ee41e26cdca76226f735c790e13..0000000000000000000000000000000000000000
--- a/sm/apps/ld_correct.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <math.h>
-#include <gsl/gsl_math.h>
-
-#include <options/options.h>
-
-#include "../csm/csm_all.h"
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-
-	const char*input_filename;
-	const char*output_filename;
-	double diff[3] = {0, 0, 0};
-	
-	double laser[3] ={0,0,0};
-
-	double omega[2] ={0,0};
-	double omega_vel = 0;
-	double vel[2] ={0,0};
-	double vel_omega = 0;
-	
-	
-	struct option* ops = options_allocate(15);
-	options_string(ops, "in", &input_filename, "stdin", "input file");
-	options_string(ops, "out", &output_filename, "stdout", "output file");
-	options_double(ops, "l_x", &(laser[0]), 0.0, "laser x (m)");
-	options_double(ops, "l_y", &(laser[1]), 0.0, "laser y (m)");
-	options_double(ops, "l_theta", &(laser[2]), 0.0, "laser theta (rad)");
-
-	options_double(ops, "omega0", &(omega[0]), 0.0, "omega (rad)");
-	options_double(ops, "omega1", &(omega[1]), 0.0, "omega (linear)");
-	options_double(ops, "omega_vel", &(omega_vel), 0.0, "omega x vel");
-	options_double(ops, "vel0", &(vel[0]), 0.0, "vel (m)");
-	options_double(ops, "vel1", &(vel[1]), 0.0, "vel (linear)");
-	options_double(ops, "vel_omega", &(vel_omega), 0.0, "vel x omega");
-
-		
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, " Corrects bias in odometry.\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	FILE * input_stream = open_file_for_reading(input_filename);
-	FILE *output_stream = open_file_for_writing(output_filename);
-	
-	if(!input_stream || !output_stream) return -1;
-	
-	LDP laser_ref = ld_read_smart(input_stream);
-	if(!laser_ref) {
-		sm_error("Cannot read first scan.\n");
-		return -2;
-	}
-	
-	copy_d(laser_ref->odometry, 3, laser_ref->estimate);
-
-	double old_odometry[3];
-	copy_d(laser_ref->odometry, 3, old_odometry);
-	
-	LDP laser_sens;
-	ld_write_as_json(laser_ref, output_stream);
-	
-	while((laser_sens = ld_read_smart(input_stream))) {
-		double guess[3], old_guess[3];
-		pose_diff_d(laser_sens->odometry, old_odometry, guess);
-		pose_diff_d(laser_sens->odometry, old_odometry, old_guess);
-		copy_d(laser_sens->odometry, 3, old_odometry);
-
-		if(fabs(guess[2]) > 1e-7)
-			guess[2] = old_guess[2] * omega[1] + omega_vel * guess[0] + omega[0];
-
-		if(fabs(guess[0]) > 1e-7)
-			guess[0] = old_guess[0] * vel[1] + vel_omega * guess[2] + vel[0];
-		
-		fprintf(stderr, "odo: %f %f %f Corr: %f rad \t%f m  \n", guess[0], guess[1], guess[2], guess[2]-old_guess[2], guess[0]-old_guess[0]);
-
-		oplus_d(laser_ref->odometry, guess, laser_sens->odometry);
-		oplus_d(laser_sens->odometry, laser, laser_sens->estimate);
-		
-		fprintf(stderr, "ref odo: %s  ref est: %s \n", 
-			friendly_pose(laser_ref->odometry),
-			friendly_pose(laser_ref->estimate));
-		fprintf(stderr, "sens odo: %s  sens est: %s \n", 
-			friendly_pose(laser_sens->odometry),
-			friendly_pose(laser_sens->estimate));
-			
-			
-			
-			ld_write_as_json(laser_sens, output_stream);
-		
-		ld_free(laser_ref);
-		laser_ref = laser_sens;
-	}
-	
-	return 0;
-}
diff --git a/sm/apps/ld_exp_tro1.c b/sm/apps/ld_exp_tro1.c
deleted file mode 100644
index 6ec0ff88c101ce6b2c0be8fcdb7cc7e95df1e545..0000000000000000000000000000000000000000
--- a/sm/apps/ld_exp_tro1.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include <string.h>
-#include <gsl/gsl_rng.h>
-#include <gsl/gsl_randist.h>
-#include <gsl/gsl_math.h>
-#include <math.h>
-#include <options/options.h>
-
-#include "../csm/csm_all.h"
-
-struct ld_exp_tro1_params {
-	int seed;
-
-	double max_xy_error;
-	double max_theta_error_deg;
-	
-	const char* file_input;
-	const char* file_output1;
-	const char* file_output2;
-	
-	int num_per_scan;
-	
-	int debug;
-};
-
-const char * banner = 
-	"This program prepares the data for one of the experiments. \n\n"
-		"The input is any sensor log (Carmen or JSON format) \n"
-		"The output are two files that contain laser_ref and laser_sens\n"
-		"(you have to match the i-th scan in the first file with the i-th\n"
-		" in the second).\n\n"
-		"The two files contain exactly the same date but for the 'odometry' field\n"
-		"The odometry error is uniform in the intervals given.\n";
-
-int main(int argc, const char ** argv) {
-	sm_set_program_name(argv[0]);
-	
-	struct ld_exp_tro1_params p;
-	
-	options_banner(banner);
-	
-	struct option* ops = options_allocate(10);
-	options_double(ops, "max_xy_error", &p.max_xy_error, 10.0, "Maximum error for x,y (m)");
-	options_double(ops, "max_theta_error_deg", &p.max_theta_error_deg, 10.0, "Maximum error for orientation (deg)");
-	options_int   (ops, "seed", &p.seed, 0, "Seed for random number generator (if 0, use GSL_RNG_SEED env. variable).");
-
-	options_int(ops, "num_per_scan", &p.num_per_scan, 10, "Number of trials for each scan.");
-
-	options_string(ops, "in", &p.file_input, "stdin", "Input file ");
-	options_string(ops, "out1", &p.file_output1, "stdout", "Output file for first scan");
-	options_string(ops, "out2", &p.file_output2, "stdout", "Output file for second scan");
-	
-	options_int(ops, "debug", &p.debug, 0, "Shows debug information");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	sm_debug_write(p.debug);
-
-	gsl_rng_env_setup();
-	gsl_rng * rng = gsl_rng_alloc (gsl_rng_ranlxs0);
-	if(p.seed != 0)
-	gsl_rng_set(rng, (unsigned int) p.seed);
-	
-	/* Open the two output files (possibly the same one) */
-	
-	FILE * in = open_file_for_reading(p.file_input);
-	if(!in) return -3;
-
-	FILE * out1 = open_file_for_writing(p.file_output1);
-	if(!out1) return -2;
-	
-	FILE * out2;
-	if(!strcmp(p.file_output1, p.file_output2)) {
-		out1 = out2;
-	} else {
-		out2 = open_file_for_writing(p.file_output2);
-		if(!out2) return -2;
-	}
-
-	/* Read laser data from input file */
-	LDP ld; int count=0;
-	while( (ld = ld_read_smart(in))) {
-		count++;
-		if(!ld_valid_fields(ld))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			continue;
-		}
-		
-		for(int n=0; n < p.num_per_scan; n++) {					
-			ld->true_pose[0] = 0;
-			ld->true_pose[1] = 0;
-			ld->true_pose[2] = 0;
-			
-			ld->odometry[0] = 0;
-			ld->odometry[1] = 0;
-			ld->odometry[2] = 0;
-			
-			ld_write_as_json(ld, out1);
-
-			ld->odometry[0] = 2*(gsl_rng_uniform(rng)-0.5) * p.max_xy_error;
-			ld->odometry[1] = 2*(gsl_rng_uniform(rng)-0.5) * p.max_xy_error;
-			ld->odometry[2] = 2*(gsl_rng_uniform(rng)-0.5) * deg2rad(p.max_theta_error_deg);
-			
-			ld_write_as_json(ld, out2);
-		}
-
-		ld_free(ld);
-	}
-	
-	return 0;
-}
diff --git a/sm/apps/ld_fisher.c b/sm/apps/ld_fisher.c
deleted file mode 100644
index 4d9f00ca9e2d474825f3b8330371a300695dc450..0000000000000000000000000000000000000000
--- a/sm/apps/ld_fisher.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <libgen.h>
-#include <math.h>
-
-#include <options/options.h>
-#include "../csm/csm_all.h"
-
-
-struct ld_fisher_params {
-	double sigma;
-};
-
-val ld_fisher0(LDP ld);
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	struct ld_fisher_params p;
-	
-	struct option* ops = options_allocate(3);
-	options_double(ops, "sigma", &p.sigma, 0.01, 
-		"Std deviation of gaussian noise");
-		
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "Writes Fisher's information matrix.\n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-	egsl_push();
-
-	LDP ld;
-	while( (ld = ld_from_json_stream(stdin))) {
-		egsl_push();
-			val fisher = egsl_scale( square(p.sigma),  ld_fisher0(ld) );
-			
-			JO jo = matrix_to_json(egsl_gslm(fisher));
-			printf("%s\n", json_object_to_json_string(jo));
-			jo_free(jo);
-		egsl_pop();
-		ld_free(ld);
-	}
-
-	egsl_pop();
-	
-	return 0;
-}
diff --git a/sm/apps/ld_linearize.c b/sm/apps/ld_linearize.c
deleted file mode 100644
index a992107f65aaa83ad519b6ab9e0250a641aa7881..0000000000000000000000000000000000000000
--- a/sm/apps/ld_linearize.c
+++ /dev/null
@@ -1,94 +0,0 @@
-#include <options/options.h>
-#include "../csm/csm_all.h"
-
-void ld_linearize(LDP ld);
-double weighted_mean(double *x, double *weight, int n);
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	int errors = 0;
-	int count = -1;
-	LDP ld;
-	while( (ld = ld_read_smart(stdin)) ) {
-		count++;
-		if(!ld_valid_fields(ld))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			errors++;
-			continue;
-		}
-		
-		ld_linearize(ld);
-
-		ld_write_as_json(ld, stdout);
-
-		ld_free(ld);
-	}
-	
-	return errors;
-}
-
-double weighted_mean(double *x, double *weight, int n) {
-	double sum_weight = 0;
-	double sum_x = 0;
-	int i;
-	for(i=0;i<n;i++) {
-		sum_x += weight[i] * x[i];
-		sum_weight += weight[i];
-	}
-	return sum_x / sum_weight;
-}
-
-
-void ld_linearize(LDP ld) {
-	int i;
-	for(i=0;i<ld->nrays;i++) {
-		if(-1 == ld->cluster[i]) continue;
-		
-		int this_cluster = ld->cluster[i];
-		int indexes[ld->nrays];
-		int nindexes = 0;
-		
-		int j;
-		for(j=i;j<ld->nrays;j++)
-			if(ld->cluster[j]==this_cluster) 
-				indexes[nindexes++] = j;
-		
-		double alpha[nindexes];
-		double alpha_weight[nindexes];
-		for(j=0;j<nindexes;j++) { 
-			alpha[j] = ld->alpha[indexes[j]];
-			alpha_weight[j] = 1 / ld->cov_alpha[indexes[j]];
-		}
-	
-		double est_alpha = weighted_mean(alpha, alpha_weight, nindexes);
-	
-		double rho[nindexes];
-		double rho_weight[nindexes];
-		for(j=0;j<nindexes;j++) { 
-			int i = indexes[j];
-			double theta = ld->theta[i];
-			double x = cos(theta)  * ld->readings[i];
-			double y = sin(theta)  * ld->readings[i];
-			rho[j] = cos(est_alpha) * x + sin(est_alpha) * y;
-			rho_weight[j] = 1 / ( cos(est_alpha) * cos(theta) 
-				+ sin(est_alpha) * sin(theta) );
-		}
-	
-		double est_rho = weighted_mean(rho, rho_weight, nindexes);
-	
-		for(j=0;j<nindexes;j++) { 
-			int i = indexes[j];
-			double theta = ld->theta[i];
-			ld->readings[i] = est_rho / (cos(est_alpha) * cos(theta) 
-				+ sin(est_alpha) * sin(theta));
-		}
-	
-		i = indexes[nindexes-1];
-	}
-	
-}
-
-
-
-
diff --git a/sm/apps/ld_noise.c b/sm/apps/ld_noise.c
deleted file mode 100644
index 9bc41814e0b11f35ade86ebfb0c04c0fcd451857..0000000000000000000000000000000000000000
--- a/sm/apps/ld_noise.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include <gsl/gsl_rng.h>
-#include <gsl/gsl_randist.h>
-
-#include <math.h>
-#include <libgen.h>
-
-#include <options/options.h>
-#include "../csm/csm_all.h"
-
-struct ld_noise_params {
-	int seed;
-	double discretization;
-	double sigma;
-	const char* file_input;
-	const char* file_output;
-	int lambertian;
-};
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	options_banner("ld_noise: Adds noise to readings in a scan");
-	
-	struct ld_noise_params p;
-	
-	struct option* ops = options_allocate(20);
-	options_double(ops, "discretization", &p.discretization, 0.0, 
-		"Size of discretization (disabled if 0)");
-	options_double(ops, "sigma", &p.sigma, 0.0, 
-		"Std deviation of gaussian noise (disabled if 0)");
-	options_int(ops, "lambertian", &p.lambertian, 0, 
-		"Use lambertian model cov = sigma^2 / cos(beta^2) where beta is the incidence. Need have alpha or true_alpha.");
-	options_int(ops, "seed", &p.seed, 0, 
-		"Seed for random number generator (if 0, use GSL_RNG_SEED env. variable).");
-	options_string(ops, "in", &p.file_input, "stdin", "Input file ");
-	options_string(ops, "out", &p.file_output, "stdout", "Output file ");
-		
-		
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "A simple program for adding noise to sensor scans.\n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-	FILE * in = open_file_for_reading(p.file_input);
-	if(!in) return -3;
-
-	FILE * out = open_file_for_writing(p.file_output);
-	if(!out) return -2;
-
-
-	gsl_rng_env_setup();
-	gsl_rng * rng = gsl_rng_alloc (gsl_rng_ranlxs0);
-	if(p.seed != 0)
-	gsl_rng_set(rng, (unsigned int) p.seed);
-
-	LDP ld; int count = 0;
-	while( (ld = ld_from_json_stream(in))) {
-		if(!ld_valid_fields(ld))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			continue;
-		}
-		
-		int i;
-		for(i=0;i<ld->nrays;i++) {
-			if(!ld->valid[i]) continue;
-			
-			double * reading = ld->readings + i;
-			if(p.sigma > 0) {
-				double add_sigma = p.sigma;
-				
-				if(p.lambertian) {
-
-					int have_alpha = 0;
-					double alpha = 0;
-					if(!is_nan(ld->true_alpha[i])) {
-						alpha = ld->true_alpha[i];
-						have_alpha = 1;
-					} else if(ld->alpha_valid[i]) {
-						alpha = ld->alpha[i];;
-						have_alpha = 1;
-					} else have_alpha = 0;
-
-					if(have_alpha) {
-						/* Recall that alpha points outside the surface */
-						double beta = (alpha+M_PI) - ld->theta[i];
-					    add_sigma = p.sigma / cos(beta);
-					} else {
-						sm_error("Because lambertian is active, I need either true_alpha[] or alpha[]");
-						ld_write_as_json(ld, stderr);
-						return -1;
-					}
-					
-				} 
-				
-			   *reading += gsl_ran_gaussian(rng, add_sigma);
-				
-				if(is_nan(ld->readings_sigma[i])) {
-					ld->readings_sigma[i] = add_sigma;
-				} else {
-					ld->readings_sigma[i] = sqrt(square(add_sigma) + square(ld->readings_sigma[i]));
-				}
-			}
-			if(p.discretization > 0)
-				*reading -= fmod(*reading , p.discretization);
-		}
-	
-		ld_write_as_json(ld, out);
-		ld_free(ld);
-	}
-	
-	return 0;
-}
diff --git a/sm/apps/ld_purify.c b/sm/apps/ld_purify.c
deleted file mode 100644
index 53de4558288e615e087b1087586c97baf891e41d..0000000000000000000000000000000000000000
--- a/sm/apps/ld_purify.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include <gsl/gsl_rng.h>
-#include <gsl/gsl_randist.h>
-
-#include <math.h>
-#include <libgen.h>
-
-#include <options/options.h>
-#include "../csm/csm_all.h"
-
-void purify(LDP ld, double threshold_min, double threshold_max);
-
-
-struct ld_purify_params {
-	double threshold_min, threshold_max;
-	const char* file_input;
-	const char* file_output;
-};
-
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	
-	options_banner("ld_purify: Makes sure that the file format is valid. \n * Sets valid=0 if reading is outside interval ");
-	
-	struct ld_purify_params p;
-	
-	struct option* ops = options_allocate(20);
-	options_double(ops, "threshold_min", &p.threshold_min, 0.01, 
-		"Sets valid=0 if readings are less than this threshold.");
-	options_double(ops, "threshold_max", &p.threshold_max, 79.0, 
-		"Sets valid=0 if readings are more than this threshold.");
-	
-	options_string(ops, "in", &p.file_input, "stdin", "Input file ");
-	options_string(ops, "out", &p.file_output, "stdout", "Output file ");
-		
-		
-	if(!options_parse_args(ops, argc, argv)) {
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-	FILE * in = open_file_for_reading(p.file_input);
-	if(!in) return -3;
-
-	FILE * out = open_file_for_writing(p.file_output);
-	if(!out) return -2;
-
-
-
-	LDP ld; int count = -1;
-	while( (ld = ld_from_json_stream(in))) {
-		
-		purify(ld, p.threshold_min, p.threshold_max);
-		
-		if(!ld_valid_fields(ld))  {
-			sm_error("Wait, we didn't purify enough  (#%d in file)\n", count);
-			continue;
-		}
-		
-		ld_write_as_json(ld, out);
-		ld_free(ld);
-	}
-	
-	return 0;
-}
-
-
-
-void purify(LDP ld, double threshold_min, double threshold_max) {
-	for(int i=0;i<ld->nrays;i++) {
-		if(!ld->valid[i]) continue;
-		
-		double rho = ld->readings[i];
-		if( is_nan(rho) | (rho < threshold_min) | (rho > threshold_max) ) {
-			ld->readings[i] = GSL_NAN;
-			ld->valid[i] = 0;
-			ld->alpha[i] = GSL_NAN;
-			ld->alpha_valid[i] = 0;
-		}
-		
-	}
-	
-}
-
-
-
diff --git a/sm/apps/ld_recover.c b/sm/apps/ld_recover.c
deleted file mode 100644
index 89f4e40b35b4025651f22d0c0f6b41feb1bfd6e5..0000000000000000000000000000000000000000
--- a/sm/apps/ld_recover.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#include <math.h>
-#include <options/options.h>
-
-#include "../csm/csm_all.h"
-#include "../csm/laser_data_drawing.h"
-
-/** Two scans are the same if they have the same timestamp. */
-int same_scan(LDP ld1, LDP ld2);
-/** Short description for a scan. */
-const char * short_desc(LDP ld);
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-
-	const char *in_filename;
-	const char *ref_filename;
-	const char *out_filename;
-	const char *ref_field_string; ld_reference ref_field;
-	const char *out_field_string; ld_reference out_field;
-
-	struct option* ops = options_allocate(15);
-	options_string(ops, "in", &in_filename, "stdin", "scan matching log");
-	options_string(ops, "ref", &ref_filename, "ref.log", "slam log");
-	options_string(ops, "out", &out_filename, "stdout", "output file");
-
-	options_string(ops, "ref_field", &ref_field_string, "estimate", "What field to find in ref.");
-	options_string(ops, "out_field", &out_field_string, "true_pose", "What field to copy to.");
-		
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, " This program works on two logs: A and B. "
-		"For each scan in A, the program searches for the scan in B having the same timestamp. "
-		"Then, the true_pose field in B is copied to the scan form A, and it is written to the output.\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	ref_field = ld_string_to_reference(ref_field_string);
-	out_field = ld_string_to_reference(out_field_string);
-	
-	
-	FILE * in_stream  = open_file_for_reading(in_filename);
-	FILE * ref_stream = open_file_for_reading(ref_filename);
-	FILE * out_stream = open_file_for_writing(out_filename);
-	
-	if(!in_stream || !ref_stream || !out_stream) return -1;
-
-	LDP ld_in;
-	while((ld_in = ld_read_smart(in_stream))) {
-		int matched = 0;
-		while(1) {
-			LDP ld_ref = ld_read_smart(ref_stream);
-			if(!ld_ref) break;
-			if(same_scan(ld_in, ld_ref)) {
-				matched = 1;
-				const double *ref_pose = ld_get_reference_pose(ld_ref, ref_field);
-				double *out_pose = ld_get_reference_pose_silent(ld_in, out_field);
-				copy_d(ref_pose, 3, out_pose);
-				ld_write_as_json(ld_in, out_stream);
-				fputs("\n", out_stream);
-				break;
-			}
-			ld_free(ld_ref);
-		}
-
-		if(!matched) {
-			sm_error("Could not match %s. \n", short_desc(ld_in));
-			if(feof(ref_stream)) {
-				sm_error("..because ref stream has ended.\n");
-				break;
-			}
-			continue;
-		}
-	
-		ld_free(ld_in);
-	}
-	
-	return 0;
-}
-
-
-/** Two scans are the same if they have the same timestamp. */
-int same_scan(LDP ld1, LDP ld2) {
-	return (ld1->tv.tv_sec == ld2->tv.tv_sec) && 
-		(ld1->tv.tv_usec == ld2->tv.tv_usec);
-}
-
-char buf[100];
-const char * short_desc(LDP ld) {
-	sprintf(buf, "LD, tv=%d,%d", (int) ld->tv.tv_sec, (int) ld->tv.tv_usec);
-	return buf;
-}
-
diff --git a/sm/apps/ld_remove_doubles.c b/sm/apps/ld_remove_doubles.c
deleted file mode 100644
index 73d594fd76c0ed56ed800675b009965e659bcf78..0000000000000000000000000000000000000000
--- a/sm/apps/ld_remove_doubles.c
+++ /dev/null
@@ -1,86 +0,0 @@
-#include <time.h>
-
-#include <options/options.h>
-
-#include "../csm/csm_all.h"
-
-int ld_equal_readings(LDP ld1, LDP ld2, double epsilon);
-
-int main(int argc, const char*argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	double epsilon;
-	int debug;
-	
-	
-	struct option* ops = options_allocate(3);
-	options_double(ops, "epsilon", &epsilon, 0.0001, "minimum difference between rays to be used");
-	
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	sm_debug_write(debug);
-	
-	
-	/* Read first scan */
-	LDP laser_ref=0, laser_sens;
-		
-	int count = -1;	
-	int num_discarded = 0;
-	int num_invalid = 0;
-	int ref_index = 0;
-	
-	while( (laser_sens = ld_read_smart(stdin)) ) {
-		count++;
-		
-		if(!ld_valid_fields(laser_sens))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			num_invalid++;
-			continue;
-		}
-		
-		if(!laser_ref) { 
-			laser_ref = laser_sens; 
-			ld_write_as_json(laser_sens, stdout);
-			count++;
-			continue;
-		}
-		
-		if(ld_equal_readings(laser_ref, laser_sens, epsilon)) {
-			sm_debug("Ignoring scan #%d, too similar to #%d.\n", count, ref_index);
-			num_discarded++;
-		} else {
-			ld_write_as_json(laser_sens, stdout);
-			ld_free(laser_ref); 
-			laser_ref = laser_sens;
-			ref_index = count;
-		}
-		
-	}
-	if(laser_ref) ld_free(laser_ref);
-	
-	sm_info("#   epsilon: %f m\n", epsilon);
-	sm_info("#     scans: %d\n", count);
-	if(count>0) {
-		sm_info("#   invalid: %d\n", num_invalid);
-		sm_info("# discarded: %d (%d%%)\n", num_discarded, num_discarded * 100 / count);
-	}
-
-	return num_invalid;
-}
-
-
-
-int ld_equal_readings(LDP ld1, LDP ld2, double epsilon) {
-	int i;
-	for(i=0;i<ld1->nrays;i++) {
-		if(!ld_valid_ray(ld1,i) || !ld_valid_ray(ld2,i)) continue;
-		
-		if(fabs(ld1->readings[i]-ld2->readings[i]) > epsilon)
-			return 0;
-	}
-	return 1;
-}
diff --git a/sm/apps/ld_resample.c b/sm/apps/ld_resample.c
deleted file mode 100644
index 95b86206ca7df7d00c266fc3c26aacd327297237..0000000000000000000000000000000000000000
--- a/sm/apps/ld_resample.c
+++ /dev/null
@@ -1,103 +0,0 @@
-#include <gsl/gsl_rng.h>
-#include <gsl/gsl_randist.h>
-#include <gsl/gsl_math.h>
-
-#include <math.h>
-#include <options/options.h>
-
-
-#include "../csm/csm_all.h"
-
-struct {
-	double interval;
-	int seed;
-}p ;
-
-LDP ld_resample(LDP ld);
-
-gsl_rng * rng;
-
-int main(int argc, const char ** argv) {
-	sm_set_program_name(argv[0]);
-	
-	
-	struct option* ops = options_allocate(3);
-	options_double(ops, "interval", &p.interval, sqrt(2.0), " 1 = no resampling");
-		
-	if(!options_parse_args(ops, argc, argv)) {
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-	int count = -1;
-	LDP ld;
-	while( (ld = ld_read_smart(stdin))) {
-		count++;
-		
-		if(!ld_valid_fields(ld))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			continue;
-		}
-		
-/*		if(count & 1) {*/
-			LDP ld2 = ld_resample(ld);
-			ld_write_as_json(ld2, stdout);
-			ld_free(ld2);
-			ld_free(ld);
-/*		} else {
-			ld_write_as_json(ld, stdout);
-			ld_free(ld);
-		}*/
-
-		count++;
-	}
-	
-	return 0;
-}
-
-LDP ld_resample(LDP ld) {
-	/* FIXME magic number */
-	int n = (int) (floor(ld->nrays / p.interval));
-	
-	LDP ld2 = ld_alloc_new(n);	
-	int k;
-	for(k=0;k<n;k++) {
-		double index = k * p.interval;
-		int i = (int) floor(index);
-		int j = i + 1;
-		double a = 1 - (index - i);
-	
-		
-		if(  (j>= ld->nrays) || !ld->valid[i] || !ld->valid[j]) {
-			ld2->valid[k] = 0;
-			ld2->readings[k] = NAN;
-			ld2->alpha_valid[k] = 0;
-			ld2->alpha[k] = NAN;
-			ld2->theta[k] = ld->theta[i];
-		} else {
-			ld2->theta[k] = a * ld->theta[i] + (1-a) * ld->theta[j];
-			
-	
-			if(is_nan(ld2->theta[k])) {
-				sm_debug("Hey, k=%d theta[%d]=%f theta[%d]=%f\n",
-					k,i,ld->theta[i],j,ld->theta[j]);
-			}
-
-			ld2->readings[k] = a * ld->readings[i] + (1-a) * ld->readings[j];
-			ld2->valid[k] = 1;
-		}
-		
-/*		sm_debug("k=%d index=%f i=%d a=%f valid %d reading %f\n", k,index,i,a,ld2->valid[k],ld2->readings[k]);*/
-	}
-	
-	ld2->min_theta = ld2->theta[0];
-	ld2->max_theta = ld2->theta[n-1];
-	ld2->tv = ld->tv;
-
-	copy_d(ld->odometry, 3, ld2->odometry);
-	copy_d(ld->estimate, 3, ld2->estimate);
-	
-	
-	return ld2;
-}
-
diff --git a/sm/apps/ld_select.c b/sm/apps/ld_select.c
deleted file mode 100644
index bf6b9fa3d61cf2405709845ce985c8ef7d3d637c..0000000000000000000000000000000000000000
--- a/sm/apps/ld_select.c
+++ /dev/null
@@ -1,4 +0,0 @@
-
-int main() {
-	
-}
diff --git a/sm/apps/ld_slip.c b/sm/apps/ld_slip.c
deleted file mode 100644
index 4b834823c60656a0dccba439a39335cdbe8e0458..0000000000000000000000000000000000000000
--- a/sm/apps/ld_slip.c
+++ /dev/null
@@ -1,105 +0,0 @@
-#include <gsl/gsl_rng.h>
-#include <gsl/gsl_randist.h>
-#include <gsl/gsl_math.h>
-
-#include <math.h>
-#include <options/options.h>
-
-#include "../csm/csm_all.h"
-
-struct ld_noise_params {
-	int seed;
-
-	double sigma_xy;
-	double sigma_theta_deg;
-	
-	const char* file_input;
-	const char* file_output;
-	
-	int debug;
-};
-
-const char * banner = 
-	"A simple program for adding slip to odometry \n\n"
-		"The 'odometry' field is set to 'true_pose' + noise.\n"
-		"If 'true_pose' is not available, then the 'odometry' \n"
-		"field is set to 'odometry' + noise.\n\n"
-		"Note: this program does *not* simulate the effect of \n"
-		"slip or odometry error in a realistic way; each scan \n"
-		"in the file is considered separately, the error does \n"
-		"not depend on the traveled distance, etc.\n\n";
-
-int main(int argc, const char ** argv) {
-	sm_set_program_name(argv[0]);
-	
-	struct ld_noise_params p;
-	
-	options_banner(banner);
-	
-	struct option* ops = options_allocate(10);
-	options_double(ops, "sigma_theta_deg", &p.sigma_theta_deg, 0.0, 
-		"Std deviation of gaussian noise for theta (deg) (disabled if 0)");
-	options_double(ops, "sigma_xy", &p.sigma_xy, 0.0, 
-		"Std deviation of gaussian noise for x,y (disabled if 0)");
-	options_int(ops, "seed", &p.seed, 0, 
-		"Seed for random number generator (if 0, use GSL_RNG_SEED env. variable).");
-	options_string(ops, "in", &p.file_input, "stdin", "Input file ");
-	options_string(ops, "out", &p.file_output, "stdout", "Output file ");
-
-	options_int(ops, "debug", &p.debug, 0, "Shows debug information");
-	
-		
-	if(!options_parse_args(ops, argc, argv)) {
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	sm_debug_write(p.debug);
-
-	gsl_rng_env_setup();
-	gsl_rng * rng = gsl_rng_alloc (gsl_rng_ranlxs0);
-	if(p.seed != 0)
-	gsl_rng_set(rng, (unsigned int) p.seed);
-	
-	
-	FILE * in = open_file_for_reading(p.file_input);
-	if(!in) return -3;
-
-	FILE * out = open_file_for_writing(p.file_output);
-	if(!out) return -2;
-
-	LDP ld; int count=0;
-	while( (ld = ld_read_smart(in))) {
-		count++;
-		if(!ld_valid_fields(ld))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			continue;
-		}
-		
-		if(!any_nan(ld->true_pose, 3))
-			copy_d( (const double*) ld->true_pose, 3, ld->odometry);
-		
-		double e[3] = {0,0,0};
-		
-		if(p.sigma_xy > 0) {
-			e[0]  = gsl_ran_gaussian(rng, p.sigma_xy);
-			e[1]  = gsl_ran_gaussian(rng, p.sigma_xy);
-		}
-
-		if(p.sigma_theta_deg > 0) {
-			e[2] = gsl_ran_gaussian(rng, deg2rad(p.sigma_theta_deg));
-		}
-		
-		ld->odometry[0] += e[0];
-		ld->odometry[1] += e[1];
-		ld->odometry[2] += e[2];
-	
-		sm_debug("Adding noise %s.\n", friendly_pose(e));
-		
-		ld_write_as_json(ld, out);
-		
-		ld_free(ld);
-	}
-	
-	return 0;
-}
diff --git a/sm/apps/ld_smooth.c b/sm/apps/ld_smooth.c
deleted file mode 100644
index 348a7af4190649efa77f6829d63caf8d550b1efc..0000000000000000000000000000000000000000
--- a/sm/apps/ld_smooth.c
+++ /dev/null
@@ -1,103 +0,0 @@
-#include <options/options.h>
-
-#include "../csm/csm_all.h"
-
-struct {
-	/** Scale factor */
-	double scale_deg; 
-	
-	/** How many neighbours to consider */
-	int neighbours;
-} p;
-
-void ld_smooth(LDP ld, int neighbours, double scale_rad);
-void convolve(const int*valid,const double*original, int n, double*dest, double*filter, int filter_len);
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	struct option* ops = options_allocate(3);
-	options_double(ops, "scale_deg", &p.scale_deg, 0.0, "Scale factor (degrees) ");
-	options_int(ops, "neighbours", &p.neighbours, 1, "How many neighbours to consider (regardless of scale).");
-		
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "A simple program for smoothing a sensor scan.\n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-	int errors = 0;
-	int count = -1;
-	LDP ld;
-	while( (ld = ld_read_smart(stdin)) ) {
-		count++;
-		if(!ld_valid_fields(ld))  {
-			sm_error("Invalid laser data (#%d in file)\n", count);
-			errors++;
-			continue;
-		}
-		
-		ld_smooth(ld, p.neighbours, deg2rad(p.scale_deg) );
-
-		ld_write_as_json(ld, stdout);
-
-		ld_free(ld);
-	}
-	
-	return errors;
-}
-
-void convolve(const int*valid,const double*original, int n, double*dest, double*filter, int filter_len) 
-{
-	int i; /* index on the points */
-	int j; /* index on the filter */
-	
-	for(i=0;i<n;i++) {
-		if(!valid[i]) {
-			dest[i] = GSL_NAN;
-			continue;
-		}
-		
-		dest[i] = 0;
-		for(j=-(filter_len-1);j<=(filter_len-1);j++) {
-			int i2 = i + j;
-			if(i2<0) i2=0; if(i2>=n) i2=n-1;
-			if(!valid[i2]) i2 = i; 
-			dest[i] += original[i2] * filter[abs(j)];
-		}
-	}
-}
-
-void ld_smooth(LDP ld, int neighbours, double scale_rad) {
-	int len = neighbours + 1;
-	double filter[len];
-	int j;
-	static int once = 1;
-	for(j=0;j<len;j++) {
-		double dist_rad = j * ((ld->max_theta-ld->min_theta)/ld->nrays);
-		double mahal = square(dist_rad / scale_rad);
-		filter[j] = exp(-mahal);
-
-		if(once) 
-			sm_info("filter[%d] = %f mahal = %f dist_rad = %f scale_rad = %f \n", j, filter[j], mahal, dist_rad, scale_rad);
-		
-	}
-	
-	once = 0;
-	
-	/* find total filter */
-	double filter_tot = filter[0];
-	for(j=1;j<len;j++) filter_tot+=filter[j];
-	/* and normalize */
-	for(j=0;j<len;j++) filter[j]/=filter_tot;
-
-	double new_readings[ld->nrays];
-	convolve(ld->valid, ld->readings, ld->nrays, new_readings, filter, len);
-	copy_d(new_readings, ld->nrays,  ld->readings);
-
-	for(j=0;j<len;j++) {
-		
-	}
-}
-
-
diff --git a/sm/apps/ld_stats.c b/sm/apps/ld_stats.c
deleted file mode 100644
index e9979f0850f3f7eafa982c1fbb46bc5ea9f58750..0000000000000000000000000000000000000000
--- a/sm/apps/ld_stats.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include <options/options.h>
-
-#include <csm/csm_all.h>
-
-int main(int argc, const char * argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	const char*input_filename;
-	const char*output_filename;
-	double max_xy;
-	double max_theta_deg;
-	
-	struct option* ops = options_allocate(10);
-	options_string(ops, "in", &input_filename, "stdin", "input file (log)");
-	options_string(ops, "out", &output_filename, "stdout", "output file ");
-	options_double(ops, "max_xy", &max_xy, 100.0, "Max admissible xy displacement");
-	options_double(ops, "max_theta_deg", &max_theta_deg, 360.0, 
-		"Max admissible theta displacement (deg)");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		sm_info("computes odometry statistics.\n\nOptions:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	FILE * input_stream = open_file_for_reading(input_filename);
-	FILE *output_stream = open_file_for_writing(output_filename);
-	
-	if(!input_stream || !output_stream) return -1;
-	
-	LDP laser_ref = ld_read_smart(input_stream);
-	if(!laser_ref) {
-		sm_error("Cannot read first scan.\n.");
-		return -2;
-	}
-
-	int count = 0, valid = 0;
-	LDP laser_sens;
-	
-	double avg_correction[3] = {0,0,0};
-	double max_correction[3] = {0,0,0};
-	while((laser_sens = ld_read_smart(input_stream))) {
-		double diff_true_pose[3], diff_odometry[3], diff_estimate[3];
-		pose_diff_d(laser_sens->odometry, laser_ref->odometry, diff_odometry);
-		pose_diff_d(laser_sens->true_pose, laser_ref->true_pose, diff_true_pose);
-		pose_diff_d(laser_sens->estimate, laser_ref->estimate, diff_estimate);
-		double diff[3];
-		pose_diff_d(diff_estimate, diff_odometry, diff);
-		
-		JO jo = jo_new();
-		jo_add_double_array(jo, "diff_odometry", diff_odometry, 3);
-		jo_add_double_array(jo, "diff_true_pose", diff_true_pose, 3);
-		jo_add_double_array(jo, "diff_estimate", diff_estimate, 3);
-		jo_add_double_array(jo, "correction", diff, 3);
-		
-		fputs(jo_to_string(jo), output_stream);
-		fputs("\n", output_stream);
-		jo_free(jo);
-		ld_free(laser_ref);
-		laser_ref = laser_sens;
-		
-		int use_it = (fabs(diff[0]) < max_xy) && (fabs(diff[1]) < max_xy) &&
-			(fabs(diff[2]) < deg2rad(max_theta_deg));
-			
-		if(use_it) {
-			int i; for(i=0;i<3;i++) {
-				avg_correction[i] += diff[i];
-				max_correction[i] = GSL_MAX(max_correction[i], fabs(diff[i]));
-			}
-			valid ++;
-		}
-		
-		count ++;
-	}
-
-	int i; for(i=0;i<3;i++) 
-		avg_correction[i] /= valid;
-		
-	fprintf(stderr, "Used %d/%d  rays (%.1f %%)\n", valid, count, (100.0 *valid)/count);
-	
-	fprintf(stderr, "Avg: %f %f %f      = %fdeg \n",
-		avg_correction[0], avg_correction[1], avg_correction[2], rad2deg(avg_correction[2]));
-	fprintf(stderr, "Max: %f %f %f      = %fdeg \n",
-		max_correction[0], max_correction[1], max_correction[2], rad2deg(max_correction[2]));
-		
-	return 0;
-}
diff --git a/sm/apps/log2pdf.c b/sm/apps/log2pdf.c
deleted file mode 100644
index c5ce4548d8710e4d2d3edea724214ecd188a8e6d..0000000000000000000000000000000000000000
--- a/sm/apps/log2pdf.c
+++ /dev/null
@@ -1,196 +0,0 @@
-#include <time.h>
-#include <string.h>
-
-
-#ifdef LINUX
-#include <linux/limits.h>
-#endif
-
-#include <cairo.h>
-#include <cairo-pdf.h>
-
-#include <options/options.h>
-
-#include "../csm/csm_all.h"
-#include "../csm/laser_data_drawing.h"
-#include "../csm/laser_data_cairo.h"
-
-
-typedef struct {
-	const char*use;
-	double padding;
-	double dimension;
-	
-	int draw_confidence;
-	double confidence_mult;
-	
-	const char*output_filename;
-	const char*input_filename;
-
-	ld_reference use_reference;
-
-	double offset_theta_deg;
-	
-	/* Drawing style for scans */
-	ld_style laser;
-	/* Drawing style for robot path */
-	line_style pose_path;
-	double start_pose_width;
-	
-	double distance_xy, distance_th_deg;
-} log2pdf_params;
-
-int log2pdf(log2pdf_params *p);
-
-double offset_theta = 0;
-
-const char* banner = 
-	"This program draws laser scans.\n"
-	"\n"
-	"IMPORTANT: it is likely you have to set one or more parameters. \n"
-	"           the default parameters are OK to draw very long laser logs\n\n";
-	
-int main(int argc, const char* argv[]) {
-	sm_set_program_name(argv[0]);
-
-	log2pdf_params p;
-	
-	lds_set_defaults(&(p.laser));
-	ls_set_defaults(&(p.pose_path));
-	
-	p.laser.rays.draw = 0;
-	p.laser.points.draw = 0;
-	p.laser.normals.draw = 0;
-	p.laser.countour.width = 0.1;
-	p.pose_path.width = 0.1;
-	p.pose_path.color = "#f00";
-	
-	options_banner(banner);
-	struct option * ops = options_allocate(100);
-	options_string(ops, "in", &p.input_filename, "stdin", "input file (Carmen or JSON)");
-	options_string(ops, "out", &p.output_filename, "", "output file (if empty, input file + '.pdf')");
-	options_double(ops, "padding", &p.padding, 0.2, "padding around bounding box (m)");
-	options_double(ops, "dimension", &p.dimension, 500.0, "dimension of the image (points)");
-	options_double(ops, "offset_theta_deg", &p.offset_theta_deg, 0.0, " rotate entire map by this angle (deg) ");
-
-	options_string(ops, "use", &p.use, "estimate", "One in 'odometry','estimate','true_pose'");
-	options_double(ops, "distance_xy", &p.distance_xy, 5.0, " Minimum distance between scans (m) ");
-	options_double(ops, "distance_th_deg", &p.distance_th_deg, 45.0, " Minimum distance between scans (deg) ");
-	options_double(ops, "start_pose_width", &p.start_pose_width, 0.4, "First pose | Circle width");
-	lds_add_options(&(p.laser), ops, "laser_", "");
-	ls_add_options(&(p.pose_path), ops, "path_", "");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		sm_error("Could not parse arguments.\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	/* If out not specified */
-	if(strlen(p.output_filename)==0) {
-		char buf[PATH_MAX];
-		sprintf(buf, "%s.pdf", p.input_filename);
-		p.output_filename = my_strdup(buf);
-/*		sm_info("Writing on file '%s'.\n", p.output_filename);*/
-	}
-	
-	p.use_reference = ld_string_to_reference(p.use);
-	if(Invalid == p.use_reference) {
-		sm_error("Invalid reference '%s'. " 
-			"Use one in 'odometry','estimate','true_pose'.\n", p.use);
-		return -1;
-	}
-/*	sm_info("Using reference: %s.\n", ld_reference_to_string(p.use_reference));*/
-	
-	return !log2pdf(&p);
-}
-
-
-int log2pdf(log2pdf_params *p) {
-
-	/** First of all, we read the entire map into memory */
-	FILE *input_file = open_file_for_reading(p->input_filename);
-	if(!input_file) return 0;
-	
-	LDP*scans; int nscans;
-	
-	if(!ld_read_some_scans_distance(input_file,  &scans, &nscans,
-		 p->use_reference, p->distance_xy, deg2rad(p->distance_th_deg) ) ){
-		sm_error("Could not read map from file '%s'.\n", p->input_filename); 
-		return 0;
-	}
-	
-	if(nscans == 0) {
-		sm_error("I could not read any scan from file '%s'.\n", p->input_filename);
-		return 0;
-	}
-	
-	sm_debug("Read map: %d scans in total.\n", nscans);
-
-	/** Let's find the bounding box for the map */
-	double bb_min[2], bb_max[2];
-	double offset[3] = {0,0,0};
-	lda_get_bounding_box(scans, nscans, bb_min, bb_max, offset, p->use_reference, p->laser.horizon);
-	
-	bb_min[0] -= p->padding;
-	bb_min[1] -= p->padding;
-	bb_max[0] += p->padding;
-	bb_max[1] += p->padding;
-	
-
-	sm_debug("Bounding box: %f %f -- %f %f.\n", bb_min[0], bb_min[1],
-		bb_max[0], bb_max[1]);
-
-		
-	/* Create PDF surface and setup paper size and transformations */
-	int max_width_points = p->dimension;
-	int max_height_points = p->dimension;
-	cairo_surface_t *surface;
-	cairo_t *cr;
-
-	if(!create_pdf_surface(p->output_filename, max_width_points, max_height_points, 
-		bb_min, bb_max, &surface, &cr)) return 0;
-
-	/* Draw pose path */
-	if(p->pose_path.draw) {
-		cairo_save(cr);
-		
-		cr_set_style(cr, &(p->pose_path));
-		cr_lda_draw_pose_path(cr, scans, nscans, p->use_reference);
-
-		if(nscans > 0 && p->laser.pose.draw) {
-			cairo_set_source_rgb(cr, 0.3, 0.0, 1.0);
-			double *pose0 = ld_get_reference_pose(scans[0], p->use_reference);
-			cairo_arc(cr, pose0[0], pose0[1], p->start_pose_width, 0.0, 2*M_PI);
-			cairo_fill(cr);
-		}
-
-		cairo_restore(cr);
-	}
-
-	/* Draw map */
-	int k; for(k=0;k<nscans;k++) {
-		LDP ld = scans[k];
-		double *pose = ld_get_reference_pose(ld, p->use_reference);
-		if(!pose) continue;
-		
-		double offset[3] = {0,0, deg2rad(p->offset_theta_deg) };
-		double world_pose[3];
-		oplus_d(offset, pose, world_pose);
-				
-		cairo_save(cr);
-		cr_set_reference(cr, world_pose);
-		cr_ld_draw(cr, ld, &(p->laser));
-		cairo_restore(cr);
-	}
-
-	cairo_show_page (cr);
-
-	cairo_destroy (cr);
-	cairo_surface_destroy (surface);
-	return 1;
-}
-
-
-
-
diff --git a/sm/apps/map/CMakeLists.txt b/sm/apps/map/CMakeLists.txt
deleted file mode 100644
index cde26000389d55bff913f4a732b3483e224603da..0000000000000000000000000000000000000000
--- a/sm/apps/map/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-cmake_minimum_required(VERSION 2.4)
-
-project(map)
-
-
-find_package(PkgConfig REQUIRED)
-pkg_check_modules(CSM REQUIRED csm)
-
-IF(${CSM_FOUND})
-	MESSAGE("CSM_LIBRARY_DIRS: ${CSM_LIBRARY_DIRS}")
-	MESSAGE("CSM_LIBRARIES: ${CSM_LIBRARIES}")
-	MESSAGE("CSM_INCLUDE_DIRS: ${CSM_INCLUDE_DIRS}")
-
-	INCLUDE_DIRECTORIES(${CSM_INCLUDE_DIRS})
-	LINK_DIRECTORIES(${CSM_LIBRARY_DIRS})
-
-ELSE(${CSM_FOUND})	
-	MESSAGE(FATAL_ERROR "CSM not found. Check that the environment variable PKG_CONFIG_PATH includes the path containing the file 'csm.pc'.")
-ENDIF(${CSM_FOUND})		
-
-
-
-set(map1_SRCS
-	map1.cpp
-)
-
-
-add_executable(map1 ${map1_SRCS})
-
-target_link_libraries(map1 ${CSM_LIBRARIES})
-
diff --git a/sm/apps/map/many_points.config b/sm/apps/map/many_points.config
deleted file mode 100644
index 1dbb2f29b91f0cf37803c05b80bbfd7c3a4482d4..0000000000000000000000000000000000000000
--- a/sm/apps/map/many_points.config
+++ /dev/null
@@ -1,9 +0,0 @@
-laser_countour_draw         1       
-laser_countour_width    0.002
-
-path_width 0.002
-
-distance_xy 0.05
-distance_th_deg 5
-
-laser_pose_draw 0
diff --git a/sm/apps/map/map1.cpp b/sm/apps/map/map1.cpp
deleted file mode 100644
index 9d52b2f134304a2cd8b31c734241de0b7cbe0086..0000000000000000000000000000000000000000
--- a/sm/apps/map/map1.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-#include <string.h>
-#include "pan.h"
-#include <options/options.h>
-
-struct myparams {
-	const char * file_in;
-	const char * file_out;
-	const char * file_out_stats;
-	const char * file_jj;
-	int format;
-	
-	/* which algorithm to run */
-	int algo;
-} p;
-
-extern "C" void sm_options(struct sm_params*p, struct option*ops);
-
-
-int main(int argc, const char*argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	struct sm_params params;
-	struct sm_result result;
-	
-	struct option* ops = options_allocate(100);
-	options_string(ops, "in", &p.file_in, "stdin", "Input file ");
-	options_string(ops, "out", &p.file_out, "stdout", "Output file ");
-	options_string(ops, "out_stats", &p.file_out_stats, "", "Output file (stats) ");
-	options_string(ops, "file_jj", &p.file_jj, "",
-		"File for journaling -- if left empty, journal not open.");
-	options_int(ops, "algo", &p.algo, 0, "Which algorithm to use (0:icp 1:gpm-stripped) ");
-	p.format = 0;
-/*	options_int(ops, "format", &p.format, 0,
-		"Output format (0: log in JSON format, 1: log in Carmen format (not implemented))");*/
-	
-	sm_options(&params, ops);
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "\n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-	/* Open input and output files */
-	
-	FILE * file_in = open_file_for_reading(p.file_in);
-	if(!file_in) return -1;
-	FILE * file_out = open_file_for_writing(p.file_out);
-	if(!file_out) return -1;
-	
-	if(strcmp(p.file_jj, "")) {
-		FILE * jj = open_file_for_writing(p.file_jj);
-		if(!jj) return -1;
-		jj_set_stream(jj);
-	}
-	
-	FILE * file_out_stats = 0;
-	if(strcmp(p.file_out_stats, "")) {
-		file_out_stats = open_file_for_writing(p.file_out_stats);
-		if(!file_out_stats) return -1;
-	}
-	
-	/* Read first scan */
-	LDP laser_ref;
-	if(!(laser_ref = ld_read_smart(file_in))) {
-		sm_error("Could not read first scan.\n");
-		return -1;
-	}
-	if(!ld_valid_fields(laser_ref))  {
-		sm_error("Invalid laser data in first scan.\n");
-		return -2;
-	}
-	
-	
-	/* For the first scan, set estimate = odometry */
-	copy_d(laser_ref->odometry, 3, laser_ref->estimate);
-	
-	ld_write_as_json(laser_ref, file_out);
-	int count=-1;
-	LDP laser_sens;
-	while( (laser_sens = ld_read_smart(file_in)) ) {
-		count++;
-		if(!ld_valid_fields(laser_sens))  {
-			sm_error("Invalid laser data in (#%d in file).\n", count);
-			return -(count+2);
-		}
-		
-		params.laser_ref  = laser_ref;
-		params.laser_sens = laser_sens;
-
-		/* Set first guess as the difference in odometry */
-		double odometry[3];
-		pose_diff_d(laser_sens->odometry, laser_ref->odometry, odometry);
-		double ominus_laser[3], temp[3];
-		ominus_d(params.laser, ominus_laser);
-		oplus_d(ominus_laser, odometry, temp);
-		oplus_d(temp, params.laser, params.first_guess);
-		
-		/* Do the actual work */
-		switch(p.algo) {
-			case(0):
-				sm_icp(&params, &result); break;
-			case(1):
-				sm_gpm(&params, &result); break;
-			default:
-				sm_error("Unknown algorithm to run: %d.\n",p.algo);
-				return -1;
-		}
-		
-		/* Add the result to the previous estimate */
-		oplus_d(laser_ref->estimate, result.x, laser_sens->estimate);
-
-		/* Write the corrected log */
-		ld_write_as_json(laser_sens, file_out);
-
-		/* Write the statistics (if required) */
-		if(file_out_stats) {
-			JO jo = result_to_json(&params, &result);
-			fputs(jo_to_string(jo), file_out_stats);
-			fputs("\n", file_out_stats);
-			jo_free(jo);
-		}
-
-		ld_free(laser_ref); laser_ref = laser_sens;
-	}
-	ld_free(laser_ref);
-	
-	return 0;
-}
diff --git a/sm/apps/map/pan.cpp b/sm/apps/map/pan.cpp
deleted file mode 100644
index a5a00a7beee9b3f1ab8055b6b4909cb8a5059c1c..0000000000000000000000000000000000000000
--- a/sm/apps/map/pan.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "pan.h"
-
-LDP pan_new(int nrays) {
-	
-}
-
-void pan_merge(LDP pan, LDP ld) {
-	
-}
-
diff --git a/sm/apps/map/pan.h b/sm/apps/map/pan.h
deleted file mode 100644
index e398e78161ed3a1836339ec9bb4708b29a2c6cad..0000000000000000000000000000000000000000
--- a/sm/apps/map/pan.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef H_MAP_PAN
-#define H_MAP_PAN
-
-#include <csm/csm_all.h>
-
-using namespace CSM;
-
-struct merge_params {
-	
-};
-
-
-LDP pan_new(int nrays);
-
-void pan_merge(LDP pan, LDP ld);
-
-
-
-#endif
diff --git a/sm/apps/map/test_01.sh b/sm/apps/map/test_01.sh
deleted file mode 100755
index 981a93de26562d281fabad757e485bc7aeab4c88..0000000000000000000000000000000000000000
--- a/sm/apps/map/test_01.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-head -n 100 k15l.log | ./map1 > out.log
-log2pdf -config many_points.config -distance_xy 0 -in out.log
- 
\ No newline at end of file
diff --git a/sm/apps/qtv/CMakeLists.txt b/sm/apps/qtv/CMakeLists.txt
deleted file mode 100644
index e81e1273bdb41ed27560970a7a331640ca957d1b..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-project(qtv)
-
-macro(join ret list)
-	SET(res "")
-	FOREACH(e ${list})
-		SET(res "${res} ${e}")
-	ENDFOREACH(e ${list})
-	SET(${ret} ${res})
-endmacro(join list)
-
-
-set(QT_USE_QTOPENGL 1)
-find_package(Qt4 REQUIRED)
-
-find_package(PkgConfig REQUIRED)
-pkg_check_modules(CSM REQUIRED csm)
-
-#join(CSM_LDFLAGS "${CSM_LDFLAGS}")
-join(CSM_CFLAGS "${CSM_CFLAGS}")
-
-MESSAGE("CSM_CFLAGS: ${CSM_CFLAGS}")
-MESSAGE("CSM_LDFLAGS: ${CSM_LDFLAGS}")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CSM_CFLAGS}")
-SET(LDFLAGS ${CSM_LDFLAGS})
-
-
-include(${QT_USE_FILE})
-
-# the variable "qtproject_SRCS" contains all .cpp files of this project
-set(qtv_SRCS
-    qtv.cpp
-    mouse.cpp
-	qlaserdata.cpp
-	qfilereader.cpp
-	qparser.cpp
-	qscene.cpp
-	qmapview.cpp
-)
-
-qt4_automoc(${qtv_SRCS})
-
-add_executable(qtv ${qtv_SRCS})
-
-target_link_libraries(qtv ${QT_LIBRARIES})
-target_link_libraries(qtv ${CSM_LDFLAGS})
-
diff --git a/sm/apps/qtv/design.txt b/sm/apps/qtv/design.txt
deleted file mode 100644
index df9059a7f7ae9cd4f029b42126cd895f512a07f7..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/design.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-Modalitā
---------
-
-1) Singolo visore
-
-	Visualizza l'ultimo laserdata.
-
-2) Visore continuo.
-
-	Ogni laserdata ha un ID. Se l'ID si ripresenta, si aggiorna.
-	Ogni laserdata ricorda la storia (opzionale)
-	
-
-Tipi di dato
-------------
-
-0) Comandi
-	CLEAR cancella tutto
-
-Oggetti:
-1) Laserdata
-2) Punti grafo
-3) Connessioni grafo (either tra laserdata o punti grafo)
-4) Labels
-	text
-	x,y,theta
-	min_zoom	Visibile solo sotto una certa distanza
-	
-5) Log
-	messaggio di log
-
-Campi comuni:
-	text
-	
-Grafica:
-	color
-
-Parametri
----------
-
-follow_last   Segui l'ultimo scan 
-follow_zoom   Ampiezza per seguire
-follow_smooth Smoothness per seguire
-
-
-Multiple viewpoints
--------------------
-
-
-
-Architettura
--------------
-- Widgets
-- Containers
-	- log
-	- graphics scene
-- Parser/demux: trasla stringhe/json in oggetti
-- Input threads (stdin, file, tcp)
-
-
-
-
-
-
-
-
diff --git a/sm/apps/qtv/main.cpp b/sm/apps/qtv/main.cpp
deleted file mode 100644
index 873e0e7f8f967a82c97c82d6819888efd86e1166..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/main.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2006-2007 Trolltech ASA. All rights reserved.
-**
-** This file is part of the example classes of the Qt Toolkit.
-**
-** This file may be used under the terms of the GNU General Public
-** License version 2.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of
-** this file.  Please review the following information to ensure GNU
-** General Public Licensing requirements will be met:
-** http://trolltech.com/products/qt/licenses/licensing/opensource/
-**
-** If you are unsure which license is appropriate for your use, please
-** review the following information:
-** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
-** or contact the sales department at sales@trolltech.com.
-**
-** In addition, as a special exception, Trolltech gives you certain
-** additional rights. These rights are described in the Trolltech GPL
-** Exception version 1.0, which can be found at
-** http://www.trolltech.com/products/qt/gplexception/ and in the file
-** GPL_EXCEPTION.txt in this package.
-**
-** In addition, as a special exception, Trolltech, as the sole copyright
-** holder for Qt Designer, grants users of the Qt/Eclipse Integration
-** plug-in the right for the Qt/Eclipse Integration to link to
-** functionality provided by Qt Designer and its related libraries.
-**
-** Trolltech reserves all rights not expressly granted herein.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
-
-#include "mouse.h"
-
-#include <QtGui>
-
-#include <math.h>
-
-static const int MouseCount = 7;
-
-int main(int argc, char **argv)
-{
-    QApplication app(argc, argv);
-    qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
-
-    QGraphicsScene scene;
-    scene.setSceneRect(-300, -300, 600, 600);
-    scene.setItemIndexMethod(QGraphicsScene::NoIndex);
-
-    for (int i = 0; i < MouseCount; ++i) {
-        Mouse *mouse = new Mouse;
-        mouse->setPos(::sin((i * 6.28) / MouseCount) * 200,
-                      ::cos((i * 6.28) / MouseCount) * 200);
-        scene.addItem(mouse);
-    }
-
-    QGraphicsView view(&scene);
-    view.setRenderHint(QPainter::Antialiasing);
-    view.setBackgroundBrush(QPixmap(":/images/cheese.jpg"));
-    view.setCacheMode(QGraphicsView::CacheBackground);
-    view.setDragMode(QGraphicsView::ScrollHandDrag);
-    view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Colliding Mice"));
-    view.resize(400, 300);
-    view.show();
-
-    return app.exec();
-}
diff --git a/sm/apps/qtv/mouse.cpp b/sm/apps/qtv/mouse.cpp
deleted file mode 100644
index 4fc49cb09625afbc35f4a978249ccf164e6a7e3a..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/mouse.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2006-2007 Trolltech ASA. All rights reserved.
-**
-** This file is part of the example classes of the Qt Toolkit.
-**
-** This file may be used under the terms of the GNU General Public
-** License version 2.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of
-** this file.  Please review the following information to ensure GNU
-** General Public Licensing requirements will be met:
-** http://trolltech.com/products/qt/licenses/licensing/opensource/
-**
-** If you are unsure which license is appropriate for your use, please
-** review the following information:
-** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
-** or contact the sales department at sales@trolltech.com.
-**
-** In addition, as a special exception, Trolltech gives you certain
-** additional rights. These rights are described in the Trolltech GPL
-** Exception version 1.0, which can be found at
-** http://www.trolltech.com/products/qt/gplexception/ and in the file
-** GPL_EXCEPTION.txt in this package.
-**
-** In addition, as a special exception, Trolltech, as the sole copyright
-** holder for Qt Designer, grants users of the Qt/Eclipse Integration
-** plug-in the right for the Qt/Eclipse Integration to link to
-** functionality provided by Qt Designer and its related libraries.
-**
-** Trolltech reserves all rights not expressly granted herein.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
-
-#include "mouse.h"
-
-#include "mouse.moc"
-
-#include <QGraphicsScene>
-#include <QPainter>
-#include <QStyleOption>
-
-#include <math.h>
-
-static const double Pi = 3.14159265358979323846264338327950288419717;
-static double TwoPi = 2.0 * Pi;
-
-static qreal normalizeAngle(qreal angle)
-{
-    while (angle < 0)
-        angle += TwoPi;
-    while (angle > TwoPi)
-        angle -= TwoPi;
-    return angle;
-}
-
-Mouse::Mouse()
-    : angle(0), speed(0), mouseEyeDirection(0),
-      color(qrand() % 256, qrand() % 256, qrand() % 256)
-{
-    rotate(qrand() % (360 * 16));
-    startTimer(1000 / 33);
-}
-
-QRectF Mouse::boundingRect() const
-{
-    qreal adjust = 0.5;
-    return QRectF(-18 - adjust, -22 - adjust,
-                  36 + adjust, 60 + adjust);
-}
-
-QPainterPath Mouse::shape() const
-{
-    QPainterPath path;
-    path.addRect(-10, -20, 20, 40);
-    return path;
-}
-
-void Mouse::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
-{
-    // Body
-    painter->setBrush(color);
-    painter->drawEllipse(-10, -20, 20, 40);
-
-    // Eyes
-    painter->setBrush(Qt::white);
-    painter->drawEllipse(-10, -17, 8, 8);
-    painter->drawEllipse(2, -17, 8, 8);
-
-    // Nose
-    painter->setBrush(Qt::black);
-    painter->drawEllipse(QRectF(-2, -22, 4, 4));
-
-    // Pupils
-    painter->drawEllipse(QRectF(-8.0 + mouseEyeDirection, -17, 4, 4));
-    painter->drawEllipse(QRectF(4.0 + mouseEyeDirection, -17, 4, 4));
-
-    // Ears
-    painter->setBrush(scene()->collidingItems(this).isEmpty() ? Qt::darkYellow : Qt::red);
-    painter->drawEllipse(-17, -12, 16, 16);
-    painter->drawEllipse(1, -12, 16, 16);
-
-    // Tail
-    QPainterPath path(QPointF(0, 20));
-    path.cubicTo(-5, 22, -5, 22, 0, 25);
-    path.cubicTo(5, 27, 5, 32, 0, 30);
-    path.cubicTo(-5, 32, -5, 42, 0, 35);
-    painter->setBrush(Qt::NoBrush);
-    painter->drawPath(path);
-}
-
-void Mouse::timerEvent(QTimerEvent *)
-{
-    // Don't move too far away
-    QLineF lineToCenter(QPointF(0, 0), mapFromScene(0, 0));
-    if (lineToCenter.length() > 150) {
-        qreal angleToCenter = ::acos(lineToCenter.dx() / lineToCenter.length());
-        if (lineToCenter.dy() < 0)
-            angleToCenter = TwoPi - angleToCenter;
-        angleToCenter = normalizeAngle((Pi - angleToCenter) + Pi / 2);
-
-        if (angleToCenter < Pi && angleToCenter > Pi / 4) {
-            // Rotate left
-            angle += (angle < -Pi / 2) ? 0.25 : -0.25;
-        } else if (angleToCenter >= Pi && angleToCenter < (Pi + Pi / 2 + Pi / 4)) {
-            // Rotate right
-            angle += (angle < Pi / 2) ? 0.25 : -0.25;
-        }
-    } else if (::sin(angle) < 0) {
-        angle += 0.25;
-    } else if (::sin(angle) > 0) {
-        angle -= 0.25;
-    }
-
-    // Try not to crash with any other mice
-    QList<QGraphicsItem *> dangerMice = scene()->items(QPolygonF()
-                                                       << mapToScene(0, 0)
-                                                       << mapToScene(-30, -50)
-                                                       << mapToScene(30, -50));
-    foreach (QGraphicsItem *item, dangerMice) {
-        if (item == this)
-            continue;
-        
-        QLineF lineToMouse(QPointF(0, 0), mapFromItem(item, 0, 0));
-        qreal angleToMouse = ::acos(lineToMouse.dx() / lineToMouse.length());
-        if (lineToMouse.dy() < 0)
-            angleToMouse = TwoPi - angleToMouse;
-        angleToMouse = normalizeAngle((Pi - angleToMouse) + Pi / 2);
-
-        if (angleToMouse >= 0 && angleToMouse < Pi / 2) {
-            // Rotate right
-            angle += 0.5;
-        } else if (angleToMouse <= TwoPi && angleToMouse > (TwoPi - Pi / 2)) {
-            // Rotate left
-            angle -= 0.5;
-        }
-    }
-
-    // Add some random movement
-    if (dangerMice.size() > 1 && (qrand() % 10) == 0) {
-        if (qrand() % 1)
-            angle += (qrand() % 100) / 500.0;
-        else
-            angle -= (qrand() % 100) / 500.0;
-    }
-
-    speed += (-50 + qrand() % 100) / 100.0;
-
-    qreal dx = ::sin(angle) * 10;
-    mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5;
-
-    rotate(dx);
-    setPos(mapToParent(0, -(3 + sin(speed) * 3)));
-}
diff --git a/sm/apps/qtv/mouse.h b/sm/apps/qtv/mouse.h
deleted file mode 100644
index 948c64470736734d88bac9321612a77ee58d9bd5..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/mouse.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2006-2007 Trolltech ASA. All rights reserved.
-**
-** This file is part of the example classes of the Qt Toolkit.
-**
-** This file may be used under the terms of the GNU General Public
-** License version 2.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of
-** this file.  Please review the following information to ensure GNU
-** General Public Licensing requirements will be met:
-** http://trolltech.com/products/qt/licenses/licensing/opensource/
-**
-** If you are unsure which license is appropriate for your use, please
-** review the following information:
-** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
-** or contact the sales department at sales@trolltech.com.
-**
-** In addition, as a special exception, Trolltech gives you certain
-** additional rights. These rights are described in the Trolltech GPL
-** Exception version 1.0, which can be found at
-** http://www.trolltech.com/products/qt/gplexception/ and in the file
-** GPL_EXCEPTION.txt in this package.
-**
-** In addition, as a special exception, Trolltech, as the sole copyright
-** holder for Qt Designer, grants users of the Qt/Eclipse Integration
-** plug-in the right for the Qt/Eclipse Integration to link to
-** functionality provided by Qt Designer and its related libraries.
-**
-** Trolltech reserves all rights not expressly granted herein.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-****************************************************************************/
-
-#ifndef MOUSE_H
-#define MOUSE_H
-
-#include <QGraphicsItem>
-#include <QObject>
-
-class Mouse : public QObject, public QGraphicsItem
-{
-    Q_OBJECT
-
-public:
-    Mouse();
-
-    QRectF boundingRect() const;
-    QPainterPath shape() const;
-    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
-               QWidget *widget);
-
-protected:
-    void timerEvent(QTimerEvent *event);
-
-private:
-    qreal angle;
-    qreal speed;
-    qreal mouseEyeDirection;
-    QColor color;
-};
-
-#endif
diff --git a/sm/apps/qtv/qfilereader.cpp b/sm/apps/qtv/qfilereader.cpp
deleted file mode 100644
index 6e6dd6b0ffe03f1606217e8bf7857746c14af37c..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qfilereader.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "qfilereader.h"
-#include "qfilereader.moc"
-
-QFileReader::QFileReader(QIODevice * source) :
-	source(source) {
-
-}
-	
-void QFileReader::run() {
-	printf("Running\n");
-		
-	while(1) {
-		char buf[10024];
-		qint64 lineLength = source->readLine(buf, sizeof(buf));
-		if (lineLength == -1) break;
-		emit new_line(QString(buf));
-		
-/*		source->waitForBytesWritten(-1);
-		if(source->canReadLine()) {
-			printf("can\n");
-			QByteArray data = source->readLine();
-			emit new_line(QString(data));
-		} else {
-			printf(".");
-		}*/
-	}
-	
-	emit eof();
-}
-
diff --git a/sm/apps/qtv/qfilereader.h b/sm/apps/qtv/qfilereader.h
deleted file mode 100644
index c2936eef0b0b0aa826d1255ab0431e6800e46783..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qfilereader.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef QFILEREADER_H
-#define QFILEREADER_H
-
-#include <QThread>
-#include <QIODevice>
-
-class QFileReader : public QThread
-{
-	Q_OBJECT
-
-	QIODevice * source;
-	
-public:
-	QFileReader(QIODevice * source);
-	void run();
-
-signals:
-	void new_line(QString);
-	void eof();
-};
-
-#endif
diff --git a/sm/apps/qtv/qlaserdata.cpp b/sm/apps/qtv/qlaserdata.cpp
deleted file mode 100644
index ee6d94c1bfa57c6adcf773878f58a1c159a1a718..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qlaserdata.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <QGraphicsScene>
-#include <QPainter>
-#include <QStyleOption>
-
-#include "qlaserdata.h"
-#include "qlaserdata.moc"
-
-
-QLaserData::QLaserData(LDP ld): ld(ld)
-{
-	this->countour = createCountour();
-	double *p = ld->estimate;
-	setPos(QPointF(p[0],p[1]));
-	rotate(CSM::rad2deg(p[2]));
-}
-
-QRectF QLaserData::boundingRect() const
-{
-	return countour.boundingRect();
-}
-
-QPainterPath QLaserData::shape() const
-{
-	return countour;
-}
-
-QPainterPath QLaserData::createCountour() {
-	ld_compute_cartesian(ld);
-	struct stroke_sequence sequence[ld->nrays];
-	compute_stroke_sequence(ld, sequence, 100, 0.1);
-	
-	QPainterPath path;
-	for(int i=0;i<ld->nrays;i++) {
-		if(sequence[i].valid==0) continue;
-		double *p = sequence[i].p;
-		if(sequence[i].begin_new_stroke)
-			path.moveTo(p[0], p[1]);
-		else
-			path.lineTo(p[0], p[1]);
-	}
-	return path;
-}
-
-void QLaserData::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
-{
-	 // Body
-//		painter->setBrush(color);
-/*	 painter->drawEllipse(-10, -20, 20, 40);
-
-	 // Eyes
-	 painter->setBrush(Qt::white);
-	 painter->drawEllipse(-10, -17, 8, 8);
-	 painter->drawEllipse(2, -17, 8, 8);
-
-	 // Nose
-	 painter->setBrush(Qt::black);
-	 painter->drawEllipse(QRectF(-2, -22, 4, 4));
-
-
-	 // Ears
-		painter->setBrush(scene()->collidingItems(this).isEmpty() ? Qt::darkYellow : Qt::red);
-	 painter->drawEllipse(-17, -12, 16, 16);
-	 painter->drawEllipse(1, -12, 16, 16);
-*/
-	 // Tail
-	 painter->setPen(Qt::black);
-	 painter->setBrush(Qt::NoBrush);
-/*	 painter->setBrush(Qt::red);*/
-	 painter->drawPath(countour);
-}
-
-void QLaserData::timerEvent(QTimerEvent *)
-{
-
-  //	rotate(dx);
-//		setPos(mapToParent(0, -(3 + sin(speed) * 3)));
-}
diff --git a/sm/apps/qtv/qlaserdata.h b/sm/apps/qtv/qlaserdata.h
deleted file mode 100644
index fc71aa34f4f78b0f2e3a728b72bb6fb56b181bbf..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qlaserdata.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef QLASERDATA_H
-#define QLASERDATA_H
-
-#include "qtv.h"
-
-class QLaserData : public QObject, public QGraphicsItem
-{
-	 Q_OBJECT
-
-public:
-	 QLaserData(LDP ld);
-
-	QPainterPath createCountour();
-
-	 QRectF boundingRect() const;
-	 QPainterPath shape() const;
-	 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
-					QWidget *widget);
-
-protected:
-	 void timerEvent(QTimerEvent *event);
-
-private:
-	LDP ld;
-	QPainterPath countour;
-};
-
-#endif
diff --git a/sm/apps/qtv/qmapview.cpp b/sm/apps/qtv/qmapview.cpp
deleted file mode 100644
index dddf65371becaa818b0abbfbceb6d1af9249a36a..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qmapview.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "qmapview.h"
-#include "qmapview.moc"
-
-
-#include <QDebug>
-#include <QGraphicsScene>
-#include <QWheelEvent>
-
-#include <math.h>
-
-QMapView::QMapView()
-{
-	setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
-	
-	 setCacheMode(CacheBackground);
-	 setRenderHint(QPainter::Antialiasing);
-	 setTransformationAnchor(AnchorUnderMouse);
-	 setResizeAnchor(AnchorViewCenter);
-
-	 scale(0.8, 0.8);
-	 setMinimumSize(400, 400);
-	 setWindowTitle(tr("QMapView"));
-}
-
-void QMapView::keyPressEvent(QKeyEvent *event)
-{
-	 switch (event->key()) {
-	 case Qt::Key_Up:
-		  break;
-	 case Qt::Key_Down:
-		  break;
-	 case Qt::Key_Left:
-		  break;
-	 case Qt::Key_Right:
-		  break;
-	 case Qt::Key_Plus:
-		  scaleView(1.2);
-		  break;
-	 case Qt::Key_Minus:
-		  scaleView(1 / 1.2);
-		  break;
-	 case Qt::Key_Space:
-	 default:
-		  QGraphicsView::keyPressEvent(event);
-	 }
-}
-
-
-void QMapView::wheelEvent(QWheelEvent *event)
-{
-	 scaleView(pow((double)2, -event->delta() / 240.0));
-}
-
-
-void QMapView::scaleView(qreal scaleFactor)
-{
-	 qreal factor = matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
-	 if (factor < 0.07 || factor > 100)
-		  return;
-
-	 scale(scaleFactor, scaleFactor);
-}
diff --git a/sm/apps/qtv/qmapview.h b/sm/apps/qtv/qmapview.h
deleted file mode 100644
index 5f22f3d4a5862602bd109588cd464b5d96f33ae3..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qmapview.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef GRAPHWIDGET_H
-#define GRAPHWIDGET_H
-
-
-#include <QtGui/QGraphicsView>
-
-#include <QtOpenGL/QtOpenGL>
-
-
-class QMapView : public QGraphicsView
-{
-    Q_OBJECT
-
-public:
-    QMapView();
-
-protected:
-    void keyPressEvent(QKeyEvent *event);
-    void wheelEvent(QWheelEvent *event);
-    void scaleView(qreal scaleFactor);
-
-};
-
-#endif
diff --git a/sm/apps/qtv/qparser.cpp b/sm/apps/qtv/qparser.cpp
deleted file mode 100644
index dee450fcfa3ca9de000c6bc995ba8e52531a20bb..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qparser.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "qparser.h"
-#include "qparser.moc"
-
-void QParser::new_line(QString qqs) {
-	const char * s = strdup(qqs.toAscii().constData());
-	LDP ld = ld_read_smart_string(s);
-	if(ld) {
-		emit parsed_laser_data(ld);
-	}
-}
-
diff --git a/sm/apps/qtv/qparser.h b/sm/apps/qtv/qparser.h
deleted file mode 100644
index ce943e5eceb5fec09b02a31221512549f3c55e3f..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qparser.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef QPARSER_H
-#define QPARSER_H
-
-#include "qtv.h"
-
-class QParser : public QObject
-{
-	Q_OBJECT
-
-public:
-
-signals:
-	void parsed_laser_data(LDP ld);
-
-public slots:
-
-	void new_line(QString);
-
-
-};
-
-#endif
diff --git a/sm/apps/qtv/qscene.cpp b/sm/apps/qtv/qscene.cpp
deleted file mode 100644
index 968984619cf8f3eaadcf928d5020df217f361c9f..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qscene.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "qscene.h"
-#include "qscene.moc"
-
-#include "qlaserdata.h"
-
-QScene::QScene() {
-	setSceneRect(-20, -20, 20, 20);
-	setItemIndexMethod(QGraphicsScene::NoIndex);
-}
-
-
-void QScene::new_laser_data(LDP ld) {
-	addItem(new QLaserData(ld));
-}
-
-void QScene::adjust() {
-	setSceneRect(itemsBoundingRect());
-}
-
-
diff --git a/sm/apps/qtv/qscene.h b/sm/apps/qtv/qscene.h
deleted file mode 100644
index 8f0c501f873d352e5734477fe85bc6c766a59d9f..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qscene.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef QSCENE_H
-#define QSCENE_H
-
-#include "qtv.h"
-
-class QScene : public QGraphicsScene
-{
-	Q_OBJECT
-
-
-public:
-	QScene();
-
-signals:
-
-
-public slots:
-
-	void new_laser_data(LDP);
-	void adjust();
-
-};
-
-#endif
diff --git a/sm/apps/qtv/qtv.cpp b/sm/apps/qtv/qtv.cpp
deleted file mode 100644
index b68c8766bde73583c7907a59b6473f70e8a69da4..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qtv.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "qtv.h"
-
-int main(int argc, char*argv[]) {
-	
-	QApplication app(argc, argv);
-   
-	QFile *qin = new QFile();
-	if(!qin->open(stdin, QIODevice::ReadOnly)) {
-		printf("Could not open stding as QFile.\n");
-		exit(1);
-	}
-	QFileReader *qfr = new QFileReader(qin);
-	QParser *qp = new QParser;
-	
-	QScene * qscene = new QScene();
-	
-	QObject::connect(qfr, SIGNAL(new_line(QString)), qp,  SLOT(new_line(QString)));
-	QObject::connect(qfr, SIGNAL(eof()), qscene,  SLOT(adjust()));
-
-	QObject::connect(qp, SIGNAL(parsed_laser_data(LDP)), qscene,  SLOT(new_laser_data(LDP)));
-	
-	
-	QMapView view;
-	view.setScene(qscene);
-   view.setCacheMode(QGraphicsView::CacheBackground);
-   view.setDragMode(QGraphicsView::ScrollHandDrag);
-	view.scale(10,10);
-   view.show();
-	qfr->start();
-	
-	return app.exec();
-}
\ No newline at end of file
diff --git a/sm/apps/qtv/qtv.h b/sm/apps/qtv/qtv.h
deleted file mode 100644
index 3da4317f36062542f747e9153bb14de0c553e157..0000000000000000000000000000000000000000
--- a/sm/apps/qtv/qtv.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef H_QTV
-#define H_QTV
-
-#include <iostream>
-
-#include <QtGui>
-#include <QThread>
-#include <QIODevice>
-
-#include <csm/csm.h>
-#include <csm/csm_all.h>
-using namespace CSM;
-
-#include "qfilereader.h"
-#include "qparser.h"
-#include "qscene.h"
-#include "qmapview.h"
-
-using namespace std;
-
-#endif
-
diff --git a/sm/apps/raytracer/CMakeLists.txt b/sm/apps/raytracer/CMakeLists.txt
deleted file mode 100644
index 5fdfbcc73ad58579aaba4bea9c5032361c74f239..0000000000000000000000000000000000000000
--- a/sm/apps/raytracer/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-cmake_minimum_required(VERSION 2.4)
-
-project(raytracer)
-
-
-find_package(PkgConfig REQUIRED)
-pkg_check_modules(CSM REQUIRED csm)
-
-IF(${CSM_FOUND})
-	MESSAGE("CSM_LIBRARY_DIRS: ${CSM_LIBRARY_DIRS}")
-	MESSAGE("CSM_LIBRARIES: ${CSM_LIBRARIES}")
-	MESSAGE("CSM_INCLUDE_DIRS: ${CSM_INCLUDE_DIRS}")
-
-	INCLUDE_DIRECTORIES(${CSM_INCLUDE_DIRS})
-	LINK_DIRECTORIES(${CSM_LIBRARY_DIRS})
-
-ELSE(${CSM_FOUND})	
-	MESSAGE(FATAL_ERROR "CSM not found. Check that the environment variable PKG_CONFIG_PATH includes the path containing the file 'csm.pc'.")
-ENDIF(${CSM_FOUND})		
-
-
-set(raytracer_SRCS
-	raytracer.cpp
-	simplemap.cpp
-)
-
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -Wall")
-
-add_executable(raytracer ${raytracer_SRCS})
-
-target_link_libraries(raytracer ${CSM_LIBRARIES})
-
diff --git a/sm/apps/raytracer/raytracer.cpp b/sm/apps/raytracer/raytracer.cpp
deleted file mode 100644
index 745b25a7185c2e753817a7550fd59707fc37d9d2..0000000000000000000000000000000000000000
--- a/sm/apps/raytracer/raytracer.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-#include "raytracer.h"
-
-struct raytracer_params {
-	const char * file_map;
-	const char * file_poses;
-	const char * file_output;
-	double fov_deg;
-	int nrays;
-	double max_reading;
-};
-
-
-bool load_env_from_json(Environment& env, JO jo);
-double cosine_between_angles(double a1, double a2);
-
-
-int main(int argc, const char** argv)
-{
-	sm_set_program_name(argv[0]);
-	struct raytracer_params p;
-	
-	struct option* ops = options_allocate(60);
-	options_string(ops, "map", &p.file_map, "map.json", "Environment description");
-	options_string(ops, "poses", &p.file_poses, "-", "List of poses");
-	options_string(ops, "out", &p.file_output, "stdout", "Output file ");
-	options_int(ops, "nrays", &p.nrays, 181,  "Number of rays");
-	options_double(ops, "fov_deg", &p.fov_deg, 180.0,  "Field of view (degrees)");
-	options_double(ops, "max_reading", &p.max_reading, 80.0,  "Sensor horizon (meters)");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		sm_info(" simulats one scan from map. \n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	
-	FILE * file_map = open_file_for_reading(p.file_map);
-	if(!file_map) return -2;
-	
-	JO jo_map = json_read_stream(file_map); 
-	if(!jo_map) {
-		sm_error("Could not read JSON from file '%s'\n", p.file_map);
-		return -3;
-	}
-	if(json_read_stream(file_map)) {
-		sm_error("I expect only 1 JSON object in file '%s'\n", p.file_map);
-		return -4;
-	}
-
-	Environment env;
-	
-	load_env_from_json(env, jo_map);
-	
-	
-	FILE * file_output = open_file_for_writing(p.file_output);
-	if(!file_output) return -1;
-
-
-	FILE * file_poses = open_file_for_reading(p.file_poses);
-	if(!file_poses) return -2;
-	
-	JO jo_pose; int num = 0;
-	while( (jo_pose = json_read_stream(file_poses)) )
-	{
-		num++;
-	
-		LDP ld = ld_alloc_new(p.nrays);
-
-		if(!jo_read_from_double_array (jo_pose, ld->true_pose, 3, GSL_NAN) || any_nan(ld->true_pose, 3)) {
-			sm_error("Bad pose: '%s'.\n", jo_to_string(jo_pose));
-			return -5;
-		}
-		
-		
-		double fov = deg2rad(p.fov_deg);
-		
-		ld->min_theta = -fov/2;
-		ld->max_theta = +fov/2;
-		
-		for(int i=0;i<ld->nrays;i++) {
-			ld->theta[i] = - fov/2 + fov * i / (ld->nrays-1);;
-			
-			double rho, alpha; int stuff_id;
-			if(env.ray_tracing(ld->true_pose, ld->theta[i] + ld->true_pose[2], rho, alpha, &stuff_id) && (rho<p.max_reading)) {
-			
-				ld->valid[i] = 1;
-				ld->readings[i] = rho;
-				
-				double relative_alpha = alpha-ld->true_pose[2];
-
-				/* Make sure alpha points out of the wall */
-				if( cosine_between_angles(relative_alpha, ld->theta[i]) > 0) {
-					relative_alpha += M_PI;
-				}
-				
-				ld->true_alpha[i] = normalize_0_2PI(relative_alpha);
-
-			} else {
-				ld->valid[i] = 0;
-			} 
-			
-		}
-		
-		ld->tv.tv_sec = num;
-
-
-		JO jo = ld_to_json(ld);
-		fputs(jo_to_string(jo), file_output);
-		fputs("\n", file_output);
-		jo_free(jo);
-
-		ld_free(ld);
-	}	
-
-	if(num == 0) {
-		sm_error("It looks like there wasn't any pose in the file '%s'\n", p.file_poses);
-		return -4;
-	}
-
-	jo_free(jo_map);
-}
-
-
-
-#define jo_expect_array(a) (a!=0 && json_object_is_type(a, json_type_array))
-#define jo_expect_object(a) (a!=0 &&  json_object_is_type(a, json_type_object))
-#define jo_expect_string(a) (a!=0 && json_object_is_type(a, json_type_string))
-#define jo_expect_array_size(a,n) ( (a!=0) && (json_object_is_type(a, json_type_array)&& (jo_array_length(a)==n)))
-#define jo_expect_array_size_min(a,n) ( (a!=0) && (json_object_is_type(a, json_type_array)&& (jo_array_length(a)>=n)))
-
-
-#define expect(a) if(!a) { \
-		sm_error("Invalid format: \n\t %s \n", #a); \
-			return false; \
-		}
-
-#define expect_s(a, s) if(!a) { \
-		sm_error("Invalid format: %s \n\t %s \n", s, #a); \
-			return false; \
-		}
-		
-double cosine_between_angles(double a1, double a2) {
-	return cos(a1)*cos(a2)+sin(a1)*sin(a2);
-}
-
-
-bool load_env_from_json(Environment& env, JO jo_map) {
-	jo_expect_object(jo_map);
-	
-	JO jo_objects = json_object_object_get(jo_map, "objects");
-		expect(jo_expect_array(jo_objects));
-	
-	for(int i=0; i < jo_array_length(jo_objects); i++) {
-		JO jo = jo_array_get(jo_objects, i);
-			expect(jo_expect_object(jo));
-		
-		JO jo_type = jo_get(jo, "type"); 
-			expect(jo_expect_string(jo_type));
-			
-		if(!strcmp(jo_get_string(jo_type), "line")) {
-			
-			JO points = jo_get(jo, "points");
-			expect(jo_expect_array_size_min(points, 2));
-			
-			
-			for(int p=0;p<jo_array_length(points)-1;p++) {
-				Segment * s = new Segment();
-				expect(jo_read_from_double_array (jo_array_get(points, p  ), s->p0, 2, NAN));
-				expect(jo_read_from_double_array (jo_array_get(points, p+1), s->p1, 2, NAN));
-				env.stuff.push_back(s);
-			}
-
-		} else if(!strcmp(jo_get_string(jo_type), "square")) {
-				
-				JO corners = jo_get(jo, "corners");
-				expect_s(jo_expect_array_size(corners, 2), jo_to_string(corners));
-
-				double pmin[2],pmax[2];
-
-				expect(jo_read_from_double_array (jo_array_get(corners, 0  ), pmin, 2, NAN));
-				expect(jo_read_from_double_array (jo_array_get(corners, 1), pmax, 2, NAN));
-
-				env.stuff.push_back(new Segment(pmin[0],pmin[1],pmax[0],pmin[1]));
-				env.stuff.push_back(new Segment(pmax[0],pmax[1],pmax[0],pmin[1]));
-				env.stuff.push_back(new Segment(pmax[0],pmax[1],pmin[0],pmax[1]));
-				env.stuff.push_back(new Segment(pmin[0],pmin[1],pmin[0],pmax[1]));
-
-		} else {
-			sm_error("unknown object type: '%s'\n", jo_get_string(jo_type));
-			return false;
-		}
-	}
-	
-	return true;
-}
-
-
diff --git a/sm/apps/raytracer/raytracer.h b/sm/apps/raytracer/raytracer.h
deleted file mode 100644
index 7f53726baa250b39d08e7198982364832546495d..0000000000000000000000000000000000000000
--- a/sm/apps/raytracer/raytracer.h
+++ /dev/null
@@ -1,18 +0,0 @@
-
-#ifndef H_RAYTRACER
-#define H_RAYTRACER
-
-
-#include <json-c/json.h>
-
-#include "simplemap.h"
-using namespace RayTracer;
-
-#include <csm/csm_all.h>
-using namespace CSM;
-
-#include <options/options.h>
-
-
-#endif
-
diff --git a/sm/apps/raytracer/simplemap.cpp b/sm/apps/raytracer/simplemap.cpp
deleted file mode 100644
index 30ff25facb828f00fc6e3d796bc0a28560f8d9a6..0000000000000000000000000000000000000000
--- a/sm/apps/raytracer/simplemap.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "raytracer.h"
-
-namespace RayTracer {
-	using namespace std;
-
-
-	bool Segment::ray_tracing(const double p[2], const double direction, 
-	 	double& range, double &alpha) const {
-
-		int found = segment_ray_tracing(this->p0, this->p1, p, direction, &range);
-
-		if(found) {
-			alpha = segment_alpha(this->p0, this->p1);
-	
-			/* alpha and direction should have versors with negative dot product */
-			if( cos(alpha)*cos(direction) + sin(alpha)*sin(direction) > 0 )
-				alpha = alpha + M_PI;
-
-			alpha = normalize_0_2PI(alpha);
-
-			return true;
-		} else {
-			alpha = NAN;
-			return false;
-		}		
-	};
-
-	bool Environment::ray_tracing(const double p[2], const double direction,  double& out_distance, double &out_alpha, int*stuff_id) const {
-	
-		int champion = -1;
-		double champion_range, champion_alpha;
-		for(size_t i=0;i<stuff.size();i++) {
-			Stuff * s = stuff.at(i);
-			
-			double range, alpha;
-			if(s->ray_tracing(p,direction,range,alpha)){
-				if(champion==-1 || range<champion_range) {
-					champion = i;
-					champion_range = range;
-					champion_alpha = alpha;
-				}
-			}
-			
-		}
-		
-		if(champion != -1) {
-			*stuff_id = champion;
-			out_distance = champion_range;
-			out_alpha = champion_alpha;
-		
-			return true;
-		} else {
-			return false;
-		}
-	}
-} // namespace SimpleMap
diff --git a/sm/apps/raytracer/simplemap.h b/sm/apps/raytracer/simplemap.h
deleted file mode 100644
index c2e391f2e329ff7ecc7ee2045104ceeba6b1d2bd..0000000000000000000000000000000000000000
--- a/sm/apps/raytracer/simplemap.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef MAPAC_H
-#define MAPAC_H
-
-#include <iostream>
-#include <vector>
-#include <string>
-
-namespace RayTracer {
-	
-	using namespace std;
-	
-	struct Material {
-		string name;
-		
-		/* 0: transparent; 1: solid; in between: randomly */
-		double infrared_solid;
-	};
-	
-	struct Stuff {
-		int group;
-		
-		Material * material;
-		
-		/** Ray tracing with incidence. */
-		virtual bool ray_tracing(const double p[2], const double direction, double& out_distance, double &out_alpha) const = 0; 	
-		virtual ~Stuff(){};
-	};
-	
-	struct Segment: public Stuff {
-		double p0[2], p1[2];
-		
-		Segment() {}
-		virtual ~Segment(){};
-		
-		Segment(double x0,double y0,double x1,double y1) {
-			p0[0] = x0; p0[1] = y0;
-			p1[0] = x1; p1[1] = y1;
-		}
-		
-		
-		bool ray_tracing(const double p[2], const double direction, double& out_distance, double &out_alpha) const;
-	};
-
-	struct Circle: public Stuff {
-		virtual ~Circle(){};
-		
-		double p[2], radius;
-		
-		bool ray_tracing(const double p[2], const double direction,  double& out_distance, double &out_alpha) const;
-	};
-	
-	struct Environment  {
-		std::vector<Stuff*> stuff;
-
-		bool ray_tracing(const double p[2], const double direction,  double& out_distance, double &out_alpha, int*stuff_id) const ;
-				
-	};
-	
-
-	
-}
-
-#endif
diff --git a/sm/apps/raytracer/simplemap_obst.cpp b/sm/apps/raytracer/simplemap_obst.cpp
deleted file mode 100644
index ab61e4cd208cda75367d3ae369db5f4086ff9525..0000000000000000000000000000000000000000
--- a/sm/apps/raytracer/simplemap_obst.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "simplemap.h"
-
-namespace PPU {
-	
-	bool Map::isCellObst(const Viewport& cbb) const {
-		for (unsigned int i = 0; i < size(); i++) {
-			const Segment& s = at(i);	
-			if(s.obstType != ObstSolid) continue;
-			
-			if(cbb.crossesSegment(s.p[0], s.p[1]))
-				return true;
-		}
-		return false;
-	}
-	
-	
-}
diff --git a/sm/apps/raytracer/test01-map.json b/sm/apps/raytracer/test01-map.json
deleted file mode 100644
index c8204f9147c1efca5628d39dc05ced022c8e06e8..0000000000000000000000000000000000000000
--- a/sm/apps/raytracer/test01-map.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-	"objects": [
-		{ "type": "square",  "corners": [ [-5.0, -5.0], [5.0, 5.0] ]}
-	]
-}
diff --git a/sm/apps/raytracer/test01-scans.json.expected b/sm/apps/raytracer/test01-scans.json.expected
deleted file mode 100644
index c2dd6343c09b597467b55c61ee056885363ac7fa..0000000000000000000000000000000000000000
--- a/sm/apps/raytracer/test01-scans.json.expected
+++ /dev/null
@@ -1 +0,0 @@
-{ "nrays": 181, "min_theta": -1.570796, "max_theta": 1.570796, "odometry": [ null, null, null ], "estimate": [ null, null, null ], "true_pose": [ 0.000000, 0.000000, 0.000000 ], "theta": [ -1.570796, -1.553343, -1.535890, -1.518436, -1.500983, -1.483530, -1.466077, -1.448623, -1.431170, -1.413717, -1.396263, -1.378810, -1.361357, -1.343904, -1.326450, -1.308997, -1.291544, -1.274090, -1.256637, -1.239184, -1.221730, -1.204277, -1.186824, -1.169371, -1.151917, -1.134464, -1.117011, -1.099557, -1.082104, -1.064651, -1.047198, -1.029744, -1.012291, -0.994838, -0.977384, -0.959931, -0.942478, -0.925025, -0.907571, -0.890118, -0.872665, -0.855211, -0.837758, -0.820305, -0.802851, -0.785398, -0.767945, -0.750492, -0.733038, -0.715585, -0.698132, -0.680678, -0.663225, -0.645772, -0.628319, -0.610865, -0.593412, -0.575959, -0.558505, -0.541052, -0.523599, -0.506145, -0.488692, -0.471239, -0.453786, -0.436332, -0.418879, -0.401426, -0.383972, -0.366519, -0.349066, -0.331613, -0.314159, -0.296706, -0.279253, -0.261799, -0.244346, -0.226893, -0.209440, -0.191986, -0.174533, -0.157080, -0.139626, -0.122173, -0.104720, -0.087266, -0.069813, -0.052360, -0.034907, -0.017453, 0.000000, 0.017453, 0.034907, 0.052360, 0.069813, 0.087266, 0.104720, 0.122173, 0.139626, 0.157080, 0.174533, 0.191986, 0.209440, 0.226893, 0.244346, 0.261799, 0.279253, 0.296706, 0.314159, 0.331613, 0.349066, 0.366519, 0.383972, 0.401426, 0.418879, 0.436332, 0.453786, 0.471239, 0.488692, 0.506145, 0.523599, 0.541052, 0.558505, 0.575959, 0.593412, 0.610865, 0.628319, 0.645772, 0.663225, 0.680678, 0.698132, 0.715585, 0.733038, 0.750492, 0.767945, 0.785398, 0.802851, 0.820305, 0.837758, 0.855211, 0.872665, 0.890118, 0.907571, 0.925025, 0.942478, 0.959931, 0.977384, 0.994838, 1.012291, 1.029744, 1.047198, 1.064651, 1.082104, 1.099557, 1.117011, 1.134464, 1.151917, 1.169371, 1.186824, 1.204277, 1.221730, 1.239184, 1.256637, 1.274090, 1.291544, 1.308997, 1.326450, 1.343904, 1.361357, 1.378810, 1.396263, 1.413717, 1.431170, 1.448623, 1.466077, 1.483530, 1.500983, 1.518436, 1.535890, 1.553343, 1.570796 ], "readings": [ 5.000000, 5.000762, 5.003048, 5.006862, 5.012209, 5.019099, 5.027541, 5.037549, 5.049138, 5.062326, 5.077133, 5.093583, 5.111703, 5.131521, 5.153068, 5.176381, 5.201497, 5.228459, 5.257311, 5.288103, 5.320889, 5.355725, 5.392674, 5.431802, 5.473181, 5.516890, 5.563010, 5.611631, 5.662850, 5.716770, 5.773503, 5.833167, 5.895892, 5.961816, 6.031090, 6.103873, 6.180340, 6.260678, 6.345091, 6.433798, 6.527036, 6.625065, 6.728164, 6.836637, 6.950818, 7.071068, 6.950818, 6.836637, 6.728164, 6.625065, 6.527036, 6.433798, 6.345091, 6.260678, 6.180340, 6.103873, 6.031090, 5.961816, 5.895892, 5.833167, 5.773503, 5.716770, 5.662850, 5.611631, 5.563010, 5.516890, 5.473181, 5.431802, 5.392674, 5.355725, 5.320889, 5.288103, 5.257311, 5.228459, 5.201497, 5.176381, 5.153068, 5.131521, 5.111703, 5.093583, 5.077133, 5.062326, 5.049138, 5.037549, 5.027541, 5.019099, 5.012209, 5.006862, 5.003048, 5.000762, 5.000000, 5.000762, 5.003048, 5.006862, 5.012209, 5.019099, 5.027541, 5.037549, 5.049138, 5.062326, 5.077133, 5.093583, 5.111703, 5.131521, 5.153068, 5.176381, 5.201497, 5.228459, 5.257311, 5.288103, 5.320889, 5.355725, 5.392674, 5.431802, 5.473181, 5.516890, 5.563010, 5.611631, 5.662850, 5.716770, 5.773503, 5.833167, 5.895892, 5.961816, 6.031090, 6.103873, 6.180340, 6.260678, 6.345091, 6.433798, 6.527036, 6.625065, 6.728164, 6.836637, 6.950818, 7.071068, 6.950818, 6.836637, 6.728164, 6.625065, 6.527036, 6.433798, 6.345091, 6.260678, 6.180340, 6.103873, 6.031090, 5.961816, 5.895892, 5.833167, 5.773503, 5.716770, 5.662850, 5.611631, 5.563010, 5.516890, 5.473181, 5.431802, 5.392674, 5.355725, 5.320889, 5.288103, 5.257311, 5.228459, 5.201497, 5.176381, 5.153068, 5.131521, 5.111703, 5.093583, 5.077133, 5.062326, 5.049138, 5.037549, 5.027541, 5.019099, 5.012209, 5.006862, 5.003048, 5.000762, 5.000000 ], "valid": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], "true_alpha": [ 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 1.570796, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 3.141593, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389, 4.712389 ], "timestamp": [ 1, 0 ] }
diff --git a/sm/apps/raytracer/test01.sh b/sm/apps/raytracer/test01.sh
deleted file mode 100755
index 4620e6ed4c7f64a9841f54441883f64f2681fa87..0000000000000000000000000000000000000000
--- a/sm/apps/raytracer/test01.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-echo '[0,0,0]' | ./raytracer -map test01-map.json  > test01-scans.json
-diff test01-scans.json{,.expected}
diff --git a/sm/apps/raytracer/tests/example-map.json b/sm/apps/raytracer/tests/example-map.json
deleted file mode 100644
index 66df7eb500b9e17db9d9bb766634e4837a38cd7f..0000000000000000000000000000000000000000
--- a/sm/apps/raytracer/tests/example-map.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-	"objects": [
-		{ "type": "square",  "corners": [ [0.0, 0.0], [1.0, 1.0] ]},
-		{ "type": "line", "points": [ [0.0, 0.0], [0.0, 0.4], [0.1, 0.4] ]}
-	],
-
-	"materials": {
-		"default": {},
-		"glass": {}
-	},
-
-	"sensors": {
-		"bias": []
-	}
-}
\ No newline at end of file
diff --git a/sm/apps/sm0.c b/sm/apps/sm0.c
deleted file mode 100644
index 23b73a14c7d5ede49ec3c520c31e56ca8dad0d53..0000000000000000000000000000000000000000
--- a/sm/apps/sm0.c
+++ /dev/null
@@ -1,95 +0,0 @@
-#include <time.h>
-
-#include "../csm/csm_all.h"
-
-
-extern int distance_counter;
-int main(int argc, const char*argv[]) {
-	FILE * file;
-	if(argc==1) {
-		file = stdin;
-	} else {
-		const char * filename = argv[1];
-		file = fopen(filename,"r");
-		if(file==NULL) {
-			fprintf(stderr, "Could not open '%s'.\n", filename); 
-			return -1;
-		}
-	}
-	
-	struct sm_params params;
-	struct sm_result result;
-	
-	params.max_angular_correction_deg = 5;
-	params.max_linear_correction = 0.2;
-	params.max_iterations = 30;
-	params.epsilon_xy = 0.001;
-	params.epsilon_theta = 0.001;
-	params.max_correspondence_dist = 2;
-	params.sigma = 0.01;
-	params.restart = 1;
-	params.restart_threshold_mean_error = 3.0 / 300.0;
-	params.restart_dt= 0.1;
-	params.restart_dtheta=    1.5 * 3.14 /180;
-
-	params.clustering_threshold = 0.05;
-	params.orientation_neighbourhood = 3;
-	params.use_corr_tricks = 1;
-
-	params.do_alpha_test = 0;
-	params.outliers_maxPerc = 0.85;
-
-	params.outliers_adaptive_order =0.7;
-	params.outliers_adaptive_mult=2;
-	params.do_visibility_test = 1;
-	params.do_compute_covariance = 0;
-
-	int num_matchings = 0;
-	int num_iterations = 0;
-	clock_t start = clock();
-	
-	if(!(params.laser_ref = ld_read_smart(file)) ) {
-		printf("Could not read first scan.\n");
-		return -1;
-	}
-	
-	gsl_vector *u = gsl_vector_alloc(3);
-	gsl_vector *x_old = gsl_vector_alloc(3);
-	gsl_vector *x_new = gsl_vector_alloc(3);
-	while(! (params.laser_sens = ld_read_smart(file)) ) {
-		copy_from_array(x_old, params.laser_ref->odometry);
-		copy_from_array(x_new, params.laser_sens->odometry);
-		pose_diff(x_new,x_old,u);
-		vector_to_array(u, params.first_guess);
-	
-	 	sm_gpm(&params,&result);
-	 	/* sm_icp(&params,&result); */
-		
-		num_matchings++;
-		num_iterations += result.iterations;
-	
-		ld_free(params.laser_ref);
-		params.laser_ref = params.laser_sens;
-	}
-
-	clock_t end = clock();
-	float seconds = (end-start)/((float)CLOCKS_PER_SEC);
-	
-	sm_debug("sm0: CPU time = %f (seconds) (start=%d end=%d)\n", seconds,(int)start,(int)end);
-	sm_debug("sm0: Total number of matchings = %d\n", num_matchings);
-	sm_debug("sm0: Total number of iterations = %d\n", num_iterations);
-	sm_debug("sm0: Avg. iterations per matching = %f\n", num_iterations/((float)num_matchings));
-	sm_debug("sm0: Avg. seconds per matching = %f\n", seconds/num_matchings);
-	sm_debug("sm0:   that is, %d matchings per second\n", (int)floor(num_matchings/seconds));
-	sm_debug("sm0: Avg. seconds per iteration = %f (note: very imprecise)\n", seconds/num_iterations);
-	sm_debug("sm0: Number of comparisons = %d \n", distance_counter);
-	sm_debug("sm0: Avg. comparisons per ray = %f \n", 
-		(distance_counter/((float)num_iterations*params.laser_ref->nrays)));
-
-	ld_free(params.laser_ref);
-	
-	gsl_vector_free(u);
-	gsl_vector_free(x_old);
-	gsl_vector_free(x_new);
-	return 0;
-}
diff --git a/sm/apps/sm1.c b/sm/apps/sm1.c
deleted file mode 100644
index f89ef64e152dfda51bc1d9770649ed251de5eb21..0000000000000000000000000000000000000000
--- a/sm/apps/sm1.c
+++ /dev/null
@@ -1,206 +0,0 @@
-#include <time.h>
-#include <string.h>
-
-#include "../csm/csm_all.h"
-
-#include <options/options.h>
-
-struct sm1_params {
-	const char * file1;
-	const char * file2;
-	const char * file_jj;
-	const char * file_output;
-	int debug;
-	
-	int algo;
-	int write_post_mortem;
-} p;
-
-
-extern int distance_counter;
-extern void sm_options(struct sm_params*p, struct option*ops);
-
-
-const char *sm1_banner = 
-
-"There are TWO ways to define the input to this program.\n"
-"                                                       \n"
-"Say that in file A there are the scans   \n"
-"                                                       \n"
-"   A1 A2 A3 A4 ...  \n"
-"                                                       \n"
-"and in file B there are the scans  \n"
-"                                                       \n"
-"   B1 B2 B3 B4 ...  \n"
-"                                                       \n"
-"With this command line:  \n"
-"                                                       \n"
-"    sm1 --file1 A --file2 B  \n"
-"                                                       \n"
-"the matchings will be:  \n"
-"                                                       \n"
-"    (A1, B1), (A2, B2), etc.\n"
-"                                                       \n"
-"While with this command line:\n"
-"                                                       \n"
-"    sm1 --file1 A --file2 A\n"
-"                                                       \n"
-"the matchings will be \n"
-"                                                       \n"
-"    (A1, A2), (A3, A4), (A5, A6), ... \n"
-"                                                       \n";
-	
-	
-int main(int argc, const char*argv[]) {
-	sm_set_program_name(argv[0]);
-	options_banner(sm1_banner);
-	
-	struct sm_params params;
-	struct sm_result result;
-	
-	struct option* ops = options_allocate(100);
-	options_string(ops, "file1", &p.file1, "file1.txt",
-		"File with first series of scans (at pose1)");
-	options_string(ops, "file2", &p.file2, "file2.txt",
-		"File with second series of scans (at pose2)");
-	options_string(ops, "file_jj", &p.file_jj, "",
-		"File for journaling -- if left empty, journal not open.");
-	options_string(ops, "out", &p.file_output, "stdout", "Output file (JSON structs)");
-	options_int(ops, "algo", &p.algo, 0, "Which algorithm to use (0:(pl)ICP 1:gpm-stripped 2:HSM) ");
-
-	options_int(ops, "debug", &p.debug, 0, "Shows debug information");
-	options_int(ops, "write_post_mortem", &p.write_post_mortem, 1, "In case of failure, writes a post mortem.");
-
-	sm_options(&params, ops);
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "\n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-	sm_debug_write(p.debug);
-
-	FILE * file1 = open_file_for_reading(p.file1);
-	FILE * file2 = !strcmp(p.file1, p.file2) ? file1 
-		: open_file_for_reading(p.file2);
-	if(!file1 || !file2) return -1;
-	
-	FILE * out = open_file_for_writing(p.file_output);
-	if(!out) return -2;
-	
-	if(strcmp(p.file_jj, "")) {
-		FILE * jj = open_file_for_writing(p.file_jj);
-		if(!jj) return -1;
-		jj_set_stream(jj);
-	}
-	
-	LDP ld1, ld2;
-	int count = 0;
-	while(1) {
-		count++;
-		
-		ld1 = ld_from_json_stream(file1);
-		if(!ld1) {
-			if(feof(file1)) break;
-			sm_error("Invalid data in file1 '%s' \n", p.file1);
-			return 2;
-		}
-		ld2 = ld_from_json_stream(file2);
-		if(!ld2) {
-			if(feof(file2)) break;
-			sm_error("Invalid data in file2 '%s' \n", p.file2);
-			return 3;
-		}
-		
-		params.laser_ref = ld1;
-		params.laser_sens = ld2;
-
-		if(	any_nan(params.laser_ref->odometry,3) ||  
-			any_nan(params.laser_sens->odometry,3) ) {
-				sm_error("The 'odometry' field is set to NaN so I don't know how to get an initial guess. I usually use the difference in the odometry fields to obtain the initial guess.\n");
-				sm_error(" (file %s) laser_ref->odometry = %s \n", p.file1, friendly_pose(params.laser_ref->odometry) );
-				sm_error(" (file %s) laser_sens->odometry = %s \n", p.file2, friendly_pose(params.laser_sens->odometry) );
-				sm_error(" I will quit it here. \n");
-				return 3;
-		}
-		
-		pose_diff_d( params.laser_sens->odometry,  
-		/* o minus */ params.laser_ref->odometry,
-			/* = */ params.first_guess);
-
-		/* Do the actual work */
-		switch(p.algo) {
-			case(0):
-				sm_icp(&params, &result); break;
-			case(1):
-				sm_gpm(&params, &result); break;
-			case(2):
-				sm_hsm(&params, &result); break;
-			default:
-				sm_error("Unknown algorithm to run: %d.\n",p.algo);
-				return -1;
-		}
-		
-		if(p.write_post_mortem && !result.valid) {
-			char casename[256];
-			sprintf(casename, "sm1_failure_matching%d", count);
-			sm_error("sm1: matching #%d failed. Writing a special case %s.\n", count, casename );
-//			save_testcase(&params)
-			
-			char file_config[256],file1[256],file2[256],file_jj[256],script[256];
-			
-			sprintf(file_config, "%s.config", casename);
-			sprintf(file1, "%s_laser_ref.json", casename);
-			sprintf(file2, "%s_laser_sens.json", casename);
-			sprintf(file_jj, "%s.journal", casename);
-			sprintf(script, "%s.sh", casename);
-			
-			FILE * f = fopen(file_config, "w");
-			options_dump(ops,f,0);
-			fclose(f);
-
-			f = fopen(file1, "w");
-			ld_write_as_json(params.laser_ref,f);
-			fclose(f);
-			
-			f = fopen(file2, "w");
-			ld_write_as_json(params.laser_sens,f);
-			fclose(f);
-			
-			f = fopen(script, "w");
-			fprintf(f, "#!/bin/bash\n");
-			fprintf(f, "%s -config %s -file1 %s -file2 %s -debug 1 -file_jj %s -write_post_mortem 0 \n", 
-				argv[0], file_config, file1, file2, file_jj);
-			fprintf(f, "sm_animate -in %s -out %s_anim.pdf \n", file_jj, casename);
-			fclose(f);
-		}
-		
-		
-		JO jo = result_to_json(&params, &result);
-
-			double true_x[3];
-			pose_diff_d(params.laser_sens->true_pose, 
-				params.laser_ref->true_pose, true_x);
-			double true_e[3];
-			
-			pose_diff_d(result.x, true_x, true_e);
-		/*	int i=0;for(;i<3;i++) true_e[i] = result.x[i] - true_x[i];*/
-			
-			jo_add_double_array(jo, "true_x", true_x, 3);
-			jo_add_double_array(jo, "true_e", true_e, 3);
-			
-		fputs(json_object_to_json_string(jo), out);
-		fputs("\n",out);
-		
-		jo_free(jo);
-		ld_free(ld1);
-		ld_free(ld2);
-	}
-	
-	fclose(file1);
-	if(file2 != file1) fclose(file2);
-	fclose(out);
-	
-	
-	return 0;
-}
diff --git a/sm/apps/sm2.c b/sm/apps/sm2.c
deleted file mode 100644
index b8f282a627e15c136f5247f0740dc0a061d7cfd9..0000000000000000000000000000000000000000
--- a/sm/apps/sm2.c
+++ /dev/null
@@ -1,190 +0,0 @@
-#include <time.h>
-#include <string.h>
-#include <libgen.h>
-
-#include <options/options.h>
-#include "../csm/csm_all.h"
-
-struct {
-	const char * file_in;
-	const char * file_out;
-	const char * file_out_stats;
-	const char * file_jj;
-	int format;
-	
-	/* which algorithm to run */
-	int algo;
-	
-	int recover_from_error;
-	
-	int debug;
-} p;
-
-extern void sm_options(struct sm_params*p, struct option*ops);
-
-void spit(LDP ld, FILE * stream);
-
-int main(int argc, const char*argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	struct sm_params params;
-	struct sm_result result;
-	
-	struct option* ops = options_allocate(100);
-	options_string(ops, "in", &p.file_in, "stdin", "Input file ");
-	options_string(ops, "out", &p.file_out, "stdout", "Output file ");
-	options_string(ops, "out_stats", &p.file_out_stats, "", "Output file (stats) ");
-	options_string(ops, "file_jj", &p.file_jj, "",
-		"File for journaling -- if left empty, journal not open.");
-	options_int(ops, "algo", &p.algo, 0, "Which algorithm to use (0:(pl)ICP 1:gpm-stripped 2:HSM) ");
-	
-	options_int(ops, "debug", &p.debug, 0, "Shows debug information");
-	options_int(ops, "recover_from_error", &p.recover_from_error, 0, "If true, tries to recover from an ICP matching error");
-	
-	
-	p.format = 0;
-/*	options_int(ops, "format", &p.format, 0,
-		"Output format (0: log in JSON format, 1: log in Carmen format (not implemented))");*/
-	
-	sm_options(&params, ops);
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "\n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-	sm_debug_write(p.debug);
-
-	/* Open input and output files */
-	
-	FILE * file_in = open_file_for_reading(p.file_in);
-	if(!file_in) return -1;
-	FILE * file_out = open_file_for_writing(p.file_out);
-	if(!file_out) return -1;
-	
-	if(strcmp(p.file_jj, "")) {
-		FILE * jj = open_file_for_writing(p.file_jj);
-		if(!jj) return -1;
-		jj_set_stream(jj);
-	}
-	
-	FILE * file_out_stats = 0;
-	if(strcmp(p.file_out_stats, "")) {
-		file_out_stats = open_file_for_writing(p.file_out_stats);
-		if(!file_out_stats) return -1;
-	}
-	
-	/* Read first scan */
-	LDP laser_ref;
-	if(!(laser_ref = ld_read_smart(file_in))) {
-		sm_error("Could not read first scan.\n");
-		return -1;
-	}
-	if(!ld_valid_fields(laser_ref))  {
-		sm_error("Invalid laser data in first scan.\n");
-		return -2;
-	}
-	
-	
-	/* For the first scan, set estimate = odometry */
-	copy_d(laser_ref->odometry, 3, laser_ref->estimate);
-	
-	spit(laser_ref, file_out);
-	int count=-1;
-	LDP laser_sens;
-	while( (laser_sens = ld_read_smart(file_in)) ) {
-		
-		count++;
-		if(!ld_valid_fields(laser_sens))  {
-			sm_error("Invalid laser data in (#%d in file).\n", count);
-			return -(count+2);
-		}
-		
-		params.laser_ref  = laser_ref;
-		params.laser_sens = laser_sens;
-
-		/* Set first guess as the difference in odometry */
-		
-		if(	any_nan(params.laser_ref->odometry,3) ||  
-			any_nan(params.laser_sens->odometry,3) ) {
-				sm_error("The 'odometry' field is set to NaN so I don't know how to get an initial guess. I usually use the difference in the odometry fields to obtain the initial guess.\n");
-				sm_error("  laser_ref->odometry = %s \n",  friendly_pose(params.laser_ref->odometry) );
-				sm_error("  laser_sens->odometry = %s \n", friendly_pose(params.laser_sens->odometry) );
-				sm_error(" I will quit it here. \n");
-				return -3;
-		}
-		
-		double odometry[3];
-		pose_diff_d(laser_sens->odometry, laser_ref->odometry, odometry);
-		double ominus_laser[3], temp[3];
-		ominus_d(params.laser, ominus_laser);
-		oplus_d(ominus_laser, odometry, temp);
-		oplus_d(temp, params.laser, params.first_guess);
-		
-		/* Do the actual work */
-		switch(p.algo) {
-			case(0):
-				sm_icp(&params, &result); break;
-			case(1):
-				sm_gpm(&params, &result); break;
-			case(2):
-				sm_hsm(&params, &result); break;
-			default:
-				sm_error("Unknown algorithm to run: %d.\n",p.algo);
-				return -1;
-		}
-		
-		if(!result.valid){
-			if(p.recover_from_error) {
-				sm_info("One ICP matching failed. Because you passed  -recover_from_error, I will try to recover."
-				" Note, however, that this might not be good in some cases. \n");
-				sm_info("The recover is that the displacement is set to 0. No result stats is output. \n");
-				
-				/* For the first scan, set estimate = odometry */
-				copy_d(laser_ref->estimate, 3, laser_sens->estimate);
-				
-				ld_free(laser_ref); laser_ref = laser_sens;
-				
-			} else {
-				sm_error("One ICP matching failed. Because I process recursively, I will stop here.\n");
-				sm_error("Use the option -recover_from_error if you want to try to recover.\n");
-				ld_free(laser_ref);
-				return 2;
-			}
-		} else {
-		
-			/* Add the result to the previous estimate */
-			oplus_d(laser_ref->estimate, result.x, laser_sens->estimate);
-
-			/* Write the corrected log */
-			spit(laser_sens, file_out);
-
-			/* Write the statistics (if required) */
-			if(file_out_stats) {
-				JO jo = result_to_json(&params, &result);
-				fputs(jo_to_string(jo), file_out_stats);
-				fputs("\n", file_out_stats);
-				jo_free(jo);
-			}
-
-			ld_free(laser_ref); laser_ref = laser_sens;
-		}
-	}
-	ld_free(laser_ref);
-	
-	return 0;
-}
-
-
-void spit(LDP ld, FILE * stream) {
-	switch(p.format) {
-		case(0): {
-			ld_write_as_json(ld, stream);
-			break;
-		}
-		case(1): {
-			/* XXX: to implement */
-			break;
-		}
-	}
-}
diff --git a/sm/apps/sm3.c b/sm/apps/sm3.c
deleted file mode 100644
index a7c94b2c89b44d3addaf7594ee13064d38cedcd8..0000000000000000000000000000000000000000
--- a/sm/apps/sm3.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#include <time.h>
-#include <string.h>
-
-#include "../csm/csm_all.h"
-
-#include <options/options.h>
-
-struct sm3_params {
-	const char * input_filename;
-	
-} p;
-extern void sm_options(struct sm_params*p, struct option*ops);
-
-extern int distance_counter;
-
-
-int main(int argc, const char*argv[]) {
-	sm_set_program_name(argv[0]);
-	
-	struct sm_params params;
-	struct sm_result result;
-	
-	struct option* ops = options_allocate(100);
-	options_string(ops, "in", &p.input_filename, "stdin",
-		"Log file");
-	
-	sm_options(&params, ops);
-	if(!options_parse_args(ops, argc, argv)) {
-		fprintf(stderr, "\n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-	FILE * file = open_file_for_reading(p.input_filename);
-	if(!file) return -1;
-	
-	LDP *lds; int lds_size;
-	if(!ld_read_all(file, &lds, &lds_size)) {
-		sm_error("Cannot read all laser scans.\n");
-		return -1;
-	}
-
-	sm_debug("Read %d scans.\n", lds_size);
-
-
-	int num_matchings = 0;
-	int num_iterations = 0;
-	clock_t start = clock();
-	
-	int i;
-	for(i=0;i<lds_size-1;i++) {
-		params.laser_ref = lds[i];
-		params.laser_sens = lds[i+1];
-
-		double odometry[3];
-		pose_diff_d(params.laser_sens->odometry, params.laser_ref->odometry, odometry);
-		double ominus_laser[3], temp[3];
-		ominus_d(params.laser, ominus_laser);
-		oplus_d(ominus_laser, odometry, temp);
-		oplus_d(temp, params.laser, params.first_guess);
-
-		sm_icp(&params,&result); 
-		
-		num_matchings++;
-		num_iterations += result.iterations;
-		
-		fprintf(stderr, "."); 
-	}
-	
-	clock_t end = clock();
-	float seconds = (end-start)/((float)CLOCKS_PER_SEC);
-	
-	if(num_matchings>0) {
-		printf("sm3: CPU time = %f (seconds) (start=%d end=%d)\n", seconds,(int)start,(int)end);
-		printf("sm3: Total number of matchings = %d\n", num_matchings);
-		printf("sm3: Total number of iterations = %d\n", num_iterations);
-		printf("sm3: Avg. iterations per matching = %f\n", num_iterations/((float)num_matchings));
-		printf("sm3: Avg. seconds per matching = %f\n", seconds/num_matchings);
-		printf("sm3:   that is, %d matchings per second\n", (int)floor(num_matchings/seconds));
-		printf("sm3: Avg. seconds per iteration = %f (note: very imprecise)\n", seconds/num_iterations);
-		printf("sm3: Number of comparisons = %d \n", distance_counter);
-		printf("sm3: Avg. comparisons per ray per iteration = %f \n", 
-			(distance_counter/((float)num_iterations*params.laser_ref->nrays)));
-	} else {
-		sm_error("Empty file?\n");
-		return 1;
-	}
-	return 0;
-}
diff --git a/sm/apps/sm_animate.c b/sm/apps/sm_animate.c
deleted file mode 100644
index 7b0ad3b821d4c606e54737cc1297e6b0792cba62..0000000000000000000000000000000000000000
--- a/sm/apps/sm_animate.c
+++ /dev/null
@@ -1,229 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <float.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <cairo-pdf.h>
-
-#include <options/options.h>
-
-#include "../csm/csm_all.h"
-#include "../csm/laser_data_drawing.h"
-#include "../csm/laser_data_cairo.h"
-
-typedef struct {
-	const char * file_input;
-
-	const char * file_output;
-	
-	ld_style laser_ref_s, laser_sens_s;
-	/* Drawing style for correspondences */
-	line_style corr;
-	
-	
-	double max_width_cm;
-	double max_height_cm;
-	
-	int max_iterations;
-	int zoom_ray;
-	
-	/* maximum size, in points, of the output pdf */
-	int width_pt, height_pt;
-	
-	/* Padding, in meters, to be added */
-	double padding;
-	
-	int write_info;
-} anim_params ;
-
-int draw_animation( anim_params* p, JO jo, const char*filename);
-void set_defaults(anim_params *p);
-
-
-int main(int argc, const char** argv)
-{
-	sm_set_program_name(argv[0]);
-
-	anim_params p;
-	set_defaults(&p);
-	
-	struct option* ops = options_allocate(100);
-	options_string(ops, "in", &p.file_input, "stdin", "Input file (defaults to stdin)");
-	options_string(ops, "out", &p.file_output, "sm_animate_%02d.pdf", "Output file ");
-
-	options_int(ops, "write_info", &p.write_info, 0, "Writes informations and statistics in the picture.");
-	options_int(ops, "max_iterations", &p.max_iterations, 10, "Maximum number of iterations");
-	options_int(ops, "zoom_ray", &p.zoom_ray, -1, "If >= 0, the action is zoomed on a particular ray.");
-	options_int(ops, "width_pt", &p.width_pt, 500, "Maximum width, in points, of the PDF.");
-	options_int(ops, "height_pt", &p.height_pt, 500, "Maximum height, in points, of the PDF.");
-	options_double(ops, "padding", &p.padding, 0.2, "Padding, in meters, to be added around figure.");
-
-	lds_add_options(&(p.laser_ref_s), ops, "ref_", "");
-	lds_add_options(&(p.laser_sens_s), ops, "sens_", "");
-	ls_add_options(&(p.corr), ops, "corr_", "");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		sm_info("Draws ICP animation. It reads the output created by sm2 when given the 'file_jj' switch. \n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-
-	FILE * input = open_file_for_reading(p.file_input);
-	if(!input) return -1;
-	
-	JO jo; int count = 0;
-	while( (jo = json_read_stream(input)) ) {
-		char filename[100];
-		sprintf(filename, p.file_output, count);
-		sm_info("Writing frame %s \n", p.file_output);
-		if(!draw_animation(&p, jo, filename))
-			return -2;
-		count++;
-	}
-
-	return 0;
-}
-
-/** Returns an array with depths */
-int draw_animation(anim_params* p, JO jo, const char*filename) {
-	JO jo_ref = jo_get(jo, "laser_ref");
-	JO jo_sens = jo_get(jo, "laser_sens");
-	if(!jo_ref || !jo_sens) {
-		sm_error("Could not get laser_ref/laser_sens.\n");
-		return 0;
-	}
-	
-	LDP laser_ref = json_to_ld(jo_ref);
-	LDP laser_sens = json_to_ld(jo_sens); 
-	if(!laser_ref || !laser_sens) {
-		sm_error("Could not read laser_ref/laser_sens from JSON representation.\n");
-		return 0;
-	}
-	
-	ld_compute_cartesian(laser_ref);
-	ld_compute_cartesian(laser_sens);
-
-	double ld_min[2], ld_max[2];
-	if(p->zoom_ray == -1) {
-		double zero[3] = {0,0,0};
-		if(!ld_get_bounding_box(laser_ref, ld_min, ld_max, zero, p->laser_ref_s.horizon)){
-			sm_error("Not enough good points to establish bounding box.\n");
-			return 0;
-		}
-	} else {
-		if(p->zoom_ray < 0 || p->zoom_ray >= laser_ref->nrays || !ld_valid_ray(laser_ref, p->zoom_ray)) {
-			sm_error("Ray index #%d is not valid in laser_ref.\n", p->zoom_ray);
-			return 0;
-		}
-		
-		ld_min[0] = ld_max[0] = laser_ref->points[p->zoom_ray].p[0];
-		ld_min[1] = ld_max[1] = laser_ref->points[p->zoom_ray].p[1];
-	}
-	
-	ld_min[0] -= p->padding;
-	ld_min[1] -= p->padding;
-	ld_max[0] += p->padding;
-	ld_max[1] += p->padding;
-	
-	sm_info("Bounding box: %f %f -- %f %f\n", ld_min[0], ld_min[1], ld_max[0], ld_max[1]);
-
-	cairo_surface_t *surface;
-	cairo_t *cr;
-	
-	if(!create_pdf_surface(filename, p->width_pt, p->height_pt, 
-		ld_min, ld_max, &surface, &cr)) return 0;
-	
-	JO iterations = jo_get(jo, "iterations");
-	if(!iterations || !json_object_is_type(iterations, json_type_array)) {
-		fprintf(stderr, "Could not read iterations.\n");
-		return 0;
-	}
-	
-	int niterations = json_object_array_length(iterations);
-	if(niterations>p->max_iterations) niterations = p->max_iterations;
-	sm_info("Displaying %d iterations.\n", niterations);
-
-	int it;
-	for(it=0;it<niterations;it++) {
-		JO iteration = json_object_array_get_idx(iterations, it);
-		
-		double x_old[3], x_new[3];
-		jo_read_double_array(iteration, "x_old", x_old, 3, NAN);
-		jo_read_double_array(iteration, "x_new", x_new, 3, NAN);
-
-
-		cairo_save(cr);
-			cr_ld_draw(cr, laser_ref, &(p->laser_ref_s));
-
-			ld_compute_world_coords(laser_sens, x_old);
-
-
-			JO corr0 = jo_get(iteration, "corr0");
-			JO corr1 = jo_get(iteration, "corr1");
-			JO corr2 = jo_get(iteration, "corr2");
-			if(!corr1 || !corr2 || !corr0) {
-				sm_error("Iteration %d: could not read correspondences (field 'corr<i>'). Probably ICP failed here?\n", it);
-			} else {
-				cr_set_style(cr, &(p->corr));
-				cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);
-				json_to_corr(corr0, laser_sens->corr, laser_sens->nrays);
-				cr_ld_draw_corr(cr, laser_ref, laser_sens);
-
-				cairo_set_source_rgb (cr, 1.0, 0.0, 1.0);
-				json_to_corr(corr1, laser_sens->corr, laser_sens->nrays);
-				cr_ld_draw_corr(cr, laser_ref, laser_sens);
-
-				cairo_set_source_rgb (cr, 0.0, 1.0, 0.0);
-				json_to_corr(corr2, laser_sens->corr, laser_sens->nrays);
-				cr_ld_draw_corr(cr, laser_ref, laser_sens);
-			}
-
-			cr_set_reference(cr, x_old);
-			cr_ld_draw(cr, laser_sens, &(p->laser_sens_s));
-
-		cairo_restore(cr);
-
-		if(p->write_info) {
-			cairo_save(cr);
-				cairo_identity_matrix(cr);
-				cairo_set_font_size (cr, 20.0f);
-				cairo_select_font_face (cr, "Sans",
-				    CAIRO_FONT_SLANT_NORMAL,
-				    CAIRO_FONT_WEIGHT_NORMAL);
-
-				char text[100];
-				sprintf(text, "Iteration #%d: x_old: %s", it, friendly_pose(x_old));
-				cairo_move_to(cr,  0.0, -20.0 );
-				cairo_show_text(cr, text);
-				
-				sm_info("%s\n",text);
-			cairo_restore(cr);
-		}
-	
-		cairo_show_page (cr);
-	}
-	
-	ld_free(laser_ref);
-	ld_free(laser_sens);
-
-	cairo_destroy (cr);
-	cairo_surface_destroy (surface);
-	
-	return 1;
-}
-
-
-void set_defaults(anim_params *p) {
-	lds_set_defaults(&(p->laser_ref_s));
-	lds_set_defaults(&(p->laser_sens_s));
-	ls_set_defaults(&(p->corr));
-	p->laser_ref_s.points.color = "#00f";
-	p->laser_sens_s.points.color = "#f00";
-	p->laser_ref_s.pose.color = p->laser_ref_s.points.color;
-	p->laser_sens_s.pose.color = p->laser_sens_s.points.color;
-	p->laser_sens_s.pose_radius = 
-	p->laser_ref_s.pose_radius = 0.015;
-	
-}
-
diff --git a/sm/apps/test_json.c b/sm/apps/test_json.c
deleted file mode 100644
index f74e64c9baec13b05e27af2cf36a540285b9a031..0000000000000000000000000000000000000000
--- a/sm/apps/test_json.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "../csm/csm.h"
-
-int main() {
-	
-	LDP ld = ld_alloc_new(50);
-	JO jo = ld_to_json(ld);
-	
-	printf(json_object_to_json_string(jo));
-	
-	return 0;
-}
diff --git a/sm/apps/test_json_ld.c b/sm/apps/test_json_ld.c
deleted file mode 100644
index 0d10899edd852f0a737f51717bfd75af62a66cce..0000000000000000000000000000000000000000
--- a/sm/apps/test_json_ld.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "../csm/csm_all.h"
-
-int main() {
-	JO jo; /* the monkey */
-	LDP ld;
-	
-	while((jo = json_read_stream(stdin))) {
-		if(!(ld = json_to_ld(jo))) {
-			fprintf(stderr, "Could not transform to laser_data:\n\n");
-			fprintf(stderr, "-----\n");
-			fprintf(stderr, json_object_to_json_string(jo));
-			fprintf(stderr, "-----\n");
-			continue;
-		}
-		
-		jo = ld_to_json(ld);
-		printf(json_object_to_json_string(jo));
-		printf("\n");
-	}
-	
-	return 0;
-}
diff --git a/sm/csm/CMakeLists.txt b/sm/csm/CMakeLists.txt
deleted file mode 100644
index d87efe9f1f26199f4dd24dd68bb75b81453a2621..0000000000000000000000000000000000000000
--- a/sm/csm/CMakeLists.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-SET(csm_sources
-	laser_data.c
-	laser_data_fisher.c
-	laser_data_json.c
-	laser_data_carmen.c
-	laser_data_load.c
-	laser_data_drawing.c
-	laser_data_bbox.c
-	
-	json_journal.c
-	math_utils.c
-	math_utils_gsl.c
-	utils.c
-	orientation.c
-	clustering.c
-	logging.c
-	sm_options.c
-	
-	icp/icp.c
-	icp/icp_loop.c
-	icp/icp_corr_dumb.c
-	icp/icp_corr_tricks.c
-	icp/icp_outliers.c
-	icp/icp_covariance.c
-	icp/icp_debug.c
-	
-	mbicp/mbicp_interface.c      
-	mbicp/MbICP.c      
-	mbicp/calcul.c     
-	mbicp/percolate.c  
-	mbicp/sp_matrix.c
-	hsm/hsm.c
-	hsm/hsm_interface.c
-	
-	gpm/gpm.c
-)
-
-IF(CAIRO_FOUND)
-	SET(csm_sources ${csm_sources} laser_data_cairo.c)
-ENDIF(CAIRO_FOUND)
-
-
-foreach(dir . hsm mbicp icp gpm structprior)
-FILE(GLOB csm_headers "${dir}/*.h")
-foreach(header ${csm_headers} )
- 	INSTALL(FILES ${header} DESTINATION include/csm/${dir})
-endforeach(header ${csm_headers})
-endforeach(dir . csm)
-
-
-
diff --git a/sm/csm/csm.h b/sm/csm/csm.h
deleted file mode 100644
index 56f191914202efef9486e202d99f3205534f1a51..0000000000000000000000000000000000000000
--- a/sm/csm/csm.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef H_CSM_H
-#define H_CSM_H
-
-/* Some preprocessor magic for calling this library from C++ */
-
-#ifdef __cplusplus
-	namespace CSM {}
-	extern "C" {
-#endif
-
-#include "laser_data.h"
-#include "laser_data_drawing.h"
-#include "laser_data_json.h"
-#include "algos.h"
-#include "utils.h"
-
-#ifdef __cplusplus
-	}
-#endif
-
-#endif
diff --git a/sm/csm/gpm/gpm.c b/sm/csm/gpm/gpm.c
deleted file mode 100644
index cf88254a8206f7100fcbd0a22f1dd5ba5f89584f..0000000000000000000000000000000000000000
--- a/sm/csm/gpm/gpm.c
+++ /dev/null
@@ -1,286 +0,0 @@
-#include <gsl/gsl_histogram.h>
-#include <gsl/gsl_matrix.h>
-
-
-#include "../csm_all.h"
-#include "gpm.h"
-
-#include <egsl/egsl_macros.h>
-
-	
-void sm_gpm(struct sm_params*params, struct sm_result*res) {
-	res->valid = 0;
-	/* Check for well-formedness of the input data */
-	if(!ld_valid_fields(params->laser_ref) || 
-	   !ld_valid_fields(params->laser_sens)) {
-		return;
-	}
-	
-	LDP laser_ref  = params->laser_ref;
-	LDP laser_sens = params->laser_sens;
-	
-	/* We need to compute cartesian points */
-	ld_compute_cartesian(laser_ref);
-	/* ... and orientation */
-	ld_simple_clustering(laser_ref, params->clustering_threshold);
-	ld_compute_orientation(laser_ref, params->orientation_neighbourhood, params->sigma);
-	/* ... for both scans. */
-	ld_compute_cartesian(laser_sens);
-	ld_simple_clustering(laser_sens, params->clustering_threshold);
-	ld_compute_orientation(laser_sens, params->orientation_neighbourhood, params->sigma);
-
-	/* Create an histogram whose bin is large `theta_bin_size` */
-	double theta_bin_size = deg2rad(params->gpm_theta_bin_size_deg);
-	double hist_min = -M_PI-theta_bin_size; /* be robust */
-	double hist_max = +M_PI+theta_bin_size;
-	size_t nbins = (size_t) ceil(  (hist_max-hist_min) / theta_bin_size);
-	gsl_histogram*hist = gsl_histogram_alloc(nbins);
-	gsl_histogram_set_ranges_uniform(hist, hist_min, hist_max);
-	
-	/* Fill the histogram with samples */
-	double u[3]; copy_d(params->first_guess, 3, u);
-	sm_debug("gpm 1/2: old u = : %s \n", friendly_pose(u) );
-	
-	int interval = params->gpm_interval;
-	
-	int num_correspondences_theta=-1;
-	
-	
-	ght_find_theta_range(laser_ref, laser_sens,
-		u, params->max_linear_correction,
-		params->max_angular_correction_deg, interval, hist, &num_correspondences_theta);
-		
-	if(num_correspondences_theta < laser_ref->nrays) {
-		sm_error("sm_gpm(): I found only %d correspondences in the first pass of GPM. I consider it a failure.\n",
-			num_correspondences_theta);
-		return;
-	}
-	
-	/* Find the bin with most samples */
-	size_t max_bin = gsl_histogram_max_bin(hist);
-	
-	/* Around that value will be the range admissible for theta */
-	double min_range, max_range;
-	gsl_histogram_get_range(hist,max_bin,&min_range,&max_range);
-	
-	/* Extend the range of the search */
-	double extend_range = deg2rad(params->gpm_extend_range_deg);
-	min_range += -extend_range;
-	max_range += +extend_range;
-
-	/*	if(jf()) fprintf(jf(), "iteration 0\n");
-	journal_pose("x_old", u);*/
-
-
-	/*	if(jf()) fprintf(jf(), "iteration 1\n");
-	journal_pose("x_old", u);*/
-
-
-	/* Now repeat the samples generation with a smaller domain */
-	u[2] = 0.5 * (max_range + min_range);
-	double new_range_deg = rad2deg( 0.5*(max_range - min_range) );
-	
-	double x_new[3];
-	int num_correspondences=-1;
-	ght_one_shot(laser_ref, laser_sens,
-			u, params->max_linear_correction*2,
-			new_range_deg, interval, x_new, &num_correspondences) ;
-			
-	if(num_correspondences < laser_ref->nrays) {
-		sm_error("sm_gpm(): I found only %d correspondences in the second pass of GPM. I consider it a failure.\n",
-			num_correspondences);
-		return;
-	}
-
-	/* Et voila, in x_new we have the answer */
-
-	{
-		sm_debug("gpm : max_correction_lin %f def %f\n", params->max_linear_correction, 		params->max_angular_correction_deg);
-		sm_debug("gpm : acceptable range for theta: [%f, %f]\n", min_range,max_range);
-		sm_debug("gpm : 1) Num correspondences for theta: %d\n", num_correspondences_theta);
-
-		sm_debug("gpm 1/2: new u = : %s \n", friendly_pose(u) );
-		sm_debug("gpm 1/2: New range: %f to %f\n",rad2deg(min_range),rad2deg(max_range));
-
-		sm_debug("gpm 2/2: Solution: %s \n", friendly_pose(x_new));
-	/*	if(jf()) fprintf(jf(), "iteration 2\n");
-		journal_pose("x_old", x_new);	*/
-	}
-
-	/* Administrivia */
-
-	res->valid = 1;
-	copy_d(x_new, 3, res->x);
-	
-	res->iterations = 0;
-	
-	gsl_histogram_free(hist);
-}
-
-void ght_find_theta_range(LDP laser_ref, LDP laser_sens,
-	const double*x0, double max_linear_correction,
-	double max_angular_correction_deg, int interval, gsl_histogram*hist, int*num_correspondences) 
-{
-	/** Compute laser_sens's points in laser_ref's coordinates by roto-translating by x0 */
-	ld_compute_world_coords(laser_sens, x0);
-	
-	int count = 0;
-	int i;
-	for(i=0;i<laser_sens->nrays;i++) {
-		if(!laser_sens->alpha_valid[i]) continue;
-		if(i % interval) continue;
-		
-		const double * p_i = laser_sens->points[i].p;
-		
-		const double * p_i_w = laser_sens->points_w[i].p;
-		int from; int to; int start_cell;
-		possible_interval(p_i_w, laser_ref, max_angular_correction_deg,
-			max_linear_correction, &from, &to, &start_cell);
-
-//		printf("\n i=%d interval = [%d,%d] ", i, from, to);
-		int j;
-		for(j=from;j<=to;j++) {
-			if(!laser_ref->alpha_valid[j]) continue;
-			if(j % interval) continue;
-			
-			double theta = angleDiff(laser_ref->alpha[j], laser_sens->alpha[i]);
-			double theta_diff = angleDiff(theta,x0[2]); 
-			if( fabs(theta_diff) > deg2rad(max_angular_correction_deg) )
-				continue;
-			theta = x0[2] + theta_diff; // otherwise problems near +- PI
-	
-			const double * p_j = laser_ref->points[j].p;
-			
-			double c = cos(theta); double s = sin(theta);
-			double t_x = p_j[0] - (c*p_i[0]-s*p_i[1]);
-			double t_y = p_j[1] - (s*p_i[0]+c*p_i[1]);
-			double t_dist = sqrt( square(t_x-x0[0]) + square(t_y-x0[1]) );
-
-			if(t_dist > max_linear_correction)
-				continue;
-				
-			/*double weight = 1/(laser_sens->cov_alpha[i]+laser_ref->cov_alpha[j]);*/
-			double weight = 1;
-			gsl_histogram_accumulate(hist, theta, weight);
-			gsl_histogram_accumulate(hist, theta+2*M_PI, weight); /* be robust */
-			gsl_histogram_accumulate(hist, theta-2*M_PI, weight);
-			count ++;
-		}
-	}
-	*num_correspondences = count;
-	sm_debug(" correspondences = %d\n",count);
-}
-
-void ght_one_shot(LDP laser_ref, LDP laser_sens,
-		const double*x0, double max_linear_correction,
-	double max_angular_correction_deg, int interval, double*x, int*num_correspondences) 
-{
-	/** Compute laser_sens's points in laser_ref's coordinates by roto-translating by x0 */
-	ld_compute_world_coords(laser_sens, x0);
-	
-	double L[3][3]  = {{0,0,0},{0,0,0},{0,0,0}};
-	double z[3] = {0,0,0};
-	
-	int count = 0;
-	int i;
-	for(i=0;i<laser_sens->nrays;i++) {
-		if(!laser_sens->alpha_valid[i]) continue;
-		if(i % interval) continue;
-		
-
-		const double * p_i = laser_sens->points_w[i].p;
-
-		const double * p_i_w = laser_sens->points_w[i].p;
-		int from; int to; int start_cell;
-		possible_interval(p_i_w, laser_ref, max_angular_correction_deg,
-			max_linear_correction, &from, &to, &start_cell);
-//		from = 0; to = laser_ref->nrays-1;
-		
-
-		int j;
-		for(j=from;j<=to;j++) {
-			if(j % interval) continue;
-			if(!laser_ref->alpha_valid[j]) continue;
-			
-			double theta = angleDiff(laser_ref->alpha[j], laser_sens->alpha[i]);
-			double theta_diff = angleDiff(theta,x0[2]); 
-			if( fabs(theta_diff) > deg2rad(max_angular_correction_deg) )
-				continue;
-			theta = x0[2] + theta_diff; // otherwise problems near +- PI
-	
-			const double * p_j = laser_ref->points[j].p;
-			
-			double c = cos(theta); double s = sin(theta);
-			double t_x = p_j[0] - (c*p_i[0]-s*p_i[1]);
-			double t_y = p_j[1] - (s*p_i[0]+c*p_i[1]);
-			double t_dist = sqrt( square(t_x-x0[0]) + square(t_y-x0[1]) );
-
-			if(t_dist > max_linear_correction)
-				continue;
-
-			/*double weight = 1/(laser_sens->cov_alpha[i]+laser_ref->cov_alpha[j]);
-			double weight = exp( -square(t_dist) - 5 * square(theta-x0[2]) );*/
-			
-			double weight = 1;
-			
-			double alpha = laser_ref->alpha[j];
-			double ca = cos(alpha); double sa=sin(alpha);
-
-//				printf("%d ", (int) rad2deg(theta));
-
-/*			printf("valid %d alpha %f weight %f t_x %f t_y %f\n",
-				laser_ref->alpha_valid[j],alpha,weight,
-				t_x, t_y); */
-			z[0] += weight*(ca*ca*t_x + sa*ca*t_y);
-			z[1] += weight*(sa*ca*t_x + sa*sa*t_y);
-			z[2] += weight*theta;
-			L[0][0] += weight* ca * ca;
-			L[0][1] += weight* sa * ca;
-			L[1][0] += weight* sa * ca;
-			L[1][1] += weight* sa * sa;
-			L[2][2] += weight;
-			
-			count += 1;
-		}
-	}
-	
-	*num_correspondences = count;
-
-	if(1) {
-		
-		double weight = 0.5 * count;
-		z[0] += x0[0] * weight;
-		z[1] += x0[1] * weight;
-		L[0][0] += weight;
-		L[0][1] += 0;
-		L[1][0] += 0;
-		L[1][1] += weight;
-	}
-	
-
-	egsl_push();
-		val eL = egsl_alloc(3,3);
-			size_t a,b; 
-			for(a=0;a<3;a++) 
-			for(b=0;b<3;b++) 
-				*egsl_atmp(eL,a,b) = L[a][b];
-
-/*		egsl_print("eL", eL);*/
-		val ez = egsl_vFa(3,z);
-		
-		val ex = m(inv(eL), ez);
-		
-		egsl_v2a(ex, x);
-		
-
-/*		egsl_print("eL", eL);
-		egsl_print("ez", ez);
-		egsl_print("ex", ex); */
-
-	egsl_pop();
-
-//	sm_debug("gpm: second step: theta = %f   %f / %d = %f \n", rad2deg(x[2]), rad2deg(z[2]), count, rad2deg(z[2]) / count);
-	sm_debug("gpm: second step: found %d correspondences\n",count);
-	
-}
-
diff --git a/sm/csm/gpm/gpm.h b/sm/csm/gpm/gpm.h
deleted file mode 100644
index b8d6a29aab707e786e813c8e02b6bf36fcdb9415..0000000000000000000000000000000000000000
--- a/sm/csm/gpm/gpm.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef H_GPM_STRIPPED_DOWN
-#define H_GPM_STRIPPED_DOWN
-
-#include <gsl/gsl_vector.h>
-#include <gsl/gsl_histogram.h>
-#include "../csm_all.h"
-
-void ght_find_theta_range(LDP laser_ref, LDP laser_sens,
-                const double*x0, double max_linear_correction,
-        double max_angular_correction_deg, int interval, gsl_histogram*hist, int*num_correspondences);
-
-void ght_one_shot(LDP laser_ref, LDP laser_sens,
-                const double*x0, double max_linear_correction,
-                double max_angular_correction_deg, int interval, double*x, int*num_correspondences) ;
-
-#endif
-
diff --git a/sm/csm/gpm/gpm_readme.txt b/sm/csm/gpm/gpm_readme.txt
deleted file mode 100644
index 60c6cbee6d4df94884a7c6c4f54790b137f6d5b8..0000000000000000000000000000000000000000
--- a/sm/csm/gpm/gpm_readme.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-
-This is a stripped-down version of GPM.
-It is used here as a first guess to be refined by ICP, so it does not iterate.
-
-Please see the corresponding paper:
-
-	http://purl.org/censi/2006/gpm
\ No newline at end of file
diff --git a/sm/csm/hsm/CMakeLists.txt b/sm/csm/hsm/CMakeLists.txt
deleted file mode 100644
index 508f2f70afd985a6171d93835785a76013216d03..0000000000000000000000000000000000000000
--- a/sm/csm/hsm/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-# This builds the code as itself
-
-cmake_minimum_required(VERSION 2.4)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -std=c99")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
-
-
-ADD_EXECUTABLE(hsm_test00 hsm_test00.c hsm.c)
diff --git a/sm/csm/hsm/hsm.c b/sm/csm/hsm/hsm.c
deleted file mode 100644
index d36881cda68aea4ea6a6c9b8fd7b708d2cedcf95..0000000000000000000000000000000000000000
--- a/sm/csm/hsm/hsm.c
+++ /dev/null
@@ -1,596 +0,0 @@
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include <assert.h>
-#include <time.h>
-#include "../csm_all.h"
-
-#include "hsm.h"
-
-hsm_buffer hsm_buffer_alloc(struct hsm_params*p) {
-	assert(p->max_norm>0);
-	assert(p->linear_cell_size>0);
-	assert(p->angular_cell_size_deg>0);
-	assert(p->num_angular_hypotheses >0);
-	assert(p->linear_xc_max_npeaks>0);
-	assert(p->xc_ndirections>0);
-	
-	hsm_buffer b = (hsm_buffer) malloc(sizeof(struct hsm_buffer_struct));
-
-	b->num_angular_cells = (int) ceil(360.0 / p->angular_cell_size_deg);
-	b->num_linear_cells = 1 + 2 * (int) ceil(p->max_norm / p->linear_cell_size);
-	b->linear_cell_size = p->linear_cell_size;
-	b->rho_min = - p->max_norm;
-	b->rho_max = + p->max_norm;
-
-	b->hs            =  (double*)  calloc((size_t)b->num_angular_cells, sizeof(double));
-	b->hs_cross_corr =  (double*)  calloc((size_t)b->num_angular_cells, sizeof(double));
-	b->ht            =  (double**) calloc((size_t)b->num_angular_cells, sizeof(double*));
-
-	for(int i=0; i<b->num_angular_cells; i++) {
-		b->ht[i] = (double*) calloc((size_t)b->num_linear_cells, sizeof(double));
-		for(int r=0;r<b->num_linear_cells;r++)
-			b->ht[i][r] = 0;
-	}
-
-	b->theta = (double*) calloc((size_t)b->num_angular_cells, sizeof(double));
-	b->sint  = (double*) calloc((size_t)b->num_angular_cells, sizeof(double));
-	b->cost  = (double*) calloc((size_t)b->num_angular_cells, sizeof(double));
-	for(int i=0; i<b->num_angular_cells; i++) {
-		b->theta[i] = (2 * M_PI * i) / b->num_angular_cells;
-		b->sint[i] = sin(b->theta[i]);
-		b->cost[i] = cos(b->theta[i]);
-	}
-
-	b->hs_cross_corr = (double*) calloc((size_t)b->num_angular_cells, sizeof(double));
-
-	b->max_num_results = (int) p->num_angular_hypotheses * pow( (float) p->linear_xc_max_npeaks,  (float) p->xc_ndirections);
-
-	b->num_valid_results = 0;
-	b->results = (double**) calloc((size_t)b->max_num_results, sizeof(double*));
-	for(int i=0;i<b->max_num_results; i++)
-		b->results[i] = (double*) calloc(3, sizeof(double));
-
-	b->results_quality = (double*) calloc((size_t)b->max_num_results, sizeof(double));
-
-	double zero[3] = {0,0,0};
-	hsm_compute_ht_base(b, zero);
-
-	return b;
-}
-
-void hsm_buffer_free(hsm_buffer b) {
-	
-	free(b->hs);
-	for(int i=0; i<b->num_angular_cells; i++)
-		free(b->ht[i]);
-	free(b->ht);
-	
-	free(b->theta);
-	free(b->sint);
-	free(b->cost);
-	
-	free(b->hs_cross_corr);
-	for(int i=0;i<b->max_num_results; i++)
-		free(b->results[i]);
-	free(b->results);
-
-	free(b->results_quality);
-	free(b);
-}
-
-void hsm_compute_ht_base(hsm_buffer b, const double base_pose[3]) {
-	b->disp[0] = base_pose[0];
-	b->disp[1] = base_pose[1];
-	b->disp[2] = base_pose[2];
-	b->disp_th_cos = cos(base_pose[2]);
-	b->disp_th_sin = sin(base_pose[2]);
-}
-
-void hsm_compute_ht_point(hsm_buffer b, double x0, double y0, double weight) {
-
-	double x1 = x0 * b->disp_th_cos - y0 * b->disp_th_sin + b->disp[0];
-	double y1 = x0 * b->disp_th_sin + y0 * b->disp_th_cos + b->disp[1];
-	
-	for(int i=0; i<b->num_angular_cells; i++) {
-		double rho = x1 * b->cost[i] + y1 * b->sint[i];
-		int rho_index;
-		double alpha;
-		if(!hsm_rho2index(b, rho, &rho_index, &alpha)) {
-			continue;
-		}
-
-		b->ht[i][rho_index] += (1-fabs(alpha)) * weight;
-
-		if( (alpha > 0) && (rho_index < b->num_linear_cells - 1))
-			b->ht[i][rho_index+1] += (fabs(alpha)) * weight;
-
-		if( (alpha < 0) && (rho_index > 0))
-			b->ht[i][rho_index-1] += (fabs(alpha)) * weight;
-	}
-}
-
-double mdax(double a, double b) {
-	return a>b?a:b;
-}
-
-/** Returns 0 if out of the buffer. rho_index is the closest cell,
-	alpha between -0.5 and 0.5 specifies the distance from the center of the cell. */
-int hsm_rho2index(hsm_buffer b, double rho, int *rho_index, double *alpha) {
-	*rho_index = 0; *alpha = NAN;
-	if ( (rho <= b->rho_min) || (rho >= b->rho_max) )
-		return 0;
-
-	/* x belongs to [0, n) */
-	double x = b->num_linear_cells * (rho-b->rho_min) / (b->rho_max-b->rho_min);
-	
-	if(x==b->num_linear_cells) x*=0.99999;
-	
-	*rho_index = (int) floor( x );
-	*alpha = (*rho_index+0.5)-x;
-
-	assert(fabs(*alpha) <= 0.5001);
-	assert(*rho_index >= 0);
-	assert(*rho_index < b->num_linear_cells);
-
-	return 1;
-}
-
-
-void hsm_compute_spectrum(hsm_buffer b) {
-	for(int t=0; t<b->num_angular_cells; t++) {
-		b->hs[t] = 0;
-		for(int r=0;r<b->num_linear_cells;r++)
-			b->hs[t] = max(b->hs[t], b->ht[t][r]);
-	}
-}
-
-void hsm_compute_spectrum_norm(hsm_buffer b) {
-	for(int t=0; t<b->num_angular_cells; t++) {
-		b->hs[t] = 0;
-		for(int r=0;r<b->num_linear_cells;r++)
-			b->hs[t] += b->ht[t][r] * b->ht[t][r];
-	}
-}
-
-void hsm_match(struct hsm_params*p, hsm_buffer b1, hsm_buffer b2) {
-	sm_log_push("hsm_match");
-	/* Let's measure the time */
-	clock_t hsm_match_start = clock();
-	
-	assert(b1->num_angular_cells == b2->num_angular_cells);
-	assert(p->max_translation > 0);
-	assert(b1->linear_cell_size > 0);
-
-	b1->num_valid_results = 0;
-
-	/* Compute cross-correlation of spectra */
-	hsm_circular_cross_corr_stupid(b1->num_angular_cells, b2->hs, b1->hs, b1->hs_cross_corr);
-
-	/* Find peaks in cross-correlation */
-	int peaks[p->num_angular_hypotheses], npeaks;
-	hsm_find_peaks_circ(b1->num_angular_cells, b1->hs_cross_corr, p->angular_hyp_min_distance_deg, 0, p->num_angular_hypotheses, peaks, &npeaks);
-
-	sm_debug("Found %d peaks (max %d) in cross correlation.\n", npeaks, p->num_angular_hypotheses);
-
-	if(npeaks == 0) {
-		sm_error("Cross correlation of spectra has 0 peaks.\n");
-		sm_log_pop();
-		return;
-	}
-
-	sm_log_push("loop on theta hypotheses");
-	/* lag e' quanto 2 si sposta a destra rispetto a 1 */
-	for(int np=0;np<npeaks;np++) {
-		int lag = peaks[np];
-		double theta_hypothesis = lag * (2*M_PI/b1->num_angular_cells);
-
-		sm_debug("Theta hyp#%d: lag %d, angle %fdeg\n", np, lag, rad2deg(theta_hypothesis));
-
-		/* Superimpose the two spectra */
-		double mult[b1->num_angular_cells];
-		for(int r=0;r<b1->num_angular_cells;r++)
-			mult[r] = b1->hs[r] * b2->hs[pos_mod(r-lag, b1->num_angular_cells)];
-
-		/* Find directions where both are intense */
-		int directions[p->xc_ndirections], ndirections;
-		hsm_find_peaks_circ(b1->num_angular_cells, b1->hs_cross_corr, p->xc_directions_min_distance_deg, 1, p->xc_ndirections, directions, &ndirections);
-
-		if(ndirections<2) {
-			sm_error("Too few directions.\n");
-		}
-		
-		#define MAX_NPEAKS 1024
-		assert(p->linear_xc_max_npeaks<MAX_NPEAKS);
-
-		struct {
-			/* Direction of cross correlation */
-			double angle;
-			int nhypotheses;
-			struct {
-				double delta;
-				double value;
-			// } hypotheses[p->linear_xc_max_npeaks];
-			} hypotheses[MAX_NPEAKS];
-		} dirs[ndirections];
-
-
-		sm_debug("Using %d (max %d) correlations directions.\n", ndirections, p->xc_ndirections);
-
-		int max_lag = (int) ceil(p->max_translation / b1->linear_cell_size);
-		int min_lag = -max_lag;
-		sm_debug("Max lag: %d cells (max t: %f, cell size: %f)\n",
-			max_lag, p->max_translation, b1->linear_cell_size);
-
-		sm_log_push("loop on xc direction");
-		/* For each correlation direction */
-		for(int cd=0;cd<ndirections;cd++) {
-
- 			dirs[cd].angle =  theta_hypothesis + (directions[cd]) * (2*M_PI/b1->num_angular_cells);
-
-			printf(" cd %d angle = %d deg\n", cd, (int) rad2deg(dirs[cd].angle));
-
-			/* Do correlation */
-			int    lags  [2*max_lag + 1];
-			double xcorr [2*max_lag + 1];
-
-			int i1 = pos_mod(directions[cd]        , b1->num_angular_cells);
-			int i2 = pos_mod(directions[cd] + lag  , b1->num_angular_cells);
-			double *f1 = b1->ht[i1];
-			double *f2 = b2->ht[i2];
-
-			hsm_linear_cross_corr_stupid(
-				b2->num_linear_cells,f2,
-				b1->num_linear_cells,f1,
-				xcorr, lags, min_lag, max_lag);
-
-			/* Find peaks of cross-correlation */
-			int linear_peaks[p->linear_xc_max_npeaks], linear_npeaks;
-
-			hsm_find_peaks_linear(
-				2*max_lag + 1, xcorr, p->linear_xc_peaks_min_distance/b1->linear_cell_size,
-				p->linear_xc_max_npeaks, linear_peaks, &linear_npeaks);
-
-			sm_debug("theta hyp #%d: Found %d (max %d) peaks for correlation.\n",
-				cd, linear_npeaks, p->linear_xc_max_npeaks);
-
-			dirs[cd].nhypotheses = linear_npeaks;
-			sm_log_push("Considering each peak of linear xc");
-			for(int lp=0;lp<linear_npeaks;lp++) {
-				int linear_xc_lag = lags[linear_peaks[lp]];
-				double value = xcorr[linear_peaks[lp]];
-				double linear_xc_lag_m = linear_xc_lag * b1->linear_cell_size;
-				sm_debug("lag: %d  delta: %f  value: %f \n", linear_xc_lag, linear_xc_lag_m, value);
-				dirs[cd].hypotheses[lp].delta = linear_xc_lag_m;
-				dirs[cd].hypotheses[lp].value = value;
-			}
-			sm_log_pop();
-			
-			if(p->debug_true_x_valid) {
-				double true_delta = cos(dirs[cd].angle) * p->debug_true_x[0] + 
-					sin(dirs[cd].angle) * p->debug_true_x[1];
-				sm_debug("true_x    delta = %f \n", true_delta );
-			}
-
-		} /* xc direction */
-		sm_log_pop();
-
-		sm_debug("Now doing all combinations. How many are there?\n");
-		int possible_choices[ndirections];
-		int num_combinations = 1;
-		for(int cd=0;cd<ndirections;cd++) {
-			possible_choices[cd] = dirs[cd].nhypotheses;
-			num_combinations *= dirs[cd].nhypotheses;
-		}
-		sm_debug("Total: %d combinations\n", num_combinations);
-		sm_log_push("For each combination..");
-		for(int comb=0;comb<num_combinations;comb++) {
-			int choices[ndirections];
-			hsm_generate_combinations(ndirections, possible_choices, comb, choices);
-
-			/* Linear least squares */
-			double M[2][2]={{0,0},{0,0}}; double Z[2]={0,0};
-			/* heuristic quality value */
-			double sum_values = 0;
-			for(int cd=0;cd<ndirections;cd++) {
-				double angle = dirs[cd].angle;
-				double c = cos(angle), s = sin(angle);
-				double w = dirs[cd].hypotheses[choices[cd]].value;
-				double y = dirs[cd].hypotheses[choices[cd]].delta;
-
-				M[0][0] += c * c * w;
-				M[1][0] += c * s * w;
-				M[0][1] += c * s * w;
-				M[1][1] += s * s * w;
-				Z[0] += w * c * y;
-				Z[1] += w * s * y;
-
-				sum_values += w;
-			}
-
-			double det = M[0][0]*M[1][1]-M[0][1]*M[1][0];
-			double Minv[2][2];
-			Minv[0][0] = M[1][1] * (1/det);
-			Minv[1][1] = M[0][0] * (1/det);
-			Minv[0][1] = -M[0][1] * (1/det);
-			Minv[1][0] = -M[1][0] * (1/det);
-
-			double t[2] = {
-				Minv[0][0]*Z[0] + Minv[0][1]*Z[1],
-				Minv[1][0]*Z[0] + Minv[1][1]*Z[1]};
-
-			/* copy result in results slot */
-
-			int k = b1->num_valid_results;
-			b1->results[k][0] = t[0];
-			b1->results[k][1] = t[1];
-			b1->results[k][2] = theta_hypothesis;
-			b1->results_quality[k] = sum_values;
-			b1->num_valid_results++;
-		}
-		sm_log_pop();
-
-	} /* theta hypothesis */
-	sm_log_pop();
-
-/*	for(int i=0;i<b1->num_valid_results;i++) {
-		printf("#%d %.0fdeg %.1fm %.1fm  quality %f \n",i,
-			rad2deg(b1->results[i][2]),
-			b1->results[i][0],
-			b1->results[i][1],
-			b1->results_quality[i]);
-	}*/
-
-
-	/* Sorting based on values */
-	int indexes[b1->num_valid_results];
-	for(int i=0;i<b1->num_valid_results;i++)
-		indexes[i] = i;
-
-	qsort_descending(indexes, (size_t) b1->num_valid_results, b1->results_quality);
-
-	/* copy in the correct order*/
-	double*results_tmp[b1->num_valid_results];
-	double results_quality_tmp[b1->num_valid_results];
-	for(int i=0;i<b1->num_valid_results;i++) {
-		results_tmp[i] = b1->results[i];
-		results_quality_tmp[i] = b1->results_quality[i];
-	}
-
-	for(int i=0;i<b1->num_valid_results;i++) {
-		b1->results[i] = results_tmp[indexes[i]];
-		b1->results_quality[i] = results_quality_tmp[indexes[i]];
-	}
-
-	for(int i=0;i<b1->num_valid_results;i++) {
-		char near[256]="";
-		double *x = b1->results[i];
-		if(p->debug_true_x_valid) {
-			double err_th = rad2deg(fabs(angleDiff(p->debug_true_x[2],x[2])));
-			double err_m = hypot(p->debug_true_x[0]-x[0],
-				p->debug_true_x[1]-x[1]);
-			const char * ast = (i == 0) && (err_th > 2) ? "   ***** " : "";
-			sprintf(near, "th err %4d  err_m  %5f %s",(int)err_th ,err_m,ast);
-		}
-		if(i<10)
-		printf("after #%d %3.1fm %.1fm %3.0fdeg quality %5.0f \t%s\n",i,
-			x[0],
-			x[1], rad2deg(x[2]), b1->results_quality[i], near);
-	}
-	
-	
-	/* How long did it take? */
-	clock_t hsm_match_stop = clock();
-	int ticks = hsm_match_stop-hsm_match_start;
-	double ctime = ((double)ticks) / CLOCKS_PER_SEC;
-	sm_debug("Time: %f sec (%d ticks)\n", ctime, ticks);
-	
-	sm_log_pop();
-}
-
-
-void hsm_generate_combinations(int nslots, const int possible_choices[],
-	int i, int i_choice[])
-{
-	for(int slot=0;slot<nslots;slot++) {
-		i_choice[slot] = i % possible_choices[slot];
-		i = (i - i % possible_choices[slot]) / possible_choices[slot];
-	}
-}
-
-void hsm_find_peaks_circ(int n, const double*f, double min_angle_deg, int unidir, int max_peaks,
-	int*peaks, int* npeaks)
-{
-	sm_log_push("hsm_find_peaks_circ");
-
-	assert(max_peaks>0);
-
-	/* Find all local maxima for the function */
-	int maxima[n], nmaxima;
-	hsm_find_local_maxima_circ(n, f, maxima, &nmaxima);
-
-	sm_debug("Found %d of %d are local maxima.\n", nmaxima, n);
-
-	/* Sort based on value */
-	qsort_descending(maxima, (size_t) nmaxima, f);
-
-	*npeaks = 0;
-
-	sm_log_push("For each maximum");
-	/* Only retain a subset of these */
-	for(int m=0;m<nmaxima;m++) {
-		/* Here's a candidate maximum */
-		int candidate = maxima[m];
-		double candidate_angle = candidate * (2*M_PI/n);
-		/* Check that is not too close to the already accepted maxima */
-		int acceptable = 1;
-		for(int a=0;a<*npeaks;a++) {
-			int other = peaks[a];
-			double other_angle = other * (2*M_PI/n);
-
-			if(hsm_is_angle_between_smaller_than_deg(candidate_angle,other_angle,min_angle_deg)) {
-				acceptable = 0; break;
-			}
-
-			/* If unidir, check also +M_PI */
-			if(unidir)
-			if(hsm_is_angle_between_smaller_than_deg(candidate_angle+M_PI,other_angle,min_angle_deg)) {
-				acceptable = 0; break;
-			}
-
-		}
-
-		sm_debug("%saccepting candidate %d; lag = %d value = %f\n",
-			acceptable?"":"not ", m, maxima[m], f[maxima[m]]);
-
-		if(acceptable) {
-			peaks[*npeaks] = candidate;
-			(*npeaks) ++;
-		}
-
-		if(*npeaks>=max_peaks) break;
-	}
-	sm_log_pop();
-
-	sm_debug("found %d (max %d) maxima.\n", *npeaks, max_peaks);
-	sm_log_pop();
-}
-
-
-void hsm_find_peaks_linear(int n, const double*f, double min_dist, int max_peaks,
-	int*peaks, int* npeaks)
-{
-	sm_log_push("hsm_find_peaks_linear");
-
-	assert(max_peaks>0);
-
-	/* Find all local maxima for the function */
-	int maxima[n], nmaxima;
-	hsm_find_local_maxima_linear(n,f,maxima,&nmaxima);
-
-	sm_debug("Found %d of %d are local maxima.\n", nmaxima, n);
-
-	/* Sort based on value */
-	qsort_descending(maxima, (size_t) nmaxima,  f);
-
-	*npeaks = 0;
-	sm_log_push("for each maximum");
-	/* Only retain a subset of these */
-	for(int m=0;m<nmaxima;m++) {
-		/* Here's a candidate maximum */
-		int candidate = maxima[m];
-		/* Check that is not too close to the already accepted maxima */
-		int acceptable = 1;
-		for(int a=0;a<*npeaks;a++) {
-			int other = peaks[a];
-
-			if(abs(other-candidate) < min_dist) {
-				acceptable = 0; break;
-			}
-		}
-
-		sm_debug("%s accepting candidate %d; lag = %d value = %f\n",
-			acceptable?"":"not", m, maxima[m], f[maxima[m]]);
-
-		if(acceptable) {
-			peaks[*npeaks] = candidate;
-			(*npeaks) ++;
-		}
-
-		if(*npeaks >= max_peaks) break;
-	}
-	sm_log_pop("");
-	sm_debug("Found %d (max %d) maxima.\n", *npeaks, max_peaks);
-
-	sm_log_pop();
-}
-
-
-int hsm_is_angle_between_smaller_than_deg(double angle1, double angle2, double threshold_deg) {
-	double dot = cos(angle1)*cos(angle2) + sin(angle1)*sin(angle2);
-	return (dot > cos(threshold_deg * M_PI/180));
-}
-
-void hsm_find_local_maxima_circ(int n, const double*f, int*maxima, int*nmaxima) {
-	*nmaxima = 0;
-	for(int i=0;i<n;i++) {
-		double val = f[i];
-		double left  = f[ pos_mod(i-1,n) ];
-		double right = f[ pos_mod(i+1,n) ];
-		if( (val>0) && (val>left) && (val>right))
-			maxima[(*nmaxima)++] = i;
-	}
-}
-
-
-void hsm_find_local_maxima_linear(int n, const double*f, int*maxima, int*nmaxima) {
-	*nmaxima = 0;
-	for(int i=1;i<n-1;i++) {
-		double val = f[i];
-		double left = f[i-1];
-		double right = f[i+1];
-		if( (val>0) && (val>left) && (val>right))
-			maxima[(*nmaxima)++] = i;
-	}
-}
-
-
-
-void hsm_circular_cross_corr_stupid(int n, const double *a, const double *b, double*res) {
-	/* Two copies of f1 */
-	double aa[2*n];
-	for(int i=0;i<2*n;i++) aa[i] = a[i%n];
-	for(int lag=0;lag<n;lag++) {
-		res[lag] = 0;
-		for(int j=0;j<n;j++)
-			res[lag] += b[j] * aa[j+lag];
-	}
-}
-
-
-void hsm_linear_cross_corr_stupid(int na, const double *a, int nb, const double *b, double*res, int*lags, int min_lag, int max_lag) {
-	assert(a); 
-	assert(b);
-	assert(res);
-	assert(lags);
-	
-	for(int l=min_lag;l<=max_lag;l++) {
-		lags[l-min_lag] = l;
-		
-		double r = 0;
-		for(int j=0; (j<nb) && (j+l<na);j++) {
-			// j + l >= 0
-			if(j+l>=0)
-			r += b[j] * a[j+l];
-		}
-	
-		res[l-min_lag] = r;
-
-	}
-}
-
-
-const double *qsort_descending_values = 0;
-
-int compare_descending(const void *index_pt1, const void *index_pt2) {
-	int i1 = *( (const int*) index_pt1);
-	int i2 = *( (const int*) index_pt2);
-	const double * f = qsort_descending_values;
-	return f[i1] < f[i2] ? +1 : f[i1] == f[i2] ? 0 : -1;
-}
-
-void qsort_descending(int *indexes, size_t nmemb, const double*values)
-{
-	qsort_descending_values = values;
-	qsort(indexes, nmemb, sizeof(int), compare_descending);
-}
-
-
-
-/** Positive modulo */
-int pos_mod(int a, int b) {
-	return ((a%b)+b)%b;
-}
-
-
-
diff --git a/sm/csm/hsm/hsm.h b/sm/csm/hsm/hsm.h
deleted file mode 100644
index 3caed064e4251c5ffe2f3b5471b081fbc4f27e68..0000000000000000000000000000000000000000
--- a/sm/csm/hsm/hsm.h
+++ /dev/null
@@ -1,160 +0,0 @@
-#ifndef H_CSM_HSM
-#define H_CSM_HSM
-
-#include <stdlib.h>
-/** Public interface */
-
-struct hsm_params {
-	/** Max norm for the points (m) (used to define Hough domain) */
-	double max_norm;
-	/** Size of a linear cell (m)*/
-	double linear_cell_size;
-	/** Size of an angular cell (deg)*/
-	double angular_cell_size_deg;
-		
-	/** Number of hypotheses for theta */
-	int num_angular_hypotheses;
-	
-	/** Minimum distance between angular hypotheses */
-	double angular_hyp_min_distance_deg;
-	
-	
-	/** Number of directions to consider to execute crosscorrelation to find T */
-	int xc_ndirections;
-	
-	/** Minimum distance between said directions */
-	double xc_directions_min_distance_deg;
-
-
-	/** Number of peakks to consider for each linear correlation */
-	int linear_xc_max_npeaks;
-
-	/** Minimum distance between said peaks */
-	double linear_xc_peaks_min_distance;
-	
-
-
-	double max_translation;
-
-	/** For debugging purpose, set this to 1 and fill next field */
-	int debug_true_x_valid;
-	/** True result, used for debugging purposes */
-	double debug_true_x[3];
-};
-
-
-struct hsm_buffer_struct {
-	/** Fields used for computing */
-		
-		/** Length of hs,theta,sint,cost,etc.*/
-		int num_angular_cells;	
-		
-		/** Num of cells for rho */
-		int num_linear_cells;
-		
-		/** Size of a cell for rho */
-		double linear_cell_size;
-		
-		/** Interval for rho */
-		double rho_min, rho_max;
-
-		/** Hough Transform. Access as: ht[theta][rho] */
-		double **ht;
-
-		/** Hough Spectrum */
-		double *hs;
-
-	/** Results */
-	
-		/** Size of results array */
-		int max_num_results;
-		
-		/** Number of valid entries in the results array */
-		int num_valid_results;
-
-		/** List of poses; theta = results[i][2] */
-		double **results;
-
-		/** Quality of results */
-		double *results_quality;
-	
-
-	/** Private fields */	
-		double *theta;
-
-		/** Used during computation of HT */
-		double *sint,*cost;
-	
-		/** Used during matching */
-		double *hs_cross_corr;
-		
-		/** Displacement to be added. See function hsm_compute_ht_base */
-		double disp[3];
-		double disp_th_cos, disp_th_sin;
-};
-
-typedef struct hsm_buffer_struct* hsm_buffer;
-
-
-	/** Allocates the buffer structures. Remember to call hsm_buffer_free afterwards */
-	hsm_buffer hsm_buffer_alloc(struct hsm_params*);
-	
-	/** Frees the buffer structure */
-	void hsm_buffer_free(hsm_buffer);
-
-	/** Adds a point to the Hough Transform */
-	void hsm_compute_ht_point(hsm_buffer, double x, double y, double weight);
-
-
-	void hsm_match(struct hsm_params*p, hsm_buffer b1, hsm_buffer b2);
-
-	/** Private interface */
-
-	/** This adds a base displacement to the point added by hsm_compute_ht_point */
-	void hsm_compute_ht_base(hsm_buffer, const double base_pose[3]);
-	
-	/** Computes the spectrum in the buffer */
-	void hsm_compute_spectrum(hsm_buffer);	
-
-	void hsm_compute_spectrum_norm(hsm_buffer b);
-	
-	/** Finds the local maxima for a circular function. 
-	    @maxima is a pointer to a struct of size n 
-	    @nmaxima returns the number of maxima found */
-	void hsm_find_local_maxima_circ(int n, const double*f, int*maxima, int*nmaxima);
-	
-	/** Returns true if @angle1 (rad) and @angle2 (rad) are closer than @threshold_deg (degrees!) */
-	int hsm_is_angle_between_smaller_than_deg(double angle1, double angle2, double threshold_deg);
-
-
-	/** Returns 0 if out of the buffer. rho_index is the closest cell, 
-	    alpha between -0.5 and 0.5 specifies the distance from the center of the cell. */
-	int hsm_rho2index(hsm_buffer b, double rho, int *rho_index, double *alpha);
-
-	/** Creates circular cross-correlation in a stupid way */
-	void hsm_circular_cross_corr_stupid(int n, const double *a, const double *b, double*res);
-	
-	/** Finds the peaks of a circular function @f of length @n. */
-	void hsm_find_peaks_circ(int n, const double*f, double min_angle_deg, int unidir, int max_peaks, 
-		int*peaks, int* npeaks) ;
-
-	void hsm_find_peaks_linear(int n, const double*f, double min_dist, int max_peaks, 
-		int*peaks, int* npeaks);
-	void hsm_find_local_maxima_linear(int n, const double*f, int*maxima, int*nmaxima);
-	 
-	void hsm_linear_cross_corr_stupid(int na, const double *a, int nb, const double *b, double*res, int*lags, int min_lag, int max_lag);
-
-	void hsm_generate_combinations(int nslots, const int possible_choices[], 
-		int i, int i_choice[]) ;
-
-	/* a mod b >= 0 */
-	int pos_mod(int a, int b);
-
-	/** Sorts the indexes based on the values */
-	void qsort_descending(int *indexes, size_t nmemb, const double*values);
-	
-	/* used by qsort_descending */
-	int compare_descending(const void *index_pt1, const void *index_pt2);
-
-
-#endif
diff --git a/sm/csm/hsm/hsm_interface.c b/sm/csm/hsm/hsm_interface.c
deleted file mode 100644
index 2022bf695509302202db09044caeb8c3bea71d63..0000000000000000000000000000000000000000
--- a/sm/csm/hsm/hsm_interface.c
+++ /dev/null
@@ -1,126 +0,0 @@
-#include <options/options.h>
-#include <assert.h>
-
-#include "../csm_all.h"
-
-void hsm_add_options(struct option* ops, struct hsm_params*p) {
-	options_double(ops, "hsm_linear_cell_size", &p->linear_cell_size, 0.03, "HSM: Size of a rho cell");
-	options_double(ops, "hsm_angular_cell_size_deg", &p->angular_cell_size_deg, 1.0, "HSM: Size of angualar cell (deg)");
-	options_int(ops, "hsm_num_angular_hypotheses", &p->num_angular_hypotheses, 8, "HSM: Number of angular hypotheses.");
-	options_double(ops, "hsm_xc_directions_min_distance_deg", &p->xc_directions_min_distance_deg, 10.0, "HSM: Min distance between directions for cross corr (deg)");
-	options_int(ops, "hsm_xc_ndirections", &p->xc_ndirections, 3, "HSM: Number of directions for cross corr (deg)");
-	options_double(ops, "hsm_angular_hyp_min_distance_deg", &p->angular_hyp_min_distance_deg, 10.0, "HSM: Min distance between different angular hypotheses  (deg)");
-	
-	options_int(ops, "hsm_linear_xc_max_npeaks", &p->linear_xc_max_npeaks, 5, "HSM: Number of peaks per direction for linear translation");
-	options_double(ops, "hsm_linear_xc_peaks_min_distance", &p->linear_xc_peaks_min_distance, 5.0, "HSM: Min distance between different peaks in linear correlation");
-}
-
-int hsm_compute_ht_for_scan(LDP ld, struct hsm_params*p, const double base[3], hsm_buffer *b);
-
-int hsm_compute_ht_for_scan(LDP ld, struct hsm_params*p, const double base[3], hsm_buffer *b) {
-	*b = 0;
-	
-	/** Find maximum reading for the points */
-	double max_reading = max_in_array(ld->readings, ld->nrays);
-	
-	if(!(max_reading>0)) {
-		sm_error("No valid points.\n");
-		return 0;
-	}
-	
-	p->max_norm = norm_d(base) + max_reading;
-	
-	*b = hsm_buffer_alloc(p);
-	hsm_compute_ht_base(*b, base);
-	
-	ld_compute_cartesian(ld);
-	int np = 0;
-	for(int i=0; i<ld->nrays; i++) {
-		if(!ld_valid_ray(ld, i)) continue;
-		
-		hsm_compute_ht_point(*b, ld->points[i].p[0], ld->points[i].p[1], 1.0);
-		
-		np++;
-	}
-	
-	sm_debug("Computed HT with %d points.\n", np);
-	if(np<5) {
-		hsm_buffer_free(*b);
-		*b = 0;
-		return 0;
-	} else {
-		return 1;
-	}
-}
-	
-void sm_hsm(struct sm_params* params, struct sm_result* res) {
-	res->valid = 0;
-	
-	params->first_guess[0]=0.2;
-	params->first_guess[1]=0;
-	params->first_guess[2]=0;
-	
-
-	/* use true information if present */
-	int has_true1 = !any_nan(params->laser_ref->true_pose, 3);
-	int has_true2 = !any_nan(params->laser_sens->true_pose, 3);
-	if(has_true1 && has_true2) {
-		params->hsm.debug_true_x_valid = 1;
-		
-		double true_x[3];
-		pose_diff_d(params->laser_sens->true_pose, params->laser_ref->true_pose, true_x);
-
-		/* This is the difference between results and true_x */
-		pose_diff_d(true_x, params->first_guess,  params->hsm.debug_true_x);
-		
-	} else {
-		params->hsm.debug_true_x_valid = 0;
-	}
-	
-	double zero[3] = {0,0,0};
-	hsm_buffer b1, b2;
-	int ok1 = hsm_compute_ht_for_scan(params->laser_ref, &(params->hsm), zero, &b1);
-	int ok2 = hsm_compute_ht_for_scan(params->laser_sens,&(params->hsm),  params->first_guess, &b2);
-	
-	if(!ok1 || !ok2) {
-		sm_error("Could not compute buffers (too few points?).\n");
-		if(b1) hsm_buffer_free(b1);
-		if(b2) hsm_buffer_free(b2);
-		return;
-	}
-
-	hsm_compute_spectrum(b1);
-	hsm_compute_spectrum(b2);
-
-	params->hsm.max_translation = max(b1->rho_max, b2->rho_max);
-	
-	hsm_match(&(params->hsm),b1,b2);
-
-
-	if(b1->num_valid_results)	{
-		res->valid = 1;
-		double pl[3];
-		double d2[3];
-		
-		pose_diff_d(params->first_guess, b1->results[0], res->x);
-		pose_diff_d(b1->results[0], params->first_guess,  d2);
-		oplus_d(params->first_guess, b1->results[0], pl);
-		
-		sm_info("hsm: odo   = %s\n", friendly_pose(params->first_guess));
-		sm_info("hsm: res   = %s\n", friendly_pose(b1->results[0]));
-		sm_info("hsm: plus  = %s\n", friendly_pose(pl));
-		sm_info("hsm: d2  = %s\n", friendly_pose(d2));
-		sm_info("hsm: xmin  = %s\n", friendly_pose(res->x));
-		res->error = 0;
-		res->iterations = 0;
-		res->nvalid = 0;
-	} else {
-		sm_error("HSM did not produce any result.\n");
-		res->valid = 0;
-	}
-	
-	
-	hsm_buffer_free(b1);
-	hsm_buffer_free(b2);
-}
-
diff --git a/sm/csm/hsm/hsm_interface.h b/sm/csm/hsm/hsm_interface.h
deleted file mode 100644
index b91450127cc285da92852696897795fd19421603..0000000000000000000000000000000000000000
--- a/sm/csm/hsm/hsm_interface.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef H_HSM_INTERFACE
-#define H_HSM_INTERFACE
-
-#include <options/options.h>
-
-#include "hsm.h"
-
-struct sm_params;
-struct sm_result;
-
-/* Interface of HSM for CSM */
-void sm_hsm(struct sm_params* params, struct sm_result* res);
-
-/** Adds options related to HSM */
-void hsm_add_options(struct option* ops, struct hsm_params*p);
-
-#endif
diff --git a/sm/csm/hsm/hsm_test00.c b/sm/csm/hsm/hsm_test00.c
deleted file mode 100644
index e110e256003fc2d567c41fe2ae58225c9cca47f8..0000000000000000000000000000000000000000
--- a/sm/csm/hsm/hsm_test00.c
+++ /dev/null
@@ -1,185 +0,0 @@
-#include <string.h>
-#include <pgm.h>
-#include <options/options.h>
-
-#include <csm/csm_all.h>
-
-#include "hsm.h"
-#include "hsm_interface.h"
-
-const char * banner = 
-	"Reads an image, computes HT, de-computes it \n\n";
-
-struct {
-	const char * file_input1;
-	const char * file_input2;
-	
-	const char * prefix;
-	int debug;
-	
-	struct hsm_params hsmp;
-	
-} p;
-
-hsm_buffer create_ht_for_image(struct hsm_params*p, FILE*in, const double base[3]);
-void write_ht_on_image(hsm_buffer b, FILE*out);
-void write_function_on_image(int n, const double*f, int rows, FILE*out);
-
-
-int main(int argc, const char**argv) {
-	pgm_init(&argc, argv);
-	options_banner(banner);
-	
-	
-	struct option* ops = options_allocate(20);
-	options_string(ops, "in1", &p.file_input1, "stdin", "Input file 1");
-	options_string(ops, "in2", &p.file_input2, "", "Input file 2");
-	options_string(ops, "out", &p.prefix, "test00", "Output file prefix ");
-	
-	hsm_add_options(ops, &p.hsmp);
-	p.hsmp.linear_cell_size = 1; /* 1 pixel */
-		
-	options_int(ops, "debug", &p.debug, 0, "Shows debug information");
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	sm_debug_write(p.debug);
-
-
-	FILE * in1 = open_file_for_reading(p.file_input1);   if(!in1) return -2;
-
-	sm_debug("Computing HT for image %s.\n", p.file_input1);
-
-	hsm_buffer b1 = create_ht_for_image(&(p.hsmp), in1, 0);  if(!b1) return -3;
-	hsm_compute_spectrum(b1);
-
-
-	if(!strcmp(p.file_input2,"")) {
-		p.file_input2 = p.file_input1;
-		p.hsmp.debug_true_x_valid = 1;
-		p.hsmp.debug_true_x[0] = 20;
-		p.hsmp.debug_true_x[1] = 50;
-		p.hsmp.debug_true_x[2] = 0; /*deg2rad(40.0);*/
-	} else {
-		p.hsmp.debug_true_x_valid = 0;
-	}
-
-	FILE * in2 = open_file_for_reading(p.file_input2);       if(!in2 ) return -2;
-	sm_debug("Computing HT for image %s.\n", p.file_input2);
-	double *base = p.hsmp.debug_true_x_valid ? p.hsmp.debug_true_x : 0;
-	hsm_buffer b2 = create_ht_for_image(&(p.hsmp), in2, base);     if(!b2) return -3;	
-	hsm_compute_spectrum(b2);
-	
-	
-	
-	sm_debug("Doing scan-matching..\n"); 
-	p.hsmp.max_translation = max(b1->rho_max, b2->rho_max);
-	
-	hsm_match(&(p.hsmp),b1,b2);
-
-	char filename_ht1[256]; sprintf(filename_ht1, "%s_ht1.pgm", p.prefix);
-	char filename_ht2[256]; sprintf(filename_ht2, "%s_ht2.pgm", p.prefix);
-	char filename_hs1[256]; sprintf(filename_hs1, "%s_hs1.pgm", p.prefix);
-	char filename_hs2[256]; sprintf(filename_hs2, "%s_hs2.pgm", p.prefix);
-	char filename_hs_xc[256]; sprintf(filename_hs_xc, "%s_hs_xc.pgm", p.prefix);
-	
-	FILE * file_ht1 = open_file_for_writing(filename_ht1);
-	FILE * file_ht2 = open_file_for_writing(filename_ht2);
-	FILE * file_hs1 = open_file_for_writing(filename_hs1);
-	FILE * file_hs2 = open_file_for_writing(filename_hs2);
-	FILE * file_hs_xc = open_file_for_writing(filename_hs_xc);
-	
-	if(!file_ht1 | !file_ht2) return -4;
-	if(!file_hs1 | !file_hs2) return -4;
-	if(!file_hs_xc) return -5;
-	
-	write_ht_on_image(b1,file_ht1);
-	write_ht_on_image(b2,file_ht2);
-	write_function_on_image(b1->num_angular_cells, b1->hs, 200, file_hs1);
-	write_function_on_image(b2->num_angular_cells, b2->hs, 200, file_hs2);
-	write_function_on_image(b1->num_angular_cells, b1->hs_cross_corr, 200, file_hs_xc);
-	
-
-}
-
-
-void write_function_on_image(int n, const double*f, int rows, FILE*out) {	
-	int cols = n;
-	gray ** grays = pgm_allocarray(cols, rows);
-	
-	double maxvalue=0;
-	for(int i=0;i<n;i++)
-		if(f[i]>0) /* case NAN */
-		maxvalue = GSL_MAX(maxvalue, f[i]);
-	if(maxvalue==0)maxvalue=1;
-
-	gray maxgray = 255;
-
-	for(int y=0;y<rows;y++)
-	for(int x=0;x<cols;x++)
-	grays[y][x] = 0;
-	
-	for(int x=0;x<cols;x++) {
-		int y =  round((rows-2)*f[x]/maxvalue);
-		y = (rows-1) - y;
-		if(y>=0 && y<rows )
-		grays[y][x] = maxgray;
-	}
-	
-	pgm_writepgm(out,grays,cols,rows,maxgray,0);
-	
-	pgm_freearray(grays,rows);
-}
-
-
-void write_ht_on_image(hsm_buffer b, FILE*out) {	
-	int rows = b->num_angular_cells;
-	int cols = b->num_linear_cells;
-	gray ** grays = pgm_allocarray(cols, rows);
-	
-	double maxvalue=0;
-	for(int t=0;t<b->num_angular_cells;t++)
-	for(int r=0;r<b->num_linear_cells;r++)
-	maxvalue = GSL_MAX(maxvalue, b->ht[t][r]);
-
-	gray maxgray = 255;
-
-	for(int t=0;t<b->num_angular_cells;t++)
-	for(int r=0;r<b->num_linear_cells;r++)
-	grays[t][r] = (gray) ceil(b->ht[t][r] * (maxgray-1) / maxvalue);
-	
-	pgm_writepgm(out,grays,cols,rows,maxgray,0);
-	
-	pgm_freearray(grays,rows);
-}
-
-hsm_buffer create_ht_for_image(struct hsm_params*p, FILE*in, const double base[3]) {
-	int cols, rows; gray max;
-	gray **image = pgm_readpgm(in, &cols, &rows, &max);
-	if(!image) { return 0; }
-
-	p->max_norm = 1.1 * hypot(cols/2.0, rows/2.0);
-	hsm_buffer b = hsm_buffer_alloc(p);
-
-	/** Add base displacement if specified */
-	if(base)
-		hsm_compute_ht_base(b, base);
-	
-	int npoints = 0;
-   for (int v=0; v<rows; v++)
-	for (int u=0; u<cols; u++) {
-		double x = u - cols/2;
-		double y = v - rows/2;
-		if(image[v][u]==0) continue;
-		hsm_compute_ht_point(b, x, y, ((double)image[v][u])/max);
-		npoints ++;
-	}
-	sm_debug("Used %d points.\n", npoints);
-    /* write the modified image to stdout */
-/*    pgm_writepgm(stdout, image, cols, rows, max, 1); */
-    pgm_freearray(image, rows);
-	return b;
-}
diff --git a/sm/csm/hsm/hsm_test01.c b/sm/csm/hsm/hsm_test01.c
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/sm/csm/hsm/tests/hsmtest.sh b/sm/csm/hsm/tests/hsmtest.sh
deleted file mode 100755
index 0c3d4a5a2cc38f3b12bbe7d4b231c59615caa4b2..0000000000000000000000000000000000000000
--- a/sm/csm/hsm/tests/hsmtest.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-set -e # exit on error
-
-
-make -C ../../../
-
-convert tunnel1.png tunnel1.pgm
-convert tunnel2.png tunnel2.pgm
-
-rm hsm0*
-
-../../../hsm_test00 -debug 1 -in1 tunnel2.pgm -in2 tunnel1.pgm -out hsm0
-
-for a in hsm0*pgm; do convert $a $a.png; done
-	
-
-open hsm0*png
-
diff --git a/sm/csm/hsm/tests/hsmtest2.sh b/sm/csm/hsm/tests/hsmtest2.sh
deleted file mode 100755
index 89e539ca245c7cd52b08344357fee57ea1550436..0000000000000000000000000000000000000000
--- a/sm/csm/hsm/tests/hsmtest2.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-set -e # exit on error
-
-
-make -C ../../../
-
-convert tunnel1.png tunnel1.pgm
-convert tunnel2.png tunnel2.pgm
-
-rm -f hsm2*
-
-echo Self test
-../../../hsm_test00 -debug 1 -in1 tunnel2.pgm  -out hsm2  -hsm_num_angular_hypotheses 2
-
-for a in hsm2*pgm; do convert $a $a.png; done
-	
-
-open hsm2*png
-
diff --git a/sm/csm/hsm/tests/tunnel1.png b/sm/csm/hsm/tests/tunnel1.png
deleted file mode 100644
index 3d63985fef639603edc67f75183b0a1eeb04cff9..0000000000000000000000000000000000000000
Binary files a/sm/csm/hsm/tests/tunnel1.png and /dev/null differ
diff --git a/sm/csm/hsm/tests/tunnel2.png b/sm/csm/hsm/tests/tunnel2.png
deleted file mode 100644
index 7ffeca4239105a79b7b93854175cea8b2937c9f0..0000000000000000000000000000000000000000
Binary files a/sm/csm/hsm/tests/tunnel2.png and /dev/null differ
diff --git a/sm/csm/icp/fast_math.h b/sm/csm/icp/fast_math.h
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/sm/csm/json_journal.c b/sm/csm/json_journal.c
deleted file mode 100644
index dec197a070be2947200a4fd114477494be004aec..0000000000000000000000000000000000000000
--- a/sm/csm/json_journal.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <assert.h>
-#include "json_journal.h"
-
-
-#define MAX_STACK 1000
-
-static JO jj_stack[MAX_STACK];
-static int jj_stack_index = -1;
-static FILE * jj_file = 0;
-
-
-int jj_enabled() {
-	return jj_file != 0;
-}
-
-JO jj_stack_top() {
-	assert(jj_stack_index>=0);
-	return jj_stack[jj_stack_index];
-}
-
-void jj_stack_push(JO jo) {
-	assert(jj_stack_index<MAX_STACK);
-	jj_stack[++jj_stack_index] = jo;
-}
-
-void jj_stack_pop() {
-/*	fprintf(stderr, "jj_stack_pop  %d\n", jj_stack_index); */
-	assert(jj_stack_index>=0);
-	if(jj_stack_index == 0 && jj_file) {
-		fprintf(jj_file, "%s\n", json_object_to_json_string(jj_stack_top()));
-		jo_free(jj_stack_top());
-	}
-	jj_stack_index--;
-}
-
-void jj_context_enter(const char*context_name) {
-/*	fprintf(stderr, "jj_context_enter('%s') %d\n", context_name, jj_stack_index); */
-	
-	JO jo = json_object_new_object();
-	if(jj_stack_index>=0)
-	jo_add(jj_stack_top(), context_name, jo);
-	
-	jj_stack_push(jo);
-}
-
-
-
-void jj_must_be_hash() {
-	assert(json_object_is_type(jj_stack_top(), (enum json_type) json_type_object));	
-}
-
-void jj_must_be_array() {
-	assert(json_object_is_type(jj_stack_top(), (enum json_type)  json_type_array));	
-}
-
-void jj_context_exit() {
-	jj_must_be_hash();
-	jj_stack_pop();
-}
-
-void jj_loop_enter(const char*loop_name) {
-	jj_must_be_hash();
-	JO jo = json_object_new_array();
-	jo_add(jj_stack_top(), loop_name, jo);
-	jj_stack_push(jo);
-}
-
-void jj_loop_iteration() {
-	JO this_iteration = json_object_new_object();
-	if(!json_object_is_type(jj_stack_top(), (enum json_type) json_type_array)) {
-		jj_stack_pop();
-		jj_must_be_array();
-	}
-	json_object_array_add(jj_stack_top(), this_iteration);
-	jj_stack_push(this_iteration);
-}
-
-void jj_loop_exit() {
-	if(!json_object_is_type(jj_stack_top(), (enum json_type) json_type_array))
-		jj_stack_pop();
-		
-	jj_must_be_array();
-	jj_stack_pop();
-}
-
-void jj_add_int(const char*name, int v) {
-	jj_must_be_hash();
-	jo_add(jj_stack_top(), name, jo_new_int(v));
-}
-
-void jj_add_double(const char*name, double v) {
-	jj_must_be_hash();
-	jo_add(jj_stack_top(), name, jo_double_or_null(v));
-}
-
-void jj_add_double_array(const char *name, double *v, int n) {
-	jj_add(name, jo_new_double_array(v, n));
-}
-
-void jj_add_int_array(const char*name, int* v, int n) {
-	jj_add(name, jo_new_int_array(v, n));	
-}
-
-void jj_add(const char*name, JO jo) {
-	jj_must_be_hash();
-	jo_add(jj_stack_top(), name, jo);
-}
-
-void jj_set_stream(FILE* f) {
-	jj_file = f;
-}
-
-FILE * jj_get_stream() {
-	return jj_file;
-}
diff --git a/sm/csm/json_journal.h b/sm/csm/json_journal.h
deleted file mode 100644
index a93afa90895d93635b29530861921aaf49ad6a5f..0000000000000000000000000000000000000000
--- a/sm/csm/json_journal.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef H_JSON_JOURNAL
-#define H_JSON_JOURNAL
-
-#include <stdio.h>
-
-#include <json-c/json.h>
-#include <json-c/json_more_utils.h>
-
-#include "laser_data_json.h"
-
-
-/** This is a collection of functions for debugging purposes only.
-    It's a little cryptic, but if you don't understand them, don't worry.
-
-	The information used by this is used primarily to create the
-	icp animation videos.
-*/
-
-/** Public interface */
-
-	#define JJ jj_enabled()
-	int jj_enabled(void);
-
-	void jj_context_enter(const char*context_name);
-	void jj_context_exit(void);
-
-	void jj_loop_enter(const char*loop_name);
-	void jj_loop_iteration(void);
-	void jj_loop_exit(void);
-
-	void jj_add_int(const char*name, int);
-	void jj_add_double(const char*name, double);
-	void jj_add_double_array(const char*name, double*,int);
-	void jj_add_int_array(const char*name, int*,int);
-	void jj_add(const char*name, JO);
-
-	void jj_set_stream(FILE*);
-	FILE*  jj_get_stream(void);
-
-/**** Private functions */
-
-	/** (private) Gets the top of the stack. */
-	JO jj_stack_top(void);
-	/** (private) Pushes an object onto the stack. */
-	void jj_stack_push(JO jo);
-	void jj_stack_pop(void);
-	/** (private) Asserts if the stack top is not an hash. */
-	void jj_must_be_hash(void);
-	/** (private) Asserts if the stack top is not an array. */
-	void jj_must_be_array(void);
-
-
-#endif
diff --git a/sm/csm/laser_data_bbox.c b/sm/csm/laser_data_bbox.c
deleted file mode 100644
index 1e5f777e2ad4127da933bcb98eaafbfc06e9b4fe..0000000000000000000000000000000000000000
--- a/sm/csm/laser_data_bbox.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* This algorithm was created by Cyrill Stachniss 
-	http://www.informatik.uni-freiburg.de/~stachnis/ */
-#include "laser_data_drawing.h"
-#include "math_utils.h"
-#include "logging.h"
-
-// the 2d-point structure for the input
-typedef struct {
-  double x;
-  double y;
-} BB_Point;
-
-// computes the area of minimal bounding box for a set of 2d-points
-double getBoundingBoxArea(BB_Point* p, int nOfPoints);
-
-// computes the minimal bounding box for a set of 2d-points
-// ul = upper left  point, ll = lower left point, 
-// ur = upper right point, ul = upper left point
-int getBoundingBox(BB_Point* p, int nOfPoints, 
-	double ul[2], double ur[2], double ll[2], double lr[2]);
-
-struct bbfind_imp {
-	int num;
-	
-	int buf_size;
-	BB_Point * buf;
-};
-
-/* Initialize structure */
-bbfind * bbfind_new(void);
-
-/* -------------------------------------- */
-
-bbfind * bbfind_new() {
-	bbfind * bbf = malloc(sizeof(bbfind));
-	bbf->buf_size = 1000;
-	bbf->buf = malloc(sizeof(BB_Point)*bbf->buf_size);
-	bbf->num = 0;
-	return bbf;
-}
-
-int bbfind_add_point(bbfind*bbf, double point[2]) {
-	return bbfind_add_point2(bbf, point[0], point[1]);
-}
-
-int bbfind_add_point2(bbfind*bbf, double x, double y) {
-	if(bbf->num > bbf->buf_size - 2) {
-		bbf->buf_size	*= 2;
-		if(! (bbf->buf = (BB_Point*) realloc(bbf->buf, sizeof(BB_Point)*bbf->buf_size)) ) {
-			sm_error("Cannot allocate (size=%d)\n", bbf->buf_size);
-			return 0;
-		}
-	}
-	bbf->buf[bbf->num].x = x;
-	bbf->buf[bbf->num].y = y;
-	bbf->num++;
-	return 1;
-}
-
-void oriented_bbox_compute_corners(const BB2 obbox,
-	double ul[2], double ur[2], double ll[2], double lr[2]) {
-	
-	ll[0] = obbox->pose[0];
-	ll[1] = obbox->pose[1];
-	lr[0] = obbox->pose[0] + obbox->size[0] * cos(obbox->pose[2]);
-	lr[1] = obbox->pose[1] + obbox->size[0] * sin(obbox->pose[2]);
-	ul[0] = obbox->pose[0] + obbox->size[1] * cos(obbox->pose[2] + M_PI/2);
-	ul[1] = obbox->pose[1] + obbox->size[1] * sin(obbox->pose[2] + M_PI/2);
-	ur[0] = ul[0] + obbox->size[0] * cos(obbox->pose[2]);
-	ur[1] = ul[1] + obbox->size[0] * sin(obbox->pose[2]);
-		
-}
-
-int bbfind_add_bbox(bbfind*bbf, const BB2 bbox) {
-	double ul[2], ur[2], ll[2], lr[2];
-	oriented_bbox_compute_corners(bbox, ul, ur, ll, lr);
-	return
-		bbfind_add_point(bbf, ul) &&
-		bbfind_add_point(bbf, ur) &&
-		bbfind_add_point(bbf, ll) &&
-		bbfind_add_point(bbf, lr);
-}
-
-
-int bbfind_compute(bbfind*bbf, BB2 bbox) {
-	double ul[2], ur[2], ll[2], lr[2];
-	
-	if(1) {
-		if(!getBoundingBox(bbf->buf, bbf->num, ul, ur, ll, lr)) {
-			sm_error("Could not compute bounding box.\n");
-			return 0;
-		}
-		bbox->pose[0] = ll[0];
-		bbox->pose[1] = ll[1];
-		bbox->pose[2] = atan2(lr[1]-ll[1], lr[0]-ll[0]);
-		bbox->size[0] = distance_d(lr, ll);
-		bbox->size[1] = distance_d(ll, ul);
-	} else {
-		double bb_min[2] = {bbf->buf[0].x,bbf->buf[0].y}, 
-				bb_max[2] = {bbf->buf[0].x,bbf->buf[0].y};
-		int i; for(i=0;i<bbf->num; i++) {
-			bb_min[0] = GSL_MIN(bb_min[0], bbf->buf[i].x);
-			bb_min[1] = GSL_MIN(bb_min[1], bbf->buf[i].y);
-			bb_max[0] = GSL_MAX(bb_max[0], bbf->buf[i].x);
-			bb_max[1] = GSL_MAX(bb_max[1], bbf->buf[i].y);
-		}
-		bbox->pose[0] = bb_min[0];
-		bbox->pose[1] = bb_min[1];
-		bbox->pose[2] = 0;
-		bbox->size[0] = bb_max[0] - bb_min[0];
-		bbox->size[1] = bb_max[1] - bb_min[1];
-	}
-	return 1;
-}
-
-void bbfind_free(bbfind* bbf) {
-	free(bbf->buf);
-	free(bbf);
-}
-
-void ld_get_oriented_bbox(LDP ld, double horizon, oriented_bbox*obbox) {
-	bbfind * bbf = bbfind_new();
-	int i; for(i=0;i<ld->nrays;i++) {
-		if(!ld->valid[i]) continue;
-		if(ld->readings[i]>horizon) continue;
-
-		double p0[2] = {
-			cos(ld->theta[i]) * ld->readings[i],
-			sin(ld->theta[i]) * ld->readings[i]
-		};
-		
-		bbfind_add_point(bbf, p0);
-	}
-	bbfind_compute(bbf, obbox);
-	bbfind_free(bbf);
-}
-
-// computes the area of minimal bounding box for a set of 2d-points
-double getBoundingBoxArea(BB_Point* p, int nOfPoints) {
-	double ul[2], ur[2], ll[2], lr[2];
-	
-	int wasOk = getBoundingBox(p, nOfPoints, ul, ur, ll, lr);
-	double vol = (!wasOk) ? -1.0 : distance_d(ul,ll)*distance_d(ul,ur);
-  return vol;
-}
-
-// computes the minimal bounding box for a set of 2d-points
-// ul = upper left  point, ll = lower left point, 
-// ur = upper right point, ul = upper left point
-int getBoundingBox(BB_Point* p, int nOfPoints, 
-	double ul[2], double ur[2], double ll[2], double lr[2]) {
-
-  // calculate the center of all points (schwerpunkt)
-  // -------------------------------------------------
-  double centerx = 0;
-  double centery = 0;
-  for (int i=0; i < nOfPoints; i++) {
-	 centerx += p[i].x;
-	 centery += p[i].y;
-  }	 
-  centerx /= (double) nOfPoints;
-  centery /= (double) nOfPoints;
-
-
-  
-  // calcutae the covariance matrix
-  // -------------------------------
-  // covariance matrix (x1 x2, x3 x4) 
-  double x1 = 0.0;
-  double x2 = 0.0;
-  double x3 = 0.0;
-  double x4 = 0.0;
-
-  for (int i=0; i < nOfPoints; i++) {
-	 double cix = p[i].x - centerx;
-	 double ciy = p[i].y - centery;
-	 
-	 x1 += cix*cix;
-	 x2 += cix*ciy;  
-	 x4 += ciy*ciy;
-  }
-  x1 /= (double) nOfPoints;
-  x2 /= (double) nOfPoints;
-  x3 = x2;
-  x4 /= (double) nOfPoints;
-  // covariance & center  done
-
-
-  // calculate the eigenvectors
-  // ---------------------------
-  // catch 1/0 or sqrt(<0)
-  if ((x3 == 0) || (x2 == 0)|| (x4*x4-2*x1*x4+x1*x1+4*x2*x3 < 0 ))  {
-	sm_error("Cyrill: Could not compute bounding box.\n");
-	return 0;
-}
-
- // eigenvalues
-  double lamda1 = 0.5* (x4 + x1 + sqrt(x4*x4 - 2.0*x1*x4 + x1*x1 + 4.0*x2*x3));
-  double lamda2 = 0.5* (x4 + x1 - sqrt(x4*x4 - 2.0*x1*x4 + x1*x1 + 4.0*x2*x3));
-  
-  // eigenvector 1  with  (x,y)
-  double v1x = - (x4-lamda1) * (x4-lamda1) * (x1-lamda1) / (x2 * x3 * x3);
-  double v1y = (x4-lamda1) * (x1-lamda1) / (x2 * x3);
-  // eigenvector 2 with	 (x,y)
-  double v2x = - (x4-lamda2) * (x4-lamda2) * (x1-lamda2) / (x2 * x3 * x3);
-  double v2y = (x4-lamda2) * (x1-lamda2) / (x2 * x3);
-
-  // norm the eigenvectors
-  double lv1 = sqrt ( (v1x*v1x) + (v1y*v1y) );
-  double lv2 = sqrt ( (v2x*v2x) + (v2y*v2y) );
-  v1x /= lv1;
-  v1y /= lv1;
-  v2x /= lv2;
-  v2y /= lv2;
-  // eigenvectors done
-
-  // get the points with maximal dot-product 
-  double x = 0.0;
-  double y = 0.0;
-  double xmin = 1e20;
-  double xmax = -1e20;
-  double ymin = 1e20;
-  double ymax = -1e20;
-  for(int i = 0; i< nOfPoints; i++) {
-	 // dot-product of relativ coordinates of every point
-	 x = (p[i].x - centerx) * v1x +	(p[i].y - centery) * v1y;
-	 y = (p[i].x - centerx) * v2x +	(p[i].y - centery) * v2y;
-
-	 if( x > xmax) xmax = x;
-	 if( x < xmin) xmin = x;
-	 if( y > ymax) ymax = y;
-	 if( y < ymin) ymin = y;
-  }
-
-  // now we can compute the corners of the bounding box
-	if(ul) {
-		ul[0] = centerx + xmin * v1x + ymin * v2x;
-		ul[1] = centery + xmin * v1y + ymin * v2y;
-	}
-
-	if(ur) {
-		ur[0] = centerx + xmax * v1x + ymin * v2x;
-		ur[1] = centery + xmax * v1y + ymin * v2y;
-	}
-	
-	if(ll) {
-		ll[0] = centerx + xmin * v1x + ymax * v2x;
-		ll[1] = centery + xmin * v1y + ymax * v2y;
-	}
-	
-	if(lr) {
-		lr[0] = centerx + xmax * v1x + ymax * v2x;
-		lr[1] = centery + xmax * v1y + ymax * v2y;
-	}
-	return 1;
-}
-
-
-
-
diff --git a/sm/csm/laser_data_cairo.c b/sm/csm/laser_data_cairo.c
deleted file mode 100644
index 92b468df167f6c4a9ce5fc6f3155c223ae6558c1..0000000000000000000000000000000000000000
--- a/sm/csm/laser_data_cairo.c
+++ /dev/null
@@ -1,397 +0,0 @@
-
-#include <string.h>
-
-#include <cairo-pdf.h>
-#include <stdlib.h>
-#include <limits.h>
-
-#include "laser_data_cairo.h"
-
-const char* cat(const char*a, const char*b);
-void cr_ld_draw_rays(cairo_t*, LDP);
-void cr_ld_draw_countour(cairo_t*, LDP, double, double);
-void cr_ld_draw_points(cairo_t*, LDP, double radius);
-void cr_ld_draw_normals(cairo_t*cr, LDP ld, double length);
-
-
-
-/* ----------------------------------------------- */
-
-void cr_ld_draw_corr(cairo_t*cr, LDP laser_ref, LDP laser_sens) {
-	int i;
-	for(i=0; i < laser_sens->nrays; i++) {
-		if(!ld_valid_corr(laser_sens, i)) continue;
-
-		if(!laser_sens->corr[i].valid) continue;
-
-		int j1 = laser_sens->corr[i].j1;
-		int j2 = laser_sens->corr[i].j2;
-		
-		const double *p_j1  = laser_ref->points[j1].p;
-		const double *p_j2  = laser_ref->points[j2].p;
-		const double *p_i_w = laser_sens->points_w[i].p;
-		double proj[2];
-	
-		if(laser_sens->corr[i].type == corr_pl)
-			projection_on_line_d(p_j1,  p_j2, p_i_w, proj, 0);
-		else
-			projection_on_segment_d(p_j1,  p_j2, p_i_w, proj);
-	
-		cairo_move_to(cr, p_i_w[0], p_i_w[1]);
-		cairo_line_to(cr, proj[0],  proj[1]);
-		cairo_stroke(cr);	
-	}
-}
-
-const char* cat(const char*a, const char*b) {
-	size_t la = strlen(a);
-	size_t lb = strlen(b);
-	char* buf = malloc(la+lb+3);
-	strcpy(buf, a);
-	strcpy(buf+la, b);
-	return buf;
-}
-
-void ls_add_options(line_style*ls, struct option*ops, 
-	const char*prefix, const char*desc_prefix) 
-{
-	options_int(ops, cat(prefix, "draw"), &(ls->draw), 
-		ls->draw, cat(desc_prefix, "Whether to draw it (0,1)"));
-	
-	options_string(ops, cat(prefix, "color"), &(ls->color), 
-		ls->color, cat(desc_prefix, "Color ('red', '#f00')"));
-
-	options_double(ops, cat(prefix, "width"), &(ls->width), 
-		ls->width, cat(desc_prefix, "line width (meters)"));
-		
-}
-
-
-void lds_add_options(ld_style*lds, struct option*ops, 
-	const char*prefix, const char*desc_prefix) 
-{
-	ls_add_options(&(lds->rays), ops, cat(prefix, "rays_"),  cat(desc_prefix, "Rays | "));
-	ls_add_options(&(lds->countour), ops, cat(prefix, "countour_"),  cat(desc_prefix, "Countour | "));
-	ls_add_options(&(lds->points), ops, cat(prefix, "points_"),  cat(desc_prefix, "Points | "));
-	
-	options_double(ops, cat(prefix, "points_radius"), &(lds->points_radius), 
-		lds->points_radius, cat(desc_prefix, "Point radius"));
-
-
-	ls_add_options(&(lds->pose), ops, cat(prefix, "pose_"),  cat(desc_prefix, "PoseMarker | "));
-	
-	options_double(ops, cat(prefix, "pose_radius"), &(lds->pose_radius), 
-		lds->pose_radius, cat(desc_prefix, "Point radius"));
-
-	ls_add_options(&(lds->normals), ops, cat(prefix, "normals_"),  cat(desc_prefix, "Normals | "));
-
-	options_double(ops, cat(prefix, "normals_length"), &(lds->normals_length), 
-		lds->normals_length, cat(desc_prefix, "Length of normals sticks (meters)"));
-
-	ls_add_options(&(lds->sigma), ops, cat(prefix, "sigma_"),  cat(desc_prefix, "Sigma | "));
-
-	options_double(ops, cat(prefix, "sigma_multiplier"), &(lds->sigma_multiplier), 
-		lds->sigma_multiplier, cat(desc_prefix, "Multiplier for sigma"));
-
-
-	options_double(ops, cat(prefix, "connect_threshold"), &(lds->connect_threshold), 
-		lds->connect_threshold, cat(desc_prefix, "Threshold under which points are connected (m)."));
-	options_double(ops, cat(prefix, "horizon"), &(lds->horizon), 
-		lds->horizon, cat(desc_prefix, "Maximum distance to plot (m)."));
-}
-
-void cr_set_color(cairo_t *cr, const char* color) {
-	if(strlen(color) == 4 && color[0] == '#') {
-		char buf[2] = {0, 0};
-		double rgb[3];
-		int i; for(i=0;i<3;i++) {
-			buf[0] = color[1+i];
-			char* endptr;
-			rgb[i] = (1/15.0) * strtol(buf, &endptr, 16);
-			if(endptr == buf) {
-				sm_error("Unknown color component: %s.\n", buf);
-			}
-		}
-		cairo_set_source_rgb (cr, rgb[0], rgb[1], rgb[2]);
-	} else if(strlen(color) == 5 && color[0] == '#') {
-			char buf[2] = {0, 0};
-			double rgba[4];
-			int i; for(i=0;i<4;i++) {
-				buf[0] = color[1+i];
-				char* endptr;
-				rgba[i] = (1/15.0) * strtol(buf, &endptr, 16);
-				if(endptr == buf) {
-					sm_error("Unknown color component: %s.\n", buf);
-				}
-			}
-			cairo_set_source_rgba (cr, rgba[0], rgba[1], rgba[2], rgba[3]);
-	} else {
-		if(!strcmp(color, "black")) {
-			cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
-		} else {
-			sm_error("Unknown color: %s.\n", color);
-			cairo_set_source_rgb (cr, 0.0, 1.0, 1.0);		
-		}
-	}
-}
-
-void cr_set_style(cairo_t *cr, line_style *ls) {
-	cr_set_color(cr, ls->color);
-	cairo_set_line_width(cr, ls->width);
-}
-
-void cr_lda_draw_pose_path(cairo_t*cr, LDP*scans, int nscans, ld_reference use_reference) {
-	int k; int first_pose=1;
-	for(k=0;k<nscans;k++) {
-		LDP ld = scans[k];
-		double *pose = ld_get_reference_pose(ld, use_reference);
-		if(!pose) {
-			sm_error("No '%s' pose specified for scan #%d, continuing.\n",
-				ld_reference_to_string(use_reference));
-			continue;
-		}
-	
-		if(first_pose) { 
-			first_pose = 0; 
-			cairo_move_to(cr, pose[0], pose[1]);
-		} else {
-			cairo_line_to(cr, pose[0], pose[1]);
-		}
-	}
-	cairo_stroke(cr);
-}
-
-
-
-void cr_ld_draw_rays(cairo_t*cr, LDP ld) {
-	int i; for(i=0;i<ld->nrays;i++) {
-		if(!ld_valid_ray(ld, i)) continue;
-		
-		double threshold = 0.03;
-		
-/*		if(ld->readings[i]<2) continue;*/
-		
-		double x1 = threshold * cos(ld->theta[i]);
-		double y1 = threshold * sin(ld->theta[i]);
-		double x2 = ld->readings[i] * cos(ld->theta[i]);
-		double y2 = ld->readings[i] * sin(ld->theta[i]);
-		
-		cairo_move_to(cr,x1,y1);
-		cairo_line_to(cr,x2,y2);
-		cairo_stroke(cr);
-	}
-}
-
-void cr_ld_draw_countour(cairo_t*cr, LDP ld, double horizon, double connect_threshold) {
-	struct stroke_sequence draw_info[ld->nrays];
-	compute_stroke_sequence(ld, draw_info, horizon, connect_threshold);
-	
-	/* draw contour: begin_new_stroke and end_stroke tell 
-	when to interrupt the stroke */
-	int i; 
-	for(i=0;i<ld->nrays;i++) {
-
-		if(draw_info[i].valid==0) continue;
-
-		double *p = draw_info[i].p;
-		
-		if(draw_info[i].begin_new_stroke)
-			cairo_move_to(cr, p[0], p[1]);
-		else
-			cairo_line_to(cr, p[0], p[1]);
-/*		if(draw_info[i].end_stroke)*/
-	}
-	cairo_stroke(cr);
-}
-
-void cr_ld_draw_points(cairo_t*cr, LDP ld, double radius) {
-	int i; for(i=0;i<ld->nrays;i++) {
-		if(!ld_valid_ray(ld, i)) continue;
-
-		double x = ld->readings[i] * cos(ld->theta[i]);
-		double y = ld->readings[i] * sin(ld->theta[i]);
-
-		cairo_arc (cr, x, y, radius, 0.0, 2*M_PI);
-		cairo_fill(cr);
-	}
-}
-
-void cr_ld_draw_normals(cairo_t*cr, LDP ld, double length) {
-	int i; for(i=0;i<ld->nrays;i++) {
-		if(!ld_valid_ray(ld, i) || !ld_valid_alpha(ld, i)) continue;
-
-		double alpha = ld->alpha[i];
-		double x1 = ld->readings[i] * cos(ld->theta[i]);
-		double y1 = ld->readings[i] * sin(ld->theta[i]);
-		double x2 = x1 + cos(alpha) * length;
-		double y2 = y1 + sin(alpha) * length;
-
-		cairo_move_to(cr, x1, y1);
-		cairo_line_to(cr, x2, y2);
-	}
-	cairo_stroke (cr);
-}
-
-void cr_ld_draw_sigma(cairo_t*cr, LDP ld, double multiplier) {
-	int i; for(i=0;i<ld->nrays;i++) {
-		if(!ld_valid_ray(ld, i) || is_nan(ld->readings_sigma[i])) continue;
-
-		double theta = ld->theta[i];
-		double length = ld->readings_sigma[i] * multiplier;
-		
-		double x0 = ld->readings[i] * cos(theta);
-		double y0 = ld->readings[i] * sin(theta);
-		double x1 = x0 + cos(theta) * length;
-		double y1 = y0 + sin(theta) * length;
-		double x2 = x0 - cos(theta) * length;
-		double y2 = y0 - sin(theta) * length;
-
-		cairo_move_to(cr, x1, y1);
-		cairo_line_to(cr, x2, y2);
-	}
-	cairo_stroke (cr);
-}
-
-
-void cr_ld_draw(cairo_t* cr, LDP ld, ld_style *p) {
-	if(p->rays.draw) {
-		cr_set_style(cr, &(p->rays));
-		cr_ld_draw_rays(cr, ld);
-	}
-		
-	if(p->countour.draw)  {
-		cr_set_style(cr, &(p->countour));
-		cr_ld_draw_countour(cr, ld, p->horizon, p->connect_threshold);
-	}
-
-	if(p->points.draw) {
-		cr_set_style(cr, &(p->points));
-		cr_ld_draw_points(cr, ld, p->points_radius);
-	}
-
-	if(p->normals.draw) {
-		cr_set_style(cr, &(p->normals));
-		cr_ld_draw_normals(cr, ld, p->normals_length);
-	}
-
-	if(p->sigma.draw) {
-		cr_set_style(cr, &(p->sigma));
-		cr_ld_draw_sigma(cr, ld, p->sigma_multiplier);
-	}
-	
-	if(p->pose.draw) {
-		cr_set_style(cr, &(p->pose));
-		cairo_move_to(cr, 0.0, 0.0);
-		cairo_arc (cr, 0.0, 0.0, p->pose_radius, 0.0, 2*M_PI);
-		cairo_fill (cr);
-	}
-}
-
-void cr_set_reference(cairo_t*cr, double*pose) {
-	cairo_translate(cr,pose[0],pose[1]);
-	cairo_rotate(cr,pose[2]);
-}
-
-void ls_set_defaults(line_style*ls) {
-	ls->draw = 1;
-	ls->color = "black";
-	ls->width = 0.002;
-}
-
-void lds_set_defaults(ld_style*lds) {
-	ls_set_defaults(&(lds->rays));
-	lds->rays.color = "#f00";
-	lds->rays.width = 0.0002;
-	
-	ls_set_defaults(&(lds->countour));
-	ls_set_defaults(&(lds->points));
-	lds->points_radius = 0.003;
-	lds->points.color = "#f00";
-	
-	ls_set_defaults(&(lds->pose));
-	lds->pose.color = "#f73";
-	lds->pose_radius = 0.24;
-	
-	lds->normals_length = 0.10;
-	ls_set_defaults(&(lds->normals));
-
-	lds->sigma_multiplier = 3;
-	ls_set_defaults(&(lds->sigma));
-	lds->sigma.draw = 0;
-	
-	lds->connect_threshold = 0.20;
-	lds->horizon = 10;
-}
-
-int create_pdf_surface(const char*file, int max_width_points, int max_height_points,
-	double bb_min[2], double bb_max[2], cairo_surface_t**surface_p, cairo_t **cr) {
-	double bb_width = bb_max[0] - bb_min[0], bb_height = bb_max[1] - bb_min[1];
-	
-	
-	double surface_width, surface_height;
-	if( bb_width > bb_height ) {
-		/* largo e basso */
-		surface_width = max_width_points;
-		surface_height =  (surface_width / bb_width) * bb_height;
-	} else {
-		/* stretto e alto */
-		surface_height = max_height_points;
-		surface_width =  (surface_height / bb_height) * bb_width;
-	}
-
-	sm_debug("bb: %f %f\n", bb_width, bb_height);
-	sm_debug("surface: %f %f\n", surface_width, surface_height);
-	
-	*surface_p = cairo_pdf_surface_create(file, surface_width, surface_height);
-	*cr = cairo_create (*surface_p);
-	cairo_status_t status = cairo_status (*cr);
-
-	if (status) {
-		sm_error("Failed to create pdf surface for file %s: %s\n",
-			file, cairo_status_to_string (status));
-		return 0;
-	}
-
-	double world_to_surface = surface_width / bb_width;
-	cairo_scale(*cr, world_to_surface, -world_to_surface );
-	cairo_translate(*cr, -bb_min[0], -bb_max[1]);
-	
-	return 1;
-}
-
-int create_image_surface(int max_width_pixels, int max_height_pixels,
-	double bb_min[2], double bb_max[2], cairo_surface_t**surface_p, cairo_t **cr) {
-	double bb_width = bb_max[0] - bb_min[0], bb_height = bb_max[1] - bb_min[1];
-
-	double surface_width, surface_height;
-	if( bb_width > bb_height ) {
-		/* largo e basso */
-		surface_width = max_width_pixels;
-		surface_height =  (surface_width / bb_width) * bb_height;
-	} else {
-		/* stretto e alto */
-		surface_height = max_height_pixels;
-		surface_width =  (surface_height / bb_height) * bb_width;
-	}
-
-	sm_debug("bb: %f %f\n", bb_width, bb_height);
-	sm_debug("surface: %f %f\n", surface_width, surface_height);
-
-	*surface_p = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, (int) surface_width, (int)surface_height);
-	*cr = cairo_create (*surface_p);
-	cairo_status_t status = cairo_status (*cr);
-
-	if (status) {
-		sm_error("Failed to create image surface: %s\n",
-			cairo_status_to_string (status));
-		return 0;
-	}
-
-	double world_to_surface = surface_width / bb_width;
-	cairo_scale(*cr, world_to_surface, -world_to_surface );
-	cairo_translate(*cr, -bb_min[0], -bb_max[1]);
-
-	return 1;
-}
-
-
diff --git a/sm/csm/laser_data_cairo.h b/sm/csm/laser_data_cairo.h
deleted file mode 100644
index 021594856bd0a7cfddaca51be4e165740674f77c..0000000000000000000000000000000000000000
--- a/sm/csm/laser_data_cairo.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef H_LASER_DATA_CAIRO
-#define H_LASER_DATA_CAIRO
-
-#include <cairo.h>
-#include <options/options.h>
-#include "../csm/csm_all.h"
-#include "../csm/laser_data_drawing.h"
-
-typedef struct {
-	/* should we draw it? */
-	int draw;
-	
-	double width;
-	const char* color;
-	
-} line_style ;
-
-typedef struct { 
-	line_style rays, countour;
-	line_style points;
-	double points_radius; 
-
-	line_style normals;
-	double normals_length;
-	
-	/* A circle at the pose */
-	line_style pose;
-	double pose_radius;
-
-
-	line_style sigma;
-	double sigma_multiplier;
-	
-	double connect_threshold;
-	double horizon;
-} ld_style;
-
-void ls_set_defaults(line_style*ls);
-void lds_set_defaults(ld_style*lds);
-
-void ls_add_options(line_style*ls, struct option*ops, 
-	const char*prefix, const char*desc_prefix);
-
-void lds_add_options(ld_style*lds, struct option*ops, 
-	const char*prefix, const char*desc_prefix);
-
-void cr_set_color(cairo_t *cr, const char* color);
-void cr_set_style(cairo_t*cr, line_style*);
-void cr_ld_draw(cairo_t* cr, LDP ld, ld_style *p);
-void cr_ld_draw_corr(cairo_t*cr, LDP laser_ref, LDP laser_sens);
-void cr_ld_draw_sigma(cairo_t*cr, LDP ld, double multiplier);
-void cr_set_reference(cairo_t*cr,double*pose);
-
-void cr_lda_draw_pose_path(cairo_t*cr, LDP*lda, int nscans, ld_reference use_reference);
-
-int create_pdf_surface(const char*file, int max_width_points, int max_height_points,
-	double bb_min[2], double bb_max[2], cairo_surface_t**surface_p, cairo_t **cr);
-
-int create_image_surface(int width, int height,
-	double bb_min[2], double bb_max[2], cairo_surface_t**surface_p, cairo_t **cr);
-
-
-
-#endif
-
diff --git a/sm/csm/laser_data_carmen.c b/sm/csm/laser_data_carmen.c
deleted file mode 100644
index a6566a1c428fa0f92ae3213ffa81e5dacd3dbfd6..0000000000000000000000000000000000000000
--- a/sm/csm/laser_data_carmen.c
+++ /dev/null
@@ -1,223 +0,0 @@
-#include <string.h>
-#include <math.h>
-#include <ctype.h>
-
-#include "csm_all.h"
-
-const char * carmen_prefix = "FLASER ";
-
-/** Returns 0 on success */
-int read_next_double(const char*line, size_t*cur, double*d);
-
-/** Returns 0 on success */
-int read_next_integer(const char*line, size_t*cur, int*d);
-
-/** Always returns 0 */
-int read_next_string(const char*line, size_t*cur, char*buf, size_t buf_len);
-
-
-/** Returns 0 on success */
-int read_next_double(const char*line, size_t*cur, double*d) {
-	int inc;
-	int ret = sscanf(line+*cur, " %lf %n", d, &inc);
-	if(1 != ret) {
-		sm_error("Could not read double at %p + %d '%s'. ret: %d.\n", line, *cur, line+*cur, ret);
-		return -1;
-	}
-	*cur += inc;
-	return 0;
-}
-
-/** Returns 0 on success */
-int read_next_integer(const char*line, size_t*cur, int*d) {
-	int inc;
-	if(1 != sscanf(line+*cur, " %d %n", d, &inc)) {
-	/*	sm_error("Could not read integer.\n");*/
-		return -1;
-	}
-	*cur += inc;
-	return 0;
-}
-
-/** Always returns 0 */
-int read_next_string(const char*line, size_t*cur, char*buf, size_t buf_len) {
-	int from = *cur; while(isspace(line[from])) from++;
-	size_t len = 0; while(!isspace(line[from+len])) len++;
-	if(len > buf_len ) len = buf_len;
-	strncpy(buf, line+from, len);
-	*cur += len;
-	return 0;
-}
-
-LDP ld_from_carmen_string(const char*line) {
-	
-	if(0 != strncmp(line, carmen_prefix, strlen(carmen_prefix))) {
-		sm_error("This is not a Carmen line: \n-> %s\n", line);
-		return 0;
-	}
-	
-	size_t cur = strlen(carmen_prefix); 
-
-	
-	int nrays=-1;
-	if(read_next_integer(line, &cur, &nrays)) {
-		sm_error("Could not get number of rays.\n");
-		goto error;
-	}
-
-	LDP ld = ld_alloc_new(nrays);
-	
-	
-	double fov = M_PI;
-	double min_reading = 0;
-	double max_reading = 80;
-	
-	if(nrays == 769) {
-		min_reading = 0.001;
-		max_reading = 4;
-		fov = deg2rad(270.0);
-
-		static int print = 0;
-		if(!print) { print = 1;
-			sm_info("Assuming that 769 rays is an Hokuyo "
-			 "with fov = %f deg, min_reading = %f m, max_reading = %fm\n",
-				rad2deg(fov), min_reading, max_reading);
-		}
-	}
-	
-	ld->min_theta = -fov/2;
-	ld->max_theta = +fov/2;
-	
-	int on_error = 0;
-	int i;
-	for(i=0;i<nrays;i++) {
-		double reading;
-		if(read_next_double(line,&cur,&reading)) {
-			sm_error("Could not read ray #%d / %d, \n", i, nrays); 
-			on_error = 1;
-			break;
-		}
-			
-		ld->valid[i] = (reading > min_reading) && (reading < max_reading);
-		ld->readings[i] = ld->valid[i] ? reading : NAN;
-		ld->theta[i] = ld->min_theta + i * 
-		  (ld->max_theta-ld->min_theta) / (ld->nrays-1);
-		
-		/* bad hokuyo!! */
-		if(nrays == 769) {
-			if(i>725 || i<44) { 
-				ld->valid[i] = 0; 
-				ld->readings[i] = NAN;
-			}
-		}
-		
-	}
-	
-	if(on_error) goto error;
-	
-	if(read_next_double(line,&cur,ld->estimate+0)) goto error;
-	if(read_next_double(line,&cur,ld->estimate+1)) goto error;
-	if(read_next_double(line,&cur,ld->estimate+2)) goto error;
-	if(read_next_double(line,&cur,ld->odometry+0)) goto error;
-	if(read_next_double(line,&cur,ld->odometry+1)) goto error;
-	if(read_next_double(line,&cur,ld->odometry+2)) goto error;
-
-	/* Following: ipc_timestamp hostname timestamp */
-	/* Two options:
-		double string double: 
-			the first is timestamp in seconds, the second is discarded
-		int string int:
-			the first is sec, the second is usec 
-	*/
-	static int warn_format = 1;
-
-	int inc; int sec=-1, usec=-1;
-	int res = sscanf(line + cur, "%d %s %d%n", &sec, ld->hostname, &usec,  &inc);
-	if(3 == res) {
-		ld->tv.tv_sec = sec;
-		ld->tv.tv_usec = usec;
-		if(warn_format)
-			sm_info("Reading timestamp as 'sec hostname usec'.\n");
-	} else {
-		double v1=-1, v2=-1;
-		res = sscanf(line + cur, "%lf %s %lf%n", &v1, ld->hostname, &v2,  &inc);
-		if(3 == res) {
-			ld->tv.tv_sec = (int) floor(v1);
-			ld->tv.tv_usec = floor( (v1 - floor(v1)) * 1e6 );
-			
-			if(warn_format)
-				sm_info("Reading timestamp as doubles (discarding second one).\n");
-			
-		} else {
-			ld->tv.tv_sec = 0;
-			ld->tv.tv_usec = 0;
-			if(warn_format)
-				sm_info("I could not read timestamp+hostname; ignoring (I will warn only once for this).\n");
-		}
-	}
-
-	warn_format = 0;
-
-	fprintf(stderr, "l");
-	return ld;
-	
-	error:
-		printf("Malformed line: '%s'\nat cur = %d\n\t-> '%s'\n", line,(int)cur,line+cur);
-		return 0;
-}
-
-/** Read next FLASER line in file, or NULL on error  */
-int ld_read_next_laser_carmen(FILE*file, LDP*ld) {
-	*ld = 0;
-	#define MAX_LINE_LENGTH 10000
-   char line[MAX_LINE_LENGTH];
-
-	while(fgets(line, MAX_LINE_LENGTH-1, file)) {
-		if(0 != strncmp(line, carmen_prefix, strlen(carmen_prefix))) {
-			sm_debug("Skipping line: \n-> %s\n", line);
-			continue;
-		}
-		
-		*ld = ld_from_carmen_string(line);
-		if(!*ld) {
-			printf("Malformed line? \n-> '%s'", line);
-			return 0;
-		} else {
-			return 1;
-		}
-	}
-	return 1;
-}
-
-/** Write the laser data in CARMEN format */
-void ld_write_as_carmen(LDP ld, FILE * stream) {
-	int i;
-	double timestamp;
-	if(!ld_valid_fields(ld)) {
-		sm_error("Writing bad data to the stream.\n");
-	}
-	fprintf(stream, "FLASER %d ", ld->nrays);
-	for(i=0; i<ld->nrays; i++){
-		fprintf(stream, "%g ", ld->readings[i]);
-	}
-	fprintf(stream, "%g %g %g ", ld->estimate[0], ld->estimate[1], ld->estimate[2]);
-	fprintf(stream, "%g %g %g ", ld->odometry[0], ld->odometry[1], ld->odometry[2]);
-	
-	timestamp = ld->tv.tv_sec + ((double)ld->tv.tv_sec)/1e6;
-	
-	fprintf(stream, "%g %s %g", timestamp, ld->hostname, timestamp);
-	
-	fputs("\n", stream);
-}
-
-void ld_write_format(LDP ld, FILE*f, const char * out_format) {
-	if(!strncmp(out_format, "carmen", 6))
-		ld_write_as_carmen(ld, f);
-	else
-		ld_write_as_json(ld, f);
-	/* XXX: check validity of format string */
-}
-
-
-
-
diff --git a/sm/csm/laser_data_drawing.c b/sm/csm/laser_data_drawing.c
deleted file mode 100644
index eae942c581ba604b1ad239c15db051aad02ac480..0000000000000000000000000000000000000000
--- a/sm/csm/laser_data_drawing.c
+++ /dev/null
@@ -1,144 +0,0 @@
-#include <string.h>
-#include <strings.h>
-#include "laser_data_drawing.h"
-#include "logging.h"
-#include "math_utils.h"
-
-const char*ld_reference_name[4] = { "invalid","odometry","estimate","true_pose"};
-
-const char*ld_reference_to_string(ld_reference r) {
-	return ld_reference_name[r];
-}
-
-ld_reference ld_string_to_reference(const char*s) {
-	int i; for(i=1;i<=3;i++) 
-		if(!strcasecmp(s, ld_reference_to_string( (ld_reference) i) ))
-			return (ld_reference) i;
-			
-	sm_error("Could not translate string '%s' to a reference name.\n", s);
-	return Invalid;
-}
-
-int ld_get_bounding_box(LDP ld, double bb_min[2], double bb_max[2],
-	double pose[3], double horizon) {
-
-	int rays_used = 0;
-	int i; for(i=0;i<ld->nrays;i++) {
-		if(!ld->valid[i]) continue;
-		if(ld->readings[i]>horizon) continue;
-
-		double p0[2] = {
-			cos(ld->theta[i]) * ld->readings[i],
-			sin(ld->theta[i]) * ld->readings[i]
-		};
-		
-		double p[2];
-		transform_d(p0,pose,p);
-		
-		if(0 == rays_used) {
-			bb_min[0] = bb_max[0] = p[0];
-			bb_min[1] = bb_max[1] = p[1];
-		} else {
-			int j=0; for(j=0;j<2;j++) {
-				bb_min[j] = GSL_MIN(bb_min[j], p[j]);
-				bb_max[j] = GSL_MAX(bb_max[j], p[j]);
-			}
-		}
-
-		rays_used++;
-	}
-		
-	return rays_used > 3;
-}
-
-/*void lda_get_bb2(LDP *ld, int nld, BB2 bb2, ld_reference use_reference, double horizon) {
-	double bb_min[2], bb_max[2], offset[3] = {0,0,0};
-	lda_get_bounding_box(ld,nld, bb2->bb_)
-}*/
-
-	
-void lda_get_bounding_box(LDP *lda, int nld, double bb_min[2], double bb_max[2],
-	double offset[3], ld_reference use_reference, double horizon) {
-	
-	int k;
-	for(k=0;k<nld;k++) {
-		LDP ld = lda[k];
-
-		double *ref = ld_get_reference_pose(ld, use_reference);
-		if(!ref) {
-			sm_error("Pose %s not set in scan #%d.\n", 
-				ld_reference_to_string(use_reference), k);
-			continue;
-		}
-		
-		double pose[3];
-		oplus_d(offset, ref, pose);
-	
-		if(k==0) 
-			ld_get_bounding_box(ld, bb_min, bb_max, pose, horizon);
-		else {
-			double this_min[2], this_max[2];
-			ld_get_bounding_box(ld, this_min, this_max, pose, horizon);
-			int i; for(i=0;i<2;i++) {
-				bb_min[i] = GSL_MIN(bb_min[i], this_min[i]);
-				bb_max[i] = GSL_MAX(bb_max[i], this_max[i]);
-			}
-		}
-	}
-}
-
-double * ld_get_reference_pose_silent(LDP ld, ld_reference use_reference) {
-	double * pose;
-	switch(use_reference) {
-		case Odometry: pose = ld->odometry; break;
-		case Estimate: pose = ld->estimate; break;
-		case True_pose: pose = ld->true_pose; break;
-		default: 
-			sm_error("Could not find pose identified by %d.\n", (int) use_reference);
-			return 0;
-	}
-	return pose;
-}
-
-double * ld_get_reference_pose(LDP ld, ld_reference use_reference) {
-	double * pose = ld_get_reference_pose_silent(ld, use_reference);
-	if(any_nan(pose, 3)) {
-		sm_error("Required field '%s' not set in laser scan.\n", 
-			ld_reference_to_string(use_reference) );
-		return 0;
-	}
-	return pose;
-}
-
-
-void compute_stroke_sequence(LDP ld, struct stroke_sequence*draw_info,
-	double horizon, double connect_threshold) {
-	int last_valid = -1; int first = 1;
-	int i; for(i=0;i<ld->nrays;i++) {
-		if( (!ld_valid_ray(ld,i)) || (ld->readings[i] > horizon) ) {
-			draw_info[i].valid = 0;
-			continue;
-		}
-		draw_info[i].valid = 1;
-		draw_info[i].p[0] = ld->readings[i] * cos(ld->theta[i]);
-		draw_info[i].p[1] = ld->readings[i] * sin(ld->theta[i]);
-		
-		if(first) { 
-			first = 0; 
-			draw_info[i].begin_new_stroke = 1;
-			draw_info[i].end_stroke = 0;
-		} else {
-			int near =  square(connect_threshold) > 
-				distance_squared_d(draw_info[last_valid].p, draw_info[i].p);
-			draw_info[i].begin_new_stroke = near ? 0 : 1;
-			draw_info[i].end_stroke = 0;
-			draw_info[last_valid].end_stroke = draw_info[i].begin_new_stroke;
-		}
-		last_valid = i;
-	} /*for */
-	if(last_valid >= 0)
-		draw_info[last_valid].end_stroke = 1;
-} /* find buff .. */
-
-
-
diff --git a/sm/csm/laser_data_drawing.h b/sm/csm/laser_data_drawing.h
deleted file mode 100644
index fd9ca1a7ae36c6acccd18cdae5ac11d9d3cdcad6..0000000000000000000000000000000000000000
--- a/sm/csm/laser_data_drawing.h
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifndef H_LASER_DATA_DRAWING
-#define H_LASER_DATA_DRAWING
-
-#include "laser_data.h"
-
-typedef enum { Invalid = 0, Odometry = 1, Estimate = 2, True_pose = 3 } ld_reference;
-
-const char*ld_reference_to_string(ld_reference);
-ld_reference ld_string_to_reference(const char*string);
-
-/** Gets a pointer to the pose specified by 'use_reference',
-    or 0 if use_reference is invalid. */ 
-double * ld_get_reference_pose_silent(LDP ld, ld_reference use_reference);
-/** Same as ld_get_reference_pose_silent(), but it also checks 
-    that the pose is valid (no NANs inside). */
-double * ld_get_reference_pose(LDP ld, ld_reference use_reference);
-
-
-
-int ld_read_some_scans_distance(FILE*file, LDP **array, int*num, 
-	ld_reference which, double d_xy, double d_th);
-
-typedef struct {
-	/** lower left point */
-	double pose[3]; 
-	/** width, height; */
-	double size[2]; 
-} oriented_bbox;
-
-typedef oriented_bbox* BB2;
-
-
-/** Returns != 0 if enough points were found */
-int ld_get_bounding_box(LDP ld, double bb_min[2], double bb_max[2],
-	double pose[3], double horizon);
-	
-void lda_get_bounding_box(LDP *ld, int nld, double bb_min[2], double bb_max[2],
-	double offset[3], ld_reference use_reference, double horizon);
-
-/*void lda_get_bb2(LDP *ld, int nld, BB2 bb2, ld_reference use_reference, double horizon);*/
-
-
-void oriented_bbox_compute_corners(const BB2,
-	double ul[2], double ur[2], double ll[2], double lr[2]);
-
-void ld_get_oriented_bbox(LDP ld, double horizon, BB2);
-
-/* Simple API for finding bounding box */
-struct bbfind_imp;
-typedef struct bbfind_imp bbfind;
-bbfind * bbfind_new();
-
-int bbfind_add_point(bbfind*, double point[2]);
-int bbfind_add_point2(bbfind*, double x, double y);
-int bbfind_add_bbox(bbfind*, const BB2);
-
-int bbfind_compute(bbfind*, BB2);
-void bbfind_free(bbfind*);
-
-/* For drawing stroke */
-
-struct stroke_sequence {
-	int begin_new_stroke;
-	int end_stroke;
-	int valid;
-	
-	double p[2];
-}; 
-
-void compute_stroke_sequence(LDP ld, struct stroke_sequence*,
-	double horizon, double connect_threshold);
-
-
-#endif
diff --git a/sm/csm/laser_data_fisher.c b/sm/csm/laser_data_fisher.c
deleted file mode 100644
index 87f8262c8ab2c9b738c1a57b69b221927f9e95d6..0000000000000000000000000000000000000000
--- a/sm/csm/laser_data_fisher.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <math.h>
-#include <egsl/egsl_macros.h>
-
-#include "csm_all.h"
-
-/** 
-	This computes the Fisher Information Matrix, in robot coordinates.
-	Uses field 'true_alpha' (and 'theta', 'readings').  
-	
-	For details about the the Fisher Information Matrix,
-	please see this paper: http://purl.org/censi/2006/accuracy
-*/
-
-val ld_fisher0(LDP ld) {
-	val fim   = zeros(3,3);
-	int i;
-	for(i=0;i<ld->nrays;i++) {		
-		double alpha = ld->true_alpha[i];
-		if(is_nan(alpha)) continue;
-		
-		double theta = ld->theta[i];
-		double beta  = alpha-theta;
-		
-		double r = ld->readings[i];
-		double c = cos(alpha);
-		double s = sin(alpha);
-		
-		double z = 1 / cos(beta);
-		double t = tan(beta);
-		
-		double fim_k[9] ={
-			c*c*z*z,    c*s*z*z,   c*z *t*r,
-			c*s*z*z,    s*s*z*z,   s*z *t*r, 
-			c*z*t*r,    s*z*t*r,   t*r *t*r 
-		};
-		
-		egsl_push();
-			val k = egsl_vFda(3,3,fim_k);
-			add_to(fim, k);
-		egsl_pop();
-	}
-	return fim;
-}
diff --git a/sm/csm/laser_data_json.c b/sm/csm/laser_data_json.c
deleted file mode 100644
index 318c170db6ebf8c04067d6ce3d8a318447358d2a..0000000000000000000000000000000000000000
--- a/sm/csm/laser_data_json.c
+++ /dev/null
@@ -1,268 +0,0 @@
-#include <errno.h>
-#include <string.h>
-#include <math.h>
-#include <ctype.h>
-
-#include "csm_all.h"
-
-void jo_add_timestamp(JO jo, const char*name, struct timeval*tv);
-int is_all_nan(const double *v, int n );
-void jo_add_double_array_if_not_nan(JO jo, const char*name, const double *v, int n);
-int all_is(int *a, int n, int v);
-
-/* -------------------------------------------- */
-
-
-JO matrix_to_json(gsl_matrix*m) {
-	JO jo = jo_new_array();
-	if(m->size1>1) {
-		size_t i,j;
-		for(i=0;i<m->size1;i++) {
-			JO row  = json_object_new_array();
-			for(j=0;j<m->size2;j++) {
-				double v = gsl_matrix_get(m,i,j);
-				json_object_array_add(row, jo_double_or_null(v));
-			}
-			json_object_array_add(jo, row);
-		}
-	} else {
-		size_t i = 1, j;
-		JO row  = jo;
-		for(j=0;j<m->size2;j++) {
-			double v = gsl_matrix_get(m,i,j);
-			json_object_array_add(row, jo_double_or_null(v));
-		}
-	}
-	return jo;
-}
-
-int json_to_corr(JO array, struct correspondence*corr, int n) {
-	/** XXX : check it's an array and its size is good */
-	int i;
-	for(i=0;i<n;i++) {
-		JO element = json_object_array_get_idx(array, i);
-		if(element == NULL) {
-			corr[i].valid = 0;
-			corr[i].j1 = -1;
-			corr[i].j2 = -1;
-		} else {
-			corr[i].valid = 1;
-			jo_read_int(element, "j1", &(corr[i].j1));
-			jo_read_int(element, "j2", &(corr[i].j2));
-			int type;
-			jo_read_int(element, "type", &(type));
-			corr[i].type = type;
-		}
-	}
-	return 1;
-}
-
-JO corr_to_json(struct correspondence*corr, int n) {
-	JO jo = jo_new_array();
-	int i;
-	for(i=0;i<n;i++) {
-		if(corr[i].valid) {
-			JO c = jo_new();
-			jo_add_int(c, "j1", corr[i].j1);
-			jo_add_int(c, "j2", corr[i].j2);
-			jo_add_int(c, "type", (int) corr[i].type);
-			jo_array_add(jo, c);
-		} else {
-			jo_array_add(jo, jo_new_null());
-		}
-	}
-	return jo;
-}
-
-
-JO vector_to_json(gsl_vector*vec) {
-	JO jo = json_object_new_array();
-	size_t j;
-	for(j=0;j<vec->size;j++) {
-		double v = gsl_vector_get(vec,j);
-		jo_array_add(jo, jo_double_or_null(v));
-	}
-	return jo;
-}
-
-
-void jo_add_timestamp(JO jo, const char*name, struct timeval*tv) {
-	int array[2] = {tv->tv_sec, tv->tv_usec};
-	jo_add_int_array(jo, name, array, 2);
-}
-
-JO result_to_json(struct sm_params*p, struct sm_result *r) {
-	JO jo = json_object_new_object();
-	jo_add_int(jo, "valid",  r->valid);
-	
-	if(r->valid) {
-		jo_add_double_array(jo, "x",  r->x, 3);
-	
-		if(p->do_compute_covariance) {
-			jo_add(jo, "cov_x",   matrix_to_json(r->cov_x_m ) );
-			jo_add(jo, "dx_dy1",  matrix_to_json(r->dx_dy1_m) );
-			jo_add(jo, "dx_dy2",  matrix_to_json(r->dx_dy2_m) );
-		}
-	}
-		jo_add_int(jo, "iterations", r->iterations);
-		jo_add_int(jo, "nvalid", r->nvalid);
-		jo_add_double(jo, "error", r->error);
-		
-		jo_add_timestamp(jo, "laser_ref_timestamp", &(p->laser_ref->tv));
-		jo_add_timestamp(jo, "laser_sens_timestamp",  &(p->laser_sens->tv));
-	
-	return jo;
-}
-
-int is_all_nan(const double *v, int n ) {
-	int i; for(i=0;i<n;i++) if(v[i]==v[i]) return 0;
-	return 1;
-}
-
-/** Adds unless it's all NAN */
-void jo_add_double_array_if_not_nan(JO jo, const char*name, const double *v, int n) {
-	if(is_all_nan(v,n)) return;
-	jo_add_double_array(jo, name, v, n);
-}
-
-/** true if all values are equal to v */
-int all_is(int *a, int n, int v) {
-	int i; for(i=0;i<n;i++) if(a[i]!=v) return 0;
-	return 1;
-}
-
-JO ld_to_json(LDP ld) {
-	JO jo = json_object_new_object();
-	int n = ld->nrays;
-
-	jo_add_int(jo, "nrays",    ld->nrays);
-	jo_add_double(jo, "min_theta", ld->min_theta);
-	jo_add_double(jo, "max_theta", ld->max_theta);
-
-	jo_add_double_array(jo, "odometry",   ld->odometry,  3);
-	jo_add_double_array(jo, "estimate",   ld->estimate,  3);
-	jo_add_double_array(jo, "true_pose",  ld->true_pose, 3);
-
-	jo_add_double_array(jo, "theta",     ld->theta, n);
-	jo_add_double_array(jo, "readings",   ld->readings, n);
-	jo_add_double_array_if_not_nan(jo, "readings_sigma", ld->readings_sigma, n);
-
-	jo_add_int_array(jo, "valid",   ld->valid, n);
-
-	if(!all_is(ld->cluster, n, -1))
-		jo_add_int_array(jo, "cluster",  ld->cluster, n);
-
-	jo_add_double_array_if_not_nan(jo, "alpha",        ld->alpha, n);
-	jo_add_double_array_if_not_nan(jo, "cov_alpha",    ld->cov_alpha, n);
-
-	if(!all_is(ld->alpha_valid, n, 0))
-		jo_add_int_array(jo, "alpha_valid", ld->alpha_valid, n);
-	
-	jo_add_double_array_if_not_nan(jo, "true_alpha",      ld->true_alpha, n);
-	
-	int timeval[2] = {ld->tv.tv_sec, ld->tv.tv_usec};
-	jo_add_int_array(jo, "timestamp", timeval, 2);
-	
-	return jo;
-}
-
-/* TODO: add some checks */
-LDP json_to_ld(JO jo) {
-	int n;
-	if(!jo_read_int(jo, "nrays", &n)) {
-		sm_error("Could not read nrays.\n");
-		return 0;
-	}
-	
-	LDP ld = ld_alloc_new(n);
-	
-	jo_read_double(jo, "min_theta", &ld->min_theta);
-	jo_read_double(jo, "max_theta", &ld->max_theta);	
-	/* XXX add more checks */
-	jo_read_double_array(jo, "theta", ld->theta, n, NAN);	
-	jo_read_double_array(jo, "readings", ld->readings, n, NAN);	
-
-	if(jo_has_field(jo,"readings_sigma") && !jo_read_double_array(jo, "readings_sigma", ld->readings_sigma, n, NAN))
-		{ sm_error("Error while reading field 'readings_sigma'.\n"); return 0; }
-
-	jo_read_int_array(jo, "valid",     ld->valid, n, 0);
-	jo_read_int_array(jo, "cluster",   ld->cluster, n, -1);
-
-	if(jo_has_field(jo,"alpha") && !jo_read_double_array(jo, "alpha",ld->alpha, n, NAN)) 
-		{ sm_error("Error while reading field alpha.\n"); return 0; }
-		
-	if(jo_has_field(jo,"cov_alpha") && !jo_read_double_array(jo, "cov_alpha", ld->cov_alpha, n, NAN))
-		{ sm_error("Error while reading field cov_alpha.\n"); return 0; }
-	
-	if(jo_has_field(jo,"alpha_valid") && !jo_read_int_array(jo, "alpha_valid",   ld->alpha_valid, n, 0)) 
-		{ sm_error("Error while reading field alpha_valid.\n"); return 0; }
-
-	if(jo_has_field(jo,"true_alpha") && !jo_read_double_array(jo, "true_alpha", ld->true_alpha, n, NAN))
-		{ sm_error("Error while reading field true_alpha.\n"); return 0; }
-		
-	
-	jo_read_double_array(jo, "odometry", ld->odometry, 3, NAN);
-	jo_read_double_array(jo, "estimate", ld->estimate, 3, NAN);	
-	jo_read_double_array(jo, "true_pose", ld->true_pose, 3, NAN);	
-	
-	int array[2] = {-1,-1};
-	jo_read_int_array(jo, "timestamp", array, 2,-1);
-	ld->tv.tv_sec = array[0];
-	ld->tv.tv_usec = array[1];
-	
-	return ld;
-}
-
-LDP ld_from_json_string(const char*s) {
-	JO jo = json_parse(s);
-	if(!jo) {
-		sm_error("Invalid JSON found.\n");
-		return 0;
-	}
-	LDP ld = json_to_ld(jo);
-	if(!ld) {
-		sm_error("Could not read laser_data:\n\n%s\n", json_object_to_json_string(jo));
-		return 0;
-	}
-	jo_free(jo);
-	return ld;
-}
-
-LDP ld_from_json_stream(FILE*file) {
-	JO jo; /* the monkey */
-	LDP ld;
-	
-	jo = json_read_stream(file);
-	if(!jo) {
-		if(!feof(file)) {
-			fprintf(stderr, " (!)\n");
-			sm_error("Invalid JSON found.\n");
-		}
-		fprintf(stderr, " EOF\n");
-		
-		return 0;
-	}
-
-	ld = json_to_ld(jo);
-	if(!ld) {
-		sm_error("Could not read laser_data:\n\n%s\n", json_object_to_json_string(jo));
-		return 0;
-	}
-	jo_free(jo);
-	
-	fprintf(stderr, "l");
-	
-	return ld;
-}
-
-void ld_write_as_json(LDP ld, FILE * stream) {
-	if(!ld_valid_fields(ld)) {
-		sm_error("Writing bad data to the stream.\n");
-	}
-
-	JO jo = ld_to_json(ld);
-	fputs(json_object_to_json_string(jo), stream);
-	fputs("\n", stream);
-	jo_free(jo);
-}
-
diff --git a/sm/csm/laser_data_json.h b/sm/csm/laser_data_json.h
deleted file mode 100644
index 8e1dfe53bbf7c42614a726f4f93317751eadc797..0000000000000000000000000000000000000000
--- a/sm/csm/laser_data_json.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef H_LASER_DATA_JSON
-#define H_LASER_DATA_JSON
-
-#include <gsl/gsl_matrix.h>
-#include <gsl/gsl_vector.h>
-
-#include <json-c/json.h>
-#include <json-c/json_more_utils.h>
-
-#include "laser_data.h"
-#include "algos.h"
-
-/* Laserdata to/from json */
-
-JO ld_to_json(LDP);
-LDP json_to_ld(JO);
-
-JO corr_to_json(struct correspondence*, int n);
-int json_to_corr(JO jo, struct correspondence*, int n);
-
-LDP ld_from_json_stream(FILE*);
-LDP ld_from_json_string(const char*s);
-void ld_write_as_json(LDP ld, FILE * stream);
-
-
-/* Other stuff to/from json */
-
-JO matrix_to_json(gsl_matrix*m);
-JO vector_to_json(gsl_vector*v);
-JO result_to_json(struct sm_params*p, struct sm_result *r);
-
-#endif
diff --git a/sm/csm/laser_data_load.c b/sm/csm/laser_data_load.c
deleted file mode 100644
index 5c65c96d3cd5f105b5f5ecf5c5af4e14b5777134..0000000000000000000000000000000000000000
--- a/sm/csm/laser_data_load.c
+++ /dev/null
@@ -1,189 +0,0 @@
-#include <ctype.h>
-
-#include "csm_all.h"
-#include "laser_data_drawing.h"
-
-/** Loads *some* data based on an acceptance criterion. */
-int ld_read_some(FILE*file, LDP **array, int*num, int (*accept)(LDP));
-
-	/* Every n scans */
-	int interval_accept(LDP ld);
-		int interval_count = 0;
-		int interval_interval = 10;
-
-	/* Every one */
-	int always(LDP ld);
-	
-	/* Read according to distance */
-	int distance_accept(LDP ld);
-		static int distance_count;
-		static double distance_last_pose[3];
-		static double distance_interval_xy = 10;
-		static double distance_interval_th = 10;
-		static ld_reference distance_reference;
-		void distance_accept_reset(ld_reference, double interval_xy, double interval_th);
-
-
-
-/* ---------------------------------------- */
-
-int ld_read_some(FILE*file, LDP **array, int*num, int (*accept)(LDP)) {
-	*array = 0; *num = 0;
-	int size = 10;
-	LDP * ar = (LDP*) malloc(sizeof(LDP)*size);
-	
-	while(1) {
-		LDP ld = ld_read_smart(file);
-
-		if(!ld) break;
-		
-		if( ! (*accept)(ld) ) {
-			ld_free(ld);
-			continue;
-		}
-		
-		
-		ar[(*num)++] = ld;
-		
-		if(*num > size - 1) {
-			size *= 2;
-			if(! (ar = (LDP*) realloc(ar, sizeof(LDP)*size)) ) {
-				sm_error("Cannot allocate (size=%d)\n", size);
-				return 0;
-			}
-		}
-	}
-
-	*array = ar; 
-
-	return feof(file);
-}
-
-
-/* Read every tot scans */
-int interval_accept(LDP ld) {
-	ld=ld;
-	int accept = interval_count % interval_interval == 0;
-	interval_count++;
-	return accept;
-}
-
-int ld_read_some_scans(FILE*file, LDP **array, int*num, int interval) {
-	interval_count = 0;
-	interval_interval = interval;
-	return ld_read_some(file, array, num, interval_accept);
-}
-
-/* Read all scans */
-int always(LDP ld)  { ld=ld; return 1; }
-int ld_read_all(FILE*file, LDP **array, int*num) {
-	return ld_read_some(file, array, num, always);
-}
-
-void distance_accept_reset(ld_reference which, double interval_xy, double interval_th) {
-	distance_count = 0;
-	distance_interval_xy = interval_xy;
-	distance_interval_th = interval_th;
-	distance_reference = which;
-}
-
-int distance_accept(LDP ld) {
-	double * this_pose = ld_get_reference_pose(ld, distance_reference);
-	if(!this_pose) return 0;
-	
-	distance_count++;
-	if(distance_count == 1) {
-		copy_d(this_pose, 3, distance_last_pose);
-		return 1;
-	} else {
-		double diff[3];
-		pose_diff_d(distance_last_pose, this_pose, diff);
-		double distance  = norm_d(diff);
-		
-		if(distance >= distance_interval_xy || 
-		   fabs(diff[2]) >= distance_interval_th ) 
-		{
-			copy_d(this_pose, 3, distance_last_pose);
-		/*	sm_debug("Accepting #%d, %f\n", distance_count, distance);*/
-			return 1;
-		}
-		else 
-			return 0;
-	}
-}
-
-int ld_read_some_scans_distance(FILE*file, LDP **array, int*num, 
-	ld_reference which, double d_xy, double d_th) {
-	distance_accept_reset(which, d_xy, d_th);
-	return ld_read_some(file, array, num, distance_accept);
-}
-
-
-
-/** 
-	Tries to read a laser scan from file. If error or EOF, it returns 0.
-	Whitespace is skipped. If first valid char is '{', it tries to read 
-	it as JSON. If next char is 'F' (first character of "FLASER"),
-	it tries to read in Carmen format. Other lines are discarded.
-	0 is returned on error or feof
-*/
-LDP ld_read_smart(FILE*f) {
-	while(1) {
-		int c;
-		while(1) {
-			c = fgetc(f);
-			if(feof(f)) { 
-				/* sm_debug("eof\n"); */
-				return 0;
-			}
-			if(!isspace(c)) break;
-		}
-		ungetc(c, f);
-
-		switch(c) {
-			case '{': {
-/*				sm_debug("Reading JSON\n"); */
-				return ld_from_json_stream(f);
-			}
-			case 'F': {
-/*				sm_debug("Reading Carmen\n");  */
-				LDP ld;
-				if(!ld_read_next_laser_carmen(f, &ld)) {
-					sm_error("bad carmen\n");
-					return 0;
-				}
-				return ld;
-			}
-			default: {
-				/*sm_error("Could not read ld. First char is '%c'. ", c);*/
-				char max_line[10000];
-				char * res = fgets(max_line, 10000-2, f);
-				if(!res) {
-					sm_error("Could not skip line. \n");
-					return 0;
-				} else {
-					fprintf(stderr, "s");
-/*					sm_error("Skipped '%s'\n", res);*/
-				}
-			}
-		}
-	}
-}
-
-LDP ld_read_smart_string(const char*line) {
-	switch(*line) {
-		case '{': 
-			return ld_from_json_string(line);
-		
-		case 'F': 
-			return ld_from_carmen_string(line);
-			
-		default:
-			sm_error("Invalid laserdata format: '%s'.", line);
-			return 0;
-	}
-}
-
-
-
-
diff --git a/sm/csm/math_utils_gsl.c b/sm/csm/math_utils_gsl.c
deleted file mode 100644
index 1bb120c2fe0590da648531e8e8d8eb291b7894aa..0000000000000000000000000000000000000000
--- a/sm/csm/math_utils_gsl.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#include "csm_all.h"
-
-void transform(const gsl_vector* p, const gsl_vector* x, gsl_vector*res) {
-	double theta = gvg(x,2);
-	double c = cos(theta); double s = sin(theta);
-	gsl_vector_set(res, 0, c * gvg(p,0) -s*gvg(p,1) + gvg(x,0));
-	gsl_vector_set(res, 1, s * gvg(p,0) +c*gvg(p,1) + gvg(x,1));
-}
-
-void gsl_vector_set_nan(gsl_vector*v) {
-	gvs(v,0,GSL_NAN);
-	gvs(v,1,GSL_NAN);
-}
-
-double norm(const gsl_vector*a){
-	double x = gvg(a,0);
-	double y = gvg(a,1);
-	return sqrt(x*x+y*y);
-}
-
-gsl_vector * vector_from_array(unsigned int n, double *x) {
-	gsl_vector * v = gsl_vector_alloc(n);
-	unsigned int i;
-	for(i=0;i<n;i++)
-		gvs(v,i,x[i]);
-	
-	return v;
-}
-
-void copy_from_array(gsl_vector*v, double*x) {
-	size_t i; 
-	for(i=0;i<v->size;i++)
-		gsl_vector_set(v,i, x[i]);
-}
-
-void vector_to_array(const gsl_vector*v, double*x){
-	size_t i; 
-	for(i=0;i<v->size;i++)
-		x[i] = gvg(v,i);
-}
-
-void oplus(const gsl_vector*x1,const gsl_vector*x2, gsl_vector*res) {
-	double c = cos(gvg(x1,2));
-	double s = sin(gvg(x1,2));
-	gvs(res,0,  gvg(x1,0)+c*gvg(x2,0)-s*gvg(x2,1));
-	gvs(res,1,  gvg(x1,1)+s*gvg(x2,0)+c*gvg(x2,1));
-	gvs(res,2,  gvg(x1,2)+gvg(x2,2));
-}
-
-void ominus(const gsl_vector*x, gsl_vector*res) {
-	double c = cos(gvg(x,2));
-	double s = sin(gvg(x,2));
-	gvs(res,0,  -c*gvg(x,0)-s*gvg(x,1));
-	gvs(res,1,   s*gvg(x,0)-c*gvg(x,1));
-	gvs(res,2,  -gvg(x,2));
-}
-
-void pose_diff(const gsl_vector*pose2,const gsl_vector*pose1,gsl_vector*res) {
-	gsl_vector* temp = gsl_vector_alloc(3);
-	ominus(pose1, temp);
-	oplus(temp, pose2, res);
-	gsl_vector_free(temp);
-}
-
-const char* gsl_friendly_pose(gsl_vector*v) {
-	return friendly_pose(v->data);
-}
-
-static char egsl_tmp_buf[1024];
-const char* egsl_friendly_pose(val v) {
-	sprintf(egsl_tmp_buf, "(%4.2f mm, %4.2f mm, %4.4f deg)",
-		1000*egsl_atv(v,0),
-		1000*egsl_atv(v,1),
-		rad2deg(egsl_atv(v,2)));
-	return egsl_tmp_buf;
-}
-
-const char* egsl_friendly_cov(val cov) {
-	
-	double limit_x  = 2 * sqrt(egsl_atm(cov, 0, 0));
-	double limit_y  = 2 * sqrt(egsl_atm(cov, 1, 1));
-	double limit_th = 2 * sqrt(egsl_atm(cov, 2, 2));
-	
-	sprintf(egsl_tmp_buf, "(+- %4.2f mm,+- %4.2f mm,+- %4.4f deg)",
-		1000*limit_x,
-		1000*limit_y,
-		rad2deg(limit_th));
-	return egsl_tmp_buf;
-}
-
-
-/*double distance(const gsl_vector* a, const gsl_vector* b) {
-	distance_counter++;
-	double x = gvg(a,0)-gvg(b,0);
-	double y = gvg(a,1)-gvg(b,1);
-	return sqrt(x*x+y*y);
-}
-
-double distance_squared(const gsl_vector* a, const gsl_vector* b) {
-	distance_counter++;
-	double x = gvg(a,0)-gvg(b,0);
-	double y = gvg(a,1)-gvg(b,1);
-	return x*x+y*y;
-}*/
diff --git a/sm/csm/math_utils_gsl.h b/sm/csm/math_utils_gsl.h
deleted file mode 100644
index 6b30b785f10ba77cac5de2dcdf249a7007c84a42..0000000000000000000000000000000000000000
--- a/sm/csm/math_utils_gsl.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef H_MATH_UTILS_GSL
-#define H_MATH_UTILS_GSL
-
-#include <gsl/gsl_math.h>
-#include <egsl/egsl.h>
-
-#include "laser_data.h"
-
-#define gvg gsl_vector_get
-#define gvs gsl_vector_set
-
-
-/* GSL stuff */
-	const char* gsl_friendly_pose(gsl_vector*v);
-	gsl_vector * vector_from_array(unsigned int n, double *x);
-	void vector_to_array(const gsl_vector*v, double*);
-	void copy_from_array(gsl_vector*v, double*);
-
-	void oplus(const gsl_vector*x1,const gsl_vector*x2, gsl_vector*res);
-	void ominus(const gsl_vector*x, gsl_vector*res);
-	void pose_diff(const gsl_vector*pose2,const gsl_vector*pose1,gsl_vector*res);
-
-	void transform(const gsl_vector* point2d, const gsl_vector* pose, gsl_vector*result2d);
-	void gsl_vector_set_nan(gsl_vector*v);
-
-	double distance(const gsl_vector* a,const gsl_vector* b);
-	double distance_squared(const gsl_vector* a,const gsl_vector* b);
-
-	/** Returns norm of 2D point p */
-	double norm(const gsl_vector*p);
-	const char* egsl_friendly_pose(val pose);
-	const char* egsl_friendly_cov(val cov);
-
-/** Returns Fisher's information matrix. You still have to multiply
-    it by (1/sigma^2). */
-val ld_fisher0(LDP ld);
-
-
-#endif
-
-
diff --git a/sm/csm/math_utils_test.c b/sm/csm/math_utils_test.c
deleted file mode 100644
index d8ad866fcce91d618b3240ac403b3cb9686e5d63..0000000000000000000000000000000000000000
--- a/sm/csm/math_utils_test.c
+++ /dev/null
@@ -1,155 +0,0 @@
-#include "csm_all.h"
-#include <time.h>
-
-#include "math_utils.h"
-
-
-inline float myasin(float x) {
-	const float threshold = .52;
-	if(x > threshold) {
-		static float z, der0, der1,der2,der3;
-		static int first = 1;
-		if(first) {
-			z = 0.5* (threshold + 0.707);
-			der0 = asin(z);
-			float M = 1-z*z;
-			der1 = 1 / sqrt(M);
-			der2 = (sqrt(M) * z) / (M*M);
-			der3 = (sqrt(M) / ( M * M ) + (3 * (z*z) * sqrt(M) ) / (M * M * M) )  ;
-			first = 0;
-			printf("%f %f  %f %f \n", der0, der1, der2, der3);
-		}
-		float m = x-z;
-		return der0 + m * ( der1 +  m * ( (der2/2) +   m * (der3/6) ) );
-	}
-	else{
-		float x2 = x * x;
-		float der1 = 1;
-		float der3 = 1.0f/6;
-		float der5 = 3.0f/40;
-		float der7 = 15.0f/ (48*7);
-		return x * ( der1 + x2 *( der3 + x2 * (der5  + der7 * x2 )));
-	}
-}
-
-#define myacos(x)  ( ((float) (M_PI/2) ) - myasin(x))
-inline void polar(float x, float y, double* restrict rho, double* restrict theta) {
-	*rho = sqrtf(x*x+y*y);
-	if(x > 0) {
-		if(y > 0) {
-			if(x < y)
-				*theta = myacos(x / *rho);
-			else
-				*theta = myasin(y / *rho);
-		} else {
-			if( x < -y )
-				*theta = - myacos(x / *rho);
-			else
-				*theta = - myasin( (-y) / *rho) ;
-		} 
-	} else  {
-		if(y > 0) {
-			if( (-x) < y)
-				*theta = ((float)M_PI) - myacos(-x / *rho);
-			else
-				*theta = ((float)M_PI) - myasin( y / *rho);
-		} else {
-			if ( (-x) < (-y) )
-				*theta = ((float)M_PI) + myacos(-x / *rho);
-			else
-				*theta = ((float)M_PI) + myasin(-y / *rho);
-		}
-	}
-}
-
-inline void polar2(double x, double y, double* restrict rho, double* restrict theta) {
-	*rho = sqrt(x*x+y*y);
-	*theta = atan2(y,x);
-}
-
-int main() {
-	double a[2] = {0, 0};
-	double b[2] = {5, 5};
-	double x[5][2] = {
-		{0, -10},
-		{  2, 1},
-		{100, 1},
-		{0,0},{5,5}};
-	
-	gsl_vector * A = vector_from_array(2,a);
-	gsl_vector * B = vector_from_array(2,b);
-
-	gsl_vector * res = gsl_vector_alloc(2);
-	
-	int i;
-	#if 0
-	for(i=0;i<5;i++){
-		gsl_vector * X = vector_from_array(2,x[i]);
-		
-/*		projection_on_segment(A,B,X,res);*/
-		
-		printf("Projection of %f %f is %f %f \n", gvg(X,0),gvg(X,1),
-			gvg(res,0),gvg(res,1));
-	}
-	#endif
-	
-	int errors = 0;
-	double should_be_nan[2] = { 0.0 / 0.0, GSL_NAN };
-	for(i=0;i<2;i++) {
-		if(!isnan(should_be_nan[i])) {
-			printf("#%d: isnan(%f) failed \n", i, should_be_nan[i]);
-			errors++;
-		}
-		if(!is_nan(should_be_nan[i])) {
-			printf("#%d: is_nan(%f) failed \n", i, should_be_nan[i]);
-			errors++;
-		}
-	}
-	
-	double max_error = 0;
-	int num = 10000;
-	for(i=0;i<num;i++) {
-		double theta = (i * 2 * M_PI) / (num-1);
-		double x = cos(theta), y = sin(theta);
-		
-		double theta_est, rho;
-		polar(x,y,&rho,&theta_est);
-		double error = fabs( angleDiff(theta_est,theta) );
-		if(error > max_error)
-		printf("%d x %f y %f theta %f theta_est %f error %f \n", i, x, y, theta, theta_est, error);
-		max_error = GSL_MAX(error, max_error);
-	}
-
-	int NUM2 = 1000; int k;
-	float c[num], s[num];
-	for(i=0;i<num;i++) {
-		double theta = (i * 2 * M_PI) / (num-1);
-		c[i]= cos(theta); s[i] = sin(theta);
-	}
-	
-	clock_t start1 = clock();
-	double thetaf,rhof;
-	for(k=0;k<NUM2;k++)
-	for(i=0;i<num;i++) {
-		polar(c[i],s[i],&rhof, &thetaf);
-	}
-	clock_t end1 = clock();
-	
-	clock_t start2 = clock();
-	double rho,theta;
-	for(k=0;k<NUM2;k++)
-	for(i=0;i<num;i++) {
-		polar2(c[i],s[i],&rho, &theta);
-	}
-	clock_t end2 = clock();
-	
-	float seconds1 = (end1-start1)/((float)CLOCKS_PER_SEC);
-	float seconds2 = (end2-start2)/((float)CLOCKS_PER_SEC);
-	
-	printf("  polar: %f   polar2: %f\n", seconds1, seconds2);
-	
-	printf("Maximum error for polar(): %lf rad = %lf deg\n", max_error, rad2deg(max_error));
-/*	printf("Acos() called for   %f  %f\n", min_acos, max_acos);
-	printf("Asin() called for   %f  %f\n", min_asin, max_asin);
-*/	return errors;
-}
diff --git a/sm/csm/mbicp/MbICP.c b/sm/csm/mbicp/MbICP.c
deleted file mode 100644
index e0b45ef731898387adbe0c733e7c02ff63c3bb87..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/MbICP.c
+++ /dev/null
@@ -1,678 +0,0 @@
-/*************************************************************************************/
-/*                                                                              */
-/*  File:	   MbICP.h                                                      */
-/*  Authors:       Luis Montesano and Javier Minguez                            */
-/*  Modified:      1/3/2006                                                     */
-/*                                                                              */
-/*  This library implements the:                                                */
-/*										*/
-/*	J. Minguez, F. Lamiraux and L. Montesano				*/
-/*	Metric-Based Iterative Closest Point, 					*/
-/*  Scan Matching for Mobile Robot Displacement Estimation			*/
-/*	IEEE Transactions on Roboticics (2006)					*/
-/*                                                                                   */
-/*************************************************************************************/
-
-
-#include "MbICP.h"
-#include "MbICP2.h"
-#include "calcul.h"
-#include "sp_matrix.h"
-#include <stdio.h>
-#include <math.h>
-#include "percolate.h"
-
-#ifndef M_PI
-	#define M_PI 3.14159265358979323846
-#endif
-
-// Initial error to compute error ratio
-#define BIG_INITIAL_ERROR 1000000.0F
-
-// Debugging flag. Print sm info in the screen.
-// #define INTMATSM_DEB
-
-
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-// Types definition
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-
-
-
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-// Variables definition
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-
-float MAXLASERRANGE;
-
-
-// ************************
-// Extern variables
-
-// structure to initialize the SM parameters
-TSMparams params;
-
-// Original points to be aligned
-Tscan ptosRef;
-Tscan ptosNew;
-
-// Structure of the associations before filtering
-TAsoc cp_associations[MAXLASERPOINTS];
-int cntAssociationsT;
-
-// Filtered Associations
-TAsoc cp_associationsTemp[MAXLASERPOINTS];
-int cntAssociationsTemp;
-
-// Those points removed by the projection filter
-Tscan ptosNoView;
-
-// Current motion estimation
-Tsc motion2;
-
-
-// ************************
-// Some precomputations for each scan to speed up
-static float refdqx[MAXLASERPOINTS];
-static float refdqx2[MAXLASERPOINTS];
-static float refdqy[MAXLASERPOINTS];
-static float refdqy2[MAXLASERPOINTS];
-static float distref[MAXLASERPOINTS];
-static float refdqxdqy[MAXLASERPOINTS];
-
-
-// value of errors
-static float error_k1;
-static int numConverged;
-
-
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-// Protos of the functions
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-
-// Function for compatibility with the scans
-static void preProcessingLib(Tpfp *laserK, Tpfp *laserK1,
-					  Tsc *initialMotion);
-
-// Function that does the association step of the MbICP
-static int EStep();
-
-// Function that does the minimization step of the MbICP
-static int MStep(Tsc *solucion);
-
-// Function to do the least-squares but optimized for the metric
-static int computeMatrixLMSOpt(TAsoc *cp_ass, int cnt, Tsc *estimacion);
-
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-// External functions
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-
-// ************************
-// Function that initializes the SM parameters
-// ************************
-
-void Init_MbICP_ScanMatching(float max_laser_range,float Bw, float Br,
-					  float L, int laserStep,
-					  float MaxDistInter,
-					  float filter,
-					  int ProjectionFilter,
-					  float AsocError,
-					  int MaxIter, float error_ratio,
-					  float error_x, float error_y, float error_t, int IterSmoothConv){
-
-  #ifdef INTMATSM_DEB
-	printf("-- Init EM params . . ");
-  #endif
-
-  MAXLASERRANGE = max_laser_range;
-  params.Bw = Bw;
-  params.Br = Br*Br;
-  params.error_th=error_ratio;
-  params.MaxIter=MaxIter;
-  params.LMET=L;
-  params.laserStep=laserStep;
-  params.MaxDistInter=MaxDistInter;
-  params.filter=filter;
-  params.ProjectionFilter=ProjectionFilter;
-  params.AsocError=AsocError;
-  params.errx_out=error_x;
-  params.erry_out=error_y;
-  params.errt_out=error_t;
-  params.IterSmoothConv=IterSmoothConv;
-
-  #ifdef INTMATSM_DEB
-	printf(". OK!\n");
-  #endif
-
-}
-
-
-// ************************
-// Function that initializes the SM parameters
-// ************************
-
-int MbICPmatcher(Tpfp *laserK, Tpfp *laserK1,
-				Tsc *sensorMotion, Tsc *solution){
-
-	int resEStep=1;
-	int resMStep=1;
-	int numIteration=0;
-
-	// Preprocess both scans
-	preProcessingLib(laserK,laserK1,sensorMotion);
-
-	while (numIteration<params.MaxIter){
-
-		// Compute the correspondences of the MbICP
-		resEStep=EStep();;
-
-		if (resEStep!=1)
-			return -1;
-
-		// Minize and compute the solution
-		resMStep=MStep(solution);
-
-		if (resMStep==1)
-			return 1;
-		else if (resMStep==-1)
-			return -2;
-		else
-			numIteration++;
-	}
-
-	return 2;
-
-}
-
-
-
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-// Inner functions
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-
-// ************************
-// Function that does the association step of the MbICP
-// ************************
-
-static int EStep()
-{
-  int cnt;
-  int i,J;
-
-  static Tscan ptosNewRef;
-  static int indexPtosNewRef[MAXLASERPOINTS];
-
-  int L,R,Io;
-  float dist;
-  float cp_ass_ptX,cp_ass_ptY,cp_ass_ptD;
-  float tmp_cp_indD;
-
-  float q1x, q1y, q2x,q2y,p2x,p2y, dqx, dqy, dqpx, dqpy, qx, qy,dx,dy;
-  float landaMin;
-  float A,B,C,D;
-  float LMET2;
-
-  LMET2=params.LMET*params.LMET;
-
-
-	// Transform the points according to the current pose estimation
-
-	ptosNewRef.numPuntos=0;
-	for (i=0; i<ptosNew.numPuntos; i++){
-		transfor_directa_p ( ptosNew.laserC[i].x, ptosNew.laserC[i].y,
-			&motion2, &ptosNewRef.laserC[ptosNewRef.numPuntos]);
-		car2pol(&ptosNewRef.laserC[ptosNewRef.numPuntos],&ptosNewRef.laserP[ptosNewRef.numPuntos]); 
-		ptosNewRef.numPuntos++;
-	}
-
-	// ----
-	/* Projection Filter */
-	/* Eliminate the points that cannot be seen */
-	/* Furthermore it orders the points with the angle */
-
-	cnt = 1; /* Becarefull with this filter (order) when the angles are big >90 */
-	ptosNoView.numPuntos=0;
-	if (params.ProjectionFilter==1){
-		for (i=1;i<ptosNewRef.numPuntos;i++){
-			if (ptosNewRef.laserP[i].t>=ptosNewRef.laserP[cnt-1].t){ 
-				ptosNewRef.laserP[cnt]=ptosNewRef.laserP[i];
-				ptosNewRef.laserC[cnt]=ptosNewRef.laserC[i];
-				cnt++;
-			}
-			else{
-				ptosNoView.laserP[ptosNoView.numPuntos]=ptosNewRef.laserP[i];
-				ptosNoView.laserC[ptosNoView.numPuntos]=ptosNewRef.laserC[i];
-				ptosNoView.numPuntos++;
-			}
-		}
-		ptosNewRef.numPuntos=cnt;
-	}
-
-
-	// ----
-	/* Build the index for the windows (this is the role of the Bw parameter */
-	/* The correspondences are searched between windows in both scans */
-	/* Like this you speed up the algorithm */
-
-	L=0; R=0; /* index of the window for ptoRef */
-	Io=0; /* index of the window for ptoNewRef */
-
-	if (ptosNewRef.laserP[Io].t<ptosRef.laserP[L].t) {
-		if (ptosNewRef.laserP[Io].t + params.Bw < ptosRef.laserP[L].t){
-			while (Io<ptosNewRef.numPuntos-1 && ptosNewRef.laserP[Io].t + params.Bw < ptosRef.laserP[L].t) {
-				Io++;
-			}
-		}
-		else{
-			while (R<ptosRef.numPuntos-1 && ptosNewRef.laserP[Io].t + params.Bw > ptosRef.laserP[R+1].t)
-				R++;
-		}
-	}
-	else{
-		while (L<ptosRef.numPuntos-1 && ptosNewRef.laserP[Io].t - params.Bw > ptosRef.laserP[L].t)
-			L++;
-		R=L;
-		while (R<ptosRef.numPuntos-1 && ptosNewRef.laserP[Io].t + params.Bw > ptosRef.laserP[R+1].t)
-			R++;
-	}
-
-	// ----
-	/* Look for potential correspondences between the scans */
-	/* Here is where we use the windows */
-
-	cnt=0;
-	for (i=Io;i<ptosNewRef.numPuntos;i++){
-
-		// Keep the index of the original scan ordering
-		cp_associations[cnt].index=indexPtosNewRef[i];
-
-		// Move the window
-		while  (L < ptosRef.numPuntos-1 && ptosNewRef.laserP[i].t - params.Bw > ptosRef.laserP[L].t)
-			L = L + 1;
-		while (R <ptosRef.numPuntos-1 && ptosNewRef.laserP[i].t + params.Bw > ptosRef.laserP[R+1].t)
-			R = R + 1;
-
-		cp_associations[cnt].L=L;
-		cp_associations[cnt].R=R;
-
-		if (L==R){
-			// Just one possible correspondence
-
-			// precompute stuff to speed up
-			qx=ptosRef.laserC[R].x; qy=ptosRef.laserC[R].y;
-			p2x=ptosNewRef.laserC[i].x;	p2y=ptosNewRef.laserC[i].y;
-			dx=p2x-qx; dy=p2y-qy;
-			dist=dx*dx+dy*dy-(dx*qy-dy*qx)*(dx*qy-dy*qx)/(qx*qx+qy*qy+LMET2);
-
-			if (dist<params.Br){
-				cp_associations[cnt].nx=ptosNewRef.laserC[i].x;
-				cp_associations[cnt].ny=ptosNewRef.laserC[i].y;
-				cp_associations[cnt].rx=ptosRef.laserC[R].x;
-				cp_associations[cnt].ry=ptosRef.laserC[R].y;
-				cp_associations[cnt].dist=dist;
-				cnt++;
-			}
-		}
-		else if (L<R)
-		{
-			// More possible correspondences
-
-			cp_ass_ptX=0;
-			cp_ass_ptY=0;
-			cp_ass_ptD=100000;
-
-			/* Metric based Closest point rule */
-			for (J=L+1;J<=R;J++){
-
-				// Precompute stuff to speed up
-				q1x=ptosRef.laserC[J-1].x; q1y=ptosRef.laserC[J-1].y;
-				q2x=ptosRef.laserC[J].x; q2y=ptosRef.laserC[J].y;
-				p2x=ptosNewRef.laserC[i].x; p2y=ptosNewRef.laserC[i].y;
-
-				dqx=refdqx[J-1]; dqy=refdqy[J-1];
-				dqpx=q1x-p2x;  dqpy=q1y-p2y;
-				A=1/(p2x*p2x+p2y*p2y+LMET2);
-				B=(1-A*p2y*p2y);
-				C=(1-A*p2x*p2x);
-				D=A*p2x*p2y;
-
-				landaMin=(D*(dqx*dqpy+dqy*dqpx)+B*dqx*dqpx+C*dqy*dqpy)/(B*refdqx2[J-1]+C*refdqy2[J-1]+2*D*refdqxdqy[J-1]);
-
-				if (landaMin<0){ // Out of the segment on one side
-					qx=q1x; qy=q1y;}
-				else if (landaMin>1){ // Out of the segment on the other side
-					qx=q2x; qy=q2y;}
-				else if (distref[J-1]<params.MaxDistInter) { // Within the segment and interpotation OK
-					qx=(1-landaMin)*q1x+landaMin*q2x;
-					qy=(1-landaMin)*q1y+landaMin*q2y;
-				}
-				else{ // Segment too big do not interpolate
-					if (landaMin<0.5){
-						qx=q1x; qy=q1y;}
-					else{
-						qx=q2x; qy=q2y;}
-				}
-
-				// Precompute stuff to see if we save the association
-				dx=p2x-qx;
-				dy=p2y-qy;
-				tmp_cp_indD=dx*dx+dy*dy-(dx*qy-dy*qx)*(dx*qy-dy*qx)/(qx*qx+qy*qy+LMET2);
-
-				// Check if the association is the best up to now
-				if (tmp_cp_indD < cp_ass_ptD){
-					cp_ass_ptX=qx;
-					cp_ass_ptY=qy;
-					cp_ass_ptD=tmp_cp_indD;
-				}
-			}
-
-			// Association compatible in distance (Br parameter)
-			if (cp_ass_ptD< params.Br){
-				cp_associations[cnt].nx=ptosNewRef.laserC[i].x;
-				cp_associations[cnt].ny=ptosNewRef.laserC[i].y;
-				cp_associations[cnt].rx=cp_ass_ptX;
-				cp_associations[cnt].ry=cp_ass_ptY;
-				cp_associations[cnt].dist=cp_ass_ptD;
-
-				cnt++;
-			}
-		}
-		else { // This cannot happen but just in case ...
-			cp_associations[cnt].nx=ptosNewRef.laserC[i].x;
-			cp_associations[cnt].ny=ptosNewRef.laserC[i].y;
-			cp_associations[cnt].rx=0;
-			cp_associations[cnt].ry=0;
-			cp_associations[cnt].dist=params.Br;
-			cnt++;
-		}
-	}  // End for (i=Io;i<ptosNewRef.numPuntos;i++){
-
-	cntAssociationsT=cnt;
-
-	// Check if the number of associations is ok
-	if (cntAssociationsT<ptosNewRef.numPuntos*params.AsocError){
-		#ifdef INTMATSM_DEB
-			printf("Number of associations too low <%d out of %f>\n",
-				cntAssociationsT,ptosNewRef.numPuntos*params.AsocError);
-		#endif
-		return 0;
-	}
-
-	return 1;
-}
-
-
-// ************************
-// Function that does the minimization step of the MbICP
-// ************************
-
-static int MStep(Tsc *solucion){
-
-  Tsc estim_cp;
-  int i,cnt,res;
-  float error_ratio, error;
-  float cosw, sinw, dtx, dty, tmp1, tmp2;
-  static TAsoc cp_tmp[MAXLASERPOINTS+1];
-
-	// Filtering of the spurious data
-	// Used the trimmed versions that orders the point by distance between associations
-
-     if (params.filter<1){
-
-		// Add Null element in array position 0	(this is because heapsort requirement)
-		for (i=0;i<cntAssociationsT;i++){
-			cp_tmp[i+1]=cp_associations[i];
-		}
-		cp_tmp[0].dist=-1;
-		// Sort array
-		heapsort(cp_tmp, cntAssociationsT);
-		// Filter out big distances
-		cnt=((int)(cntAssociationsT*100*params.filter))/100;
-		// Remove Null element
-		for (i=0;i<cnt;i++){
-			cp_associationsTemp[i]=cp_tmp[i+1];
-		}
-	 }
-	 else{ // Just build the Temp array to minimize
-		cnt=0;
-		for (i=0; i<cntAssociationsT;i++){
-			if (cp_associations[i].dist<params.Br){
-				cp_associationsTemp[cnt]=cp_associations[i];
-				cnt++;
-			}
-		}
-	}
-
-	cntAssociationsTemp=cnt;
-
-	#ifdef INTMATSM_DEB
-		printf("All assoc: %d  Filtered: %d  Percentage: %f\n",
-			cntAssociationsT, cntAssociationsTemp, cntAssociationsTemp*100.0/cntAssociationsT);
-	#endif
-
-	// ---
-	/* Do de minimization Minimize Metric-based distance */
-	/* This function is optimized to speed up */
-
-	res=computeMatrixLMSOpt(cp_associationsTemp,cnt,&estim_cp);
-	if (res==-1)
-		return -1;
-
-	#ifdef INTMATSM_DEB
-		printf("estim_cp: <%f %f %f>\n",estim_cp.x, estim_cp.y,estim_cp.tita);
-		printf("New impl: <%f %f %f>\n",estim_cp.x, estim_cp.y,estim_cp.tita);
-	#endif
-
-	cosw=(float)cos(estim_cp.tita); sinw=(float)sin(estim_cp.tita);
-	dtx=estim_cp.x; dty=estim_cp.y;
-
-
-	// ------
-	/* Compute the error of the associations */
-
-	error=0;
-	for (i = 0; i<cnt;i++){
-		tmp1=cp_associationsTemp[i].nx * cosw - cp_associationsTemp[i].ny * sinw + dtx - cp_associationsTemp[i].rx;tmp1*=tmp1;
-		tmp2=cp_associationsTemp[i].nx * sinw + cp_associationsTemp[i].ny * cosw + dty - cp_associationsTemp[i].ry;tmp2*=tmp2;
-		error = error+ tmp1+tmp2;
-	}
-
-	error_ratio = error / error_k1;
-
-	#ifdef INTMATSM_DEB
-		printf("<err,errk1,errRatio>=<%f,%f,%f>\n estim=<%f,%f,%f>\n",
-			error,error_k1,error_ratio, estim_cp.x,estim_cp.y, estim_cp.tita);
-	#endif
-
-	// ----
-	/* Check the exit criteria */
-	/* Error ratio */
-	if (fabs(1.0-error_ratio)<=params.error_th ||
-		(fabs(estim_cp.x)<params.errx_out && fabs(estim_cp.y)<params.erry_out
-		&& fabs(estim_cp.tita)<params.errt_out) ){
-		numConverged++;
-	}
-	else
-		numConverged=0;
-
-	//--
-	/* Build the solution */
-	composicion_sis(&estim_cp, &motion2, solucion);
-	motion2=*solucion;
-	error_k1=error;
-
-	/* Number of iterations doing convergence (smooth criterion of convergence) */
-	if (numConverged>params.IterSmoothConv)
-		return 1;
-	else
-		return 0;
-}
-
-
-// ************************
-// Function to do the least-squares but optimized for the metric
-// ************************
-
-static int computeMatrixLMSOpt(TAsoc *cp_ass, int cnt, Tsc *estimacion) {
-
-	int i;
-	float LMETRICA2;
-	float X1[MAXLASERPOINTS], Y1[MAXLASERPOINTS];
-	float X2[MAXLASERPOINTS],Y2[MAXLASERPOINTS];
-	float X2Y2[MAXLASERPOINTS],X1X2[MAXLASERPOINTS];
-	float X1Y2[MAXLASERPOINTS], Y1X2[MAXLASERPOINTS];
-	float Y1Y2[MAXLASERPOINTS];
-	float K[MAXLASERPOINTS], DS[MAXLASERPOINTS];
-	float DsD[MAXLASERPOINTS], X2DsD[MAXLASERPOINTS], Y2DsD[MAXLASERPOINTS];
-	float Bs[MAXLASERPOINTS], BsD[MAXLASERPOINTS];
-	float A1, A2, A3, B1, B2, B3, C1, C2, C3, D1, D2, D3;
-	MATRIX matA,invMatA;
-	VECTOR vecB,vecSol;
-
-	A1=0;A2=0;A3=0;B1=0;B2=0;B3=0;
-	C1=0;C2=0;C3=0;D1=0;D2=0;D3=0;
-
-
-	LMETRICA2=params.LMET*params.LMET;
-
-	for (i=0; i<cnt; i++){
-		X1[i]=cp_ass[i].nx*cp_ass[i].nx;
-		Y1[i]=cp_ass[i].ny*cp_ass[i].ny;
-		X2[i]=cp_ass[i].rx*cp_ass[i].rx;
-		Y2[i]=cp_ass[i].ry*cp_ass[i].ry;
-		X2Y2[i]=cp_ass[i].rx*cp_ass[i].ry;
-
-		X1X2[i]=cp_ass[i].nx*cp_ass[i].rx;
-		X1Y2[i]=cp_ass[i].nx*cp_ass[i].ry;
-		Y1X2[i]=cp_ass[i].ny*cp_ass[i].rx;
-		Y1Y2[i]=cp_ass[i].ny*cp_ass[i].ry;
-
-		K[i]=X2[i]+Y2[i] + LMETRICA2;
-		DS[i]=Y1Y2[i] + X1X2[i];
-		DsD[i]=DS[i]/K[i];
-		X2DsD[i]=cp_ass[i].rx*DsD[i];
-		Y2DsD[i]=cp_ass[i].ry*DsD[i];
-
-		Bs[i]=X1Y2[i]-Y1X2[i];
-		BsD[i]=Bs[i]/K[i];
-
-		A1=A1 + (1-Y2[i]/K[i]);
-		B1=B1 + X2Y2[i]/K[i];
-		C1=C1 + (-cp_ass[i].ny + Y2DsD[i]);
-		D1=D1 + (cp_ass[i].nx - cp_ass[i].rx -cp_ass[i].ry*BsD[i]);
-
-		A2=B1;
-		B2=B2 + (1-X2[i]/K[i]);
-		C2=C2 + (cp_ass[i].nx-X2DsD[i]);
-		D2=D2 + (cp_ass[i].ny -cp_ass[i].ry +cp_ass[i].rx*BsD[i]);
-
-		A3=C1;
-		B3=C2;
-		C3=C3 + (X1[i] + Y1[i] - DS[i]*DS[i]/K[i]);
-		D3=D3 + (Bs[i]*(-1+DsD[i]));
-	}
-
-
-	initialize_matrix(&matA,3,3);
-	MDATA(matA,0,0)=A1;	MDATA(matA,0,1)=B1;	MDATA(matA,0,2)=C1;
-	MDATA(matA,1,0)=A2;	MDATA(matA,1,1)=B2;	MDATA(matA,1,2)=C2;
-	MDATA(matA,2,0)=A3;	MDATA(matA,2,1)=B3;	MDATA(matA,2,2)=C3;
-
-	if (inverse_matrix (&matA, &invMatA)==-1)
-		return -1;
-
-#ifdef INTMATSM_DEB
-	print_matrix("inverted matrix", &invMatA);
-#endif
-
-	initialize_vector(&vecB,3);
-	VDATA(vecB,0)=D1; VDATA(vecB,1)=D2; VDATA(vecB,2)=D3;
-	multiply_matrix_vector (&invMatA, &vecB, &vecSol);
-
-	estimacion->x=-VDATA(vecSol,0);
-	estimacion->y=-VDATA(vecSol,1);
-	estimacion->tita=-VDATA(vecSol,2);
-
-	return 1;
-}
-
-
-// ------------------------------------
-// Function added by Javi for compatibility
-// ------------------------------------
-
-static void preProcessingLib(Tpfp *laserK, Tpfp *laserK1,
-					  Tsc *initialMotion)
-{
-
-	int i,j;
-
-	motion2=*initialMotion;
-
-	// ------------------------------------------------//
-	// Compute xy coordinates of the points in laserK1
-	ptosNew.numPuntos=0;
-	for (i=0; i<MAXLASERPOINTS; i++) {
-                if (laserK1[i].r <MAXLASERRANGE){
-			ptosNew.laserP[ptosNew.numPuntos].r=laserK1[i].r;
-			ptosNew.laserP[ptosNew.numPuntos].t=laserK1[i].t;
-			ptosNew.laserC[ptosNew.numPuntos].x=(float)(laserK1[i].r * cos(laserK1[i].t));
-			ptosNew.laserC[ptosNew.numPuntos].y=(float)(laserK1[i].r * sin(laserK1[i].t));
-		    ptosNew.numPuntos++;
-		}
-        }
-
-	// Choose one point out of params.laserStep points
-	j=0;
-	for (i=0; i<ptosNew.numPuntos; i+=params.laserStep) {
-		ptosNew.laserC[j]=ptosNew.laserC[i];
-		j++;
-	}
-	ptosNew.numPuntos=j;
-
-	// Compute xy coordinates of the points in laserK
-	ptosRef.numPuntos=0;
-	for (i=0; i<MAXLASERPOINTS; i++) {
- 		if (laserK[i].r <MAXLASERRANGE){
-			ptosRef.laserP[ptosRef.numPuntos].r=laserK[i].r;
-			ptosRef.laserP[ptosRef.numPuntos].t=laserK[i].t;
-			ptosRef.laserC[ptosRef.numPuntos].x=(float)(laserK[i].r * cos(laserK1[i].t));
-			ptosRef.laserC[ptosRef.numPuntos].y=(float)(laserK[i].r * sin(laserK1[i].t));
-		    ptosRef.numPuntos++;
-		}
-	}
-
-	// Choose one point out of params.laserStep points
-	j=0;
-	for (i=0; i<ptosRef.numPuntos; i+=params.laserStep) {
-		ptosRef.laserC[j]=ptosRef.laserC[i];
-		j++;
-	}
-	ptosRef.numPuntos=j;
-	// ------------------------------------------------//
-
-	// Preprocess reference points
-	for (i=0;i<ptosRef.numPuntos-1;i++) {
-		car2pol(&ptosRef.laserC[i],&ptosRef.laserP[i]);
-		refdqx[i]=ptosRef.laserC[i].x - ptosRef.laserC[i+1].x;
-		refdqy[i]=ptosRef.laserC[i].y - ptosRef.laserC[i+1].y;
-		refdqx2[i]=refdqx[i]*refdqx[i];
-		refdqy2[i]=refdqy[i]*refdqy[i];
-		distref[i]=refdqx2[i] + refdqy2[i];
-		refdqxdqy[i]=refdqx[i]*refdqy[i];
-	}
-	car2pol(&ptosRef.laserC[ptosRef.numPuntos-1],&ptosRef.laserP[ptosRef.numPuntos-1]);
-
-	error_k1=BIG_INITIAL_ERROR;
-	numConverged=0;
-}
diff --git a/sm/csm/mbicp/MbICP.h b/sm/csm/mbicp/MbICP.h
deleted file mode 100644
index 1e27740fc1c9201cb084ca50b546da5d7dc467bc..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/MbICP.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*************************************************************************************/
-/*                                                                                   */
-/*  File:	   MbICP.h                                                           */
-/*  Authors:       Luis Montesano and Javier Minguez                                 */
-/*  Modified:      1/3/2006                                                          */
-/*                                                                                   */
-/*  This library implements the:                                                     */
-/*										     */
-/*      		    							     */
-/*      J. Minguez, L. Montesano, and F. Lamiraux, "Metric-based iterative		*/
-/*	closest point scan matching for sensor displacement estimation," IEEE		*/
-/*	Transactions on Robotics, vol. 22, no. 5, pp. 1047 \u2013 1054, 2006. 		*/
-/*************************************************************************************/
-
-
-/*****************************************************************************/
-//
-//	EVERYTHING IN THE INTERNATIONAL SYSTEM (METERS AND RADIANS)
-//
-/*****************************************************************************/
-
-#ifndef MbICP
-#define MbICP
-#include "TData.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-// ----------------------------------------------------------------------------
-// GLOBAL FUNCTIONS
-// ----------------------------------------------------------------------------
-
-
-// ************************
-// Function that initializes the SM parameters
-// ************************
-
-/* void InitScanMatching(float Bw, float Br,
-						 float L, int laserStep,float MaxDistInter, float filtrado,
-					     int MaxIter, float error_th, float exo, float eyo, float etitao, int IterSmoothConv); */
-// in:::
-
-	/* --------------------- */
-	/* --- Thresold parameters */
-	/* --------------------- */
-	/* Bw: maximum angle diference between points of different scans */
-	/* Points with greater Bw cannot be correspondent (eliminate spurius asoc.) */
-	/* This is a speed up parameter */
-	//float Bw;
-
-	/* Br: maximum distance difference between points of different scans */
-	/* Points with greater Br cannot be correspondent (eliminate spurius asoc.) */
-	//float Br;
-
-	/* --------------------- */
-	/* --- Inner parameters */
-	/* --------------------- */
-	/* L: value of the metric */
-	/* When L tends to infinity you are using the standart ICP */
-    /* When L tends to 0 you use the metric (more importance to rotation) */
-	//float L;
-
-	/* laserStep: selects points of each scan with an step laserStep  */
-	/* When laserStep=1 uses all the points of the scans */
-	/* When laserStep=2 uses one each two ... */
-	/* This is an speed up parameter */
-	//int laserStep;
-
-	/* ProjectionFilter: */
-	/* Eliminate the points that cannot be seen given the two scans (see Lu&Millios 97) */
-	/* It works well for angles < 45 \circ*/
-	/* 1 : activates the filter */
-	/* 0 : desactivates the filter */
-	// int ProjectionFilter;
-
-	/* MaxDistInter: maximum distance to interpolate between points in the ref scan */
-	/* Consecutive points with less Euclidean distance than MaxDistInter are considered to be a segment */
-	//float MaxDistInter;
-
-	/* filter: in [0,1] sets the % of asociations NOT considered spurious */
-	/* E.g. if filter=0.9 you use 90% of the associations */
-	/* The associations are ordered by distance and the (1-filter) with greater distance are not used */
-	/* This type of filtering is called "trimmed-ICP" */
-	//float filter;
-
-	/* AsocError: in [0,1] */
-	/* One way to check if the algorithm diverges if to supervise if the number of associatios goes below a thresold */
-	/* When the number of associations is below AsocError, the main function will return error in associations step */
-	// float AsocError;
-
-	/* --------------------- */
-	/* --- Exit parameters */
-	/* --------------------- */
-	/* MaxIter: sets the maximum number of iterations for the algorithm to exit */
-	/* The more iterations, the more chance you give the algorithm to be more accurate   */
-	//int MaxIter;
-
-	/* errorRatio: in [0,1] sets the maximum error ratio between iterations to exit */
-	/* In iteration K, let be errorK the residual of the minimization */
-	/* Error_th=(errorK-1/errorK). When error_th tends to 1 more precise is the solution of the scan matching */
-	//float error_th;
-
-	/* errx_out,erry_out, errt_out: minimum error of the asociations to exit */
-	/* In each iteration, the error is the residual of the minimization in each component */
-	/* The condition is (errorKx<errx_out && errorKx<erry_out && errorKx<errt_out) */
-	/* When errorK tends to 0 the more precise is the solution of the scan matching */
-	//float errx_out,erry_out, errt_out;
-
-	/* IterSmoothConv: number of consecutive iterations that satisfity the error criteria (the two above criteria) */
-	/* (error_th) OR (errorx_out && errory_out && errt_out) */
-	/* With this parameter >1 avoids random solutions and estabilices the algorithm */
-	//int IterSmoothConv;
-
-
-
-void Init_MbICP_ScanMatching(
-			     float max_laser_range,
-			     float Bw,
-			     float Br,
-			     float L,
-			     int   laserStep,
-			     float MaxDistInter,
-			     float filter,
-			     int   ProjectionFilter,
-			     float AsocError,
-			     int   MaxIter,
-			     float errorRatio,
-			     float errx_out,
-			     float erry_out,
-			     float errt_out,
-			     int IterSmoothConv);
-
-// -------------------------------------------------------------
-
-// ************************
-// Function that does the scan matching
-// ************************
-
-/* int MbICPmatcher(Tpfp *laserK, Tpfp *laserK1,
-				 Tsc *sensorMotion, Tsc *solution); */
-
-// in:::
-//      laserK: is the reference scan in polar coordinates (max. num points is MAXLASERPOINTS)
-//		laserK1: is the new scan in polar coordinates (max. num points is MAXLASERPOINTS)
-//		sensorMotion: initial SENSOR motion estimation from location K to location K1
-//		solution: SENSOR motion solution from location K to location K1
-// out:::
-//		1 : Everything OK in less that the Maximum number of iterations
-//		2 : Everything OK but reached the Maximum number of iterations
-//		-1: Failure in the association step
-//		-2: Failure in the minimization step
-
-int MbICPmatcher(Tpfp *laserK, Tpfp *laserK1,
-				 Tsc *sensorMotion, Tsc *solution);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sm/csm/mbicp/MbICP2.h b/sm/csm/mbicp/MbICP2.h
deleted file mode 100644
index 66d1f276a80152ec3890fdae32f03e823439fe21..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/MbICP2.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*************************************************************************************/
-/*                                                                                   */
-/*  File:	   MbICP.h                                                               */
-/*  Authors:       Luis Montesano and Javier Minguez                                 */
-/*  Modified:      1/3/2006                                                          */
-/*                                                                                   */
-/*  This library implements the:                                                     */
-/*																		             */
-/*	J. Minguez, F. Lamiraux and L. Montesano										 */
-/*	Metric-Based Iterative Closest Point, 											 */
-/*  Scan Matching for Mobile Robot Displacement Estimation							 */
-/*	IEEE Transactions on Roboticics (2006)										     */
-/*                                                                                   */
-/*************************************************************************************/
-
-
-/* **************************************************************************************** */
-//	This file contains inner information of the MbICP that you want to see from the outside
-/* **************************************************************************************** */
-
-#ifndef MbICP2
-#define MbICP2
-
-#include "TData.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-// ************************
-// Scan inner matching parameters
-typedef struct{
-	/* --------------------- */
-	/* --- Thresold parameters */
-	/* Bw: maximum angle diference between points of different scans */
-	/* Points with greater Bw cannot be correspondent (eliminate spurius asoc.) */
-	/* This is a speed up parameter */
-	float Bw;
-
-	/* Br: maximum distance difference between points of different scans */
-	/* Points with greater Br cannot be correspondent (eliminate spurius asoc.) */
-	float Br;
-
-	/* --------------------- */
-	/* --- Inner parameters */
-
-	/* L: value of the metric */
-	/* When L tends to infinity you are using the standart ICP */
-    /* When L tends to 0 you use the metric (more importance to rotation */
-	float LMET;
-
-	/* laserStep: selects points of each scan with an step laserStep  */
-	/* When laserStep=1 uses all the points of the scans */
-	/* When laserStep=2 uses one each two ... */
-	/* This is an speed up parameter */
-	int laserStep;
-
-	/* ProjectionFilter: */
-	/* Eliminate the points that cannot be seen given the two scans (see Lu&Millios 97) */
-	/* It works well for angles < 45 \circ*/
-	/* 1 : activates the filter */
-	/* 0 : desactivates the filter */
-	int ProjectionFilter;
-
-	/* MaxDistInter: maximum distance to interpolate between points in the ref scan */
-	/* Consecutive points with less Euclidean distance than MaxDistInter are considered to be a segment */
-	float MaxDistInter;
-
-	/* filtrado: in [0,1] sets the % of asociations NOT considered spurious */
-	float filter;
-
-	/* AsocError: in [0,1] */
-	/* One way to check if the algorithm diverges if to supervise if the number of associatios goes below a thresold */
-	/* When the number of associations is below AsocError, the main function will return error in associations step */
-	float AsocError;
-
-	/* --------------------- */
-	/* --- Exit parameters */
-	/* MaxIter: sets the maximum number of iterations for the algorithm to exit */
-	/* More iterations more chance you give the algorithm to be more accurate   */
-	int MaxIter;
-
-	/* error_th: in [0,1] sets the maximum error ratio between iterations to exit */
-	/* In each iteration, the error is the residual of the minimization */
-	/* When error_th tends to 1 more precise is the solution of the scan matching */
-	float error_th;
-
-	/* errx_out,erry_out, errt_out: minimum error of the asociations to exit */
-	/* In each iteration, the error is the residual of the minimization in each component */
-	/* The condition is (lower than errx_out && lower than erry_out && lower than errt_out */
-	/* When error_XXX tend to 0 more precise is the solution of the scan matching */
-	float errx_out,erry_out, errt_out;
-
-	/* IterSmoothConv: number of consecutive iterations that satisfity the error criteria */
-	/* (error_th) OR (errorx_out && errory_out && errt_out) */
-	/* With this parameter >1 avoids random solutions */
-	int IterSmoothConv;
-
-}TSMparams;
-
-
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-// Variables definition
-// ---------------------------------------------------------------
-// ---------------------------------------------------------------
-
-
-// ************************
-// Static structure to initialize the SM parameters
-extern TSMparams params;
-
-// Original points to be aligned
-extern Tscan ptosRef;
-extern Tscan ptosNew;
-
-// At each step::
-
-// Those points removed by the projection filter (see Lu&Millios -- IDC)
-extern Tscan ptosNoView; // Only with ProjectionFilter=1;
-
-// Structure of the associations before filtering
-extern TAsoc cp_associations[MAXLASERPOINTS];
-extern int cntAssociationsT;
-
-// Filtered Associations
-extern TAsoc cp_associationsTemp[MAXLASERPOINTS];
-extern int cntAssociationsTemp;
-
-// Current motion estimation
-extern Tsc motion2;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sm/csm/mbicp/TData.h b/sm/csm/mbicp/TData.h
deleted file mode 100644
index 3390dbebabbdba09b1f9492f0855e8a1c8189962..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/TData.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/***************************************************/
-/* Last Revised: 
-$Id: TData.h 4129 2007-08-21 23:16:24Z gerkey $
-*/
-/***************************************************/
-
-#ifndef TData
-#define TData
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* 
-   Este fichero contiene los tipos de datos utilizados por todos 
-*/
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define MAXLASERPOINTS 361
-
-#define RADIO 0.4F  /* Radio del robot */
-
-typedef struct {
-  float x;
-  float y;
-}Tpf;
-
-
-typedef struct {
-  float r;
-  float t;
-}Tpfp;
-
-typedef struct {
-  int x;
-  int y;
-}Tpi;
-
-typedef struct {
-  float x;
-  float y;
-  float tita;
-}Tsc;
-
-typedef struct {
-  int numPuntos;
-  Tpf laserC[MAXLASERPOINTS];  // Cartesian coordinates
-  Tpfp laserP[MAXLASERPOINTS]; // Polar coordinates
-}Tscan;
-
-
-// Associations information
-typedef struct{
-  float rx,ry,nx,ny,dist;				// Point (nx,ny), static corr (rx,ry), dist 
-  int numDyn;							// Number of dynamic associations
-  float unknown;						// Unknown weight
-  int index;							// Index within the original scan
-  int L,R;
-}TAsoc;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sm/csm/mbicp/calcul.c b/sm/csm/mbicp/calcul.c
deleted file mode 100644
index c0702081bfbb301ca0164fe575628c3d402262d6..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/calcul.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/***************************************************/
-/* Last Revised: 
-$Id: calcul.c 4129 2007-08-21 23:16:24Z gerkey $
-*/
-/***************************************************/
-
-
-#include "calcul.h"
-
-
-
-void transfor_directa_p(float x, float y, 
-			Tsc *sistema, Tpf *sol){
-
-  /* Esta funcion transforma el punto x,y en el sistema de coordenadas mas global*/
-  /* Es decir las coordenadas x y son vistas desde el sistema de coordenadas sistema*/
-  /* Y se las quiere transformar en el sistema de ref desde el que se sistema*/
-  /* Es la transformacion directa */
-
-  float SinT,CosT;
-
-  SinT=(float)sin(sistema->tita);
-  CosT=(float)cos(sistema->tita);
- 
-  sol->x=x*CosT-y*SinT+sistema->x;
-  sol->y=x*SinT+y*CosT+sistema->y;
-
-  //fprintf(stderr,"input:<%f,%f> sis:<%f %f %f> sol:<%f %f>\n",x,y,sistema->x, sistema->y, sistema->tita,sol->x, sol->y);
-
-}
-
-void transfor_directa_pt0(float x, float y, 
-			Tsc *sistema, Tpf *sol){
-
-  /* Esta funcion transforma el punto x,y en el sistema de coordenadas mas global*/
-  /* Es decir las coordenadas x y son vistas desde el sistema de coordenadas sistema*/
-  /* Y se las quiere transformar en el sistema de ref desde el que se sistema*/
-  /* Es la transformacion directa */
-
-  sol->x=x+sistema->x;
-  sol->y=y+sistema->y;
-
-}
-
-
-void transfor_inversa_p(float x,float y,
-			Tsc *sistema, Tpf *sol){
-
-  /* Esta funcion transforma el punto x,y en el sistema de coordenadas que entra*/
-  /* Las coordenadas x y se ven desde el sistema de coordenadas desde el que se tienen las */
-  /* las coordenadas de sistema */
-  /* Es la transformacion directa */
- 
-  float a13, a23;
-  float SinT,CosT;
-
-  SinT=(float)sin(sistema->tita);
-  CosT=(float)cos(sistema->tita);
-
-
-  a13=-sistema->y*SinT-sistema->x*CosT;
-  a23=-sistema->y*CosT+sistema->x*SinT;
-    
-  sol->x=x*CosT+y*SinT+a13;
-  sol->y=-x*SinT+y*CosT+a23;
-}  
-
-float NormalizarPI(float ang){
-
-  return (float)(ang+(2*M_PI)*floor((M_PI-ang)/(2*M_PI)));
-}
-
-void inversion_sis(Tsc *sisIn, Tsc *sisOut){
-
-  float c,s;
-
-  c=(float)cos(sisIn->tita);
-  s=(float)sin(sisIn->tita);
-  sisOut->x =-c*sisIn->x-s*sisIn->y;
-  sisOut->y = s*sisIn->x-c*sisIn->y;
-  sisOut->tita = NormalizarPI(-sisIn->tita);
-}
-
-void composicion_sis(Tsc *sis1,Tsc *sis2,Tsc *sisOut){
-
-  Tpf sol;
-
-  transfor_directa_p(sis2->x, sis2->y, 
-		     sis1, &sol);
-  sisOut->x=sol.x;
-  sisOut->y=sol.y;
-  sisOut->tita = NormalizarPI(sis1->tita+sis2->tita);
-  
-}
-
-void car2pol(Tpf *in, Tpfp *out){
-  
-  out->r=(float)sqrt(in->x*in->x+in->y*in->y);
-  out->t=(float)atan2(in->y,in->x);
-}
-
-void pol2car(Tpfp *in, Tpf *out){
-  
-  out->x=in->r*(float)cos(in->t);
-  out->y=in->r*(float)sin(in->t);
-}
-
-
-
-
-int corte_segmentos(float x1,float y1,float x2,float y2,
-		    float x3,float y3,float x4,float y4,
-		    Tpf *sol){
-/* corte de segmentos */
-/* TE DEVUELVE EL PUNTO DE CORTE EN EL SISTEMA QUE ESTEN LOS SEGMENTOS */
- 
-  float a1,a2,b1,b2,c1,c2,xm,ym,denominador,max1_x,max1_y,min1_x,min1_y;
-  float xerr,yerr;
-  int si1;
-  float error_redondeo;
-
-  error_redondeo=(float)0.00001F;
-
-  /* primera recta */
-  a1=y2-y1;
-  b1=x1-x2;
-  c1=y1*(-b1)-x1*a1; 
-
-  /* segunda recta */
-  a2=y4-y3;
-  b2=x3-x4;
-  c2=y3*(-b2)-x3*a2;
-
-  
-  denominador=a1*b2-a2*b1;
-  if (denominador==0)
-    return 0;
-  else{
-    xm=(b1*c2-b2*c1)/denominador;
-    ym=(c1*a2-c2*a1)/denominador;
-
-    xerr=xm+error_redondeo;
-    yerr=ym+error_redondeo;
-
-    /* Comprobamos que cae entre los segmantos */
-    if (x1>x2){
-      max1_x=x1; min1_x=x2;
-    }
-    else{
-      max1_x=x2; min1_x=x1;
-    }
-    if (y1>y2){
-      max1_y=y1; min1_y=y2;
-    }
-    else{
-      max1_y=y2; min1_y=y1;
-    }
-    si1=0;
-    if (max1_x+error_redondeo>=xm && xerr>=min1_x &&  max1_y+error_redondeo>=ym && yerr>=min1_y)
-      si1=1;
-    
-
-    if (si1){
-
-      if (x3>x4){
-	max1_x=x3; min1_x=x4;
-      }
-      else{
-	max1_x=x4; min1_x=x3;
-      }
-      if (y3>y4){
-	max1_y=y3; min1_y=y4;
-      }
-      else{
-	max1_y=y4; min1_y=y3;
-      }
-      
-      if (max1_x+error_redondeo>=xm && xerr>=min1_x &&  max1_y+error_redondeo>=ym && yerr>=min1_y){
-	sol->x=xm;
-	sol->y=ym;
-	return 1;
-      }
-    }
-    return 0;
-  }
-}
-
diff --git a/sm/csm/mbicp/calcul.h b/sm/csm/mbicp/calcul.h
deleted file mode 100644
index 48845b7d070ebf98366245ccdc8c7c13a67b896c..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/calcul.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/***************************************************/
-/* Last Revised: 
-$Id: calcul.h 4129 2007-08-21 23:16:24Z gerkey $
-*/
-/***************************************************/
-
-#ifndef Calcul
-#define Calcul
-
-#include <stdio.h>
-#include <math.h>
-#include "TData.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* 
-   Este fichero tiene operaciones de transformacion de sistemas de referencia, 
-   transformaciones de puntos entre sistemas, de paso de coordenadadas polares,
-   a cartesianas y de corte de segmentos
-
-*/
-
-/* --------------------------------------------------------------------------------------- */
-/* TRANSFORMACIONES DE PUNTO DE UN SISTEMA DE REFERENCIA A OTRO                            */
-/* --------------------------------------------------------------------------------------- */
-
-/* --------------------------------------------------------------------------------------- */
-/* transfor_directa_p                                                                      */ 
-/*  .... Hace la transformacion directa de un punto a un sistema a otro                    */ 
-/*  .... In: (x,y) las coordenadas del punto, sistema es el sistema de referencia          */
-/*  .... Out: en sol se devuelve las coordenadas del punto en el nuevo sistema             */
-
-void transfor_directa_p ( float x, float y, Tsc *sistema, Tpf *sol );
-
-/* --------------------------------------------------------------------------------------- */
-/* transfor_directa_p                                                                      */ 
-/*  .... Hace la transformacion directa de un punto a un sistema a otro                    */ 
-/*  .... La diferencia es que aqui el punto de entrada es el (0,0) (optimiza la anterior)  */
-/*  .... In: (x,y) las coordenadas del punto, sistema es el sistema de referencia          */
-/*  .... Out: en sol se devuelve las coordenadas del punto en el nuevo sistema             */
-
-void transfor_directa_pt0(float x, float y, 
-			  Tsc *sistema, Tpf *sol);
-  
-/* --------------------------------------------------------------------------------------- */
-/* transfor_inversa_p                                                                      */ 
-/*  .... Hace la transformacion inversa de un punto a un sistema a otro                    */ 
-/*  .... In: (x,y) las coordenadas del punto, sistema es el sistema de referencia          */
-/*  .... Out: en sol se devuelve las coordenadas del punto en el nuevo sistema             */
-
-void transfor_inversa_p ( float x, float y, Tsc *sistema, Tpf *sol );
-
-/* --------------------------------------------------------------------------------------- */
-/* TRANSFORMACIONES DE COMPOSICION E INVERSION DE SISTEMAS DE REFERENCIA                   */
-/* --------------------------------------------------------------------------------------- */
-
-/* --------------------------------------------------------------------------------------- */
-/* composicion_sis                                                                         */ 
-/*  .... Realiza la composicion de sistemas de referencia en otro sistema                  */ 
-/*  .... In: compone sis1 y sis2                                                           */
-/*  .... Out: la salida sisOut es el resultado de la composicion de los sistemas           */
-/*  .... Nota: resulta muy importante el orden de las entradas en la composicion           */
-
-void composicion_sis(Tsc *sis1,Tsc *sis2,Tsc *sisOut);
-
-/* --------------------------------------------------------------------------------------- */
-/* inversion_sis                                                                           */ 
-/*  .... Realiza la inversion de un sistema de referencia                                  */ 
-/*  .... In: sisIn es el sistema a invertir                                                */
-/*  .... Out: sisOut es el sistema invertido                                               */
-
-void inversion_sis(Tsc *sisIn, Tsc *sisOut);
-
-/* --------------------------------------------------------------------------------------- */
-/* TRANSFORMACIONES DE PUNTO DE UN SISTEMA DE REFERENCIA A OTRO                            */
-/* --------------------------------------------------------------------------------------- */
-
-/* --------------------------------------------------------------------------------------- */
-/* car2pol                                                                                 */ 
-/*  .... Transforma un punto de coordenadas cartesianas a polares                          */ 
-/*  .... In: el punto en coordenadas cartesianas a transformar                             */
-/*  .... Out: el punto salida en coordenadas polares                                       */
-
-void car2pol(Tpf *in, Tpfp *out);
-
-/* --------------------------------------------------------------------------------------- */
-/* pol2car                                                                                 */ 
-/*  .... Transforma un punto de coordenadas polares a cartesianas                          */ 
-/*  .... In: el punto entrada en coordenadas polares a transformar                         */
-/*  .... Out: el punto en coordenadas cartesianas transformado                             */
-
-void pol2car(Tpfp *in, Tpf *out);
-
-/* --------------------------------------------------------------------------------------- */
-/* TRANSFORMACIONES DE PUNTO DE UN SISTEMA DE REFERENCIA A OTRO                            */
-/* --------------------------------------------------------------------------------------- */
-
-/* --------------------------------------------------------------------------------------- */
-/* corte_segmentos                                                                         */ 
-/*  .... Calcula el punto de corte entre dos segmentos                                     */ 
-/*  .... In: las coordenadas de los puntos extremos (x1,y1)-(x2,y2) y (x3,y3)-(x4,y4)      */
-/*  .... Out: sol son las coordenadas del punto de corte. return --> 1 si hay corte. -->0 no */
-
-int corte_segmentos ( float x1, float y1, float x2, float y2, 
-		      float x3, float y3, float x4, float y4,
-		      Tpf *sol );
-
-
-/* Normaliza el angulo entre [-PI, PI] */
-float NormalizarPI(float ang);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif 
diff --git a/sm/csm/mbicp/mbicp_driver.cc b/sm/csm/mbicp/mbicp_driver.cc
deleted file mode 100644
index e84971de67e0a91d092a017020322dd8af2cc968..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/mbicp_driver.cc
+++ /dev/null
@@ -1,693 +0,0 @@
-/** @ingroup drivers */
-/** @{ */
-/** @defgroup driver_mbicp mbicp
- * @brief ScanMatching
-
-This driver implements the metric-based ICP scan-matching algorithm.
-
-J. Minguez, L. Montesano, and F. Lamiraux, "Metric-based iterative
-closest point scan matching for sensor displacement estimation," IEEE
-Transactions on Robotics, vol. 22, no. 5, pp. 1047 \u2013 1054, 2006. 
-
-@par Compile-time dependencies
-
-- none
-
-@par Provides
-
-- @ref interface_position2d
-
-@par Requires
-
-- @ref interface_position2d : source of pose and velocity information
-- @ref interface_laser : Pose-stamped laser scans (subtype 
-PLAYER_LASER_DATA_SCANPOSE)
-
-@par Configuration requests
-
-- none
-
-@par Configuration file options
-
-- max_laser_range (float)
-  - Default: 7.9 m    
-  - Maximum laser range.
-
-- laserPose_x (float)
-  - Default: 0.16 m    
-  - Offset of the laser on the edge x (in the robot's system of reference).
-
-- laserPose_y (float)
-  - Default: 0.0 m    
-  - Offset of the laser on the edge y (in the robot's system of reference).
-  
-- laserPose_th (float)
-  - Default: 0.0 rad    
-  - Offset of the laser on th (in the robot's system of reference).
-
-- radial_window	(float)
-  - Default: 0.3 m    
-  - Maximum distance difference between points of different scans. Points 
-    with greater Br cannot be correspondent (eliminate spurius asoc.).
- 
-- angular_window (float)
-  - Default: 0.523333333 rad
-  - Maximum angle diference between points of different scans. Points 
-    with greater Bw cannot be correspondent (eliminate spurius asoc.). 
-  
-- L (float)
-  - Default: 3.00   
-  - Value of the metric. When L tends to infinity you are using the 
-    standart ICP. When L tends to 0 you use the metric (more importance 
-    to rotation), when L tends to infinity you are using Euclidian metric.
-
-- laserStep (integer)
-  - Default: 1   
-  - Selects points of each scan with an step laserStep.
-    When laserStep=1 uses all the points of the scans
-    When laserStep=2 uses one each two ... 
-    This is an speed up parameter. 
-    
-- MaxDistInter (float)
-  - Default: 0.5 m   
-  - Maximum distance to interpolate between points in the ref scan. Consecutive 
-    points with less Euclidean distance than MaxDistInter are considered 
-    to be a segment.
-
-- filter (float)
-  - Default: 0.95   
-  - In [0,1] sets the % of asociations NOT considered spurious. E.g. if 
-    filter=0.9 you use 90% of the associations. The associations 
-    are ordered by distance and the (1-filter) with greater distance 
-    are not used. This type of filtering is called "trimmed-ICP".
-    
-- ProjectionFilter (int)
-  - Default: 1   
-  - Eliminate the points that cannot be seen given the two scans 
-    (see Lu&Millios 97). It works well for angles < 45 deg. 
-    1 : activates the filter.
-    0 : desactivates the filter.
-
-- AsocError (float)
-  - Default: 0.1   
-  - In [0,1]. Sets the % of minimun associations to run the algorithm.
-    One way to check if the algorithm diverges is to supervise 
-    if the number of associatios goes below a thresold. When the number 
-    of associations is below AsocError, the main function will return
-    error in associations step.
- 
-- MaxIter (int)
-  - Default: 50   
-  - Sets the maximum number of iterations for the algorithm to exit. The 
-    more iterations, the more chance you give the algorithm to be more accurate.
-
-- errorRatio (float)
-  - Default: 0.0001 m
-  - In [0,1] sets the maximum error ratio between iterations to exit. In 
-    iteration K, let be errorK the residual of the minimization. 
-    Error_th=(errorK-1/errorK). When error_th tends to 1 more precise is 
-    the solution of the scan matching.
-
-- IterSmoothConv (int)
-  - Default: 2   
-  - Number of consecutive iterations that satisfity the error criteria 
-    (the two above criteria) (error_th) OR (errorx_out && errory_out && errt_out).
-    With this parameter >1 avoids random solutions and estabilices the algorithm. 
-
-- errx_out (float)
-  - Default: 0.0001 m   
-  - Minimum error in x of the asociations to exit. In each iteration, the error 
-    is the residual of the minimization in each component. The condition is 
-    (errorKx<errx_out && errorKx<erry_out && errorKx<errt_out). When errorK 
-    tends to 0 the more precise is the solution of the scan matching
-    
-- erry_out (float)
-  - Default: 0.0001 m   
-  - Minimum error in x of the asociations to exit. In each iteration, the error 
-    is the residual of the minimization in each component. The condition is 
-    (errorKx<errx_out && errorKx<erry_out && errorKx<errt_out). When errorK 
-    tends to 0 the more precise is the solution of the scan matching
-
-- errt_out (float)
-  - Default: 0.0001 m   
-  - Minimum error in x of the asociations to exit. In each iteration, the error 
-    is the residual of the minimization in each component. The condition is 
-    (errorKx<errx_out && errorKx<erry_out && errorKx<errt_out). When errorK 
-    tends to 0 the more precise is the solution of the scan matching
-    
-@par Example
-
-@verbatim
-driver
-(
-  name "mbicp"
-  provides ["position2d:1"]
-  requires ["position2d:0" "laser:1"]
-
-  max_laser_range		7.9
-  laserPose_x			0.16
-  laserPose_y			0
-  laserPose_th			0
-  
-  radial_window  	       	0.3    
-  angular_window 	       	0.523333333	
-  
-  L		       		3.00    
-  laserStep	       		1       
-  MaxDistInter	       		0.5     
-  filter 	       		0.95    
-  ProjectionFilter	       	1       
-  AsocError	      		0.1     
-  MaxIter	       		50      
-  
-  errorRatio	       		0.0001  
-  errx_out	       		0.0001  
-  erry_out	       		0.0001  
-  errt_out	       		0.0001  
-  IterSmoothConv 	       	2       
-)
-
-@endverbatim
-
-@author Javier Minguez (underlying algorithm)
-*/
-/** @} */
-
-
-#include <libplayercore/playercore.h>
-
-#include "calcul.h"
-#include "MbICP.h"
-
-#define LASER_MAX_SAMPLES 1024
-
-class mbicp : public Driver
-{
-
-public:
-    
-    mbicp( ConfigFile* cf, int section);
-    virtual ~mbicp();
-
-    virtual int Setup();
-    virtual int Shutdown();
-
-    virtual int ProcessMessage(QueuePointer &resp_queue,
-                               player_msghdr * hdr,
-                               void * data);
-private:
-
-	float	max_laser_range;
-	float	Bw;
-	float	Br;
-	float	L;
-	int	laserStep;
-	float	MaxDistInter;
-	float	filter;
-	int	ProjectionFilter;
-	float	AsocError;
-	int	MaxIter;
-	float	errorRatio;
-	float	errx_out;
-	float	erry_out;
-	float	errt_out;
-	int	IterSmoothConv;
- 	Tsc	laserPoseTsc;
- 
-	player_pose2d_t		lastPoseOdom,
-				currentPose,
-    				previousPose,
-    				scanmatchingPose;
-
-	player_laser_data_t	currentScan,
-    				previousScan;
-				
-	bool		havePrevious;
-
-	//Compute scanMatching
-	void compute();
-
-	//Transform structures between player and Tdata
-	Tsc		playerPose2Tsc(player_pose2d_t posicion);
-	player_pose2d_t 	Tsc2playerPose(Tsc posicion);
-	void 		playerLaser2Tpfp(player_laser_data_t laserData,Tpfp *laserDataTpfp);
-
- 	// Main function for device thread.
-    	virtual void Main();
-
-    	int SetupDevice();
-    	int ShutdownDevice();
-
-    	// Odometry.
-    	void ProcessOdom(player_msghdr_t* hdr, player_position2d_data_t &data);
-
-    	// SubtypeLaser
-    	void ProcessSubtypeLaser(player_msghdr_t* hdr, player_laser_data_scanpose_t &data);
-
-    	// Check for new commands from server
-    	void ProcessCommand(player_msghdr_t* hdr, player_position2d_cmd_pos_t &);
-
-    	// Setup ScanMatching
-    	void setupScanMatching();
-
-    	// Position
-    	player_devaddr_t posicion_addr;
-
-    	// Odometry and laser
-    	Device *odom;
-    	player_devaddr_t odom_addr;
-
-    	Device *laser;
-    	player_devaddr_t laser_addr;
-
-};
-
-////////////////////////////////////////////////////////////////////////////////
-Driver* mbicp_Init(ConfigFile* cf, int section){
-
-   return((Driver*)(new mbicp(cf, section)));
-
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-void mbicp_Register(DriverTable* table){
-
-   table->AddDriver("mbicp", mbicp_Init);
-
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-int mbicp::Setup(){
-
-   havePrevious = false;
-
-   // Initialise the underlying position device.
-   if(SetupDevice() != 0)
-      return -1;
-
-   setupScanMatching();
-
-   puts("Setup Scanmatching");
-   // Start the driver thread.
-   StartThread();
-   return 0;
-
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-void mbicp::setupScanMatching(){
-
-Init_MbICP_ScanMatching( 
-			this->max_laser_range,
-			this->Bw,	 
- 			this->Br,	 
-			this->L,	 
-			this->laserStep,
-			this->MaxDistInter,
-			this->filter,	 
-			this->ProjectionFilter,
-			this->AsocError,
-			this->MaxIter,  
-			this->errorRatio,
-			this->errx_out, 
-			this->erry_out,  
-			this->errt_out,  
-			this->IterSmoothConv);
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-int mbicp::Shutdown(){
-   // Stop the driver thread.
-   StopThread();
-
-   // Stop the odom device.
-   ShutdownDevice();
-   return 0;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-mbicp::mbicp( ConfigFile* cf, int section)
-  : Driver(cf, section, true, PLAYER_MSGQUEUE_DEFAULT_MAXLEN,
-           PLAYER_POSITION2D_CODE){
-
-
-	this->max_laser_range		=  cf->ReadFloat(section, "max_laser_range", 7.9);
-	this->Bw			=  cf->ReadFloat(section, "angular_window", 1.57/3.0);
-	this->Br			=  cf->ReadFloat(section, "radial_window", 0.3);
-	this->L				=  cf->ReadFloat(section, "L", 3.00);
-	this->laserStep			=  cf->ReadInt(section, "laserStep", 1);
-	this->MaxDistInter		=  cf->ReadFloat(section, "MaxDistInter", 0.5);
-	this->filter			=  cf->ReadFloat(section, "filter", 0.85);
-	this->ProjectionFilter		=  cf->ReadInt(section, "ProjectionFilter", 1);
-	this->AsocError			=  cf->ReadFloat(section, "AsocError", 0.1);
-	this->MaxIter			=  cf->ReadInt(section, "MaxIter", 50);
-	this->errorRatio		=  cf->ReadFloat(section, "errorRatio", 0.0001);
-	this->errx_out			=  cf->ReadFloat(section, "errx_out", 0.0001);
-	this->erry_out			=  cf->ReadFloat(section, "erry_out", 0.0001);
-	this->errt_out			=  cf->ReadFloat(section, "errt_out", 0.0001);
-	this->IterSmoothConv		=  cf->ReadInt(section, "IterSmoothConv", 2);
-	this->laserPoseTsc.x 		=  cf->ReadFloat(section, "laserPose_x", 0.16);
-  	this->laserPoseTsc.y 		=  cf->ReadFloat(section, "laserPose_y", 0);
-  	this->laserPoseTsc.tita 	=  cf->ReadFloat(section, "laserPose_th", 0);
-
-
-   	if(cf->ReadDeviceAddr(&(posicion_addr), section, "provides",
-         	PLAYER_POSITION2D_CODE, -1, NULL) != 0){
-     		this->SetError(-1);
-     		return;
-   	}
-
-   	odom = NULL;
-   	if(cf->ReadDeviceAddr(&odom_addr, section, "requires",
-       		PLAYER_POSITION2D_CODE, -1, NULL) != 0){
-      		SetError(-1);
-      		return;
-   	}
-
-   	laser = NULL;
-   	if(cf->ReadDeviceAddr(&laser_addr, section, "requires",
-       		PLAYER_LASER_CODE, -1, NULL) != 0){
-       		SetError(-1);
-   	}
-
-   	return;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-mbicp::~mbicp(){
-   return;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-int mbicp::SetupDevice(){
-
-   if(!(odom = deviceTable->GetDevice(odom_addr))){
-      PLAYER_ERROR("Unable to locate suitable position device");
-      return -1;
-   }
-   if(odom->Subscribe(InQueue) != 0){
-      PLAYER_ERROR("Unable to subscribe to position device");
-      return -1;
-   }
-
-   if(!(laser = deviceTable->GetDevice(laser_addr))){
-      PLAYER_ERROR("Unable to locate suitable laser device");
-      return -1;
-   }
-   if(laser->Subscribe(InQueue) != 0){
-      PLAYER_ERROR("Unable to subscribe to laser device");
-      return -1;
-   }
-
-   return 0;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-int mbicp::ShutdownDevice(){
-   player_position2d_cmd_vel_t cmd;
-
-   memset(&cmd, 0, sizeof(cmd));
-   // Stop the robot (locks the motors) if the motor state is set to
-   // disabled.  The P2OS driver does not respect the motor state.
-   cmd.vel.px = 0;
-   cmd.vel.py = 0;
-   cmd.vel.pa = 0;
- 
-   odom->PutMsg(InQueue, PLAYER_MSGTYPE_CMD, PLAYER_POSITION2D_CMD_VEL,
-                (void*)&cmd,sizeof(cmd),NULL);
-
-   odom->Unsubscribe(InQueue);
-   laser->Unsubscribe(InQueue);
-   puts("Shutdown mbicp");
-   return 0;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-void mbicp::Main(){
-	while (true){
-      		// Wait till we get new data
-      		Wait();
-      		
-		// Test if we are supposed to cancel this thread.
-      		pthread_testcancel();
-
-      		// Process any pending requests.
-      		ProcessMessages();
-   	}
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-int mbicp::ProcessMessage(QueuePointer &resp_queue,player_msghdr * hdr, void * data){
-
-   	// PLAYER_LASER_DATA_SCANPOSE
-   	if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_DATA,PLAYER_LASER_DATA_SCANPOSE, laser_addr))
-	{
-      		assert(hdr->size == sizeof(player_laser_data_scanpose_t));
-      		ProcessSubtypeLaser(hdr, *reinterpret_cast<player_laser_data_scanpose_t *> (data));
-   	}else
-
-   	// PLAYER_POSITION2D_DATA_STATE
-   	if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_DATA,PLAYER_POSITION2D_DATA_STATE, odom_addr))
-	{
-      		assert(hdr->size == sizeof(player_position2d_data_t));
-      		ProcessOdom(hdr, *reinterpret_cast<player_position2d_data_t *> (data));
-   	}else
-
-   	if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_DATA,PLAYER_POSITION2D_DATA_GEOM, odom_addr))
-	{
-		assert(hdr->size == sizeof(player_position2d_data_t));
-      		player_msghdr_t newhdr = *hdr;
-      		newhdr.addr = device_addr;
-      		Publish(&newhdr, (void*)&data);
-   	}else 
-
-   	if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD,/*PLAYER_POSITION2D_CMD_VEL*/ -1, device_addr))
-	{
-      		assert(hdr->size == sizeof(player_position2d_cmd_vel_t));
-      		// make a copy of the header and change the address
-      		player_msghdr_t newhdr = *hdr;
-      		newhdr.addr = odom_addr;
-      		odom->PutMsg(InQueue, &newhdr, (void*)data);
-   	}else
-	{ 
-      		if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ, -1, device_addr)){
-	        	// Pass the request on to the underlying position device and wait for
-         		// the reply.
-         		Message* msg;
-
-         		if(!(msg = odom->Request(InQueue, hdr->type, hdr->subtype, (void*)data,hdr->size, &hdr->timestamp)))
-			{
-            			PLAYER_WARN1("failed to forward config request with subtype: %d\n",hdr->subtype);
-            			return(-1);
-         		}
-         		player_msghdr_t* rephdr = msg->GetHeader();
-         		void* repdata = msg->GetPayload();
-         		// Copy in our address and forward the response
-         		rephdr->addr = device_addr;
-         		Publish(resp_queue, rephdr, repdata);
-         		delete msg;
-		}
-   	}
-   	return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-void mbicp::ProcessOdom(player_msghdr_t* hdr,player_position2d_data_t &data)
-{
-
-	
-	Tsc	outComposicion1,
-		outComposicion2,
-		outInversion1;
-			
-	Tsc	lastPoseOdomTsc,
-		previousPoseTsc,
-		scanmatchingPoseTsc;		
-
-
-	lastPoseOdom.px = data.pos.px;
-	lastPoseOdom.py = data.pos.py;
-	lastPoseOdom.pa = data.pos.pa;
-
-	if (havePrevious)
-	{
-		lastPoseOdomTsc 	= playerPose2Tsc(lastPoseOdom);
-		previousPoseTsc 	= playerPose2Tsc(previousPose);
-		scanmatchingPoseTsc	= playerPose2Tsc(scanmatchingPose);
-
-		inversion_sis(&previousPoseTsc, &outInversion1);
-		composicion_sis(&outInversion1, &lastPoseOdomTsc, &outComposicion1);
-		composicion_sis(&scanmatchingPoseTsc, &outComposicion1, &outComposicion2);
-	
-
-		data.pos.px	= outComposicion2.x;
-		data.pos.py	= outComposicion2.y;
-		data.pos.pa	= outComposicion2.tita;
-
-
-	}	
-	
-	player_msghdr_t newhdr = *hdr;
-   	newhdr.addr = device_addr;
-   	Publish(&newhdr, (void*)&data);
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-void mbicp::ProcessSubtypeLaser(player_msghdr_t* hdr,player_laser_data_scanpose_t &data){
-
-	lastPoseOdom.px = data.pose.px;
-	lastPoseOdom.py = data.pose.py;
-	lastPoseOdom.pa = data.pose.pa;
-
-	currentPose	= lastPoseOdom;
-
-	currentScan.min_angle		= data.scan.min_angle;		
-	currentScan.max_angle		= data.scan.max_angle;	
-	currentScan.resolution		= data.scan.resolution;
-	currentScan.max_range		= data.scan.max_range;	
-	currentScan.ranges_count	= data.scan.ranges_count;
-	currentScan.intensity_count	= data.scan.intensity_count;	
-	currentScan.id					= data.scan.id;
-	
-	for (unsigned int i=0; i < currentScan.ranges_count; i++){
-		currentScan.ranges[i] = data.scan.ranges[i];
-		currentScan.intensity[i] = data.scan.intensity[i];
-	}
-
-	if (havePrevious && (	currentPose.px != previousPose.px || 
-				currentPose.py != previousPose.py ||
-				currentPose.pa != previousPose.pa))
-	{
-		compute();
-	}
-
-	else if (!havePrevious)
-	{
-		previousScan 		= currentScan;
-		previousPose		= currentPose;
-		scanmatchingPose	= currentPose;
-		havePrevious		= true;
-	}					
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-void mbicp::compute()
-{
-	Tsc	previousPoseTsc,
-		currentPoseTsc,
-		scanmatchingPoseTsc,
-		solutionTsc;
-	
-	Tsc	outComposicion1,
-		outComposicion2,
-		outComposicion3,
-		outComposicion9,
-		outComposicion10,
-		outComposicion11,
-		outInversion1,
-		outInversion4;
-			
-	Tpfp	previousScanTpfp[LASER_MAX_SAMPLES],
-		currentScanTpfp[LASER_MAX_SAMPLES];
-			
-	int	salidaMbicp;		
-			
-
-	currentPoseTsc		= playerPose2Tsc(currentPose);
-	previousPoseTsc 	= playerPose2Tsc(previousPose);
-	scanmatchingPoseTsc 	= playerPose2Tsc(scanmatchingPose);
-
-
-	composicion_sis(&previousPoseTsc, &laserPoseTsc, &outComposicion1);
-	composicion_sis(&currentPoseTsc, &laserPoseTsc, &outComposicion2);
-	inversion_sis(&outComposicion1, &outInversion1);
-	composicion_sis(&outInversion1, &outComposicion2, &outComposicion3);
-
-	playerLaser2Tpfp(previousScan,previousScanTpfp);
-	playerLaser2Tpfp(currentScan,currentScanTpfp);
-
-	salidaMbicp = MbICPmatcher(previousScanTpfp,currentScanTpfp,&outComposicion3, &solutionTsc);	
-
-	if (salidaMbicp == 1){
-
-		composicion_sis(&laserPoseTsc,&solutionTsc,&outComposicion9);
-		inversion_sis(&laserPoseTsc, &outInversion4);
-		composicion_sis(&outComposicion9,&outInversion4,&outComposicion10);
-		composicion_sis(&scanmatchingPoseTsc, &outComposicion10, &outComposicion11);
-
-		scanmatchingPoseTsc.x = outComposicion11.x;
-		scanmatchingPoseTsc.y = outComposicion11.y;
-		scanmatchingPoseTsc.tita = outComposicion11.tita;
-
-	}
-	else{
-
-		if (salidaMbicp == 2)
-			fprintf(stderr,"2 : Everything OK but reached the Maximum number of iterations\n");		
-		else{
-			if (salidaMbicp == -1)
-				fprintf(stderr,"Failure in the association step\n");
-			if (salidaMbicp == -2)
-				fprintf(stderr,"Failure in the minimization step\n");
-		}
-		composicion_sis(&laserPoseTsc,&outComposicion3,&outComposicion9);
-		inversion_sis(&laserPoseTsc, &outInversion4);
-		composicion_sis(&outComposicion9,&outInversion4,&outComposicion10);
-		composicion_sis(&scanmatchingPoseTsc, &outComposicion10, &outComposicion11);
-
-		scanmatchingPoseTsc.x = outComposicion11.x;
-		scanmatchingPoseTsc.y = outComposicion11.y;
-		scanmatchingPoseTsc.tita = outComposicion11.tita;
-
-	}
-
-	scanmatchingPose	= Tsc2playerPose(scanmatchingPoseTsc);
-	previousScan		= currentScan;
-	previousPose		= currentPose;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-Tsc mbicp::playerPose2Tsc(player_pose2d_t posicion)
-{
-	Tsc	posicionTsc;
-	
-	posicionTsc.x = posicion.px;
-  	posicionTsc.y = posicion.py;
-  	posicionTsc.tita = posicion.pa;
-  	return(posicionTsc);
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-player_pose2d_t mbicp::Tsc2playerPose(Tsc posicion)
-{
-	player_pose2d_t	posicionPlayer;
-	
-	posicionPlayer.px = posicion.x;
-  	posicionPlayer.py = posicion.y;
-  	posicionPlayer.pa = posicion.tita;
-  	return(posicionPlayer);
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-void mbicp::playerLaser2Tpfp(player_laser_data_t laserData,Tpfp *laserDataTpfp)
-{
-	for(unsigned int i=0; i< laserData.ranges_count; i++){
-		laserDataTpfp[i].r	= laserData.ranges[i];
-		laserDataTpfp[i].t	= laserData.min_angle + (i*laserData.resolution);
-	}
-}
diff --git a/sm/csm/mbicp/mbicp_interface.c b/sm/csm/mbicp/mbicp_interface.c
deleted file mode 100644
index 724d38e1aac82f9a30e835acd7c01fd62257d0c1..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/mbicp_interface.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "../csm_all.h"
-
-void sm_mbcip(struct sm_params*input, struct sm_result*output) {
-	
-}
-
-/*
-void mbicp_add_options(struct option* ops, struct hsm_params*p) {
-	#define prefix "mbicp_"
-	
-	options_double(ops, "hsm_linear_cell_size", &p->linear_cell_size, 0.03, "HSM: Size of a rho cell");
-	options_double(ops, "hsm_angular_cell_size_deg", &p->angular_cell_size_deg, 1.0, "HSM: Size of angualar cell (deg)");
-	options_int(ops, "hsm_num_angular_hypotheses", &p->num_angular_hypotheses, 8, "HSM: Number of angular hypotheses.");
-	options_double(ops, "hsm_xc_directions_min_distance_deg", &p->xc_directions_min_distance_deg, 10.0, "HSM: Min distance between directions for cross corr (deg)");
-	options_int(ops, "hsm_xc_ndirections", &p->xc_ndirections, 3, "HSM: Number of directions for cross corr (deg)");
-	options_double(ops, "hsm_angular_hyp_min_distance_deg", &p->angular_hyp_min_distance_deg, 10.0, "HSM: Min distance between different angular hypotheses  (deg)");
-	
-	options_int(ops, "hsm_linear_xc_max_npeaks", &p->linear_xc_max_npeaks, 5, "HSM: Number of peaks per direction for linear translation");
-	options_double(ops, "hsm_linear_xc_peaks_min_distance", &p->linear_xc_peaks_min_distance, 5.0, "HSM: Min distance between different peaks in linear correlation");
-}
-
-*/
-
-
diff --git a/sm/csm/mbicp/percolate.c b/sm/csm/mbicp/percolate.c
deleted file mode 100644
index a4a79c5fd96ca103fe37a8b8ae80ba6bdc6f6161..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/percolate.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <stdio.h>
-#include "percolate.h"
-
-
-void swapItem(TAsoc *a, TAsoc *b){
-	TAsoc c;
-
-	c=*a;
-	*a=*b;
-	*b=c;
-}
-
-void perc_down(TAsoc a[], int i, int n) {
-  int child; TAsoc tmp;
-  for (tmp=a[i]; i*2 <= n; i=child) {
-    child = i*2;
-    if ((child != n) && (a[child+1].dist > a[child].dist))
-      child++;
-    if (tmp.dist < a[child].dist)
-      a[i] = a[child];
-    else
-      break;
-  }
-  a[i] = tmp;
-}
-
-void heapsort(TAsoc a[], int n) {
-  int i, j;
-  j = n;
-  for (i=n/2; i>0; i--)  /* BuildHeap */
-    perc_down(a,i,j);
-  i = 1;
-  for (j=n; j>=2; j--) {
-    swapItem(&a[i],&a[j]);   /* DeleteMax */
-    perc_down(a,i,j-1);
-  }
-}
diff --git a/sm/csm/mbicp/percolate.h b/sm/csm/mbicp/percolate.h
deleted file mode 100644
index 3d36a934a41ef29a41d197be2e917b38319eb1d7..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/percolate.h
+++ /dev/null
@@ -1,18 +0,0 @@
-
-#ifndef percolate
-#define percolate
-
-#include "MbICP2.h"
-#include "TData.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void heapsort(TAsoc a[], int n);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sm/csm/mbicp/sp_matrix.c b/sm/csm/mbicp/sp_matrix.c
deleted file mode 100644
index 168e2f0a11a6aaa64994bb4fda5ea3b6565d47d3..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/sp_matrix.c
+++ /dev/null
@@ -1,253 +0,0 @@
-#include <stdio.h>
-#include "sp_matrix.h"
-
-/*****************************************************************************/
- MATRIX create_matrix (int rows, int cols)
-
-/*****************************************************************************
- Creates a MATRIX of dimensions (rows, cols) and initializaes it to zeros.
-******************************************************************************/
-{
-  MATRIX m; 
-
-  MROWS (m) = rows;
-  MCOLS (m) = cols;
-
-  {
-    int i, j;
-
-    for (i = 0; i < MROWS (m); i++)
-        for (j = 0; j < MCOLS (m); j++)
-            MDATA (m, i, j) = 0;
-  }
-
-  return m;
-}
-
-/*****************************************************************************/
- void initialize_matrix (MATRIX *m, int rows, int cols)
-
-/*****************************************************************************
- Initializes a MATRIX to dimensions (rows, cols) and content zeros.
-******************************************************************************/
-{
-  MROWS (*m) = rows;
-  MCOLS (*m) = cols;
-
-  {
-    int i, j;
-
-    for (i = 0; i < MROWS (*m); i++)
-        for (j = 0; j < MCOLS (*m); j++)
-            MDATA (*m, i, j) = 0;
-  }
-
-}
-
-
-/*****************************************************************************/
- void print_matrix (char *message, MATRIX const *m)
-
-/*****************************************************************************
- Print to stdout the contents of MATRIX m.
-******************************************************************************/
-{
-  int i, j;
-
-  printf ("%s\n",message);
-  printf("%d %d \n",MROWS (*m),MCOLS (*m));
-  if ((MROWS (*m) <= MAX_ROWS) && (MCOLS (*m) <= MAX_COLS))
-    for (i = 0; i < MROWS (*m); i++)
-    {
-        for (j = 0; j < MCOLS (*m); j++)
-            printf ("%10.5f ", MDATA (*m, i, j));
-        printf ("\n");
-    }
-  else printf ("Dimension incorrecta!");
-  printf ("\n");
-}
-
-/*****************************************************************************/
- VECTOR create_vector (int elements)
-
-/*****************************************************************************
- Initializes a VECTOR to dimension (elements) and its contents to zeros.
-******************************************************************************/
-{
-  VECTOR v;
-
-  VELEMENTS (v) = elements;
-
-  {
-    int i;
-
-    for (i = 0; i < VELEMENTS (v); i++)
-        VDATA (v, i) = 0;
-  }
-
-  return v;
-}
-
-/*****************************************************************************/
- void initialize_vector (VECTOR *v, int elements)
-
-/*****************************************************************************
- Initializes a VECTOR to dimension (elements) and its contents to zeros.
-******************************************************************************/
-{
-  VELEMENTS (*v) = elements;
-
-  {
-    int i;
-
-    for (i = 0; i < VELEMENTS (*v); i++)
-        VDATA (*v, i) = 0;
-  }
-}
-
-/*****************************************************************************/
- void print_vector (char *message, VECTOR const *v)
- 
-/*****************************************************************************
- Print to stdout the contents of VECTOR m.
-******************************************************************************/
-{
-  int i;
-
-  printf ("%s\n",message);
-  if (VELEMENTS (*v) <= MAX_ROWS)
-    for (i = 0; i < VELEMENTS (*v); i++)
-    {
-        printf ("%f ", VDATA (*v, i));
-        printf ("\n");
-    }
-  else printf ("Dimension incorrecta!");
-  printf ("\n");
-}
-
-/*****************************************************************************/
- float cross_product (MATRIX const *m, int f1, int c1, int f2, int c2)
-
-/*****************************************************************************
-******************************************************************************/
-{
-  return MDATA (*m, f1, c1) * MDATA (*m, f2, c2) - MDATA (*m, f1, c2) * MDATA (*m, f2, c1);
-}
-
-/*****************************************************************************/
-int determinant (MATRIX const *m, float *result)
-/*****************************************************************************
-******************************************************************************/
-{
-  if (!M_SQUARE (*m))
-  {
-     printf ("ERROR (determinant): MATRIX must be square!\n");
-     print_matrix ("MATRIX:", m);	
-	 return -1;     
-  }
-  else
-  {    
-
-    if (MROWS (*m) == 1)
-       *result = MDATA (*m, 0, 0);
-    else if (MROWS (*m) == 2)
-       *result = cross_product (m, 0, 0, 1, 1);
-    else
-       *result = MDATA (*m, 0, 0) * cross_product (m, 1, 1, 2, 2)
-              - MDATA (*m, 0, 1) * cross_product (m, 1, 0, 2, 2)
-              + MDATA (*m, 0, 2) * cross_product (m, 1, 0, 2, 1);
-
-
-    return 1;
-  }  
-}
-
-/*****************************************************************************/
- int inverse_matrix (MATRIX const *m, MATRIX *n)
-
-/*****************************************************************************
-******************************************************************************/
-{
-  if (!M_SQUARE (*m))
-  {	 
-     printf ("ERROR (inverse_matrix): MATRIX must be square!\n");
-     print_matrix ("MATRIX:", m);
-	 n->cols=0; n->rows=0;
-     return -1;
-  }
-  else
-  {
-    float det;
-	int res;
-
-    res = determinant (m,&det);
-
-    if (res == -1)
-    {
-       printf ("ERROR (inverse_matrix): singular MATRIX!\n");
-       print_matrix ("MATRIX:", m);
-       return -1;
-    }
-    else
-    {
-      initialize_matrix (n, MROWS (*m), MCOLS (*m));
-      if (MROWS (*m) == 1)
-      {
-        MDATA (*n, 0, 0) = 1 / det ;
-      }
-      else if (MROWS (*m) == 2)
-      {
-        MDATA (*n, 0, 0) = MDATA (*m, 1, 1) / det ;
-        MDATA (*n, 0, 1) = -MDATA (*m, 0, 1) / det ;
-        MDATA (*n, 1, 0) = -MDATA (*m, 1, 0) / det ;
-        MDATA (*n, 1, 1) = MDATA (*m, 0, 0) / det ;
-      }
-      else
-      {
-        MDATA (*n, 0, 0) = cross_product (m, 1, 1, 2, 2) / det ;
-        MDATA (*n, 0, 1) = -cross_product (m, 0, 1, 2, 2) / det ;
-        MDATA (*n, 0, 2) = cross_product (m, 0, 1, 1, 2) / det ;
-        MDATA (*n, 1, 0) = -cross_product (m, 1, 0, 2, 2) / det ;
-        MDATA (*n, 1, 1) = cross_product (m, 0, 0, 2, 2) / det ;
-        MDATA (*n, 1, 2) = -cross_product (m, 0, 0, 1, 2) / det ;
-        MDATA (*n, 2, 0) = cross_product (m, 1, 0, 2, 1) / det ;
-        MDATA (*n, 2, 1) = -cross_product (m, 0, 0, 2, 1) / det ;
-        MDATA (*n, 2, 2) = cross_product (m, 0, 0, 1, 1) / det ;
-      }	  
-	}
-  }
-  return 1;
-}
-
-/*****************************************************************************/
- int multiply_matrix_vector (MATRIX const *m, VECTOR const *v, VECTOR *r)
-
-/*****************************************************************************
- Returns the VECTOR-MATRIX product of m and v in r.
-******************************************************************************/
-{
-  if (! (MV_COMPAT_DIM (*m, *v)))
-  {
-     printf ("ERROR (multiply_matrix_vector): MATRIX  and VECTOR dimensions incompatible!\n");
-     print_matrix ("MATRIX:", m);
-     print_vector ("VECTOR:", v);
-     return -1; /*added 1996-07*/
-  }
-  else
-  {
-    int i, j;
-    float datum;
-
-    VELEMENTS (*r) = MROWS (*m);
-
-    for (i = 0; i < MROWS (*m); i++)
-    {
-        datum = 0;
-        for (j = 0; j < VELEMENTS (*v); j++)
-            datum = datum + MDATA (*m, i, j) * VDATA (*v, j);
-        VDATA (*r, i) = datum;
-    }
-  }
-  return 1;
-}
-
diff --git a/sm/csm/mbicp/sp_matrix.h b/sm/csm/mbicp/sp_matrix.h
deleted file mode 100644
index 648ae698fba9ac694ef1ce0bca81ee849b699f09..0000000000000000000000000000000000000000
--- a/sm/csm/mbicp/sp_matrix.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-  J. Neira
-  J. A. Castellanos
-  Robotics and Real Time Group
-  University of Zaragoza
-  
-  sp_matrix.h
-  Implements basic MATRIX operations
-*/
-
-#ifndef _SP_MATRIX_H
-#define _SP_MATRIX_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_ROWS (7)
-#define MAX_COLS (7)
-
-typedef struct {
-  int   rows;
-  int   cols;
-  float data[MAX_ROWS][MAX_COLS];
-} MATRIX;
-
-typedef struct {
-  int   elements;
-  float data[MAX_ROWS];
-} VECTOR;
-
-#define DOF (3)
-
-typedef struct {
-  int mat[DOF];
-  int range;
-} BMAT;
-
-#define MROWS(m)             ((m).rows)
-#define MCOLS(m)             ((m).cols)
-#define MDATA(m,i,j)         ((m).data[i][j])
-
-#define VELEMENTS(v)         ((v).elements)
-#define VDATA(v,i)           ((v).data[i])
-
-#define M_SQUARE(m)          ((m).rows == (m).cols)
-#define M_COMPAT_DIM(m, n)   ((m).cols == (n).rows)
-#define M_EQUAL_DIM(m, n)    (((m).rows == (n).rows)  && ((m).cols == (n).cols))
-#define V_EQUAL_DIM(v, w)    (((v).elements == (w).elements))
-#define MV_COMPAT_DIM(m, v)  ((m).cols == (v).elements)
-
-#define FIRST(b)             ((b).mat[0])
-#define SECOND(b)            ((b).mat[1])
-#define THIRD(b)             ((b).mat[2])
-#define RANGE(b)             ((b).range)
-
-#define SQUARE(x)            ((x)*(x))
-
-MATRIX create_matrix (int rows, int cols);
-void initialize_matrix (MATRIX *m, int rows, int cols);
-void diagonal_matrix (MATRIX *m, int dim, float el1, float el2, float el3);
-void print_matrix (char *message, MATRIX const *m);
-VECTOR create_vector (int elements);
-void initialize_vector (VECTOR *v, int elements);
-void print_vector (char *message, VECTOR const *v);
-float cross_product (MATRIX const *m, int f1, int c1, int f2, int c2);
-int determinant (MATRIX const *m, float *result);
-int inverse_matrix (MATRIX const *m, MATRIX *n);
-int multiply_matrix_vector (MATRIX const *m, VECTOR const *v, VECTOR *r);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/sm/csm/test_math_utils_sanity.c b/sm/csm/test_math_utils_sanity.c
deleted file mode 100644
index 5c7bef00481dd22ecc627bbce01bbd6d2a30fb47..0000000000000000000000000000000000000000
--- a/sm/csm/test_math_utils_sanity.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "csm_all.h"
-#include <time.h>
-
-#include "math_utils.h"
-
-int main() {
-
-	int errors = 0;
-	double should_be_nan[2] = { 0.0 / 0.0, GSL_NAN };
-	
-	int i;
-	for(i=0;i<2;i++) {
-		if(!isnan(should_be_nan[i])) {
-			printf("#%d: isnan(%f) failed \n", i, should_be_nan[i]);
-			errors++;
-		}
-		if(!is_nan(should_be_nan[i])) {
-			printf("#%d: is_nan(%f) failed \n", i, should_be_nan[i]);
-			errors++;
-		}
-	}
-	
-	return errors;
-}
diff --git a/sm/header_test.c.in b/sm/header_test.c.in
deleted file mode 100644
index d4d891c7032421f5fd324a1ef5b4754ab32dcbe9..0000000000000000000000000000000000000000
--- a/sm/header_test.c.in
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "@header@"
-
-int main() {}
\ No newline at end of file
diff --git a/sm/lib/egsl/CMakeLists.txt b/sm/lib/egsl/CMakeLists.txt
deleted file mode 100644
index 7daa48fbace04b7aa6f211a2e4316a786f2fc015..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-
-SET(egsl_sources 
-	egsl.c 
-	egsl_ops.c
-	egsl_conversions.c
-	egsl_misc.c
-)
-
-ADD_LIBRARY(egsl STATIC ${egsl_sources})
-
-ADD_EXECUTABLE(egsl_test egsl_test.c)
-TARGET_LINK_LIBRARIES(egsl_test egsl  ${GSL_LIBRARIES})
-
-ADD_EXECUTABLE(egsl_test_allocation egsl_test_allocation.c)
-TARGET_LINK_LIBRARIES(egsl_test_allocation egsl  ${GSL_LIBRARIES})
-
-
-# installation
-
-FILE(GLOB headers "*.h")
-INSTALL(FILES ${headers} DESTINATION include/egsl)
-INSTALL(TARGETS egsl ARCHIVE DESTINATION lib)
diff --git a/sm/lib/egsl/docs/Makefile b/sm/lib/egsl/docs/Makefile
deleted file mode 100644
index d7c49f0a4765f46d7fa8c57990d190415464be92..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/docs/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-
-input=egsl.txt
-output=egsl.html
-
-htmlsection=./htmlsection -no-spacer
-markdown=Markdown.pl
-
-header=header.html_frag
-footer=footer.html_frag 
-tmp=tmp
-
-
-all: $(output)
-
-$(output): $(input) $(header) $(footer)
-	$(markdown) $(input) | $(htmlsection) > $(tmp)
-	cat $(header) $(tmp) $(footer) > $@
-	-rm $(tmp)
-
-clean:
-	-rm $(output)
\ No newline at end of file
diff --git a/sm/lib/egsl/docs/egsl.html b/sm/lib/egsl/docs/egsl.html
deleted file mode 100644
index 1dcc4aed9cce766fce5463faf5bb86ea0b9f8b98..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/docs/egsl.html
+++ /dev/null
@@ -1,293 +0,0 @@
-<html>
-<head>
-	<title>Easy GSL</title>
-	<style type="text/css">
-		body * {
-			max-width:  35em;
-		}
-		body {
-			padding-left:  3cm;
-		}
-		h1 { margin-left:  -1cm;}
-		h2 { 
-			margin-left:  -1cm; margin-top: +1em; 	
-			}
-		h3 { margin-left:  -0.5cm;}
-		
-		/* Colors */
-		body { font-family:  Georgia, serif; 
-			background-color:  white;
-			color: #333;} 
-		h1, h2 { color: darkblue;}
-		h3 { color:  #333; }
-		pre {
-			margin-left:  +1em;
-			padding:  +5px;
-			background-color:  #eee;
-			color:  #00e;
-		}
-	</style>
- 	<link rel="stylesheet" type="text/css" href="style.css" />
-</head>
-<body>
-	<h1>Easy GSL: Making GSL easy for simple tasks.</h1>
-
-<p>This is a small C library for <em>making</em> <strong>simple</strong> <em>matrix 
-computations</em> <strong>easy</strong>. It is built on top of
-<a href="http://www.gnu.org/software/gsl/">the GNU Scientific Library</a>.</p>
-
-<p>
-
-<ul compact>
-<ul compact>
-<li><a href="#subsection_toc1">Introduction</a></li>
-<ul compact>
-<li><a href="#subsubsection_toc2">Download</a></li>
-<li><a href="#subsubsection_toc3">License</a></li>
-<li><a href="#subsubsection_toc4">Acknowledgements</a></li>
-</ul>
-<li><a href="#subsection_toc5">The two main features of <tt>EGSL</tt></a></li>
-<ul compact>
-<li><a href="#subsubsection_toc6">Feature #1: Automatic (de)allocation of matrices</a></li>
-<li><a href="#subsubsection_toc7">Feature #2: Caching of matrices</a></li>
-</ul>
-<li><a href="#subsection_toc8">Usage</a></li>
-<ul compact>
-<li><a href="#subsubsection_toc9">Start with a <tt>egsl_push()</tt>, end with a <tt>egsl_pop()</tt></a></li>
-<li><a href="#subsubsection_toc10">Promotion of <code>val</code>s to previous contexts</a></li>
-<li><a href="#subsubsection_toc11">Useful macros</a></li>
-</ul>
-<li><a href="#subsection_toc12">Library reference</a></li>
-<ul compact>
-<li><a href="#subsubsection_toc13">Allocation of matrices</a></li>
-<li><a href="#subsubsection_toc14">Operation with matrices</a></li>
-<li><a href="#subsubsection_toc15">Accessing matrix elements</a></li>
-<li><a href="#subsubsection_toc16">Eigenvalues and eigenvectors</a></li>
-<li><a href="#subsubsection_toc17">Conversions</a></li>
-<li><a href="#subsubsection_toc18">Printing</a></li>
-</ul>
-</ul>
-</ul>
-</p>
-
-<p><h2><a name="subsection_toc1">Introduction</a></h2></p>
-
-<p>Albeit very powerful, the GSL is definitely not user-friendly for
-making simple matrix computations.
-Instead, <code>EGSL</code> will try to <em>fool you into thinking that you are using Matlab</em>.</p>
-
-<p>Yes, it's that easy! You can forget all of that <code>gsl_matrix_alloc</code>
-and <code>gsl_matrix_free</code>.</p>
-
-<p><h3><a name="subsubsection_toc2">Download</a></h3></p>
-
-<p>Download from <a href="http://purl.org/censi/2006/egsl">here</a>.</p>
-
-<p><h3><a name="subsubsection_toc3">License</a></h3></p>
-
-<p><h3><a name="subsubsection_toc4">Acknowledgements</a></h3></p>
-
-<p>This documentation is written using <a href="http://daringfireball.net/projects/markdown/">Markdown</a> and a tool called <a href="http://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/htmlsection.html">htmlsection</a>.</p>
-
-<p><h2><a name="subsection_toc5">The two main features of <tt>EGSL</tt></a></h2></p>
-
-<p><h3><a name="subsubsection_toc6">Feature #1: Automatic (de)allocation of matrices</a></h3></p>
-
-<p>Its main feature is that matrices are automatically allocated and 
-deallocated. For example, you can write:</p>
-
-<pre><code>egsl_push();
-
-    val v1 = zeros(10,10);
-    val v2 = ones(10,10);
-
-    egsl_print("v1+v2=", sum(v1, v2) );
-
-egsl_pop();
-</code></pre>
-
-<p>and not worry about (de)allocation.</p>
-
-<p><h3><a name="subsubsection_toc7">Feature #2: Caching of matrices</a></h3></p>
-
-<p>This feature makes <code>EGSL</code> faster than any other C++ equivalent that
-uses objects. Consider this code:</p>
-
-<pre><code>egsl_push();
-
-val v1 = zeros(10,10);
-
-for(int i=0;i&lt;1000000;i++) {
-
-    egsl_push();
-
-        val v2 = zeros(10,10);
-        // make some operation on v2
-        ....
-        // add v2 to v1
-        add_to(v1, v2);
-
-    egsl_pop();
-
-}
-
-egsl_pop();
-
-
-// Prints statistics about EGSL's usage of memory
-egsl_print_stats();
-</code></pre>
-
-<p>The output of this program is:</p>
-
-<pre><code>egsl: total allocations: 2   cache hits: 999999
-</code></pre>
-
-<p>Even though the loop executes one million times, the total number
-of matrix allocations is 2. Note that there is an inner context.
-When the loop runs the first time, the <code>gsl_matrix</code> for <code>v2</code> is allocated.
-However, when the <code>egsl_pop()</code> is reached, this matrix is not deallocated.
-When the loop runs the second time, <code>EGSL</code> detects that you already
-allocated a matrix of the requested size and re-utilizes the memory.</p>
-
-<p><h2><a name="subsection_toc8">Usage</a></h2></p>
-
-<p>For <code>EGSL</code> to work, you must remember some simple rules:</p>
-
-<ol>
-<li>Always include your code between a pair of <code>egsl_push</code>/<code>egsl_pop</code> calls.</li>
-<li>All values are returned as <code>val</code> structs: <code>val</code> object are not valid outside of the context they are created into (unless you tell <code>EGSL</code>).</li>
-</ol>
-
-<p><h3><a name="subsubsection_toc9">Start with a <tt>egsl_push()</tt>, end with a <tt>egsl_pop()</tt></a></h3></p>
-
-<p>A first, simple program may look like this:</p>
-
-<pre><code>#include &lt;egsl.h&gt;
-
-int main() {
-    // First of all, push a context
-    egsl_push();
-
-        // Allocates a matrix
-        val m1 = egsl_zeros(10, 10);
-
-        // Print it
-        egsl_print("Your first matrix:", m1);
-
-    egsl_pop();
-
-    // Wrong: you can't use m1 after egsl_pop()
-    // egsl_print("Your first matrix:", m1);
-}
-</code></pre>
-
-<p><h3><a name="subsubsection_toc10">Promotion of <code>val</code>s to previous contexts</a></h3></p>
-
-<p>If you want to make a matrix valid also for the previous context, 
-you may use the <code>egsl_promote(val)</code> function.</p>
-
-<pre><code>#include &lt;egsl.h&gt;
-
-int main() {
-    // First of all, push a context
-    egsl_push();
-
-        // push another
-        egsl_push();
-
-            // Allocates a matrix
-            val m1 = egsl_zeros(10, 10);
-
-            val m2 = egsl_promote(m1);
-
-        egsl_pop();
-
-    // ok, m2 is valid
-    egsl_print("m2 is valid here", m2);
-    // error: m1 is not valid here
-    // egsl_print("m1 is not valid here!", m1);
-
-
-    egsl_pop();
-}
-</code></pre>
-
-<p><h3><a name="subsubsection_toc11">Useful macros</a></h3></p>
-
-<p>If you use the include </p>
-
-<pre><code>#include &lt;egsl_macros.h&gt;
-</code></pre>
-
-<p>you can use a number of short macros instead of the long-named functions
-<code>egsl_*</code>. Most of these macros are inspired by Matlab syntax.</p>
-
-<p>For example, consider this line of Matlab code (taken from an actual program):</p>
-
-<pre><code>a = -2 * C_k * v_j1 +  2 * dC_drho_j1 * v2'
-</code></pre>
-
-<p>Translated into EGSL, with macros defined in <code>&lt;egsl_macros.h&gt;</code>, it turns
-into:</p>
-
-<pre><code>val a = sum(sc(-2,m(C_k,v_j1)), sc(2,m(dC_drho_j1,tr(v2))));
-</code></pre>
-
-<p>where</p>
-
-<ul>
-<li><code>sum(A, B)</code> is equivalent to <code>A + B</code></li>
-<li><code>sc(a, B)</code> is scalar--matrix multiplication: <code>a * B</code></li>
-<li><code>m(A, B)</code> is matrix--matrix multiplication; <code>A + B</code></li>
-</ul>
-
-<p>This is the best that we can do without operator overloading. </p>
-
-<p>Notice that for evaluating this expression <code>EGSL</code> needs a lot of 
-intermediate matrices, and it's managing all memory allocations for you.
-How many <code>egsl_matrix_alloc</code> would you need to write the same code in <code>GSL</code>?</p>
-
-<p><h2><a name="subsection_toc12">Library reference</a></h2></p>
-
-<p>This is a summary of available operations. It is shown both the
-extended function name (beginning with <code>egsl_</code>) and the macro
-defined in <code>&lt;egsl_macros.h&gt;</code></p>
-
-<p><h3><a name="subsubsection_toc13">Allocation of matrices</a></h3></p>
-
-<ul>
-<li><code>zeros(rows, cols)</code> (<code>egsl_zeros</code>): Allocates a matrix with all zeros.</li>
-<li><code>ones(rows, cols)</code> (<code>egsl_ones</code>): Allocates a matrix with all zeros.</li>
-</ul>
-
-<p><h3><a name="subsubsection_toc14">Operation with matrices</a></h3></p>
-
-<p>All this functions return a new <code>val</code>:</p>
-
-<ul>
-<li><code>sum(A, B)</code> (<code>egsl_sum</code>):  Sums two matrices.</li>
-<li><code>sc(a, B)</code> (<code>egsl_scale</code>): Represents scalar--matrix multiplication: <code>a * B</code></li>
-<li><code>m(A, B)</code> (<code>egsl_mult</code>): Represents matrix--matrix multiplication; <code>A * B</code></li>
-<li><code>inv(A)</code> (<code>egsl_inverse</code>): Returns the inverse of <code>A</code>.</li>
-</ul>
-
-<p><h3><a name="subsubsection_toc15">Accessing matrix elements</a></h3></p>
-
-<ul>
-<li><p><code>egsl_glsm(v)</code> will return you the underlying <code>gsl_matrix</code> for <code>v</code>. 
-For example:</p>
-
-<pre><code>val v = egsl_zeros(10,10);
-gsl_matrix* m = egsl_gslm(v);
-// now do whatever you want with m
-</code></pre></li>
-</ul>
-
-<p><h3><a name="subsubsection_toc16">Eigenvalues and eigenvectors</a></h3></p>
-
-<p><h3><a name="subsubsection_toc17">Conversions</a></h3></p>
-
-<p><h3><a name="subsubsection_toc18">Printing</a></h3></p>
-
-</body></html>
\ No newline at end of file
diff --git a/sm/lib/egsl/docs/egsl.md b/sm/lib/egsl/docs/egsl.md
deleted file mode 100644
index 9c05881addba28775fde8d0f7e26824abde40c71..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/docs/egsl.md
+++ /dev/null
@@ -1,216 +0,0 @@
-Easy GSL: Making GSL easy for simple tasks.
-=======================================
-
-This is a small C library for _making_ **simple** _matrix 
-computations_ **easy**. It is built on top of
-[the GNU Scientific Library](http://www.gnu.org/software/gsl/).
-
-@toc
-* toc
-
-Introduction
-------------
-
-Albeit very powerful, the GSL is definitely not user-friendly for
-making simple matrix computations.
-Instead, `EGSL` will try to *fool you into thinking that you are using Matlab*.
-
-Yes, it's that easy! You can forget all of that `gsl_matrix_alloc`
-and `gsl_matrix_free`.
-
-### Download ###
-
-Download from [here](http://purl.org/censi/2006/egsl).
-
-
-The two main features of <tt>EGSL</tt>
---------------------------------------
-
-### Feature #1: Automatic (de)allocation of matrices ###
-
-Its main feature is that matrices are automatically allocated and 
-deallocated. For example, you can write:
-
-	egsl_push();
-	
-		val v1 = zeros(10,10);
-		val v2 = ones(10,10);
-	
-		egsl_print("v1+v2=", sum(v1, v2) );
-	
-	egsl_pop();
-
-and not worry about (de)allocation.
-
-
-### Feature #2: Caching of matrices</subsubsection number=no>
-
-This feature makes `EGSL` faster than any other C++ equivalent that
-uses objects. Consider this code:
-
-	egsl_push();
-	
-	val v1 = zeros(10,10);
-	
-	for(int i=0;i<1000000;i++) {
-		
-		egsl_push();
-		
-			val v2 = zeros(10,10);
-			// make some operation on v2
-			....
-			// add v2 to v1
-			add_to(v1, v2);
-		
-		egsl_pop();
-		
-	}
-	
-	egsl_pop();
-	
-	
-	// Prints statistics about EGSL's usage of memory
-	egsl_print_stats();
-
-The output of this program is:
-
-	egsl: total allocations: 2   cache hits: 999999
-
-Even though the loop executes one million times, the total number
-of matrix allocations is 2. Note that there is an inner context.
-When the loop runs the first time, the `gsl_matrix` for `v2` is allocated.
-However, when the `egsl_pop()` is reached, this matrix is not deallocated.
-When the loop runs the second time, `EGSL` detects that you already
-allocated a matrix of the requested size and re-utilizes the memory.
-
-##  Usage</subsection>
-
-For `EGSL` to work, you must remember some simple rules:
-
-1. Always include your code between a pair of `egsl_push`/`egsl_pop` calls.
-2. All values are returned as `val` structs: `val` object are not valid outside of the context they are created into (unless you tell `EGSL`).
-
-
-### Start with a <tt>egsl\_push()</tt>, end with a <tt>egsl\_pop()</tt>
-
-A first, simple program may look like this:
-
-	#include <egsl.h>
-	
-	int main() {
-		// First of all, push a context
-		egsl_push();
-
-			// Allocates a matrix
-			val m1 = egsl_zeros(10, 10);
-		
-			// Print it
-			egsl_print("Your first matrix:", m1);
-		
-		egsl_pop();
-		
-		// Wrong: you can't use m1 after egsl_pop()
-		// egsl_print("Your first matrix:", m1);
-	}
-
-### Promotion of `val`s to previous contexts
-
-If you want to make a matrix valid also for the previous context, 
-you may use the `egsl_promote(val)` function.
-
-	#include <egsl.h>
-	
-	int main() {
-		// First of all, push a context
-		egsl_push();
-		
-			// push another
-			egsl_push();
-			
-				// Allocates a matrix
-				val m1 = egsl_zeros(10, 10);
-	
-				val m2 = egsl_promote(m1);
-			
-			egsl_pop();
-	
-		// ok, m2 is valid
-		egsl_print("m2 is valid here", m2);
-		// error: m1 is not valid here
-		// egsl_print("m1 is not valid here!", m1);
-		
-		
-		egsl_pop();
-	}
-
-### Useful macros
-
-If you use the include 
-
-	#include <egsl_macros.h>
-
-you can use a number of short macros instead of the long-named functions
-`egsl_*`. Most of these macros are inspired by Matlab syntax.
-
-For example, consider this line of Matlab code (taken from an actual program):
-
-	a = -2 * C_k * v_j1 +  2 * dC_drho_j1 * v2'
-
-Translated into EGSL, with macros defined in `<egsl_macros.h>`, it turns
-into:
-
-	val a = sum(sc(-2,m(C_k,v_j1)), sc(2,m(dC_drho_j1,tr(v2))));
-
-where
-
-* `sum(A, B)` is equivalent to `A + B`
-* `sc(a, B)` is scalar--matrix multiplication: `a * B`
-* `m(A, B)` is matrix--matrix multiplication; `A + B`
-
-This is the best that we can do without operator overloading. 
-
-Notice that for evaluating this expression `EGSL` needs a lot of 
-intermediate matrices, and it's managing all memory allocations for you.
-How many `egsl_matrix_alloc` would you need to write the same code in `GSL`?
-
-##  Library reference</subsection>
-
-This is a summary of available operations. It is shown both the
-extended function name (beginning with `egsl_`) and the macro
-defined in `<egsl_macros.h>`
-
-### Allocation of matrices
-
-* `zeros(rows, cols)` (`egsl_zeros`): Allocates a matrix with all zeros.
-* `ones(rows, cols)` (`egsl_ones`): Allocates a matrix with all zeros.
-
-### Operation with matrices
-
-All this functions return a new `val`:
-
-* `sum(A, B)` (`egsl_sum`):  Sums two matrices.
-* `sc(a, B)` (`egsl_scale`): Represents scalar--matrix multiplication: `a * B`
-* `m(A, B)` (`egsl_mult`): Represents matrix--matrix multiplication; `A * B`
-* `inv(A)` (`egsl_inverse`): Returns the inverse of `A`.
-
-### Accessing matrix elements
-
-* `egsl_glsm(v)` will return you the underlying `gsl_matrix` for `v`. 
-	For example:
-
-		val v = egsl_zeros(10,10);
-		gsl_matrix* m = egsl_gslm(v);
-		// now do whatever you want with m
-
-
-### Eigenvalues and eigenvectors
-
-### Conversions
-
-### Printing
-
-
-
-
-
-
diff --git a/sm/lib/egsl/docs/egsl.txt b/sm/lib/egsl/docs/egsl.txt
deleted file mode 100644
index 0b8e1a88296e93fe56ca4dce2b8267af182e2f16..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/docs/egsl.txt
+++ /dev/null
@@ -1,218 +0,0 @@
-Easy GSL: Making GSL easy for simple tasks.
-=======================================
-
-This is a small C library for _making_ **simple** _matrix 
-computations_ **easy**. It is built on top of
-[the GNU Scientific Library](http://www.gnu.org/software/gsl/).
-
-<tableofcontents></tableofcontents>
-
-<subsection number=no>Introduction</subsection>
-
-Albeit very powerful, the GSL is definitely not user-friendly for
-making simple matrix computations.
-Instead, `EGSL` will try to *fool you into thinking that you are using Matlab*.
-
-Yes, it's that easy! You can forget all of that `gsl_matrix_alloc`
-and `gsl_matrix_free`.
-
-<subsubsection number=no>Download</subsubsection>
-
-Download from [here](http://purl.org/censi/2006/egsl).
-
-<subsubsection number=no>License</subsubsection>
-
-<subsubsection number=no>Acknowledgements</subsubsection>
-
-This documentation is written using [Markdown](http://daringfireball.net/projects/markdown/) and a tool called [htmlsection](http://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/htmlsection.html).
-
-<subsection number=no>The two main features of <tt>EGSL</tt></subsection>
-
-<subsubsection number=no>Feature #1: Automatic (de)allocation of matrices</subsubsection number=no>
-
-Its main feature is that matrices are automatically allocated and 
-deallocated. For example, you can write:
-
-	egsl_push();
-	
-		val v1 = zeros(10,10);
-		val v2 = ones(10,10);
-	
-		egsl_print("v1+v2=", sum(v1, v2) );
-	
-	egsl_pop();
-
-and not worry about (de)allocation.
-
-
-<subsubsection number=no>Feature #2: Caching of matrices</subsubsection number=no>
-
-This feature makes `EGSL` faster than any other C++ equivalent that
-uses objects. Consider this code:
-
-	egsl_push();
-	
-	val v1 = zeros(10,10);
-	
-	for(int i=0;i<1000000;i++) {
-		
-		egsl_push();
-		
-			val v2 = zeros(10,10);
-			// make some operation on v2
-			....
-			// add v2 to v1
-			add_to(v1, v2);
-		
-		egsl_pop();
-		
-	}
-	
-	egsl_pop();
-	
-	
-	// Prints statistics about EGSL's usage of memory
-	egsl_print_stats();
-
-The output of this program is:
-
-	egsl: total allocations: 2   cache hits: 999999
-
-Even though the loop executes one million times, the total number
-of matrix allocations is 2. Note that there is an inner context.
-When the loop runs the first time, the `gsl_matrix` for `v2` is allocated.
-However, when the `egsl_pop()` is reached, this matrix is not deallocated.
-When the loop runs the second time, `EGSL` detects that you already
-allocated a matrix of the requested size and re-utilizes the memory.
-
-<subsection number=no>Usage</subsection>
-
-For `EGSL` to work, you must remember some simple rules:
-
-1. Always include your code between a pair of `egsl_push`/`egsl_pop` calls.
-2. All values are returned as `val` structs: `val` object are not valid outside of the context they are created into (unless you tell `EGSL`).
-
-
-<subsubsection number=no>Start with a <tt>egsl\_push()</tt>, end with a <tt>egsl\_pop()</tt></subsubsection>
-
-A first, simple program may look like this:
-
-	#include <egsl.h>
-	
-	int main() {
-		// First of all, push a context
-		egsl_push();
-
-			// Allocates a matrix
-			val m1 = egsl_zeros(10, 10);
-		
-			// Print it
-			egsl_print("Your first matrix:", m1);
-		
-		egsl_pop();
-		
-		// Wrong: you can't use m1 after egsl_pop()
-		// egsl_print("Your first matrix:", m1);
-	}
-
-<subsubsection number=no>Promotion of `val`s to previous contexts</subsubsection>
-
-If you want to make a matrix valid also for the previous context, 
-you may use the `egsl_promote(val)` function.
-
-	#include <egsl.h>
-	
-	int main() {
-		// First of all, push a context
-		egsl_push();
-		
-			// push another
-			egsl_push();
-			
-				// Allocates a matrix
-				val m1 = egsl_zeros(10, 10);
-	
-				val m2 = egsl_promote(m1);
-			
-			egsl_pop();
-	
-		// ok, m2 is valid
-		egsl_print("m2 is valid here", m2);
-		// error: m1 is not valid here
-		// egsl_print("m1 is not valid here!", m1);
-		
-		
-		egsl_pop();
-	}
-
-<subsubsection number=no>Useful macros</subsubsection>
-
-If you use the include 
-
-	#include <egsl_macros.h>
-
-you can use a number of short macros instead of the long-named functions
-`egsl_*`. Most of these macros are inspired by Matlab syntax.
-
-For example, consider this line of Matlab code (taken from an actual program):
-
-	a = -2 * C_k * v_j1 +  2 * dC_drho_j1 * v2'
-
-Translated into EGSL, with macros defined in `<egsl_macros.h>`, it turns
-into:
-
-	val a = sum(sc(-2,m(C_k,v_j1)), sc(2,m(dC_drho_j1,tr(v2))));
-
-where
-
-* `sum(A, B)` is equivalent to `A + B`
-* `sc(a, B)` is scalar--matrix multiplication: `a * B`
-* `m(A, B)` is matrix--matrix multiplication; `A + B`
-
-This is the best that we can do without operator overloading. 
-
-Notice that for evaluating this expression `EGSL` needs a lot of 
-intermediate matrices, and it's managing all memory allocations for you.
-How many `egsl_matrix_alloc` would you need to write the same code in `GSL`?
-
-<subsection number=no>Library reference</subsection>
-
-This is a summary of available operations. It is shown both the
-extended function name (beginning with `egsl_`) and the macro
-defined in `<egsl_macros.h>`
-
-<subsubsection number=no>Allocation of matrices</subsubsection>
-
-* `zeros(rows, cols)` (`egsl_zeros`): Allocates a matrix with all zeros.
-* `ones(rows, cols)` (`egsl_ones`): Allocates a matrix with all zeros.
-
-<subsubsection number=no>Operation with matrices</subsubsection>
-
-All this functions return a new `val`:
-
-* `sum(A, B)` (`egsl_sum`):  Sums two matrices.
-* `sc(a, B)` (`egsl_scale`): Represents scalar--matrix multiplication: `a * B`
-* `m(A, B)` (`egsl_mult`): Represents matrix--matrix multiplication; `A * B`
-* `inv(A)` (`egsl_inverse`): Returns the inverse of `A`.
-
-<subsubsection number=no>Accessing matrix elements</subsubsection>
-
-* `egsl_glsm(v)` will return you the underlying `gsl_matrix` for `v`. 
-	For example:
-
-		val v = egsl_zeros(10,10);
-		gsl_matrix* m = egsl_gslm(v);
-		// now do whatever you want with m
-
-
-<subsubsection number=no>Eigenvalues and eigenvectors</subsubsection>
-
-<subsubsection number=no>Conversions</subsubsection>
-
-<subsubsection number=no>Printing</subsubsection>
-
-
-
-
-
-
diff --git a/sm/lib/egsl/docs/footer.html_frag b/sm/lib/egsl/docs/footer.html_frag
deleted file mode 100644
index c20b863dce6b2ae114190b6945cd0d28c9e06d5e..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/docs/footer.html_frag
+++ /dev/null
@@ -1,2 +0,0 @@
-
-</body></html>
\ No newline at end of file
diff --git a/sm/lib/egsl/docs/header.html_frag b/sm/lib/egsl/docs/header.html_frag
deleted file mode 100644
index 07a541bc5315a8f89cbce3004f7e1eefb6969ca4..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/docs/header.html_frag
+++ /dev/null
@@ -1,33 +0,0 @@
-<html>
-<head>
-	<title>Easy GSL</title>
-	<style type="text/css">
-		body * {
-			max-width:  35em;
-		}
-		body {
-			padding-left:  3cm;
-		}
-		h1 { margin-left:  -1cm;}
-		h2 { 
-			margin-left:  -1cm; margin-top: +1em; 	
-			}
-		h3 { margin-left:  -0.5cm;}
-		
-		/* Colors */
-		body { font-family:  Georgia, serif; 
-			background-color:  white;
-			color: #333;} 
-		h1, h2 { color: darkblue;}
-		h3 { color:  #333; }
-		pre {
-			margin-left:  +1em;
-			padding:  +5px;
-			background-color:  #eee;
-			color:  #00e;
-		}
-	</style>
- 	<link rel="stylesheet" type="text/css" href="style.css" />
-</head>
-<body>
-	
\ No newline at end of file
diff --git a/sm/lib/egsl/docs/htmlsection b/sm/lib/egsl/docs/htmlsection
deleted file mode 100755
index 9928096dfc64940833b0b5507998721fdc72a82f..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/docs/htmlsection
+++ /dev/null
@@ -1,1022 +0,0 @@
-#!/usr/bin/perl
-
-# htmlsection-1.0
-# 
-# htmlsection - insert section number in HTML and make the table of contents.
-# 
-# * Insert section number in HTML and make links to the section.
-# * Make the table of contents.
-# * Insert table, figure, and program-list number and make links.
-# * Make the index of tables, figures, and program-lists.
-# * Insert reference number and make links.
-# 
-# htmlsection Copyright (C) 2001 SAKAI Hiroaki.
-# All Rights Reserved.
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-# 
-# SYNOPSIS
-# 
-#     htmlsection [-options] [files ...]
-# 
-# DESCRIPTION
-# 
-# htmlsection is a perl script to insert section number in HTML. When you use
-# htmlsection, you don't have to manage section, table, figure, program-list,
-# and reference numbers and you don't have to make the table of contents,
-# table index, figure index, and program-list index.
-# 
-# If files are specified, htmlsection reads HTML from these files. But, if
-# files are not specified, htmlsection reads HTML from standard input.
-# 
-# EXAMPLES
-# 
-# * Insert section number in HTML and make links to the section.
-# 
-# htmlsection changes <section></section> tag to <h1></h1> tag and section
-# number. You can use tag <section>, <subsection>, ..., and
-# <subsubsubsubsubsection>.
-# If name option is specified, htmlsection changes <sectionref> tag to the
-# number and title of the section and make link to the section.
-# If you want not to use number, use number option as <section number=no>.
-# 
-# Example:
-# 
-# For example, make the file example.html as below,
-# -------- begin of example --------
-# <section name="intro" number=no>Introduction</section>
-# 
-#     This is introduction.
-# 
-# <section name="howto">How to use htmlsection</section>
-# 
-# <subsection name="howtouse">Let's use htmlsection!</subsection>
-# 
-#     If you want to know about htmlsection, see
-# <sectionref name="howto">, and
-# <subsectionref name="howtouse" title=no>.
-# 
-# <section number=no>Ending</section>
-# -------- end of example --------
-# 
-# And execute, 
-# > cat example.html | htmlsection
-# htmlsection will output as,
-# -------- begin of example --------
-# <spacer type=vertical size=70>
-# <h1><a name="section_intro">Introduction</a></h1>
-# <spacer type=vertical size=30>
-# 
-#     This is introduction.
-# 
-# <spacer type=vertical size=70>
-# <h1><a name="section_howto">1 How to use htmlsection</a></h1>
-# <spacer type=vertical size=30>
-# 
-# <spacer type=vertical size=50>
-# <h2><a name="subsection_howtouse">1.1 Let's use htmlsection!</a></h2>
-# <spacer type=vertical size=25>
-# 
-#     If you want to know about htmlsection, see
-# <a href="#section_howto">1 How to use htmlsection</a>, and
-# <a href="#subsection_howtouse">1.1</a>.
-# 
-# <spacer type=vertical size=70>
-# <h1><a name="section_toc2">Ending</a></h1>
-# <spacer type=vertical size=30>
-# -------- end of example --------
-# 
-# * Make the table of contents.
-# 
-# htmlsection inserts the table of contents at
-# <tableofcontents></tableofcontents> tag.
-# 
-# * Insert table, figure, and program-list number and make links.
-# 
-# htmlsection inserts the number at <tablereference> tag.
-# 
-# Example:
-# 
-# Before convertion
-# -------- begin of example --------
-# <center>
-# <tablereference name="sample_table">Sample Table</tablereference>
-# <table border=1>
-# <tr><td align=center>name</td><td align=center>function</td></tr>
-# <tr><td>printf</td><td>print strings by a format.</td></tr>
-# </table>
-# </center>
-# 
-# <p>
-# <center>
-# <img src="picture/sample.jpg">
-# <br>
-# <figurereference name="sample_figure">Sample Figure</figurereference>
-# </center>
-# 
-# <p>
-# <pre>
-# <listreference name="sample_list">Sample List</listreference>
-# 
-# int main()
-# {
-#   int i;
-#   for (i = 0; i < 10; i++)
-#     printf("%d\n", i);
-#   exit (0);
-# }
-# </pre>
-# 
-# <p>
-# See <tableref name="sample_table">.
-# See <figureref name="sample_figure">.
-# See <listref name="sample_list">.
-# -------- end of example --------
-# 
-# After convertion by htmlsection
-# -------- begin of example --------
-# <center>
-# <a name="tbl_sample_table">table1: Sample Table</a>
-# <table border=1>
-# <tr><td align=center>name</td><td align=center>function</td></tr>
-# <tr><td>printf</td><td>print strings by a format.</td></tr>
-# </table>
-# </center>
-# 
-# <p>
-# <center>
-# <img src="picture/sample.jpg">
-# <br>
-# <a name="fig_sample_figure">figure1: Sample Figure</a>
-# </center>
-# 
-# <p>
-# <pre>
-# <a name="lst_sample_list">list1: Sample List</a>
-# 
-# int main()
-# {
-#   int i;
-#   for (i = 0; i < 10; i++)
-#     printf("%d\n", i);
-#   exit (0);
-# }
-# </pre>
-# 
-# <p>
-# See <a href="#tbl_sample_table">table1</a>.
-# See <a href="#fig_sample_figure">figure1</a>.
-# See <a href="#lst_sample_list">list1</a>.
-# -------- end of example --------
-# 
-# * Make the index of tables, figures, and program-lists.
-# 
-# htmlsection inserts the index of table, figure, and list at
-# <tableindex></tableindex>, <figureindex></figureindex>, and
-# <listindex></listindex> tag.
-# 
-# * Insert reference number and make links.
-# 
-# htmlsention makes reference table.
-# 
-# Example:
-# 
-# Before convertion
-# -------- begin of example --------
-# See <ref name="KandR2">.
-# 
-# <references>
-# <reference name="KandR">Brian W. Kernighan and Dennis M. Ritchie,
-# "The C Programming Language", Prentice-Hall, 1978.
-# <reference name="KandR2">Brian W. Kernighan and Dennis M. Ritchie,
-# "The C Programming Language", Second Edition, Prentice Hall, 1988.
-# <reference name="NumericalRecipe">William H. Press, Saul A. Teukolsky,
-# William T. Vetterling, and Brian P.Flannery,
-# "Numerical Recipes in C", Second Edition, Cambridge University Press, 1992.
-# </references>
-# -------- end of example --------
-# 
-# After convertion by htmlsection
-# -------- begin of example --------
-# See <a href="#ref_KandR2">[2]</a>.
-# 
-# <ul>
-# <li><a name="ref_KandR">[1]</a>Brian W. Kernighan and Dennis M. Ritchie,
-# "The C Programming Language", Prentice-Hall, 1978.
-# <li><a name="ref_KandR2">[2]</a>Brian W. Kernighan and Dennis M. Ritchie,
-# "The C Programming Language", Second Edition, Prentice Hall, 1988.
-# <li><a name="ref_NumericalRecipe">[3]</a>William H. Press, Saul A. Teukolsky,
-# William T. Vetterling, and Brian P.Flannery,
-# "Numerical Recipes in C", Second Edition, Cambridge University Press, 1992.
-# </ul>
-# -------- end of example --------
-# 
-# OPTIONS
-# 
-# The following options are available:
-# 
-# -h, -help
-#     Output help messages.
-# 
-# -max-depth [depth]
-#     Specify the max depth of subsection of section tag. If you specify
-#     -max-depth 10, you can use <subsubsubsubsubsubsubsubsubsection> tag.
-# 
-# -spacer
-#     Spacing <section>, <subsection> and <subsubsection> tag.
-# 
-# -no-spacer
-#     No spacing.
-# 
-# -english, -japanese
-#     Specify the language. If you don't specify these options, htmlsection
-#     sees environment variable LANG.
-# 
-# -start-section [section]
-#     Specify the section number at start. For example, if you specify
-#     -start-section 3.5.6, htmlsection sets the section number to it at start.
-# 
-# -toc-section [section]
-#     Specify the section depth to make the table of contents. If you
-#     specify -toc-section 2, htmlsection makes the table of contents
-#     by section and subsection only.
-# 
-# -table-section [section]
-#     Specify the section number at beginning of table number.
-#     If you specify -table-section 2, format of table number is
-#     [section_number].[subsection_number].[table_number].
-#     If you specify -table-section 0, format of table number is
-#     [table_number] only.
-# 
-# -figure-section [section], -list-section [section]
-#     Same as -table-section option.
-# 
-# -start-table [number]
-#     Specify the table number at start.
-# 
-# -start-figure [number], -start-list [number], -start-ref [number]
-#     Same as -start-table option.
-# 
-# -toc-file [filename]
-#     If you specify -toc-file, output the table of contents to the file.
-# 
-# -table-file [filename]
-#     If you specify -table-file, output the table index to the file.
-# 
-# -figure-file [filename], -list-file [filename]
-#     Same as -table-file option.
-# 
-# -o [filename]
-#     Specify the output file. If you don't specify the filename, htmlsection
-#     outputs HTML to the standard output.
-# 
-# ENVIRONMENT VARIABLES
-# 
-#     LANG
-#     Specify the language.
-# 
-# TAGS
-# 
-#     <section>Title</section>, <subsection>Title</subsection>, ...
-#         options:
-#         name="section_name"
-#         number=yes or no
-# 
-#     <sectionref>, <subsectionref>, ...
-#         options:
-#         name="section_name"
-#         title=yes or no
-# 
-#     <tablereference>Title</tablereference>
-#         options:
-#         name="table_name"
-#         number=yes or no
-# 
-#     <figurereference>Title</figurereference>
-#         options:
-#         name="figure_name"
-#         number=yes or no
-# 
-#     <listreference>Title</listreference>
-#         options:
-#         name="list_name"
-#         number=yes or no
-# 
-#     <tableref>Title</tableref>
-#         options:
-#         name="table_name"
-#         title=yes or no
-# 
-#     <figureref>Title</figureref>
-#         options:
-#         name="figure_name"
-#         title=yes or no
-# 
-#     <listref>Title</listref>
-#         options:
-#         name="list_name"
-#         title=yes or no
-# 
-#     <references></references>
-# 
-#     <reference>
-#         options:
-#         name="reference_name"
-# 
-#     <ref>
-#         options:
-#         name="reference_name"
-#         title=yes or no
-#     
-#     <tableofcontents></tableofcontents>
-#     <tableindex></tableindex>
-#     <figureindex></figureindex>
-#     <listindex></listindex>
-# 
-# SEE ALSO
-# 
-#     perl(1)
-# 
-#     If you want to see more detail information, See,
-#         Comments at the head of htmlsection script.
-#         /usr/local/share/doc/htmlsection - Documents.
-#         /usr/local/share/doc/htmlsection/README - Readme file.
-#         /usr/local/share/doc/htmlsection/htmlsection.html
-#             - Sample HTML file and description about htmlsection.
-#         http://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/htmlsection.html
-# 
-# AUTHOR
-# 
-#     Programmed by SAKAI Hiroaki.
-#     E-Mail: sakai@seki.ee.kagu.sut.ac.jp, hsakai@m8.people.or.jp,
-#             hsakai@pfu.fujitsu.com
-#     Web site:
-#     http://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/index.html
-#     Mirror site:
-#     http://hp.vector.co.jp/authors/VA014157/myfreesoft/index.html
-#     http://www.people.or.jp/~hsakai/myfreesoft/index.html
-# 
-
-#use IO::Handle;
-
-$help_message = "
-htmlsection-1.0
-
-\thtmlsection [-options] [files ...]
-
-htmlsection is a perl script to insert section number in HTML. When you use
-htmlsection, you don't have to manage section, table, figure, program-list,
-and reference numbers and you don't have to make the table of contents,
-table index, figure index, and program-list index.
-
-* Insert section number in HTML and make links to the section.
-* Make the table of contents.
-* Insert table, figure, and program-list number and make links.
-* Make the index of tables, figures, and program-lists.
-* Insert reference number and make links.
-
-If you want to see more detail information, See htmlsection(1),
-documents in /usr/local/share/doc/htmlsection, and comments
-at the head of htmlsection script. And see,
-
-\thttp://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/htmlsection.html
-
-htmlsection Copyright (C) 2001 SAKAI Hiroaki.
-All Rights Reserved.
-
-";
-
-$max_depth = 6;
-$spacer = 1;
-@prev_space = (70, 50, 30);
-@next_space = (30, 25, 20);
-
-for ($i = 0; $i < $max_depth; $i++) {
-	$section[$i] = 0;
-}
-
-# This is for temporary files. But, temporary files are not used.
-# 
-# -tmpdir [directry]
-#     Specify the directry to make temporary file. If you don't specify
-#     -tmpdir option, environment variable TMPDIR will be used.
-# 
-#     TMPDIR
-#     Directry to make the temporary file. If you don't specify environment
-#     variable TMPDIR and -tmpdir option, /tmp will be used.
-# 
-#$tmpdir = $ENV{"TMPDIR"};
-#if ($tmpdir eq "") { $tmpdir = "/tmp"; }
-
-$lang = $ENV{"LANG"};
-if (($lang eq "ja_JP.EUC") || ($lang eq "japanese")) {
-	$lang = "japanese";
-} else {
-	$lang = "english";
-}
-
-$table_section_num  = 1;
-$figure_section_num = 1;
-$list_section_num   = 1;
-$tablenum  = 0;
-$figurenum = 0;
-$listnum   = 0;
-$refnum = 0;
-$toc_filename    = "";
-$table_filename  = "";
-$figure_filename = "";
-$list_filename   = "";
-$output_filename = "";
-
-$toc_section = 4;
-
-while ($_ = shift(@ARGV)) {
-
-	if (($_ eq "-h") || ($_ eq "-help")) {
-		print "$help_message";
-		exit (0);
-	}
-
-	elsif ($_ eq "-max-depth") { $max_depth = shift(@ARGV); }
-	elsif ($_ eq "-spacer") { $spacer = 1; }
-	elsif ($_ eq "-no-spacer") { $spacer = 0; }
-	elsif ($_ eq "-english" ) { $lang = "english"; }
-	elsif ($_ eq "-japanese") { $lang = "japanese"; }
-	elsif ($_ eq "-start-section") {
-		$sec = shift(@ARGV);
-		for ($i = 0; $i < $max_depth; $i++) {
-			($n) = $sec =~ /^(\d*)/;
-			$sec =~ s/^(\d*)(\D*)//;
-			if ($n ne "") { $section[$i] = $n; }
-		}
-	}
-	elsif ($_ eq "-toc-section"   ) { $toc_section        = shift(@ARGV); }
-	elsif ($_ eq "-table-section" ) { $table_section_num  = shift(@ARGV); }
-	elsif ($_ eq "-figure-section") { $figure_section_num = shift(@ARGV); }
-	elsif ($_ eq "-list-section"  ) { $list_section_num   = shift(@ARGV); }
-	elsif ($_ eq "-start-table" ) { $tablenum  = shift(@ARGV); }
-	elsif ($_ eq "-start-figure") { $figurenum = shift(@ARGV); }
-	elsif ($_ eq "-start-list"  ) { $listnum   = shift(@ARGV); }
-	elsif ($_ eq "-start-ref"   ) { $refnum    = shift(@ARGV); }
-	elsif ($_ eq "-toc-file"    ) { $toc_filename    = shift(@ARGV); }
-	elsif ($_ eq "-table-file"  ) { $table_filename  = shift(@ARGV); }
-	elsif ($_ eq "-figure-file" ) { $figure_filename = shift(@ARGV); }
-	elsif ($_ eq "-list-file"   ) { $list_filename   = shift(@ARGV); }
-	elsif ($_ eq "-o"           ) { $output_filename = shift(@ARGV); }
-# This is for temporary files. But, temporary files are not used.
-#	elsif ($_ eq "-tmpdir") { $tmpdir = shift(@ARGV); }
-}
-
-# This is for temporary files. But, temporary files are not used.
-##system ("rm -f $tmpdir/htmlsection.tmp.*");
-#$r = rand();
-#($filename) = $r =~ /(........)$/;
-#$filename = "$tmpdir/htmlsection.tmp.$filename";
-
-if ($lang eq "japanese") {
-	$table_string = "É―";
-	$figure_string = "ŋÞ";
-	$list_string = "ĨęĨđĨČ";
-	$reference_string = "ĘļļĨ";
-	$toc_string = "ĖÜžĄ";
-	$table_index_string = "É―ĖÜžĄ";
-	$figure_index_string = "ŋÞĖÜžĄ";
-	$list_index_string = "ĨęĨđĨČĖÜžĄ";
-	$references_string = "ŧēđÍĘļļĨ";
-} else {
-	$table_string = "table";
-	$figure_string = "figure";
-	$list_string = "list";
-	$reference_string = "Reference";
-	$toc_string = "Table of Contents";
-	$table_index_string = "Table Index";
-	$figure_index_string = "Figure Index";
-	$list_index_string = "List Index";
-	$references_string = "References";
-}
-
-@table_toc  = ();
-@figure_toc = ();
-@list_toc   = ();
-
-# This is for temporary files. But, temporary files are not used.
-#$filename_num = 0;
-#$filename_num++;
-#open (WFILE, "> $filename.$filename_num");
-
-# This is for debug
-#WFILE->autoflush(1);
-
-$no_space = 0;
-$toc_num = 0;
-$table_num = 0;
-$figure_num = 0;
-$list_num = 0;
-$ref_num = 0;
-$toc = "";
-$depth = 0;
-$line = 0;
-@lines = ();
-
-while(<>) {
-	$line++;
-	$prev = "";
-	$next = "";
-
-	$sec_flag = 0;
-
-	if (/section/i) {
-		for ($i = 0; $i < $max_depth; $i++) {
-			$sub = "sub" x $i;
-			$sec = $sub . "section";
-			while (($tag) = /(<$sec[^>]*?>.*?<\/$sec[^>]*?>)/i) {
-				$sec_flag = 1;
-#				if (($i > $depth) && ($i - $depth > 1)) {
-#					die "line$line: invalid section.\n";
-#				}
-
-				($title) = $tag =~ /<$sec[^>]*?>(.*?)<\/$sec[^>]*?>/i;
-				($n) = $tag =~ /<$sec[^>]*?number\s*=\s*([^\s>]*)[\s>]/i;
-				if ($n =~ /\".*\"/) { ($n) = $n =~ /\"(.*)\"/; }
-				$number_flag = 1;
-				if    ($n =~ /^yes$/i) { $number_flag = 1; }
-				elsif ($n =~ /^on$/i ) { $number_flag = 1; }
-				elsif ($n =~ /^no$/i ) { $number_flag = 0; }
-				elsif ($n =~ /^off$/i) { $number_flag = 0; }
-
-				if ($number_flag) {
-					$section[$i]++;
-					for ($j = $i+1; $j < $max_depth; $j++) {
-						$section[$j] = 0;
-					}
-
-					$t = "";
-					for ($j = 0; $j <= $i; $j++) {
-						$t = "$t$section[$j]";
-						if ($j < $i) {
-							$t = "$t.";
-						}
-					}
-					$title = "$t $title";
-				} else {
-					$toc_num++;
-					$t = "toc$toc_num";
-				}
-
-				($name) = $tag =~ /<$sec[^>]*?name\s*=\s*([^\s>]*)[\s>]/i;
-				if ($name =~ /\".*\"/) { ($name) = $name =~ /\"(.*)\"/; }
-				$name =~ s/\//\_/g;
-				if ($name eq "") { $name = "$t"; }
-				$name = "$sec\_$name";
-				if ($sectionref[$i]{$name} ne "") {
-					die "line$line: duplicate section name: $name\n";
-				}
-				$sectionref[$i]{$name} = $t;
-				$sectionref_title[$i]{$name} = $title;
-				$t = "<a name=\"$name\">$title</a>";
-				$n = $i+1;
-				unless (s/\Q$tag/<h$n>$t<\/h$n>/i) {
-					die "line$line: fail to parse: $_\n";
-				}
-
-				if ($n <= $toc_section) {
-					if ($n > $depth) {
-						$toc = $toc . "<ul compact>\n" x ($n - $depth);
-					} elsif ($n < $depth) {
-						$toc = $toc . "</ul>\n" x ($depth - $n);
-					}
-					$toc = $toc . "<li><a href=\"#$name\">$title</a></li>\n";
-					$depth = $n;
-
-				}
-
-				if ($n <= $table_section_num ) { $tablenum  = 0; }
-				if ($n <= $figure_section_num) { $figurenum = 0; }
-				if ($n <= $list_section_num  ) { $listnum   = 0; }
-
-				if (($prev_space[$i] != 0) && ($no_space == 0)) {
-					$prev = "<spacer type=vertical size=$prev_space[$i]>\n";
-				}
-				if ($next_space[$i] != 0) {
-					$next = "<spacer type=vertical size=$next_space[$i]>\n";
-					$no_space = 1;
-				}
-			}
-		}
-	}
-
-	if ($sec_flag == 0) {
-		unless (/^\s*$/) {
-			$no_space = 0;
-		}
-	}
-
-	while (($tag) = /(<tablereference[^>]*?>.*?<\/tablereference[^>]*?>)/i) {
-		($title) = $tag =~ /<tablereference[^>]*?>(.*?)<\/tablereference[^>]*?>/i;
-		($num) = $tag =~ /<tablereference[^>]*?number\s*=\s*([^\s>]*)[\s>]/i;
-		if ($num =~ /\".*\"/) { ($num) = $num =~ /\"(.*)\"/; }
-		$number_flag = 1;
-		if    ($num =~ /^yes$/i) { $number_flag = 1; }
-		elsif ($num =~ /^on$/i ) { $number_flag = 1; }
-		elsif ($num =~ /^no$/i ) { $number_flag = 0; }
-		elsif ($num =~ /^off$/i) { $number_flag = 0; }
-		($name) = $tag =~ /<tablereference[^>]*?name\s*=\s*([^\s>]*)[\s>]/i;
-		if ($name =~ /\".*\"/) { ($name) = $name =~ /\"(.*)\"/; }
-		$name =~ s/\//\_/g;
-		if ($number_flag) {
-			$tablenum++;
-			$r = "";
-			for ($i = 0; $i < $table_section_num; $i++) {
-				if ($section[$i] < 1) { last; }
-				$r = "$r$section[$i].";
-			}
-			$r = "$r$tablenum";
-			if ($name eq "") { $name = "$r"; }
-		} else {
-			$table_num++;
-			$r = "";
-			if ($name eq "") { $name = "num$table_num"; }
-		}
-		$name = "tbl_$name";
-		$r = "$table_string$r";
-		$ref = "$r: $title";
-		if ($tableref{$name} ne "") {
-			die "line$line: duplicate table name: $name\n";
-		}
-		$tableref{$name} = $r;
-		$tableref_title{$name} = $ref;
-		$t = "<li><a href=\"#$name\">$ref</a>\n";
-		push(@table_toc, $t);
-		unless (s/\Q$tag/<a name=\"$name\">$ref<\/a>/i) {
-			die "line$line: fail to parse: $_\n";
-		}
-	}
-
-	while (($tag) = /(<figurereference[^>]*?>.*?<\/figurereference[^>]*?>)/i) {
-		($title) = $tag =~ /<figurereference[^>]*?>(.*?)<\/figurereference[^>]*?>/i;
-		($num) = $tag =~ /<figurereference[^>]*?number\s*=\s*([^\s>]*)[\s>]/i;
-		if ($num =~ /\".*\"/) { ($num) = $num =~ /\"(.*)\"/; }
-		$number_flag = 1;
-		if    ($num =~ /^yes$/i) { $number_flag = 1; }
-		elsif ($num =~ /^on$/i ) { $number_flag = 1; }
-		elsif ($num =~ /^no$/i ) { $number_flag = 0; }
-		elsif ($num =~ /^off$/i) { $number_flag = 0; }
-		($name) = $tag =~ /<figurereference[^>]*?name\s*=\s*([^\s>]*)[\s>]/i;
-		if ($name =~ /\".*\"/) { ($name) = $name =~ /\"(.*)\"/; }
-		$name =~ s/\//\_/g;
-		if ($number_flag) {
-			$figurenum++;
-			$r = "";
-			for ($i = 0; $i < $figure_section_num; $i++) {
-				if ($section[$i] < 1) { last; }
-				$r = "$r$section[$i].";
-			}
-			$r = "$r$figurenum";
-			if ($name eq "") { $name = "$r"; }
-		} else {
-			$figure_num++;
-			$r = "";
-			if ($name eq "") { $name = "num$figure_num"; }
-		}
-		$name = "fig_$name";
-		$r = "$figure_string$r";
-		$ref = "$r: $title";
-		if ($figureref{$name} ne "") {
-			die "line$line: duplicate figure name: $name\n";
-		}
-		$figureref{$name} = $r;
-		$figureref_title{$name} = $ref;
-		$t = "<li><a href=\"#$name\">$ref</a>\n";
-		push(@figure_toc, $t);
-		unless (s/\Q$tag/<a name=\"$name\">$ref<\/a>/i) {
-			die "line$line: fail to parse: $_\n";
-		}
-	}
-
-	while (($tag) = /(<listreference[^>]*?>.*?<\/listreference[^>]*?>)/i) {
-		($title) = $tag =~ /<listreference[^>]*?>(.*?)<\/listreference[^>]*?>/i;
-		($num) = $tag =~ /<listreference[^>]*?number\s*=\s*([^\s>]*)[\s>]/i;
-		if ($num =~ /\".*\"/) { ($num) = $num =~ /\"(.*)\"/; }
-		$number_flag = 1;
-		if    ($num =~ /^yes$/i) { $number_flag = 1; }
-		elsif ($num =~ /^on$/i ) { $number_flag = 1; }
-		elsif ($num =~ /^no$/i ) { $number_flag = 0; }
-		elsif ($num =~ /^off$/i) { $number_flag = 0; }
-		($name) = $tag =~ /<listreference[^>]*?name\s*=\s*([^\s>]*)[\s>]/i;
-		if ($name =~ /\".*\"/) { ($name) = $name =~ /\"(.*)\"/; }
-		$name =~ s/\//\_/g;
-		if ($number_flag) {
-			$listnum++;
-			$r = "";
-			for ($i = 0; $i < $list_section_num; $i++) {
-				if ($section[$i] < 1) { last; }
-				$r = "$r$section[$i].";
-			}
-			$r = "$r$listnum";
-			if ($name eq "") { $name = "$r"; }
-		} else {
-			$list_num++;
-			$r = "";
-			if ($name eq "") { $name = "num$list_num"; }
-		}
-		$name = "lst_$name";
-		$r = "$list_string$r";
-		$ref = "$r: $title";
-		if ($listref{$name} ne "") {
-			die "line$line: duplicate list name: $name\n";
-		}
-		$listref{$name} = $r;
-		$listref_title{$name} = $ref;
-		$t = "<li><a href=\"#$name\">$ref</a>\n";
-		push(@list_toc, $t);
-		unless (s/\Q$tag/<a name=\"$name\">$ref<\/a>/i) {
-			die "line$line: fail to parse: $_\n";
-		}
-	}
-
-	if (($spacer) && ($prev ne "")) {
-# This is for temporary files. But, temporary files are not used.
-#		print WFILE $prev;
-		push(@lines, $prev);
-	}
-# This is for temporary files. But, temporary files are not used.
-#	print WFILE $_;
-	push(@lines, $_);
-	if (($spacer) && ($next ne "")) {
-# This is for temporary files. But, temporary files are not used.
-#		print WFILE $next;
-		push(@lines, $next);
-	}
-}
-
-$toc = $toc . "</ul>\n" x ($depth);
-
-# This is for temporary files. But, temporary files are not used.
-#close (WFILE);
-#open (RFILE, "< $filename.$filename_num");
-#$filename_num++;
-#open (WFILE, "> $filename.$filename_num");
-
-$line = 0;
-@lines2 = ();
-
-# This is for temporary files. But, temporary files are not used.
-#while (<RFILE>)
-while ($_ = shift(@lines))
-{
-	$line++;
-
-	if (/sectionref/i) {
-		for ($i = 0; $i < $max_depth; $i++) {
-			$sub = "sub" x $i;
-			$sec = $sub . "sectionref";
-
-			while (($tag) = /(<$sec[^>]*?>)/i) {
-				($t) = $tag =~ /<$sec[^>]*?title\s*=\s*([^\s>]*)[\s>]/i;
-				if ($t =~ /\".*\"/) { ($t) = $t =~ /\"(.*)\"/; }
-				($n) = $tag =~ /<$sec[^>]*?name\s*=\s*([^\s>]*)[\s>]/i;
-				if ($n =~ /\".*\"/) { ($n) = $n =~ /\"(.*)\"/; }
-				$title_flag = 1;
-				if    ($t =~ /^yes$/i) { $title_flag = 1; }
-				elsif ($t =~ /^on$/i ) { $title_flag = 1; }
-				elsif ($t =~ /^no$/i ) { $title_flag = 0; }
-				elsif ($t =~ /^off$/i) { $title_flag = 0; }
-				$n =~ s/\//\_/g;
-				if ($n eq "") { die "line$line: $_:no name.\n"; }
-				$name = "$sub" . "section\_$n";
-				if ($title_flag) { $ref = $sectionref_title[$i]{$name}; }
-				else { $ref = $sectionref[$i]{$name}; }
-				if ($ref eq "") { die "line$line: $_$n: not found.\n"; }
-				unless (s/\Q$tag/<a href=\"\#$name\">$ref<\/a>/i) {
-					die "line$line: fail to parse: $_\n";
-				}
-			}
-		}
-	}
-
-	while (($tag) = /(<tableref[^>]*?>)/i) {
-		($t) = $tag =~ /<tableref[^>]*?title\s*=\s*([^\s>]*)[\s>]/i;
-		if ($t =~ /\".*\"/) { ($t) = $t =~ /\"(.*)\"/; }
-		($n) = $tag =~ /<tableref[^>]*?name\s*=\s*([^\s>]*)[\s>]/i;
-		if ($n =~ /\".*\"/) { ($n) = $n =~ /\"(.*)\"/; }
-		$title_flag = 0;
-		if    ($t =~ /^yes$/i) { $title_flag = 1; }
-		elsif ($t =~ /^on$/i ) { $title_flag = 1; }
-		elsif ($t =~ /^no$/i ) { $title_flag = 0; }
-		elsif ($t =~ /^off$/i) { $title_flag = 0; }
-		$n =~ s/\//\_/g;
-		if ($n eq "") { die "line$line: $_:no name.\n"; }
-		$name = "tbl_$n";
-		if ($title_flag) { $ref = $tableref_title{$name}; }
-		else { $ref = $tableref{$name}; }
-		if ($ref eq "") { die "line$line: $_$n: not found.\n"; }
-		unless (s/\Q$tag/<a href=\"\#$name\">$ref<\/a>/i) {
-			die "line$line: fail to parse: $_\n";
-		}
-	}
-	while (($tag) = /(<figureref[^>]*?>)/i) {
-		($t) = $tag =~ /<figureref[^>]*?title\s*=\s*([^\s>]*)[\s>]/i;
-		if ($t =~ /\".*\"/) { ($t) = $t =~ /\"(.*)\"/; }
-		($n) = $tag =~ /<figureref[^>]*?name\s*=\s*([^\s>]*)[\s>]/i;
-		if ($n =~ /\".*\"/) { ($n) = $n =~ /\"(.*)\"/; }
-		$title_flag = 0;
-		if    ($t =~ /^yes$/i) { $title_flag = 1; }
-		elsif ($t =~ /^on$/i ) { $title_flag = 1; }
-		elsif ($t =~ /^no$/i ) { $title_flag = 0; }
-		elsif ($t =~ /^off$/i) { $title_flag = 0; }
-		$n =~ s/\//\_/g;
-		if ($n eq "") { die "line$line: $_:no name.\n"; }
-		$name = "fig_$n";
-		if ($title_flag) { $ref = $figureref_title{$name}; }
-		else { $ref = $figureref{$name}; }
-		if ($ref eq "") { die "line$line: $_$n: not found.\n"; }
-		unless (s/\Q$tag/<a href=\"\#$name\">$ref<\/a>/i) {
-			die "line$line: fail to parse: $_\n";
-		}
-	}
-	while (($tag) = /(<listref[^>]*?>)/i) {
-		($t) = $tag =~ /<listref[^>]*?title\s*=\s*([^\s>]*)[\s>]/i;
-		if ($t =~ /\".*\"/) { ($t) = $t =~ /\"(.*)\"/; }
-		($n) = $tag =~ /<listref[^>]*?name\s*=\s*([^\s>]*)[\s>]/i;
-		if ($n =~ /\".*\"/) { ($n) = $n =~ /\"(.*)\"/; }
-		$title_flag = 0;
-		if    ($t =~ /^yes$/i) { $title_flag = 1; }
-		elsif ($t =~ /^on$/i ) { $title_flag = 1; }
-		elsif ($t =~ /^no$/i ) { $title_flag = 0; }
-		elsif ($t =~ /^off$/i) { $title_flag = 0; }
-		$n =~ s/\//\_/g;
-		if ($n eq "") { die "line$line: $_:no name.\n"; }
-		$name = "lst_$n";
-		if ($title_flag) { $ref = $listref_title{$name}; }
-		else { $ref = $listref{$name}; }
-		if ($ref eq "") { die "line$line: $_$n: not found.\n"; }
-		unless (s/\Q$tag/<a href=\"\#$name\">$ref<\/a>/i) {
-			die "line$line: fail to parse: $_\n";
-		}
-	}
-# This is for temporary files. But, temporary files are not used.
-#	print WFILE $_;
-	push(@lines2, $_);
-}
-
-# This is for temporary files. But, temporary files are not used.
-#close (RFILE);
-#close (WFILE);
-#open (RFILE, "< $filename.$filename_num");
-#$filename_num++;
-#open (WFILE, "> $filename.$filename_num");
-
-@lines = ();
-
-# This is for temporary files. But, temporary files are not used.
-#while (<RFILE>)
-while ($_ = shift(@lines2))
-{
-	if (/<references>/i) {
-		s/<references>/<h1>$references_string<\/h1>\n\n<ul>/i;
-		while (!(/<\/references>/i)) {
-			if (($tag) = /(<reference[^>]*?>)/i) {
-				$refnum++;
-				($name) = $tag =~ /<reference[^>]*?name\s*=\s*([^\s>]*)[\s>]/i;
-				if ($name =~ /\".*\"/) { ($name) = $name =~ /\"(.*)\"/; }
-				$name =~ s/\//\_/g;
-				if ($name eq "") { $name = "$refnum"; }
-				$name = "ref_$name";
-				if ($reference{$name} ne "") {
-					die "line$line: duplicate reference name: $name\n";
-				}
-				$reference{$name} = $refnum;
-				unless (s/\Q$tag/<li><a name=\"$name\">\[$refnum\]<\/a>/i) {
-					die "line$line: fail to parse: $_\n";
-				}
-			}
-# This is for temporary files. But, temporary files are not used.
-#			print WFILE $_;
-#			unless ($_ = <RFILE>) { last; }
-			push(@lines, $_);
-			unless ($_ = shift(@lines2)) { last; }
-		}
-		s/<\/references>/<\/ul>/i;
-	}
-# This is for temporary files. But, temporary files are not used.
-#	print WFILE $_;
-	push(@lines, $_);
-}
-
-# This is for temporary files. But, temporary files are not used.
-#close (RFILE);
-#close (WFILE);
-#open (RFILE, "< $filename.$filename_num");
-#$filename_num++;
-#open (WFILE, "> $filename.$filename_num");
-
-$line = 0;
-@lines2 = ();
-
-# This is for temporary files. But, temporary files are not used.
-#while (<RFILE>)
-while ($_ = shift(@lines))
-{
-	$line++;
-	while (($tag) = /(<ref[^>]*?>)/i) {
-		($t) = $tag =~ /<ref[^>]*?title\s*=\s*([^\s>]*)[\s>]/i;
-		if ($t =~ /\".*\"/) { ($t) = $t =~ /\"(.*)\"/; }
-		($n) = $tag =~ /<ref[^>]*?name\s*=\s*([^\s>]*)[\s>]/i;
-		if ($n =~ /\".*\"/) { ($n) = $n =~ /\"(.*)\"/; }
-		$title_flag = 0;
-		if    ($t =~ /^yes$/i) { $title_flag = 1; }
-		elsif ($t =~ /^on$/i ) { $title_flag = 1; }
-		elsif ($t =~ /^no$/i ) { $title_flag = 0; }
-		elsif ($t =~ /^off$/i) { $title_flag = 0; }
-		$n =~ s/\//\_/g;
-		if ($n eq "") { die "line$line: $_:no name.\n"; }
-		$name = "ref_$n";
-		$ref = $reference{$name};
-		if ($ref eq "") { die "line$line: $_$n: not found.\n"; }
-		if ($title_flag) { $ref = "$reference_string\[$ref\]"; }
-		else { $ref = "\[$ref\]"; }
-		unless (s/\Q$tag/<a href=\"\#$name\">$ref<\/a>/i) {
-			die "line$line: fail to parse: $_\n";
-		}
-	}
-# This is for temporary files. But, temporary files are not used.
-#	print WFILE $_;
-	push(@lines2, $_);
-}
-
-# This is for temporary files. But, temporary files are not used.
-#close (RFILE);
-#close (WFILE);
-#open (RFILE, "< $filename.$filename_num");
-
-if ($output_filename ne "") {
-	open (WFILE, "> $output_filename") || die "cannot open: $output_filename\n";
-}
-
-$toc_string = "\n\n$toc";
-#AC $toc_string = "<h1>$toc_string<\/h1>\n\n$toc";
-$table_index_string = "<h1>$table_index_string<\/h1>\n\n<ul>\n@table_toc<\/ul>";
-$figure_index_string = "<h1>$figure_index_string<\/h1>\n\n<ul>\n@figure_toc<\/ul>";
-$list_index_string = "<h1>$list_index_string<\/h1>\n\n<ul>\n@list_toc<\/ul>";
-
-# This is for temporary files. But, temporary files are not used.
-#while (<RFILE>)
-while ($_ = shift(@lines2))
-{
-	if (/<tableofcontents>.*<\/tableofcontents>/i) {
-		s/<tableofcontents>.*?<\/tableofcontents>/$toc_string/i;
-	}
-	if (/<tableindex>.*<\/tableindex>/i) {
-		s/<tableindex>.*?<\/tableindex>/$table_index_string/i;
-	}
-	if (/<figureindex>.*<\/figureindex>/i) {
-		s/<figureindex>.*?<\/figureindex>/$figure_index_string/i;
-	}
-	if (/<listindex>.*<\/listindex>/i) {
-		s/<listindex>.*?<\/listindex>/$list_index_string/i;
-	}
-	if ($output_filename ne "") {
-		print WFILE $_;
-	} else {
-		print $_;
-	}
-}
-
-# This is for temporary files. But, temporary files are not used.
-#close (RFILE);
-
-if ($output_filename ne "") {
-	close (WFILE);
-}
-
-if ($toc_filename ne "") {
-	open (WFILE, "> $toc_filename");
-	print WFILE "$toc_string";
-	close (WFILE);
-}
-if ($table_filename ne "") {
-	open (WFILE, "> $table_filename");
-	print WFILE "$table_index_string";
-	close (WFILE);
-}
-if ($figure_filename ne "") {
-	open (WFILE, "> $figure_filename");
-	print WFILE "$figure_index_string";
-	close (WFILE);
-}
-if ($list_filename ne "") {
-	open (WFILE, "> $list_filename");
-	print WFILE "$list_index_string";
-	close (WFILE);
-}
-
-# This is for temporary files. But, temporary files are not used.
-#system ("rm -f $filename.*");
-
-exit (0);
-
-###############################################################################
-# htmlsection-1.0
diff --git a/sm/lib/egsl/docs/htmlsection.txt b/sm/lib/egsl/docs/htmlsection.txt
deleted file mode 100755
index 0435e84339e445f593a6a6371200a8a919593e58..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/docs/htmlsection.txt
+++ /dev/null
@@ -1,358 +0,0 @@
-
-htmlsection - insert section number in HTML and make the table of contents.
-
-* Insert section number in HTML and make links to the section.
-* Make the table of contents.
-* Insert table, figure, and program-list number and make links.
-* Make the index of tables, figures, and program-lists.
-* Insert reference number and make links.
-
-htmlsection Copyright (C) 2001 SAKAI Hiroaki.
-All Rights Reserved.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-SYNOPSIS
-
-    htmlsection [-options] [files ...]
-
-DESCRIPTION
-
-htmlsection is a perl script to insert section number in HTML. When you use
-htmlsection, you don't have to manage section, table, figure, program-list,
-and reference numbers and you don't have to make the table of contents,
-table index, figure index, and program-list index.
-
-If files are specified, htmlsection reads HTML from these files. But, if
-files are not specified, htmlsection reads HTML from standard input.
-
-EXAMPLES
-
-* Insert section number in HTML and make links to the section.
-
-htmlsection changes <section></section> tag to <h1></h1> tag and section
-number. You can use tag <section>, <subsection>, ..., and
-<subsubsubsubsubsection>.
-If name option is specified, htmlsection changes <sectionref> tag to the
-number and title of the section and make link to the section.
-If you want not to use number, use number option as <section number=no>.
-
-Example:
-
-For example, make the file example.html as below,
--------- begin of example --------
-<section name="intro" number=no>Introduction</section>
-
-    This is introduction.
-
-<section name="howto">How to use htmlsection</section>
-
-<subsection name="howtouse">Let's use htmlsection!</subsection>
-
-    If you want to know about htmlsection, see
-<sectionref name="howto">, and
-<subsectionref name="howtouse" title=no>.
-
-<section number=no>Ending</section>
--------- end of example --------
-
-And execute, 
-> cat example.html | htmlsection
-htmlsection will output as,
--------- begin of example --------
-<spacer type=vertical size=70>
-<h1><a name="section_intro">Introduction</a></h1>
-<spacer type=vertical size=30>
-
-    This is introduction.
-
-<spacer type=vertical size=70>
-<h1><a name="section_howto">1 How to use htmlsection</a></h1>
-<spacer type=vertical size=30>
-
-<spacer type=vertical size=50>
-<h2><a name="subsection_howtouse">1.1 Let's use htmlsection!</a></h2>
-<spacer type=vertical size=25>
-
-    If you want to know about htmlsection, see
-<a href="#section_howto">1 How to use htmlsection</a>, and
-<a href="#subsection_howtouse">1.1</a>.
-
-<spacer type=vertical size=70>
-<h1><a name="section_toc2">Ending</a></h1>
-<spacer type=vertical size=30>
--------- end of example --------
-
-* Make the table of contents.
-
-htmlsection inserts the table of contents at
-<tableofcontents></tableofcontents> tag.
-
-* Insert table, figure, and program-list number and make links.
-
-htmlsection inserts the number at <tablereference> tag.
-
-Example:
-
-Before convertion
--------- begin of example --------
-<center>
-<tablereference name="sample_table">Sample Table</tablereference>
-<table border=1>
-<tr><td align=center>name</td><td align=center>function</td></tr>
-<tr><td>printf</td><td>print strings by a format.</td></tr>
-</table>
-</center>
-
-<p>
-<center>
-<img src="picture/sample.jpg">
-<br>
-<figurereference name="sample_figure">Sample Figure</figurereference>
-</center>
-
-<p>
-<pre>
-<listreference name="sample_list">Sample List</listreference>
-
-int main()
-{
-  int i;
-  for (i = 0; i < 10; i++)
-    printf("%d\n", i);
-  exit (0);
-}
-</pre>
-
-<p>
-See <tableref name="sample_table">.
-See <figureref name="sample_figure">.
-See <listref name="sample_list">.
--------- end of example --------
-
-After convertion by htmlsection
--------- begin of example --------
-<center>
-<a name="tbl_sample_table">table1: Sample Table</a>
-<table border=1>
-<tr><td align=center>name</td><td align=center>function</td></tr>
-<tr><td>printf</td><td>print strings by a format.</td></tr>
-</table>
-</center>
-
-<p>
-<center>
-<img src="picture/sample.jpg">
-<br>
-<a name="fig_sample_figure">figure1: Sample Figure</a>
-</center>
-
-<p>
-<pre>
-<a name="lst_sample_list">list1: Sample List</a>
-
-int main()
-{
-  int i;
-  for (i = 0; i < 10; i++)
-    printf("%d\n", i);
-  exit (0);
-}
-</pre>
-
-<p>
-See <a href="#tbl_sample_table">table1</a>.
-See <a href="#fig_sample_figure">figure1</a>.
-See <a href="#lst_sample_list">list1</a>.
--------- end of example --------
-
-* Make the index of tables, figures, and program-lists.
-
-htmlsection inserts the index of table, figure, and list at
-<tableindex></tableindex>, <figureindex></figureindex>, and
-<listindex></listindex> tag.
-
-* Insert reference number and make links.
-
-htmlsention makes reference table.
-
-Example:
-
-Before convertion
--------- begin of example --------
-See <ref name="KandR2">.
-
-<references>
-<reference name="KandR">Brian W. Kernighan and Dennis M. Ritchie,
-"The C Programming Language", Prentice-Hall, 1978.
-<reference name="KandR2">Brian W. Kernighan and Dennis M. Ritchie,
-"The C Programming Language", Second Edition, Prentice Hall, 1988.
-<reference name="NumericalRecipe">William H. Press, Saul A. Teukolsky,
-William T. Vetterling, and Brian P.Flannery,
-"Numerical Recipes in C", Second Edition, Cambridge University Press, 1992.
-</references>
--------- end of example --------
-
-After convertion by htmlsection
--------- begin of example --------
-See <a href="#ref_KandR2">[2]</a>.
-
-<ul>
-<li><a name="ref_KandR">[1]</a>Brian W. Kernighan and Dennis M. Ritchie,
-"The C Programming Language", Prentice-Hall, 1978.
-<li><a name="ref_KandR2">[2]</a>Brian W. Kernighan and Dennis M. Ritchie,
-"The C Programming Language", Second Edition, Prentice Hall, 1988.
-<li><a name="ref_NumericalRecipe">[3]</a>William H. Press, Saul A. Teukolsky,
-William T. Vetterling, and Brian P.Flannery,
-"Numerical Recipes in C", Second Edition, Cambridge University Press, 1992.
-</ul>
--------- end of example --------
-
-OPTIONS
-
-The following options are available:
-
--h, -help
-    Output help messages.
-
--max-depth [depth]
-    Specify the max depth of subsection of section tag. If you specify
-    -max-depth 10, you can use <subsubsubsubsubsubsubsubsubsection> tag.
-
--spacer
-    Spacing <section>, <subsection> and <subsubsection> tag.
-
--no-spacer
-    No spacing.
-
--english, -japanese
-    Specify the language. If you don't specify these options, htmlsection
-    sees environment variable LANG.
-
--start-section [section]
-    Specify the section number at start. For example, if you specify
-    -start-section 3.5.6, htmlsection sets the section number to it at start.
-
--toc-section [section]
-    Specify the section depth to make the table of contents. If you
-    specify -toc-section 2, htmlsection makes the table of contents
-    by section and subsection only.
-
--table-section [section]
-    Specify the section number at beginning of table number.
-    If you specify -table-section 2, format of table number is
-    [section_number].[subsection_number].[table_number].
-    If you specify -table-section 0, format of table number is
-    [table_number] only.
-
--figure-section [section], -list-section [section]
-    Same as -table-section option.
-
--start-table [number]
-    Specify the table number at start.
-
--start-figure [number], -start-list [number], -start-ref [number]
-    Same as -start-table option.
-
--toc-file [filename]
-    If you specify -toc-file, output the table of contents to the file.
-
--table-file [filename]
-    If you specify -table-file, output the table index to the file.
-
--figure-file [filename], -list-file [filename]
-    Same as -table-file option.
-
--o [filename]
-    Specify the output file. If you don't specify the filename, htmlsection
-    outputs HTML to the standard output.
-
-ENVIRONMENT VARIABLES
-
-    LANG
-    Specify the language.
-
-TAGS
-
-    <section>Title</section>, <subsection>Title</subsection>, ...
-        options:
-        name="section_name"
-        number=yes or no
-
-    <sectionref>, <subsectionref>, ...
-        options:
-        name="section_name"
-        title=yes or no
-
-    <tablereference>Title</tablereference>
-        options:
-        name="table_name"
-        number=yes or no
-
-    <figurereference>Title</figurereference>
-        options:
-        name="figure_name"
-        number=yes or no
-
-    <listreference>Title</listreference>
-        options:
-        name="list_name"
-        number=yes or no
-
-    <tableref>Title</tableref>
-        options:
-        name="table_name"
-        title=yes or no
-
-    <figureref>Title</figureref>
-        options:
-        name="figure_name"
-        title=yes or no
-
-    <listref>Title</listref>
-        options:
-        name="list_name"
-        title=yes or no
-
-    <references></references>
-
-    <reference>
-        options:
-        name="reference_name"
-
-    <ref>
-        options:
-        name="reference_name"
-        title=yes or no
-    
-    <tableofcontents></tableofcontents>
-    <tableindex></tableindex>
-    <figureindex></figureindex>
-    <listindex></listindex>
-
-SEE ALSO
-
-    perl(1)
-
-    If you want to see more detail information, See,
-        Comments at the head of htmlsection script.
-        HTMLSECTION_PREFIX/share/doc/htmlsection - Documents.
-        HTMLSECTION_PREFIX/share/doc/htmlsection/README - Readme file.
-        HTMLSECTION_PREFIX/share/doc/htmlsection/htmlsection.html
-            - Sample HTML file and description about htmlsection.
-        http://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/htmlsection.html
-
-AUTHOR
-
-    Programmed by SAKAI Hiroaki.
-    E-Mail: sakai@seki.ee.kagu.sut.ac.jp, hsakai@m8.people.or.jp,
-            hsakai@pfu.fujitsu.com
-    Web site:
-    http://www.seki.ee.kagu.sut.ac.jp/~sakai/myfreesoft/index.html
-    Mirror site:
-    http://hp.vector.co.jp/authors/VA014157/myfreesoft/index.html
-    http://www.people.or.jp/~hsakai/myfreesoft/index.html
-
diff --git a/sm/lib/egsl/egsl_conversions.c b/sm/lib/egsl/egsl_conversions.c
deleted file mode 100644
index 2d81c09df2f0fc2f1c9c7a0e9049747945150351..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/egsl_conversions.c
+++ /dev/null
@@ -1,64 +0,0 @@
-#include "egsl.h"
-
-val egsl_vFda(size_t rows, size_t cols, const double *a) {
-	val v = egsl_alloc(rows, cols);
-
-	size_t i; size_t j;
-	for(i=0;i<rows;i++)
-	for(j=0;j<cols;j++) {
-		*egsl_atmp(v,i,j) = a[j+i*cols];
-	}
-	return v;
-}
-
-val egsl_vFa(size_t rows, const double*a) {
-	val v = egsl_alloc(rows,1);
-	size_t i;
-	for(i=0;i<rows;i++)
-		*egsl_atmp(v,i,0) =  a[i];
-	return v;
-}
-
-void egsl_v2a(val v, double*vec) {
-	gsl_matrix *m = egsl_gslm(v);
-	size_t i;
-	for(i=0; i < m->size1; i++)
-		vec[i] = gsl_matrix_get(m,i,0);
-}
-
-void egsl_v2da(val v, double*a){
-	gsl_matrix *m = egsl_gslm(v);
-	size_t i,j;
-	for(i=0;i<m->size1;i++)
-		for(j=0;j<m->size2;j++)
-			a[j*m->size1 +i] = gsl_matrix_get(m,i,j);
-}
-
-void egsl_v2vec(val v, gsl_vector*vec) {
-	size_t i;
-	for(i=0;i<vec->size;i++)
-		gsl_vector_set(vec,i, *egsl_atmp(v,i,0));
-}
-
-
-val egsl_vFgslv(const gsl_vector*vec){
-	val v = egsl_alloc(vec->size,1);
-	size_t i;
-	for(i=0;i<vec->size;i++)
-		*egsl_atmp(v,i,0) = gsl_vector_get(vec,i);
-	return v;
-}
-
-val egsl_vFgslm(const gsl_matrix*m){
-	val v = egsl_alloc(m->size1,m->size2);
-	gsl_matrix * m2 = egsl_gslm(v);
-	gsl_matrix_memcpy(m2,m);
-	return v;
-}
-
-gsl_matrix* egsl_v2gslm(val v){
-	gsl_matrix * m = egsl_gslm(v); 
-	gsl_matrix * m2 = gsl_matrix_alloc(m->size1,m->size2);
-	gsl_matrix_memcpy(m2,m);
-	return m2;
-}
diff --git a/sm/lib/egsl/egsl_ops.c b/sm/lib/egsl/egsl_ops.c
deleted file mode 100644
index aeceb542184a1abd3098a7282b8dded598b0ff0c..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/egsl_ops.c
+++ /dev/null
@@ -1,172 +0,0 @@
-#include <gsl/gsl_matrix.h>
-#include <gsl/gsl_blas.h>
-#include <gsl/gsl_linalg.h>
-#include <gsl/gsl_eigen.h>
-
-#include "egsl.h"
-
-
-
-val egsl_sub(val v1,val v2){
-	return egsl_sum(v1, egsl_scale(-1.0,v2));
-}
-
-val egsl_compose_col(val v1, val v2){
-	gsl_matrix *m1 = egsl_gslm(v1);
-	gsl_matrix *m2 = egsl_gslm(v2);
-	egsl_expect_size(v2, 0, m1->size2);
-	val v3 = egsl_alloc(m1->size1+m2->size1,m1->size2);
-	gsl_matrix *m3 = egsl_gslm(v3);
-	size_t i,j;
-	for(j=0;j<m1->size2;j++) {
-		for(i=0;i<m1->size1;i++)
-			gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j));
-		
-		for(i=0;i<m2->size1;i++)
-			gsl_matrix_set(m3, m1->size1+i, j, gsl_matrix_get(m2,i,j));
-	}
-	return v3;
-}
-
-val egsl_compose_row(val v1, val v2){
-	gsl_matrix *m1 = egsl_gslm(v1);
-	gsl_matrix *m2 = egsl_gslm(v2);
-	egsl_expect_size(v2, m1->size1, 0);
-	val v3 = egsl_alloc(m1->size1, m1->size2 + m2->size2);
-	gsl_matrix *m3 = egsl_gslm(v3);
-	size_t i,j;
-	for(i=0;i<m1->size1;i++) {
-		for(j=0;j<m1->size2;j++) 
-			gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j));
-		
-		for(j=0;j<m2->size2;j++) 
-			gsl_matrix_set(m3, i, m1->size2+j, gsl_matrix_get(m2,i,j));
-	}
-	return v3;
-}
-
-void egsl_add_to(val v1, val v2) {
-	gsl_matrix * m1 = egsl_gslm(v1); 
-	gsl_matrix * m2 = egsl_gslm(v2);
-	gsl_matrix_add(m1,m2);	
-}
-
-void egsl_add_to_col(val v1, size_t j, val v2) {
-/*	egsl_print("m1",v1);
-	egsl_print("m2",v2); */
-	gsl_matrix * m1 = egsl_gslm(v1); 
-	gsl_matrix * m2 = egsl_gslm(v2);
-	
-/*	printf("m1 size = %d,%d j = %d\n",m1->size1,m1->size2,j); */
-	egsl_expect_size(v2, m1->size1, 1);
-	size_t i;
-	for(i=0;i<m1->size1;i++) {
-		*gsl_matrix_ptr(m1, i, j) += gsl_matrix_get(m2,i,0);
-	}
-}
-
-
-val egsl_copy_val(val v1) {
-	gsl_matrix * m1 = egsl_gslm(v1);
-	val v2 = egsl_alloc(m1->size1,m1->size2);
-	gsl_matrix * m2 = egsl_gslm(v2);
-	gsl_matrix_memcpy(m2,m1);
-	return v2;
-}
-
-val egsl_scale(double s, val v1){
-	val v2 = egsl_copy_val(v1);
-	gsl_matrix * m2 = egsl_gslm(v2);
-	gsl_matrix_scale(m2, s);
-	return v2;
-}
-
-val egsl_sum(val v1, val v2){
-	gsl_matrix * m1 = egsl_gslm(v1);
-	gsl_matrix * m2 = egsl_gslm(v2);
-	val v3 = egsl_alloc(m1->size1,m1->size2);
-	gsl_matrix * m3 = egsl_gslm(v3);
-	gsl_matrix_memcpy(m3,m1);
-	gsl_matrix_add(m3,m2);	
-	return v3;
-}
-
-val egsl_sum3(val v1, val v2, val v3){
-	return egsl_sum(v1, egsl_sum(v2,v3));
-}
-
-val egsl_mult(val v1, val v2){
-	gsl_matrix * a = egsl_gslm(v1);
-	gsl_matrix * b = egsl_gslm(v2);
-	val v = egsl_alloc(a->size1,b->size2);
-	gsl_matrix * ab = egsl_gslm(v); 
-	gsl_blas_dgemm(CblasNoTrans,CblasNoTrans,1.0,a,b,0.0,ab);
-	return v;
-}
-
-val egsl_transpose(val v1){
-	gsl_matrix * m1 = egsl_gslm(v1);
-	val v2 = egsl_alloc(m1->size2,m1->size1);
-	gsl_matrix * m2 = egsl_gslm(v2);
-	gsl_matrix_transpose_memcpy(m2,m1);
-	return v2;
-}
-
-val egsl_inverse(val v1){
-	gsl_matrix*A = egsl_gslm(v1);
-	val v2 = egsl_alloc(A->size1,A->size1);
-	gsl_matrix*invA = egsl_gslm(v2);
-	size_t n = A->size1;
-	gsl_matrix * m = gsl_matrix_alloc(n,n);
-	gsl_matrix_memcpy(m,A);
-	gsl_permutation * perm = gsl_permutation_alloc (n);
-	/* Make LU decomposition of matrix m */
-	int s;
-	gsl_linalg_LU_decomp (m, perm, &s);
-	/* Invert the matrix m */
-	gsl_linalg_LU_invert (m, perm, invA);
-	gsl_permutation_free(perm);
-	gsl_matrix_free(m);
-	return v2;
-}
-
-void egsl_symm_eig(val v, double* eigenvalues, val* eigenvectors) {
-	gsl_matrix *m = egsl_gslm(v);
-	size_t N = m->size1;
-	/* Check for v to be square */
-	
-	gsl_matrix *A = gsl_matrix_alloc(N,N);
-	gsl_matrix_memcpy(A, m);
-	
-	gsl_vector *eval = gsl_vector_alloc(N); 
-	gsl_matrix *evec = gsl_matrix_alloc(N,N);
-	
-	gsl_eigen_symmv_workspace * ws = gsl_eigen_symmv_alloc(N);
-	gsl_eigen_symmv(A, eval, evec, ws);
-	gsl_eigen_symmv_free(ws);	
-
-	
-	gsl_eigen_symmv_sort(eval, evec, GSL_EIGEN_SORT_VAL_DESC);
-	
-	size_t j;
-	for(j=0;j<N;j++) {
-		eigenvalues[j] = gsl_vector_get(eval, j);
-		eigenvectors[j] = egsl_alloc(N,1);
-		size_t i;
-		for(i=0;i<N;i++)
-			*egsl_atmp(eigenvectors[j],i,0) = gsl_matrix_get(evec,i,j);
-	}
-	
-	
-	gsl_vector_free(eval);	
-	gsl_matrix_free(evec);
-	gsl_matrix_free(A);
-}
-
-
-
-
-
-
-
-
diff --git a/sm/lib/egsl/egsl_test.c b/sm/lib/egsl/egsl_test.c
deleted file mode 100644
index 8439a5d60558ebccf8f5444d8b251bd0a4c9b567..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/egsl_test.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <math.h>
-#include <gsl/gsl_math.h>
-#include "egsl_macros.h"
-
-int main() {	
-	egsl_push();
-	
-		/* Creates a vector from a double array */
-		double p[2] = {1,2};
-		val vp = egsl_vFa(2,p);	
-		
-		/* Creates a matrix from a double array */
-		double md[4] = {
-			1, 2,
-			0, -1
-		};
-		val m = egsl_vFda(2,2,md);
-
-		/* Creates a rotation matrix */
-		val R = rot(M_PI/2);
-		
-		/* Multiplies the three together */
-		val vrot = m3(R, m, vp); 
-	
-		/* Displays the results */
-		egsl_print("R", R);
-		egsl_print("vp", vp);
-		egsl_print("vrot", vrot);
-	
-		/* Create a semidifinite matrix (symmetric part of R) */
-		val A = sc(0.5, sum(m, tr(m)) );
- 
- 		/* Displays spectrum */
-		egsl_print("A",A);
-		egsl_print_spectrum("A",A);
-		
-	egsl_pop();
-	
-	return 0;
-}
-
diff --git a/sm/lib/egsl/egsl_test_allocation.c b/sm/lib/egsl/egsl_test_allocation.c
deleted file mode 100644
index 201bbe3978b563cc1e869fb7f0104af7f7042531..0000000000000000000000000000000000000000
--- a/sm/lib/egsl/egsl_test_allocation.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "egsl.h"
-#include "egsl_macros.h"
-
-int main() {
-	egsl_push();
-
-	val v1 = zeros(10,10);
-
-	int i;
-	for(i=0;i<1000000;i++) {
-	       egsl_push();
-	       val v2 = zeros(10,10);
-
-	       add_to(v1, v2);
-       
-	       egsl_pop();
-	}
-
-	egsl_pop();
-	egsl_print_stats();
-	
-	return 0;
-}
diff --git a/sm/lib/gpc/CMakeLists.txt b/sm/lib/gpc/CMakeLists.txt
deleted file mode 100644
index 782609a65603ed37beab4477ae2ddc4e6fa10f01..0000000000000000000000000000000000000000
--- a/sm/lib/gpc/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-
-SET(gpc_sources
-	gpc.c
-	gpc_utils.c
-)
-
-ADD_LIBRARY(gpc STATIC  ${gpc_sources})
diff --git a/sm/lib/gpc/gpc_test.c b/sm/lib/gpc/gpc_test.c
deleted file mode 100644
index ed76ec4cafe8ca2124f9d6c1a8d2ef182502fdaf..0000000000000000000000000000000000000000
--- a/sm/lib/gpc/gpc_test.c
+++ /dev/null
@@ -1,52 +0,0 @@
-// GPC: A library for the solution of General Point Correspondence problems.
-// Copyright (C) 2006 Andrea Censi (andrea at censi dot org)
-
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
-#include <stdio.h>
-#include <math.h>
-#include "gpc.h"
-
-#define deg2rad(x) (x*M_PI/180)
-
-int main() {
-	// This is the true roto-translation
-	double theta = deg2rad(4);
-	double t[2] = {0.3,-0.2};
-	printf("x_true =  %f  %f  %f deg\n", t[0], t[1], theta*180/M_PI);	
-	
-	double p[5][2] = {{1,0},{0,1},{-1,0},{2,1},{4,2}};
-	double alpha[5] = {deg2rad(0), 
-		deg2rad(10), deg2rad(20), deg2rad(50),deg2rad(-20)};
-
-	struct gpc_corr c[5];
-	int k;
-	for(k=0;k<5;k++) {
-		c[k].p[0] = p[k][0];
-		c[k].p[1] = p[k][1];
-		c[k].q[0] = t[0] + p[k][0]*cos(theta) - p[k][1]*sin(theta);
-		c[k].q[1] = t[1] + p[k][0]*sin(theta) + p[k][1]*cos(theta);
-		c[k].C[0][0] = cos(alpha[k])*cos(alpha[k]);
-		c[k].C[0][1] = c[k].C[1][0] = cos(alpha[k])*sin(alpha[k]);
-		c[k].C[1][1] = sin(alpha[k])*sin(alpha[k]);
-	}
-
-	double x[3];
-	gpc_solve(5,c,x);
-
-	printf("estimated x =  %f  %f  %f deg\n", x[0], x[1],x[2]*180/M_PI);
-	return 0;
-}
-
diff --git a/sm/lib/gpc/gpc_utils.c b/sm/lib/gpc/gpc_utils.c
deleted file mode 100644
index b743f4cd2831648fdea69bf32ed422f763c767cb..0000000000000000000000000000000000000000
--- a/sm/lib/gpc/gpc_utils.c
+++ /dev/null
@@ -1,134 +0,0 @@
-#include "gpc.h"
-#include "gpc_utils.h"
-
-void m_trans(const gsl_matrix*A, gsl_matrix*A_t){
-	gsl_matrix_transpose_memcpy(A_t,A);
-}
-
-void m_mult(const gsl_matrix*A, const gsl_matrix*B, gsl_matrix*AB){
-	gsl_blas_dgemm(CblasNoTrans,CblasNoTrans,1.0,A,B,0.0,AB);
-}
-
-void m_add_to(const gsl_matrix*A, gsl_matrix*B){
-	gsl_matrix_add(B, A);
-}
-
-void m_scale(double m, gsl_matrix*A){
-	gsl_matrix_scale(A,m);
-}
-
-void m_add (const gsl_matrix*A, const gsl_matrix*B, gsl_matrix*ApB){
-	gsl_matrix_memcpy(ApB,A);
-	gsl_matrix_add(ApB,B);	
-}
-
-void m_inv(const gsl_matrix*A, gsl_matrix*invA) {
-	unsigned int n = A->size1;
-	gsl_matrix * m = gsl_matrix_alloc(n,n);
-	gsl_matrix_memcpy(m,A);
-	gsl_permutation * perm = gsl_permutation_alloc (n);
-	/* Make LU decomposition of matrix m */
-	int s;
-	gsl_linalg_LU_decomp (m, perm, &s);
-	/* Invert the matrix m */
-	gsl_linalg_LU_invert (m, perm, invA);
-	gsl_permutation_free(perm);
-	gsl_matrix_free(m);
-}
-
-double m_det(const gsl_matrix*A) {
-	unsigned int n = A->size1;
-	gsl_matrix * m = gsl_matrix_alloc(n,n);
-	gsl_matrix_memcpy(m,A);
-	gsl_permutation * perm = gsl_permutation_alloc (n);
-	int sign;
-	gsl_linalg_LU_decomp (m, perm, &sign);
-	double det = gsl_linalg_LU_det(m, sign);
-	
-	gsl_permutation_free(perm);
-	gsl_matrix_free(m);
-	return det;
-}
-
-double m_dot(const gsl_matrix*A,const gsl_matrix*B) {
-	double sum = 0;
-	unsigned int j;
-	for(j=0;j<A->size2;j++)
-		sum += gmg(A,0,j)*gmg(B,j,0);
-	return sum;
-}
-
-int poly_real_roots(unsigned int n, const double*a, double *roots) {
-	double z[(n-1)*2];
-	gsl_poly_complex_workspace * w  = gsl_poly_complex_workspace_alloc(n);
-	if(GSL_SUCCESS != gsl_poly_complex_solve (a, n, w, z)) {
-		return 0;
-	}
-	gsl_poly_complex_workspace_free (w);
-	
-	unsigned int i=0;
-	for(i=0;i<n-1;i++) {
-		roots[i] = z[2*i];
-	}	
-	return 1;
-}
-
-
-int poly_greatest_real_root(unsigned int n, const double*a, double *root) {
-	double z[(n-1)*2];
-	gsl_poly_complex_workspace * w  = gsl_poly_complex_workspace_alloc(n);
-	if(GSL_SUCCESS != gsl_poly_complex_solve (a, n, w, z)) {
-		return 0;
-	}
-	gsl_poly_complex_workspace_free (w);
-	if(TRACE_ALGO) {
-		printf("Solving the equation\n a = [");
-		for(unsigned int i=0;i<n;i++) {
-			printf("%lf ", a[i]);
-		}
-		printf("]\n");
-	}
-
-	unsigned int i;
-	double lambda = 0; int assigned = 0;
-	for (i = 0; i < n-1; i++) {
-		if(TRACE_ALGO) {
-			fprintf (stderr, "root z%d = %+.18f + %+.18f i \n", i, z[2*i], z[2*i+1]);
-		}
-/*		 XXX ==0 is bad */
-		if( z[2*i+1]==0 ) /* real root */
-			if(!assigned || (z[2*i]>lambda)) {
-				assigned = 1;
-				lambda = z[2*i];
-			}
-	}
-	if(TRACE_ALGO)
-		fprintf (stderr, "lambda = %+.18f \n", lambda); 
-	if(!assigned) {
-		fprintf(stderr, "poly_greatest_real_root: Could not find real root for polynomial.\n");
-		fprintf(stderr, "polynomial coefficients : ");
-		for (i = 0; i < n; i++)
-			fprintf(stderr, " %lf ", a[i]);
-		fprintf(stderr, "\nRoots:\n");
-		
-		for (i = 0; i < n-1; i++)
-			fprintf (stderr, "root z%d = %+.18f + %+.18f i \n", i, z[2*i], z[2*i+1]);
-
-		return 0;
-	}
-	
-	*root = lambda;
-	return 1;
-}
-
-void m_display(const char*str, gsl_matrix*m) {
-	printf("%s= \n", str);
-	unsigned int i,j;
-	for(i=0;i<m->size1;i++) {
-		printf("   ");
-		for(j=0;j<m->size2;j++)
-			printf("%e ", gmg(m,i,j));
-		printf("\n");
-	}
-}
-
diff --git a/sm/lib/json-c/CMakeLists.txt b/sm/lib/json-c/CMakeLists.txt
deleted file mode 100644
index a75dad61d69ce16ce7046ae8e66223306021952c..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/CMakeLists.txt
+++ /dev/null
@@ -1,81 +0,0 @@
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
-
-SET(json-c_sources
-	arraylist.c
-	debug.c
-	json_object.c
-	json_tokener.c
-	json_util.c
-	linkhash.c
-	printbuf.c
-	JSON_checker.c
-	json_more_utils.c
-)
-
-ADD_LIBRARY(json-c STATIC ${json-c_sources})
-
-#ADD_EXECUTABLE(test1 test1.c)
-ADD_EXECUTABLE(test2 test2.c)
-
-#TARGET_LINK_LIBRARIES(test1 json-c)
-TARGET_LINK_LIBRARIES(test2 json-c)
-
-
-FILE(GLOB json_headers "*.h")
-INSTALL(FILES ${json_headers} DESTINATION include/json-c)
-
-
-INCLUDE(CheckIncludeFile)
-
-MACRO(MY_CHECK_INCLUDE_FILE file VAR)
-	CHECK_INCLUDE_FILE(${file} ${file}-exists)
-	IF(${${file}-exists})
-		SET(${VAR} 1)
-	ELSE()
-		SET(${VAR} 0)
-	ENDIF(${${file}-exists})
-ENDMACRO(MY_CHECK_INCLUDE_FILE file VAR)
-
-MY_CHECK_INCLUDE_FILE(fcntl.h HAVE_FCNTL_H)
-MY_CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
-MY_CHECK_INCLUDE_FILE(limits.h HAVE_LIMITS_H)
-MY_CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
-MY_CHECK_INCLUDE_FILE(stdarg.h HAVE_STDARG_H)
-MY_CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
-MY_CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H)
-MY_CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
-MY_CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
-MY_CHECK_INCLUDE_FILE(syslog.h HAVE_SYSLOG_H)
-MY_CHECK_INCLUDE_FILE(sys/param.h HAVE_SYS_PARAM_H)
-MY_CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
-MY_CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
-MY_CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
-
-MACRO(MY_CHECK_FUNCTION_EXISTS function VAR)
-	CHECK_FUNCTION_EXISTS(${function} ${function}-exists)
-	IF(${${function}-exists})
-		# MESSAGE(STATUS "Exists ${function} = ${${function}-exists}")
-		SET(${VAR} 1)
-	ELSE()
-		# MESSAGE(STATUS "NOT Exists ${function} = ${${function}-exists}")
-		SET(${VAR} 0)
-	ENDIF(${${function}-exists})
-ENDMACRO(MY_CHECK_FUNCTION_EXISTS function VAR)
-
-INCLUDE(CheckFunctionExists)
-
-MY_CHECK_FUNCTION_EXISTS(open HAVE_OPEN)
-MY_CHECK_FUNCTION_EXISTS(strubded HAVE_STRUB)
-MY_CHECK_FUNCTION_EXISTS(malloc HAVE_MALLOC)
-MY_CHECK_FUNCTION_EXISTS(realloc HAVE_REALLOC)
-MY_CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
-MY_CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
-MY_CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP)
-MY_CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
-MY_CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF)
-MY_CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF)
-MY_CHECK_FUNCTION_EXISTS(vsyslog HAVE_VSYSLOG)
-
-CONFIGURE_FILE(config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
diff --git a/sm/lib/json-c/JSON_checker.c b/sm/lib/json-c/JSON_checker.c
deleted file mode 100644
index e11382115061d9aef19b1f1de847bf4398c7d2a6..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/JSON_checker.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/* JSON_checker.c */
-
-
-/* 2005-12-30 */
-
-/*
-Copyright (c) 2005 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-
-#include "JSON_checker.h"
-
-#define true  1
-#define false 0
-
-/*
-    Characters are mapped into these 32 symbol classes. This allows for
-    significant reductions in the size of the state transition table.
-*/
-
-/* error */
-#define S_ERR -1
-
-/* space */
-#define S_SPA 0
-
-/* other whitespace */
-#define S_WSP 1
-
-/* {  */
-#define S_LBE 2
-
-/* } */
-#define S_RBE 3
-
-/* [ */
-#define S_LBT 4
-
-/* ] */
-#define S_RBT 5
-
-/* : */
-#define S_COL 6
-
-/* , */
-#define S_COM 7
-
-/* " */
-#define S_QUO 8
-
-/* \ */
-#define S_BAC 9
-
-/* / */
-#define S_SLA 10
-
-/* + */
-#define S_PLU 11
-
-/* - */
-#define S_MIN 12
-
-/* . */
-#define S_DOT 13
-
-/* 0 */
-#define S_ZER 14
-
-/* 123456789 */
-#define S_DIG 15
-
-/* a */
-#define S__A_ 16
-
-/* b */
-#define S__B_ 17
-
-/* c */
-#define S__C_ 18
-
-/* d */
-#define S__D_ 19
-
-/* e */
-#define S__E_ 20
-
-/* f */
-#define S__F_ 21
-
-/* l */
-#define S__L_ 22
-
-/* n */
-#define S__N_ 23
-
-/* r */
-#define S__R_ 24
-
-/* s */
-#define S__S_ 25
-
-/* t */
-#define S__T_ 26
-
-/* u */
-#define S__U_ 27
-
-/* ABCDF */
-#define S_A_F 28
-
-/* E */
-#define S_E   29
-
-/* everything else */
-#define S_ETC 30
-
-
-/*
-    This table maps the 128 ASCII characters into the 32 character classes.
-    The remaining Unicode characters should be mapped to S_ETC.
-*/
-static int ascii_class[128] = {
-    S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR,
-    S_ERR, S_WSP, S_WSP, S_ERR, S_ERR, S_WSP, S_ERR, S_ERR,
-    S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR,
-    S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR,
-
-    S_SPA, S_ETC, S_QUO, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC,
-    S_ETC, S_ETC, S_ETC, S_PLU, S_COM, S_MIN, S_DOT, S_SLA,
-    S_ZER, S_DIG, S_DIG, S_DIG, S_DIG, S_DIG, S_DIG, S_DIG,
-    S_DIG, S_DIG, S_COL, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC,
-
-    S_ETC, S_A_F, S_A_F, S_A_F, S_A_F, S_E  , S_A_F, S_ETC,
-    S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC,
-    S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC,
-    S_ETC, S_ETC, S_ETC, S_LBT, S_BAC, S_RBT, S_ETC, S_ETC,
-
-    S_ETC, S__A_, S__B_, S__C_, S__D_, S__E_, S__F_, S_ETC,
-    S_ETC, S_ETC, S_ETC, S_ETC, S__L_, S_ETC, S__N_, S_ETC,
-    S_ETC, S_ETC, S__R_, S__S_, S__T_, S__U_, S_ETC, S_ETC,
-    S_ETC, S_ETC, S_ETC, S_LBE, S_ETC, S_RBE, S_ETC, S_ETC
-};
-
-
-/*
-    The state transition table takes the current state and the current symbol,
-    and returns either a new state or an action. A new state is a number between
-    0 and 29. An action is a negative number between -1 and -9. A JSON text is
-    accepted if the end of the text is in state 9 and mode is MODE_DONE.
-*/
-static int state_transition_table[30][31] = {
-/* 0*/ { 0, 0,-8,-1,-6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/* 1*/ { 1, 1,-1,-9,-1,-1,-1,-1, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/* 2*/ { 2, 2,-8,-1,-6,-5,-1,-1, 3,-1,-1,-1,20,-1,21,22,-1,-1,-1,-1,-1,13,-1,17,-1,-1,10,-1,-1,-1,-1},
-/* 3*/ { 3,-1, 3, 3, 3, 3, 3, 3,-4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
-/* 4*/ {-1,-1,-1,-1,-1,-1,-1,-1, 3, 3, 3,-1,-1,-1,-1,-1,-1, 3,-1,-1,-1, 3,-1, 3, 3,-1, 3, 5,-1,-1,-1},
-/* 5*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 6, 6, 6, 6, 6, 6, 6, 6,-1,-1,-1,-1,-1,-1, 6, 6,-1},
-/* 6*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 7, 7, 7, 7, 7, 7, 7, 7,-1,-1,-1,-1,-1,-1, 7, 7,-1},
-/* 7*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 8, 8, 8, 8, 8, 8, 8, 8,-1,-1,-1,-1,-1,-1, 8, 8,-1},
-/* 8*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 3, 3, 3, 3, 3, 3, 3, 3,-1,-1,-1,-1,-1,-1, 3, 3,-1},
-/* 9*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/*10*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,-1,-1,-1,-1,-1,-1},
-/*11*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,12,-1,-1,-1},
-/*12*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/*13*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,14,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/*14*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,15,-1,-1,-1,-1,-1,-1,-1,-1},
-/*15*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,16,-1,-1,-1,-1,-1},
-/*16*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/*17*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,18,-1,-1,-1},
-/*18*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,-1,-1,-1,-1,-1,-1,-1,-1},
-/*19*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 9,-1,-1,-1,-1,-1,-1,-1,-1},
-/*20*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,21,22,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/*21*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,23,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/*22*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,23,22,22,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,24,-1},
-/*23*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,-1,23,23,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,24,-1},
-/*24*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,25,25,-1,26,26,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/*25*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,26,26,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/*26*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,-1,26,26,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/*27*/ {27,27,-1,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-/*28*/ {28,28,-8,-1,-6,-1,-1,-1, 3,-1,-1,-1,20,-1,21,22,-1,-1,-1,-1,-1,13,-1,17,-1,-1,10,-1,-1,-1,-1},
-/*29*/ {29,29,-1,-1,-1,-1,-1,-1, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}
-};
-
-
-
-/*
-    These modes can be pushed on the PDA stack.
-*/
-#define MODE_DONE   1
-#define MODE_KEY    2
-#define MODE_OBJECT 3
-#define MODE_ARRAY  4
-
-/*
-    A stack maintains the states of nested structures.
-*/
-#define MAX_DEPTH   20
-
-static int the_state;
-static int the_stack[MAX_DEPTH];
-static int the_top;
-
-static int the_index = 0;
-
-/*
-    Push a mode onto the stack. Return false if there is overflow.
-*/
-static int 
-push(int mode)
-{
-    the_top += 1;
-    if (the_top >= MAX_DEPTH) {
-        return false;
-    }
-    the_stack[the_top] = mode;
-    return true;
-}
-
-
-/*
-    Pop the stack, assuring that the current mode matches the expectation.
-    Return false if there is underflow or if the modes mismatch.
-*/
-static int
-pop(int mode)
-{
-    if (the_top < 0 || the_stack[the_top] != mode) {
-        return false;
-    }
-    the_stack[the_top] = 0;
-    the_top -= 1;
-    return true;
-}
-
-int JSON_checker_push(int b);
-
-void JSON_checker_init() {
-	the_state = 0;
-   the_top = -1;
-   push(MODE_DONE);
-}
-
-int JSON_checker_finished() {
-	 return the_state == 9 && pop(MODE_DONE);
-}
-
-/*
-    The JSON_checker takes a UTF-16 encoded string and determines if it is a
-    syntactically correct JSON text.
-
-    It is implemented as a Pushdown Automaton; that means it is a finite state
-    machine with a stack.
-*/
-int 
-JSON_checker(unsigned short p[], int length)
-{
-	JSON_checker_init();
-
-	for (the_index = 0; the_index < length; the_index += 1) {
-		if(!(JSON_checker_push(p[the_index]))) return false;
-	}
-   
-	return JSON_checker_finished() ;
-}
-
-
-int JSON_checker_push(int b) {
-   int c;  /* the next character class */
-   int s;  /* the next state */
-        if ((b & 127) == b) {
-            c = ascii_class[b];
-            if (c <= S_ERR) {
-                return false;
-            }
-        } else {
-            c = S_ETC;
-        }
-/*
-    Get the next state from the transition table.
-*/
-        s = state_transition_table[the_state][c];
-        if (s < 0) {
-/*
-    Perform one of the predefined actions.
-*/
-            switch (s) {
-/*
-    empty }
-*/
-            case -9:
-                if (!pop(MODE_KEY)) {
-                    return false;
-                }
-                the_state = 9;
-                break;
-/*
-    {
-*/
-            case -8:
-                if (!push(MODE_KEY)) {
-                    return false;
-                }
-                the_state = 1;
-                break;
-/*
-    }
-*/
-            case -7:
-                if (!pop(MODE_OBJECT)) {
-                    return false;
-                }
-                the_state = 9;
-                break;
-/*
-    [
-*/
-            case -6:
-                if (!push(MODE_ARRAY)) {
-                    return false;
-                }
-                the_state = 2;
-                break;
-/*
-    ]
-*/
-            case -5:
-                if (!pop(MODE_ARRAY)) {
-                    return false;
-                }
-                the_state = 9;
-                break;
-/*
-    "
-*/
-            case -4:
-                switch (the_stack[the_top]) {
-                case MODE_KEY:
-                    the_state = 27;
-                    break;
-                case MODE_ARRAY:
-                case MODE_OBJECT:
-                    the_state = 9;
-                    break;
-                default:
-                    return false;
-                }
-                break;
-/*
-    ,
-*/
-            case -3:
-                switch (the_stack[the_top]) {
-                case MODE_OBJECT:
-                    if (pop(MODE_OBJECT) && push(MODE_KEY)) {
-                        the_state = 29;
-                    }
-                    break;
-                case MODE_ARRAY:
-                    the_state = 28;
-                    break;
-                default:
-                    return false;
-                }
-                break;
-/*
-    :
-*/
-            case -2:
-                if (pop(MODE_KEY) && push(MODE_OBJECT)) {
-                    the_state = 28;
-                    break;
-                }
-/*
-    syntax error
-*/
-            case -1:
-                return false;
-            }
-        } else {
-/*
-    Change the state and iterate.
-*/
-            the_state = s;
-        }
-		return true;
-}
-/*
-    Get the current character number.
-*/
-int 
-JSON_checker_at_character()
-{
-    return the_index;
-}
diff --git a/sm/lib/json-c/JSON_checker.h b/sm/lib/json-c/JSON_checker.h
deleted file mode 100644
index 4561385b9837dd7e4558cd5ace9b8f5745aaf61b..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/JSON_checker.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* JSON_checker.h */
-
-extern int JSON_checker(unsigned short p[], int length);
-extern int JSON_checker_at_character(void);
-
-
-void JSON_checker_init(void);
-int JSON_checker_push(int b);
-int JSON_checker_finished(void);
-
diff --git a/sm/lib/json-c/arraylist.c b/sm/lib/json-c/arraylist.c
deleted file mode 100644
index a6db497530f1ef43fd512d7b0fc57f5ce0e4527e..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/arraylist.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * $Id: arraylist.c,v 1.4 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#include "config.h"
-
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <string.h>
-#endif /* STDC_HEADERS */
-
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif /* HAVE_STRINGS_H */
-
-#include "bits.h"
-#include "arraylist.h"
-
-struct array_list*
-array_list_new(array_list_free_fn *free_fn)
-{
-  struct array_list *this;
-
-  if(!(this = calloc(1, sizeof(struct array_list)))) return NULL;
-  this->size = ARRAY_LIST_DEFAULT_SIZE;
-  this->length = 0;
-  this->free_fn = free_fn;
-  if(!(this->array = calloc(sizeof(void*), (size_t) this->size))) {
-    free(this);
-    return NULL;
-  }
-  return this;
-}
-
-extern void
-array_list_free(struct array_list *this)
-{
-  int i;
-  for(i = 0; i < this->length; i++)
-    if(this->array[i]) this->free_fn(this->array[i]);
-  free(this->array);
-  free(this);
-}
-
-void*
-array_list_get_idx(struct array_list *this, int i)
-{
-  if(i >= this->length) return NULL;
-  return this->array[i];
-}
-
-static int array_list_expand_internal(struct array_list *this, int max)
-{
-  void *t;
-  int new_size;
-
-  if(max < this->size) return 0;
-  new_size = max(this->size << 1, max);
-  if(!(t = realloc(this->array, new_size*sizeof(void*)))) return -1;
-  this->array = t;
-  (void)memset(this->array + this->size, 0, (new_size-this->size)*sizeof(void*));
-  this->size = new_size;
-  return 0;
-}
-
-int
-array_list_put_idx(struct array_list *this, int idx, void *data)
-{
-  if(array_list_expand_internal(this, idx)) return -1;
-  if(this->array[idx]) this->free_fn(this->array[idx]);
-  this->array[idx] = data;
-  if(this->length <= idx) this->length = idx + 1;
-  return 0;
-}
-
-int
-array_list_add(struct array_list *this, void *data)
-{
-  return array_list_put_idx(this, this->length, data);
-}
-
-int
-array_list_length(struct array_list *this)
-{
-  return this->length;
-}
diff --git a/sm/lib/json-c/arraylist.h b/sm/lib/json-c/arraylist.h
deleted file mode 100644
index 2948e042a93b4f495921c0a453de717756063667..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/arraylist.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * $Id: arraylist.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _arraylist_h_
-#define _arraylist_h_
-
-#define ARRAY_LIST_DEFAULT_SIZE 32
-
-typedef void (array_list_free_fn) (void *data);
-
-struct array_list
-{
-  void **array;
-  int length;
-  int size;
-  array_list_free_fn *free_fn;
-};
-
-extern struct array_list*
-array_list_new(array_list_free_fn *free_fn);
-
-extern void
-array_list_free(struct array_list *al);
-
-extern void*
-array_list_get_idx(struct array_list *al, int i);
-
-extern int
-array_list_put_idx(struct array_list *al, int i, void *data);
-
-extern int
-array_list_add(struct array_list *al, void *data);
-
-extern int
-array_list_length(struct array_list *al);
-
-#endif
diff --git a/sm/lib/json-c/bits.h b/sm/lib/json-c/bits.h
deleted file mode 100644
index 2c107cce11a42fd1dd7821613e55dcb4666d1484..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/bits.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * $Id: bits.h,v 1.10 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _bits_h_
-#define _bits_h_
-
-#ifndef min
-#define min(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
-#ifndef max
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-#define hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
-#define error_ptr(error) ((void*)error)
-#define is_error(ptr) ((unsigned long)ptr > (unsigned long)-4000L)
-
-#endif
diff --git a/sm/lib/json-c/config.h.cmake b/sm/lib/json-c/config.h.cmake
deleted file mode 100644
index 7b920619e1e79f72a8fde1017a3a73619a92f8bd..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/config.h.cmake
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
-#define HAVE_DOPRNT ${HAVE_DOPRNT}
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H ${HAVE_FCNTL_H}
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H ${HAVE_INTTYPES_H}
-
-/* Define to 1 if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H ${HAVE_LIMITS_H}
-
-/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
-   to 0 otherwise. */
-#define HAVE_MALLOC ${HAVE_MALLOC}
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H ${HAVE_MEMORY_H}
-
-/* Define to 1 if you have the `open' function. */
-#define HAVE_OPEN ${HAVE_OPEN}
-
-/* Define to 1 if your system has a GNU libc compatible `realloc' function,
-   and to 0 otherwise. */
-#define HAVE_REALLOC ${HAVE_REALLOC}
-
-/* Define to 1 if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H ${HAVE_STDARG_H}
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H ${HAVE_STDINT_H}
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H ${HAVE_STDLIB_H}
-
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR ${HAVE_STRERROR}
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H ${HAVE_STRINGS_H}
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H ${HAVE_STRING_H}
-
-/* Define to 1 if you have the `strncasecmp' function. */
-#define HAVE_STRNCASECMP ${HAVE_STRNCASECMP}
-
-/* Define to 1 if you have the `strndup' function. */
-#define HAVE_STRNDUP ${HAVE_STRNDUP}
-
-/* Define to 1 if you have the <syslog.h> header file. */
-#define HAVE_SYSLOG_H ${HAVE_SYSLOG_H}
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H ${HAVE_SYS_PARAM_H}
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H}
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H ${HAVE_UNISTD_H}
-
-/* Define to 1 if you have the `vasprintf' function. */
-#define HAVE_VASPRINTF ${HAVE_VASPRINTF}
- 
-/* Define to 1 if you have the `vprintf' function. */
-#define HAVE_VPRINTF ${HAVE_VPRINTF}
-
-/* Define to 1 if you have the `vsnprintf' function. */
-#define HAVE_VSNPRINTF ${HAVE_VSNPRINTF}
-
-/* Define to 1 if you have the `vsyslog' function. */
-#define HAVE_VSYSLOG ${HAVE_VSYSLOG}
-
-
-/* Define to rpl_malloc if the replacement function should be used. */
-#if !HAVE_MALLOC
-#define malloc rpl_malloc
-#endif
-
-/* Define to rpl_realloc if the replacement function should be used. */
-#if !HAVE_REALLOC
-#define realloc rpl_realloc
-#endif
-
-
-
-
-
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define to empty if `const' does not conform to ANSI C. */
-#cmakedefine const
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#cmakedefine size_t
diff --git a/sm/lib/json-c/debug.c b/sm/lib/json-c/debug.c
deleted file mode 100644
index eaa6fca33c99bdc10437145427eff0c92b6b86a2..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/debug.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * $Id: debug.c,v 1.5 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-
-#if HAVE_SYSLOG_H
-# include <syslog.h>
-#endif /* HAVE_SYSLOG_H */
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-#if HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif /* HAVE_SYS_PARAM_H */
-
-#include "debug.h"
-
-static int _syslog = 0;
-static int _debug = 0;
-
-void mc_set_debug(int debug) { _debug = debug; }
-int mc_get_debug() { return _debug; }
-
-extern void mc_set_syslog(int syslog)
-{
-  _syslog = syslog;
-}
-
-void mc_abort(const char *msg, ...)
-{
-  va_list ap;
-  va_start(ap, msg);
-#if HAVE_VSYSLOG
-  if(_syslog) {
-	  vsyslog(LOG_ERR, msg, ap);
-  } else
-#endif
-	  vprintf(msg, ap);
-  exit(1);
-}
-
-
-void mc_debug(const char *msg, ...)
-{
-  va_list ap;
-  if(_debug) {
-    va_start(ap, msg);
-#if HAVE_VSYSLOG
-    if(_syslog) {
-		vsyslog(LOG_DEBUG, msg, ap);
-	} else
-#endif
-		vprintf(msg, ap);
-  }
-}
-
-void mc_error(const char *msg, ...)
-{
-  va_list ap;
-  va_start(ap, msg);
-#if HAVE_VSYSLOG
-    if(_syslog) {
-		vsyslog(LOG_ERR, msg, ap);
-	} else
-#endif
-		vfprintf(stderr, msg, ap);
-}
-
-void mc_info(const char *msg, ...)
-{
-  va_list ap;
-  va_start(ap, msg);
-#if HAVE_VSYSLOG
-    if(_syslog) {
-		vsyslog(LOG_INFO, msg, ap);
-	} else 
-#endif
-		vfprintf(stderr, msg, ap);
-}
diff --git a/sm/lib/json-c/debug.h b/sm/lib/json-c/debug.h
deleted file mode 100644
index 03a9b44f4f8c6adc4ea48791ccb35c7c136d8f44..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/debug.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * $Id: debug.h,v 1.5 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _DEBUG_H_
-#define _DEBUG_H_
-
-extern void mc_set_debug(int debug);
-extern int mc_get_debug(void);
-
-extern void mc_set_syslog(int syslog);
-extern void mc_abort(const char *msg, ...);
-extern void mc_debug(const char *msg, ...);
-extern void mc_error(const char *msg, ...);
-extern void mc_info(const char *msg, ...);
-
-#endif
diff --git a/sm/lib/json-c/json.h b/sm/lib/json-c/json.h
deleted file mode 100644
index e6bfbd716e879ad68f45c6f4f220e9c386e526a1..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/json.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * $Id: json.h,v 1.6 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _json_h_
-#define _json_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "bits.h"
-#include "debug.h"
-#include "linkhash.h"
-#include "arraylist.h"
-#include "json_util.h"
-#include "json_object.h"
-#include "json_tokener.h"
-#include "json_more_utils.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sm/lib/json-c/json_more_utils.c b/sm/lib/json-c/json_more_utils.c
deleted file mode 100644
index d714dafcfdbe88f03a16907b1a45977d74e4721a..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/json_more_utils.c
+++ /dev/null
@@ -1,331 +0,0 @@
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <math.h>
-#include "debug.h"
-#include "bits.h"
-#include "json_object.h"
-#include "json_more_utils.h" 
-#include "json_tokener.h"
-#include "JSON_checker.h"
-#include "linkhash.h"
-
-
-double convert_to_double(JO jo);
-
-#ifndef NAN
-#define NAN strtod("NaN",0)
-#endif
-
-int json_stream_skip(FILE*f) {
-	int count = 0;
-	JSON_checker_init();
-	while(1) {
-		char c;
-		if(1 != fread(&c,1,1,f)) {
-			if(feof(f)) {
-				if(count==0) return 0;
-				mc_error("EOF after %d bytes were read.\n", count);
-				return 0;
-			} 
-			mc_error("Reading error: %s\n", strerror(errno));
-			return 0;
-		} else {
-			if(!JSON_checker_push(c)) {
-				mc_error("Malformed JSON object. (read %d bytes).\n", count);
-				return 0;
-			}
-		
-			if(JSON_checker_finished())
-				return 1;
-		}
-		count++;
-	}
-}
-
-JO json_read_stream(FILE*f) {
-	
-	size_t buf_size = 100000;
-	char * buf = (char*) malloc(buf_size);
-	
-	int count = 0;
-	
-	JSON_checker_init();
-	while(1) {
-		if( ((size_t)count) > buf_size - 2) {
-			buf_size *= 2;
-			char * new_buf = realloc(buf, buf_size);
-			if(!new_buf) {
-				mc_error("Having read %d bytes, cannot allocate a block of size %d.",
-					count, buf_size);
-				free(buf);
-				return 0;
-			}
-			buf = new_buf;
-		}
-		char c;
-		if(1 != fread(&c,1,1,f)) {
-			if(feof(f)) {
-				if(count==0) { free(buf); return 0; }
-				mc_error("EOF while %d were read: \n\t'%.*s'. \n", count, count, buf);
-				free(buf); return 0;
-			} 
-			mc_error("Reading error: %s\n", strerror(errno));
-			return 0;
-		} else {
-			if(count==0 && isspace(c)) continue;
-			
-			buf[count] = c;
-			count++;
-
-			if(!JSON_checker_push(c)) {
-				mc_error("Malformed JSON object: \n'%.*s'\n", count, buf);
-				free(buf); return 0;
-			}
-			
-			if(JSON_checker_finished()) {
-/*				sm_de("Found object.\n"); */
-				JO jo = json_tokener_parse_len(buf, count);
-
-				free(buf); return jo;
-			}
-			
-		}
-	}
-}
-
-
-
-struct json_object* json_tokener_parse_len(const char *str, int len) {
-  struct json_tokener* tok;
-  struct json_object* obj;
-
-  tok = json_tokener_new();
-  obj = json_tokener_parse_ex(tok, str, len);
-  if(tok->err != json_tokener_success) {
-    obj = error_ptr(-tok->err);
-    json_tokener_free(tok);
-	mc_error("Malformed JSON object: \n'%.*s'\n", len, str);
-	 return 0;
-  }
-  json_tokener_free(tok);
-  return obj;
-}
-
-int jo_has_field(JO s, const char*name) {
-	return json_object_object_get(s, name) != 0;
-}
-
-
-int jo_read_double_array(JO s, const char*name, double*p, int n, double when_null) {
-	JO jo = json_object_object_get(s, name);
-	if(!jo) {
-/*		mc_error("Field '%s' not found.\n", name); */
-		return 0;
-	}
-	
-	return jo_read_from_double_array (jo, p, n, when_null);
-}
-
-/* Returns 0 if jo is not a double array, or its length is not n */
-int jo_read_from_double_array (JO jo, double *p, int n, double when_null) {
-	if(!json_object_is_type(jo, (enum json_type) json_type_array)) {
-		mc_error("This is not an array: '%s'\n",json_object_to_json_string(jo));
-		return 0;
-	}
-
-	{
-		int size = json_object_array_length(jo);
-		if(size < n) {
-			mc_error("I expected at least %d elements, got %d. \nArray: '%s'\n",
-				n, size, json_object_to_json_string(jo));
-			return 0;
-		}
-	}
-
-	{
-	int i; for(i=0;i<n;i++) {
-		JO v = json_object_array_get_idx(jo, i);
-		if(!v)
-			p[i] = when_null;
-		else
-		 	if(json_object_is_type(v, (enum json_type) json_type_double)) {
-				p[i] = json_object_get_double(v);
-			} else
-			if(json_object_is_type(v, (enum json_type) json_type_int)) {
-				p[i] = json_object_get_int(v);
-			} else
-			p[i] = when_null;
-	}
-	}
-	return 1;
-}
-
-
-
-
-int jo_read_int_array(JO s, const char*name, int*p, int n, int when_null) {
-	int size, i;
-	JO jo = json_object_object_get(s, name);
-	if(!jo) {
-/*		mc_error("Field '%s' not found.\n", name); */
-		return 0;
-	}
-	if(!json_object_is_type(jo, (enum json_type) json_type_array)) {
-		mc_error("This is not an array: '%s'\n",json_object_to_json_string(jo));
-		return 0;
-	}
-	size = json_object_array_length(jo);
-	if(size < n) {
-		mc_error("I expected at least %d elements, got %d. \nArray: '%s'\n",
-			n, size, json_object_to_json_string(jo));
-		return 0;
-	}
-	for(i=0;i<n;i++) {
-		JO v = json_object_array_get_idx(jo, i);
-		if(!v || !json_object_is_type(v, (enum json_type) json_type_int))
-			p[i] = when_null;
-		else
-			p[i] = json_object_get_int(v);
-	}
-	return 1; /** XXX should we thro error? */
-}
-
-JO jo_double_or_null(double v) {
-	return (v == v) ?  /* NAN is null */
-		json_object_new_double(v) : jo_new_null() ;
-}
-
-JO jo_new_double_array(const double *v, int n) {
-	JO array = json_object_new_array();
-	int i; for(i=0;i<n;i++) {
-		json_object_array_add(array, jo_double_or_null(v[i]));
-	}
-	return array;
-}
-
-JO jo_new_int_array(const int *v, int n) {
-	JO array = json_object_new_array();
-	int i; for(i=0;i<n;i++) {
-		json_object_array_add(array, json_object_new_int(v[i]));
-	}
-	return array;
-}
-
-/** XXX forse ho fatto casino */
-int json_to_int(JO jo, int*ptr) {
-	
-	if(!jo) {
-/*		mc_error("Field '%s' not found.\n", name); */
-		return 0;
-	}
-	
-	if(!json_object_is_type(jo, (enum json_type) json_type_int)) {
-		mc_error("I was looking for a int, instead got '%s'.\n",
-		         json_object_to_json_string(jo));
-		return 0;
-	}
-	
-	*ptr = json_object_get_int(jo);
-	
-	return 1;
-}
-
-int json_to_double(JO jo, double*ptr) {
-	if(json_object_is_type(jo, (enum json_type) json_type_double)) {
-		*ptr = json_object_get_double(jo);
-		return 1;
-	} else if(json_object_is_type(jo, (enum json_type) json_type_int)) {
-		*ptr = json_object_get_int(jo);
-		return 1;
-	} else{
-		*ptr = NAN;
-		return 0;
-	}
-}
-
-int jo_read_int(JO jo, const char*name, int*p) {
-	JO v = json_object_object_get(jo, name);
-	if(!v) {
-		return 0;
-	}
-	return json_to_int(v, p);
-}
-
-double convert_to_double(JO jo) {
-	if(json_object_is_type(jo, (enum json_type) json_type_double)) 
-		return json_object_get_double(jo);
-	else if(json_object_is_type(jo, (enum json_type) json_type_int)) {
-		return json_object_get_int(jo);
-	}
-	else 
-		return NAN;
-}
-
-int jo_read_double(JO jo, const char*name, double*p) {
-	JO v = json_object_object_get(jo, name);
-	
-	if(!v) {
-/*		mc_error("Field '%s' not found.\n", name); */
-		return 0;
-	}
-	
-	*p = convert_to_double(v);
-	return 1;
-}
-
-
-int jo_read_string(JO jo, const char*name,  char*dest_string, size_t max_len) {
-	JO v = json_object_object_get(jo, name);
-	if(!v) return 0;
-	if(json_object_is_type(v, (enum json_type) json_type_string))  {
-		strncpy(dest_string, json_object_get_string(v), max_len);
-		return 1;
-	} else {
-		strncpy(dest_string, "<string not found>", max_len);
-		return 0;
-	}
-}
-
-void jo_add_string(JO root, const char*name, const char*v) {
-	jo_add(root, name, jo_new_string(v));
-}
-
-void jo_add_double_array(JO root, const char*name, const double*v, int n) {
-	jo_add(root, name, jo_new_double_array(v, n));
-}
-
-void jo_add_int_array(JO root, const char*name, const int*v, int n) {
-	jo_add(root, name, jo_new_int_array(v, n));
-}
-
-void jo_add_int(JO root, const char*name, int v) {
-	jo_add(root, name, jo_new_int(v));
-}
-
-void jo_add_double(JO root, const char*name, double v) {
-	jo_add(root, name, jo_double_or_null(v));
-}
-
-JO json_parse(const char*str) {
-	return json_tokener_parse_len(str, (int)strlen(str));
-}
-
-const char* json_write(JO jo) {
-	return json_object_to_json_string(jo);
-}
-
-/*
-JO find_object_with_name(JO root, const char*name) {
-	json_object_object_foreach(root, key, val) {
-		if(!strcmp(key, name)) return root;
-		if(json_object_is_type(val, json_type_object)) {
-			JO jo = find_object_with_name(val, name);
-			if(jo) return jo;
-		}
-	}
-	return 0;
-}*/
-
diff --git a/sm/lib/json-c/json_more_utils.h b/sm/lib/json-c/json_more_utils.h
deleted file mode 100644
index 385ed818adb0a3329011ac88c05e68f92199f88a..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/json_more_utils.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef H_JSON_MORE_UTILS
-#define H_JSON_MORE_UTILS
-
-#include <stdio.h>
-#include "json_object.h"
-
-typedef struct json_object* JO;
-
-#define jo_new_double json_object_new_double 
-#define jo_new_int    json_object_new_int
-#define jo_new_array  json_object_new_array
-#define jo_new_string json_object_new_string
-#define jo_new_null()   0
-#define jo_add        json_object_object_add
-#define jo_del        json_object_object_del
-#define jo_free       json_object_put
-#define jo_get        json_object_object_get
-#define jo_new        json_object_new_object
-#define jo_array_add  json_object_array_add
-#define jo_array_get  json_object_array_get_idx
-#define jo_array_length json_object_array_length
-#define jo_get_string json_object_get_string 
-
-/** Reads a JSON object from stream.
-    Returns 0 on error. XXX: does not support unicode. */
-JO json_read_stream(FILE*);
-
-/** Skips one object from stream (without parsing it).
-    Returns 0 on error. XXX: does not support unicode. */
-int json_stream_skip(FILE*);
-
-/** Return true if there is a field */
-int jo_has_field(JO s, const char*name);
-
-JO jo_new_double_array(const double *v, int n);
-JO jo_new_int_array   (const int    *v, int n);
-
-void jo_add_double       (JO parent, const char*name, double v);
-void jo_add_int          (JO parent, const char*name, int    v);
-void jo_add_double_array (JO parent, const char*name, const double *v, int n);
-void jo_add_int_array    (JO parent, const char*name, const int    *v, int n);
-
-void jo_add_string       (JO parent, const char*name, const char*v);
-
-/** Return 0 if there isn't a field called 'name' */
-int jo_read_int          (JO parent, const char*name, int*p) ;
-/** This also tolerates an integer */
-int jo_read_double       (JO parent, const char*name, double*p);
-
-/* Returns 0 if there isn't a field called "name", or it's not an array, or 
-its length is not at least "n". Else, it returns 1. */
-int jo_read_double_array (JO parent, const char*name, double *p, int n, double when_null);
-int jo_read_int_array    (JO parent, const char*name, int    *p, int n, int    when_null);
-int jo_read_string       (JO parent, const char*name, char*v, size_t max_len);
-
-
-/* Returns 0 if jo is not a double array, or its length is not n */
-int jo_read_from_double_array (JO array, double *p, int n, double when_null);
-
-
-int json_to_int(JO jo, int*ptr);
-
-/** Converts an integer or a double to a double, 
-    or else *ptr will be set to NAN. */
-int json_to_double(JO jo, double*ptr);
-
-	
-/* returns 0 if NAN */
-JO jo_double_or_null(double d);
-
-/*JO find_object_with_name(JO root, const char*name);*/
-JO json_tokener_parse_len(const char *str, int len);
-JO json_parse(const char*str);
-const char* json_write(JO jo);
-#define jo_to_string json_write
-
-#endif
diff --git a/sm/lib/json-c/json_object.c b/sm/lib/json-c/json_object.c
deleted file mode 100644
index b32740e8d6626103d3115760e5660ffad085a4f7..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/json_object.c
+++ /dev/null
@@ -1,541 +0,0 @@
-/*
- * $Id: json_object.c,v 1.17 2006/07/25 03:24:50 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#include <assert.h>
-#include "config.h"
-
-/* This is an hack for strndup */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <string.h>
-#include <strings.h>
-
-#include "debug.h"
-#include "printbuf.h"
-#include "linkhash.h"
-#include "arraylist.h"
-#include "json_object.h"
-#include "json_object_private.h"
-#include "json_tokener.h"
-
-/*#if !HAVE_STRNDUP*/
-  char* json_c_strndup(const char* str, size_t n);
-/*#endif  !HAVE_STRNDUP */
-
-/* #define REFCOUNT_DEBUG 1 */
-
-const char *json_number_chars = "0123456789.+-e";
-const char *json_hex_chars = "0123456789abcdef";
-
-#ifdef REFCOUNT_DEBUG
-static const char* json_type_name[] = {
-  "null",
-  "boolean",
-  "double",
-  "int",
-  "object",
-  "array",
-  "string",
-};
-#endif /* REFCOUNT_DEBUG */
-
-static void json_object_generic_delete(struct json_object* this);
-static struct json_object* json_object_new(enum json_type o_type);
-
-
-/* ref count debugging */
-
-#ifdef REFCOUNT_DEBUG
-
-static struct lh_table *json_object_table;
-
-static void json_object_init() __attribute__ ((constructor));
-static void json_object_init() {
-  mc_debug("json_object_init: creating object table\n");
-  json_object_table = lh_kptr_table_new(128, "json_object_table", NULL);
-}
-
-static void json_object_fini() __attribute__ ((destructor));
-static void json_object_fini() {
-  struct lh_entry *ent;
-  if(mc_get_debug() && json_object_table->count) {
-    mc_debug("json_object_fini: %d referenced objects at exit\n",
-	     json_object_table->count);
-    lh_foreach(json_object_table, ent) {
-      struct json_object* obj = (struct json_object*)ent->v;
-      mc_debug("\t%s:%p\n", json_type_name[obj->o_type], obj);
-    }
-  }
-  mc_debug("json_object_fini: freeing object table\n");
-  lh_table_free(json_object_table);
-}
-#endif /* REFCOUNT_DEBUG */
-
-
-/* string escaping */
-
-static int json_escape_str(struct printbuf *pb, char *str)
-{
-  int pos = 0, start_offset = 0;
-  unsigned char c;
-  do {
-    c = str[pos];
-    switch(c) {
-    case '\0':
-      break;
-    case '\b':
-    case '\n':
-    case '\r':
-    case '\t':
-    case '"':
-    case '\\':
-    case '/':
-      if(pos - start_offset > 0)
-	printbuf_memappend(pb, str + start_offset, pos - start_offset);
-      if(c == '\b') printbuf_memappend(pb, "\\b", 2);
-      else if(c == '\n') printbuf_memappend(pb, "\\n", 2);
-      else if(c == '\r') printbuf_memappend(pb, "\\r", 2);
-      else if(c == '\t') printbuf_memappend(pb, "\\t", 2);
-      else if(c == '"') printbuf_memappend(pb, "\\\"", 2);
-      else if(c == '\\') printbuf_memappend(pb, "\\\\", 2);
-      else if(c == '/') printbuf_memappend(pb, "\\/", 2);
-      start_offset = ++pos;
-      break;
-    default:
-      if(c < ' ') {
-	if(pos - start_offset > 0)
-	  printbuf_memappend(pb, str + start_offset, pos - start_offset);
-	sprintbuf(pb, "\\u00%c%c",
-		  json_hex_chars[c >> 4],
-		  json_hex_chars[c & 0xf]);
-	start_offset = ++pos;
-      } else pos++;
-    }
-  } while(c);
-  if(pos - start_offset > 0)
-    printbuf_memappend(pb, str + start_offset, pos - start_offset);
-  return 0;
-}
-
-
-/* reference counting */
-
-extern struct json_object* json_object_get(struct json_object *this)
-{
-  if(this) {
-    this->_ref_count++;
-  }
-  return this;
-}
-
-extern void json_object_put(struct json_object *this)
-{
-  if(this) {
-    this->_ref_count--;
-    if(!this->_ref_count) this->_delete(this);
-  }
-}
-
-
-/* generic object construction and destruction parts */
-
-static void json_object_generic_delete(struct json_object* this)
-{
-#ifdef REFCOUNT_DEBUG
-  mc_debug("json_object_delete_%s: %p\n",
-	   json_type_name[this->o_type], this);
-  lh_table_delete(json_object_table, this);
-#endif /* REFCOUNT_DEBUG */
-  printbuf_free(this->_pb);
-  free(this);
-}
-
-static struct json_object* json_object_new(enum json_type o_type)
-{
-  struct json_object *this = calloc(sizeof(struct json_object), 1);
-  if(!this) return NULL;
-  this->o_type = o_type;
-  this->_ref_count = 1;
-  this->_delete = &json_object_generic_delete;
-#ifdef REFCOUNT_DEBUG
-  lh_table_insert(json_object_table, this, this);
-  mc_debug("json_object_new_%s: %p\n", json_type_name[this->o_type], this);
-#endif /* REFCOUNT_DEBUG */
-  return this;
-}
-
-
-/* type checking functions */
-
-/*int json_object_is_type(struct json_object *this, enum json_type type)*/
-int json_object_is_type(struct json_object *this, int type)
-{
-	if(!this && json_type_null == type) return 1;
-  return (this->o_type == type);
-}
-
-enum json_type json_object_get_type(struct json_object *this)
-{
-  if(!this) return json_type_null;
-  return this->o_type;
-}
-
-
-/* json_object_to_json_string */
-
-const char* json_object_to_json_string(struct json_object *this)
-{
-  if(!this) return "null";
-  if(!this->_pb) {
-    if(!(this->_pb = printbuf_new())) return NULL;
-  } else {
-    printbuf_reset(this->_pb);
-  }
-  if(this->_to_json_string(this, this->_pb) < 0) return NULL;
-  return this->_pb->buf;
-}
-
-
-/* json_object_object */
-
-static int json_object_object_to_json_string(struct json_object* this,
-					     struct printbuf *pb)
-{
-  int i=0;
-  struct json_object_iter iter;
-  sprintbuf(pb, "{");
-
-  /* CAW: scope operator to make ANSI correctness */
-  /* CAW: switched to json_object_object_foreachC which uses an iterator struct */
-	json_object_object_foreachC(this, iter) {
-			if(i) sprintbuf(pb, ",");
-			sprintbuf(pb, " \"");
-			json_escape_str(pb, iter.key);
-			sprintbuf(pb, "\": ");
-			if(iter.val == NULL) sprintbuf(pb, "null");
-			else iter.val->_to_json_string(iter.val, pb);
-			i++;
-	}
-
-  return sprintbuf(pb, " }");
-}
-
-static void json_object_lh_entry_free(struct lh_entry *ent)
-{
-  free(ent->k);
-  json_object_put((struct json_object*)ent->v);
-}
-
-static void json_object_object_delete(struct json_object* this)
-{
-  lh_table_free(this->o.c_object);
-  json_object_generic_delete(this);
-}
-
-struct json_object* json_object_new_object()
-{
-  struct json_object *this = json_object_new(json_type_object);
-  if(!this) return NULL;
-  this->_delete = &json_object_object_delete;
-  this->_to_json_string = &json_object_object_to_json_string;
-  this->o.c_object = lh_kchar_table_new(JSON_OBJECT_DEF_HASH_ENTIRES,
-					NULL, &json_object_lh_entry_free);
-  return this;
-}
-
-struct lh_table* json_object_get_object(struct json_object *this)
-{
-  if(!this) return NULL;
-  switch(this->o_type) {
-  case json_type_object:
-    return this->o.c_object;
-  default:
-    return NULL;
-  }
-}
-
-void json_object_object_add(struct json_object* this, const char *key,
-			    struct json_object *val)
-{
-  lh_table_delete(this->o.c_object,  (char*) key);
-  lh_table_insert(this->o.c_object, strdup(key), val);
-}
-
-struct json_object* json_object_object_get(struct json_object* this, const char *key)
-{
-  return (struct json_object*) lh_table_lookup(this->o.c_object, (char*)key);
-}
-
-void json_object_object_del(struct json_object* this, const char *key)
-{
-  lh_table_delete(this->o.c_object,  (char*) key);
-}
-
-
-/* json_object_boolean */
-
-static int json_object_boolean_to_json_string(struct json_object* this,
-					      struct printbuf *pb)
-{
-  if(this->o.c_boolean) return sprintbuf(pb, "true");
-  else return sprintbuf(pb, "false");
-}
-
-struct json_object* json_object_new_boolean(boolean b)
-{
-  struct json_object *this = json_object_new(json_type_boolean);
-  if(!this) return NULL;
-  this->_to_json_string = &json_object_boolean_to_json_string;
-  this->o.c_boolean = b;
-  return this;
-}
-
-boolean json_object_get_boolean(struct json_object *this)
-{
-  if(!this) return FALSE;
-  switch(this->o_type) {
-  case json_type_boolean:
-    return this->o.c_boolean;
-  case json_type_int:
-    return (this->o.c_int != 0);
-  case json_type_double:
-    return (this->o.c_double != 0);
-  case json_type_string:
-    if(strlen(this->o.c_string)) return TRUE;
-  default:
-    return TRUE;
-  }
-}
-
-
-/* json_object_int */
-
-static int json_object_int_to_json_string(struct json_object* this,
-					  struct printbuf *pb)
-{
-  return sprintbuf(pb, "%d", this->o.c_int);
-}
-
-struct json_object* json_object_new_int(int i)
-{
-  struct json_object *this = json_object_new(json_type_int);
-  if(!this) return NULL;
-  this->_to_json_string = &json_object_int_to_json_string;
-  this->o.c_int = i;
-  return this;
-}
-
-int json_object_get_int(struct json_object *this)
-{
-  int cint;
-
-  if(!this) return 0;
-  switch(this->o_type) {
-  case json_type_int:
-    return this->o.c_int;
-  case json_type_double:
-    return (int)this->o.c_double;
-  case json_type_boolean:
-    return this->o.c_boolean;
-  case json_type_string:
-    if(sscanf(this->o.c_string, "%d", &cint) == 1) return cint;
-  default:
-    return 0;
-  }
-}
-
-const char *float_format = "%e";
-
-void json_set_float_format(const char*f) {
-    float_format = f;
-}
-
-/* json_object_double */
-
-static int json_object_double_to_json_string(struct json_object* this,
-					     struct printbuf *pb)
-{
-#define AC_BETTER_PRECISION
-#ifdef AC_BETTER_PRECISION
-//#warning json: Using better precision in printing floats
-	if( ((int) this->o.c_double) !=  this->o.c_double)
-//		return sprintbuf(pb, "%g", this->o.c_double);
-	    return sprintbuf(pb, float_format, this->o.c_double);
-	else
-		return sprintbuf(pb, "%d.0", (int) this->o.c_double);
-#else
-  return sprintbuf(pb, "%lf", this->o.c_double);
-
-#endif
-
-}
-
-struct json_object* json_object_new_double(double d)
-{
-  struct json_object *this = json_object_new(json_type_double);
-  if(!this) return NULL;
-  this->_to_json_string = &json_object_double_to_json_string;
-  this->o.c_double = d;
-  return this;
-}
-
-double json_object_get_double(struct json_object *this)
-{
-  double cdouble;
-
-  if(!this) return 0.0;
-  switch(this->o_type) {
-  case json_type_double:
-    return this->o.c_double;
-  case json_type_int:
-    return this->o.c_int;
-  case json_type_boolean:
-    return this->o.c_boolean;
-  case json_type_string:
-    if(sscanf(this->o.c_string, "%lf", &cdouble) == 1) return cdouble;
-  default:
-    return 0.0;
-  }
-}
-
-
-/* json_object_string */
-
-static int json_object_string_to_json_string(struct json_object* this,
-					     struct printbuf *pb)
-{
-  sprintbuf(pb, "\"");
-  json_escape_str(pb, this->o.c_string);
-  sprintbuf(pb, "\"");
-  return 0;
-}
-
-static void json_object_string_delete(struct json_object* this)
-{
-  free(this->o.c_string);
-  json_object_generic_delete(this);
-}
-
-struct json_object* json_object_new_string(const char *s)
-{
-  struct json_object *this = json_object_new(json_type_string);
-  if(!this) return NULL;
-  this->_delete = &json_object_string_delete;
-  this->_to_json_string = &json_object_string_to_json_string;
-  this->o.c_string = json_c_strndup(s, strlen(s));
-  return this;
-}
-
-struct json_object* json_object_new_string_len(const char *s, int len)
-{
-  struct json_object *this = json_object_new(json_type_string);
-  if(!this) return NULL;
-  this->_delete = &json_object_string_delete;
-  this->_to_json_string = &json_object_string_to_json_string;
-  this->o.c_string = json_c_strndup(s, (size_t)len);
-  return this;
-}
-
-char* json_object_get_string(struct json_object *this)
-{
-  if(!this) return NULL;
-  switch(this->o_type) {
-  case json_type_string:
-    return this->o.c_string;
-  default:
-    return json_object_to_json_string(this);
-  }
-}
-
-
-/* json_object_array */
-
-static int json_object_array_to_json_string(struct json_object* this,
-					    struct printbuf *pb)
-{
-  int i;
-  sprintbuf(pb, "[");
-  for(i=0; i < json_object_array_length(this); i++) {
-	  struct json_object *val;
-	  if(i) { sprintbuf(pb, ", "); }
-	  else { sprintbuf(pb, " "); }
-
-      val = json_object_array_get_idx(this, i);
-	  if(val == NULL) { sprintbuf(pb, "null"); }
-	  else { val->_to_json_string(val, pb); }
-  }
-  return sprintbuf(pb, " ]");
-}
-
-static void json_object_array_entry_free(void *data)
-{
-  json_object_put((struct json_object*)data);
-}
-
-static void json_object_array_delete(struct json_object* this)
-{
-	assert(json_object_is_type(this, json_type_array));
-  array_list_free(this->o.c_array);
-  json_object_generic_delete(this);
-}
-
-struct json_object* json_object_new_array()
-{
-  struct json_object *this = json_object_new(json_type_array);
-  if(!this) return NULL;
-  this->_delete = &json_object_array_delete;
-  this->_to_json_string = &json_object_array_to_json_string;
-  this->o.c_array = array_list_new(&json_object_array_entry_free);
-  return this;
-}
-
-struct array_list* json_object_get_array(struct json_object *this)
-{
-  if(!this) return NULL;
-  switch(this->o_type) {
-  case json_type_array:
-    return this->o.c_array;
-  default:
-    return NULL;
-  }
-}
-
-int json_object_array_length(struct json_object *this)
-{
-	assert(json_object_is_type(this, json_type_array));
-	return array_list_length(this->o.c_array);
-}
-
-int json_object_array_add(struct json_object *this,struct json_object *val)
-{
-	assert(json_object_is_type(this, json_type_array));
-	return array_list_add(this->o.c_array, val);
-}
-
-int json_object_array_put_idx(struct json_object *this, int idx,
-			      struct json_object *val)
-{
-	assert(json_object_is_type(this, json_type_array));
-	return array_list_put_idx(this->o.c_array, idx, val);
-}
-
-struct json_object* json_object_array_get_idx(struct json_object *this,
-					      int idx)
-{
-	assert(json_object_is_type(this, json_type_array));
-	return (struct json_object*)array_list_get_idx(this->o.c_array, idx);
-}
-
diff --git a/sm/lib/json-c/json_object.h b/sm/lib/json-c/json_object.h
deleted file mode 100644
index 1d589ca6a3de3c3107c2d54c1c1142baa3d09657..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/json_object.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * $Id: json_object.h,v 1.12 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _json_object_h_
-#define _json_object_h_
-
-#define JSON_OBJECT_DEF_HASH_ENTIRES 16
-
-#undef FALSE
-#define FALSE ((boolean)0)
-
-#undef TRUE
-#define TRUE ((boolean)1)
-
-extern const char *json_number_chars;
-extern const char *json_hex_chars;
-
-/* forward structure definitions */
-
-typedef int boolean;
-struct printbuf;
-struct lh_table;
-struct array_list;
-struct json_object;
-struct json_object_iter;
-
-/* supported object types */
-
-enum json_type {
-  json_type_null,
-  json_type_boolean,
-  json_type_double,
-  json_type_int,
-  json_type_object,
-  json_type_array,
-  json_type_string
-};
-
-/* reference counting functions */
-
-
-
-
-/**
- * Increment the reference count of json_object
- * @param obj the json_object instance
- */
-extern struct json_object* json_object_get(struct json_object *obj);
-
-/**
- * Decrement the reference count of json_object and free if it reaches zero
- * @param obj the json_object instance
- */
-extern void json_object_put(struct json_object *obj);
-
-
-/**
- * Check if the json_object is of a given type
- * @param obj the json_object instance
- * @param type one of:
-     json_type_boolean,
-     json_type_double,
-     json_type_int,
-     json_type_object,
-     json_type_array,
-     json_type_string,
- */
-/*extern int json_object_is_type(struct json_object *obj, enum json_type type);*/
-extern int json_object_is_type(struct json_object *obj, int type);
-
-/**
- * Get the type of the json_object
- * @param obj the json_object instance
- * @returns type being one of:
-     json_type_boolean,
-     json_type_double,
-     json_type_int,
-     json_type_object,
-     json_type_array,
-     json_type_string,
- */
-extern enum json_type json_object_get_type(struct json_object *obj);
-
-
-/** Stringify object to json format
- * @param obj the json_object instance
- * @returns a string in JSON format
- */
-extern const char* json_object_to_json_string(struct json_object *obj);
-
-
-/* object type methods */
-
-/** Create a new empty object
- * @returns a json_object of type json_type_object
- */
-extern struct json_object* json_object_new_object(void);
-
-/** Get the hashtable of a json_object of type json_type_object
- * @param obj the json_object instance
- * @returns a linkhash
- */
-extern struct lh_table* json_object_get_object(struct json_object *obj);
-
-/** Add an object field to a json_object of type json_type_object
- *
- * The reference count will *not* be incremented. This is to make adding
- * fields to objects in code more compact. If you want to retain a reference
- * to an added object you must wrap the passed object with json_object_get
- *
- * @param obj the json_object instance
- * @param key the object field name (a private copy will be duplicated)
- * @param val a json_object or NULL member to associate with the given field
- */
-extern void json_object_object_add(struct json_object* obj, const char *key,
-				   struct json_object *val);
-
-/** Get the json_object associate with a given object field
- * @param obj the json_object instance
- * @param key the object field name
- * @returns the json_object associated with the given field name
- */
-extern struct json_object* json_object_object_get(struct json_object* obj,
-						  const char *key);
-
-/** Delete the given json_object field
- *
- * The reference count will be decremented for the deleted object
- *
- * @param obj the json_object instance
- * @param key the object field name
- */
-extern void json_object_object_del(struct json_object* obj, const char *key);
-
-/** Iterate through all keys and values of an object
- * @param obj the json_object instance
- * @param key the local name for the char* key variable defined in the body
- * @param val the local name for the json_object* object variable defined in the body
- */
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-# define json_object_object_foreach(obj,key,val) \
- char *key; struct json_object *val; \
- for(struct lh_entry *entry = json_object_get_object(obj)->head; ({ if(entry) { key = (char*)entry->k; val = (struct json_object*)entry->v; } ; entry; }); entry = entry->next )
-
-#else /* ANSI C or MSC */
-
-# define json_object_object_foreach(obj,key,val) \
- char *key; struct json_object *val; struct lh_entry *entry; \
- for(entry = json_object_get_object(obj)->head; (entry ? (key = (char*)entry->k, val = (struct json_object*)entry->v, entry) : 0); entry = entry->next)
-
-#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) */
-
-/** Iterate through all keys and values of an object (ANSI C Safe)
- * @param obj the json_object instance
- * @param iter the object iterator
- */
-#define json_object_object_foreachC(obj,iter) \
- for(iter.entry = json_object_get_object(obj)->head; (iter.entry ? (iter.key = (char*)iter.entry->k, iter.val = (struct json_object*)iter.entry->v, iter.entry) : 0); iter.entry = iter.entry->next)
-
-/* Array type methods */
-
-/** Create a new empty json_object of type json_type_array
- * @returns a json_object of type json_type_array
- */
-extern struct json_object* json_object_new_array(void);
-
-/** Get the arraylist of a json_object of type json_type_array
- * @param obj the json_object instance
- * @returns an arraylist
- */
-extern struct array_list* json_object_get_array(struct json_object *obj);
-
-/** Get the length of a json_object of type json_type_array
- * @param obj the json_object instance
- * @returns an int
- */
-extern int json_object_array_length(struct json_object *obj);
-
-/** Add an element to the end of a json_object of type json_type_array
- *
- * The reference count will *not* be incremented. This is to make adding
- * fields to objects in code more compact. If you want to retain a reference
- * to an added object you must wrap the passed object with json_object_get
- *
- * @param obj the json_object instance
- * @param val the json_object to be added
- */
-extern int json_object_array_add(struct json_object *obj,
-				 struct json_object *val);
-
-/** Insert or replace an element at a specified index in an array (a json_object of type json_type_array)
- *
- * The reference count will *not* be incremented. This is to make adding
- * fields to objects in code more compact. If you want to retain a reference
- * to an added object you must wrap the passed object with json_object_get
- *
- * The reference count of a replaced object will be decremented.
- *
- * The array size will be automatically be expanded to the size of the
- * index if the index is larger than the current size.
- *
- * @param obj the json_object instance
- * @param idx the index to insert the element at
- * @param val the json_object to be added
- */
-extern int json_object_array_put_idx(struct json_object *obj, int idx,
-				     struct json_object *val);
-
-/** Get the element at specificed index of the array (a json_object of type json_type_array)
- * @param obj the json_object instance
- * @param idx the index to get the element at
- * @returns the json_object at the specified index (or NULL)
- */
-extern struct json_object* json_object_array_get_idx(struct json_object *obj,
-						     int idx);
-
-/* boolean type methods */
-
-/** Create a new empty json_object of type json_type_boolean
- * @param b a boolean TRUE or FALSE (0 or 1)
- * @returns a json_object of type json_type_boolean
- */
-extern struct json_object* json_object_new_boolean(boolean b);
-
-/** Get the boolean value of a json_object
- *
- * The type is coerced to a boolean if the passed object is not a boolean.
- * integer and double objects will return FALSE if there value is zero
- * or TRUE otherwise. If the passed object is a string it will return
- * TRUE if it has a non zero length. If any other object type is passed
- * TRUE will be returned if the object is not NULL.
- *
- * @param obj the json_object instance
- * @returns a boolean
- */
-extern boolean json_object_get_boolean(struct json_object *obj);
-
-
-/* int type methods */
-
-/** Create a new empty json_object of type json_type_int
- * @param i the integer
- * @returns a json_object of type json_type_int
- */
-extern struct json_object* json_object_new_int(int i);
-
-/** Get the int value of a json_object
- *
- * The type is coerced to a int if the passed object is not a int.
- * double objects will return their integer conversion. Strings will be
- * parsed as an integer. If no conversion exists then 0 is returned.
- *
- * @param obj the json_object instance
- * @returns an int
- */
-extern int json_object_get_int(struct json_object *obj);
-
-
-/* double type methods */
-
-/** Create a new empty json_object of type json_type_double
- * @param d the double
- * @returns a json_object of type json_type_double
- */
-extern struct json_object* json_object_new_double(double d);
-
-/** Get the double value of a json_object
- *
- * The type is coerced to a double if the passed object is not a double.
- * integer objects will return their dboule conversion. Strings will be
- * parsed as a double. If no conversion exists then 0.0 is returned.
- *
- * @param obj the json_object instance
- * @returns an double
- */
-extern double json_object_get_double(struct json_object *obj);
-
-
-/* string type methods */
-
-/** Create a new empty json_object of type json_type_string
- *
- * A copy of the string is made and the memory is managed by the json_object
- *
- * @param s the string
- * @returns a json_object of type json_type_string
- */
-extern struct json_object* json_object_new_string(const char *s);
-
-extern struct json_object* json_object_new_string_len(const char *s, int len);
-
-/** Get the string value of a json_object
- *
- * If the passed object is not of type json_type_string then the JSON
- * representation of the object is returned.
- *
- * The returned string memory is managed by the json_object and will
- * be freed when the reference count of the json_object drops to zero.
- *
- * @param obj the json_object instance
- * @returns a string
- */
-extern char* json_object_get_string(struct json_object *obj);
-
-extern void json_set_float_format(const char*f);
-
-#endif
diff --git a/sm/lib/json-c/json_object_private.h b/sm/lib/json-c/json_object_private.h
deleted file mode 100644
index 5e83e90cc3de26c0f3730a01cae4d14e3fc72b4d..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/json_object_private.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * $Id: json_object_private.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _json_object_private_h_
-#define _json_object_private_h_
-
-#include "json_object.h"
-
-typedef void (json_object_delete_fn)(struct json_object *o);
-typedef int (json_object_to_json_string_fn)(struct json_object *o,
-					    struct printbuf *pb);
-
-struct json_object
-{
-  enum json_type o_type;
-  json_object_delete_fn *_delete;
-  json_object_to_json_string_fn *_to_json_string;
-  int _ref_count;
-  struct printbuf *_pb;
-  union data {
-    boolean c_boolean;
-    double c_double;
-    int c_int;
-    struct lh_table *c_object;
-    struct array_list *c_array;
-    char *c_string;
-  } o;
-};
-
-/* CAW: added for ANSI C iteration correctness */
-struct json_object_iter
-{
-	char *key;
-	struct json_object *val;
-	struct lh_entry *entry;
-};
-
-#endif
diff --git a/sm/lib/json-c/json_tokener.c b/sm/lib/json-c/json_tokener.c
deleted file mode 100644
index 3df87becb41476f8fcff2ced0129f3c291098d31..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/json_tokener.c
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
- * $Id: json_tokener.c,v 1.20 2006/07/25 03:24:50 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include <strings.h>
-
-#include "bits.h"
-#include "debug.h"
-#include "printbuf.h"
-#include "arraylist.h"
-#include "json_object.h"
-#include "json_tokener.h"
-
-
-#if !HAVE_STRNCASECMP && defined(_MSC_VER)
-  /* MSC has the version as _strnicmp */
-# define strncasecmp _strnicmp
-#elif !HAVE_STRNCASECMP
-/*# error You do not have strncasecmp on your system.*/
-#endif /* HAVE_STRNCASECMP */
-
-
-static const char* json_null_str = "null";
-static const char* json_true_str = "true";
-static const char* json_false_str = "false";
-
-const char* json_tokener_errors[] = {
-  "success",
-  "continue",
-  "nesting to deep",
-  "unexpected end of data",
-  "unexpected character",
-  "null expected",
-  "boolean expected",
-  "number expected",
-  "array value separator ',' expected",
-  "quoted object property name expected",
-  "object property name separator ':' expected",
-  "object value separator ',' expected",
-  "invalid string sequence",
-  "expected comment",
-};
-
-
-struct json_tokener* json_tokener_new()
-{
-  struct json_tokener *tok = calloc(1, sizeof(struct json_tokener));
-  tok->pb = printbuf_new();
-  json_tokener_reset(tok);
-  return tok;
-}
-
-void json_tokener_free(struct json_tokener *tok)
-{
-  json_tokener_reset(tok);
-  if(tok) printbuf_free(tok->pb);
-  free(tok);
-}
-
-static void json_tokener_reset_level(struct json_tokener *tok, int depth)
-{
-  tok->stack[depth].state = json_tokener_state_eatws;
-  tok->stack[depth].saved_state = json_tokener_state_start;
-  json_object_put(tok->stack[depth].current);
-  tok->stack[depth].current = NULL;
-  free(tok->stack[depth].obj_field_name);
-  tok->stack[depth].obj_field_name = NULL;
-}
-
-void json_tokener_reset(struct json_tokener *tok)
-{
-  int i;
-  for(i = tok->depth; i >= 0; i--)
-    json_tokener_reset_level(tok, i);
-  tok->depth = 0;
-  tok->err = json_tokener_success;
-}
-
-struct json_object* json_tokener_parse(const char *str)
-{
-  struct json_tokener* tok;
-  struct json_object* obj;
-
-  tok = json_tokener_new();
-  obj = json_tokener_parse_ex(tok, str, -1);
-  if(tok->err != json_tokener_success)
-    obj = error_ptr(-tok->err);
-  json_tokener_free(tok);
-  return obj;
-}
-
-
-/*#if !HAVE_STRNDUP*/
-/* CAW: compliant version of strndup() */
-char* json_c_strndup(const char* str, size_t n)
-{
-  if(str) {
-    size_t len = strlen(str);
-    size_t nn = min(len,n);
-    char* s = (char*)malloc(sizeof(char) * (nn + 1));
-
-    if(s) {
-      memcpy(s, str, nn);
-      s[nn] = '\0';
-    }
-
-    return s;
-  }
-
-  return NULL;
-}
-/*#endif*/
-
-
-#define state  tok->stack[tok->depth].state
-#define saved_state  tok->stack[tok->depth].saved_state
-#define current tok->stack[tok->depth].current
-#define obj_field_name tok->stack[tok->depth].obj_field_name
-
-struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
-					  const char *str, int len)
-{
-  struct json_object *obj = NULL;
-  char c;
-
-  tok->char_offset = 0;
-  tok->err = json_tokener_success;
-
-  do {
-    if(tok->char_offset == len) {
-      if(tok->depth == 0 && state == json_tokener_state_eatws &&
-	 saved_state == json_tokener_state_finish)
-	tok->err = json_tokener_success;
-      else
-	tok->err = json_tokener_continue;
-      goto out;
-    }
-
-    c = *str;
-  redo_char:
-    switch(state) {
-
-    case json_tokener_state_eatws:
-      if(isspace(c)) {
-	/* okay */
-      } else if(c == '/') {
-	printbuf_reset(tok->pb);
-	printbuf_memappend(tok->pb, &c, 1);
-	state = json_tokener_state_comment_start;
-      } else {
-	state = saved_state;
-	goto redo_char;
-      }
-      break;
-
-    case json_tokener_state_start:
-      switch(c) {
-      case '{':
-	state = json_tokener_state_eatws;
-	saved_state = json_tokener_state_object_field_start;
-	current = json_object_new_object();
-	break;
-      case '[':
-	state = json_tokener_state_eatws;
-	saved_state = json_tokener_state_array;
-	current = json_object_new_array();
-	break;
-      case 'N':
-      case 'n':
-	state = json_tokener_state_null;
-	printbuf_reset(tok->pb);
-	tok->st_pos = 0;
-	goto redo_char;
-      case '"':
-      case '\'':
-	state = json_tokener_state_string;
-	printbuf_reset(tok->pb);
-	tok->quote_char = c;
-	break;
-      case 'T':
-      case 't':
-      case 'F':
-      case 'f':
-	state = json_tokener_state_boolean;
-	printbuf_reset(tok->pb);
-	tok->st_pos = 0;
-	goto redo_char;
-#if 0 /*defined(__GNUC__)*/
-	  case '0' ... '9':
-#else
-	  case '0':
-      case '1':
-      case '2':
-      case '3':
-      case '4':
-      case '5':
-      case '6':
-      case '7':
-      case '8':
-      case '9':
-#endif
-      case '-':
-	state = json_tokener_state_number;
-	printbuf_reset(tok->pb);
-	tok->is_double = 0;
-	goto redo_char;
-      default:
-	tok->err = json_tokener_error_parse_unexpected;
-	goto out;
-      }
-      break;
-
-    case json_tokener_state_finish:
-      if(tok->depth == 0) goto out;
-      obj = json_object_get(current);
-      json_tokener_reset_level(tok, tok->depth);
-      tok->depth--;
-      goto redo_char;
-
-    case json_tokener_state_null:
-      printbuf_memappend(tok->pb, &c, 1);
-      if(strncasecmp(json_null_str, tok->pb->buf,
-		     min( (size_t) (tok->st_pos+1), strlen(json_null_str))) == 0) {
-	if(  ((size_t) tok->st_pos) == strlen(json_null_str)) {
-	  current = NULL;
-	  saved_state = json_tokener_state_finish;
-	  state = json_tokener_state_eatws;
-	  goto redo_char;
-	}
-      } else {
-	tok->err = json_tokener_error_parse_null;
-	goto out;
-      }
-      tok->st_pos++;
-      break;
-
-    case json_tokener_state_comment_start:
-      if(c == '*') {
-	state = json_tokener_state_comment;
-      } else if(c == '/') {
-	state = json_tokener_state_comment_eol;
-      } else {
-	tok->err = json_tokener_error_parse_comment;
-	goto out;
-      }
-      printbuf_memappend(tok->pb, &c, 1);
-      break;
-
-    case json_tokener_state_comment:
-      if(c == '*') state = json_tokener_state_comment_end;
-      printbuf_memappend(tok->pb, &c, 1);
-      break;
-
-    case json_tokener_state_comment_eol:
-      if(c == '\n') {
-	mc_debug("json_tokener_comment: %s\n", tok->pb->buf);
-	state = json_tokener_state_eatws;
-      } else {
-	printbuf_memappend(tok->pb, &c, 1);
-      }
-      break;
-
-    case json_tokener_state_comment_end:
-      printbuf_memappend(tok->pb, &c, 1);
-      if(c == '/') {
-	mc_debug("json_tokener_comment: %s\n", tok->pb->buf);
-	state = json_tokener_state_eatws;
-      } else {
-	state = json_tokener_state_comment;
-      }
-      break;
-
-    case json_tokener_state_string:
-      if(c == tok->quote_char) {
-	current = json_object_new_string(tok->pb->buf);
-	saved_state = json_tokener_state_finish;
-	state = json_tokener_state_eatws;
-      } else if(c == '\\') {
-	saved_state = json_tokener_state_string;
-	state = json_tokener_state_string_escape;
-      } else {
-	printbuf_memappend(tok->pb, &c, 1);
-      }
-      break;
-
-    case json_tokener_state_string_escape:
-      switch(c) {
-      case '"':
-      case '\\':
-      case '/':
-	printbuf_memappend(tok->pb, &c, 1);
-	state = saved_state;
-	break;
-      case 'b':
-      case 'n':
-      case 'r':
-      case 't':
-	if(c == 'b') printbuf_memappend(tok->pb, "\b", 1);
-	else if(c == 'n') printbuf_memappend(tok->pb, "\n", 1);
-	else if(c == 'r') printbuf_memappend(tok->pb, "\r", 1);
-	else if(c == 't') printbuf_memappend(tok->pb, "\t", 1);
-	state = saved_state;
-	break;
-      case 'u':
-	tok->ucs_char = 0;
-	tok->st_pos = 0;
-	state = json_tokener_state_escape_unicode;
-	break;
-      default:
-	tok->err = json_tokener_error_parse_string;
-	goto out;
-      }
-      break;
-
-    case json_tokener_state_escape_unicode:
-      if(strchr(json_hex_chars, c)) {
-	tok->ucs_char += ((unsigned int)hexdigit(c) << ((3-tok->st_pos++)*4));
-	if(tok->st_pos == 4) {
-	  unsigned char utf_out[3];
-	  if (tok->ucs_char < 0x80) {
-	    utf_out[0] = tok->ucs_char;
-	    printbuf_memappend(tok->pb, (char*)utf_out, 1);
-	  } else if (tok->ucs_char < 0x800) {
-	    utf_out[0] = 0xc0 | (tok->ucs_char >> 6);
-	    utf_out[1] = 0x80 | (tok->ucs_char & 0x3f);
-	    printbuf_memappend(tok->pb, (char*)utf_out, 2);
-	  } else {
-	    utf_out[0] = 0xe0 | (tok->ucs_char >> 12);
-	    utf_out[1] = 0x80 | ((tok->ucs_char >> 6) & 0x3f);
-	    utf_out[2] = 0x80 | (tok->ucs_char & 0x3f);
-	    printbuf_memappend(tok->pb, (char*)utf_out, 3);
-	  }
-	  state = saved_state;
-	}
-      } else {
-	tok->err = json_tokener_error_parse_string;
-	goto out;
-      }
-      break;
-
-    case json_tokener_state_boolean:
-      printbuf_memappend(tok->pb, &c, 1);
-      if(strncasecmp(json_true_str, tok->pb->buf,
-		      min( (size_t)(tok->st_pos+1), strlen(json_true_str))) == 0) {
-	if(((size_t) tok->st_pos) == strlen(json_true_str)) {
-	  current = json_object_new_boolean(1);
-	  saved_state = json_tokener_state_finish;
-	  state = json_tokener_state_eatws;
-	  goto redo_char;
-	}
-      } else if(strncasecmp(json_false_str, tok->pb->buf,
-			    min((size_t)(tok->st_pos+1), strlen(json_false_str))) == 0) {
-	if(( (size_t) tok->st_pos) == strlen(json_false_str)) {
-	  current = json_object_new_boolean(0);
-	  saved_state = json_tokener_state_finish;
-	  state = json_tokener_state_eatws;
-	  goto redo_char;
-	}
-      } else {
-	tok->err = json_tokener_error_parse_boolean;
-	goto out;
-      }
-      tok->st_pos++;
-      break;
-
-    case json_tokener_state_number:
-      if(c && strchr(json_number_chars, c)) {
-	printbuf_memappend(tok->pb, &c, 1);	
-	if(c == '.' || c == 'e') tok->is_double = 1;
-      } else {
-	int numi;
-	double numd;
-	if(!tok->is_double && sscanf(tok->pb->buf, "%d", &numi) == 1) {
-	  current = json_object_new_int(numi);
-	} else if(tok->is_double && sscanf(tok->pb->buf, "%lf", &numd) == 1) {
-	  current = json_object_new_double(numd);
-	} else {
-	  tok->err = json_tokener_error_parse_number;
-	  goto out;
-	}
-	saved_state = json_tokener_state_finish;
-	state = json_tokener_state_eatws;
-	goto redo_char;
-      }
-      break;
-
-    case json_tokener_state_array:
-      if(c == ']') {
-	saved_state = json_tokener_state_finish;
-	state = json_tokener_state_eatws;
-      } else {
-	if(tok->depth >= JSON_TOKENER_MAX_DEPTH-1) {
-	  tok->err = json_tokener_error_depth;
-	  goto out;
-	}
-	state = json_tokener_state_array_add;
-	tok->depth++;
-	json_tokener_reset_level(tok, tok->depth);
-	goto redo_char;
-      }
-      break;
-
-    case json_tokener_state_array_add:
-      json_object_array_add(current, obj);
-      saved_state = json_tokener_state_array_sep;
-      state = json_tokener_state_eatws;
-      goto redo_char;
-
-    case json_tokener_state_array_sep:
-      if(c == ']') {
-	saved_state = json_tokener_state_finish;
-	state = json_tokener_state_eatws;
-      } else if(c == ',') {
-	saved_state = json_tokener_state_array;
-	state = json_tokener_state_eatws;
-      } else {
-	tok->err = json_tokener_error_parse_array;
-	goto out;
-      }
-      break;
-
-    case json_tokener_state_object_field_start:
-      if(c == '}') {
-	saved_state = json_tokener_state_finish;
-	state = json_tokener_state_eatws;
-      } else if (c == '"' || c == '\'') {
-	tok->quote_char = c;
-	printbuf_reset(tok->pb);
-	state = json_tokener_state_object_field;
-      } else {
-	tok->err = json_tokener_error_parse_object_key_name;
-	goto out;
-      }
-      break;
-
-    case json_tokener_state_object_field:
-      if(c == tok->quote_char) {
-	obj_field_name = strdup(tok->pb->buf);
-	saved_state = json_tokener_state_object_field_end;
-	state = json_tokener_state_eatws;
-      } else if(c == '\\') {
-	saved_state = json_tokener_state_object_field;
-	state = json_tokener_state_string_escape;
-      } else {
-	printbuf_memappend(tok->pb, &c, 1);
-      }
-      break;
-
-    case json_tokener_state_object_field_end:
-      if(c == ':') {
-	saved_state = json_tokener_state_object_value;
-	state = json_tokener_state_eatws;
-      } else {
-	tok->err = json_tokener_error_parse_object_key_sep;
-	goto out;
-      }
-      break;
-
-    case json_tokener_state_object_value:
-      if(tok->depth >= JSON_TOKENER_MAX_DEPTH-1) {
-	tok->err = json_tokener_error_depth;
-	goto out;
-      }
-      state = json_tokener_state_object_value_add;
-      tok->depth++;
-      json_tokener_reset_level(tok, tok->depth);
-      goto redo_char;
-
-    case json_tokener_state_object_value_add:
-      json_object_object_add(current, obj_field_name, obj);
-      free(obj_field_name);
-      obj_field_name = NULL;
-      saved_state = json_tokener_state_object_sep;
-      state = json_tokener_state_eatws;
-      goto redo_char;
-
-    case json_tokener_state_object_sep:
-      if(c == '}') {
-	saved_state = json_tokener_state_finish;
-	state = json_tokener_state_eatws;
-      } else if(c == ',') {
-	saved_state = json_tokener_state_object_field_start;
-	state = json_tokener_state_eatws;
-      } else {
-	tok->err = json_tokener_error_parse_object_value_sep;
-	goto out;
-      }
-      break;
-
-    }
-    str++;
-    tok->char_offset++;
-  } while(c);
-
-  if(state != json_tokener_state_finish &&
-     saved_state != json_tokener_state_finish)
-    tok->err = json_tokener_error_parse_eof;
-
- out:
-  if(tok->err == json_tokener_success) return json_object_get(current);
-  mc_debug("json_tokener_parse_ex: error %s at offset %d\n",
-	   json_tokener_errors[tok->err], tok->char_offset);
-  return NULL;
-}
diff --git a/sm/lib/json-c/json_tokener.h b/sm/lib/json-c/json_tokener.h
deleted file mode 100644
index 32330af460632a85c4510ad0378a142a88a80c3d..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/json_tokener.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * $Id: json_tokener.h,v 1.10 2006/07/25 03:24:50 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _json_tokener_h_
-#define _json_tokener_h_
-
-#include "json_object.h"
-
-enum json_tokener_error {
-  json_tokener_success,
-  json_tokener_continue,
-  json_tokener_error_depth,
-  json_tokener_error_parse_eof,
-  json_tokener_error_parse_unexpected,
-  json_tokener_error_parse_null,
-  json_tokener_error_parse_boolean,
-  json_tokener_error_parse_number,
-  json_tokener_error_parse_array,
-  json_tokener_error_parse_object_key_name,
-  json_tokener_error_parse_object_key_sep,
-  json_tokener_error_parse_object_value_sep,
-  json_tokener_error_parse_string,
-  json_tokener_error_parse_comment
-};
-
-enum json_tokener_state {
-  json_tokener_state_eatws,
-  json_tokener_state_start,
-  json_tokener_state_finish,
-  json_tokener_state_null,
-  json_tokener_state_comment_start,
-  json_tokener_state_comment,
-  json_tokener_state_comment_eol,
-  json_tokener_state_comment_end,
-  json_tokener_state_string,
-  json_tokener_state_string_escape,
-  json_tokener_state_escape_unicode,
-  json_tokener_state_boolean,
-  json_tokener_state_number,
-  json_tokener_state_array,
-  json_tokener_state_array_add,
-  json_tokener_state_array_sep,
-  json_tokener_state_object_field_start,
-  json_tokener_state_object_field,
-  json_tokener_state_object_field_end,
-  json_tokener_state_object_value,
-  json_tokener_state_object_value_add,
-  json_tokener_state_object_sep
-};
-
-struct json_tokener_srec
-{
-  enum json_tokener_state state, saved_state;
-  struct json_object *obj;
-  struct json_object *current;
-  char *obj_field_name;
-};
-
-#define JSON_TOKENER_MAX_DEPTH 32
-
-struct json_tokener
-{
-  char *str;
-  struct printbuf *pb;
-  int depth, is_double, st_pos, char_offset;
-  enum json_tokener_error err;
-  unsigned int ucs_char;
-  char quote_char;
-  struct json_tokener_srec stack[JSON_TOKENER_MAX_DEPTH];
-};
-
-extern const char* json_tokener_errors[];
-
-extern struct json_tokener* json_tokener_new(void);
-extern void json_tokener_free(struct json_tokener *tok);
-extern void json_tokener_reset(struct json_tokener *tok);
-extern struct json_object* json_tokener_parse(const char *str);
-extern struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
-						 const char *str, int len);
-
-#endif
diff --git a/sm/lib/json-c/json_util.c b/sm/lib/json-c/json_util.c
deleted file mode 100644
index e20be240387e13d3500de53169071b05aca03a41..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/json_util.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * $Id: json_util.c,v 1.4 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <string.h>
-#include <errno.h>
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif /* HAVE_SYS_TYPES_H */
-
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif /* HAVE_SYS_STAT_H */
-
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#endif /* HAVE_FCNTL_H */
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-#ifdef WIN32
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# include <io.h>
-#endif /* defined(WIN32) */
-
-#if !HAVE_OPEN && defined(WIN32)
-# define open _open
-#endif
-
-
-#include "bits.h"
-#include "debug.h"
-#include "printbuf.h"
-#include "json_object.h"
-#include "json_tokener.h"
-#include "json_util.h"
-
-struct json_object* json_object_from_file(char *filename)
-{
-  struct printbuf *pb;
-  struct json_object *obj;
-  char buf[JSON_FILE_BUF_SIZE];
-  int fd, ret;
-
-  if((fd = open(filename, O_RDONLY)) < 0) {
-    mc_error("json_object_from_file: error reading file %s: %s\n",
-	     filename, strerror(errno));
-    return error_ptr(-1);
-  }
-  if(!(pb = printbuf_new())) {
-    mc_error("json_object_from_file: printbuf_new failed\n");
-    return error_ptr(-1);
-  }
-  while((ret = read(fd, buf, JSON_FILE_BUF_SIZE)) > 0) {
-    printbuf_memappend(pb, buf, ret);
-  }
-  close(fd);
-  if(ret < 0) {
-    mc_abort("json_object_from_file: error reading file %s: %s\n",
-	     filename, strerror(errno));
-    printbuf_free(pb);
-    return error_ptr(-1);
-  }
-  obj = json_tokener_parse(pb->buf);
-  printbuf_free(pb);
-  return obj;
-}
-
-int json_object_to_file(char *filename, struct json_object *obj)
-{
-  char *json_str;
-  int fd, ret;
-  unsigned int wpos, wsize;
-
-  if(!obj) {
-    mc_error("json_object_to_file: object is null\n");
-    return -1;
-  }
-
-  if((fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0644)) < 0) {
-    mc_error("json_object_to_file: error opening file %s: %s\n",
-	     filename, strerror(errno));
-    return -1;
-  }
-
-  if(!(json_str = json_object_to_json_string(obj))) { return -1; }
-
-
-  wsize = (unsigned int)(strlen(json_str) & UINT_MAX); /* CAW: probably unnecessary, but the most 64bit safe */
-  wpos = 0;
-  while(wpos < wsize) {
-    if((ret = write(fd, json_str + wpos, wsize-wpos)) < 0) {
-      close(fd);
-      mc_error("json_object_to_file: error writing file %s: %s\n",
-	     filename, strerror(errno));
-      return -1;
-    }
-
-	/* because of the above check for ret < 0, we can safely cast and add */
-    wpos += (unsigned int)ret;
-  }
-
-  close(fd);
-  return 0;
-}
diff --git a/sm/lib/json-c/json_util.h b/sm/lib/json-c/json_util.h
deleted file mode 100644
index 30fe2ab2c4dfefceb88cfc9b82fa694833f58d91..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/json_util.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * $Id: json_util.h,v 1.4 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _json_util_h_
-#define _json_util_h_
-
-#include "json_object.h"
-
-#define JSON_FILE_BUF_SIZE 4096
-
-/* utlitiy functions */
-extern struct json_object* json_object_from_file(char *filename);
-extern int json_object_to_file(char *filename, struct json_object *obj);
-
-#endif
diff --git a/sm/lib/json-c/linkhash.c b/sm/lib/json-c/linkhash.c
deleted file mode 100644
index 922735679794e56c5259e1b11c2a98d7be8928ce..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/linkhash.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * $Id: linkhash.c,v 1.4 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <limits.h>
-
-#include "linkhash.h"
-
-void lh_abort(const char *msg, ...)
-{
-	va_list ap;
-	va_start(ap, msg);
-	vprintf(msg, ap);
-	exit(1);
-}
-
-unsigned long lh_ptr_hash(void *k)
-{
-	/* CAW: refactored to be 64bit nice */
-	return (unsigned long)((((ptrdiff_t)k * LH_PRIME) >> 4) & ULONG_MAX);
-}
-
-int lh_ptr_equal(void *k1, void *k2)
-{
-	return (k1 == k2);
-}
-
-unsigned long lh_char_hash(void *k)
-{
-	unsigned int h = 0;
-	const char* data = k;
- 
-	while( *data!=0 ) h = h*129 + (unsigned int)(*data++) + LH_PRIME;
-
-	return h;
-}
-
-int lh_char_equal(void *k1, void *k2)
-{
-	return (strcmp((char*)k1, (char*)k2) == 0);
-}
-
-struct lh_table* lh_table_new(int size, char *name,
-			      lh_entry_free_fn *free_fn,
-			      lh_hash_fn *hash_fn,
-			      lh_equal_fn *equal_fn)
-{
-	int i;
-	struct lh_table *t;
-
-	t = calloc(1, sizeof(struct lh_table));
-	if(!t) lh_abort("lh_table_new: calloc failed\n");
-	t->count = 0;
-	t->size = size;
-	t->name = name;
-	t->table = calloc( (size_t) size,sizeof(struct lh_entry));
-	if(!t->table) lh_abort("lh_table_new: calloc failed\n");
-	t->free_fn = free_fn;
-	t->hash_fn = hash_fn;
-	t->equal_fn = equal_fn;
-	for(i = 0; i < size; i++) t->table[i].k = LH_EMPTY;
-	return t;
-}
-
-struct lh_table* lh_kchar_table_new(int size, char *name,
-				    lh_entry_free_fn *free_fn)
-{
-	return lh_table_new(size, name, free_fn, lh_char_hash, lh_char_equal);
-}
-
-struct lh_table* lh_kptr_table_new(int size, char *name,
-				   lh_entry_free_fn *free_fn)
-{
-	return lh_table_new(size, name, free_fn, lh_ptr_hash, lh_ptr_equal);
-}
-
-void lh_table_resize(struct lh_table *t, int new_size)
-{
-	struct lh_table *new_t;
-	struct lh_entry *ent;
-
-	new_t = lh_table_new(new_size, t->name, NULL, t->hash_fn, t->equal_fn);
-	ent = t->head;
-	while(ent) {
-		lh_table_insert(new_t, ent->k, ent->v);
-		ent = ent->next;
-	}
-	free(t->table);
-	t->table = new_t->table;
-	t->size = new_size;
-	t->head = new_t->head;
-	t->tail = new_t->tail;
-	t->resizes++;
-	free(new_t);
-}
-
-void lh_table_free(struct lh_table *t)
-{
-	struct lh_entry *c;
-	for(c = t->head; c != NULL; c = c->next) {
-		if(t->free_fn) {
-			t->free_fn(c);
-		}
-	}
-	free(t->table);
-	free(t);
-}
-
-
-int lh_table_insert(struct lh_table *t, void *k, void *v)
-{
-	unsigned long h, n;
-
-	t->inserts++;
-	if(t->count > t->size * 0.66) lh_table_resize(t, t->size * 2);
-
-	h = t->hash_fn(k);
-	n = h % t->size;
-
-	while( 1 ) {
-		if(t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED) break;
-		t->collisions++;
-		if(++n ==  (size_t) t->size) n = 0;
-	}
-
-	t->table[n].k = k;
-	t->table[n].v = v;
-	t->count++;
-
-	if(t->head == NULL) {
-		t->head = t->tail = &t->table[n];
-		t->table[n].next = t->table[n].prev = NULL;
-	} else {
-		t->tail->next = &t->table[n];
-		t->table[n].prev = t->tail;
-		t->table[n].next = NULL;
-		t->tail = &t->table[n];
-	}
-
-	return 0;
-}
-
-
-struct lh_entry* lh_table_lookup_entry(struct lh_table *t, void *k)
-{
-	unsigned long h = t->hash_fn(k);
-	unsigned long n = h % t->size;
-
-	t->lookups++;
-	while( 1 ) {
-		if(t->table[n].k == LH_EMPTY) return NULL;
-		if(t->table[n].k != LH_FREED &&
-		   t->equal_fn(t->table[n].k, k)) return &t->table[n];
-		if(++n ==  (size_t) t->size) n = 0;
-	}
-	return NULL;
-}
-
-
-void* lh_table_lookup(struct lh_table *t, void *k)
-{
-	struct lh_entry *e = lh_table_lookup_entry(t, k);
-	if(e) return e->v;
-	return NULL;
-}
-
-
-int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e)
-{
-	ptrdiff_t n = (ptrdiff_t)(e - t->table); /* CAW: fixed to be 64bit nice, still need the crazy negative case... */
-
-	/* CAW: this is bad, really bad, maybe stack goes other direction on this machine... */
-	if(n < 0) { return -2; }
-
-	if(t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED) return -1;
-	t->count--;
-	if(t->free_fn) t->free_fn(e);
-	t->table[n].v = NULL;
-	t->table[n].k = LH_FREED;
-	if(t->tail == &t->table[n] && t->head == &t->table[n]) {
-		t->head = t->tail = NULL;
-	} else if (t->head == &t->table[n]) {
-		t->head->next->prev = NULL;
-		t->head = t->head->next;
-	} else if (t->tail == &t->table[n]) {
-		t->tail->prev->next = NULL;
-		t->tail = t->tail->prev;
-	} else {
-		t->table[n].prev->next = t->table[n].next;
-		t->table[n].next->prev = t->table[n].prev;
-	}
-	t->table[n].next = t->table[n].prev = NULL;
-	return 0;
-}
-
-
-int lh_table_delete(struct lh_table *t, void *k)
-{
-	struct lh_entry *e = lh_table_lookup_entry(t, k);
-	if(!e) return -1;
-	return lh_table_delete_entry(t, e);
-}
-
diff --git a/sm/lib/json-c/linkhash.h b/sm/lib/json-c/linkhash.h
deleted file mode 100644
index 5c9fa852d8efba088164e22f4203cd935d0cc5bb..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/linkhash.h
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * $Id: linkhash.h,v 1.6 2006/01/30 23:07:57 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
- 
-#ifndef _linkhash_h_
-#define _linkhash_h_
-
-/**
- * golden prime used in hash functions
- */
-#define LH_PRIME 0x9e370001UL
-
-/**
- * sentinel pointer value for empty slots
- */
-#define LH_EMPTY (void*)-1
-
-/**
- * sentinel pointer value for freed slots
- */
-#define LH_FREED (void*)-2
-
-struct lh_entry;
-
-/**
- * callback function prototypes
- */
-typedef void (lh_entry_free_fn) (struct lh_entry *e);
-/**
- * callback function prototypes
- */
-typedef unsigned long (lh_hash_fn) (void *k);
-/**
- * callback function prototypes
- */
-typedef int (lh_equal_fn) (void *k1, void *k2);
-
-/**
- * An entry in the hash table
- */
-struct lh_entry {
-	/**
-	 * The key.
-	 */
-	void *k;
-	/**
-	 * The value.
-	 */
-	void *v;
-	/**
-	 * The next entry
-	 */
-	struct lh_entry *next;
-	/**
-	 * The previous entry.
-	 */
-	struct lh_entry *prev;
-};
-
-
-/**
- * The hash table structure.
- */
-struct lh_table {
-	/**
-	 * Size of our hash.
-	 */
-	int size;
-	/**
-	 * Numbers of entries.
-	 */
-	int count;
-
-	/**
-	 * Number of collisions.
-	 */
-	int collisions;
-
-	/**
-	 * Number of resizes.
-	 */
-	int resizes;
-
-	/**
-	 * Number of lookups.
-	 */
-	int lookups;
-
-	/**
-	 * Number of inserts.
-	 */
-	int inserts;
-
-	/**
-	 * Number of deletes.
-	 */
-	int deletes;
-
-	/**
-	 * Name of the hash table.
-	 */
-	char *name;
-
-	/**
-	 * The first entry.
-	 */
-	struct lh_entry *head;
-
-	/**
-	 * The last entry.
-	 */
-	struct lh_entry *tail;
-
-	struct lh_entry *table;
-
-	/**
-	 * A pointer onto the function responsible for freeing an entry.
-	 */
-	lh_entry_free_fn *free_fn;
-	lh_hash_fn *hash_fn;
-	lh_equal_fn *equal_fn;
-};
-
-
-/**
- * Pre-defined hash and equality functions
- */
-extern unsigned long lh_ptr_hash(void *k);
-extern int lh_ptr_equal(void *k1, void *k2);
-
-extern unsigned long lh_char_hash(void *k);
-extern int lh_char_equal(void *k1, void *k2);
-
-
-/**
- * Convenience list iterator.
- */
-#define lh_foreach(table, entry) \
-for(entry = table->head; entry; entry = entry->next)
-
-/**
- * lh_foreach_safe allows calling of deletion routine while iterating.
- */
-#define lh_foreach_safe(table, entry, tmp) \
-for(entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp)
-
-
-
-/**
- * Create a new linkhash table.
- * @param size initial table size. The table is automatically resized
- * although this incurs a performance penalty.
- * @param name the table name.
- * @param free_fn callback function used to free memory for entries
- * when lh_table_free or lh_table_delete is called.
- * If NULL is provided, then memory for keys and values
- * must be freed by the caller.
- * @param hash_fn  function used to hash keys. 2 standard ones are defined:
- * lh_ptr_hash and lh_char_hash for hashing pointer values
- * and C strings respectively.
- * @param equal_fn comparison function to compare keys. 2 standard ones defined:
- * lh_ptr_hash and lh_char_hash for comparing pointer values
- * and C strings respectively.
- * @return a pointer onto the linkhash table.
- */
-extern struct lh_table* lh_table_new(int size, char *name,
-				     lh_entry_free_fn *free_fn,
-				     lh_hash_fn *hash_fn,
-				     lh_equal_fn *equal_fn);
-
-/**
- * Convenience function to create a new linkhash
- * table with char keys.
- * @param size initial table size.
- * @param name table name.
- * @param free_fn callback function used to free memory for entries.
- * @return a pointer onto the linkhash table.
- */
-extern struct lh_table* lh_kchar_table_new(int size, char *name,
-					   lh_entry_free_fn *free_fn);
-
-
-/**
- * Convenience function to create a new linkhash
- * table with ptr keys.
- * @param size initial table size.
- * @param name table name.
- * @param free_fn callback function used to free memory for entries.
- * @return a pointer onto the linkhash table.
- */
-extern struct lh_table* lh_kptr_table_new(int size, char *name,
-					  lh_entry_free_fn *free_fn);
-
-
-/**
- * Free a linkhash table.
- * If a callback free function is provided then it is called for all
- * entries in the table.
- * @param t table to free.
- */
-extern void lh_table_free(struct lh_table *t);
-
-
-/**
- * Insert a record into the table.
- * @param t the table to insert into.
- * @param k a pointer to the key to insert.
- * @param v a pointer to the value to insert.
- */
-extern int lh_table_insert(struct lh_table *t, void *k, void *v);
-
-
-/**
- * Lookup a record into the table.
- * @param t the table to lookup
- * @param k a pointer to the key to lookup
- * @return a pointer to the record structure of the value or NULL if it does not exist.
- */
-extern struct lh_entry* lh_table_lookup_entry(struct lh_table *t, void *k);
-
-/**
- * Lookup a record into the table
- * @param t the table to lookup
- * @param k a pointer to the key to lookup
- * @return a pointer to the found value or NULL if it does not exist.
- */
-extern void* lh_table_lookup(struct lh_table *t, void *k);
-
-
-/**
- * Delete a record from the table.
- * If a callback free function is provided then it is called for the
- * for the item being deleted.
- * @param t the table to delete from.
- * @param e a pointer to the entry to delete.
- * @return 0 if the item was deleted.
- * @return -1 if it was not found.
- */
-extern int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e);
-
-
-/**
- * Delete a record from the table.
- * If a callback free function is provided then it is called for the
- * for the item being deleted.
- * @param t the table to delete from.
- * @param k a pointer to the key to delete.
- * @return 0 if the item was deleted.
- * @return -1 if it was not found.
- */
-extern int lh_table_delete(struct lh_table *t, void *k);
-
-
-#endif
diff --git a/sm/lib/json-c/printbuf.c b/sm/lib/json-c/printbuf.c
deleted file mode 100644
index 1449577d05c177e3664e768e594a9715558b7825..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/printbuf.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * $Id: printbuf.c,v 1.5 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if HAVE_STDARG_H
-# include <stdarg.h>
-#else /* !HAVE_STDARG_H */
-# error Not enough var arg support!
-#endif /* HAVE_STDARG_H */
-
-#include "bits.h"
-#include "debug.h"
-#include "printbuf.h"
-
-struct printbuf* printbuf_new()
-{
-  struct printbuf *p;
-
-  if(!(p = calloc(1, sizeof(struct printbuf)))) return NULL;
-  p->size = 32;
-  p->bpos = 0;
-  if(!(p->buf = malloc( (size_t) p->size))) {
-    free(p);
-    return NULL;
-  }
-  return p;
-}
-
-
-int printbuf_memappend(struct printbuf *p, const char *buf, int size)
-{
-  char *t;
-  if(p->size - p->bpos <= size) {
-    int new_size = max(p->size * 2, p->bpos + size + 8);
-#ifdef PRINTBUF_DEBUG
-    mc_debug("printbuf_memappend: realloc "
-	     "bpos=%d wrsize=%d old_size=%d new_size=%d\n",
-	     p->bpos, size, p->size, new_size);
-#endif /* PRINTBUF_DEBUG */
-    if(!(t = realloc(p->buf,  (size_t) new_size))) return -1;
-    p->size = new_size;
-    p->buf = t;
-  }
-  memcpy(p->buf + p->bpos, buf,  (size_t) size);
-  p->bpos += size;
-  p->buf[p->bpos]= '\0';
-  return size;
-}
-
-#if !HAVE_VSNPRINTF && defined(WIN32)
-# define vsnprintf _vsnprintf
-#elif !HAVE_VSNPRINTF /* !HAVE_VSNPRINTF */
-# error Need vsnprintf!
-#endif /* !HAVE_VSNPRINTF && defined(WIN32) */
-
-#if !HAVE_VASPRINTF
-/* CAW: compliant version of vasprintf */
-static int vasprintf(char **buf, const char *fmt, va_list ap)
-{
-#ifndef WIN32
-	static char _T_emptybuffer = '\0';
-#endif /* !defined(WIN32) */
-	int chars;
-	char *b;
-
-	if(!buf) { return -1; }
-
-#ifdef WIN32
-	chars = _vscprintf(fmt, ap)+1;
-#else /* !defined(WIN32) */
-	/* CAW: RAWR! We have to hope to god here that vsnprintf doesn't overwrite
-	   our buffer like on some 64bit sun systems.... but hey, its time to move on */
-	chars = vsnprintf(&_T_emptybuffer, 0, fmt, ap)+1;
-	if(chars < 0) { chars *= -1; } /* CAW: old glibc versions have this problem */
-#endif /* defined(WIN32) */
-
-	b = (char*)malloc(sizeof(char)*chars);
-	if(!b) { return -1; }
-
-	if((chars = vsprintf(b, fmt, ap)) < 0)
-	{
-		free(b);
-	} else {
-		*buf = b;
-	}
-
-	return chars;
-}
-#endif /* !HAVE_VASPRINTF */
-
-int sprintbuf(struct printbuf *p, const char *msg, ...)
-{
-  va_list ap;
-  char *t;
-  int size;
-  char buf[128];
-
-  /* user stack buffer first */
-  va_start(ap, msg);
-  size = vsnprintf(buf, 128, msg, ap);
-  va_end(ap);
-  /* if string is greater than stack buffer, then use dynamic string
-     with vasprintf.  Note: some implementation of vsnprintf return -1
-     if output is truncated whereas some return the number of bytes that
-     would have been writen - this code handles both cases. */
-  if(size == -1 || size > 127) {
-    int ret;
-    va_start(ap, msg);
-    if((size = vasprintf(&t, msg, ap)) == -1) return -1;
-    va_end(ap);
-    ret = printbuf_memappend(p, t, size);
-    free(t);
-    return ret;
-  } else {
-    return printbuf_memappend(p, buf, size);
-  }
-}
-
-void printbuf_reset(struct printbuf *p)
-{
-  p->buf[0] = '\0';
-  p->bpos = 0;
-}
-
-void printbuf_free(struct printbuf *p)
-{
-  if(p) {
-    free(p->buf);
-    free(p);
-  }
-}
diff --git a/sm/lib/json-c/printbuf.h b/sm/lib/json-c/printbuf.h
deleted file mode 100644
index 95f7a248fb4485a8cfc46ae2a48982c5c7f8a44a..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/printbuf.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * $Id: printbuf.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
- *
- * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
- * Michael Clark <michael@metaparadigm.com>
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the MIT license. See COPYING for details.
- *
- */
-
-#ifndef _printbuf_h_
-#define _printbuf_h_
-
-#undef PRINTBUF_DEBUG
-
-struct printbuf {
-  char *buf;
-  int bpos;
-  int size;
-};
-
-extern struct printbuf*
-printbuf_new(void);
-
-extern int
-printbuf_memappend(struct printbuf *p, const char *buf, int size);
-
-extern int
-sprintbuf(struct printbuf *p, const char *msg, ...);
-
-extern void
-printbuf_reset(struct printbuf *p);
-
-extern void
-printbuf_free(struct printbuf *p);
-
-#endif
diff --git a/sm/lib/json-c/test1.c b/sm/lib/json-c/test1.c
deleted file mode 100644
index b6174c3dc70145ac7d3af539508206b562bae707..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/test1.c
+++ /dev/null
@@ -1,181 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "json.h"
-
-int main(int argc, char **argv)
-{
-  argc = 0; argv = 0;
-  struct json_tokener *tok;
-  struct json_object *my_string, *my_int, *my_object, *my_array;
-  struct json_object *new_obj;
-  int i;
-
-  mc_set_debug(2);
-
-  my_string = json_object_new_string("\t");
-  printf("my_string=%s\n", json_object_get_string(my_string));
-  printf("my_string.to_string()=%s\n", json_object_to_json_string(my_string));
-  json_object_put(my_string);
-
-  my_string = json_object_new_string("\\");
-  printf("my_string=%s\n", json_object_get_string(my_string));
-  printf("my_string.to_string()=%s\n", json_object_to_json_string(my_string));
-  json_object_put(my_string);
-
-  my_string = json_object_new_string("foo");
-  printf("my_string=%s\n", json_object_get_string(my_string));
-  printf("my_string.to_string()=%s\n", json_object_to_json_string(my_string));
-
-  my_int = json_object_new_int(9);
-  printf("my_int=%d\n", json_object_get_int(my_int));
-  printf("my_int.to_string()=%s\n", json_object_to_json_string(my_int));
-
-  my_array = json_object_new_array();
-  json_object_array_add(my_array, json_object_new_int(1));
-  json_object_array_add(my_array, json_object_new_int(2));
-  json_object_array_add(my_array, json_object_new_int(3));
-  json_object_array_put_idx(my_array, 4, json_object_new_int(5));
-  printf("my_array=\n");
-  for(i=0; i < json_object_array_length(my_array); i++) {
-    struct json_object *obj = json_object_array_get_idx(my_array, i);
-    printf("\t[%d]=%s\n", i, json_object_to_json_string(obj));
-  }
-  printf("my_array.to_string()=%s\n", json_object_to_json_string(my_array));    
-
-  my_object = json_object_new_object();
-  json_object_object_add(my_object, "abc", json_object_new_int(12));
-  json_object_object_add(my_object, "foo", json_object_new_string("bar"));
-  json_object_object_add(my_object, "bool0", json_object_new_boolean(0));
-  json_object_object_add(my_object, "bool1", json_object_new_boolean(1));
-  json_object_object_add(my_object, "baz", json_object_new_string("bang"));
-  json_object_object_add(my_object, "baz", json_object_new_string("fark"));
-  json_object_object_del(my_object, "baz");
-  json_object_object_add(my_object, "arr", my_array);
-  printf("my_object=\n");
-  /*json_object_object_foreach(my_object, key, val) {
-    printf("\t%s: %s\n", key, json_object_to_json_string(val));
-  }*/
-  printf("my_object.to_string()=%s\n", json_object_to_json_string(my_object));
-
-  new_obj = json_tokener_parse("\"\003\"");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("/* hello */\"foo\"");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("// hello\n\"foo\"");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("\"\\u0041\\u0042\\u0043\"");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("null");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("True");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("12");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("12.3");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("[\"\\n\"]");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("[\"\\nabc\\n\"]");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("[null]");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("[]");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("[false]");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("[\"abc\",null,\"def\",12]");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("{}");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("{ \"foo\": \"bar\" }");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("{ \"foo\": \"bar\", \"baz\": null, \"bool0\": true }");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("{ \"foo\": [null, \"foo\"] }");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("{ \"abc\": 12, \"foo\": \"bar\", \"bool0\": false, \"bool1\": true, \"arr\": [ 1, 2, 3, null, 5 ] }");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  new_obj = json_tokener_parse("{ foo }");
-  if(is_error(new_obj)) printf("got error as expected\n");
-
-  new_obj = json_tokener_parse("foo");
-  if(is_error(new_obj)) printf("got error as expected\n");
-
-  new_obj = json_tokener_parse("{ \"foo");
-  if(is_error(new_obj)) printf("got error as expected\n");
-
-  /* test incremental parsing */
-
-printf("Hello\n");
-  tok = json_tokener_new();
-  new_obj = json_tokener_parse_ex(tok, "{ \"foo", 6);
-  if(is_error(new_obj)) printf("got error as expected\n");
-  new_obj = json_tokener_parse_ex(tok, "\": {\"bar", 8);
-  if(is_error(new_obj)) printf("got error as expected\n");
-  new_obj = json_tokener_parse_ex(tok, "\":13}}", 6);
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);  
-  json_tokener_free(tok);
-
-  json_object_put(my_string);
-  json_object_put(my_int);
-  json_object_put(my_object);
-  /*json_object_put(my_array);*/
-
-	{
-	struct json_object *laser = json_object_new_object();
-	struct json_object *my_array = json_object_new_array();
-	int i; for(i=0;i<20;i++) {
-		json_object_array_add(my_array, 
-			i%5 > 0 ? json_object_new_double((double)i) :
-				json_tokener_parse("null")
-					);
-	}
-	json_object_object_add(laser, "readings", my_array);
-
-	printf("new_obj.to_string()=%s\n", json_object_to_json_string(laser));
-	json_object_put(laser);
-}
-
-  return 0;
-}
diff --git a/sm/lib/json-c/test2.c b/sm/lib/json-c/test2.c
deleted file mode 100644
index 68cd81f61293975d5a562cb48ee162c604fe3ba7..0000000000000000000000000000000000000000
--- a/sm/lib/json-c/test2.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "json.h"
-
-
-int main(int argc, char **argv)
-{
-  argc = 0; argv = (char**)0;
-  struct json_object *new_obj;
-
-  mc_set_debug(1);
-
-  new_obj = json_tokener_parse("/* more difficult test case */ { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": [ { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": \"A meta-markup language, used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\", \"markup\"] } ] } } }");
-  printf("new_obj.to_string()=%s\n", json_object_to_json_string(new_obj));
-  json_object_put(new_obj);
-
-  return 0;
-}
diff --git a/sm/lib/options/CMakeLists.txt b/sm/lib/options/CMakeLists.txt
deleted file mode 100644
index 4292eb4767b50e099a9497465cb68e7673acfbe8..0000000000000000000000000000000000000000
--- a/sm/lib/options/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-SET(options_sources options.c options_interface.c )
-ADD_LIBRARY(options STATIC ${options_sources})
-
-ADD_EXECUTABLE(test_options test_options.c)
-TARGET_LINK_LIBRARIES(test_options options)
-
-
-# installation
-
-FILE(GLOB headers "*.h")
-INSTALL(FILES ${headers} DESTINATION include/options)
-INSTALL(TARGETS options ARCHIVE DESTINATION lib)
diff --git a/sm/lib/options/ruby/options.rb b/sm/lib/options/ruby/options.rb
deleted file mode 100644
index 604e2080ff4cfaeb0d213ca172a7da4e08bceff2..0000000000000000000000000000000000000000
--- a/sm/lib/options/ruby/options.rb
+++ /dev/null
@@ -1,143 +0,0 @@
-
-require 'ostruct'
-require 'optparse'
-
-class Options
-	Option = Struct.new(:name, :default, :description, :value)
-		
-	def initialize
-		@hash = {}
-		@order = []
-	end
-	
-	def add(name, default, description)
-	  if name.class == String
-	    name = name.to_sym
-	  end
-	  if name.class != Symbol
-	    raise "This: #{name.inspect} should be a String or Symbol"
-	  end
-	  
-		@hash[name] = Option.new(name, default, description, nil)
-		@order.push @hash[name]
-	end
-
-	def add_required(name, description)
-	  add(name, nil, description)
-	end
-	
-	
-	def populate(opts)
-
-		opts.on("--help", "shows help") do
-		  $stderr.puts opts.help
-		  exit 0
-		end
-
-		opts.on("--config FILE", "Load config from file") do |file|
-			load_config_from_file(file)
-		end
-
-		opts.on("--config_dump", "Dump config on stdout") do 
-			$stdout.puts self.config_dump
-			exit 0
-		end
-
-		@order.each do |o|
-			s = o.default.inspect.ljust(25)
-			opts.on("--#{o.name} VALUE", "#{s} #{o.description}") do |s|
-				value = s
-				begin value = eval(s) 
-				rescue SyntaxError => ex
-				rescue => ex
-					end
-				
-				@hash[o.name].value = value
-			end
-		end
-			
-	end
-	
-	# Create an ostruct from the data
-	def get_ostruct
-		r = {}
-		@hash.each do |k, v| 
-			r[k] = v.value || v.default
-		end
- 		OpenStruct.new r
-	end
-	
-	# Warn if some required parameter was not set
-	# (default and value are nil)
-	def warn_required
-	  res = false
-		@order.each do |v| 
-			 if v.value.nil? && v.default.nil?
-			    $stderr.puts "Required option '#{v.name}' not set."
-			    res = true
-			 end
-		end	  
-		res
-  end
-	
-	def config_dump
-		s = ""
-		max_size = @hash.keys.map{|x|x.to_s.size}.max + 2
-		for o in @order
-			s += o.name.to_s.ljust(max_size) +  (o.value || o.default).inspect + "\n"
-		end
-		s
-	end
-	
-	RegComment = /^\s*\#/ 
-	RegOption  = /^\s*(\w+)\s*=?\s*(.+)$/ 
-	RegLoad    = /^\s*(?:<|source)\s*(.*)$/
-
-	def load_config_from_file(file)
-		load_config_from_string(File.open(file).read, File.dirname(file))
-	end
-	
-	def load_config_from_string(string, dir)
-		string.split("\n").each do |line|
-			next if (line.strip.size == 0) || line =~ RegComment
-			if m = RegLoad.match(line)
-				filename = m[1]
-				filename = File.expand_path(File.join(dir, filename))
-				load_config_from_file(filename)
-			elsif m = RegOption.match(line)
-				name = m[1].to_sym
-				value = m[2].strip
-
-				begin
-					value = eval(value)
-				rescue ScriptError,StandardError
-				end
-				
-				if o = @hash[name]
-					o.value = value
-#					$stderr.puts "#{name} = #{value}"
-				else
-					$stderr.puts "Unknown key #{name.inspect} (#{@hash.keys.inspect})"
-				end
-			else
-				$stderr.puts "Line #{line.inspect} is malformed"
-				exit -1
-			end
-		end
-	end
-	
-	def parse_cmd_line!
-		opt = OptionParser.new do |opts|
-			self.populate(opts)
-		end
-
-		begin  opt.parse!
-		rescue OptionParser::InvalidOption=>e
-			$stderr.puts e
-			$stderr.puts opt
-			exit -1
-		end
-	end
-	
-
-end
\ No newline at end of file
diff --git a/sm/lib/options/test_options.c b/sm/lib/options/test_options.c
deleted file mode 100644
index 1e9e315b99878c7fda01070c2acae50250263f9a..0000000000000000000000000000000000000000
--- a/sm/lib/options/test_options.c
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "options.h"
-
-
-
-struct params {
-	int a_int;
-	double a_double;
-	const char * file;
-	int algo;
-};
-
-
-struct option_alternative alt[4] = { 
-   {"PLICP", 3, "a new algorithm"}, 
-   {"ICP",   4, "the standard"}, 
-   {"MbICP", 5, "good for rotations"}, {0,0,0}
-};
-
-int main(int argc, const char*argv[]) {
-	options_banner("This is a test program for the options library.");
-	
-	struct params p;
-	
-	struct option* ops = options_allocate(3);
-	options_int    (ops, "i", &p.a_int,  42, "An int parameter");
-	options_double (ops, "d", &p.a_double,  0.42, "A double parameter");
-	options_string (ops, "s", &p.file ,  "Hello", "A file parameter");
-	options_alternative(ops, "algorith", alt, &p.algo, "which algorithm to use" );
-	
-	
-	if(!options_parse_args(ops, argc, argv)) {
-		printf("A simple program.\n\nUsage:\n");
-		options_print_help(ops, stderr);
-		return -1;
-	}
-	
-	printf("i: %d \n", p.a_int);
-	printf("d: %g \n", p.a_double);
-	printf("s: %s \n", p.file);
-	
-	return 0;
-}
diff --git a/sm/pkg-config/CMakeLists.txt b/sm/pkg-config/CMakeLists.txt
deleted file mode 100644
index 28aa95362b19fab5bb02d38d2201e613e182d72c..0000000000000000000000000000000000000000
--- a/sm/pkg-config/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIGURE_FILE(csm.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/csm.pc @ONLY)
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/csm.pc
-	DESTINATION lib/pkgconfig)
diff --git a/sm/pkg-config/csm.pc.in b/sm/pkg-config/csm.pc.in
deleted file mode 100644
index a5e1d0d82ff3c4ed8f7aa349e62ad6d910fde05d..0000000000000000000000000000000000000000
--- a/sm/pkg-config/csm.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-libdir=${prefix}/lib
-includedir=${prefix}/include
-
-Name: csm
-Description: The C(anonical) Scan Matcher
-Requires: gsl
-Version: @csm_version@
-Libs: @csm_link_flags@ -L${libdir} -lcsm-static 
-Cflags: @csm_c_flags@ -I${includedir}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..bea18db93d8e53bff94ee97e417252802ec19a0f
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,64 @@
+cmake_minimum_required(VERSION 2.6)
+
+PROJECT(csm_eigen)
+
+set(CMAKE_CXX_FLAGS_RELEASE "-O3")
+set(CMAKE_C_FLAGS_RELEASE "-O3")
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") 
+
+
+#SET(CMAKE_BUILD_TYPE Debug)
+SET(CMAKE_BUILD_TYPE RelWithDebInfo)
+#SET(CMAKE_BUILD_TYPE Release)
+
+SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../bin )
+SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../lib )
+SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../lib )
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
+find_package(Eigen3 REQUIRED)
+INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIR})
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../include ${CMAKE_SOURCE_DIR})
+
+SET(CSM_SRC 
+  csm/laser_data.cpp
+  csm/math_utils.cpp
+  csm/math_utils_gsl.cpp
+  csm/utils.cpp
+  csm/logging.cpp
+  csm/sm_options.cpp
+  csm/orientation.cpp
+  csm/clustering.cpp)
+
+SET(EGSL_SRC
+	egsl/egsl.cpp
+	egsl/egsl_conversions.cpp
+	egsl/egsl_misc.cpp
+	egsl/egsl_ops.cpp)
+
+SET(GPC_SRC
+	gpc/gpc.cpp
+	gpc/gpc_utils.cpp)
+
+SET(ICP_SRC
+  icp/icp.cpp
+  icp/icp_corr_dumb.cpp
+  icp/icp_corr_tricks.cpp
+  icp/icp_covariance.cpp
+  icp/icp_debug.cpp
+  icp/icp_loop.cpp
+  icp/icp_outliers.cpp)
+
+SET(OPTIONS_SRC  
+   options/options.cpp
+   options/options_interface.cpp)
+
+ADD_LIBRARY(csm_eigen
+	${CSM_SRC}
+	${EGSL_SRC} 
+	${GPC_SRC}
+	${ICP_SRC}
+	${OPTIONS_SRC})
diff --git a/src/cmake/.svn/all-wcprops b/src/cmake/.svn/all-wcprops
new file mode 100644
index 0000000000000000000000000000000000000000..5a88c60b3840dc8ab81545e8a0a138f9d3c7ec8a
--- /dev/null
+++ b/src/cmake/.svn/all-wcprops
@@ -0,0 +1,11 @@
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/projects-finepositioning/!svn/ver/1/csm_eigen/src/cmake
+END
+FindEigen3.cmake
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svn/projects-finepositioning/!svn/ver/1/csm_eigen/src/cmake/FindEigen3.cmake
+END
diff --git a/src/cmake/.svn/entries b/src/cmake/.svn/entries
new file mode 100644
index 0000000000000000000000000000000000000000..cf174ba55e0e398673ba93928951b7bb74f9c8a7
--- /dev/null
+++ b/src/cmake/.svn/entries
@@ -0,0 +1,62 @@
+10
+
+dir
+44
+https://aissvn.informatik.uni-freiburg.de/svn/projects-finepositioning/csm_eigen/src/cmake
+https://aissvn.informatik.uni-freiburg.de/svn/projects-finepositioning
+
+
+
+2012-10-15T16:45:58.517020Z
+1
+sprunkc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+4f0715f2-ee9a-4e3b-b139-986d1b33de6f
+
+FindEigen3.cmake
+file
+
+
+
+
+2012-10-12T15:29:44.055339Z
+911e0662949d9bf6a5845073addb37ec
+2012-10-15T16:45:58.517020Z
+1
+sprunkc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2995
+
diff --git a/src/cmake/.svn/text-base/FindEigen3.cmake.svn-base b/src/cmake/.svn/text-base/FindEigen3.cmake.svn-base
new file mode 100644
index 0000000000000000000000000000000000000000..9c546a05d859b18c49554d7ee7221cc486b7760e
--- /dev/null
+++ b/src/cmake/.svn/text-base/FindEigen3.cmake.svn-base
@@ -0,0 +1,81 @@
+# - Try to find Eigen3 lib
+#
+# This module supports requiring a minimum version, e.g. you can do
+#   find_package(Eigen3 3.1.2)
+# to require version 3.1.2 or newer of Eigen3.
+#
+# Once done this will define
+#
+#  EIGEN3_FOUND - system has eigen lib with correct version
+#  EIGEN3_INCLUDE_DIR - the eigen include directory
+#  EIGEN3_VERSION - eigen version
+
+# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
+# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
+# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
+# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
+
+if(NOT Eigen3_FIND_VERSION)
+  if(NOT Eigen3_FIND_VERSION_MAJOR)
+    set(Eigen3_FIND_VERSION_MAJOR 2)
+  endif(NOT Eigen3_FIND_VERSION_MAJOR)
+  if(NOT Eigen3_FIND_VERSION_MINOR)
+    set(Eigen3_FIND_VERSION_MINOR 91)
+  endif(NOT Eigen3_FIND_VERSION_MINOR)
+  if(NOT Eigen3_FIND_VERSION_PATCH)
+    set(Eigen3_FIND_VERSION_PATCH 0)
+  endif(NOT Eigen3_FIND_VERSION_PATCH)
+
+  set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
+endif(NOT Eigen3_FIND_VERSION)
+
+macro(_eigen3_check_version)
+  file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
+
+  string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
+  set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
+  string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
+  set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
+  string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
+  set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
+
+  set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
+  if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+    set(EIGEN3_VERSION_OK FALSE)
+  else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+    set(EIGEN3_VERSION_OK TRUE)
+  endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+
+  if(NOT EIGEN3_VERSION_OK)
+
+    message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
+                   "but at least version ${Eigen3_FIND_VERSION} is required")
+  endif(NOT EIGEN3_VERSION_OK)
+endmacro(_eigen3_check_version)
+
+if (EIGEN3_INCLUDE_DIR)
+
+  # in cache already
+  _eigen3_check_version()
+  set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
+
+else (EIGEN3_INCLUDE_DIR)
+
+  find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
+      PATHS
+      ${CMAKE_INSTALL_PREFIX}/include
+      ${KDE4_INCLUDE_DIR}
+      PATH_SUFFIXES eigen3 eigen
+    )
+
+  if(EIGEN3_INCLUDE_DIR)
+    _eigen3_check_version()
+  endif(EIGEN3_INCLUDE_DIR)
+
+  include(FindPackageHandleStandardArgs)
+  find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
+
+  mark_as_advanced(EIGEN3_INCLUDE_DIR)
+
+endif(EIGEN3_INCLUDE_DIR)
+
diff --git a/src/cmake/FindEigen3.cmake b/src/cmake/FindEigen3.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..9c546a05d859b18c49554d7ee7221cc486b7760e
--- /dev/null
+++ b/src/cmake/FindEigen3.cmake
@@ -0,0 +1,81 @@
+# - Try to find Eigen3 lib
+#
+# This module supports requiring a minimum version, e.g. you can do
+#   find_package(Eigen3 3.1.2)
+# to require version 3.1.2 or newer of Eigen3.
+#
+# Once done this will define
+#
+#  EIGEN3_FOUND - system has eigen lib with correct version
+#  EIGEN3_INCLUDE_DIR - the eigen include directory
+#  EIGEN3_VERSION - eigen version
+
+# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
+# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
+# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
+# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
+
+if(NOT Eigen3_FIND_VERSION)
+  if(NOT Eigen3_FIND_VERSION_MAJOR)
+    set(Eigen3_FIND_VERSION_MAJOR 2)
+  endif(NOT Eigen3_FIND_VERSION_MAJOR)
+  if(NOT Eigen3_FIND_VERSION_MINOR)
+    set(Eigen3_FIND_VERSION_MINOR 91)
+  endif(NOT Eigen3_FIND_VERSION_MINOR)
+  if(NOT Eigen3_FIND_VERSION_PATCH)
+    set(Eigen3_FIND_VERSION_PATCH 0)
+  endif(NOT Eigen3_FIND_VERSION_PATCH)
+
+  set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
+endif(NOT Eigen3_FIND_VERSION)
+
+macro(_eigen3_check_version)
+  file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
+
+  string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
+  set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
+  string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
+  set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
+  string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
+  set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
+
+  set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
+  if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+    set(EIGEN3_VERSION_OK FALSE)
+  else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+    set(EIGEN3_VERSION_OK TRUE)
+  endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
+
+  if(NOT EIGEN3_VERSION_OK)
+
+    message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
+                   "but at least version ${Eigen3_FIND_VERSION} is required")
+  endif(NOT EIGEN3_VERSION_OK)
+endmacro(_eigen3_check_version)
+
+if (EIGEN3_INCLUDE_DIR)
+
+  # in cache already
+  _eigen3_check_version()
+  set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
+
+else (EIGEN3_INCLUDE_DIR)
+
+  find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
+      PATHS
+      ${CMAKE_INSTALL_PREFIX}/include
+      ${KDE4_INCLUDE_DIR}
+      PATH_SUFFIXES eigen3 eigen
+    )
+
+  if(EIGEN3_INCLUDE_DIR)
+    _eigen3_check_version()
+  endif(EIGEN3_INCLUDE_DIR)
+
+  include(FindPackageHandleStandardArgs)
+  find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
+
+  mark_as_advanced(EIGEN3_INCLUDE_DIR)
+
+endif(EIGEN3_INCLUDE_DIR)
+
diff --git a/sm/csm/clustering.c b/src/csm/clustering.cpp
similarity index 100%
rename from sm/csm/clustering.c
rename to src/csm/clustering.cpp
diff --git a/sm/csm/csm_all.h b/src/csm/csm_all.h
similarity index 73%
rename from sm/csm/csm_all.h
rename to src/csm/csm_all.h
index c5e9bb32a5ce5927bc85aef857a3a9a827b53983..daf3e464974bff503209b7cc1577d2dfa9a4d975 100644
--- a/sm/csm/csm_all.h
+++ b/src/csm/csm_all.h
@@ -1,20 +1,20 @@
 #ifndef H_CSM_ALL
 #define H_CSM_ALL
 
-#include "csm.h"
+#include <csm/csm.h>
 
 #ifdef __cplusplus
 namespace CSM {}
-extern "C" {
+//extern "C" {
 #endif
 
-#include "json_journal.h"
+//#include "json_journal.h"
 #include "logging.h"
 #include "math_utils.h"
 #include "math_utils_gsl.h"
 
 #ifdef __cplusplus
-}
+//}
 #endif
 
 #endif
diff --git a/sm/csm/laser_data.c b/src/csm/laser_data.cpp
similarity index 86%
rename from sm/csm/laser_data.c
rename to src/csm/laser_data.cpp
index 7f47fb7ba4136648abb627fa95b231e133cad3f0..ebef8227bf601e194c4de70cf80b1c7a64249c16 100644
--- a/sm/csm/laser_data.c
+++ b/src/csm/laser_data.cpp
@@ -10,7 +10,7 @@ int* alloc_int_array(int n, int def);
 /* -------------------------------------------------- */
 
 LDP ld_alloc_new(int nrays) {
-	LDP ld = malloc(sizeof(struct laser_data));
+	LDP ld = (LDP) malloc(sizeof(struct laser_data));
 	ld_alloc(ld, nrays);
 	return ld;
 }
@@ -35,19 +35,19 @@ void ld_alloc(LDP ld, int nrays) {
 	ld->nrays = nrays;
 	
 	ld->valid        = alloc_int_array(nrays, 0);
-	ld->readings     = alloc_double_array(nrays, GSL_NAN);
-	ld->readings_sigma = alloc_double_array(nrays, GSL_NAN);
-	ld->theta        = alloc_double_array(nrays, GSL_NAN);
+	ld->readings     = alloc_double_array(nrays, std::numeric_limits<double>::quiet_NaN());
+	ld->readings_sigma = alloc_double_array(nrays, std::numeric_limits<double>::quiet_NaN());
+	ld->theta        = alloc_double_array(nrays, std::numeric_limits<double>::quiet_NaN());
 	
-	ld->min_theta = GSL_NAN;
-	ld->max_theta = GSL_NAN;
+	ld->min_theta = std::numeric_limits<double>::quiet_NaN();
+	ld->max_theta = std::numeric_limits<double>::quiet_NaN();
 	
 	ld->cluster      = alloc_int_array(nrays, -1);
-	ld->alpha        = alloc_double_array(nrays, GSL_NAN);
-	ld->cov_alpha    = alloc_double_array(nrays, GSL_NAN);
+	ld->alpha        = alloc_double_array(nrays, std::numeric_limits<double>::quiet_NaN());
+	ld->cov_alpha    = alloc_double_array(nrays, std::numeric_limits<double>::quiet_NaN());
 	ld->alpha_valid  = alloc_int_array(nrays, 0);
 
-	ld->true_alpha   = alloc_double_array(nrays, GSL_NAN);
+	ld->true_alpha   = alloc_double_array(nrays, std::numeric_limits<double>::quiet_NaN());
 	
 	ld->up_bigger    = alloc_int_array(nrays, 0);
 	ld->up_smaller   = alloc_int_array(nrays, 0);
@@ -67,7 +67,7 @@ void ld_alloc(LDP ld, int nrays) {
 	for(i=0;i<3;i++) {
 		ld->odometry[i] = 
 		ld->estimate[i] = 
-		ld->true_pose[i] = GSL_NAN;
+		ld->true_pose[i] = std::numeric_limits<double>::quiet_NaN();
 	}
 	
 	ld->points = (point2d*) malloc(nrays * sizeof(point2d));
@@ -77,7 +77,7 @@ void ld_alloc(LDP ld, int nrays) {
 		ld->points[i].p[0] = 
 		ld->points[i].p[1] = 
 		ld->points[i].rho = 
-		ld->points[i].phi = GSL_NAN;
+		ld->points[i].phi = std::numeric_limits<double>::quiet_NaN();
 		ld->points_w[i] = ld->points[i];
 	}
 	
@@ -124,8 +124,8 @@ void ld_compute_cartesian(LDP ld) {
 		
 		ld->points[i].p[0] = x, 
 		ld->points[i].p[1] = y;
-		ld->points[i].rho = GSL_NAN;
-		ld->points[i].phi = GSL_NAN;
+		ld->points[i].rho = std::numeric_limits<double>::quiet_NaN();
+		ld->points[i].phi = std::numeric_limits<double>::quiet_NaN();
 	}
 }
 
diff --git a/sm/csm/logging.c b/src/csm/logging.cpp
similarity index 99%
rename from sm/csm/logging.c
rename to src/csm/logging.cpp
index 647a6dbcb6d8c1645266c59bf805db2635bc8be4..95da035ba1b2fd08f44850596450372fc40a5ea9 100644
--- a/sm/csm/logging.c
+++ b/src/csm/logging.cpp
@@ -1,4 +1,3 @@
-#include <sys/param.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
@@ -7,6 +6,7 @@
 
 #include "logging.h"
 #include "csm_all.h"
+#include "utils.h"
 
 
 int sm_debug_write_flag = 0;
diff --git a/sm/csm/logging.h b/src/csm/logging.h
similarity index 100%
rename from sm/csm/logging.h
rename to src/csm/logging.h
diff --git a/sm/csm/math_utils.c b/src/csm/math_utils.cpp
similarity index 96%
rename from sm/csm/math_utils.c
rename to src/csm/math_utils.cpp
index 275aabf2e00d4e4951cd4d13855f07b72f0ae3b9..ba7c6c8f5dc95e8680f70bd93adda8b4006ada77 100644
--- a/sm/csm/math_utils.c
+++ b/src/csm/math_utils.cpp
@@ -1,10 +1,10 @@
 #include <assert.h>
-#include <gsl/gsl_nan.h>
+//#include <gsl/gsl_nan.h>
 
 #include "csm_all.h"
 
 int minmax(int from, int to, int x) {
-	return GSL_MAX(GSL_MIN(x,to),from);
+	return std::max(std::min(x,to),from);
 }
 
 void possible_interval(
@@ -186,7 +186,7 @@ double dist_to_segment_d(const double a[2], const double b[2], const double x[2]
 		/* the projection is inside the segment */
 		return distance;
 	} else 
-		return sqrt(GSL_MIN( distance_squared_d(a,x), distance_squared_d(b,x)));
+		return sqrt(std::min( distance_squared_d(a,x), distance_squared_d(b,x)));
 }
 
 int count_equal(const int*v, int n, int value) {
@@ -198,7 +198,7 @@ int count_equal(const int*v, int n, int value) {
 double normalize_0_2PI(double t) {
 	if(is_nan(t)) {
 		sm_error("Passed NAN to normalize_0_2PI().\n");
-		return GSL_NAN;
+		return std::numeric_limits<double>::quiet_NaN();
 	}
 	while(t<0) t+=2*M_PI;
 	while(t>=2*M_PI) t-=2*M_PI;
@@ -217,7 +217,7 @@ of the eye, and direction is the direction of the ray coming out of the eye. Ret
 if the ray intersects the segment, and in that case *range contains the length of the ray. */
 int segment_ray_tracing(const double p0[2], const double p1[2], const double eye[2], double direction, double*range) {
 	
-	*range = NAN;
+	*range = std::numeric_limits<double>::quiet_NaN();
 	
 	// p0 - p1
 	double arrow[2] = {p1[0]-p0[0],p1[1]-p0[1]};
diff --git a/sm/csm/math_utils.h b/src/csm/math_utils.h
similarity index 100%
rename from sm/csm/math_utils.h
rename to src/csm/math_utils.h
diff --git a/src/csm/math_utils_gsl.cpp b/src/csm/math_utils_gsl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..665f987022987df59e2ed0474d4865c747097e56
--- /dev/null
+++ b/src/csm/math_utils_gsl.cpp
@@ -0,0 +1,104 @@
+#include "csm_all.h"
+
+//void transform(const gsl_vector* p, const gsl_vector* x, gsl_vector*res) {
+//	double theta = gvg(x,2);
+//	double c = cos(theta); double s = sin(theta);
+//	gsl_vector_set(res, 0, c * gvg(p,0) -s*gvg(p,1) + gvg(x,0));
+//	gsl_vector_set(res, 1, s * gvg(p,0) +c*gvg(p,1) + gvg(x,1));
+//}
+//
+//void gsl_vector_set_nan(gsl_vector*v) {
+//	gvs(v,0,GSL_NAN);
+//	gvs(v,1,GSL_NAN);
+//}
+//
+//double norm(const gsl_vector*a){
+//	double x = gvg(a,0);
+//	double y = gvg(a,1);
+//	return sqrt(x*x+y*y);
+//}
+
+gsl_vector * vector_from_array(unsigned int n, double *x) {
+	gsl_vector * v = gsl_vector_alloc(n);
+	unsigned int i;
+	for(i=0;i<n;i++)
+		gvs(v,i,x[i]);
+
+	return v;
+}
+
+//void copy_from_array(gsl_vector*v, double*x) {
+//	size_t i;
+//	for(i=0;i<v->size;i++)
+//		gsl_vector_set(v,i, x[i]);
+//}
+
+void vector_to_array(const gsl_vector*v, double*x){
+	size_t i;
+	for(i=0;i<v->size();i++)
+		x[i] = gvg(v,i);
+}
+
+//void oplus(const gsl_vector*x1,const gsl_vector*x2, gsl_vector*res) {
+//	double c = cos(gvg(x1,2));
+//	double s = sin(gvg(x1,2));
+//	gvs(res,0,  gvg(x1,0)+c*gvg(x2,0)-s*gvg(x2,1));
+//	gvs(res,1,  gvg(x1,1)+s*gvg(x2,0)+c*gvg(x2,1));
+//	gvs(res,2,  gvg(x1,2)+gvg(x2,2));
+//}
+
+void ominus(const gsl_vector*x, gsl_vector*res) {
+	double c = cos(gvg(x,2));
+	double s = sin(gvg(x,2));
+	gvs(res,0,  -c*gvg(x,0)-s*gvg(x,1));
+	gvs(res,1,   s*gvg(x,0)-c*gvg(x,1));
+	gvs(res,2,  -gvg(x,2));
+}
+
+//void pose_diff(const gsl_vector*pose2,const gsl_vector*pose1,gsl_vector*res) {
+//	gsl_vector* temp = gsl_vector_alloc(3);
+//	ominus(pose1, temp);
+//	oplus(temp, pose2, res);
+//	gsl_vector_free(temp);
+//}
+
+const char* gsl_friendly_pose(gsl_vector*v) {
+	return friendly_pose(v->data());
+}
+
+//static char egsl_tmp_buf[1024];
+//const char* egsl_friendly_pose(val v) {
+//	sprintf(egsl_tmp_buf, "(%4.2f mm, %4.2f mm, %4.4f deg)",
+//		1000*egsl_atv(v,0),
+//		1000*egsl_atv(v,1),
+//		rad2deg(egsl_atv(v,2)));
+//	return egsl_tmp_buf;
+//}
+//
+//const char* egsl_friendly_cov(val cov) {
+//
+//	double limit_x  = 2 * sqrt(egsl_atm(cov, 0, 0));
+//	double limit_y  = 2 * sqrt(egsl_atm(cov, 1, 1));
+//	double limit_th = 2 * sqrt(egsl_atm(cov, 2, 2));
+//
+//	sprintf(egsl_tmp_buf, "(+- %4.2f mm,+- %4.2f mm,+- %4.4f deg)",
+//		1000*limit_x,
+//		1000*limit_y,
+//		rad2deg(limit_th));
+//	return egsl_tmp_buf;
+//}
+
+
+/*double distance(const gsl_vector* a, const gsl_vector* b) {
+	distance_counter++;
+	double x = gvg(a,0)-gvg(b,0);
+	double y = gvg(a,1)-gvg(b,1);
+	return sqrt(x*x+y*y);
+}
+
+double distance_squared(const gsl_vector* a, const gsl_vector* b) {
+	distance_counter++;
+	double x = gvg(a,0)-gvg(b,0);
+	double y = gvg(a,1)-gvg(b,1);
+	return x*x+y*y;
+}*/
diff --git a/src/csm/math_utils_gsl.h b/src/csm/math_utils_gsl.h
new file mode 100644
index 0000000000000000000000000000000000000000..df41637c9f76ba24afb3c44aca2ee658920e1819
--- /dev/null
+++ b/src/csm/math_utils_gsl.h
@@ -0,0 +1,41 @@
+#ifndef H_MATH_UTILS_GSL
+#define H_MATH_UTILS_GSL
+
+//#include <gsl/gsl_math.h>
+#include <egsl/egsl.h>
+
+#include <csm/laser_data.h>
+
+#define gvg gsl_vector_get
+#define gvs gsl_vector_set
+
+
+/* GSL stuff */
+	const char* gsl_friendly_pose(gsl_vector*v);
+	gsl_vector * vector_from_array(unsigned int n, double *x);
+	void vector_to_array(const gsl_vector*v, double*);
+	//void copy_from_array(gsl_vector*v, double*);
+
+	//void oplus(const gsl_vector*x1,const gsl_vector*x2, gsl_vector*res);
+	void ominus(const gsl_vector*x, gsl_vector*res);
+	//void pose_diff(const gsl_vector*pose2,const gsl_vector*pose1,gsl_vector*res);
+
+	//void transform(const gsl_vector* point2d, const gsl_vector* pose, gsl_vector*result2d);
+	//void gsl_vector_set_nan(gsl_vector*v);
+
+	//double distance(const gsl_vector* a,const gsl_vector* b);
+	//double distance_squared(const gsl_vector* a,const gsl_vector* b);
+
+	/** Returns norm of 2D point p */
+	//double norm(const gsl_vector*p);
+	//const char* egsl_friendly_pose(val pose);
+	//const char* egsl_friendly_cov(val cov);
+
+/** Returns Fisher's information matrix. You still have to multiply
+    it by (1/sigma^2). */
+val ld_fisher0(LDP ld);
+
+
+#endif
+
+
diff --git a/sm/csm/orientation.c b/src/csm/orientation.cpp
similarity index 73%
rename from sm/csm/orientation.c
rename to src/csm/orientation.cpp
index 5c3eb8998d50b87ba69b2afd2ca6e6c4d08eda13..8ad240235e4b3f895ba619160f8a7247cc9198de 100644
--- a/sm/csm/orientation.c
+++ b/src/csm/orientation.cpp
@@ -1,40 +1,43 @@
 #include <math.h>
-#include <gsl/gsl_nan.h>
 
 #include "csm_all.h"
 
 #include <egsl/egsl_macros.h>
+#include <vector>
 
-
-void find_neighbours(LDP ld, int i, int max_num, int*indexes, size_t*num_found);
+
+void find_neighbours(LDP ld, int i, int max_num, std::vector<int>& indexes, size_t*num_found);
 void filter_orientation(double theta0, double rho0, size_t n,
- 	const double*thetas, const double*rhos, double *alpha, double*cov0_alpha );
+ 	const std::vector<double>& thetas, const std::vector<double>& rhos, double *alpha, double*cov0_alpha );
 
 /** Requires the "cluster" field to be set */
 void ld_compute_orientation(LDP ld, int size_neighbourhood, double sigma) {
 	int i;
 	for(i=0;i<ld->nrays;i++){
 		if(!ld_valid_ray(ld,i) || (ld->cluster[i] == -1)) {
-			ld->alpha[i] = GSL_NAN;
-			ld->cov_alpha[i] = GSL_NAN;
+			ld->alpha[i] = std::numeric_limits<double>::quiet_NaN(); //GSL_NAN;
+			ld->cov_alpha[i] = std::numeric_limits<double>::quiet_NaN(); //GSL_NAN;
 			ld->alpha_valid[i] = 0;
 			continue;
 		}
 		
-		int neighbours[size_neighbourhood*2];
+		//int neighbours[size_neighbourhood*2];
+		std::vector<int> neighbours(size_neighbourhood*2, 0);
 		size_t num_neighbours;
 		find_neighbours(ld, i, size_neighbourhood, neighbours, &num_neighbours);
 
 		if(0==num_neighbours) {
-			ld->alpha[i] = GSL_NAN;
-			ld->cov_alpha[i] = GSL_NAN;
+			ld->alpha[i] = std::numeric_limits<double>::quiet_NaN(); //GSL_NAN;
+			ld->cov_alpha[i] = std::numeric_limits<double>::quiet_NaN(); //GSL_NAN;
 			ld->alpha_valid[i] = 0;
 			continue;
 		}
 
 /*		printf("orientation for i=%d:\n",i); */
-		double thetas[num_neighbours];
-		double readings[num_neighbours];
+		//double thetas[num_neighbours];
+		std::vector<double> thetas(num_neighbours, 0.0);
+		//double readings[num_neighbours];
+		std::vector<double> readings(num_neighbours, 0.0);
 		size_t a=0; 
 		for(a=0;a<num_neighbours;a++) {
 			thetas[a] = ld->theta[neighbours[a]];
@@ -45,10 +48,13 @@ void ld_compute_orientation(LDP ld, int size_neighbourhood, double sigma) {
 		double alpha=42, cov0_alpha=32;
 		filter_orientation(ld->theta[i],ld->readings[i],num_neighbours,
 			thetas,readings,&alpha,&cov0_alpha);
-		
-		if(gsl_isnan(alpha)) {
-			ld->alpha[i] = GSL_NAN;
-			ld->cov_alpha[i] = GSL_NAN;
+#ifndef WINDOWS
+		if(std::isnan(alpha)) {
+#else
+		if(_isnan(alpha)) {
+#endif
+			ld->alpha[i] = std::numeric_limits<double>::quiet_NaN();
+			ld->cov_alpha[i] = std::numeric_limits<double>::quiet_NaN();
 			ld->alpha_valid[i] = 0;
 		} else {  
 			ld->alpha[i] = alpha;
@@ -62,7 +68,7 @@ void ld_compute_orientation(LDP ld, int size_neighbourhood, double sigma) {
 /** A very cool algorithm for finding the orientation */
 
 void filter_orientation(double theta0, double rho0, size_t n,
- 	const double*thetas, const double*rhos, double *alpha, double*cov0_alpha ) {
+ 	const std::vector<double>& thetas, const std::vector<double>& rhos, double *alpha, double*cov0_alpha ) {
 	
 	egsl_push();
 	/* Y = L x + R epsilon */
@@ -93,8 +99,11 @@ void filter_orientation(double theta0, double rho0, size_t n,
 	
 	*cov0_alpha	= square(dalpha_df1) * cov_f1 + square(dalpha_drho);
 
-
-	if(gsl_isnan(*alpha)) {
+#ifndef WINDOWS
+        if(std::isnan(*alpha)) {
+#else
+        if(_isnan(*alpha)) {
+#endif
 		egsl_print("Y",Y);
 		egsl_print("L",L);
 		egsl_print("R",R);
@@ -129,7 +138,7 @@ void filter_orientation(double theta0, double rho0, size_t n,
 }
 
 /* indexes: an array of size "max_num*2" */
-void find_neighbours(LDP ld, int i, int max_num, int*indexes, size_t*num_found) {
+void find_neighbours(LDP ld, int i, int max_num, std::vector<int>& indexes, size_t*num_found) {
 	*num_found = 0;
 	
 	int up = i; 
diff --git a/sm/csm/sm_options.c b/src/csm/sm_options.cpp
similarity index 88%
rename from sm/csm/sm_options.c
rename to src/csm/sm_options.cpp
index f83adade3e04e021eabd2575d3c348d80cc40b08..083f827664b8786f86bd17586a0aa99e98c773e8 100644
--- a/sm/csm/sm_options.c
+++ b/src/csm/sm_options.cpp
@@ -1,7 +1,4 @@
-#include <options/options.h>
-
-#include "csm_all.h"
-
+#include "sm_options.h"
 
 void sm_options(struct sm_params*p, struct option*ops) {
 	
@@ -95,11 +92,11 @@ void sm_options(struct sm_params*p, struct option*ops) {
 		&(p->debug_verify_tricks), 0,
 		"Checks that find_correspondences_tricks gives the right answer.");
 
-	options_double(ops, "gpm_theta_bin_size_deg", &(p->gpm_theta_bin_size_deg), 5.0, 
-		"GPM: Dimension of bins for finding first theta.");
-	options_double(ops, "gpm_extend_range_deg", &(p->gpm_extend_range_deg), 15.0, 
-		"GPM: Area around maximum.");
-	options_int(ops, "gpm_interval", &(p->gpm_interval), 1, "Interval of points to consider (1: all points, 2: every other point, etc.)");
+	/*options_double(ops, "gpm_theta_bin_size_deg", &(p->gpm_theta_bin_size_deg), 5.0, */
+		/*"GPM: Dimension of bins for finding first theta.");*/
+	/*options_double(ops, "gpm_extend_range_deg", &(p->gpm_extend_range_deg), 15.0, */
+		/*"GPM: Area around maximum.");*/
+	/*options_int(ops, "gpm_interval", &(p->gpm_interval), 1, "Interval of points to consider (1: all points, 2: every other point, etc.)");*/
 
 	options_double(ops, "laser_x", &(p->laser[0]), 0.0, "laser.x (m)");
 	options_double(ops, "laser_y", &(p->laser[1]), 0.0, "laser.y (m)");
@@ -115,5 +112,5 @@ void sm_options(struct sm_params*p, struct option*ops) {
 		"If 1, the field 'readings_sigma' in the second scan is used to weight the correspondence by 1/sigma^2");
 		
 
-	hsm_add_options(ops, &p->hsm);
+	/*hsm_add_options(ops, &p->hsm);*/
 }
diff --git a/src/csm/sm_options.h b/src/csm/sm_options.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a1ab6ce0e53313598d912225888b47473aa1b03
--- /dev/null
+++ b/src/csm/sm_options.h
@@ -0,0 +1,9 @@
+#ifndef SM_OPTIONS_H
+#define SM_OPTIONS_H
+
+#include <options/options.h>
+#include "csm/csm_all.h"
+
+void sm_options(struct sm_params*p, struct option*ops);
+
+#endif
diff --git a/sm/csm/utils.c b/src/csm/utils.cpp
similarity index 98%
rename from sm/csm/utils.c
rename to src/csm/utils.cpp
index bb373d9dc225ff99c3e27f3d3fd8af337a24f4e8..a1145c9a3a8923e4c86517d7fc3ec59e6aba455c 100644
--- a/sm/csm/utils.c
+++ b/src/csm/utils.cpp
@@ -1,8 +1,10 @@
 #include <string.h>
 #include <errno.h>
 
+#include "utils.h"
 #include "csm_all.h"
 
+
 /** Wraps around fopen and provides error message. */
 FILE * open_file(const char *filename, const char*mode);
 
diff --git a/sm/csm/utils.h b/src/csm/utils.h
similarity index 100%
rename from sm/csm/utils.h
rename to src/csm/utils.h
diff --git a/sm/lib/egsl/egsl.c b/src/egsl/egsl.cpp
similarity index 70%
rename from sm/lib/egsl/egsl.c
rename to src/egsl/egsl.cpp
index c4943b49cd2896528c27d45d8bd6d5c921420d16..0b5efe5f121df48416a2dcb26aae9e1d2ba8b79a 100644
--- a/sm/lib/egsl/egsl.c
+++ b/src/egsl/egsl.cpp
@@ -1,10 +1,12 @@
-#include <gsl/gsl_matrix.h>
-#include <gsl/gsl_blas.h>
-#include <gsl/gsl_linalg.h>
+//#include <gsl/gsl_matrix.h>
+//#include <gsl/gsl_blas.h>
+//#include <gsl/gsl_linalg.h>
 
 #include <assert.h>
 #include <math.h>
 #include <string.h>
+#include <stdio.h>
+using namespace std;
 
 #include "egsl.h"
 #include "egsl_imp.h"
@@ -39,9 +41,9 @@ int egsl_cache_hits = 0;
 
 void egsl_error(void) {
 	/* TODO: better handling of errors */
-	
+
 	egsl_print_stats();
-	
+
 	assert(0);
 }
 
@@ -99,7 +101,7 @@ void egsl_push_named(const char*name) {
 		egsl_first_time  = 0;
 	}
 	cid++;
-	
+
 	if(cid >= MAX_CONTEXTS) {
 		fprintf(stderr, "egsl: maximum number of contexts reached \n");
 		egsl_print_stats();
@@ -111,7 +113,7 @@ void egsl_push_named(const char*name) {
 	if(name != 0) 
 		sprintf(egsl_contexts[cid].name, "%s", name);
 	else
-		sprintf(egsl_contexts[cid].name, "Unnamed context");
+		sprintf(egsl_contexts[cid].name, "Unnamed context");		
 }
 
 void egsl_pop_named(const char*name) {
@@ -145,7 +147,7 @@ void egsl_pop_check(int assumed) {
 }*/
 
 void egsl_print_stats() {
-	fprintf(stderr, "egsl: total allocations: %d   cache hits: %d\n",	
+	fprintf(stderr, "egsl: total allocations: %d   cache hits: %d\n",
 		egsl_total_allocations, egsl_cache_hits);
 /*	printf("egsl: sizeof(val) = %d\n",(int)sizeof(val)); */
 	int c; for(c=0;c<=max_cid&&c<MAX_CONTEXTS;c++) {
@@ -169,7 +171,7 @@ val egsl_alloc(size_t rows, size_t columns) {
 	int index = c->nvars;
 	if(index<c->nallocated) {
 		gsl_matrix*m = c->vars[index].gsl_m;
-		if(m->size1 == rows && m->size2 == columns) {
+		if(m->rows() == rows && m->cols() == columns) {
 			egsl_cache_hits++;
 			c->nvars++;
 			return assemble_val(cid,index,c->vars[index].gsl_m);
@@ -190,34 +192,50 @@ val egsl_alloc(size_t rows, size_t columns) {
 }
 
 val egsl_alloc_in_context(int context, size_t rows, size_t columns) {
-	struct egsl_context*c = egsl_contexts+context;
-	
-	if(c->nvars>=MAX_VALS) {
-		fprintf(stderr,"Limit reached, in context %d, nvars is %d\n",context,c->nvars);
-		egsl_error();
-	}
+    struct egsl_context*c = egsl_contexts+context;
+
+/*  if(cid<3)
+    printf("Alloc cid=%d nvars=%d nalloc=%d\n",cid,c->nvars,c->nallocated); */
+
+    if(c->nvars>=MAX_VALS) {
+        fprintf(stderr,"Limit reached, in context %d, nvars is %d\n",context,c->nvars);
+        egsl_error();
+    }
+    int index = c->nvars;
+    if(index<c->nallocated) {
+        gsl_matrix*m = c->vars[index].gsl_m;
+        if(m->rows() == rows && m->cols() == columns) {
+            egsl_cache_hits++;
+            c->nvars++;
+            return assemble_val(context,index,c->vars[index].gsl_m);
+        } else {
+            gsl_matrix_free(m);
+            egsl_total_allocations++;
+            c->vars[index].gsl_m = gsl_matrix_alloc((size_t)rows,(size_t)columns);
+            c->nvars++;
+            return assemble_val(context,index,c->vars[index].gsl_m);
+        }
+    } else {
+        egsl_total_allocations++;
+        c->vars[index].gsl_m = gsl_matrix_alloc((size_t)rows,(size_t)columns);
+        c->nvars++;
+        c->nallocated++;
+        return assemble_val(context,index,c->vars[index].gsl_m);
+    }
+}
+
+/*
+val egsl_alloc_in_context(int context, size_t rows, size_t columns) {
+	egsl_total_allocations++;
+	struct egsl_context *c = egsl_contexts+context;
 	int index = c->nvars;
-	if(index<c->nallocated) {
-		gsl_matrix*m = c->vars[index].gsl_m;
-		if(m->size1 == rows && m->size2 == columns) {
-			egsl_cache_hits++;
-			c->nvars++;
-			return assemble_val(context,index,c->vars[index].gsl_m);
-		} else {
-			gsl_matrix_free(m);
-			egsl_total_allocations++;			
-			c->vars[index].gsl_m = gsl_matrix_alloc((size_t)rows,(size_t)columns);
-			c->nvars++;
-			return assemble_val(context,index,c->vars[index].gsl_m);
-		}
-	} else {
-		egsl_total_allocations++;
-		c->vars[index].gsl_m = gsl_matrix_alloc((size_t)rows,(size_t)columns);
-		c->nvars++;
-		c->nallocated++;
-		return assemble_val(context,index,c->vars[index].gsl_m);
-	}
+	c->vars[index].gsl_m = gsl_matrix_alloc((size_t)rows,(size_t)columns);
+	c->nvars++;
+	c->nallocated++;
+	return assemble_val(context,index,c->vars[index].gsl_m);
 }
+*/
+
 
 /** Creates a copy of v in the previous context. */
 val egsl_promote(val v) {
@@ -226,7 +244,7 @@ val egsl_promote(val v) {
 	}
 
 	gsl_matrix * m = egsl_gslm(v);
-	val v2 = egsl_alloc_in_context(cid-1, m->size1, m->size2);
+	val v2 = egsl_alloc_in_context(cid-1, m->rows(), m->cols());
 	gsl_matrix * m2 = egsl_gslm(v2);
 	gsl_matrix_memcpy(m2, m);
 	return v2;
@@ -237,12 +255,12 @@ val egsl_promote(val v) {
 
 void egsl_expect_size(val v, size_t rows, size_t cols) {
 	gsl_matrix * m = egsl_gslm(v);
-	
-	int bad = (rows && (m->size1!=rows)) || (cols && (m->size2!=cols));
+
+	int bad = (rows && (m->rows()!=rows)) || (cols && (m->cols()!=cols));
 	if(bad) {
 		fprintf(stderr, "Matrix size is %d,%d while I expect %d,%d",
-			(int)m->size1,(int)m->size2,(int)rows,(int)cols);
-		
+			(int)m->rows(),(int)m->cols(),(int)rows,(int)cols);
+
 		egsl_error();
 	}
 }
@@ -254,19 +272,19 @@ void egsl_print(const char*str, val v) {
 	int context = its_context(v);
 	int var_index = its_var_index(v);
 	fprintf(stderr, "%s =  (%d x %d)  context=%d index=%d\n",
-		str,(int)m->size1,(int)m->size2,  context, var_index);
+		str,(int)m->rows(),(int)m->cols(),  context, var_index);
 
-	for(i=0;i<m->size1;i++) {
+	for(i=0;i<m->rows();i++) {
 		if(i==0)
 			fprintf(stderr, " [ ");
 		else
 			fprintf(stderr, "   ");
 		
-		for(j=0;j<m->size2;j++) 
+		for(j=0;j<m->cols();j++)
 			fprintf(stderr, "%f ", gsl_matrix_get(m,i,j));
 		
 		
-		if(i==m->size1-1)
+		if(i==m->rows()-1)
 			fprintf(stderr, "] \n");
 		else
 			fprintf(stderr, "; \n");
@@ -284,7 +302,7 @@ double egsl_norm(val v1){
 	double n=0;
 	size_t i;
 	gsl_matrix * m = egsl_gslm(v1);
-	for(i=0;i<m->size1;i++) {
+	for(i=0;i<m->rows();i++) {
 		double v = gsl_matrix_get(m,i,0);
 		n += v * v;
 	}
@@ -295,17 +313,18 @@ double egsl_atv(val v1,  size_t i){
 	return *egsl_atmp(v1, i, 0);
 }
 
-double egsl_atm(val v1, size_t i, size_t j){
-	return *egsl_atmp(v1, i, j);
-}
+//double egsl_atm(val v1, size_t i, size_t j){
+//	return *egsl_atmp(v1, i, j);
+//}
 
-void egsl_free(void){
-	int c;
-	for(c=0;c<=max_cid;c++) {
-		for(int i=egsl_contexts[c].nvars; i<egsl_contexts[c].nallocated; i++){
-			gsl_matrix_free(egsl_contexts[c].vars[i].gsl_m);
-		}
-	egsl_contexts[c].nallocated = egsl_contexts[c].nvars;
-	} 
-}
 
+void egsl_free_unused_memory(){
+  int c;
+  int freecounter = 0;
+  for(c=0;c<=max_cid;c++) {
+    for(int i=egsl_contexts[c].nvars; i<egsl_contexts[c].nallocated; i++){
+      gsl_matrix_free(egsl_contexts[c].vars[i].gsl_m);
+    }
+    egsl_contexts[c].nallocated = egsl_contexts[c].nvars;
+  }
+}
diff --git a/sm/lib/egsl/egsl.h b/src/egsl/egsl.h
similarity index 71%
rename from sm/lib/egsl/egsl.h
rename to src/egsl/egsl.h
index 0b8c17cd77f2c66fcd93fcd00d6d0906e82e7782..3cac81dd30a2a7c1161c5f15e48e4950d3d0fe08 100644
--- a/sm/lib/egsl/egsl.h
+++ b/src/egsl/egsl.h
@@ -1,13 +1,14 @@
 #ifndef H_EASY_GSL
 #define H_EASY_GSL
 
-#include <gsl/gsl_vector.h>
-#include <gsl/gsl_matrix.h>
+//#include <gsl/gsl_vector.h>
+//#include <gsl/gsl_matrix.h>
 
+#include <gsl_eigen/gsl_eigen.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+//#ifdef __cplusplus
+//extern "C" {
+//#endif
 
 struct egsl_val {
 	gsl_matrix * gslm;
@@ -29,7 +30,7 @@ void egsl_free(void);
 
 double* egsl_atmp(val v, size_t i, size_t j);
 val egsl_alloc(size_t rows, size_t columns);
-val egsl_alloc_in_context(int cid, size_t rows, size_t cols);
+val egsl_alloc_in_context(int cid, size_t rows, size_t cols); //used by egsl_promote
 gsl_matrix * egsl_gslm(val v);
 /** Creates a copy of v in the previous context.*/
 val egsl_promote(val v);
@@ -37,7 +38,7 @@ val egsl_promote(val v);
 /** Operations among values */
 val egsl_scale(double, val);
 val egsl_sum(val, val);
-val egsl_sum3(val, val, val);
+//val egsl_sum3(val, val, val);
 val egsl_mult(val, val);
 val egsl_transpose(val);
 val egsl_inverse(val);
@@ -50,10 +51,10 @@ void egsl_add_to_col(val v1, size_t j, val v2);
 
 double egsl_norm(val);
 
-void egsl_symm_eig(val v, double* eigenvalues, val* eigenvectors);
+//void egsl_symm_eig(val v, double* eigenvalues, val* eigenvectors);
 
 double egsl_atv(val, size_t i);
-double egsl_atm(val, size_t i, size_t j);
+//double egsl_atm(val, size_t i, size_t j);
 
 /* File: egsl_conversions.c
   Conversions */
@@ -62,14 +63,14 @@ val egsl_vFa(size_t rows, const double*);
 val egsl_vFda(size_t rows, size_t columns, const double*);
 
 /** Copies a VECTOR value into array */
-void egsl_v2a(val, double*);
+//void egsl_v2a(val, double*);
 /** Copies a MATRIX value into array (row1 .. rown) */
-void egsl_v2da(val, double*);
+//void egsl_v2da(val, double*);
 /** Copies a vector value into a gsl_vector */
-void egsl_v2vec(val, gsl_vector*);
+//void egsl_v2vec(val, gsl_vector*);
 
-val egsl_vFgslv(const gsl_vector*);
-val egsl_vFgslm(const gsl_matrix*);
+//val egsl_vFgslv(const gsl_vector*);
+//val egsl_vFgslm(const gsl_matrix*);
 
 gsl_matrix* egsl_v2gslm(val);
 
@@ -82,9 +83,9 @@ val egsl_rot(double theta);
 
 
 /* Misc */
-void egsl_print(const char*str, val);	
+void egsl_print(const char*str, val);
 /** Prints eigenvalues and eigenvectors of a symmetric matrix */
-void egsl_print_spectrum(const char*s, val v);
+//void egsl_print_spectrum(const char*s, val v);
 void egsl_print_stats(void);
 
 
@@ -94,8 +95,11 @@ void egsl_expect_size(val v, size_t rows, size_t cols);
 void egsl_error(void);
 
 
-#ifdef __cplusplus
-}
-#endif
+void egsl_free_unused_memory();
+
+
+//#ifdef __cplusplus
+//}
+//#endif
 
 #endif
diff --git a/src/egsl/egsl_conversions.cpp b/src/egsl/egsl_conversions.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..eb38b7e3bb89c01649421b8d3bb433678b605fae
--- /dev/null
+++ b/src/egsl/egsl_conversions.cpp
@@ -0,0 +1,64 @@
+#include "egsl.h"
+
+val egsl_vFda(size_t rows, size_t cols, const double *a) {
+	val v = egsl_alloc(rows, cols);
+
+	size_t i; size_t j;
+	for(i=0;i<rows;i++)
+	for(j=0;j<cols;j++) {
+		*egsl_atmp(v,i,j) = a[j+i*cols];
+	}
+	return v;
+}
+
+val egsl_vFa(size_t rows, const double*a) {
+	val v = egsl_alloc(rows,1);
+	size_t i;
+	for(i=0;i<rows;i++)
+		*egsl_atmp(v,i,0) =  a[i];
+	return v;
+}
+
+//void egsl_v2a(val v, double*vec) {
+//	gsl_matrix *m = egsl_gslm(v);
+//	size_t i;
+//	for(i=0; i < m->size1; i++)
+//		vec[i] = gsl_matrix_get(m,i,0);
+//}
+
+//void egsl_v2da(val v, double*a){
+//	gsl_matrix *m = egsl_gslm(v);
+//	size_t i,j;
+//	for(i=0;i<m->size1;i++)
+//		for(j=0;j<m->size2;j++)
+//			a[j*m->size1 +i] = gsl_matrix_get(m,i,j);
+//}
+
+//void egsl_v2vec(val v, gsl_vector*vec) {
+//	size_t i;
+//	for(i=0;i<vec->size;i++)
+//		gsl_vector_set(vec,i, *egsl_atmp(v,i,0));
+//}
+
+
+//val egsl_vFgslv(const gsl_vector*vec){
+//	val v = egsl_alloc(vec->size,1);
+//	size_t i;
+//	for(i=0;i<vec->size;i++)
+//		*egsl_atmp(v,i,0) = gsl_vector_get(vec,i);
+//	return v;
+//}
+
+//val egsl_vFgslm(const gsl_matrix*m){
+//	val v = egsl_alloc(m->size1,m->size2);
+//	gsl_matrix * m2 = egsl_gslm(v);
+//	gsl_matrix_memcpy(m2,m);
+//	return v;
+//}
+
+gsl_matrix* egsl_v2gslm(val v){
+	gsl_matrix * m = egsl_gslm(v); 
+	gsl_matrix * m2 = gsl_matrix_alloc(m->rows(),m->cols());
+	gsl_matrix_memcpy(m2,m);
+	return m2;
+}
diff --git a/sm/lib/egsl/egsl_imp.h b/src/egsl/egsl_imp.h
similarity index 100%
rename from sm/lib/egsl/egsl_imp.h
rename to src/egsl/egsl_imp.h
diff --git a/sm/lib/egsl/egsl_macros.h b/src/egsl/egsl_macros.h
similarity index 100%
rename from sm/lib/egsl/egsl_macros.h
rename to src/egsl/egsl_macros.h
diff --git a/sm/lib/egsl/egsl_misc.c b/src/egsl/egsl_misc.cpp
similarity index 52%
rename from sm/lib/egsl/egsl_misc.c
rename to src/egsl/egsl_misc.cpp
index 2120e23bed9aa7b33afe8edd2effc0c3f0eead67..270db8f1f4bc9c45aa1b92ae017f27db18f084d8 100644
--- a/sm/lib/egsl/egsl_misc.c
+++ b/src/egsl/egsl_misc.cpp
@@ -1,5 +1,7 @@
 #include <math.h>
 #include "egsl.h"
+#include <stdio.h>
+using namespace std;
 
 val egsl_rot(double theta) {
 	double R[2*2] = {
@@ -28,18 +30,18 @@ val egsl_vers(double theta){
 	return egsl_vFa(2,v);
 }
 
-void egsl_print_spectrum(const char*s, val v) {
-	gsl_matrix *m = egsl_gslm(v);
-	/* expect same size */
-	size_t n = m->size1;
-	double eval[n]; val evec[n];
-	egsl_symm_eig(v, eval, evec);
- 	size_t i,j;
-	for(j=0;j<n;j++) {
-		fprintf(stderr, "%s | eval[%d] = %+5.5f evec[%d]= ",
-			s, (int)j, eval[j],(int)j);
-		for(i=0;i<n;i++) 
-			fprintf(stderr, "%+4.4f ", egsl_atv(evec[j],i));
-		fprintf(stderr, " sqrt(eval[%d])=%5.5f  \n", (int)j, sqrt(eval[j]));
-	}		
-}
+//void egsl_print_spectrum(const char*s, val v) {
+//	gsl_matrix *m = egsl_gslm(v);
+//	/* expect same size */
+//	size_t n = m->rows();
+//	double eval[n]; val evec[n];
+//	egsl_symm_eig(v, eval, evec);
+// 	size_t i,j;
+//	for(j=0;j<n;j++) {
+//		fprintf(stderr, "%s | eval[%d] = %+5.5f evec[%d]= ",
+//			s, (int)j, eval[j],(int)j);
+//		for(i=0;i<n;i++)
+//			fprintf(stderr, "%+4.4f ", egsl_atv(evec[j],i));
+//		fprintf(stderr, " sqrt(eval[%d])=%5.5f  \n", (int)j, sqrt(eval[j]));
+//	}
+//}
diff --git a/src/egsl/egsl_ops.cpp b/src/egsl/egsl_ops.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1a5e661be41bc65925e5fb9ec4ac8ea9129ae272
--- /dev/null
+++ b/src/egsl/egsl_ops.cpp
@@ -0,0 +1,185 @@
+//#include <gsl/gsl_matrix.h>
+//#include <gsl/gsl_blas.h>
+//#include <gsl/gsl_linalg.h>
+//#include <gsl/gsl_eigen.h>
+
+#include "egsl.h"
+
+
+
+val egsl_sub(val v1,val v2){
+	return egsl_sum(v1, egsl_scale(-1.0,v2));
+}
+
+val egsl_compose_col(val v1, val v2){
+	gsl_matrix *m1 = egsl_gslm(v1);
+	gsl_matrix *m2 = egsl_gslm(v2);
+	egsl_expect_size(v2, 0, m1->cols());
+	val v3 = egsl_alloc(m1->rows()+m2->rows(),m1->cols());
+	gsl_matrix *m3 = egsl_gslm(v3);
+	size_t i,j;
+	for(j=0;j<m1->cols();j++) {
+		for(i=0;i<m1->rows();i++)
+			gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j));
+		
+		for(i=0;i<m2->rows();i++)
+			gsl_matrix_set(m3, m1->rows()+i, j, gsl_matrix_get(m2,i,j));
+	}
+	return v3;
+}
+
+val egsl_compose_row(val v1, val v2){
+	gsl_matrix *m1 = egsl_gslm(v1);
+	gsl_matrix *m2 = egsl_gslm(v2);
+	egsl_expect_size(v2, m1->rows(), 0);
+	val v3 = egsl_alloc(m1->rows(), m1->cols() + m2->cols());
+	gsl_matrix *m3 = egsl_gslm(v3);
+	size_t i,j;
+	for(i=0;i<m1->rows();i++) {
+		for(j=0;j<m1->cols();j++)
+			gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j));
+		
+		for(j=0;j<m2->cols();j++)
+			gsl_matrix_set(m3, i, m1->cols()+j, gsl_matrix_get(m2,i,j));
+	}
+	return v3;
+}
+
+void egsl_add_to(val v1, val v2) {
+	gsl_matrix * m1 = egsl_gslm(v1);
+	gsl_matrix * m2 = egsl_gslm(v2);
+	gsl_matrix_add(m1,m2);
+}
+
+void egsl_add_to_col(val v1, size_t j, val v2) {
+/*	egsl_print("m1",v1);
+	egsl_print("m2",v2); */
+	gsl_matrix * m1 = egsl_gslm(v1);
+	gsl_matrix * m2 = egsl_gslm(v2);
+
+/*	printf("m1 size = %d,%d j = %d\n",m1->rows(),m1->cols(),j); */
+	egsl_expect_size(v2, m1->rows(), 1);
+	size_t i;
+	for(i=0;i<m1->rows();i++) {
+		*gsl_matrix_ptr(m1, i, j) += gsl_matrix_get(m2,i,0);
+	}
+}
+
+
+val egsl_copy_val(val v1) {
+	gsl_matrix * m1 = egsl_gslm(v1);
+	val v2 = egsl_alloc(m1->rows(),m1->cols());
+	gsl_matrix * m2 = egsl_gslm(v2);
+	gsl_matrix_memcpy(m2,m1);
+	return v2;
+}
+
+val egsl_scale(double s, val v1){
+	val v2 = egsl_copy_val(v1);
+	gsl_matrix * m2 = egsl_gslm(v2);
+	gsl_matrix_scale(m2, s);
+	return v2;
+}
+
+val egsl_sum(val v1, val v2){
+	gsl_matrix * m1 = egsl_gslm(v1);
+	gsl_matrix * m2 = egsl_gslm(v2);
+	val v3 = egsl_alloc(m1->rows(),m1->cols());
+	gsl_matrix * m3 = egsl_gslm(v3);
+	gsl_matrix_memcpy(m3,m1);
+	gsl_matrix_add(m3,m2);
+	return v3;
+}
+
+//val egsl_sum3(val v1, val v2, val v3){
+//	return egsl_sum(v1, egsl_sum(v2,v3));
+//}
+
+val egsl_mult(val v1, val v2){
+	gsl_matrix * a = egsl_gslm(v1);
+	gsl_matrix * b = egsl_gslm(v2);
+	val v = egsl_alloc(a->rows(),b->cols());
+	gsl_matrix * ab = egsl_gslm(v); 
+
+	//gsl_blas_dgemm(CblasNoTrans,CblasNoTrans,1.0,a,b,0.0,ab);
+	*ab = *a * *b;
+
+	return v;
+
+}
+
+val egsl_transpose(val v1){
+	gsl_matrix * m1 = egsl_gslm(v1);
+	val v2 = egsl_alloc(m1->cols(),m1->rows());
+	gsl_matrix * m2 = egsl_gslm(v2);
+
+	*m2 = m1->transpose();
+	//gsl_matrix_transpose_memcpy(m2,m1);
+
+	return v2;
+}
+
+val egsl_inverse(val v1){
+	gsl_matrix*A = egsl_gslm(v1);
+	val v2 = egsl_alloc(A->rows(),A->rows());
+	gsl_matrix*invA = egsl_gslm(v2);
+
+
+//	size_t n = A->rows();
+//	gsl_matrix * m = gsl_matrix_alloc(n,n);
+//
+//	gsl_matrix_memcpy(m,A);
+//	gsl_permutation * perm = gsl_permutation_alloc (n);
+//	/* Make LU decomposition of matrix m */
+//	int s;
+//	gsl_linalg_LU_decomp (m, perm, &s);
+//	/* Invert the matrix m */
+//	gsl_linalg_LU_invert (m, perm, invA);
+//	gsl_permutation_free(perm);
+//	gsl_matrix_free(m);
+
+	*invA = A->inverse();
+
+	return v2;
+}
+
+//void egsl_symm_eig(val v, double* eigenvalues, val* eigenvectors) {
+//	gsl_matrix *m = egsl_gslm(v);
+//	size_t N = m->rows();
+//	/* Check for v to be square */
+//
+//	gsl_matrix *A = gsl_matrix_alloc(N,N);
+//	gsl_matrix_memcpy(A, m);
+//
+//	gsl_vector *eval = gsl_vector_alloc(N);
+//	gsl_matrix *evec = gsl_matrix_alloc(N,N);
+//
+//	gsl_eigen_symmv_workspace * ws = gsl_eigen_symmv_alloc(N);
+//	gsl_eigen_symmv(A, eval, evec, ws);
+//	gsl_eigen_symmv_free(ws);
+//
+//
+//	gsl_eigen_symmv_sort(eval, evec, GSL_EIGEN_SORT_VAL_DESC);
+//
+//	size_t j;
+//	for(j=0;j<N;j++) {
+//		eigenvalues[j] = gsl_vector_get(eval, j);
+//		eigenvectors[j] = egsl_alloc(N,1);
+//		size_t i;
+//		for(i=0;i<N;i++)
+//			*egsl_atmp(eigenvectors[j],i,0) = gsl_matrix_get(evec,i,j);
+//	}
+//
+//
+//	gsl_vector_free(eval);
+//	gsl_matrix_free(evec);
+//	gsl_matrix_free(A);
+//}
+
+
+
+
+
+
+
+
diff --git a/sm/lib/gpc/gpc.c b/src/gpc/gpc.cpp
similarity index 87%
rename from sm/lib/gpc/gpc.c
rename to src/gpc/gpc.cpp
index 97cb3219208b9042359f92504a4ceb7f06029e62..63fa715cd7b91318e8498a950a184327f7dc8e95 100644
--- a/sm/lib/gpc/gpc.c
+++ b/src/gpc/gpc.cpp
@@ -17,40 +17,57 @@
 */
 
 #include <math.h>
-#include <gsl/gsl_math.h>
+//#include <gsl/gsl_math.h>
+//#include <gsl/gsl_matrix.h>
 #include "gpc.h"
 #include "gpc_utils.h"
+#include <gsl_eigen/gsl_eigen.h>
+#include <stdio.h>
+#include <vector>
+using namespace std;
 
+
+//original version
 /* Note that we use static values here so we don't need to evaluate that all the time */
-#define M(matrix, rows, col) static gsl_matrix*matrix=0; if(!matrix) matrix = gsl_matrix_alloc(rows,col);
-#define MF(matrix) /*gsl_matrix_free(matrix)*/
+//#define M(matrix, rows, col) static gsl_matrix*matrix=0; if(!matrix) matrix = gsl_matrix_alloc(rows,col);
+//#define MF(matrix) /*gsl_matrix_free(matrix)*/
+
+//version to free the memory, slower
+//#define M(matrix, rows, col) static gsl_matrix*matrix=0; if(!matrix) matrix = gsl_matrix_alloc(rows,col);
+//#define MF(matrix) gsl_matrix_free(matrix); matrix=0;
 
+//New version: have static Eigen variables and use pointers to these for compatibility
+#define TAGME(name, tag) name##tag
+#define M(matrix, rows, col) static Eigen::MatrixXd TAGME(matrix,_mem)(rows, col); static gsl_matrix* matrix=&TAGME(matrix,_mem);
+#define MF(matrix)
 
-int gpc_solve(int K, const struct gpc_corr*c,
+
+int gpc_solve(int K, const std::vector<gpc_corr>& c,
 	const double*x0, const double *cov_x0,
-	double *x_out) 
+	double *x_out)
 {
+  (void) x0; (void) cov_x0;
 	M(bigM,    4,4); M(g,  4,1); M(bigM_k,2,4);
 	M(bigM_k_t,4,2); M(C_k,2,2); M(q_k,   2,1);
 	M(temp41,  4,1); M(temp22,2,2);	M(temp22b,2,2);
 	M(temp42,  4,2); M(temp44,4,4);	M(temp21, 2,1);
 	M(temp22c, 2,2); M(temp12,1,2);
-	
+
 	gsl_matrix_set_zero(bigM);
 	gsl_matrix_set_zero(g);
 	gsl_matrix_set_zero(temp42);
-	
+
 	double d_bigM[4][4] = { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}};
 	double d_g[4] = {0, 0, 0, 0};
 	int k;
 	for(k=0;k<K;k++) {
 		if(!c[k].valid) continue;
-		
+
 		double C00 = c[k].C[0][0];
 		double C01 = c[k].C[0][1];
 		double C10 = c[k].C[1][0];
 		double C11 = c[k].C[1][1];
-		
+
 		if(C01 != C10) {
 			fprintf(stderr, "k=%d; I expect C to be a symmetric matrix.\n", k);
 			return 0;
@@ -65,25 +82,25 @@ int gpc_solve(int K, const struct gpc_corr*c,
 			return 0;
 		}
 #endif
-		
+
 		double qx = c[k].q[0];
 		double qy = c[k].q[1];
 		double px = c[k].p[0];
 		double py = c[k].p[1];
-		
+
 		/* [ C00,  c01,  px C00 + c01 py , c01 px - py C00 ] */
 		d_bigM[0][0] += C00;
 		d_bigM[0][1] += C01;
 		d_bigM[0][2] += +px * C00 + py * C01;
 		d_bigM[0][3] += -py * C00 + px * C01;
-	
+
 		/*  [ C10 ,  C11 , py C11 + px C10 , px C11 - py C10 ] */
 		d_bigM[1][0] += C10;
 		d_bigM[1][1] += C11;
 		d_bigM[1][2] += +px * C10 + py * C11;
 		d_bigM[1][3] += +px * C11 - py * C10;
-		
-		/*Col 1 = [ py C10 + px C00 ] 
+
+		/*Col 1 = [ py C10 + px C00 ]
 		 Col 2 = [ py C11 + c01 px ]
 		 Col 3 = [ py (py C11 + px C10) + px (px C00 + c01 py) ]
 		 Col 4 = [ py (px C11 - py C10) + px (c01 px - py C00) ]
@@ -93,7 +110,7 @@ int gpc_solve(int K, const struct gpc_corr*c,
 		d_bigM[2][2] += (px*px)*(+C00) + (px*py)*(+C10+C01) + (py*py)*(+C11);
 		d_bigM[2][3] += (px*px)*(+C01) + (px*py)*(-C00+C11) + (py*py)*(-C10);
 
-		/*Col 1 = [ px C10 - py C00 ] 
+		/*Col 1 = [ px C10 - py C00 ]
 		  Col 2 = [ px C11 - c01 py ]
 		 Col 3 = [ px (py C11 + px C10) - py (px C00 + c01 py) ]
 		 Col 4 = [ px (px C11 - py C10) - py (c01 px - py C00) ]*/
@@ -101,7 +118,7 @@ int gpc_solve(int K, const struct gpc_corr*c,
 		d_bigM[3][1] += -py * C01 + px * C11;
 		d_bigM[3][2] += (px*px)*(+C10) + (px*py)*(-C00+C11) + (py*py)*(-C01);
 		d_bigM[3][3] += (px*px)*(+C11) + (px*py)*(-C10-C01) + (py*py)*(+C00);
-		
+
 		d_g[0] += C00*qx+C10*qy;
 		d_g[1] += C01*qx+C11*qy;
 		d_g[2] += qx * (C00*px+C01*py) + qy * (C10*px+C11*py);
@@ -111,14 +128,14 @@ int gpc_solve(int K, const struct gpc_corr*c,
 
 	{
 	unsigned int a,b;
-	 for(a=0;a<4;a++) 
+	 for(a=0;a<4;a++)
 			*gsl_matrix_ptr(g, a, 0) = -2 * d_g[a];
-	 for(a=0;a<4;a++) 
+	 for(a=0;a<4;a++)
 		for(b=0;b<4;b++)
 		gsl_matrix_set(bigM, a, b,  2 * d_bigM[a][b]);
 	}
 
-	
+
 	M(mA,2,2); gms(mA,0,0, gmg(bigM,0,0)); gms(mA,0,1, gmg(bigM,0,1));
 	           gms(mA,1,0, gmg(bigM,1,0)); gms(mA,1,1, gmg(bigM,1,1));
 	M(mB,2,2); gms(mB,0,0, gmg(bigM,0,2)); gms(mB,0,1, gmg(bigM,0,3));
@@ -128,22 +145,22 @@ int gpc_solve(int K, const struct gpc_corr*c,
 
 	M(mS,2,2); M(mSa,2,2);
 
-	 
+
 	/*	mS = mD - mB.trans * mA.inv * mB;
 	  temp22b = inv(A) */
-	m_inv(mA, temp22b); 
+	m_inv(mA, temp22b);
 	/* temp22c = inv(A) * mB           */
 	m_mult(temp22b, mB, temp22c);
 	/* temp22 = mB'               */
-	m_trans(mB, temp22); 
-	m_mult(temp22, temp22c, temp22b); 
+	m_trans(mB, temp22);
+	m_mult(temp22, temp22c, temp22b);
 	m_scale(-1.0,temp22b);
 	m_add(mD,temp22b,mS);
-	
+
 	/* mSa = mS.inv * mS.det; */
 	m_inv(mS, mSa);
 	m_scale(m_det(mS), mSa);
-	
+
 	if(TRACE_ALGO) {
 		m_display("mA",mA);
 		m_display("mB",mB);
@@ -155,7 +172,7 @@ int gpc_solve(int K, const struct gpc_corr*c,
 	M(g1,2,1);	M(g2,2,1);
 	M(g1t,1,2);	M(g2t,1,2);
 	M(mAi,2,2);	M(mBt,2,2);
-	
+
 	gms(g1,0,0,gmg(g,0,0));
 	gms(g1,1,0,gmg(g,1,0));
 	gms(g2,0,0,gmg(g,2,0));
@@ -178,20 +195,20 @@ int gpc_solve(int K, const struct gpc_corr*c,
 	m_mult(m1t,mSa,m2t);
 	m_trans(m2t,m2);
 	/* m3t = g2t*mSa     */
-	m_mult(g2t,mSa,m3t); 
+	m_mult(g2t,mSa,m3t);
 	m_trans(m3t,m3);
-	
+
 	double p[3] = {
 		  m_dot(m2t,m2) - 2*m_dot(m2t,m3) +   m_dot(m3t,m3),
 		4*m_dot(m2t,m1) - 8*m_dot(m2t,g2) + 4*m_dot(g2t,m3),
 		4*m_dot(m1t,m1) - 8*m_dot(m1t,g2) + 4*m_dot(g2t,g2)};
 
 	double l[3] = {m_det(mS), 2*gmg(mS,0,0)+2*gmg(mS,1,1), 4};
-	
+
 	/* q = p - l^2        */
-	double q[5] = {p[0]-(l[0]*l[0]), p[1]-(2*l[1]*l[0]), 
+	double q[5] = {p[0]-(l[0]*l[0]), p[1]-(2*l[1]*l[0]),
 		p[2]-(l[1]*l[1]+2*l[0]*l[2]), -(2*l[2]*l[1]), -(l[2]*l[2])};
-	
+
 	if(TRACE_ALGO) {
 		fprintf(stderr, "p = %f %f %f \n", p[2], p[1], p[0]);
 		fprintf(stderr, "l = %f %f %f \n", l[2], l[1], l[0]);
@@ -207,49 +224,49 @@ int gpc_solve(int K, const struct gpc_corr*c,
 
 	double lambdas_error[4];
 	double lambdas_pose[4][3];
-	
+
 	for(int i=0;i<4;i++) {
 		double lambda = lambdas[i];
-		
+
 		if(TRACE_ALGO) {
 			fprintf(stderr, "lambda = %f \n", lambda);
-		}	
-	
+		}
+
 		M(W,4,4); gsl_matrix_set_zero(W); gms(W,2,2,1.0); gms(W,3,3,1.0);
 		M(x,4,1);
-	
+
 		m_scale(2*lambda, W);
 		gsl_matrix_add(bigM,W);
 		m_inv(bigM, temp44);
 		m_mult(temp44, g, x);
 		m_scale(-1.0, x);
-	
+
 		lambdas_pose[i][0] = gmg(x,0,0);
 		lambdas_pose[i][1] = gmg(x,1,0);
 		lambdas_pose[i][2] = atan2(gmg(x,3,0),gmg(x,2,0));
-		
+
 		lambdas_error[i] = gpc_total_error(c, K, lambdas_pose[i]);
 	}
-	
+
 	int lowest_error = 0;
 	for(int i=0;i<4;i++) {
 		printf("#%d lambda=%lf error=%lf\n",i,lambdas[i],lambdas_error[i]);
 		if(lambdas_error[i] < lambdas_error[lowest_error])
 			lowest_error = i;
 	}
-	
+
 	double lr;
 	poly_greatest_real_root(5,q,&lr);
 	printf("Choose %d: lambda = %lf   bigger real root = %lf \n",lowest_error,lambdas[lowest_error],lr);
-	
+
 	x_out[0]=lambdas_pose[lowest_error][0];
 	x_out[1]=lambdas_pose[lowest_error][1];
 	x_out[2]=lambdas_pose[lowest_error][2];
 	*/
-	
+
 	double lambda;
 	if(!poly_greatest_real_root(5, q, &lambda)) return 0;
-	
+
 	M(W,4,4); gsl_matrix_set_zero(W); gms(W,2,2,1.0); gms(W,3,3,1.0);
 	M(x,4,1);
 
@@ -266,7 +283,7 @@ int gpc_solve(int K, const struct gpc_corr*c,
 	if(TRACE_ALGO) {
 		fprintf(stderr, "x =  %f  %f %f deg\n", x_out[0], x_out[1],x_out[2]*180/M_PI);
 	}
-	
+
 	MF(mA); MF(mB); MF(mD); MF(mS); MF(mSa);
 	MF(m1t);	MF(m1);	MF(m2t);	MF(m2);
 	MF(m3t);	MF(m3);	MF(W); 	MF(x);
@@ -289,7 +306,7 @@ double gpc_error(const struct gpc_corr*co, const double*x) {
 	e[0] = c*(co->p[0]) -s*(co->p[1]) + x[0] - co->q[0];
 	e[1] = s*(co->p[0]) +c*(co->p[1]) + x[1] - co->q[1];
 	double this_error = e[0]*e[0]*co->C[0][0]+2*e[0]*e[1]*co->C[0][1]+e[1]*e[1]*co->C[1][1];
-	
+
 	if(0) /* due to limited numerical precision, error might be negative */
 	if(this_error < 0) {
 		fprintf(stderr, "Something fishy: error = %lf e = [%lf %lf]  C = [%lf,%lf;%lf,%lf]\n", this_error,
@@ -298,11 +315,12 @@ double gpc_error(const struct gpc_corr*co, const double*x) {
 	return this_error;
 }
 
-double gpc_total_error(const struct gpc_corr*co, int n, const double*x){
+double gpc_total_error(const std::vector<gpc_corr>& co, int n, const double*x){
+  int i;
 	double error = 0;
-	for(int i=0;i<n;i++) {
+	for(i=0;i<n;i++) {
 		if(!co[i].valid) continue;
-		error += gpc_error(co+i,x);
+		error += gpc_error(&(co.at(i)),x);
 	}
 	if(0) /* due to limited numerical precision, error might be negative */
 	if(error<0) {
diff --git a/sm/lib/gpc/gpc.h b/src/gpc/gpc.h
similarity index 91%
rename from sm/lib/gpc/gpc.h
rename to src/gpc/gpc.h
index 5e23614e07e156a42170653015c6e267669cf0c4..c524309e9a03ceffc2fd0de56e2523033a36b07a 100644
--- a/sm/lib/gpc/gpc.h
+++ b/src/gpc/gpc.h
@@ -20,6 +20,8 @@
 #ifndef H_GENERAL_POINT_CORRESPONDENCE
 #define H_GENERAL_POINT_CORRESPONDENCE
 
+#include <vector>
+
 struct gpc_corr {
 	double p[2];
 	double q[2];
@@ -46,7 +48,7 @@ struct gpc_corr {
 #define GPC_CHECK_SEMIDEF 0
 
 /** if c[k].valid is 0, the correspondence is not used */
-int gpc_solve(int K, const struct gpc_corr*, 
+int gpc_solve(int K, const std::vector<gpc_corr>&,
 	const double*x0, const double *cov_x0,
 	double *x);
 
@@ -55,6 +57,6 @@ int gpc_solve(int K, const struct gpc_corr*,
 	/** Computes error for a single correspondence */
 	double gpc_error(const struct gpc_corr*co, const double*x);
 
-	double gpc_total_error(const struct gpc_corr*co, int n, const double*x);
+	double gpc_total_error(const std::vector<gpc_corr>& co, int n, const double*x);
 #endif
 
diff --git a/src/gpc/gpc_utils.cpp b/src/gpc/gpc_utils.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5051fe078bd12d566894b6936ca241de4b1d0c32
--- /dev/null
+++ b/src/gpc/gpc_utils.cpp
@@ -0,0 +1,170 @@
+#include "gpc.h"
+#include "gpc_utils.h"
+#include <stdio.h>
+#include <iostream>
+using namespace std;
+
+#include <unsupported/Eigen/Polynomials>
+
+void m_trans(const gsl_matrix*A, gsl_matrix*A_t){
+	//gsl_matrix_transpose_memcpy(A_t,A);
+    *A_t = A->transpose();
+}
+
+void m_mult(const gsl_matrix*A, const gsl_matrix*B, gsl_matrix*AB){
+	//gsl_blas_dgemm(CblasNoTrans,CblasNoTrans,1.0,A,B,0.0,AB);
+    *AB = *A * *B;
+}
+
+//void m_add_to(const gsl_matrix*A, gsl_matrix*B){
+//	gsl_matrix_add(B, A);
+//}
+
+void m_scale(double m, gsl_matrix*A){
+	gsl_matrix_scale(A,m);
+}
+
+void m_add (const gsl_matrix*A, const gsl_matrix*B, gsl_matrix*ApB){
+	gsl_matrix_memcpy(ApB,A);
+	gsl_matrix_add(ApB,B);
+}
+
+void m_inv(const gsl_matrix*A, gsl_matrix*invA) {
+//	unsigned int n = A->rows();
+//	gsl_matrix * m = gsl_matrix_alloc(n,n);
+//	gsl_matrix_memcpy(m,A);
+//	gsl_permutation * perm = gsl_permutation_alloc (n);
+//	/* Make LU decomposition of matrix m */
+//	int s;
+//	gsl_linalg_LU_decomp (m, perm, &s);
+//	/* Invert the matrix m */
+//	gsl_linalg_LU_invert (m, perm, invA);
+//	gsl_permutation_free(perm);
+//	gsl_matrix_free(m);
+
+  *invA = A->inverse();
+}
+
+double m_det(const gsl_matrix*A) {
+//	unsigned int n = A->rows();
+//	gsl_matrix * m = gsl_matrix_alloc(n,n);
+//	gsl_matrix_memcpy(m,A);
+//	gsl_permutation * perm = gsl_permutation_alloc (n);
+//	int sign;
+//	gsl_linalg_LU_decomp (m, perm, &sign);
+//	double det = gsl_linalg_LU_det(m, sign);
+//
+//	gsl_permutation_free(perm);
+//	gsl_matrix_free(m);
+//	return det;
+  return A->determinant();
+}
+
+double m_dot(const gsl_matrix*A,const gsl_matrix*B) {
+	double sum = 0;
+	unsigned int j;
+	for(j=0;j<A->cols();j++)
+		sum += gmg(A,0,j)*gmg(B,j,0);
+	return sum;
+}
+
+//int poly_real_roots(unsigned int n, const double*a, double *roots) {
+//	double z[(n-1)*2];
+//	gsl_poly_complex_workspace * w  = gsl_poly_complex_workspace_alloc(n);
+//	if(GSL_SUCCESS != gsl_poly_complex_solve (a, n, w, z)) {
+//		return 0;
+//	}
+//	gsl_poly_complex_workspace_free (w);
+//
+//	unsigned int i=0;
+//	for(i=0;i<n-1;i++) {
+//		roots[i] = z[2*i];
+//	}
+//	return 1;
+//}
+
+
+int poly_greatest_real_root(unsigned int n, const double*a, double *root) {
+//	unsigned int i;
+//
+//	double z[(n-1)*2];
+//	gsl_poly_complex_workspace * w  = gsl_poly_complex_workspace_alloc(n);
+//	if(GSL_SUCCESS != gsl_poly_complex_solve (a, n, w, z)) {
+//		return 0;
+//	}
+//	gsl_poly_complex_workspace_free (w);
+//	if(TRACE_ALGO) {
+//		printf("Solving the equation\n a = [");
+//		for(i=0;i<n;i++) {
+//			printf("%lf ", a[i]);
+//		}
+//		printf("]\n");
+//	}
+//
+//	double lambda = 0; int assigned = 0;
+//	for (i = 0; i < n-1; i++) {
+//		if(TRACE_ALGO) {
+//			fprintf (stderr, "root z%d = %+.18f + %+.18f i \n", i, z[2*i], z[2*i+1]);
+//		}
+///*		 XXX ==0 is bad */
+//		if( z[2*i+1]==0 ) /* real root */
+//			if(!assigned || (z[2*i]>lambda)) {
+//				assigned = 1;
+//				lambda = z[2*i];
+//			}
+//	}
+
+    Eigen::VectorXd poly_coeffs(n);
+    for(unsigned int i=0; i<n; i++){
+      poly_coeffs(i) = a[i];
+    }
+    if(n!=5){
+      std::cerr<<"ERROR: WRONG DEGREE POLYNOMIAL TO SOLVE."<<std::endl;
+      return 0;
+    }
+    Eigen::PolynomialSolver<double, 4> psolve(poly_coeffs);
+
+    //std::cerr<<"dims "<<psolve.roots().rows()<<" "<<psolve.roots().cols()<<std::endl;
+    Eigen::Matrix<std::complex<double>, 4, 1, 0, 4, 1> eigen_roots = psolve.roots();
+
+    int assigned = 0;
+    double lambda = 0;
+    for(unsigned int i=0; i<eigen_roots.size(); i++){
+      if(eigen_roots(i).imag() == 0){
+        if(!assigned || eigen_roots(i).real() > lambda) {
+          assigned = 1;
+          lambda = eigen_roots(i).real();
+        }
+      }
+    }
+
+	if(TRACE_ALGO)
+		fprintf (stderr, "lambda = %+.18f \n", lambda);
+	if(!assigned) {
+		fprintf(stderr, "poly_greatest_real_root: Could not find real root for polynomial.\n");
+		fprintf(stderr, "polynomial coefficients : ");
+		for (int i = 0; i < n; i++)
+			fprintf(stderr, " %lf ", a[i]);
+		fprintf(stderr, "\nRoots:\n");
+
+		for (int i = 0; i < n-1; i++)
+			fprintf (stderr, "root z%d = %+.18f + %+.18f i \n", i, eigen_roots(i).real(), eigen_roots(i).imag());
+
+		return 0;
+	}
+
+	*root = lambda;
+	return 1;
+}
+
+void m_display(const char*str, gsl_matrix*m) {
+	printf("%s= \n", str);
+	unsigned int i,j;
+	for(i=0;i<m->rows();i++) {
+		printf("   ");
+		for(j=0;j<m->cols();j++)
+			printf("%e ", gmg(m,i,j));
+		printf("\n");
+	}
+}
+
diff --git a/sm/lib/gpc/gpc_utils.h b/src/gpc/gpc_utils.h
similarity index 74%
rename from sm/lib/gpc/gpc_utils.h
rename to src/gpc/gpc_utils.h
index 40bf03269ce1d1c397ea598512cd7be679480262..f08139ec1a93a5ad76421f8112649605a25c378b 100644
--- a/sm/lib/gpc/gpc_utils.h
+++ b/src/gpc/gpc_utils.h
@@ -1,10 +1,12 @@
 #ifndef H_GPC_UTILS
 #define H_GPC_UTILS
 
-#include <gsl/gsl_matrix.h>
-#include <gsl/gsl_blas.h>
-#include <gsl/gsl_linalg.h>
-#include <gsl/gsl_poly.h>
+//#include <gsl/gsl_matrix.h>
+//#include <gsl/gsl_blas.h>
+//#include <gsl/gsl_linalg.h>
+//#include <gsl/gsl_poly.h>
+
+#include <gsl_eigen/gsl_eigen.h>
 
 /* The GSL is a pain to work with. The library DOES NOT HAVE a determinant() function
   or an inv() function: you have to write your own routines. */
@@ -15,14 +17,14 @@
 void m_trans(const gsl_matrix*A, gsl_matrix*A_t);
 void m_mult(const gsl_matrix*A, const gsl_matrix*B, gsl_matrix*AB);
 void m_add(const gsl_matrix*A, const gsl_matrix*B, gsl_matrix*ApB);
-void m_add_to(const gsl_matrix*A, gsl_matrix*B);
+//void m_add_to(const gsl_matrix*A, gsl_matrix*B);
 void m_scale(double m, gsl_matrix*A);
 double m_dot(const gsl_matrix*A,const gsl_matrix*B);
 void m_inv(const gsl_matrix*A, gsl_matrix*invA);
 double m_det(const gsl_matrix*A);
 
 /* Returns the real part of the roots in roots */
-int poly_real_roots(unsigned int n, const double*a, double *roots);
+//int poly_real_roots(unsigned int n, const double*a, double *roots);
 
 int poly_greatest_real_root(unsigned int n, const double*a, double *root);
 
diff --git a/sm/csm/icp/icp.c b/src/icp/icp.cpp
similarity index 89%
rename from sm/csm/icp/icp.c
rename to src/icp/icp.cpp
index 4472ea2792afd6bd7c0b7d71f7d807c3ef864737..4d5f987e1d9576539a56836331c9d4a9249366bb 100644
--- a/sm/csm/icp/icp.c
+++ b/src/icp/icp.cpp
@@ -1,18 +1,19 @@
 #include <math.h>
 #include <string.h>
 
-#include <gsl/gsl_matrix.h>
+//#include <gsl/gsl_matrix.h>
+#include <gsl_eigen/gsl_eigen.h>
 
-#include <gpc/gpc.h>
+//#include <gpc/gpc.h>
 #include <egsl/egsl_macros.h>
 
-#include "../csm_all.h"
+#include "../csm/csm_all.h"
 
 #include "icp.h"
 
 
 void sm_journal_open(const char* file) {
-	file = 0;
+	file = 0; (void) file;
 /*	journal_open(file);*/
 }
 
@@ -51,8 +52,6 @@ void sm_icp(struct sm_params*params, struct sm_result*res) {
 		count_equal(laser_ref->valid, laser_ref->nrays, 1), laser_ref->nrays,
    	   params->min_reading, params->max_reading);
 	
-	if(JJ) jj_context_enter("sm_icp");
-	
 	egsl_push_named("sm_icp");
 	
 			
@@ -69,9 +68,6 @@ void sm_icp(struct sm_params*params, struct sm_result*res) {
 		ld_compute_orientation(laser_sens, params->orientation_neighbourhood, params->sigma);
 	}
 
-	if(JJ) jj_add("laser_ref",  ld_to_json(laser_ref));
-	if(JJ) jj_add("laser_sens", ld_to_json(laser_sens));
-	
 	gsl_vector * x_new = gsl_vector_alloc(3);
 	gsl_vector * x_old = vector_from_array(3, params->first_guess);
 	
@@ -89,12 +85,11 @@ void sm_icp(struct sm_params*params, struct sm_result*res) {
 	double error;
 	int iterations;
 	int nvalid;
-	if(!icp_loop(params, x_old->data, x_new->data, &error, &nvalid, &iterations)) {
+	if(!icp_loop(params, x_old->data(), x_new->data(), &error, &nvalid, &iterations)) {
 		sm_error("icp: ICP failed for some reason. \n");
 		res->valid = 0;
 		res->iterations = iterations;
 		res->nvalid = 0;
-		
 	} else {
 		/* It was succesfull */
 		
@@ -124,7 +119,7 @@ void sm_icp(struct sm_params*params, struct sm_result*res) {
 					gvs(start, 2, gvg(x_new,2)+perturb[a][2]);
 				gsl_vector * x_a = gsl_vector_alloc(3);
 				double my_error; int my_valid; int my_iterations;
-				if(!icp_loop(&my_params, start->data, x_a->data, &my_error, &my_valid, &my_iterations)){
+				if(!icp_loop(&my_params, start->data(), x_a->data(), &my_error, &my_valid, &my_iterations)){
 					sm_error("Error during restart #%d/%d. \n", a, 6);
 					break;
 				}
@@ -161,13 +156,13 @@ void sm_icp(struct sm_params*params, struct sm_result*res) {
 			res->dx_dy2_m = egsl_v2gslm(dx_dy2);
 		
 			if(0) {
-				egsl_print("cov0_x", cov0_x);
-				egsl_print_spectrum("cov0_x", cov0_x);
+				//egsl_print("cov0_x", cov0_x);
+				//egsl_print_spectrum("cov0_x", cov0_x);
 		
 				val fim = ld_fisher0(laser_ref);
 				val ifim = inv(fim);
 				egsl_print("fim", fim);
-				egsl_print_spectrum("ifim", ifim);
+				//egsl_print_spectrum("ifim", ifim);
 			}
 		}
 	
@@ -180,8 +175,10 @@ void sm_icp(struct sm_params*params, struct sm_result*res) {
 	gsl_vector_free(x_new);
 	gsl_vector_free(x_old);
 
-
 	egsl_pop_named("sm_icp");
 
-	if(JJ) jj_context_exit();
+}
+
+void csm_free_unused_memory(){
+  egsl_free_unused_memory();
 }
diff --git a/sm/csm/icp/icp.h b/src/icp/icp.h
similarity index 97%
rename from sm/csm/icp/icp.h
rename to src/icp/icp.h
index 298bfcd6977e360b4d87b0e4138ebbdd29703a54..1b0f6a436dfae1c1dc263340142522c5e38b8d9d 100644
--- a/sm/csm/icp/icp.h
+++ b/src/icp/icp.h
@@ -1,9 +1,9 @@
 #ifndef _H_ICP_
 #define _H_ICP_
 
-#include <gpc/gpc.h>
-#include "../csm_all.h"
+//#include <gpc/gpc.h>
 
+#include <csm/csm_all.h>
 
 /** This sets the stage.  */
 void sm_icp(struct sm_params*params, struct sm_result*res);
diff --git a/sm/csm/icp/icp_corr_dumb.c b/src/icp/icp_corr_dumb.cpp
similarity index 93%
rename from sm/csm/icp/icp_corr_dumb.c
rename to src/icp/icp_corr_dumb.cpp
index 025b89ab5bf3484bf99ca613482ce64aa12d89fd..4cb490af7cb113b6e660d682bf8806c98afc0fdd 100644
--- a/sm/csm/icp/icp_corr_dumb.c
+++ b/src/icp/icp_corr_dumb.cpp
@@ -1,7 +1,8 @@
-#include <gsl/gsl_vector.h>
+//#include <gsl/gsl_vector.h>
+#include <gsl_eigen/gsl_eigen.h>
 
 #include "icp.h"
-#include "../csm_all.h"
+#include "../csm/csm_all.h"
 
 int compatible(struct sm_params*params, int i, int j);
 
@@ -94,7 +95,7 @@ void find_correspondences(struct sm_params*params) {
 		ld_set_correspondence(laser_sens, i, j1, j2);
 		laser_sens->corr[i].dist2_j1 = best_dist;
 		laser_sens->corr[i].type = 
-			params->use_point_to_line_distance ? corr_pl : corr_pp;
+			params->use_point_to_line_distance ? correspondence::corr_pl : correspondence::corr_pp;
 		
 	}
 	
diff --git a/sm/csm/icp/icp_corr_tricks.c b/src/icp/icp_corr_tricks.cpp
similarity index 96%
rename from sm/csm/icp/icp_corr_tricks.c
rename to src/icp/icp_corr_tricks.cpp
index 3cdef2d226e85cdbc8442954a670ddf886aa3f1b..5d5010d69a6de351450e0e9e18d1ac7ed62b24fa 100644
--- a/sm/csm/icp/icp_corr_tricks.c
+++ b/src/icp/icp_corr_tricks.cpp
@@ -1,10 +1,11 @@
-#include <gsl/gsl_vector.h>
+//#include <gsl/gsl_vector.h>
+#include <gsl_eigen/gsl_eigen.h>
 
 #include "icp.h"
-#include "../csm_all.h"
+#include "../csm/csm_all.h"
 
 /** This is very close (but *less* than) to sin(x), for 
-    x in (0, PI/2). It's a 5° degree taylor expansion. */
+    x in (0, PI/2). It's a 5ïŋ― degree taylor expansion. */
 INLINE double mysin(double x) {
 	const double a = -1.0/6.0;
 	const double b = +1.0/120.0;
@@ -47,9 +48,6 @@ INLINE double local_distance_squared_d(const double* a, const double* b)  {
 	return x*x + y*y;
 }
 
-#include "fast_math.h"
-
-
 #define SQUARE(a) ((a)*(a))
 
 /* Assumes that points_w is filled.  */
@@ -224,7 +222,7 @@ void find_correspondences_tricks(struct sm_params*params) {
 		laser_sens->corr[i].j2 = j2;
 		laser_sens->corr[i].dist2_j1 = best_dist;
 		laser_sens->corr[i].type = 
-			params->use_point_to_line_distance ? corr_pl : corr_pp;
+			params->use_point_to_line_distance ? correspondence::corr_pl : correspondence::corr_pp;
 		
 	}
 }
diff --git a/sm/csm/icp/icp_covariance.c b/src/icp/icp_covariance.cpp
similarity index 97%
rename from sm/csm/icp/icp_covariance.c
rename to src/icp/icp_covariance.cpp
index 3d4db6447add915f705ddcedaccb954a4c5c4af1..c0f3736b485383d1ddfb0a89f7a10237d2852d49 100644
--- a/sm/csm/icp/icp_covariance.c
+++ b/src/icp/icp_covariance.cpp
@@ -1,9 +1,8 @@
 #include <math.h>
-#include <gsl/gsl_math.h>
 #include <egsl/egsl_macros.h>
 
 #include "icp.h"
-#include "../csm_all.h"
+#include "../csm/csm_all.h"
 
 
 val compute_C_k(val p_j1, val p_j2);
@@ -24,8 +23,8 @@ void compute_covariance_exact(
 	val d2J_dt_dtheta = zeros(2,1);
 	val d2J_dtheta2   = zeros(1,1);
 	
-	double theta = x->data[2];
-	val t = egsl_vFa(2,x->data);
+	double theta = x->data()[2];
+	val t = egsl_vFa(2,x->data());
 	
 	int i; 
 	for(i=0;i<laser_sens->nrays;i++) {
diff --git a/sm/csm/icp/icp_debug.c b/src/icp/icp_debug.cpp
similarity index 78%
rename from sm/csm/icp/icp_debug.c
rename to src/icp/icp_debug.cpp
index f4d761b8cb1b041fc54f28a282117838c0371775..3bd37caa8c4e7475330924b476a49a172a96da7f 100644
--- a/sm/csm/icp/icp_debug.c
+++ b/src/icp/icp_debug.cpp
@@ -1,13 +1,18 @@
 #include <string.h>
 #include "icp.h"
+#include <vector>
 
 void debug_correspondences(struct sm_params * params) {
 	LDP laser_sens = params->laser_sens;
 	/** Do the test */
 	find_correspondences_tricks(params);
-	struct correspondence c1[laser_sens->nrays];
+	//struct correspondence c1[laser_sens->nrays];
+	std::vector<correspondence> c1;
+	c1.reserve(laser_sens->nrays);
+
 	struct correspondence * c2 = laser_sens->corr;
-	memcpy(c1, c2, sizeof(struct correspondence) * laser_sens->nrays);
+	//memcpy(c1, c2, sizeof(struct correspondence) * laser_sens->nrays);
+	c1.assign(c2, c2+laser_sens->nrays);
 	long hash1 = ld_corr_hash(laser_sens);
 	find_correspondences(params);
 	long hash2 = ld_corr_hash(laser_sens);
diff --git a/sm/csm/icp/icp_loop.c b/src/icp/icp_loop.cpp
similarity index 91%
rename from sm/csm/icp/icp_loop.c
rename to src/icp/icp_loop.cpp
index f64d17a9a321c76e90c47f6494f68967bd10161a..4b1b7fd944a4417626936d3844254ae0e02f0647 100644
--- a/sm/csm/icp/icp_loop.c
+++ b/src/icp/icp_loop.cpp
@@ -1,14 +1,15 @@
 #include <math.h>
 #include <string.h>
 
-#include <gsl/gsl_matrix.h>
-
+//#include <gsl/gsl_matrix.h>
+#include <gsl_eigen/gsl_eigen.h>
 #include <gpc/gpc.h>
 #include <egsl/egsl_macros.h>
 
-#include "../csm_all.h"
+#include "../csm/csm_all.h"
 
 #include "icp.h"
+#include <vector>
 
 int icp_loop(struct sm_params*params, const double*q0, double*x_new, 
 	double*total_error, int*valid, int*iterations) {
@@ -21,19 +22,15 @@ int icp_loop(struct sm_params*params, const double*q0, double*x_new,
 	LDP laser_sens = params->laser_sens;
 	double x_old[3], delta[3], delta_old[3] = {0,0,0};
 	copy_d(q0, 3, x_old);
-	unsigned int hashes[params->max_iterations];
+	//unsigned int hashes[params->max_iterations];
+	std::vector<unsigned int> hashes(params->max_iterations, 0);
 	int iteration;
 	
 	sm_debug("icp: starting at  q0 =  %s  \n", friendly_pose(x_old));
 	
-	if(JJ) jj_loop_enter("iterations");
-	
 	int all_is_okay = 1;
 	
 	for(iteration=0; iteration<params->max_iterations;iteration++) {
-		if(JJ) jj_loop_iteration();
-		if(JJ) jj_add_double_array("x_old", x_old, 3);
-
 		egsl_push_named("icp_loop iteration");
 		sm_debug("== icp_loop: starting iteration. %d  \n", iteration);
 
@@ -62,28 +59,17 @@ int icp_loop(struct sm_params*params, const double*q0, double*x_new,
 			break;
 		}
 
-		if(JJ) jj_add("corr0", corr_to_json(laser_sens->corr, laser_sens->nrays));
-
 		/* Kill some correspondences (using dubious algorithm) */
 		if(params->outliers_remove_doubles)
 			kill_outliers_double(params);
 		
 		int num_corr2 = ld_num_valid_correspondences(laser_sens);
 
-		if(JJ) jj_add("corr1", corr_to_json(laser_sens->corr, laser_sens->nrays));
-		
 		double error=0;
 		/* Trim correspondences */
 		kill_outliers_trim(params, &error);
 		int num_corr_after = ld_num_valid_correspondences(laser_sens);
 		
-		if(JJ) {
-			jj_add("corr2", corr_to_json(laser_sens->corr, laser_sens->nrays));
-			jj_add_int("num_corr0", num_corr);
-			jj_add_int("num_corr1", num_corr2);
-			jj_add_int("num_corr2", num_corr_after);
-		}
-
 		*total_error = error; 
 		*valid = num_corr_after;
 
@@ -109,10 +95,6 @@ int icp_loop(struct sm_params*params, const double*q0, double*x_new,
 		
 		{
 			sm_debug("  icp_loop: killing. laser_sens has %d/%d rays valid,  %d corr found -> %d after double cut -> %d after adaptive cut \n", count_equal(laser_sens->valid, laser_sens->nrays, 1), laser_sens->nrays, num_corr, num_corr2, num_corr_after);
-			if(JJ) {
-				jj_add_double_array("x_new", x_new, 3);
-				jj_add_double_array("delta", delta, 3);
-			}
 		}
 		/** Checks for oscillations */
 		hashes[iteration] = ld_corr_hash(laser_sens);
@@ -155,8 +137,6 @@ int icp_loop(struct sm_params*params, const double*q0, double*x_new,
 		egsl_pop_named("icp_loop iteration");
 	}
 
-	if(JJ) jj_loop_exit();
-	
 	*iterations = iteration+1;
 	
 	return all_is_okay;
@@ -174,7 +154,9 @@ int compute_next_estimate(struct sm_params*params,
 	LDP laser_ref  = params->laser_ref;
 	LDP laser_sens = params->laser_sens;
 	
-	struct gpc_corr c[laser_sens->nrays];
+	//struct gpc_corr c[laser_sens->nrays];
+	struct gpc_corr dummy;
+	std::vector<gpc_corr> c(laser_sens->nrays, dummy);
 
 	int i; int k=0;
 	for(i=0;i<laser_sens->nrays;i++) {
@@ -189,7 +171,7 @@ int compute_next_estimate(struct sm_params*params,
 
 		c[k].valid = 1;
 		
-		if(laser_sens->corr[i].type == corr_pl) {
+		if(laser_sens->corr[i].type == correspondence::corr_pl) {
 
 			c[k].p[0] = laser_sens->points[i].p[0];
 			c[k].p[1] = laser_sens->points[i].p[1];
@@ -277,7 +259,7 @@ int compute_next_estimate(struct sm_params*params,
 					sm_error("Param use_ml_weights was active, but not valid alpha[] or true_alpha[]." 
 					          "Perhaps, if this is a single ray not having alpha, you should mark it as inactive.\n");						
 					sm_error("Writing laser_ref: \n");						
-					ld_write_as_json(laser_ref, stderr);
+					/*ld_write_as_json(laser_ref, stderr);*/
 					warned_before = 1;
 				}
 			}
@@ -292,7 +274,7 @@ int compute_next_estimate(struct sm_params*params,
 				if(!warned_before) {
 					sm_error("Param use_sigma_weights was active, but the field readings_sigma[] was not filled in.\n");						
 					sm_error("Writing laser_sens: \n");						
-					ld_write_as_json(laser_sens, stderr);
+					/*ld_write_as_json(laser_sens, stderr);*/
 				}
 			}
 		}
diff --git a/sm/csm/icp/icp_outliers.c b/src/icp/icp_outliers.cpp
similarity index 79%
rename from sm/csm/icp/icp_outliers.c
rename to src/icp/icp_outliers.cpp
index b4202e3bf606c23b713abf41a364650690874212..7c2e32a8c92721f76fee803a9b8c41a523f03bb6 100644
--- a/sm/csm/icp/icp_outliers.c
+++ b/src/icp/icp_outliers.cpp
@@ -1,14 +1,16 @@
 #include <math.h>
 
 #include "icp.h"
+#include <vector>
 
-void quicksort(double *array, int begin, int end);
+void quicksort(std::vector<double>& array, int begin, int end);
 double hoare_selection(double *data, int start, int end, int k);
 
 /** expects cartesian valid */
 void visibilityTest(LDP laser_ref, const gsl_vector*u) {
 
-	double theta_from_u[laser_ref->nrays];
+	//double theta_from_u[laser_ref->nrays];
+	std::vector<double> theta_from_u(laser_ref->nrays, 0.0);
 	
 	int j;
 	for(j=0;j<laser_ref->nrays;j++) {
@@ -45,8 +47,10 @@ void kill_outliers_double(struct sm_params*params) {
 	LDP laser_ref  = params->laser_ref;
 	LDP laser_sens = params->laser_sens;
 
-	double dist2_i[laser_sens->nrays];
-	double dist2_j[laser_ref->nrays];
+	//double dist2_i[laser_sens->nrays];
+	std::vector<double> dist2_i(laser_sens->nrays, 0.0);
+	//double dist2_j[laser_ref->nrays];
+	std::vector<double> dist2_j(laser_ref->nrays, 0.0);
 	int j; for(j=0;j<laser_ref->nrays;j++) 
 		dist2_j[j]= 1000000;
 	
@@ -55,7 +59,7 @@ void kill_outliers_double(struct sm_params*params) {
 		if(!ld_valid_corr(laser_sens, i)) continue;
 		int j1 = laser_sens->corr[i].j1;
 		dist2_i[i] = laser_sens->corr[i].dist2_j1;
-		dist2_j[j1] = GSL_MIN(dist2_j[j1], dist2_i[i]);
+		dist2_j[j1] = std::min(dist2_j[j1], dist2_i[i]);
 	}
 	
 	int nkilled = 0;
@@ -82,21 +86,21 @@ void kill_outliers_double(struct sm_params*params) {
 */
 void kill_outliers_trim(struct sm_params*params,  double*total_error) {
 		
-	if(JJ) jj_context_enter("kill_outliers_trim");
-		
 	LDP laser_ref  = params->laser_ref;
 	LDP laser_sens = params->laser_sens;
 	
 	/* dist2, indexed by k, contains the error for the k-th correspondence */
 	int k = 0; 
-	double dist2[laser_sens->nrays];
+	//double dist2[laser_sens->nrays];
+	std::vector<double> dist2(laser_sens->nrays, 0.0);
 		
 	int i;
-	double dist[laser_sens->nrays];
+	//double dist[laser_sens->nrays];
+	std::vector<double> dist(laser_sens->nrays, 0.0);
 	/* for each point in laser_sens */
 	for(i=0;i<laser_sens->nrays;i++) {
 		/* which has a valid correspondence */
-		if(!ld_valid_corr(laser_sens, i)) { dist[i]=NAN; continue; }
+		if(!ld_valid_corr(laser_sens, i)) { dist[i]=std::numeric_limits<double>::quiet_NaN(); continue; }
 		double *p_i_w = laser_sens->points_w[i].p;
 		
 		int j1 = laser_sens->corr[i].j1;
@@ -109,9 +113,6 @@ void kill_outliers_trim(struct sm_params*params,  double*total_error) {
 	}
 	
 	
-	if(JJ) jj_add_int("num_valid_before", k);
-	if(JJ) jj_add_double_array("dist_points", dist2, laser_sens->nrays);
-	if(JJ) jj_add_double_array("dist_corr_unsorted", dist2, k);
 
 #if 0	
 	double dist2_copy[k]; for(i=0;i<k;i++) dist2_copy[i] = dist2[i];
@@ -120,21 +121,20 @@ void kill_outliers_trim(struct sm_params*params,  double*total_error) {
 	/* two errors limits are defined: */
 		/* In any case, we don't want more than outliers_maxPerc% */
 		int order = (int)floor(k*(params->outliers_maxPerc));
-			order = GSL_MAX(0, GSL_MIN(order, k-1));
+			order = std::max(0, std::min(order, k-1));
 
 	/* The dists for the correspondence are sorted
 	   in ascending order */
 		quicksort(dist2, 0, k-1);
 		double error_limit1 = dist2[order];
-		if(JJ) jj_add_double_array("dist_corr_sorted", dist2, k);
 	
 		/* Then we take a order statics (o*K) */
 		/* And we say that the error must be less than alpha*dist(o*K) */
 		int order2 = (int)floor(k*params->outliers_adaptive_order);
-			order2 = GSL_MAX(0, GSL_MIN(order2, k-1));
+			order2 = std::max(0, std::min(order2, k-1));
 		double error_limit2 = params->outliers_adaptive_mult*dist2[order2];
 	
-	double error_limit = GSL_MIN(error_limit1, error_limit2);
+	double error_limit = std::min(error_limit1, error_limit2);
 	
 #if 0
 	double error_limit1_ho = hoare_selection(dist2_copy, 0, k-1, order);
@@ -145,11 +145,6 @@ void kill_outliers_trim(struct sm_params*params,  double*total_error) {
 	}
 #endif
 
-	if(JJ) jj_add_double_array("dist_corr_sorted", dist2, k);
-	if(JJ) jj_add_double("error_limit_max_perc", error_limit1);
-	if(JJ) jj_add_double("error_limit_adaptive", error_limit2);
-	if(JJ) jj_add_double("error_limit", error_limit);
-	
 	sm_debug("\ticp_outliers: maxPerc %f error_limit: fix %f adaptive %f \n",
 		params->outliers_maxPerc,error_limit1,error_limit2);
 
@@ -169,12 +164,6 @@ void kill_outliers_trim(struct sm_params*params,  double*total_error) {
 	
 	sm_debug("\ticp_outliers: valid %d/%d (limit: %f) mean error = %f \n",nvalid,k,error_limit,
 		*total_error/nvalid);	
-
-	if(JJ) jj_add_int("num_valid_after", nvalid);
-	if(JJ) jj_add_double("total_error", *total_error);
-	if(JJ) jj_add_double("mean_error", *total_error / nvalid);
-		
-	if(JJ) jj_context_exit();
 }
 
 
@@ -183,7 +172,7 @@ void swap_double(double*a,double*b) {
 }
 
 /** Code taken from Wikipedia */
-void quicksort(double *array, int begin, int end) {
+void quicksort(std::vector<double>& array, int begin, int end) {
 	if (end > begin) {
 		double pivot = array[begin];
 		int l = begin + 1;
@@ -193,11 +182,11 @@ void quicksort(double *array, int begin, int end) {
 				l++;
 			} else {
 				r--;
-				swap_double(array+l, array+r); 
+				swap_double(&(array[l]), &(array[r]));
 			}
 		}
 		l--;
-		swap_double(array+begin, array+l);
+		swap_double(&(array[begin]), &(array[l]));
 		if(l>begin)
 		quicksort(array, begin, l);
 		if(end>r)
diff --git a/sm/lib/options/options.c b/src/options/options.cpp
similarity index 74%
rename from sm/lib/options/options.c
rename to src/options/options.cpp
index 04d33383085d7ee154135a3b75c903fbf4116bbf..e61b2c43ae7bd9a2893b76d499dae1e922bc8011 100644
--- a/sm/lib/options/options.c
+++ b/src/options/options.cpp
@@ -15,12 +15,14 @@
 #include <limits.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <sys/param.h>
+//#include <sys/param.h>
 #include <ctype.h>
 #include <sys/stat.h>
-#include <unistd.h>
-#include <libgen.h>
+//#include <unistd.h>
+//#include <libgen.h>
 #include <string.h>
+#include <algorithm>
+#include <vector>
 
 #include "options.h"
 
@@ -84,9 +86,9 @@ int options_parse_args(struct option*ops, int argc, const char* argv[]) {
 				fprintf(stderr, "Please specify config file.\n");
 				if(!options_tolerant) return 0;
 			}
-			if(!options_parse_file(ops, ".", argv[i+1])) {
-				if(!options_tolerant) return 0;
-			}
+//			if(!options_parse_file(ops, ".", argv[i+1])) {
+//				if(!options_tolerant) return 0;
+//			}
 			i++;
 			continue;
 		}
@@ -128,91 +130,91 @@ int options_requires_argument(struct option*o) {
 }
 
 
-int options_parse_stream(struct option*ops, const char*pwd, FILE*file) {
-	#define MAX_LINE_LENGTH 10000
-	char linesto[MAX_LINE_LENGTH];
-	while(fgets(linesto, MAX_LINE_LENGTH-1, file)) {
-		char *line=linesto; while(*line) { if(*line=='\n') *line=0; line++; }
-		line = linesto;
-		while(isspace(*line)) line++;
-		if(*line == '#') continue;
-		if(*line == '<') { line++;
-			while(isspace(*line)) line++;
-			if(!options_parse_file(ops, pwd, line)) {
-				if(!options_tolerant) return 0;
-			}
-			continue;
-		}
-		if(!*line) continue;
-		/* Here starts the name; later we put a terminating 0 */
-		const char * name = line;
-		/* name continus until nonspace char */
-		while(!isspace(*line)) line++;
-
-		char empty[5] = "";
-		char * value;
-		if(*line == 0) value = empty; else {
-			*line = 0; /* terminating 0 for name */
-			line++;
-			/* ignore spaces */
-			while(isspace(*line)) line++;
-			/* ignore possible "=" */
-			if(*line == '=') line++;
-			/* ignore spaces */
-			while(isspace(*line)) line++;
-
-			/* here starts the value */
-			value = line;
-			/* delete final spaces */
-			int len = strlen(value);
-			while(isspace(value[len-1]) && len > 0) {
-				value[len-1] = 0; len--;
-			}
-		}
-				
-		if(!options_try_pair(ops, name, value) && !options_tolerant) {
-			return 0;
-		}
-	}
-	return 1;
-}
-
-int options_parse_file(struct option*ops, const char*pwd, const char*filename) {
-	char concat[PATH_MAX*2+1];
-
-	if(filename[0] != '/') {
-		strcpy(concat, pwd);
-		strcat(concat, "/");
-		strcat(concat, filename);
-	} else {
-		strcpy(concat, filename);	
-	}
-	
-	char resolved_path[PATH_MAX];
-	char *resolved;
-	if(! (resolved = realpath(concat, resolved_path))) {
-		fprintf(stderr, "Could not resolve '%s' ('%s').\n", concat, resolved); 
-		return 0;
-	}
-
-	const char * newdir = dirname(resolved);
-	if(!newdir) {
-		fprintf(stderr, "Could not get dirname for '%s'.\n",  resolved); 
-		free(resolved);
-		return 0;
-	}
-	
-	FILE * file;
-	file = fopen(resolved,"r");
-	if(file==NULL) {
-		fprintf(stderr, "Could not open '%s': %s.\n", resolved, strerror(errno)); 
-		/* free(resolved); */
-		return 0;
-	}
-	
-	/* free(resolved); */
-	return options_parse_stream(ops, newdir, file);
-}
+//int options_parse_stream(struct option*ops, const char*pwd, FILE*file) {
+//	#define MAX_LINE_LENGTH 10000
+//	char linesto[MAX_LINE_LENGTH];
+//	while(fgets(linesto, MAX_LINE_LENGTH-1, file)) {
+//		char *line=linesto; while(*line) { if(*line=='\n') *line=0; line++; }
+//		line = linesto;
+//		while(isspace(*line)) line++;
+//		if(*line == '#') continue;
+//		if(*line == '<') { line++;
+//			while(isspace(*line)) line++;
+//			if(!options_parse_file(ops, pwd, line)) {
+//				if(!options_tolerant) return 0;
+//			}
+//			continue;
+//		}
+//		if(!*line) continue;
+//		/* Here starts the name; later we put a terminating 0 */
+//		const char * name = line;
+//		/* name continus until nonspace char */
+//		while(!isspace(*line)) line++;
+//
+//		char empty[5] = "";
+//		char * value;
+//		if(*line == 0) value = empty; else {
+//			*line = 0; /* terminating 0 for name */
+//			line++;
+//			/* ignore spaces */
+//			while(isspace(*line)) line++;
+//			/* ignore possible "=" */
+//			if(*line == '=') line++;
+//			/* ignore spaces */
+//			while(isspace(*line)) line++;
+//
+//			/* here starts the value */
+//			value = line;
+//			/* delete final spaces */
+//			int len = strlen(value);
+//			while(isspace(value[len-1]) && len > 0) {
+//				value[len-1] = 0; len--;
+//			}
+//		}
+//
+//		if(!options_try_pair(ops, name, value) && !options_tolerant) {
+//			return 0;
+//		}
+//	}
+//	return 1;
+//}
+
+//int options_parse_file(struct option*ops, const char*pwd, const char*filename) {
+//	char concat[PATH_MAX*2+1];
+//
+//	if(filename[0] != '/') {
+//		strcpy(concat, pwd);
+//		strcat(concat, "/");
+//		strcat(concat, filename);
+//	} else {
+//		strcpy(concat, filename);
+//	}
+//
+//	char resolved_path[PATH_MAX];
+//	char *resolved;
+//	if(! (resolved = realpath(concat, resolved_path))) {
+//		fprintf(stderr, "Could not resolve '%s' ('%s').\n", concat, resolved);
+//		return 0;
+//	}
+//
+//	const char * newdir = dirname(resolved);
+//	if(!newdir) {
+//		fprintf(stderr, "Could not get dirname for '%s'.\n",  resolved);
+//		free(resolved);
+//		return 0;
+//	}
+//
+//	FILE * file;
+//	file = fopen(resolved,"r");
+//	if(file==NULL) {
+//		fprintf(stderr, "Could not open '%s': %s.\n", resolved, strerror(errno));
+//		/* free(resolved); */
+//		return 0;
+//	}
+//
+//	/* free(resolved); */
+//	return options_parse_stream(ops, newdir, file);
+//}
 
 
 /** Finds an option in the array. Returns 0 if not found. */
@@ -275,7 +277,11 @@ int options_set(struct option*o, const char*value) {
 			int * value_pointer = (int*) o->value_pointer;
 			struct option_alternative * a = o->alternative;
 			for(; a->label; a++) {
+#ifndef WINDOWS
 				if( !strcasecmp(a->label, value) ) {
+#else
+				if( !stricmp(a->label, value) ) {
+#endif
 					*value_pointer = a->value;
 					return 1;
 				}
@@ -304,14 +310,15 @@ int options_set(struct option*o, const char*value) {
 const char*options_value_as_string(struct option*o);
 
 void display_table(FILE*f,  char**table, int rows, int columns, int padding) {
-	int col_size[columns];
+	//int col_size[columns];
+	std::vector<int> col_size(columns, 0);
 	
 	int i,j;
 	for(j=0;j<columns;j++)  {
 		col_size[j]=0;
 		for(i=0;i<rows;i++) {
 			const char * s = table[j+i*columns];
-			col_size[j] = MAX(col_size[j], (int) strlen(s));
+			col_size[j] = (std::max)(col_size[j], (int) strlen(s));
 		}
 		col_size[j] += padding;
 	}
@@ -333,7 +340,7 @@ void options_dump(struct option * options, FILE*f, int write_desc) {
 	int n; for (n=0;options_valid(options+n);n++);
 
 	int nrows = n + 2;
-	char**table = malloc(sizeof(char*)*nrows*3);
+	char**table = (char**) malloc(sizeof(char*)*nrows*3);
 
 	int row = 0;
 	if(write_desc) {
@@ -396,7 +403,7 @@ void options_dump(struct option * options, FILE*f, int write_desc) {
 }
 
 void options_print_help(struct option * options, FILE*f) {
-	fprintf(f, options_banner_string);
+	fprintf(f, "%s", options_banner_string);
 	fprintf(f, 
 	"Generic options: \n"
 	"  -help          Displays this help.\n"
diff --git a/sm/lib/options/options.h b/src/options/options.h
similarity index 93%
rename from sm/lib/options/options.h
rename to src/options/options.h
index 66ede2993b800e9a06d837e6f81f1f1245e1a12e..335770d432ba28e4355105537e752c56554e36d8 100644
--- a/sm/lib/options/options.h
+++ b/src/options/options.h
@@ -3,9 +3,9 @@
 
 #include <stdio.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+//#ifdef __cplusplus
+//extern "C" {
+//#endif
 
 
 /** User-friendly interface */
@@ -33,7 +33,7 @@ extern "C" {
 	int options_parse_args(struct option*ops, int argc, const char* argv[]);
 
 	/** Returns 0 on error */
-	int options_parse_file(struct option*ops, const char*pwd, const char*file);
+	//int options_parse_file(struct option*ops, const char*pwd, const char*file);
 
 	void options_print_help(struct option*ops, FILE*where);
 
@@ -103,7 +103,7 @@ int options_valid(struct option*op);
 
 void options_dump(struct option * options, FILE*f, int write_desc);
 
-int options_parse_stream(struct option*ops, const char*pwd, FILE*file);
+//int options_parse_stream(struct option*ops, const char*pwd, FILE*file);
 
 /** Our version of strdup. */
 char * strdup_(const char *s);
@@ -116,9 +116,9 @@ struct option* options_next_empty(struct option*ops);
 
 
 
-#ifdef __cplusplus
-}
-#endif
+//#ifdef __cplusplus
+//}
+//#endif
 
 
 
diff --git a/sm/lib/options/options_interface.c b/src/options/options_interface.cpp
similarity index 96%
rename from sm/lib/options/options_interface.c
rename to src/options/options_interface.cpp
index 05695ec3f5865925cfe79b448303cb08a7fe07e7..d1b5a08ccc28835cac933fdd15514a14a417bef2 100644
--- a/sm/lib/options/options_interface.c
+++ b/src/options/options_interface.cpp
@@ -15,7 +15,7 @@
 
 struct option* options_allocate(int n) {
 	n += 2; /* better safe than sorry */
-	struct option* ops = malloc(sizeof(struct option)*n);
+	struct option* ops = (option*) malloc(sizeof(struct option)*n);
 	int i; for(i=0;i<n;i++) {
 		ops[i].name = 0;
 		ops[i].type = (enum option_type) 0xbeef;
diff --git a/website/.gitignore b/website/.gitignore
deleted file mode 100644
index 53752db253e3b4b5e3f17633c0f358b6d7cdd166..0000000000000000000000000000000000000000
--- a/website/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-output
diff --git a/website/Makefile b/website/Makefile
deleted file mode 100644
index 9b81763bd1a586034c9f14e5f41a44a42593d770..0000000000000000000000000000000000000000
--- a/website/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-
-all: source/*
-	maruku source/index.md
-	cp source/*  output
-	
\ No newline at end of file
diff --git a/website/init_website.sh b/website/init_website.sh
deleted file mode 100755
index 36eb023a753338301c644cfb43bdba9503d73481..0000000000000000000000000000000000000000
--- a/website/init_website.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-set -e
-set -x
-git clone git@github.com:AndreaCensi/csm.git  output
-cd output
-git checkout origin/gh-pages -b gh-pages
-git branch -D master
-
diff --git a/website/source/a.gif b/website/source/a.gif
deleted file mode 100644
index 5379a170c4d2b6e6583277435c7318ec3cd9ad6d..0000000000000000000000000000000000000000
Binary files a/website/source/a.gif and /dev/null differ
diff --git a/website/source/index.html b/website/source/index.html
deleted file mode 100644
index 525f71b4291831bb9f23feb330e48aa62bcb561d..0000000000000000000000000000000000000000
--- a/website/source/index.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC
-    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
-    "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
-<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
-<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title>The C(anonical) Scan Matcher</title></head>
-<body>
-<h1 id='the_canonical_scan_matcher'>The C(anonical) Scan Matcher</h1>
-
-<p><img src='sm_plicp_zoom_crop.gif' alt='PL-ICP' style='float: right; margin:1em;' /></p>
-
-<h3 id='news'>News</h3>
-
-<ul>
-<li>Fall 2010: <a href='http://www.ros.org/wiki/canonical_scan_matcher'>CSM has been integrated and packaged</a> for <a href='http://www.ros.org/'>ROS</a> by <a href='http://robotics.ccny.cuny.edu/blog/People/Dryanovski'>Ivan Dryanovski</a>.</li>
-</ul>
-
-<h3 id='download'>Download</h3>
-
-<ul>
-<li>
-<p>CSM can be download from GitHub (.zip package available) at the url:</p>
-
-<p><a href='http://github.com/AndreaCensi/csm'>http://github.com/AndreaCensi/csm</a></p>
-</li>
-</ul>
-
-<h3 id='documentation__getting_started'>Documentation / getting started</h3>
-
-<p>Please see the manual contained in &#8220;csm_manual.pdf&#8221;. See below for a quick description.</p>
-
-<p><strong>What is this.</strong> I created this package:</p>
-
-<ul>
-<li>
-<p>To have a well-documented reference implementation of <a href='http://purl.org/censi/2007/plicp'>PL-ICP</a>. If you are only interested in the core algorithm of PL-ICP, a <a href='http://purl.org/censi/2007/gpc'>separate concise implementation in C/Matlab/Ruby</a> is available.</p>
-</li>
-
-<li>
-<p>To have a <strong>trustworthy</strong> scan matcher to be used in the experiments for some papers on <a href='http://purl.org/censi/2006/icpcov'>ICP covariance</a>, <a href='http://purl.org/censi/2006/accuracy'>the Cramer-Rao bound for range finders</a>, and <a href='http://purl.org/censi/2007/calib'>robot calibration</a>. For batch experiments, it&#8217;s also useful that it&#8217;s pretty fast.</p>
-</li>
-
-<li>
-<p>To have a collection of utilies for command line (UNIX-style) manipulation of laser data, and creating <a href='../plicp/laserazosSM3.log.pdf'>beautiful maps</a> and animations.</p>
-</li>
-</ul>
-
-<p>The package contains also a Ruby wrapper for the C library, and additional Ruby and a Matlab implementations of the same algorithm. These are not as usable or documented as the C version.</p>
-
-<p><strong>What it is NOT</strong>: Note that this is not a full-featured SLAM solution: this only does pairwise scan-matching between scans (but it&#8217;s really good at it!). If you are looking for a more complete SLAM solution, please see the projects listed in the <a href='http://www.openslam.org'>OpenSLAM</a> page; in particular you can have a look at <a href='http://www.openslam.org/gmapping.html'>GMapping</a>. Many pointers to other SLAM software can be found on the pages of the Euron SLAM summer schools: <a href='http://www.cas.kth.se/SLAM/'>2002 (Stockholm)</a>, <a href='http://www.laas.fr/SLAM/'>2004 (Toulouse)</a>, <a href='http://www.robots.ox.ac.uk/~SSS06/Website/index.html'>2006 (Oxford)</a>. Other related projects are <a href='http://carmen.sourceforge.net/'>Carmen</a> and <a href='http://playerstage.sourceforge.net/'>Stage</a>.</p>
-<hr />
-<p>Please link to this page using the url <a href='http://purl.org/censi/2007/csm'>http://purl.org/censi/2007/csm</a>.</p>
-</body></html>
diff --git a/website/source/index.md b/website/source/index.md
deleted file mode 100644
index 064b082095d23553c7f3b602701e8195b68ef2b5..0000000000000000000000000000000000000000
--- a/website/source/index.md
+++ /dev/null
@@ -1,57 +0,0 @@
-The C(anonical) Scan Matcher
-============================
-
-![PL-ICP](sm_plicp_zoom_crop.gif){:style="float: right; margin:1em;"}
-
-
-### News ###
-
-* Fall 2010: [CSM has been integrated and packaged][stack] for [ROS] by [Ivan Dryanovski][ivan].
-    
-
-### Download ###
-
-* CSM can be download from GitHub (.zip package available) at the url:
-
-  [http://github.com/AndreaCensi/csm](http://github.com/AndreaCensi/csm)
-
-[stack]: http://www.ros.org/wiki/canonical_scan_matcher
-[ivan]: http://robotics.ccny.cuny.edu/blog/People/Dryanovski
-[ROS]: http://www.ros.org/
- 
-
-### Documentation / getting started ###
-
-Please see the manual contained in "csm_manual.pdf". See below for a quick description.
-
-
-**What is this.** I created this package:
-
-- To have a well-documented reference implementation of [PL-ICP](http://purl.org/censi/2007/plicp). If you are only interested in the core algorithm of PL-ICP, a [separate concise implementation in C/Matlab/Ruby](http://purl.org/censi/2007/gpc) is available.
-
-- To have a **trustworthy** scan matcher to be used in the experiments for some papers on [ICP covariance](http://purl.org/censi/2006/icpcov), [the Cramer-Rao bound for range finders](http://purl.org/censi/2006/accuracy), and [robot calibration](http://purl.org/censi/2007/calib).  For batch experiments, it's also useful that it's pretty fast.
-
-- To have a collection of utilies for command line (UNIX-style) manipulation of laser data,
-  and creating [beautiful maps][map-example] and animations.
-
-The package contains also a Ruby wrapper for the C library, and additional Ruby and a Matlab implementations of the same algorithm. These are not as usable or documented as the C version.
-
-**What it is NOT**: Note that this is not a full-featured SLAM solution: this only does pairwise scan-matching between scans (but it's really good at it!).
-If you are looking for a more complete SLAM solution, please see the projects listed in the [OpenSLAM](http://www.openslam.org) page; in particular you can have a look at [GMapping]. 
-Many pointers to other SLAM software can be found on the pages of the Euron SLAM summer schools: 
-[2002 (Stockholm)](http://www.cas.kth.se/SLAM/),
-[2004 (Toulouse)](http://www.laas.fr/SLAM/),
-[2006 (Oxford)](http://www.robots.ox.ac.uk/~SSS06/Website/index.html).
-Other related projects are [Carmen] and [Stage].
-
-[map-example]: ../plicp/laserazosSM3.log.pdf
-
-[gmapping]: http://www.openslam.org/gmapping.html
-[carmen]: http://carmen.sourceforge.net/
-[stage]: http://playerstage.sourceforge.net/
-
-
-
------------
-
-Please link to this page using the url <http://purl.org/censi/2007/csm>.
\ No newline at end of file
diff --git a/website/source/sm_icp_zoom_crop.gif b/website/source/sm_icp_zoom_crop.gif
deleted file mode 100644
index dda33c638427060efc58bc2691c5f5a68c435e84..0000000000000000000000000000000000000000
Binary files a/website/source/sm_icp_zoom_crop.gif and /dev/null differ
diff --git a/website/source/sm_plicp_zoom_crop.gif b/website/source/sm_plicp_zoom_crop.gif
deleted file mode 100644
index 3701f9f952e9021e7312d06fcd3b15747d5309e0..0000000000000000000000000000000000000000
Binary files a/website/source/sm_plicp_zoom_crop.gif and /dev/null differ