V1 Readme + rangement

This commit is contained in:
Unknown 2018-08-13 11:25:26 +02:00
parent 3300e0efd3
commit 406e6d9b5d
1339 changed files with 248781 additions and 4282 deletions

View file

@ -0,0 +1,16 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# Relative path conversion top directories.
SET(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src")
SET(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src")
# Force unix paths in dependencies.
SET(CMAKE_FORCE_UNIX_PATHS 1)
# The C and CXX include file regular expressions for this directory.
SET(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
SET(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})

View file

@ -0,0 +1,62 @@
#IncludeRegexLine: ^[ ]*#[ ]*(include|import)[ ]*[<"]([^">]+)([">])
#IncludeRegexScan: ^.*$
#IncludeRegexComplain: ^$
#IncludeRegexTransform:
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/computeH.cpp
homography.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.h
numerics.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.h
algorithm
-
math.h
-
string.h
-
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.cpp
homography.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.h
matrix.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.h
iostream
-
cassert
-
matrix.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.cpp
vector.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/vector.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.cpp
numerics.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.h
cmath
-
vector
-
limits
-
algorithm
-
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.h
matrix.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.h
vector
-
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/rodrigues.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/vector.cpp

View file

@ -0,0 +1,26 @@
# The set of languages for which implicit dependencies are needed:
SET(CMAKE_DEPENDS_LANGUAGES
"CXX"
)
# The set of files for implicit dependencies of each language:
SET(CMAKE_DEPENDS_CHECK_CXX
"/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/computeH.cpp" "/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o"
"/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.cpp" "/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o"
"/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.cpp" "/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o"
"/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.cpp" "/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o"
"/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/rodrigues.cpp" "/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o"
"/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/vector.cpp" "/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o"
)
SET(CMAKE_CXX_COMPILER_ID "GNU")
# Targets to which this target links.
SET(CMAKE_TARGET_LINKED_INFO_FILES
)
# The include file search paths:
SET(CMAKE_C_TARGET_INCLUDE_PATH
"libNumerics/.."
)
SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH})
SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH})
SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH})

View file

@ -0,0 +1,233 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src
# Include any dependencies generated for this target.
include libNumerics/CMakeFiles/Numerics.dir/depend.make
# Include the progress variables for this target.
include libNumerics/CMakeFiles/Numerics.dir/progress.make
# Include the compile flags for this target's objects.
include libNumerics/CMakeFiles/Numerics.dir/flags.make
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o: libNumerics/CMakeFiles/Numerics.dir/flags.make
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o: libNumerics/computeH.cpp
$(CMAKE_COMMAND) -E cmake_progress_report /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/CMakeFiles $(CMAKE_PROGRESS_1)
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/Numerics.dir/computeH.cpp.o -c /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/computeH.cpp
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/Numerics.dir/computeH.cpp.i"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -E /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/computeH.cpp > CMakeFiles/Numerics.dir/computeH.cpp.i
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/Numerics.dir/computeH.cpp.s"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -S /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/computeH.cpp -o CMakeFiles/Numerics.dir/computeH.cpp.s
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o.requires:
.PHONY : libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o.provides: libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o.requires
$(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o.provides.build
.PHONY : libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o.provides
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o.provides.build: libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o: libNumerics/CMakeFiles/Numerics.dir/flags.make
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o: libNumerics/homography.cpp
$(CMAKE_COMMAND) -E cmake_progress_report /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/CMakeFiles $(CMAKE_PROGRESS_2)
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/Numerics.dir/homography.cpp.o -c /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.cpp
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/Numerics.dir/homography.cpp.i"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -E /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.cpp > CMakeFiles/Numerics.dir/homography.cpp.i
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/Numerics.dir/homography.cpp.s"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -S /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.cpp -o CMakeFiles/Numerics.dir/homography.cpp.s
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o.requires:
.PHONY : libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o.provides: libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o.requires
$(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o.provides.build
.PHONY : libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o.provides
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o.provides.build: libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o
libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o: libNumerics/CMakeFiles/Numerics.dir/flags.make
libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o: libNumerics/matrix.cpp
$(CMAKE_COMMAND) -E cmake_progress_report /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/CMakeFiles $(CMAKE_PROGRESS_3)
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/Numerics.dir/matrix.cpp.o -c /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.cpp
libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/Numerics.dir/matrix.cpp.i"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -E /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.cpp > CMakeFiles/Numerics.dir/matrix.cpp.i
libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/Numerics.dir/matrix.cpp.s"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -S /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.cpp -o CMakeFiles/Numerics.dir/matrix.cpp.s
libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o.requires:
.PHONY : libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o.provides: libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o.requires
$(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o.provides.build
.PHONY : libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o.provides
libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o.provides.build: libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o: libNumerics/CMakeFiles/Numerics.dir/flags.make
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o: libNumerics/numerics.cpp
$(CMAKE_COMMAND) -E cmake_progress_report /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/CMakeFiles $(CMAKE_PROGRESS_4)
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/Numerics.dir/numerics.cpp.o -c /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.cpp
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/Numerics.dir/numerics.cpp.i"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -E /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.cpp > CMakeFiles/Numerics.dir/numerics.cpp.i
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/Numerics.dir/numerics.cpp.s"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -S /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.cpp -o CMakeFiles/Numerics.dir/numerics.cpp.s
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o.requires:
.PHONY : libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o.provides: libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o.requires
$(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o.provides.build
.PHONY : libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o.provides
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o.provides.build: libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o
libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o: libNumerics/CMakeFiles/Numerics.dir/flags.make
libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o: libNumerics/rodrigues.cpp
$(CMAKE_COMMAND) -E cmake_progress_report /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/CMakeFiles $(CMAKE_PROGRESS_5)
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/Numerics.dir/rodrigues.cpp.o -c /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/rodrigues.cpp
libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/Numerics.dir/rodrigues.cpp.i"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -E /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/rodrigues.cpp > CMakeFiles/Numerics.dir/rodrigues.cpp.i
libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/Numerics.dir/rodrigues.cpp.s"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -S /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/rodrigues.cpp -o CMakeFiles/Numerics.dir/rodrigues.cpp.s
libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o.requires:
.PHONY : libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o.provides: libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o.requires
$(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o.provides.build
.PHONY : libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o.provides
libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o.provides.build: libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o
libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o: libNumerics/CMakeFiles/Numerics.dir/flags.make
libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o: libNumerics/vector.cpp
$(CMAKE_COMMAND) -E cmake_progress_report /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/CMakeFiles $(CMAKE_PROGRESS_6)
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Building CXX object libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -o CMakeFiles/Numerics.dir/vector.cpp.o -c /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/vector.cpp
libNumerics/CMakeFiles/Numerics.dir/vector.cpp.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/Numerics.dir/vector.cpp.i"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -E /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/vector.cpp > CMakeFiles/Numerics.dir/vector.cpp.i
libNumerics/CMakeFiles/Numerics.dir/vector.cpp.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/Numerics.dir/vector.cpp.s"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && /usr/bin/c++ $(CXX_DEFINES) $(CXX_FLAGS) -S /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/vector.cpp -o CMakeFiles/Numerics.dir/vector.cpp.s
libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o.requires:
.PHONY : libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o.provides: libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o.requires
$(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o.provides.build
.PHONY : libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o.provides
libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o.provides.build: libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o
# Object files for target Numerics
Numerics_OBJECTS = \
"CMakeFiles/Numerics.dir/computeH.cpp.o" \
"CMakeFiles/Numerics.dir/homography.cpp.o" \
"CMakeFiles/Numerics.dir/matrix.cpp.o" \
"CMakeFiles/Numerics.dir/numerics.cpp.o" \
"CMakeFiles/Numerics.dir/rodrigues.cpp.o" \
"CMakeFiles/Numerics.dir/vector.cpp.o"
# External object files for target Numerics
Numerics_EXTERNAL_OBJECTS =
libNumerics/libNumerics.a: libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o
libNumerics/libNumerics.a: libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o
libNumerics/libNumerics.a: libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o
libNumerics/libNumerics.a: libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o
libNumerics/libNumerics.a: libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o
libNumerics/libNumerics.a: libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o
libNumerics/libNumerics.a: libNumerics/CMakeFiles/Numerics.dir/build.make
libNumerics/libNumerics.a: libNumerics/CMakeFiles/Numerics.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --red --bold "Linking CXX static library libNumerics.a"
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && $(CMAKE_COMMAND) -P CMakeFiles/Numerics.dir/cmake_clean_target.cmake
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/Numerics.dir/link.txt --verbose=$(VERBOSE)
# Rule to build all files generated by this target.
libNumerics/CMakeFiles/Numerics.dir/build: libNumerics/libNumerics.a
.PHONY : libNumerics/CMakeFiles/Numerics.dir/build
libNumerics/CMakeFiles/Numerics.dir/requires: libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/requires: libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/requires: libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/requires: libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/requires: libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o.requires
libNumerics/CMakeFiles/Numerics.dir/requires: libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o.requires
.PHONY : libNumerics/CMakeFiles/Numerics.dir/requires
libNumerics/CMakeFiles/Numerics.dir/clean:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics && $(CMAKE_COMMAND) -P CMakeFiles/Numerics.dir/cmake_clean.cmake
.PHONY : libNumerics/CMakeFiles/Numerics.dir/clean
libNumerics/CMakeFiles/Numerics.dir/depend:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/CMakeFiles/Numerics.dir/DependInfo.cmake --color=$(COLOR)
.PHONY : libNumerics/CMakeFiles/Numerics.dir/depend

View file

@ -0,0 +1,15 @@
FILE(REMOVE_RECURSE
"CMakeFiles/Numerics.dir/computeH.cpp.o"
"CMakeFiles/Numerics.dir/homography.cpp.o"
"CMakeFiles/Numerics.dir/matrix.cpp.o"
"CMakeFiles/Numerics.dir/numerics.cpp.o"
"CMakeFiles/Numerics.dir/rodrigues.cpp.o"
"CMakeFiles/Numerics.dir/vector.cpp.o"
"libNumerics.pdb"
"libNumerics.a"
)
# Per-language clean rules from dependency scanning.
FOREACH(lang CXX)
INCLUDE(CMakeFiles/Numerics.dir/cmake_clean_${lang}.cmake OPTIONAL)
ENDFOREACH(lang)

View file

@ -0,0 +1,3 @@
FILE(REMOVE_RECURSE
"libNumerics.a"
)

View file

@ -0,0 +1,28 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/computeH.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/vector.cpp
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/homography.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/vector.cpp
libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.cpp
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/matrix.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.cpp
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/numerics.h
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/vector.cpp
libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/rodrigues.cpp
libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o
/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/vector.cpp

View file

@ -0,0 +1,28 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o: libNumerics/computeH.cpp
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o: libNumerics/homography.h
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o: libNumerics/matrix.cpp
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o: libNumerics/matrix.h
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o: libNumerics/numerics.h
libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o: libNumerics/vector.cpp
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o: libNumerics/homography.cpp
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o: libNumerics/homography.h
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o: libNumerics/matrix.cpp
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o: libNumerics/matrix.h
libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o: libNumerics/vector.cpp
libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o: libNumerics/matrix.cpp
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o: libNumerics/matrix.cpp
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o: libNumerics/matrix.h
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o: libNumerics/numerics.cpp
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o: libNumerics/numerics.h
libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o: libNumerics/vector.cpp
libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o: libNumerics/rodrigues.cpp
libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o: libNumerics/vector.cpp

View file

@ -0,0 +1,8 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# compile CXX with /usr/bin/c++
CXX_FLAGS = -I/home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/..
CXX_DEFINES =

View file

@ -0,0 +1,2 @@
/usr/bin/ar cr libNumerics.a CMakeFiles/Numerics.dir/computeH.cpp.o CMakeFiles/Numerics.dir/homography.cpp.o CMakeFiles/Numerics.dir/matrix.cpp.o CMakeFiles/Numerics.dir/numerics.cpp.o CMakeFiles/Numerics.dir/rodrigues.cpp.o CMakeFiles/Numerics.dir/vector.cpp.o
/usr/bin/ranlib libNumerics.a

View file

@ -0,0 +1,7 @@
CMAKE_PROGRESS_1 = 2
CMAKE_PROGRESS_2 = 3
CMAKE_PROGRESS_3 = 4
CMAKE_PROGRESS_4 = 5
CMAKE_PROGRESS_5 = 6
CMAKE_PROGRESS_6 = 7

View file

@ -0,0 +1,13 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(libNumerics)
INCLUDE_DIRECTORIES(..)
ADD_LIBRARY(Numerics
computeH.cpp
homography.cpp homography.h
matrix.cpp matrix.h
numerics.cpp numerics.h
rodrigues.cpp rodrigues.h
vector.cpp)

View file

@ -0,0 +1,299 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
/usr/bin/cmake -i .
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(CMAKE_COMMAND) -E cmake_progress_start /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/CMakeFiles /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics/CMakeFiles/progress.marks
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f CMakeFiles/Makefile2 libNumerics/all
$(CMAKE_COMMAND) -E cmake_progress_start /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f CMakeFiles/Makefile2 libNumerics/clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f CMakeFiles/Makefile2 libNumerics/preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f CMakeFiles/Makefile2 libNumerics/preinstall
.PHONY : preinstall/fast
# clear depends
depend:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
# Convenience name for target.
libNumerics/CMakeFiles/Numerics.dir/rule:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f CMakeFiles/Makefile2 libNumerics/CMakeFiles/Numerics.dir/rule
.PHONY : libNumerics/CMakeFiles/Numerics.dir/rule
# Convenience name for target.
Numerics: libNumerics/CMakeFiles/Numerics.dir/rule
.PHONY : Numerics
# fast build rule for target.
Numerics/fast:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/build
.PHONY : Numerics/fast
computeH.o: computeH.cpp.o
.PHONY : computeH.o
# target to build an object file
computeH.cpp.o:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.o
.PHONY : computeH.cpp.o
computeH.i: computeH.cpp.i
.PHONY : computeH.i
# target to preprocess a source file
computeH.cpp.i:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.i
.PHONY : computeH.cpp.i
computeH.s: computeH.cpp.s
.PHONY : computeH.s
# target to generate assembly for a file
computeH.cpp.s:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/computeH.cpp.s
.PHONY : computeH.cpp.s
homography.o: homography.cpp.o
.PHONY : homography.o
# target to build an object file
homography.cpp.o:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/homography.cpp.o
.PHONY : homography.cpp.o
homography.i: homography.cpp.i
.PHONY : homography.i
# target to preprocess a source file
homography.cpp.i:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/homography.cpp.i
.PHONY : homography.cpp.i
homography.s: homography.cpp.s
.PHONY : homography.s
# target to generate assembly for a file
homography.cpp.s:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/homography.cpp.s
.PHONY : homography.cpp.s
matrix.o: matrix.cpp.o
.PHONY : matrix.o
# target to build an object file
matrix.cpp.o:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.o
.PHONY : matrix.cpp.o
matrix.i: matrix.cpp.i
.PHONY : matrix.i
# target to preprocess a source file
matrix.cpp.i:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.i
.PHONY : matrix.cpp.i
matrix.s: matrix.cpp.s
.PHONY : matrix.s
# target to generate assembly for a file
matrix.cpp.s:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/matrix.cpp.s
.PHONY : matrix.cpp.s
numerics.o: numerics.cpp.o
.PHONY : numerics.o
# target to build an object file
numerics.cpp.o:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.o
.PHONY : numerics.cpp.o
numerics.i: numerics.cpp.i
.PHONY : numerics.i
# target to preprocess a source file
numerics.cpp.i:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.i
.PHONY : numerics.cpp.i
numerics.s: numerics.cpp.s
.PHONY : numerics.s
# target to generate assembly for a file
numerics.cpp.s:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/numerics.cpp.s
.PHONY : numerics.cpp.s
rodrigues.o: rodrigues.cpp.o
.PHONY : rodrigues.o
# target to build an object file
rodrigues.cpp.o:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.o
.PHONY : rodrigues.cpp.o
rodrigues.i: rodrigues.cpp.i
.PHONY : rodrigues.i
# target to preprocess a source file
rodrigues.cpp.i:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.i
.PHONY : rodrigues.cpp.i
rodrigues.s: rodrigues.cpp.s
.PHONY : rodrigues.s
# target to generate assembly for a file
rodrigues.cpp.s:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/rodrigues.cpp.s
.PHONY : rodrigues.cpp.s
vector.o: vector.cpp.o
.PHONY : vector.o
# target to build an object file
vector.cpp.o:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/vector.cpp.o
.PHONY : vector.cpp.o
vector.i: vector.cpp.i
.PHONY : vector.i
# target to preprocess a source file
vector.cpp.i:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/vector.cpp.i
.PHONY : vector.cpp.i
vector.s: vector.cpp.s
.PHONY : vector.s
# target to generate assembly for a file
vector.cpp.s:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(MAKE) -f libNumerics/CMakeFiles/Numerics.dir/build.make libNumerics/CMakeFiles/Numerics.dir/vector.cpp.s
.PHONY : vector.cpp.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... Numerics"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... computeH.o"
@echo "... computeH.i"
@echo "... computeH.s"
@echo "... homography.o"
@echo "... homography.i"
@echo "... homography.s"
@echo "... matrix.o"
@echo "... matrix.i"
@echo "... matrix.s"
@echo "... numerics.o"
@echo "... numerics.i"
@echo "... numerics.s"
@echo "... rodrigues.o"
@echo "... rodrigues.i"
@echo "... rodrigues.s"
@echo "... vector.o"
@echo "... vector.i"
@echo "... vector.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
cd /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

View file

@ -0,0 +1,34 @@
# Install script for directory: /home/harle/catkin_ws/src/BaxterInterface/ASIFT_tests/demo_ASIFT_src/libNumerics
# Set the install prefix
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX "/usr/local")
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
IF(BUILD_TYPE)
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
ELSE(BUILD_TYPE)
SET(CMAKE_INSTALL_CONFIG_NAME "")
ENDIF(BUILD_TYPE)
MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
# Set the component getting installed.
IF(NOT CMAKE_INSTALL_COMPONENT)
IF(COMPONENT)
MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
ELSE(COMPONENT)
SET(CMAKE_INSTALL_COMPONENT)
ENDIF(COMPONENT)
ENDIF(NOT CMAKE_INSTALL_COMPONENT)
# Install shared libraries without execute permission?
IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
SET(CMAKE_INSTALL_SO_NO_EXE "1")
ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)

View file

@ -0,0 +1,651 @@
// Authors: Unknown. Please, if you are the author of this file, or if you
// know who are the authors of this file, let us know, so we can give the
// adequate credits and/or get the adequate authorizations.
#include "homography.h"
#include "numerics.h"
#include <algorithm>
#include <math.h> /* For sqrt */
#include <string.h>
static const float minEigenValue = 1e-3f; // For regular matrix
namespace libNumerics {
/// Constructor. Field `b' used only for error computation.
ComputeH::ComputeH(Type type)
: _type(type), n( size(type) ), b(0)
{
clear();
}
// Destructor
ComputeH::~ComputeH()
{}
// Dimension of matrix w.r.t. type
int ComputeH::size(Type type)
{
switch(type) {
case Translation:
return 2;
case Zoom:
return 3;
case Rotation: // In fact 3, but nonlinear system
case GeneralZoom:
case Similarity:
return 4;
case Affine:
return 6;
case Projective:
return 8;
}
return 8;
}
// Return less general motion
ComputeH::Type ComputeH::restrict(Type t)
{
switch(t) {
case Translation:
return Translation; // Should return identity
case Rotation:
case Zoom:
return Translation;
case Similarity:
return Zoom; // Rotation also correct. Arbitrary choice.
case GeneralZoom:
return Zoom;
case Affine:
return Similarity;
case Projective:
return Affine;
}
return Affine;
}
// Reinitialize
void ComputeH::clear()
{
memset(Ann, 0, n*n*sizeof(double));
memset(Bn, 0, n*sizeof(double));
b = 0;
}
// Add two corresponding points
void ComputeH::add(float x, float y, float X, float Y, float w)
{
if(_type <= Similarity) { // Separate for readability
add_4parameters(x, y, X, Y, w);
return;
}
double x2 = x*x, y2 = y*y, xy = x*y;
double xX = x*X, yX = y*X, xY = x*Y, yY = y*Y;
double *A = Ann, *B = Bn;
*A++ += w* x2; // Equation 1
*A++ += w* xy;
A += 2;
*A++ += w* x;
A++;
if(_type == Projective) {
*A++ -= w* x*xX;
*A++ -= w* x*yX;
}
*B++ += w* x*X;
A++; // Equation 2
*A++ += w* y2;
A += 2;
*A++ += w* y;
A++;
if(_type == Projective) {
*A++ -= w* y*xX;
*A++ -= w* y*yX;
}
*B++ += w* y*X;
A +=2; // Equation 3
*A++ += w* x2;
*A++ += w* xy;
A++;
*A++ += w* x;
if(_type == Projective) {
*A++ -= w* x*xY;
*A++ -= w* x*yY;
}
*B++ += w* x*Y;
A +=3; // Equation 4
*A++ += w* y2;
A++;
*A++ += w* y;
if(_type == Projective) {
*A++ -= w* y*xY;
*A++ -= w* y*yY;
}
*B++ += w* y*Y;
A+= 4; // Equation 5
*A++ += w;
A++;
if(_type == Projective) {
*A++ -= w* xX;
*A++ -= w* yX;
}
*B++ += w* X;
A += 5; // Equation 6
*A++ += w;
*B++ += w* Y;
if(_type == Projective) {
*A++ -= w* xY;
*A++ -= w* yY;
A += 6; // Equation 7
*A++ += w* (xX*xX + xY*xY);
*A++ += w* (xX*yX + xY*yY);
*B++ -= w* (xX*X + xY*Y);
A+= 7; // Equation 8
*A++ += w* (yX*yX + yY*yY);
*B++ -= w* (yX*X + yY*Y);
}
b += w* (X*X + Y*Y);
}
// Add two corresponding points, type involving at most 4 parameters
void ComputeH::add_4parameters(float x, float y, float X, float Y, float w)
{
double *A = Ann, *B = Bn;
if(_type == Translation) {
A[0] += w;
A[3] += w;
B[0] += w* (X - x);
B[1] += w* (Y - y);
b += w* ((X-x)*(X-x) + (Y-y)*(Y-y));
return;
}
b += w* (X*X + Y*Y);
if(_type == GeneralZoom) {
A[0] += w* x*x;
A[2] += w* x;
B[0] += w* x*X;
A[5] += w* y*y;
A[7] += w* y;
B[1] += w* y*Y;
A[10]+= w;
B[2] += w* X;
A[15]+= w;
B[3] += w* Y;
return;
}
*A++ += w* (x*x + y*y); // Equation 1
if(_type != Zoom) // Similarity or Rotation
A++;
*A++ += w* x;
*A++ += w* y;
*B++ += w* (x*X + y*Y);
if(_type != Zoom) { // Similarity or Rotation
A++; // Equation 2
*A++ += w* (x*x + y*y);
*A++ += w* y;
*A++ -= w* x;
*B++ += w* (y*X - x*Y);
A++; // Prepare for next line
}
A++; // Equation 3
*A++ += w;
A++;
*B++ += w* X;
A += n-1; // Equation 4
*A++ += w;
*B++ += w* Y;
}
// Add corresponding lines of equation ux + by + x = 0
void ComputeH::add(float x, float y, float z, float X, float Y, float Z,
float w)
{
float s = 1.0f / (float)sqrt(x*x + y*y);
x *= s;
y *= s;
z *= s;
s = 1.0f / (float)sqrt(X*X + Y*Y);
X *= s;
Y *= s;
Z *= s;
if(_type <= Similarity) { // Separate for readability
add_4parameters(x, y, z, X, Y, Z, w);
return;
}
double x2 = x*x, y2 = y*y, z2 = z*z, xy = x*y, xz = x*z, yz = y*z;
double X2 = X*X, Y2 = Y*Y, Z2 = Z*Z, XY = X*Y, XZ = X*Z, YZ = Y*Z;
double *A = Ann, *B = Bn;
*A++ += w* (y2+z2) * X2; // Equation 1
*A++ -= w* xy * X2;
*A++ += w* (y2+z2) * XY;
*A++ -= w* xy * XY;
*A++ -= w* xz * X2;
*A++ -= w* xz * XY;
if(_type == Projective) {
*A++ += w* (y2+z2) * XZ;
*A++ -= w* xy * XZ;
}
*B++ += w* xz * XZ;
A++; // Equation 2
*A++ += w* (x2+z2) * X2;
*A++ -= w* xy * XY;
*A++ += w* (x2+z2) * XY;
*A++ -= w* yz * X2;
*A++ -= w* yz * XY;
if(_type == Projective) {
*A++ -= w* xy * XZ;
*A++ += w* (x2+z2) * XZ;
}
*B++ -= w* yz * XZ;
A += 2; // Equation 3
*A++ += w* (y2+z2) * Y2;
*A++ -= w* xy * Y2;
*A++ -= w* xz * XY;
*A++ -= w* xz * Y2;
if(_type == Projective) {
*A++ += w* (y2+z2) * YZ;
*A++ -= w* xy * YZ;
}
*B++ += w* xz * YZ;
A += 3; // Equation 4
*A++ += w* (x2+z2) * Y2;
*A++ -= w* yz * XY;
*A++ -= w* yz * Y2;
if(_type == Projective) {
*A++ -= w* xy * YZ;
*A++ += w* (x2+z2) * YZ;
}
*B++ += w* yz * YZ;
A += 4; // Equation 5
*A++ += w* X2; // *(x2+y2=1)
*A++ += w* XY; // *(x2+y2=1)
if(_type == Projective) {
*A++ -= w* xz * XZ;
*A++ -= w* yz * XZ;
}
*B++ -= w* XZ; // *(x2+y2=1)
A += 5; // Equation 6
*A++ += w* Y2; // *(x2+y2=1)
*B++ -= w* YZ; // *(x2+y2=1)
if(_type == Projective) {
*A++ -= w* xz * YZ;
*A++ -= w* yz * YZ;
A += 6; // Equation 7
*A++ += w* (y2+z2) * Y2;
*A++ -= w* xy * Z2;
*B++ += w* xz * Z2;
A += 7; // Equation 8
*A++ += w* (x2+z2) * Z2;
*B++ += w* yz * Z2;
}
b += w* Z2; // *(x2+y2=1)
}
// Add two corresponding lines, type involving at most 4 parameters
void ComputeH::add_4parameters(float x, float y, float z,
float X, float Y, float Z, float w)
{
double x2 = x*x, y2 = y*y, z2 = z*z, xy = x*y, xz = x*z, yz = y*z;
double X2 = X*X, Y2 = Y*Y, Z2 = Z*Z, XY = X*Y, XZ = X*Z, YZ = Y*Z;
double *A = Ann, *B = Bn;
if(_type == Translation) {
*A++ += w* X2; // *(x2+y2=1)
*A++ += w* XY; // *(x2+y2=1)
*B++ += w* (yz*XY + xz*X2 - XZ/* *(x2+y2=1) */);
A++;
*A++ += w* Y2; // *(x2+y2=1)
*B++ += w* (xz*XY + yz*Y2 - YZ/* *(x2+y2=1) */);
b += w* (z2 + Z2 + y2*X2 + x2*Z2 - 2*(xz*XZ + yz*YZ + xy*XZ));
return;
}
b += w* Z2; // *(x2+y2=1)
if(_type == GeneralZoom) {
*A++ += w* (y2+z2) * X2;
*A++ -= w* xy * XY;
*A++ -= w* xz * X2;
*A++ -= w* xz * XY;
*B++ += w* xz * XZ;
A++;
*A++ += w* (x2+z2) * Y2;
*A++ -= w* yz * XY;
*A++ -= w* yz * Y2;
*B++ += w* yz * YZ;
A += 2;
*A++ += w* X2; // *(x2+y2=1)
*A++ += w* XY; // *(x2+y2=1)
*B++ -= w* XZ; // *(x2+y2=1)
A += 3;
*A++ += w* Y2; // *(x2+y2=1)
*B++ -= w* YZ; // *(x2+y2=1)
return;
}
if(_type == Zoom) {
*A++ += w* (z2/* *(X2+Y2=1)*/ + y2*X2 + x2*Y2 - 2*xy*XY);
*A++ -= w* (yz*XY + xz*X2);
*A++ -= w* (yz*Y2 + xz*XY);
*B++ += w* (yz*YZ + xz*X2);
} else { // Similarity or Rotation
*A++ += w* (1 /* =x2+y2*/+ 2*(z2 - xy)) * X2;
*A++ += w* (x2 - y2) * XY;
*A++ -= w* (xz + yz) * X2;
*A++ -= w* (xz + yz) * XY;
*B++ += w* (xz + yz) * XZ;
A++;
*A++ += w* (1 /* =x2+y2*/+ 2*(z2 + xy)) * Y2;
*A++ += w* (xz - yz) * XY;
*A++ += w* (xz - yz) * Y2;
*B++ += w* (yz - xz) * YZ;
A++; // Prepare for next line
}
A++;
*A++ += w* X2; // *(x2+y2=1)
*A++ += w* XY; // *(x2+y2=1)
*B++ -= w* XZ; // *(x2+y2=1)
A += n-1;
*A++ += w* Y2; // *(x2+y2=1)
*B++ -= w* YZ; // *(x2+y2=1)
}
// Wrap vector of unknowns `v' into structure `map'
void ComputeH::wrap(Homography& h, const vector<double>& v) const
{
int i = 0;
h.mat()(0,0) = (_type==Translation)? 1.0f: v(i++);
h.mat()(0,1) = (_type==Translation || _type==Zoom || _type==GeneralZoom) ?
0: v(i++);
if(n >= 6) {
h.mat()(1,0) = v(i++);
h.mat()(1,1) = v(i++);
} else {
h.mat()(1,0) = -h.mat()(0,1);
h.mat()(1,1) = (_type==GeneralZoom)? v(i++): h.mat()(0,0);
}
h.mat()(0,2) = v(i++);
h.mat()(1,2) = v(i++);
if(_type == Projective) {
h.mat()(2,0) = v(i++);
h.mat()(2,1) = v(i++);
} else
h.mat()(2,0) = h.mat()(2,1) = 0;
h.mat()(2,2) = 1.0;
}
/// Unwrap parameters in \a h into vector of unknowns \a v.
void ComputeH::unwrap(const Homography& h, vector<double>& v) const
{
int i = 0;
if(_type != Translation) {
v(i++) = h.mat()(0,0);
if(_type != Zoom) {
if(_type != GeneralZoom) {
v(i++) = h.mat()(0,1); // Rotation or Similarity or...
if(n >= 6) // Affine or Projective
v(i++) = h.mat()(1,0);
}
if(_type==GeneralZoom || _type==Affine || _type==Projective)
v(i++) = h.mat()(1,1);
}
}
v(i++) = h.mat()(0,2);
v(i++) = h.mat()(1,2);
if(_type == Projective) {
v(i++) = h.mat()(2,0);
v(i++) = h.mat()(2,1);
}
}
// Sum of weights (=#correspondences)
float ComputeH::weight() const
{
// Diagonal coefficient affecting translation
int i = (_type == Projective) ? 6 : n;
return static_cast<float>(Ann[(i-1)*(n+1)]); // Element (i-1,i-1)
}
// Return quadratic error when mapping with `motion'
float ComputeH::q_error(const Homography& map) const
{
vector<double> v(n);
unwrap(map, v);
return q_error(v);
}
// Idem, with arguments in a vector
float ComputeH::q_error(const vector<double>& v) const
{
double e = b;
// Diagonal terms
const double* A = Ann + n*n-1;
for(int i = n-1; i >= 0; i--, A -= n+1)
e += *A * v(i) * v(i);
// Cross terms
A = Ann + (n-1)*n; // Last row
for(int i = n-1; i >= 0; i--, A -= n) {
double vi = v(i);
e -= 2.0 * Bn[i] * vi;
for(int j = n-1; j > i; j--)
e += 2.0 * A[j] * vi * v(j);
}
return static_cast<float>(e);
}
// LSE for rotation: solve linear system under quadratic constraint
bool ComputeH::compute_rotation(vector<double>& B) const
{
if(Ann[15] <= 0) // No point added or absurd value
return false;
B(0) = Ann[15] * Bn[0] - Ann[2] * Bn[2] - Ann[3] * Bn[3];
B(1) = Ann[15] * Bn[1] - Ann[3] * Bn[2] + Ann[2] * Bn[3];
double root = sqrt(B(0)*B(0) + B(1)*B(1));
if(root < minEigenValue)
return false;
// Test first solution
double lambda1 = (Ann[2]*Ann[2] + Ann[3]*Ann[3] + root) / Ann[15];
B(0) /= root;
B(1) /= root;
B(2) = (-Ann[2]*Bn[0] - Ann[3]*Bn[1] + lambda1 * Bn[2]) / root;
B(3) = (-Ann[3]*Bn[0] + Ann[2]*Bn[1] + lambda1 * Bn[3]) / root;
float v1 = q_error(B);
// Test second solution
vector<double> C(4);
double lambda2 = (Ann[2]*Ann[2] + Ann[3]*Ann[3] - root) / Ann[15];
C(0) = -B(0);
C(1) = -B(1);
C(2) = -(-Ann[2]*Bn[0] - Ann[3]*Bn[1] + lambda2 * Bn[2]) / root;
C(3) = -(-Ann[3]*Bn[0] + Ann[2]*Bn[1] + lambda2 * Bn[3]) / root;
if(v1 > q_error(C)) // Keep second solution
B = C;
return true;
}
// Return LSE motion and the sum of weights
float ComputeH::compute(Homography& map) const
{
vector<double> B(n);
B.read(Bn);
if(_type == Rotation) {
if(! compute_rotation(B))
return 0;
} else {
matrix<double> A(n,n);
A.read(Ann);
Normalization left, right;
if(_type == Projective && !normalize(left, A, B, right))
return 0;
A.symUpper();
vector<double> oldB(B);
if(! solveLU(A, B))
return 0;
if(_type == Projective && ! de_normalize(left, B, right))
return 0;
}
wrap(map, B);
return weight();
}
// Normalize independently original and final points so that the new
// origin is their centroid and their mean square distance (to it) is 2
bool ComputeH::normalize(Normalization& left,
matrix<double>& A, vector<double>& B,
Normalization& right) const
{
double w = A(5,5); // Total weight
if(w < minEigenValue)
return false;
double invW = 1.0 / w;
// Find normalizations (zoom-translation)
right.s = (A(0,0) + A(1,1)) - (A(0,4)*A(0,4) + A(1,4)*A(1,4))*invW;
if(right.s < minEigenValue)
return false;
right.s = sqrt(2.0*w / right.s);
right.x = - invW * right.s * A(0,4);
right.y = - invW * right.s * A(1,4);
left.s = b - (B(4)*B(4) + B(5)*B(5))*invW;
if(left.s < minEigenValue)
return false;
left.s = sqrt(2.0*w / left.s);
left.x = - invW * left.s * B(4);
left.y = - invW * left.s * B(5);
double norm = left.x*left.x + left.y*left.y;
double s2 = right.s*right.s, sS = right.s*left.s, S2 = left.s*left.s;
// Normalization of vector B
double b0 = B(0), b1 = B(1), b2 = B(2), b3 = B(3);
B(0) = sS * B(0) - w*right.x*left.x;
B(1) = sS * B(1) - w*right.y*left.x;
B(2) = sS * B(2) - w*right.x*left.y;
B(3) = sS * B(3) - w*right.y*left.y;
B(4) = B(5) = 0;
B(6) = sS*(left.s*B(6) - 2*(left.x*b0 + left.y*b2)) +
w*right.x*(norm - 2.0);
B(7) = sS*(left.s*B(7) - 2*(left.x*b1 + left.y*b3)) +
w*right.y*(norm - 2.0);
// Normalization of matrix A
double a0 = A(0,0), a1 = A(0,1), a6 = A(0,6), a7 = A(0,7), a9 = A(1,1);
double a15 = A(1,7), a22 = A(2,6), a23 = A(2,7), a31 = A(3,7);
A(0,0) = s2 * A(0,0) - w*right.x*right.x;
A(0,1) = s2 * A(0,1) - w*right.x*right.y;
A(0,4) = 0;
A(0,6) = right.s*(sS*A(0,6) - right.s*left.x*a0 - left.s*right.x*b0) +
w*right.x*left.x*right.x - right.x * B(0);
A(0,7) = right.s*(sS*A(0,7) - right.s*left.x*a1 - left.s*right.x*b1) +
w*right.x*left.x*right.y - right.y * B(0);
A(1,1) = s2 * A(1,1) - w*right.y*right.y;
A(1,4) = 0;
A(1,6) = A(0,7);
A(1,7) = right.s*(sS*A(1,7) - right.s*left.x*a9 - left.s*right.y*b1) +
w*right.y*left.x*right.y - right.y * B(1);
A(2,2) = A(0,0);
A(2,3) = A(0,1);
A(2,5) = 0;
A(2,6) = right.s*(sS*A(2,6) - right.s*left.y*a0 - left.s*right.x*b2) +
w*right.x*left.y*right.x - right.x * B(2);
A(2,7) = right.s*(sS*A(2,7) - right.s*left.y*a1 - left.s*right.x*b3) +
w*right.x*left.y*right.y - right.y * B(2);
A(3,3) = A(1,1);
A(3,5) = 0;
A(3,6) = A(2,7);
A(3,7) = right.s*(sS*A(3,7) - right.s*left.y*a9 - left.s*right.y*b3) +
w*right.y*left.y*right.y - right.y * B(3);
A(4,6) = -B(0);
A(4,7) = -B(1);
A(5,6) = -B(2);
A(5,7) = -B(3);
A(6,6) = s2*(S2*A(6,6) - 2*left.s*(left.x*a6+left.y*a22) + a0*norm) -
2*right.x*(B(6) + w*right.x);
A(6,7) = s2*(S2*A(6,7) - 2*left.s*(left.x*a7+left.y*a23) + a1*norm) -
right.x*B(7) - right.y*B(6) - 2*w*right.x*right.y;
A(7,7) = s2*(S2*A(7,7) - 2*left.s*(left.x*a15+left.y*a31) + a9*norm) -
2*right.y*(B(7) + w*right.y);
return true;
}
// `l' (left) and 'r' (right) representing zoom-translation normalizations,
// and `B' the parameters of a projective motion,
// compute l^-1 B r
bool ComputeH::de_normalize(const Normalization& l,
vector<double>& B,
const Normalization& r)
{
// B := B r
B(4) += r.x * B(0) + r.y * B(1); // Line 1
B(0) *= r.s;
B(1) *= r.s;
B(5) += r.x * B(2) + r.y * B(3); // Line 2
B(2) *= r.s;
B(3) *= r.s;
double f = r.x * B(6) + r.y * B(7) + 1.0; // Line 3
if(-minEigenValue < f && f < minEigenValue)
return false; // Origin of right normalization on line at infinity
B(6) *= r.s;
B(7) *= r.s;
// B := l^-1 B
double s = 1.0 / (l.s * f);
B(0) = (B(0) - l.x*B(6)) * s; // Line 1
B(1) = (B(1) - l.x*B(7)) * s;
B(4) = (B(4) - l.x* f ) * s;
B(2) = (B(2) - l.y*B(6)) * s; // Line 2
B(3) = (B(3) - l.y*B(7)) * s;
B(5) = (B(5) - l.y* f ) * s;
B(6) /= f; // Line 3
B(7) /= f;
return true;
}
} // libNumerics

View file

@ -0,0 +1,73 @@
// Authors: Unknown. Please, if you are the author of this file, or if you
// know who are the authors of this file, let us know, so we can give the
// adequate credits and/or get the adequate authorizations.
#include "homography.h"
namespace libNumerics {
/// Constructor.
Homography::Homography()
: m_H( matrix<double>::eye(3) )
{}
/// Put to identity.
void Homography::setId()
{
m_H = matrix<double>::eye(3);
}
/// Set to translation.
void Homography::setTrans(double dx, double dy)
{
setId();
m_H(0,2) = dx;
m_H(1,2) = dy;
}
/// Set to zoom.
void Homography::setZoom(double zx, double zy)
{
setId();
m_H(0,0) = zx;
m_H(1,1) = zy;
}
/// Apply homography.
void Homography::operator()(double& x, double& y) const
{
vector<double> m(3);
m(0) = x;
m(1) = y;
m(2) = 1.0f;
m = m_H * m;
double z_1 = 1.0 / m(2);
x = m(0) * z_1;
y = m(1) * z_1;
}
/// Compose homographies.
Homography Homography::operator*(const Homography& rhs) const
{
Homography h;
h.m_H = m_H * rhs.m_H;
h.normalize();
return h;
}
/// Inverse homography.
Homography Homography::inverse() const
{
Homography h;
h.m_H = m_H.inv();
h.normalize();
return h;
}
/// Put coef(2,2) to 1.
void Homography::normalize()
{
m_H /= m_H(2,2);
}
} // libNumerics

View file

@ -0,0 +1,83 @@
#ifndef HOMOGRAPHY_H
#define HOMOGRAPHY_H
#include "matrix.h"
namespace libNumerics {
/// 2-D homography transform.
class Homography {
public:
Homography();
void setId();
void setTrans(double dx, double dy);
void setZoom(double zx, double zy);
matrix<double>& mat() { return m_H; }
const matrix<double>& mat() const { return m_H; }
void operator()(double& x, double& y) const;
Homography operator*(const Homography& rhs) const;
Homography inverse() const;
private:
matrix<double> m_H;
void normalize();
};
/// Homography (and more restricted transforms) estimation.
class ComputeH {
public:
enum Type { Translation, // (2 parameters)
Rotation, // Rotation/Translation (3 parameters)
Zoom, // Zoom/Translation (3 parameters)
GeneralZoom, // Non uniform zoom/Translation (4 parameters)
Similarity, // Zoom/Rotation/Translation (4 parameters)
Affine, // (6 parameters)
Projective // (8 parameters)
};
static Type restrict(Type t); // Return less general motion
public:
ComputeH(Type type);
~ComputeH();
Type type() const { return _type; }
void clear();
/// Add corresponding points (x1,y1) and (x2,y2)
void add(float x1, float y1, float x2, float y2, float w = 1.0f);
/// Add corresponding lines of equation u x + v y + w = 0
void add(float a1, float b1, float c1,
float a2, float b2, float c2, float w = 1.0f);
float weight() const; ///< Sum of weights (=#correspondences)
float q_error(const Homography& map) const; ///< Quadratic error
float compute(Homography& map) const; ///< LSE motion, return support weight
private:
Type _type;
int n; ///< Dimension of matrix = # unknown parameters
double Ann[64], Bn[8], b; // Min (X 1) (A B) (X 1)^T is X^T = Ann^-1 Bn
static int size(Type type);
void add_4parameters(float x1, float y1, float x2, float y2, float w);
void add_4parameters(float a1, float b1, float c1,
float a2, float b2, float c2, float w);
void wrap(Homography& map, const vector<double>& v) const;
void unwrap(const Homography& map, vector<double>& v) const;
float q_error(const vector<double>& v) const; // Quadratic error
bool compute_rotation(vector<double>& B) const;
/// For Projective, data normalization is required
class Normalization { public: double x, y, s; };
bool normalize(Normalization& left,
matrix<double>& A, vector<double>& B,
Normalization& right) const;
static bool de_normalize(const Normalization& left,
vector<double>& B,
const Normalization& right);
};
} // libNumerics
#endif

View file

@ -0,0 +1,565 @@
// Authors: Unknown. Please, if you are the author of this file, or if you
// know who are the authors of this file, let us know, so we can give the
// adequate credits and/or get the adequate authorizations.
#ifdef MATRIX_H // Do nothing if not included from matrix.h
#define INDEX(i,j) ((i) * m_cols + (j))
namespace libNumerics {
/// Constructor for \a m*\a n matrix.
/// \param m number of rows.
/// \param n number of columns.
template <typename T>
matrix<T>::matrix(int m, int n)
{
alloc(m, n);
}
/// Copy constructor.
template <typename T>
matrix<T>::matrix(const matrix<T>& m)
{
alloc(m.m_rows, m.m_cols);
for(int i = nElements()-1; i >= 0; i--)
p[i] = m.p[i];
}
/// Destructor.
template <typename T>
matrix<T>::~matrix()
{
free();
}
/// Assignment operator.
template <typename T>
matrix<T>& matrix<T>::operator=(const matrix<T>& m)
{
if(&m == this) return *this;
if(m.nElements() != nElements()){
free();
alloc(m.m_rows, m.m_cols);
} else {
m_rows = m.m_rows;
m_cols = m.m_cols;
}
for(int i = nElements()-1; i >= 0; i--)
p[i] = m.p[i];
return *this;
}
/// Access the coefficient on the \a i-th row, \a j-th column.
template <typename T>
inline T matrix<T>::operator() (int i, int j) const
{
assert(i >= 0 && i < m_rows && j >= 0 && j < m_cols);
return p[INDEX(i,j)];
}
/// Access the coefficient on the \a i-th row, \a j-th column.
template <typename T>
inline T& matrix<T>::operator() (int i, int j)
{
assert(i >= 0 && i < m_rows && j >= 0 && j < m_cols);
return p[INDEX(i,j)];
}
template <typename T>
inline T matrix<T>::operator() (int i) const
{
assert(i >= 0 && i < nElements());
return p[i];
}
template <typename T>
inline T& matrix<T>::operator() (int i)
{
assert(i >= 0 && i < nElements());
return p[i];
}
/// Set matrix at constant value.
///
/// Assign all coefficients to the value \a a.
template <typename T>
inline void matrix<T>::operator=(T a)
{
for(int i = nElements()-1; i >= 0; i--)
p[i] = a;
}
/// Multiply a matrix by scalar.
/// \param a a scalar.
template <typename T>
matrix<T> matrix<T>::operator*(T a) const
{
matrix<T> prod(m_rows, m_cols);
for(int i = nElements()-1; i >= 0; i--)
prod.p[i] = a * p[i];
return prod;
}
/// Multiply a matrix by scalar.
/// \param a a scalar.
template <typename T>
void matrix<T>::operator*=(T a)
{
for(int i = nElements()-1; i >= 0; i--)
p[i] *= a;
}
/// Divide a matrix by scalar.
/// \param a a scalar.
template <typename T>
matrix<T> matrix<T>::operator/(T a) const
{
return (*this) * ((T)1/a);
}
/// Divide a matrix by scalar.
/// \param a a scalar.
template <typename T>
void matrix<T>::operator/=(T a)
{
*this *= (T)1 / a;
}
/// Matrix sum.
template <typename T>
matrix<T> matrix<T>::operator+(const matrix<T>& m) const
{
assert(m.m_rows == m_rows && m.m_cols == m_cols);
matrix<T> sum(m_rows,m_cols);
for(int i = nElements()-1; i >= 0; i--)
sum.p[i] = p[i] + m.p[i];
return sum;
}
/// Matrix sum.
template <typename T>
void matrix<T>::operator+=(const matrix<T>& m)
{
assert(m.m_rows == m_rows && m.m_cols == m_cols);
for(int i = nElements()-1; i >= 0; i--)
p[i] += m.p[i];
}
/// Matrix subtraction.
template <typename T>
matrix<T> matrix<T>::operator-(const matrix<T>& m) const
{
assert(m.m_rows == m_rows && m.m_cols == m_cols);
matrix<T> sub(m_rows,m_cols);
for(int i = nElements()-1; i >= 0; i--)
sub.p[i] = p[i] - m.p[i];
return sub;
}
/// Matrix subtraction.
template <typename T>
void matrix<T>::operator-=(const matrix<T>& m)
{
assert(m.m_rows == m_rows && m.m_cols == m_cols);
for(int i = nElements()-1; i >= 0; i--)
p[i] -= m.p[i];
}
template <typename T>
matrix<T> matrix<T>::operator-() const
{
matrix<T> opp(m_rows, m_cols);
for(int i = nElements()-1; i >= 0; i--)
opp.p[i] = -p[i];
return opp;
}
/// Matrix multiplication.
template <typename T>
matrix<T> matrix<T>::operator*(const matrix<T>& m) const
{
assert(m_cols == m.m_rows);
matrix<T> prod(m_rows, m.m_cols);
T* out = prod.p;
for(int i = 0; i < prod.m_rows; i++) {
const T* left = p + i*m_cols;
for(int j = 0; j < prod.m_cols; j++, out++) {
const T* right = m.p + j;
*out = 0;
for(int k = 0; k < m_cols; k++) {
*out += left[k] * *right;
right += m.m_cols;
}
}
}
return prod;
}
/// Matrix-vector multiplication.
template <typename T>
vector<T> matrix<T>::operator*(const vector<T>& m) const
{
assert(m_cols == m.m_rows);
vector<T> prod(m_rows);
T* out = prod.p;
for(int i = 0; i < prod.m_rows; i++, out++) {
const T* left = p + i*m_cols;
const T* right = m.p;
*out = 0;
for(int k = 0; k < m_cols; k++)
*out += left[k] * right[k];
}
return prod;
}
/// Tranposed of matrix.
template <typename T>
matrix<T> matrix<T>::t() const
{
matrix<T> t(ncol(), nrow());
T* out = t.p;
for(int i = 0; i < t.nrow(); i++) {
const T* in = p + i;
for(int j = 0; j < t.ncol(); j++) {
*out++ = *in;
in += ncol();
}
}
return t;
}
/// Symmetrize upper part of matrix.
template <typename T>
void matrix<T>::symUpper()
{
assert(m_rows == m_cols);
for(int i = 1; i < m_rows; i++) {
const T* in = p + i;
T* out = p + m_cols*i;
for(int j = 0; j < i; j++) {
*out++ = *in;
in += m_cols;
}
}
}
/// Symmetrize lower part of matrix.
template <typename T>
void matrix<T>::symLower()
{
assert(m_rows == m_cols);
for(int i = 1; i < m_rows; i++) {
const T* in = p + m_cols*i;
T* out = p + i;
for(int j = 0; j < i; j++) {
*out = *in++;
out += m_cols;
}
}
}
template <typename T>
vector<T> matrix<T>::diag() const
{
assert(m_rows == m_cols);
vector<T> t(m_rows);
for(int i = 0; i < m_rows; i++)
t.p[i] = p[i*(m_cols+1)];
return t;
}
/// Matrix made of zeros.
template <typename T>
matrix<T> matrix<T>::zeros(int m, int n)
{
matrix<T> M(m,n);
for(int i = M.nElements()-1; i >= 0; i--)
M.p[i] = (T)0;
return M;
}
/// Matrix made of ones.
template <typename T>
matrix<T> matrix<T>::ones(int m, int n)
{
matrix<T> M(m,n);
for(int i = M.nElements()-1; i >= 0; i--)
M.p[i] = (T)1;
return M;
}
/// Identity matrix.
template <typename T>
matrix<T> matrix<T>::eye(int n)
{
matrix<T> M(n,n);
for(int i = M.nElements()-1; i >= 0; i--)
M.p[i] = (T)0;
for(int i = n-1; i >= 0; i--)
M.p[i*(n+1)] = (T)1;
return M;
}
/// Extract the submatrix [i0,i1]x[j0,j1].
/// \param i0 first row
/// \param i1 last row
/// \param j0 first column
/// \param j1 last column
template <typename T>
matrix<T> matrix<T>::copy(int i0, int i1, int j0, int j1) const
{
assert(0 <= i0 && i0 <= i1 && i1 <= m_rows &&
0 <= j0 && j0 <= j1 && j1 <= m_cols);
matrix<T> sub(i1-i0+1,j1-j0+1);
T* out = sub.p;
for(int i = i0; i <= i1; i++) {
const T* in = p + INDEX(i, j0);
for(int j = j0; j <= j1; j++)
*out++ = *in++;
}
return sub;
}
/// Extract the columns of index in [j0,j1].
/// \param j0 first column
/// \param j1 last column
template <typename T>
matrix<T> matrix<T>::copyCols(int j0, int j1) const
{
return copy(0, lastRow(), j0, j1);
}
/// Extract the rows of index in [i0,i1].
/// \param i0 first row
/// \param i1 last row
template <typename T>
matrix<T> matrix<T>::copyRows(int i0, int i1) const
{
return copy(i0, i1, 0, lastCol());
}
/// Paste a matrix in another one, at position (\a i0,\a j0)
/// \param i0 first row where to paste in
/// \param j0 first column where to paste in
/// \param matrix to paste
template <typename T>
void matrix<T>::paste(int i0, int j0, const matrix<T>& m)
{
assert(i0 >= 0 && i0+m.m_rows <= m_rows &&
j0 >= 0 && j0+m.m_cols <= m_cols);
const T* in = m.p;
for(int i = 0; i < m.m_rows; i++) {
T* out = p + INDEX(i0+i, j0);
for(int j = 0; j < m.m_cols; j++)
*out++ = *in++;
}
}
/// Concatenate matrices.
template <typename T>
matrix<T> cat(const matrix<T>& m1, const matrix<T>& m2)
{
assert(m1.m_rows == m2.m_rows);
matrix<T> m(m1.m_rows, m1.m_cols+m2.m_cols);
m.paste(0, 0, m1);
m.paste(0, m1.m_cols, m2);
return m;
}
/// Copy column number \a j.
template <typename T>
vector<T> matrix<T>::col(int j) const
{
assert(j >= 0 && j < m_cols);
vector<T> c(m_rows);
const T* in = p + j;
for(int i = 0; i < m_rows; i++) {
c(i) = *in;
in += m_cols;
}
return c;
}
/// Copy row number \a i.
template <typename T>
inline matrix<T> matrix<T>::row(int i) const
{
return copy(i, i, 0, lastCol());
}
template <class T>
void swap(matrix<T>& A, matrix<T>& B)
{
int i=A.m_rows;
A.m_rows = B.m_rows;
B.m_rows = i;
i = A.m_cols;
A.m_cols = B.m_cols;
B.m_cols = i;
T* p = A.p;
A.p = B.p;
B.p = p;
}
template <typename T>
void matrix<T>::swapRows(int i0, int i1)
{
assert(0 <= i0 && i0 < m_rows &&
0 <= i1 && i1 < m_rows);
T* row0 = p + i0*m_cols;
T* row1 = p + i1*m_cols;
for(int j = m_cols-1; j >= 0; j--) {
T tmp = *row0; *row0++ = *row1; *row1++ = tmp;
}
}
template <typename T>
void matrix<T>::swapCols(int j0, int j1)
{
assert(0 <= j0 && j0 < m_cols &&
0 <= j1 && j1 < m_cols);
T* col0 = p + j0;
T* col1 = p + j1;
for(int i = m_rows-1; i >= 0; i--) {
T tmp = *col0; *col0 = *col1; *col1 = tmp;
col0 += m_cols;
col1 += m_cols;
}
}
/// Copy the array values in a matrix, row by row.
/// \param m number of rows
/// \param n number of columns
/// \param v an array of scalar of size m*n
template <typename T> template <typename U>
void matrix<T>::read(const U* v)
{
for(int i = nElements()-1; i >= 0; i--)
p[i] = (T)v[i];
}
/// Read the coefficients from \a m.
template <typename T>
inline void matrix<T>::read(const matrix<T>& m)
{
assert(m.nElements() == nElements());
read(m.p);
}
/// Copy the matrix coefficients in an array.
///
/// The matrix is scanned row by row.
template <typename T>
void matrix<T>::write(T* vect) const
{
for(int i = nElements()-1; i >= 0; i--)
vect[i] = p[i];
}
template <typename T>
void matrix<T>::alloc(int m, int n)
{
assert(m > 0 && n > 0);
m_rows = m;
m_cols = n;
p = new T[m*n];
}
template <typename T>
inline void matrix<T>::free()
{
delete [] p;
p = NULL;
}
template <typename T>
inline int matrix<T>::nElements() const
{
return m_rows*m_cols;
}
/// Submatrix without row \a i0 and col \a j0.
template <typename T>
matrix<T>& matrix<T>::sub(matrix<T>& s, int i0, int j0) const
{
const T* in = p;
T* out = s.p;
for(int i = 0; i < i0; i++) {
for(int j = 0; j < j0; j++)
*out++ = *in++;
++in; // Skip col j0
for(int j = j0+1; j < m_cols; j++)
*out++ = *in++;
}
in += m_cols; // Skip row i0
for(int i = i0+1; i < m_rows; i++) {
for(int j = 0; j < j0; j++)
*out++ = *in++;
++in; // Skip col j0
for(int j = j0+1; j < m_cols; j++)
*out++ = *in++;
}
return s;
}
/// Trace.
template <typename T>
T matrix<T>::tr() const
{
assert(m_rows == m_cols);
T res = (T)0;
for(int i = 0; i < m_rows; i++)
res += p[i*(m_cols+1)];
return res;
}
/// Determinant. Slow, use only for small matrices.
template <typename T>
T matrix<T>::det() const
{
assert(m_rows == m_cols);
if(m_rows == 1)
return p[0];
if(m_rows == 2)
return (p[0]*p[3]-p[1]*p[2]);
T res = (T)0;
T sign = (T)1;
matrix<T> s(m_rows-1, m_cols-1);
for(int j = 0; j < m_cols; j++) {
res += sign*p[j]*sub(s,0,j).det();
sign = -sign;
}
return res;
}
/// Inverse. Slow, use only for small matrices.
template <typename T>
matrix<T> matrix<T>::inv() const
{
assert(m_rows == m_cols);
matrix<T> res(m_rows, m_cols);
if(m_rows == 1)
res.p[0] = (T)1/p[0];
else {
T d = (T)1 / det();
T signi = (T)1;
T* out = res.p;
matrix<T> s(m_rows-1, m_cols-1);
for(int i = 0; i < m_rows; i++) {
T signj = signi;
for(int j = 0; j < m_cols; j++) {
*out++ = signj*d*sub(s,j,i).det();
signj = -signj;
}
signi = -signi;
}
}
return res;
}
} // namespace libNumerics
#undef INDEX
#endif // MATRIX_H

View file

@ -0,0 +1,175 @@
// Authors: Unknown. Please, if you are the author of this file, or if you
// know who are the authors of this file, let us know, so we can give the
// adequate credits and/or get the adequate authorizations.
#ifndef MATRIX_H
#define MATRIX_H
#include <iostream>
#include <cassert>
namespace libNumerics {
// Forward declaration, definition below
template <typename T> class vector;
template <typename T> class matrix;
template <typename T> matrix<T> cat(const matrix<T>&, const matrix<T>&);
template <typename T> void swap(matrix<T>&, matrix<T>&);
/// Matrix class
template <typename T>
class matrix
{
public:
static matrix<T> zeros(int m) { return zeros(m,m); }
static matrix<T> zeros(int m, int n);
static matrix<T> ones(int m) { return ones(m,m); }
static matrix<T> ones(int m, int n);
static matrix<T> eye(int n); ///< Identity matrix.
public:
matrix(int m, int n);
matrix(const matrix<T>& m);
virtual ~matrix();
matrix<T>& operator=(const matrix<T>& m);
int nrow() const { return m_rows; } ///< The number of rows.
int ncol() const { return m_cols; } ///< The number of columns.
T operator() (int i, int j) const;
T& operator() (int i, int j);
T operator() (int i) const;
T& operator() (int i);
void operator=(T a);
matrix<T> operator*(T a) const;
matrix<T> operator/(T a) const;
void operator*=(T a);
void operator/=(T a);
/// Product by scalar.
friend matrix<T> operator*(T a, const matrix<T>& m)
{ return m * a; }
matrix<T> operator+(const matrix<T>& m) const;
matrix<T> operator-(const matrix<T>& m) const;
matrix<T> operator-() const; ///< Matrix opposite.
matrix<T> operator*(const matrix<T>& m) const;
vector<T> operator*(const vector<T>& m) const;
void operator+=(const matrix<T>& m);
void operator-=(const matrix<T>& m);
matrix<T> t() const; ///< Transpose.
vector<T> diag() const; ///< Diagonal of matrix.
T tr() const;
T det() const;
matrix<T> inv() const;
void symUpper();
void symLower();
matrix<T> copy(int i0, int i1, int j0, int j1) const;
matrix<T> copyCols(int j0, int j1) const;
matrix<T> copyRows(int i0, int i1) const;
void paste(int i0, int j0, const matrix<T>& block);
friend matrix<T> cat<T>(const matrix<T>& left, const matrix<T>& right);
vector<T> col(int j) const; ///< Copy column.
matrix<T> row(int i) const; ///< Copy row.
int lastCol() const {return m_cols-1;} ///< Index of last column.
int lastRow() const {return m_rows-1;} ///< Index of last row.
friend void swap<T>(matrix<T>&, matrix<T>&);
void swapRows(int i0, int i1);
void swapCols(int j0, int j1);
template <typename U>
void read(const U* v);
void read(const matrix<T>& v);
void write(T* vect) const;
protected:
int m_rows; ///< Number of rows.
int m_cols; ///< Number of columns.
T* p; ///< 1-D array of coefficients.
void alloc(int m, int n); ///< Allocate the array value.
void free(); ///< Free the array value.
int nElements() const; ///< Number of elements in the matrix.
matrix<T>& sub(matrix<T>& s, int i, int j) const;
}; // class matrix
/// Column vector class (template)
template <typename T>
class vector : public matrix<T>
{
public:
explicit vector(int m);
vector(T x);
vector(T x, T y);
vector(T x, T y, T z);
vector(const vector<T>& v);
virtual ~vector() {}
using matrix<T>::operator=;
vector<T>& operator=(const vector<T>& v);
// void operator=(T a);
vector<T> operator*(T a) const;
vector<T> operator/(T a) const;
/// Product of a vector by a scalar.
friend vector<T> operator*(T a, const vector<T>& v)
{ return v * a; }
vector<T> operator+(const vector<T>& v) const;
vector<T> operator-(const vector<T>& v) const;
vector<T> operator-() const; ///< Vector opposite.
matrix<T> operator*(const matrix<T>& m) const;
matrix<T> diag() const;
T qnorm() const;
vector<T> copy(int i0, int i1) const;
void paste(int i0, const vector<T>& v);
};
} // namespace libNumerics
/// Output matrix coefficients.
template <typename T>
inline std::ostream& operator<<(std::ostream& out,
const libNumerics::matrix<T>& m)
{
for(int i = 0; i < m.nrow(); ++i) {
out << ((i==0)? "[": ";");
for (int j = 0; j < m.ncol(); ++j)
out << " " << m(i,j);
}
out << " ]";
return out;
}
/// Input matrix. Need to know the dimensions in advance...
template <class T>
inline std::istream& operator>>(std::istream& in,
libNumerics::matrix<T>& m)
{
char c;
for(int i=0; i < m.nrow(); ++i) {
in >> c;
for(int j=0; j < m.ncol(); ++j)
in >> m(i,j);
}
in >> c;
return in;
}
template <typename T>
T dot(const libNumerics::vector<T>& u, const libNumerics::vector<T>& v);
template <typename T>
libNumerics::vector<T> cross(const libNumerics::vector<T>& u,
const libNumerics::vector<T>& v);
// Need to see definitions for templates...
#include "matrix.cpp"
#include "vector.cpp"
#endif

View file

@ -0,0 +1,487 @@
// Authors: Unknown. Please, if you are the author of this file, or if you
// know who are the authors of this file, let us know, so we can give the
// adequate credits and/or get the adequate authorizations.
#include "numerics.h"
#include <cmath>
#include <vector>
#include <limits>
#include <algorithm>
namespace libNumerics {
const flnum MinLM::DEFAULT_RELATIVE_TOL = 1E-3;
const flnum MinLM::DEFAULT_LAMBDA_INIT = 1E-3;
const flnum MinLM::DEFAULT_LAMBDA_FACT = 10.0;
const flnum MinLM::EPSILON_KERNEL = 1E-9;
inline flnum ABS(flnum x)
{ return (x >= 0)? x: -x; }
/// Resolution by LU decomposition with pivot.
bool solveLU(const matrix<flnum>& A, const vector<flnum>& B, vector<flnum>& X)
{
X = B;
return solveLU(A, X);
}
/// Replace X by A^{-1}X, by LU solver.
bool solveLU(matrix<flnum> A, vector<flnum>& X)
{
assert(A.nrow() == A.ncol());
int n = A.nrow();
vector<flnum> rowscale(n); // Implicit scaling of each row
std::vector<int> permut(n,0); // Permutation of rows
// Get the implicit scaling information of each row
for(int i=0; i< n; i++) {
flnum max = 0.0;
for(int j=0; j< n; j++) {
flnum tmp = ABS(A(i,j));
if (tmp> max)
max = tmp;
}
if(max == 0.0)
return false;
rowscale(i) = 1.0/max;
}
// Perform the decomposition
for(int k=0; k < n; k++) {
// Search for largest pivot element
flnum max = rowscale(k)*ABS(A(k,k));
int imax = k;
for(int i=k+1; i < n; i++) {
flnum tmp = rowscale(i)*ABS(A(i,k));
if(tmp > max) {
max = tmp;
imax = i;
}
}
if(max == 0.0)
return false;
// Interchange rows if needed
if(k != imax) {
A.swapRows(k, imax);
rowscale(imax) = rowscale(k); // Scale of row k no longer needed
}
permut[k] = imax; // permut(k) was not initialized before
flnum Akk = 1/A(k,k);
for(int i=k+1; i < n; i++) {
flnum tmp = A(i,k) *= Akk; // Divide by pivot
for (int j=k+1;j < n; j++) // Reduce the row
A(i,j) -= tmp*A(k,j);
}
}
// Forward substitution
for (int k=0; k < n; k++) {
flnum sum = X(permut[k]);
X(permut[k]) = X(k);
for(int j = 0; j < k; j++)
sum -= A(k,j)*X(j);
X(k) = sum;
}
// Backward substitution
for(int k=n-1; k >= 0; k--) {
flnum sum = X(k);
for(int j=k+1; j < n; j++)
sum -= A(k,j)*X(j);
X(k) = sum/A(k,k);
}
return true;
}
/// Decompose A into U diag(W) V^T with U(m,n) and V(n,n) having orthonormal
/// vectors.
SVD::SVD(const matrix<flnum>& A)
: m_U(A), m_V(A.ncol(),A.ncol()), m_W(A.ncol())
{
compute();
sort();
}
/// SVD computation. Initial matrix stored in m_U as input.
void SVD::compute()
{
const flnum EPSILON = std::numeric_limits<flnum>::epsilon();
const int SVD_MAX_ITS = 30;
int rows = m_U.nrow();
int cols = m_U.ncol();
flnum g, scale, anorm;
vector<flnum> RV1(cols);
// Householder reduction to bidiagonal form:
anorm = g = scale = 0.0;
for (int i=0; i< cols; i++) {
int l = i + 1;
RV1(i) = scale*g;
g = scale = 0.0;
if(i< rows) {
for (int k=i; k< rows; k++)
scale += ABS(m_U(k,i));
if (scale != 0.0) {
flnum invScale=1.0/scale, s=0.0;
for (int k=i; k< rows; k++) {
m_U(k,i) *= invScale;
s += m_U(k,i) * m_U(k,i);
}
flnum f = m_U(i,i);
g = - withSignOf(std::sqrt(s),f);
flnum h = 1.0 / (f*g - s);
m_U(i,i) = f - g;
for (int j=l; j< cols; j++) {
s = 0.0;
for (int k=i; k< rows; k++)
s += m_U(k,i) * m_U(k,j);
f = s * h;
for (int k=i; k< rows; k++)
m_U(k,j) += f * m_U(k,i);
}
for (int k=i; k< rows; k++)
m_U(k,i) *= scale;
}
}
m_W(i) = scale * g;
g = scale = 0.0;
if ( i< rows && i< cols-1 ) {
for (int k=l; k< cols; k++)
scale += ABS(m_U(i,k));
if (scale != 0.0) {
flnum invScale=1.0/scale, s=0.0;
for (int k=l; k< cols; k++) {
m_U(i,k) *= invScale;
s += m_U(i,k) * m_U(i,k);
}
flnum f = m_U(i,l);
g = - withSignOf(std::sqrt(s),f);
flnum h = 1.0 / (f*g - s);
m_U(i,l) = f - g;
for (int k=l; k< cols; k++)
RV1(k) = m_U(i,k) * h;
for (int j=l; j< rows; j++) {
s = 0.0;
for (int k=l; k< cols; k++)
s += m_U(j,k) * m_U(i,k);
for (int k=l; k< cols; k++)
m_U(j,k) += s * RV1(k);
}
for (int k=l; k< cols; k++)
m_U(i,k) *= scale;
}
}
anorm = std::max(anorm, ABS(m_W(i)) + ABS(RV1(i)) );
}
// Accumulation of right-hand transformations:
m_V(cols-1,cols-1) = 1.0;
for (int i= cols-2; i>=0; i--) {
m_V(i,i) = 1.0;
int l = i+1;
g = RV1(l);
if (g != 0.0) {
flnum invgUil = 1.0 / (m_U(i,l)*g);
for (int j=l; j< cols; j++)
m_V(j,i) = m_U(i,j) * invgUil;
for (int j=l; j< cols; j++){
flnum s = 0.0;
for (int k=l; k< cols; k++)
s += m_U(i,k) * m_V(k,j);
for (int k=l; k< cols; k++)
m_V(k,j) += s * m_V(k,i);
}
}
for (int j=l; j< cols; j++)
m_V(i,j) = m_V(j,i) = 0.0;
}
// Accumulation of left-hand transformations:
for (int i=std::min(rows,cols)-1; i>=0; i--) {
int l = i+1;
g = m_W(i);
for (int j=l; j< cols; j++)
m_U(i,j) = 0.0;
if (g != 0.0) {
g = 1.0 / g;
flnum invUii = 1.0 / m_U(i,i);
for (int j=l; j< cols; j++) {
flnum s = 0.0;
for (int k=l; k< rows; k++)
s += m_U(k,i) * m_U(k,j);
flnum f = (s * invUii) * g;
for (int k=i; k< rows; k++)
m_U(k,j) += f * m_U(k,i);
}
for (int j=i; j< rows; j++)
m_U(j,i) *= g;
} else
for (int j=i; j< rows; j++)
m_U(j,i) = 0.0;
m_U(i,i) = m_U(i,i) + 1.0;
}
// Diagonalization of the bidiagonal form:
for (int k=cols-1; k>=0; k--) { // Loop over singular values
for (int its=1; its<=SVD_MAX_ITS; its++) {
bool flag = false;
int l = k;
int nm = k-1;
while(l>0 && ABS(RV1(l)) > EPSILON*anorm) { // Test for splitting
if(ABS(m_W(nm)) <= EPSILON*anorm) {
flag = true;
break;
}
l--;
nm--;
}
if (flag) { // Cancellation of RV1(l), if l > 0
flnum c=0.0, s=1.0;
for (int i=l; i< k+1; i++) {
flnum f = s * RV1(i);
RV1(i) = c * RV1(i);
if (ABS(f)<=EPSILON*anorm)
break;
g = m_W(i);
flnum h = SVD::hypot(f,g);
m_W(i) = h;
h = 1.0 / h;
c = g * h;
s = - f * h;
for (int j=0; j< rows; j++)
rotate(m_U(j,nm),m_U(j,i), c,s);
}
}
flnum z = m_W(k);
if (l==k) { // Convergence of the singular value
if (z< 0.0) { // Singular value is made nonnegative
m_W(k) = -z;
for (int j=0; j< cols; j++)
m_V(j,k) = - m_V(j,k);
}
break;
}
// Exception if convergence to the singular value not reached:
if(its==SVD_MAX_ITS) throw SvdConvergenceError();
flnum x = m_W(l); // Get QR shift value from bottom 2x2 minor
nm = k-1;
flnum y = m_W(nm);
g = RV1(nm);
flnum h = RV1(k);
flnum f = ( (y-z)*(y+z) + (g-h)*(g+h) ) / ( 2.0*h*y );
g = SVD::hypot(f,1.0);
f = ( (x-z)*(x+z) + h*(y/(f+withSignOf(g,f)) - h) ) / x;
// Next QR transformation (through Givens reflections)
flnum c=1.0, s=1.0;
for (int j=l; j<=nm; j++) {
int i = j+1;
g = RV1(i);
y = m_W(i);
h = s * g;
g = c * g;
z = SVD::hypot(f,h);
RV1(j) = z;
z = 1.0 / z;
c = f * z;
s = h * z;
f = x*c + g*s;
g = g*c - x*s;
h = y * s;
y *= c;
for(int jj=0; jj < cols; jj++)
rotate(m_V(jj,j),m_V(jj,i), c,s);
z = SVD::hypot(f,h);
m_W(j) = z;
if (z!=0.0) { // Rotation can be arbitrary if z = 0.0
z = 1.0 / z;
c = f * z;
s = h * z;
}
f = c*g + s*y;
x = c*y - s*g;
for(int jj=0; jj < rows; jj++)
rotate(m_U(jj,j),m_U(jj,i), c,s);
}
RV1(l) = 0.0;
RV1(k) = f;
m_W(k) = x;
}
}
}
/// Recompose from SVD. This should be the initial matrix.
matrix<flnum> SVD::compose() const
{
return m_U * m_W.diag() * m_V.t();
}
flnum SVD::withSignOf(flnum a, flnum b)
{ return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a); }
/// Replace hypot of math.h by robust numeric implementation.
flnum SVD::hypot(flnum a, flnum b)
{
a = ABS(a);
b = ABS(b);
if(a > b) {
b /= a;
return a*std::sqrt(1.0 + b*b);
} else if(b) {
a /= b;
return b*std::sqrt(1.0 + a*a);
}
return 0.0;
}
/// Utility function used while computing SVD.
void SVD::rotate(flnum& a, flnum& b, flnum c, flnum s)
{
flnum d = a;
a = +d*c +b*s;
b = -d*s +b*c;
}
class SVDElement {
public:
SVDElement(const vector<flnum>& W, int i)
: m_val(W(i)), m_i(i) {}
bool operator<(const SVDElement& e) const
{ return (m_val>e.m_val); }
flnum m_val;
int m_i;
};
/// Sort SVD by decreasing order of singular value.
void SVD::sort()
{
std::vector<SVDElement> vec;
for(int i=0; i < m_U.ncol(); i++)
vec.push_back( SVDElement(m_W, i) );
std::sort(vec.begin(), vec.end());
// Apply permutation
for(int i=m_U.ncol()-1; i >=0; i--)
if(vec[i].m_i != i) { // Find cycle of i
const vector<flnum> colU = m_U.col(i);
const vector<flnum> colV = m_V.col(i);
const flnum w = m_W(i);
int j = i;
while(vec[j].m_i != i) {
m_U.paste(0,j, m_U.col(vec[j].m_i));
m_V.paste(0,j, m_V.col(vec[j].m_i));
m_W(j) = m_W(vec[j].m_i);
std::swap(j,vec[j].m_i);
}
vec[j].m_i = j;
m_U.paste(0,j, colU);
m_V.paste(0,j, colV);
m_W(j) = w;
}
}
/// Constructor.
MinLM::MinLM()
: iterations(0), relativeTol(DEFAULT_RELATIVE_TOL),
lambdaInit(DEFAULT_LAMBDA_INIT), lambdaFact(DEFAULT_LAMBDA_FACT)
{}
/// In equation JtJ X = B, remove columns of J close to 0, so that JtJ can be
/// invertible
void MinLM::compress(matrix<flnum>& JtJ, vector<flnum>& B)
{
flnum max=0;
for(int i=0; i < JtJ.nrow(); i++)
if(JtJ(i,i) > max)
max = JtJ(i,i);
max *= EPSILON_KERNEL;
m_nullCols.clear();
for(int i=0; i < JtJ.nrow(); i++)
if(JtJ(i,i) <= max)
m_nullCols.push_back(i);
if( m_nullCols.empty() )
return;
int n=(int)m_nullCols.size();
matrix<flnum> JtJ2(JtJ.nrow()-m_nullCols.size(),
JtJ.ncol()-m_nullCols.size());
vector<flnum> B2(B.nrow()-(int)m_nullCols.size());
for(int i=0,i2=0; i < JtJ.nrow(); i++) {
if(i-i2 < n && m_nullCols[i-i2]==i)
continue;
for(int j=0,j2=0; j < JtJ.ncol(); j++) {
if(j-j2 < n && m_nullCols[j-j2]==j)
continue;
JtJ2(i2,j2) = JtJ(i,j);
j2++;
}
B2(i2) = B(i);
i2++;
}
swap(JtJ,JtJ2);
swap(B,B2);
}
/// Insert 0 in rows of B that were removed by \c compress()
void MinLM::uncompress(vector<flnum>& B)
{
if(m_nullCols.empty())
return;
int n=(int)m_nullCols.size();
vector<flnum> B2(B.nrow()+(int)m_nullCols.size());
for(int i=0,i2=0; i2 < B2.nrow(); i2++)
if(i2-i < n && m_nullCols[i2-i]==i2)
B2(i2)=0;
else
B2(i2) = B(i++);
swap(B,B2);
}
/// Perform minimization.
/// \a targetRMSE is the root mean square error aimed at.
/// Return the reached RMSE. Since the class does not know the dimension, the
/// real RMSE should be this value multiplied by sqrt(dim). For example, for 2-D
/// points this would be sqrt(2) times the returned value.
flnum MinLM::minimize(vector<flnum>& P, const vector<flnum>& yData,
flnum targetRMSE, int maxIters)
{
flnum errorMax = targetRMSE*targetRMSE*yData.nrow();
vector<flnum> yModel( yData.nrow() );
modelData(P, yModel);
vector<flnum> E( yData-yModel );
flnum error = E.qnorm();
matrix<flnum> J( yData.nrow(), P.nrow() );
modelJacobian(P, J);
matrix<flnum> Jt = J.t();
matrix<flnum> JtJ = Jt*J;
vector<flnum> B = Jt*E;
compress(JtJ, B);
flnum lambda = lambdaInit;
for(iterations=0; iterations < maxIters && error > errorMax; iterations++) {
matrix<flnum> H(JtJ);
for(int i = 0; i < H.nrow(); i++)
H(i,i) *= 1+lambda;
vector<flnum> dP( P.nrow() );
solveLU(H, B, dP);
uncompress(dP);
vector<flnum> tryP = P + dP;
modelData(tryP, yModel);
E = yData - yModel;
flnum tryError = E.qnorm();
if(ABS(tryError-error) <= relativeTol*error)
break;
if(tryError > error)
lambda *= lambdaFact;
else {
lambda /= lambdaFact;
error = tryError;
P = tryP;
modelJacobian(P, J);
Jt = J.t();
JtJ = Jt*J;
B = Jt*E;
compress(JtJ, B);
}
}
return sqrt(error/yData.nrow());
}
} // namespace libNumerics

View file

@ -0,0 +1,66 @@
// Authors: Unknown. Please, if you are the author of this file, or if you
// know who are the authors of this file, let us know, so we can give the
// adequate credits and/or get the adequate authorizations.
#ifndef NUMERICS_H
#define NUMERICS_H
#include "matrix.h"
#include <vector>
namespace libNumerics {
class NumericsException {};
class SvdConvergenceError : public NumericsException {};
typedef double flnum;
/// Solve system AX = B.
bool solveLU(const matrix<flnum>& A, const vector<flnum>& B,
vector<flnum>& X);
bool solveLU(matrix<flnum> A, vector<flnum>& B);
/// Singular Value Decomposition
class SVD {
public:
SVD(const matrix<flnum>& A);
matrix<flnum>& U() { return m_U; }
vector<flnum>& W() { return m_W; }
matrix<flnum>& V() { return m_V; }
matrix<flnum> compose() const;
private:
matrix<flnum> m_U, m_V;
vector<flnum> m_W;
static flnum withSignOf(flnum a, flnum b);
static flnum hypot(flnum a, flnum b);
static void rotate(flnum& a, flnum& b, flnum c, flnum s);
void compute();
void sort();
};
/// Levenberg-Marquardt minimization.
class MinLM {
static const flnum DEFAULT_RELATIVE_TOL;
static const flnum DEFAULT_LAMBDA_INIT;
static const flnum DEFAULT_LAMBDA_FACT;
static const flnum EPSILON_KERNEL;
public:
MinLM();
flnum minimize(vector<flnum>& P, const vector<flnum>& ydata,
flnum targetRMSE=0.1, int maxIters=300);
virtual void modelData(const vector<flnum>& P,
vector<flnum>& ymodel) const = 0;
virtual void modelJacobian(const vector<flnum>& P,
matrix<flnum>& J) const = 0;
int iterations;
flnum relativeTol;
flnum lambdaInit;
flnum lambdaFact;
private:
std::vector<int> m_nullCols;
void compress(matrix<flnum>& JtJ, vector<flnum>& B);
void uncompress(vector<flnum>& B);
};
} // namespace libNumerics
#endif

View file

@ -0,0 +1,55 @@
// Authors: Unknown. Please, if you are the author of this file, or if you
// know who are the authors of this file, let us know, so we can give the
// adequate credits and/or get the adequate authorizations.
#ifdef RODRIGUES_H
namespace libNumerics {
template <class T>
matrix<T> skew(const vector<T>& v)
{
assert(v.nrow() == 3);
matrix<T> M(3,3);
M(0,0) = M(1,1) = M(2,2) = 0;
M(1,2) = -(M(2,1)=v(0));
M(2,0) = -(M(0,2)=v(1));
M(0,1) = -(M(1,0)=v(2));
return M;
}
template <class T>
matrix<T> rotation(vector<T> w)
{
assert(w.nrow() == 3);
T n = sqrt(w.qnorm());
T c = cos(n);
matrix<T> R = c*matrix<T>::eye(3);
if(n) {
w /= n;
R += skew(sin(n)*w);
R += (1-c)*w*w.t();
}
return R;
}
template <class T>
vector<T> rotationAxis(const matrix<T>& R)
{
assert(R.nrow() == 3 && R.ncol() == 3);
vector<T> w(3);
T n = acos(0.5*(R.tr()-1));
if(n == 0)
w = 0;
else {
w(0) = R(2,1)-R(1,2);
w(1) = R(0,2)-R(2,0);
w(2) = R(1,0)-R(0,1);
w *= n/(2*sin(n));
}
return w;
}
} // libNumerics
#endif // RODRIGUES_H

View file

@ -0,0 +1,24 @@
// Authors: Unknown. Please, if you are the author of this file, or if you
// know who are the authors of this file, let us know, so we can give the
// adequate credits and/or get the adequate authorizations.
#ifndef RODRIGUES_H
#define RODRIGUES_H
#include "matrix.h"
#include <math.h>
namespace libNumerics {
/// Skew-symmetric matrix of 3-vector v.
template <class T> matrix<T> skew(const vector<T>& v);
/// Rodrigues's rotation: exp(w_x).
template <class T> matrix<T> rotation(vector<T> w);
/// Inverse Rodrigues's formula: w s.t. R=exp(w_x).
template <class T> vector<T> rotationAxis(const matrix<T>& R);
} // libNumerics
#include "rodrigues.cpp"
#endif

View file

@ -0,0 +1,179 @@
// Authors: Unknown. Please, if you are the author of this file, or if you
// know who are the authors of this file, let us know, so we can give the
// adequate credits and/or get the adequate authorizations.
#ifdef MATRIX_H // Do nothing if not included from matrix.h
namespace libNumerics {
/// Constructor
template <typename T>
vector<T>::vector(int m)
: matrix<T>(m, 1)
{}
/// 1-vector constructor.
template <typename T>
vector<T>::vector(T x)
: matrix<T>(1,1)
{
this->p[0] = x;
}
/// 2-vector constructor.
template <typename T>
vector<T>::vector(T x, T y)
: matrix<T>(2,1)
{
this->p[0] = x;
this->p[1] = y;
}
/// 3-vector constructor.
template <typename T>
vector<T>::vector(T x, T y, T z)
: matrix<T>(3,1)
{
this->p[0] = x;
this->p[1] = y;
this->p[2] = z;
}
/// Copy constructor
template <typename T>
vector<T>::vector(const vector<T>& v)
: matrix<T>(v)
{}
/// Assignment operator
template <typename T>
vector<T>& vector<T>::operator=(const vector<T>& v)
{
matrix<T>::operator=(v);
return *this;
}
/// Multiply a vector by scalar.
/// \param a a scalar.
template <typename T>
vector<T> vector<T>::operator*(T a) const
{
vector<T> v(this->m_rows);
for(int i = this->m_rows-1; i >= 0; i--)
v.p[i] = a*this->p[i];
return v;
}
/// Divide a vector by scalar.
/// \param a a scalar.
template <typename T>
inline vector<T> vector<T>::operator/(T a) const
{
return operator*( (T)1/a );
}
/// Addition of vectors.
template <typename T>
vector<T> vector<T>::operator+(const vector<T>& v) const
{
assert(this->m_rows == v.m_rows);
vector<T> sum(this->m_rows);
for(int i = this->m_rows-1; i >= 0; i--)
sum.p[i] = this->p[i] + v.p[i];
return sum;
}
/// Subtraction of vectors.
template <typename T>
vector<T> vector<T>::operator-(const vector<T>& v) const
{
assert(this->m_rows == v.m_rows);
vector<T> sub(this->m_rows);
for(int i = this->m_rows-1; i >= 0; i--)
sub.p[i] = this->p[i] - v.p[i];
return sub;
}
/// Opposite of vector.
template <typename T>
vector<T> vector<T>::operator-() const
{
vector<T> v(this->m_rows);
for(int i = this->m_rows-1; i >= 0; i--)
v.p[i] = -this->p[i];
return v;
}
/// Vector times matrix.
template <typename T>
matrix<T> vector<T>::operator*(const matrix<T>& m) const
{
return matrix<T>::operator*(m);
}
/// Diagonal matrix defined by its diagonal vector.
template <typename T>
matrix<T> vector<T>::diag() const
{
matrix<T> d(this->m_rows, this->m_rows);
d = (T)0;
for(int i = this->m_rows-1; i >= 0; i--)
d(i,i) = this->p[i];
return d;
}
/// Square L^2 norm of vector.
template <typename T>
T vector<T>::qnorm() const
{
T q = (T)0;
for(int i = this->m_rows-1; i >= 0; i--)
q += this->p[i]*this->p[i];
return q;
}
/// Subvector from \a i0 to \a i1.
template <typename T>
vector<T> vector<T>::copy(int i0, int i1) const
{
assert(0 <= i0 && i0 <= i1 && i1 <= this->m_rows);
vector<T> v(i1-i0+1);
for(int i=i0; i <= i1; i++)
v.p[i-i0] = this->p[i];
return v;
}
/// Paste vector \a v from row i0.
template <typename T>
void vector<T>::paste(int i0, const vector<T>& v)
{
matrix<T>::paste(i0, 0, v);
}
} // namespace libNumerics
/// Scalar product.
template <typename T>
T dot(const libNumerics::vector<T>& u, const libNumerics::vector<T>& v)
{
assert(u.nrow() == v.nrow());
T d = (T)0;
for(int i = u.nrow()-1; i >= 0; i--)
d += u(i)*v(i);
return d;
}
/// Cross product.
template <typename T>
libNumerics::vector<T> cross(const libNumerics::vector<T>& u,
const libNumerics::vector<T>& v)
{
assert(u.nrow() == 3 && v.nrow() == 3);
libNumerics::vector<T> w(3);
w(0) = u(1)*v(2) - u(2)*v(1);
w(1) = u(2)*v(0) - u(0)*v(2);
w(2) = u(0)*v(1) - u(1)*v(0);
return w;
}
#endif // MATRIX_H