flann-1.9.1+dfsg/000077500000000000000000000000001275407571100135505ustar00rootroot00000000000000flann-1.9.1+dfsg/CMakeLists.txt000066400000000000000000000154261275407571100163200ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) endif(COMMAND cmake_policy) project(flann) string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) include(${PROJECT_SOURCE_DIR}/cmake/flann_utils.cmake) set(FLANN_VERSION 1.9.1) DISSECT_VERSION() GET_OS_INFO() # detect if using the Clang compiler if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang") set(CMAKE_COMPILER_IS_CLANG 1) endif () if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(CMAKE_COMPILER_IS_CLANGXX 1) endif () list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # Add an "uninstall" target CONFIGURE_FILE ("${PROJECT_SOURCE_DIR}/cmake/uninstall_target.cmake.in" "${PROJECT_BINARY_DIR}/uninstall_target.cmake" IMMEDIATE @ONLY) ADD_CUSTOM_TARGET (uninstall "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/uninstall_target.cmake") # Set the build type. Options are: # Debug : w/ debug symbols, w/o optimization # Release : w/o debug symbols, w/ optimization # RelWithDebInfo : w/ debug symbols, w/ optimization # MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries if (NOT CMAKE_BUILD_TYPE) #set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type" FORCE) #set(CMAKE_BUILD_TYPE Debug) endif() #set the default path for built executables to the "bin" directory set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) #set the default path for built libraries to the "lib" directory set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) # set output path for tests set(TEST_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/test) option(BUILD_C_BINDINGS "Build C bindings" ON) option(BUILD_PYTHON_BINDINGS "Build Python bindings" ON) option(BUILD_MATLAB_BINDINGS "Build Matlab bindings" ON) option(BUILD_CUDA_LIB "Build CUDA library" OFF) option(BUILD_EXAMPLES "Build examples" ON) option(BUILD_TESTS "Build tests" ON) option(BUILD_DOC "Build documentation" ON) option(USE_OPENMP "Use OpenMP multi-threading" ON) option(USE_MPI "Use MPI" OFF) set(NVCC_COMPILER_BINDIR "" CACHE PATH "Directory where nvcc should look for C++ compiler. This is passed to nvcc through the --compiler-bindir option.") if (NOT BUILD_C_BINDINGS) set(BUILD_PYTHON_BINDINGS OFF) set(BUILD_MATLAB_BINDINGS OFF) endif() # find python find_package(PythonInterp) if (NOT PYTHON_EXECUTABLE) set(BUILD_PYTHON_BINDINGS OFF) endif() find_hdf5() if (NOT HDF5_FOUND) message(WARNING "hdf5 library not found, some tests will not be run") else() include_directories(${HDF5_INCLUDE_DIR}) endif() if (USE_MPI OR HDF5_IS_PARALLEL) find_package(MPI) endif() if (HDF5_IS_PARALLEL) if (NOT MPI_FOUND) message(WARNING "Found the parallel HDF5 library, but could not find the MPI library. Define the MPI_COMPILER variable to the path of your MPI compiler.") endif() # Parallel HDF5 needs to find the "mpi.h" header file include_directories(${MPI_INCLUDE_PATH}) endif() if (USE_MPI) if (NOT MPI_FOUND) message(WARNING "Could not find an MPI library. Define the MPI_COMPILER variable to the path of your MPI compiler.") set(USE_MPI OFF) endif() if (NOT HDF5_IS_PARALLEL) message(WARNING "For MPI support the Parallel HDF5 library is required.") set(USE_MPI OFF) endif() endif(USE_MPI) if (USE_MPI AND HDF5_IS_PARALLEL) find_package(Boost COMPONENTS mpi system serialization thread REQUIRED) include_directories(${Boost_INCLUDE_DIRS}) add_definitions("-DHAVE_MPI") endif() find_package(GTest) if (NOT GTEST_FOUND) message(WARNING "gtest library not found, some tests will not be run") endif() if (USE_OPENMP) find_package(OpenMP) if(OPENMP_FOUND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") else() message(WARNING "OpenMP NOT found") endif() endif() # CUDA support if (BUILD_CUDA_LIB) find_package(CUDA) if (CUDA_FOUND) message(STATUS "CUDA found (include: ${CUDA_INCLUDE_DIRS}, lib: ${CUDA_LIBRARIES})") include_directories(${CUDA_INCLUDE_DIRS}) else(CUDA_FOUND) message(STATUS "CUDA not found, CUDA library will not be built") set(BUILD_CUDA_LIB OFF) endif(CUDA_FOUND) endif(BUILD_CUDA_LIB) #set the C/C++ include path to the "include" directory include_directories(BEFORE ${PROJECT_SOURCE_DIR}/src/cpp) # require proper c++ #add_definitions( "-Wall -ansi -pedantic" ) # HDF5 uses long long which is not ansi if(CMAKE_C_COMPILER_ID MATCHES "MSVC" OR CMAKE_CXX_COMPILER_ID MATCHES "MSVC") # lots of warnings with cl.exe right now, use /W1 add_definitions("/W1 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /bigobj") else() add_definitions( "-Wall -Wno-unknown-pragmas -Wno-unused-function" ) endif() add_subdirectory( cmake ) add_subdirectory( src ) if (BUILD_EXAMPLES) add_subdirectory( examples ) endif(BUILD_EXAMPLES) if (BUILD_TESTS) add_subdirectory( test ) endif (BUILD_TESTS) if (BUILD_DOC) add_subdirectory( doc ) endif (BUILD_DOC) # CPACK options # RPM find_program(RPM_PROGRAM rpm) if(EXISTS ${RPM_PROGRAM}) list(APPEND CPACK_GENERATOR "RPM") endif(EXISTS ${RPM_PROGRAM}) # DEB find_program(DPKG_PROGRAM dpkg) if(EXISTS ${DPKG_PROGRAM}) list(APPEND CPACK_GENERATOR "DEB") endif(EXISTS ${DPKG_PROGRAM}) # NSIS find_program(NSIS_PROGRAM makensis MakeNSIS) if(EXISTS ${NSIS_PROGRAM}) list(APPEND CPACK_GENERATOR "NSIS") endif(EXISTS ${NSIS_PROGRAM}) # dpkg find_program(PACKAGE_MAKER_PROGRAM PackageMaker HINTS /Developer/Applications/Utilities) if(EXISTS ${PACKAGE_MAKER_PROGRAM}) list(APPEND CPACK_GENERATOR "PackageMaker") endif(EXISTS ${PACKAGE_MAKER_PROGRAM}) set(CPACK_GENERATOR "${CPACK_GENERATOR}") set(CPACK_MONOLITHIC_INSTALL 1) set(CPACK_SET_DESTDIR ON) include(InstallRequiredSystemLibraries) set(CPACK_PACKAGE_CONTACT "Marius Muja") set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) SET(CPACK_PACKAGE_VERSION ${FLANN_VERSION}) SET(CPACK_PACKAGE_VERSION_MAJOR ${FLANN_VERSION_MAJOR}) SET(CPACK_PACKAGE_VERSION_MINOR ${FLANN_VERSION_MINOR}) SET(CPACK_PACKAGE_VERSION_PATCH ${FLANN_VERSION_PATCH}) include(CPack) message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}") message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") message(STATUS "Building C bindings: ${BUILD_C_BINDINGS}") message(STATUS "Building examples: ${BUILD_EXAMPLES}") message(STATUS "Building tests: ${BUILD_TESTS}") message(STATUS "Building documentation: ${BUILD_DOC}") message(STATUS "Building python bindings: ${BUILD_PYTHON_BINDINGS}") message(STATUS "Building matlab bindings: ${BUILD_MATLAB_BINDINGS}") message(STATUS "Building CUDA library: ${BUILD_CUDA_LIB}") message(STATUS "Using OpenMP support: ${USE_OPENMP}") message(STATUS "Using MPI support: ${USE_MPI}") flann-1.9.1+dfsg/COPYING000066400000000000000000000032511275407571100146040ustar00rootroot00000000000000 The BSD License Copyright (c) 2008-2011 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. Copyright (c) 2008-2011 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. Copyright (c) 2015 Google Inc (Jack Rae, jwrae@google.com). All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the "University of British Columbia" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. flann-1.9.1+dfsg/ChangeLog000066400000000000000000000020721275407571100153230ustar00rootroot00000000000000Version 1.6.11 * bug fixes Version 1.6.10 * fixed a radiusSearch bug introduced in 1.6.9 Version 1.6.9 * bug fixes * fixed radius search bug on MSVC compiler * fixed windows linking problems Version 1.6.8 * bug fixes, low dimensional search speedup Version 1.6.7 * bug fixes Version 1.6.6 * misc bug fixes Version 1.6.5 * fix compilation problem on some C++ compilers * fixes in the python bindings Version 1.6.4 * small bug fix Version 1.6.3 * radius search speedup Version 1.6.2 * slight API changes to the C++ bindings, now the main index type is templated * on the distance functor which makes it easier to use custom distances * new kd-tree implementation optimized for low dimensionality data * experimental MPI support for cluster computing Version 1.5 * new C++ templated API * saving/loading of indices to disk * threadsafe search * new distance types (thanks to Radu Bogdan Rusu and Romain Thibaux for the patch) * (api change) autotuned is no longer selected by passing a precision >0, it's used when the algorithm type is set to autotuned flann-1.9.1+dfsg/README.md000066400000000000000000000033631275407571100150340ustar00rootroot00000000000000FLANN - Fast Library for Approximate Nearest Neighbors ====================================================== FLANN is a library for performing fast approximate nearest neighbor searches in high dimensional spaces. It contains a collection of algorithms we found to work best for nearest neighbor search and a system for automatically choosing the best algorithm and optimum parameters depending on the dataset. FLANN is written in C++ and contains bindings for the following languages: C, MATLAB, Python, and Ruby. Documentation ------------- Check FLANN web page [here](http://www.cs.ubc.ca/research/flann). Documentation on how to use the library can be found in the doc/manual.pdf file included in the release archives. More information and experimental results can be found in the following paper: * Marius Muja and David G. Lowe, "Fast Approximate Nearest Neighbors with Automatic Algorithm Configuration", in International Conference on Computer Vision Theory and Applications (VISAPP'09), 2009 [(PDF)](http://people.cs.ubc.ca/~mariusm/uploads/FLANN/flann_visapp09.pdf) [(BibTex)](http://people.cs.ubc.ca/~mariusm/index.php/FLANN/BibTex) Getting FLANN ------------- If you want to try out the latest changes or contribute to FLANN, then it's recommended that you checkout the git source repository: `git clone git://github.com/mariusmuja/flann.git` If you just want to browse the repository, you can do so by going [here](https://github.com/mariusmuja/flann). Conditions of use ----------------- FLANN is distributed under the terms of the [BSD License](https://github.com/mariusmuja/flann/blob/master/COPYING). Bug reporting ------------- Please report bugs or feature requests using [github's issue tracker](http://github.com/mariusmuja/flann/issues). flann-1.9.1+dfsg/bin/000077500000000000000000000000001275407571100143205ustar00rootroot00000000000000flann-1.9.1+dfsg/bin/download_checkmd5.py000077500000000000000000000036351275407571100202560ustar00rootroot00000000000000#!/usr/bin/env python2 import urllib, hashlib, sys, os from optparse import OptionParser class AppURLopener(urllib.FancyURLopener): version ="Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7" def prompt_user_passwd(self, host, realm): raise Exception() urllib._urlopener = AppURLopener() def file_md5(file): m = hashlib.md5() m.update(open(dest).read()) return m.hexdigest() def main(): parser = OptionParser(usage="usage: %prog URI dest [md5sum]", prog=sys.argv[0]) options, args = parser.parse_args() md5sum = None if len(args)==2: uri, dest = args elif len(args)==3: uri, dest, md5 = args else: parser.error("Wrong arguments") fresh = False if not os.path.exists(dest): print "Downloading from %s to %s..."%(uri, dest), sys.stdout.flush() urllib.urlretrieve(uri, dest) print "done" fresh = True if md5sum: print "Computing md5sum on downloaded file", sys.stdout.flush() checksum = md5_file(dest) print "done" if checksum!=md5sum: if not fresh: print "Checksum mismatch (%s != %s), re-downloading file %s"%(checksum, md5sum, dest), sys.stdout.flush() os.remove(dest) urllib.urlretrieve(uri, dest) print "done" print "Computing md5sum on downloaded file", sys.stdout.flush() checksum = md5_file(dest) print "done" if checksum!=md5sum: print "ERROR, checksum mismatch (%s != %s) on %d",(checksum, md5sum, dest) return 1 return 0 if __name__ == '__main__': try: sys.exit(main()) except Exception as e: print "ERROR, ",e sys.exit(1) flann-1.9.1+dfsg/bin/indent.sh000077500000000000000000000001231275407571100161340ustar00rootroot00000000000000#!/bin/bash DIR=`dirname $0` uncrustify --no-backup -c ${DIR}/uncrustify.cfg $1 flann-1.9.1+dfsg/bin/make_release.sh000077500000000000000000000003571275407571100173010ustar00rootroot00000000000000#!/bin/bash VERSION=`grep "set(FLANN_VERSION" CMakeLists.txt | sed 's/[^0-9]*\([0-9]*\.[0-9]*\.[0-9]*\)[^0-9]*/\1/'` echo "Creating flann-$VERSION-src.zip" git archive --prefix=flann-$VERSION-src/ -o flann-$VERSION-src.zip $VERSION-src flann-1.9.1+dfsg/bin/run_test.py000077500000000000000000000006011275407571100165350ustar00rootroot00000000000000#!/usr/bin/env python2 import sys import os.path as op import unittest if __name__ == "__main__": if len(sys.argv)==1: print "Usage: %s file"%sys.argv[0] sys.exit(1) python_path = op.abspath(op.join( op.dirname(__file__),"..","src","python")) sys.path.append(python_path) test_file = sys.argv[1] sys.argv = sys.argv[1:] execfile(test_file) flann-1.9.1+dfsg/bin/uncrustify.cfg000066400000000000000000000062631275407571100172230ustar00rootroot00000000000000indent_align_string=false indent_braces=false indent_braces_no_func=false indent_brace_parent=false indent_namespace=false indent_extern=false indent_class=true indent_class_colon=false indent_else_if=false indent_func_call_param=false indent_func_def_param=false indent_func_proto_param=false indent_func_class_param=false indent_func_ctor_var_param=false indent_template_param=false indent_func_param_double=false indent_relative_single_line_comments=true indent_col1_comment=true indent_access_spec_body=false indent_paren_nl=false indent_comma_paren=false indent_bool_paren=false indent_square_nl=false indent_preserve_sql=false indent_align_assign=true sp_balance_nested_parens=false align_keep_tabs=false align_with_tabs=false align_on_tabstop=false align_number_left=false align_func_params=false align_same_func_call_params=false align_var_def_colon=false align_var_def_attribute=false align_var_def_inline=false align_right_cmt_mix=false align_on_operator=false align_mix_var_proto=false align_single_line_func=false align_single_line_brace=false align_nl_cont=false align_left_shift=true nl_collapse_empty_body=false nl_assign_leave_one_liners=true nl_class_leave_one_liners=true nl_enum_leave_one_liners=true nl_getset_leave_one_liners=true nl_func_leave_one_liners=true nl_if_leave_one_liners=true nl_multi_line_cond=false nl_multi_line_define=false nl_before_case=false nl_after_case=false nl_after_return=false nl_after_semicolon=false nl_after_brace_open=false nl_after_brace_open_cmt=false nl_after_vbrace_open=false nl_after_brace_close=false nl_define_macro=false nl_squeeze_ifdef=false nl_ds_struct_enum_cmt=false nl_ds_struct_enum_close_brace=false nl_create_if_one_liner=true nl_create_for_one_liner=true nl_create_while_one_liner=true ls_for_split_full=false ls_func_split_full=false nl_after_multiline_comment=false eat_blanks_after_open_brace=false eat_blanks_before_close_brace=false mod_pawn_semicolon=false mod_full_paren_if_bool=true mod_remove_extra_semicolon=true mod_sort_import=false mod_sort_using=false mod_sort_include=false mod_move_case_break=false mod_remove_empty_return=false cmt_indent_multi=true cmt_c_group=false cmt_c_nl_start=false cmt_c_nl_end=false cmt_cpp_group=false cmt_cpp_nl_start=false cmt_cpp_nl_end=false cmt_cpp_to_c=false cmt_star_cont=false cmt_multi_check_last=true cmt_insert_before_preproc=false pp_indent_at_level=false pp_region_indent_code=false pp_if_indent_code=false pp_define_at_level=false input_tab_size=4 indent_columns=4 indent_with_tabs=0 sp_before_ptr_star=remove sp_between_ptr_star=remove sp_after_ptr_star=add sp_before_byref=remove sp_after_byref=add sp_after_type=ignore sp_else_brace=add sp_catch_brace=add sp_finally_brace=add sp_try_brace=add nl_end_of_file=add nl_fcall_brace=remove nl_enum_brace=add nl_struct_brace=add nl_union_brace=remove nl_if_brace=remove nl_brace_else=add nl_else_brace=remove nl_else_if=remove nl_brace_finally=add nl_finally_brace=remove nl_try_brace=remove nl_for_brace=remove nl_catch_brace=remove nl_brace_catch=add nl_while_brace=remove nl_do_brace=remove nl_brace_while=remove nl_switch_brace=remove nl_namespace_brace=add nl_template_class=add nl_class_brace=add nl_fdef_brace=add mod_full_brace_function=add mod_paren_on_return=remove flann-1.9.1+dfsg/cmake/000077500000000000000000000000001275407571100146305ustar00rootroot00000000000000flann-1.9.1+dfsg/cmake/CMakeLists.txt000066400000000000000000000004231275407571100173670ustar00rootroot00000000000000set(PKG_DESC "Fast Library for Approximate Nearest Neighbors") set(pkg_conf_file ${CMAKE_CURRENT_BINARY_DIR}/flann.pc) configure_file(flann.pc.in ${pkg_conf_file} @ONLY) install(FILES ${pkg_conf_file} DESTINATION ${FLANN_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT pkgconfig) flann-1.9.1+dfsg/cmake/FindFlann.cmake000066400000000000000000000016141275407571100174730ustar00rootroot00000000000000############################################################################### # Find Flann # # This sets the following variables: # FLANN_FOUND - True if FLANN was found. # FLANN_INCLUDE_DIRS - Directories containing the FLANN include files. # FLANN_LIBRARIES - Libraries needed to use FLANN. # FLANN_DEFINITIONS - Compiler flags for FLANN. find_package(PkgConfig) pkg_check_modules(PC_FLANN flann) set(FLANN_DEFINITIONS ${PC_FLANN_CFLAGS_OTHER}) find_path(FLANN_INCLUDE_DIR flann/flann.hpp HINTS ${PC_FLANN_INCLUDEDIR} ${PC_FLANN_INCLUDE_DIRS}) find_library(FLANN_LIBRARY flann HINTS ${PC_FLANN_LIBDIR} ${PC_FLANN_LIBRARY_DIRS}) set(FLANN_INCLUDE_DIRS ${FLANN_INCLUDE_DIR}) set(FLANN_LIBRARIES ${FLANN_LIBRARY}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Flann DEFAULT_MSG FLANN_LIBRARY FLANN_INCLUDE_DIR) mark_as_advanced(FLANN_LIBRARY FLANN_INCLUDE_DIR) flann-1.9.1+dfsg/cmake/UseLATEX.cmake000066400000000000000000001010621275407571100171640ustar00rootroot00000000000000# File: UseLATEX.cmake # CMAKE commands to actually use the LaTeX compiler # Version: 1.7.3 # Author: Kenneth Moreland (kmorel at sandia dot gov) # # Copyright 2004 Sandia Corporation. # Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive # license for use of this work by or on behalf of the # U.S. Government. Redistribution and use in source and binary forms, with # or without modification, are permitted provided that this Notice and any # statement of authorship are reproduced on all copies. # # The following MACROS are defined: # # ADD_LATEX_DOCUMENT( # [BIBFILES ] # [INPUTS ] # [IMAGE_DIRS] # [IMAGES] # [CONFIGURE] # [DEPENDS] # [USE_INDEX] [USE_GLOSSARY] # [DEFAULT_PDF] [MANGLE_TARGET_NAMES]) # Adds targets that compile . The latex output is placed # in LATEX_OUTPUT_PATH or CMAKE_CURRENT_BINARY_DIR if the former is # not set. The latex program is picky about where files are located, # so all input files are copied from the source directory to the # output directory. This includes the target tex file, any tex file # listed with the INPUTS option, the bibliography files listed with # the BIBFILES option, and any .cls, .bst, and .clo files found in # the current source directory. Images found in the IMAGE_DIRS # directories or listed by IMAGES are also copied to the output # directory and coverted to an appropriate format if necessary. Any # tex files also listed with the CONFIGURE option are also processed # with the CMake CONFIGURE_FILE command (with the @ONLY flag. Any # file listed in CONFIGURE but not the target tex file or listed with # INPUTS has no effect. DEPENDS can be used to specify generated files # that are needed to compile the latex target. # # The following targets are made: # dvi: Makes .dvi # pdf: Makes .pdf using pdflatex. # safepdf: Makes .pdf using ps2pdf. If using the default # program arguments, this will ensure all fonts are # embedded and no lossy compression has been performed # on images. # ps: Makes .ps # html: Makes .html # auxclean: Deletes .aux. This is sometimes necessary # if a LaTeX error occurs and writes a bad aux file. # # The dvi target is added to the ALL. That is, it will be the target # built by default. If the DEFAULT_PDF argument is given, then the # pdf target will be the default instead of dvi. # # If the argument MANGLE_TARGET_NAMES is given, then each of the # target names above will be mangled with the name. This # is to make the targets unique if ADD_LATEX_DOCUMENT is called for # multiple documents. If the argument USE_INDEX is given, then # commands to build an index are made. If the argument USE_GLOSSARY # is given, then commands to build a glossary are made. # # History: # # 1.7.3 Fix some issues with interactions between makeglossaries and bibtex # (thanks to Mark de Wever). # # 1.7.2 Use ps2pdf to convert eps to pdf to get around the problem with # ImageMagick dropping the bounding box (thanks to Lukasz Lis). # # 1.7.1 Fixed some dependency issues. # # 1.7.0 Added DEPENDS options (thanks to Theodore Papadopoulo). # # 1.6.1 Ported the makeglossaries command to CMake and embedded the port # into UseLATEX.cmake. # # 1.6.0 Allow the use of the makeglossaries command. Thanks to Oystein # S. Haaland for the patch. # # 1.5.0 Allow any type of file in the INPUTS lists, not just tex file # (suggested by Eric Noulard). As a consequence, the ability to # specify tex files without the .tex extension is removed. The removed # function is of dubious value anyway. # # When copying input files, skip over any file that exists in the # binary directory but does not exist in the source directory with the # assumption that these files were added by some other mechanism. I # find this useful when creating large documents with multiple # chapters that I want to build separately (for speed) as I work on # them. I use the same boilerplate as the starting point for all # and just copy it with different configurations. This was what the # separate ADD_LATEX_DOCUMENT method was supposed to originally be for. # Since its external use is pretty much deprecated, I removed that # documentation. # # 1.4.1 Copy .sty files along with the other class and package files. # # 1.4.0 Added a MANGLE_TARGET_NAMES option that will mangle the target names. # # Fixed problem with copying bib files that became apparent with # CMake 2.4. # # 1.3.0 Added a LATEX_OUTPUT_PATH variable that allows you or the user to # specify where the built latex documents to go. This is especially # handy if you want to do in-source builds. # # Removed the ADD_LATEX_IMAGES macro and absorbed the functionality # into ADD_LATEX_DOCUMENT. The old interface was always kind of # clunky anyway since you had to specify the image directory in both # places. It also made supporting LATEX_OUTPUT_PATH problematic. # # Added support for jpeg files. # # 1.2.0 Changed the configuration options yet again. Removed the NO_CONFIGURE # Replaced it with a CONFIGURE option that lists input files for which # configure should be run. # # The pdf target no longer depends on the dvi target. This allows you # to build latex documents that require pdflatex. Also added an option # to make the pdf target the default one. # # 1.1.1 Added the NO_CONFIGURE option. The @ character can be used when # specifying table column separators. If two or more are used, then # will incorrectly substitute them. # # 1.1.0 Added ability include multiple bib files. Added ability to do copy # sub-tex files for multipart tex files. # # 1.0.0 If both ps and pdf type images exist, just copy the one that # matches the current render mode. Replaced a bunch of STRING # commands with GET_FILENAME_COMPONENT commands that were made to do # the desired function. # # 0.4.0 First version posted to CMake Wiki. # ############################################################################# # Find the location of myself while originally executing. If you do this # inside of a macro, it will recode where the macro was invoked. ############################################################################# SET(LATEX_USE_LATEX_LOCATION ${CMAKE_CURRENT_LIST_FILE} CACHE INTERNAL "Location of UseLATEX.cmake file." FORCE ) ############################################################################# # Generic helper macros ############################################################################# # Helpful list macros. MACRO(LATEX_CAR var) SET(${var} ${ARGV1}) ENDMACRO(LATEX_CAR) MACRO(LATEX_CDR var junk) SET(${var} ${ARGN}) ENDMACRO(LATEX_CDR) MACRO(LATEX_LIST_CONTAINS var value) SET(${var}) FOREACH (value2 ${ARGN}) IF (${value} STREQUAL ${value2}) SET(${var} TRUE) ENDIF (${value} STREQUAL ${value2}) ENDFOREACH (value2) ENDMACRO(LATEX_LIST_CONTAINS) # Parse macro arguments. MACRO(LATEX_PARSE_ARGUMENTS prefix arg_names option_names) SET(DEFAULT_ARGS) FOREACH(arg_name ${arg_names}) SET(${prefix}_${arg_name}) ENDFOREACH(arg_name) FOREACH(option ${option_names}) SET(${prefix}_${option}) ENDFOREACH(option) SET(current_arg_name DEFAULT_ARGS) SET(current_arg_list) FOREACH(arg ${ARGN}) LATEX_LIST_CONTAINS(is_arg_name ${arg} ${arg_names}) IF (is_arg_name) SET(${prefix}_${current_arg_name} ${current_arg_list}) SET(current_arg_name ${arg}) SET(current_arg_list) ELSE (is_arg_name) LATEX_LIST_CONTAINS(is_option ${arg} ${option_names}) IF (is_option) SET(${prefix}_${arg} TRUE) ELSE (is_option) SET(current_arg_list ${current_arg_list} ${arg}) ENDIF (is_option) ENDIF (is_arg_name) ENDFOREACH(arg) SET(${prefix}_${current_arg_name} ${current_arg_list}) ENDMACRO(LATEX_PARSE_ARGUMENTS) # Match the contents of a file to a regular expression. MACRO(LATEX_FILE_MATCH variable filename regexp default) # The FILE STRINGS command would be a bit better, but it's not supported on # older versions of CMake. FILE(READ ${filename} file_contents) STRING(REGEX MATCHALL "${regexp}" ${variable} ${file_contents} ) IF (NOT ${variable}) SET(${variable} "${default}") ENDIF (NOT ${variable}) ENDMACRO(LATEX_FILE_MATCH) ############################################################################# # Macros that perform processing during a LaTeX build. ############################################################################# MACRO(LATEX_MAKEGLOSSARIES) MESSAGE("**************************** In makeglossaries") IF (NOT LATEX_TARGET) MESSAGE(SEND_ERROR "Need to define LATEX_TARGET") ENDIF (NOT LATEX_TARGET) IF (NOT MAKEINDEX_COMPILER) MESSAGE(SEND_ERROR "Need to define MAKEINDEX_COMPILER") ENDIF (NOT MAKEINDEX_COMPILER) SET(aux_file ${LATEX_TARGET}.aux) IF (NOT EXISTS ${aux_file}) MESSAGE(SEND_ERROR "${aux_file} does not exist. Run latex on your target file.") ENDIF (NOT EXISTS ${aux_file}) LATEX_FILE_MATCH(newglossary_lines ${aux_file} "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}" "@newglossary{main}{glg}{gls}{glo}" ) LATEX_FILE_MATCH(istfile_line ${aux_file} "@istfilename[ \t]*{([^}]*)}" "@istfilename{${LATEX_TARGET}.ist}" ) STRING(REGEX REPLACE "@istfilename[ \t]*{([^}]*)}" "\\1" istfile ${istfile_line} ) FOREACH(newglossary ${newglossary_lines}) STRING(REGEX REPLACE "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}" "\\1" glossary_name ${newglossary} ) STRING(REGEX REPLACE "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}" "${LATEX_TARGET}.\\2" glossary_log ${newglossary} ) STRING(REGEX REPLACE "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}" "${LATEX_TARGET}.\\3" glossary_out ${newglossary} ) STRING(REGEX REPLACE "@newglossary[ \t]*{([^}]*)}{([^}]*)}{([^}]*)}{([^}]*)}" "${LATEX_TARGET}.\\4" glossary_in ${newglossary} ) MESSAGE("${MAKEINDEX_COMPILER} ${MAKEGLOSSARIES_COMPILER_FLAGS} -s ${istfile} -t ${glossary_log} -o ${glossary_out} ${glossary_in}") EXEC_PROGRAM(${MAKEINDEX_COMPILER} ARGS ${MAKEGLOSSARIES_COMPILER_FLAGS} -s ${istfile} -t ${glossary_log} -o ${glossary_out} ${glossary_in} ) ENDFOREACH(newglossary) ENDMACRO(LATEX_MAKEGLOSSARIES) ############################################################################# # Helper macros for establishing LaTeX build. ############################################################################# MACRO(LATEX_NEEDIT VAR NAME) IF (NOT ${VAR}) MESSAGE(SEND_ERROR "I need the ${NAME} command.") ENDIF(NOT ${VAR}) ENDMACRO(LATEX_NEEDIT) MACRO(LATEX_WANTIT VAR NAME) IF (NOT ${VAR}) MESSAGE(STATUS "I could not find the ${NAME} command.") ENDIF(NOT ${VAR}) ENDMACRO(LATEX_WANTIT) MACRO(LATEX_SETUP_VARIABLES) SET(LATEX_OUTPUT_PATH "${LATEX_OUTPUT_PATH}" CACHE PATH "If non empty, specifies the location to place LaTeX output." ) FIND_PACKAGE(LATEX) MARK_AS_ADVANCED(CLEAR LATEX_COMPILER PDFLATEX_COMPILER BIBTEX_COMPILER MAKEINDEX_COMPILER DVIPS_CONVERTER PS2PDF_CONVERTER LATEX2HTML_CONVERTER ) LATEX_NEEDIT(LATEX_COMPILER latex) LATEX_WANTIT(PDFLATEX_COMPILER pdflatex) LATEX_NEEDIT(BIBTEX_COMPILER bibtex) LATEX_NEEDIT(MAKEINDEX_COMPILER makeindex) LATEX_WANTIT(DVIPS_CONVERTER dvips) LATEX_WANTIT(PS2PDF_CONVERTER ps2pdf) LATEX_WANTIT(LATEX2HTML_CONVERTER latex2html) SET(LATEX_COMPILER_FLAGS "-interaction=batchmode" CACHE STRING "Flags passed to latex.") SET(PDFLATEX_COMPILER_FLAGS ${LATEX_COMPILER_FLAGS} CACHE STRING "Flags passed to pdflatex.") SET(BIBTEX_COMPILER_FLAGS "" CACHE STRING "Flags passed to bibtex.") SET(MAKEINDEX_COMPILER_FLAGS "" CACHE STRING "Flags passed to makeindex.") SET(MAKEGLOSSARIES_COMPILER_FLAGS "" CACHE STRING "Flags passed to makeglossaries.") SET(DVIPS_CONVERTER_FLAGS "-Ppdf -G0 -t letter" CACHE STRING "Flags passed to dvips.") SET(PS2PDF_CONVERTER_FLAGS "-dMaxSubsetPct=100 -dCompatibilityLevel=1.3 -dSubsetFonts=true -dEmbedAllFonts=true -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -dMonoImageFilter=/FlateEncode" CACHE STRING "Flags passed to ps2pdf.") SET(LATEX2HTML_CONVERTER_FLAGS "" CACHE STRING "Flags passed to latex2html.") MARK_AS_ADVANCED( LATEX_COMPILER_FLAGS PDFLATEX_COMPILER_FLAGS BIBTEX_COMPILER_FLAGS MAKEINDEX_COMPILER_FLAGS MAKEGLOSSARIES_COMPILER_FLAGS DVIPS_CONVERTER_FLAGS PS2PDF_CONVERTER_FLAGS LATEX2HTML_CONVERTER_FLAGS ) SEPARATE_ARGUMENTS(LATEX_COMPILER_FLAGS) SEPARATE_ARGUMENTS(PDFLATEX_COMPILER_FLAGS) SEPARATE_ARGUMENTS(BIBTEX_COMPILER_FLAGS) SEPARATE_ARGUMENTS(MAKEINDEX_COMPILER_FLAGS) SEPARATE_ARGUMENTS(MAKEGLOSSARIES_COMPILER_FLAGS) SEPARATE_ARGUMENTS(DVIPS_CONVERTER_FLAGS) SEPARATE_ARGUMENTS(PS2PDF_CONVERTER_FLAGS) SEPARATE_ARGUMENTS(LATEX2HTML_CONVERTER_FLAGS) FIND_PROGRAM(IMAGEMAGICK_CONVERT convert DOC "The convert program that comes with ImageMagick (available at http://www.imagemagick.org)." ) OPTION(LATEX_SMALL_IMAGES "If on, the raster images will be converted to 1/6 the original size. This is because papers usually require 600 dpi images whereas most monitors only require at most 96 dpi. Thus, smaller images make smaller files for web distributation and can make it faster to read dvi files." OFF) IF (LATEX_SMALL_IMAGES) SET(LATEX_RASTER_SCALE 16) SET(LATEX_OPPOSITE_RASTER_SCALE 100) ELSE (LATEX_SMALL_IMAGES) SET(LATEX_RASTER_SCALE 100) SET(LATEX_OPPOSITE_RASTER_SCALE 16) ENDIF (LATEX_SMALL_IMAGES) # Just holds extensions for known image types. They should all be lower case. SET(LATEX_DVI_VECTOR_IMAGE_EXTENSIONS .eps) SET(LATEX_DVI_RASTER_IMAGE_EXTENSIONS) SET(LATEX_DVI_IMAGE_EXTENSIONS ${LATEX_DVI_VECTOR_IMAGE_EXTENSIONS} ${LATEX_DVI_RASTER_IMAGE_EXTENSIONS}) SET(LATEX_PDF_VECTOR_IMAGE_EXTENSIONS .pdf) SET(LATEX_PDF_RASTER_IMAGE_EXTENSIONS .png .jpeg .jpg) SET(LATEX_PDF_IMAGE_EXTENSIONS ${LATEX_PDF_VECTOR_IMAGE_EXTENSIONS} ${LATEX_PDF_RASTER_IMAGE_EXTENSIONS}) SET(LATEX_IMAGE_EXTENSIONS ${LATEX_DVI_IMAGE_EXTENSIONS} ${LATEX_PDF_IMAGE_EXTENSIONS}) ENDMACRO(LATEX_SETUP_VARIABLES) MACRO(LATEX_GET_OUTPUT_PATH var) SET(${var}) IF (LATEX_OUTPUT_PATH) IF ("${LATEX_OUTPUT_PATH}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") MESSAGE(SEND_ERROR "You cannot set LATEX_OUTPUT_PATH to the same directory that contains LaTeX input files.") ELSE ("${LATEX_OUTPUT_PATH}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") SET(${var} "${LATEX_OUTPUT_PATH}") ENDIF ("${LATEX_OUTPUT_PATH}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") ELSE (LATEX_OUTPUT_PATH) IF ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") MESSAGE(SEND_ERROR "LaTeX files must be built out of source or you must set LATEX_OUTPUT_PATH.") ELSE ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") SET(${var} "${CMAKE_CURRENT_BINARY_DIR}") ENDIF ("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") ENDIF (LATEX_OUTPUT_PATH) ENDMACRO(LATEX_GET_OUTPUT_PATH) MACRO(LATEX_ADD_CONVERT_COMMAND output_path input_path output_extension input_extension flags) SET (converter ${IMAGEMAGICK_CONVERT}) SET (convert_flags "") # ImageMagick has broken eps to pdf conversion # use ps2pdf instead IF (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf") IF (PS2PDF_CONVERTER) SET (converter ${PS2PDF_CONVERTER}) SET (convert_flags "-dEPSCrop ${flags}") ELSE (PS2PDF_CONVERTER) MESSAGE(SEND_ERROR "Using postscript files with pdflatex requires ps2pdf for conversion.") ENDIF (PS2PDF_CONVERTER) ELSE (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf") SET (convert_flags ${flags}) ENDIF (${input_extension} STREQUAL ".eps" AND ${output_extension} STREQUAL ".pdf") ADD_CUSTOM_COMMAND(OUTPUT ${output_path} COMMAND ${converter} ARGS ${convert_flags} ${input_path} ${output_path} DEPENDS ${input_path} ) ENDMACRO(LATEX_ADD_CONVERT_COMMAND) # Makes custom commands to convert a file to a particular type. MACRO(LATEX_CONVERT_IMAGE output_files input_file output_extension convert_flags output_extensions other_files) SET(input_dir ${CMAKE_CURRENT_SOURCE_DIR}) LATEX_GET_OUTPUT_PATH(output_dir) GET_FILENAME_COMPONENT(extension "${input_file}" EXT) STRING(REGEX REPLACE "\\.[^.]*\$" ${output_extension} output_file "${input_file}") LATEX_LIST_CONTAINS(is_type ${extension} ${output_extensions}) IF (is_type) IF (convert_flags) LATEX_ADD_CONVERT_COMMAND(${output_dir}/${output_file} ${input_dir}/${input_file} ${output_extension} ${extension} "${convert_flags}") SET(${output_files} ${${output_files}} ${output_dir}/${output_file}) ELSE (convert_flags) # As a shortcut, we can just copy the file. ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${input_file} COMMAND ${CMAKE_COMMAND} ARGS -E copy ${input_dir}/${input_file} ${output_dir}/${input_file} DEPENDS ${input_dir}/${input_file} ) SET(${output_files} ${${output_files}} ${output_dir}/${input_file}) ENDIF (convert_flags) ELSE (is_type) SET(do_convert TRUE) # Check to see if there is another input file of the appropriate type. FOREACH(valid_extension ${output_extensions}) STRING(REGEX REPLACE "\\.[^.]*\$" ${output_extension} try_file "${input_file}") LATEX_LIST_CONTAINS(has_native_file "${try_file}" ${other_files}) IF (has_native_file) SET(do_convert FALSE) ENDIF (has_native_file) ENDFOREACH(valid_extension) # If we still need to convert, do it. IF (do_convert) LATEX_ADD_CONVERT_COMMAND(${output_dir}/${output_file} ${input_dir}/${input_file} ${output_extension} ${extension} "${convert_flags}") SET(${output_files} ${${output_files}} ${output_dir}/${output_file}) ENDIF (do_convert) ENDIF (is_type) ENDMACRO(LATEX_CONVERT_IMAGE) # Adds custom commands to process the given files for dvi and pdf builds. # Adds the output files to the given variables (does not replace). MACRO(LATEX_PROCESS_IMAGES dvi_outputs pdf_outputs) LATEX_GET_OUTPUT_PATH(output_dir) FOREACH(file ${ARGN}) IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${file}") GET_FILENAME_COMPONENT(extension "${file}" EXT) SET(convert_flags) # Check to see if we need to downsample the image. LATEX_LIST_CONTAINS(is_raster extension ${LATEX_DVI_RASTER_IMAGE_EXTENSIONS} ${LATEX_PDF_RASTER_IMAGE_EXTENSIONS}) IF (LATEX_SMALL_IMAGES) IF (is_raster) SET(convert_flags -resize ${LATEX_RASTER_SCALE}%) ENDIF (is_raster) ENDIF (LATEX_SMALL_IMAGES) # Make sure the output directory exists. GET_FILENAME_COMPONENT(path "${output_dir}/${file}" PATH) MAKE_DIRECTORY("${path}") # Do conversions for dvi. LATEX_CONVERT_IMAGE(${dvi_outputs} "${file}" .eps "${convert_flags}" "${LATEX_DVI_IMAGE_EXTENSIONS}" "${ARGN}") # Do conversions for pdf. IF (is_raster) LATEX_CONVERT_IMAGE(${pdf_outputs} "${file}" .png "${convert_flags}" "${LATEX_PDF_IMAGE_EXTENSIONS}" "${ARGN}") ELSE (is_raster) LATEX_CONVERT_IMAGE(${pdf_outputs} "${file}" .pdf "${convert_flags}" "${LATEX_PDF_IMAGE_EXTENSIONS}" "${ARGN}") ENDIF (is_raster) ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${file}") MESSAGE("Could not find file \"${CMAKE_CURRENT_SOURCE_DIR}/${file}\"") ENDIF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${file}") ENDFOREACH(file) ENDMACRO(LATEX_PROCESS_IMAGES) MACRO(ADD_LATEX_IMAGES) MESSAGE("The ADD_LATEX_IMAGES macro is deprecated. Image directories are specified with LATEX_ADD_DOCUMENT.") ENDMACRO(ADD_LATEX_IMAGES) MACRO(LATEX_COPY_GLOBBED_FILES pattern dest) FILE(GLOB file_list ${pattern}) FOREACH(in_file ${file_list}) GET_FILENAME_COMPONENT(out_file ${in_file} NAME) CONFIGURE_FILE(${in_file} ${dest}/${out_file} COPYONLY) ENDFOREACH(in_file) ENDMACRO(LATEX_COPY_GLOBBED_FILES) MACRO(LATEX_COPY_INPUT_FILE file) LATEX_GET_OUTPUT_PATH(output_dir) IF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}) GET_FILENAME_COMPONENT(path ${file} PATH) FILE(MAKE_DIRECTORY ${output_dir}/${path}) LATEX_LIST_CONTAINS(use_config ${file} ${LATEX_CONFIGURE}) IF (use_config) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file} ${output_dir}/${file} @ONLY ) ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${file} COMMAND ${CMAKE_COMMAND} ARGS ${CMAKE_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} ) ELSE (use_config) ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${file} COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${file} ${output_dir}/${file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file} ) ENDIF (use_config) ELSE (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}) IF (EXISTS ${output_dir}/${file}) # Special case: output exists but input does not. Assume that it was # created elsewhere and skip the input file copy. ELSE (EXISTS ${output_dir}/${file}) MESSAGE("Could not find input file ${CMAKE_CURRENT_SOURCE_DIR}/${file}") ENDIF (EXISTS ${output_dir}/${file}) ENDIF (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}) ENDMACRO(LATEX_COPY_INPUT_FILE) ############################################################################# # Commands provided by the UseLATEX.cmake "package" ############################################################################# MACRO(LATEX_USAGE command message) MESSAGE(SEND_ERROR "${message}\nUsage: ${command}(\n [BIBFILES ...]\n [INPUTS ...]\n [IMAGE_DIRS ...]\n [IMAGES \n [CONFIGURE ...]\n [DEPENDS ...]\n [USE_INDEX] [USE_GLOSSARY] [DEFAULT_PDF] [MANGLE_TARGET_NAMES])" ) ENDMACRO(LATEX_USAGE command message) # Parses arguments to ADD_LATEX_DOCUMENT and ADD_LATEX_TARGETS and sets the # variables LATEX_TARGET, LATEX_IMAGE_DIR, LATEX_BIBFILES, LATEX_DEPENDS, and # LATEX_INPUTS. MACRO(PARSE_ADD_LATEX_ARGUMENTS command) LATEX_PARSE_ARGUMENTS( LATEX "BIBFILES;INPUTS;IMAGE_DIRS;IMAGES;CONFIGURE;DEPENDS" "USE_INDEX;USE_GLOSSARY;USE_GLOSSARIES;DEFAULT_PDF;MANGLE_TARGET_NAMES" ${ARGN} ) # The first argument is the target latex file. IF (LATEX_DEFAULT_ARGS) LATEX_CAR(LATEX_MAIN_INPUT ${LATEX_DEFAULT_ARGS}) LATEX_CDR(LATEX_DEFAULT_ARGS ${LATEX_DEFAULT_ARGS}) GET_FILENAME_COMPONENT(LATEX_TARGET ${LATEX_MAIN_INPUT} NAME_WE) ELSE (LATEX_DEFAULT_ARGS) LATEX_USAGE(${command} "No tex file target given to ${command}.") ENDIF (LATEX_DEFAULT_ARGS) IF (LATEX_DEFAULT_ARGS) LATEX_USAGE(${command} "Invalid or depricated arguments: ${LATEX_DEFAULT_ARGS}") ENDIF (LATEX_DEFAULT_ARGS) # Backward compatibility between 1.6.0 and 1.6.1. IF (LATEX_USE_GLOSSARIES) SET(LATEX_USE_GLOSSARY TRUE) ENDIF (LATEX_USE_GLOSSARIES) ENDMACRO(PARSE_ADD_LATEX_ARGUMENTS) MACRO(ADD_LATEX_TARGETS) LATEX_GET_OUTPUT_PATH(output_dir) PARSE_ADD_LATEX_ARGUMENTS(ADD_LATEX_TARGETS ${ARGV}) # Set up target names. IF (LATEX_MANGLE_TARGET_NAMES) SET(dvi_target ${LATEX_TARGET}_dvi) SET(pdf_target ${LATEX_TARGET}_pdf) SET(ps_target ${LATEX_TARGET}_ps) SET(safepdf_target ${LATEX_TARGET}_safepdf) SET(html_target ${LATEX_TARGET}_html) SET(auxclean_target ${LATEX_TARGET}_auxclean) ELSE (LATEX_MANGLE_TARGET_NAMES) SET(dvi_target dvi) SET(pdf_target pdf) SET(ps_target ps) SET(safepdf_target safepdf) SET(html_target html) SET(auxclean_target auxclean) ENDIF (LATEX_MANGLE_TARGET_NAMES) # For each directory in LATEX_IMAGE_DIRS, glob all the image files and # place them in LATEX_IMAGES. FOREACH(dir ${LATEX_IMAGE_DIRS}) FOREACH(extension ${LATEX_IMAGE_EXTENSIONS}) FILE(GLOB files ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/*${extension}) FOREACH(file ${files}) GET_FILENAME_COMPONENT(filename ${file} NAME) SET(LATEX_IMAGES ${LATEX_IMAGES} ${dir}/${filename}) ENDFOREACH(file) ENDFOREACH(extension) ENDFOREACH(dir) SET(dvi_images) SET(pdf_images) LATEX_PROCESS_IMAGES(dvi_images pdf_images ${LATEX_IMAGES}) SET(make_dvi_command ${CMAKE_COMMAND} -E chdir ${output_dir} ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}) SET(make_pdf_command ${CMAKE_COMMAND} -E chdir ${output_dir} ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}) SET(make_dvi_depends ${LATEX_DEPENDS} ${dvi_images}) SET(make_pdf_depends ${LATEX_DEPENDS} ${pdf_images}) FOREACH(input ${LATEX_MAIN_INPUT} ${LATEX_INPUTS}) SET(make_dvi_depends ${make_dvi_depends} ${output_dir}/${input}) SET(make_pdf_depends ${make_pdf_depends} ${output_dir}/${input}) ENDFOREACH(input) IF (LATEX_USE_GLOSSARY) FOREACH(dummy 0 1) # Repeat these commands twice. SET(make_dvi_command ${make_dvi_command} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${CMAKE_COMMAND} -D LATEX_BUILD_COMMAND=makeglossaries -D LATEX_TARGET=${LATEX_TARGET} -D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER} -D MAKEGLOSSARIES_COMPILER_FLAGS=${MAKEGLOSSARIES_COMPILER_FLAGS} -P ${LATEX_USE_LATEX_LOCATION} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT} ) SET(make_pdf_command ${make_pdf_command} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${CMAKE_COMMAND} -D LATEX_BUILD_COMMAND=makeglossaries -D LATEX_TARGET=${LATEX_TARGET} -D MAKEINDEX_COMPILER=${MAKEINDEX_COMPILER} -D MAKEGLOSSARIES_COMPILER_FLAGS=${MAKEGLOSSARIES_COMPILER_FLAGS} -P ${LATEX_USE_LATEX_LOCATION} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT} ) ENDFOREACH(dummy) ENDIF (LATEX_USE_GLOSSARY) IF (LATEX_BIBFILES) SET(make_dvi_command ${make_dvi_command} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${BIBTEX_COMPILER} ${BIBTEX_COMPILER_FLAGS} ${LATEX_TARGET}) SET(make_pdf_command ${make_pdf_command} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${BIBTEX_COMPILER} ${BIBTEX_COMPILER_FLAGS} ${LATEX_TARGET}) FOREACH (bibfile ${LATEX_BIBFILES}) SET(make_dvi_depends ${make_dvi_depends} ${output_dir}/${bibfile}) SET(make_pdf_depends ${make_pdf_depends} ${output_dir}/${bibfile}) ENDFOREACH (bibfile ${LATEX_BIBFILES}) ENDIF (LATEX_BIBFILES) IF (LATEX_USE_INDEX) SET(make_dvi_command ${make_dvi_command} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${MAKEINDEX_COMPILER} ${MAKEINDEX_COMPILER_FLAGS} ${LATEX_TARGET}.idx) SET(make_pdf_command ${make_pdf_command} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${MAKEINDEX_COMPILER} ${MAKEINDEX_COMPILER_FLAGS} ${LATEX_TARGET}.idx) ENDIF (LATEX_USE_INDEX) SET(make_dvi_command ${make_dvi_command} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${LATEX_COMPILER} ${LATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}) SET(make_pdf_command ${make_pdf_command} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT} COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${PDFLATEX_COMPILER} ${PDFLATEX_COMPILER_FLAGS} ${LATEX_MAIN_INPUT}) # Add commands and targets for building dvi outputs. ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.dvi COMMAND ${make_dvi_command} DEPENDS ${make_dvi_depends} ) IF (LATEX_DEFAULT_PDF) ADD_CUSTOM_TARGET(${dvi_target} DEPENDS ${output_dir}/${LATEX_TARGET}.dvi) ELSE (LATEX_DEFAULT_PDF) ADD_CUSTOM_TARGET(${dvi_target} DEPENDS ${output_dir}/${LATEX_TARGET}.dvi) ENDIF (LATEX_DEFAULT_PDF) # Add commands and targets for building pdf outputs (with pdflatex). IF (PDFLATEX_COMPILER) ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.pdf COMMAND ${make_pdf_command} DEPENDS ${make_pdf_depends} ) IF (LATEX_DEFAULT_PDF) ADD_CUSTOM_TARGET(${pdf_target} DEPENDS ${output_dir}/${LATEX_TARGET}.pdf) ELSE (LATEX_DEFAULT_PDF) ADD_CUSTOM_TARGET(${pdf_target} DEPENDS ${output_dir}/${LATEX_TARGET}.pdf) ENDIF (LATEX_DEFAULT_PDF) ENDIF (PDFLATEX_COMPILER) IF (DVIPS_CONVERTER) ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${LATEX_TARGET}.ps COMMAND ${CMAKE_COMMAND} -E chdir ${output_dir} ${DVIPS_CONVERTER} ${DVIPS_CONVERTER_FLAGS} -o ${LATEX_TARGET}.ps ${LATEX_TARGET}.dvi DEPENDS ${output_dir}/${LATEX_TARGET}.dvi) ADD_CUSTOM_TARGET(${ps_target} DEPENDS ${output_dir}/${LATEX_TARGET}.ps) IF (PS2PDF_CONVERTER) # Since both the pdf and safepdf targets have the same output, we # cannot properly do the dependencies for both. When selecting safepdf, # simply force a recompile every time. ADD_CUSTOM_TARGET(${safepdf_target} ${CMAKE_COMMAND} -E chdir ${output_dir} ${PS2PDF_CONVERTER} ${PS2PDF_CONVERTER_FLAGS} ${LATEX_TARGET}.ps ${LATEX_TARGET}.pdf ) ADD_DEPENDENCIES(${safepdf_target} ${ps_target}) ENDIF (PS2PDF_CONVERTER) ENDIF (DVIPS_CONVERTER) IF (LATEX2HTML_CONVERTER) ADD_CUSTOM_TARGET(${html_target} ${CMAKE_COMMAND} -E chdir ${output_dir} ${LATEX2HTML_CONVERTER} ${LATEX2HTML_CONVERTER_FLAGS} ${LATEX_MAIN_INPUT} ) ADD_DEPENDENCIES(${html_target} ${LATEX_MAIN_INPUT} ${LATEX_INPUTS}) ENDIF (LATEX2HTML_CONVERTER) ADD_CUSTOM_TARGET(${auxclean_target} ${CMAKE_COMMAND} -E remove ${output_dir}/${LATEX_TARGET}.aux ${output_dir}/${LATEX_TARGET}.idx ${output_dir}/${LATEX_TARGET}.ind ) ENDMACRO(ADD_LATEX_TARGETS) MACRO(ADD_LATEX_DOCUMENT) LATEX_GET_OUTPUT_PATH(output_dir) IF (output_dir) PARSE_ADD_LATEX_ARGUMENTS(ADD_LATEX_DOCUMENT ${ARGV}) LATEX_COPY_INPUT_FILE(${LATEX_MAIN_INPUT}) FOREACH (bib_file ${LATEX_BIBFILES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${bib_file} ${output_dir}/${bib_file} COPYONLY) ADD_CUSTOM_COMMAND(OUTPUT ${output_dir}/${bib_file} COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${bib_file} ${output_dir}/${bib_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${bib_file} ) ENDFOREACH (bib_file) FOREACH (input ${LATEX_INPUTS}) LATEX_COPY_INPUT_FILE(${input}) ENDFOREACH(input) LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.cls ${output_dir}) LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.bst ${output_dir}) LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.clo ${output_dir}) LATEX_COPY_GLOBBED_FILES(${CMAKE_CURRENT_SOURCE_DIR}/*.sty ${output_dir}) ADD_LATEX_TARGETS(${ARGV}) ENDIF (output_dir) ENDMACRO(ADD_LATEX_DOCUMENT) ############################################################################# # Actually do stuff ############################################################################# IF (LATEX_BUILD_COMMAND) SET(command_handled) IF ("${LATEX_BUILD_COMMAND}" STREQUAL makeglossaries) LATEX_MAKEGLOSSARIES() SET(command_handled TRUE) ENDIF ("${LATEX_BUILD_COMMAND}" STREQUAL makeglossaries) IF (NOT command_handled) MESSAGE(SEND_ERROR "Unknown command: ${LATEX_BUILD_COMMAND}") ENDIF (NOT command_handled) ELSE (LATEX_BUILD_COMMAND) # Must be part of the actual configure (included from CMakeLists.txt). LATEX_SETUP_VARIABLES() ENDIF (LATEX_BUILD_COMMAND) flann-1.9.1+dfsg/cmake/flann.pc.in000066400000000000000000000005241275407571100166600ustar00rootroot00000000000000# This file was generated by CMake for @PROJECT_NAME@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=${prefix}/@FLANN_LIB_INSTALL_DIR@ includedir=${prefix}/include Name: @PROJECT_NAME@ Description: @PKG_DESC@ Version: @FLANN_VERSION@ Requires: @PKG_EXTERNAL_DEPS@ Libs: -L${libdir} -lflann -lflann_cpp Cflags: -I${includedir} flann-1.9.1+dfsg/cmake/flann_utils.cmake000066400000000000000000000103461275407571100201540ustar00rootroot00000000000000macro(GET_OS_INFO) string(REGEX MATCH "Linux" OS_IS_LINUX ${CMAKE_SYSTEM_NAME}) set(FLANN_LIB_INSTALL_DIR "lib${LIB_SUFFIX}") set(FLANN_INCLUDE_INSTALL_DIR "include/${PROJECT_NAME_LOWER}-${FLANN_MAJOR_VERSION}.${FLANN_MINOR_VERSION}") endmacro(GET_OS_INFO) macro(DISSECT_VERSION) # Find version components string(REGEX REPLACE "^([0-9]+).*" "\\1" FLANN_VERSION_MAJOR "${FLANN_VERSION}") string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" FLANN_VERSION_MINOR "${FLANN_VERSION}") string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" FLANN_VERSION_PATCH ${FLANN_VERSION}) string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" FLANN_VERSION_CANDIDATE ${FLANN_VERSION}) set(FLANN_SOVERSION "${FLANN_VERSION_MAJOR}.${FLANN_VERSION_MINOR}") endmacro(DISSECT_VERSION) # workaround a FindHDF5 bug macro(find_hdf5) find_package(HDF5) set( HDF5_IS_PARALLEL FALSE ) foreach( _dir ${HDF5_INCLUDE_DIRS} ) if( EXISTS "${_dir}/H5pubconf.h" ) file( STRINGS "${_dir}/H5pubconf.h" HDF5_HAVE_PARALLEL_DEFINE REGEX "HAVE_PARALLEL 1" ) if( HDF5_HAVE_PARALLEL_DEFINE ) set( HDF5_IS_PARALLEL TRUE ) endif() endif() endforeach() set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL "HDF5 library compiled with parallel IO support" ) mark_as_advanced( HDF5_IS_PARALLEL ) endmacro(find_hdf5) macro(flann_add_gtest exe) # add build target add_executable(${exe} EXCLUDE_FROM_ALL ${ARGN}) target_link_libraries(${exe} ${GTEST_LIBRARIES}) # add dependency to 'tests' target add_dependencies(flann_gtests ${exe}) # add target for running test string(REPLACE "/" "_" _testname ${exe}) add_custom_target(test_${_testname} COMMAND ${exe} ARGS --gtest_print_time DEPENDS ${exe} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test VERBATIM COMMENT "Runnint gtest test(s) ${exe}") # add dependency to 'test' target add_dependencies(flann_gtest test_${_testname}) endmacro(flann_add_gtest) macro(flann_add_cuda_gtest exe) # add build target cuda_add_executable(${exe} EXCLUDE_FROM_ALL ${ARGN}) target_link_libraries(${exe} ${GTEST_LIBRARIES}) # add dependency to 'tests' target add_dependencies(tests ${exe}) # add target for running test string(REPLACE "/" "_" _testname ${exe}) add_custom_target(test_${_testname} COMMAND ${exe} ARGS --gtest_print_time DEPENDS ${exe} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test VERBATIM COMMENT "Runnint gtest test(s) ${exe}") # add dependency to 'test' target add_dependencies(test test_${_testname}) endmacro(flann_add_cuda_gtest) macro(flann_add_pyunit file) # find test file set(_file_name _file_name-NOTFOUND) find_file(_file_name ${file} ${CMAKE_CURRENT_SOURCE_DIR}) if(NOT _file_name) message(FATAL_ERROR "Can't find pyunit file \"${file}\"") endif(NOT _file_name) # add target for running test string(REPLACE "/" "_" _testname ${file}) add_custom_target(pyunit_${_testname} COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/bin/run_test.py ${_file_name} DEPENDS ${_file_name} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test VERBATIM COMMENT "Running pyunit test(s) ${file}" ) # add dependency to 'test' target add_dependencies(pyunit_${_testname} flann) add_dependencies(test pyunit_${_testname}) endmacro(flann_add_pyunit) macro(flann_download_test_data _name _md5) string(REPLACE "/" "_" _dataset_name dataset_${_name}) add_custom_target(${_dataset_name} COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/bin/download_checkmd5.py http://people.cs.ubc.ca/~mariusm/uploads/FLANN/datasets/${_name} ${TEST_OUTPUT_PATH}/${_name} ${_md5} VERBATIM) # Also make sure that downloads are done before we run any tests add_dependencies(tests ${_dataset_name}) endmacro(flann_download_test_data) flann-1.9.1+dfsg/cmake/uninstall_target.cmake.in000066400000000000000000000016471275407571100216260ustar00rootroot00000000000000if(NOT EXISTS "@PROJECT_BINARY_DIR@/install_manifest.txt") message(FATAL_ERROR "Cannot find install manifest: \"@PROJECT_BINARY_DIR@/install_manifest.txt\"") endif(NOT EXISTS "@PROJECT_BINARY_DIR@/install_manifest.txt") file(READ "@PROJECT_BINARY_DIR@/install_manifest.txt" files) string(REGEX REPLACE "\n" ";" files "${files}") foreach(file ${files}) message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") if(EXISTS "$ENV{DESTDIR}${file}") exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval) if(NOT "${rm_retval}" STREQUAL 0) message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") endif(NOT "${rm_retval}" STREQUAL 0) else(EXISTS "$ENV{DESTDIR}${file}") message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") endif(EXISTS "$ENV{DESTDIR}${file}") endforeach(file) flann-1.9.1+dfsg/doc/000077500000000000000000000000001275407571100143155ustar00rootroot00000000000000flann-1.9.1+dfsg/doc/CMakeLists.txt000066400000000000000000000012631275407571100170570ustar00rootroot00000000000000find_package(LATEX) if (NOT DOCDIR) set(DOCDIR share/doc/flann) endif () if (EXISTS ${PDFLATEX_COMPILER} AND EXISTS ${BIBTEX_COMPILER}) include(${PROJECT_SOURCE_DIR}/cmake/UseLATEX.cmake) add_latex_document(manual.tex BIBFILES references.bib IMAGE_DIRS images DEFAULT_PDF) add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/manual.pdf COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/manual.pdf ${CMAKE_CURRENT_SOURCE_DIR}/manual.pdf DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/manual.pdf ) add_custom_target(doc DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/manual.pdf) endif() install( FILES manual.pdf DESTINATION ${DOCDIR} OPTIONAL ) flann-1.9.1+dfsg/doc/images/000077500000000000000000000000001275407571100155625ustar00rootroot00000000000000flann-1.9.1+dfsg/doc/images/cmake-gui.png000066400000000000000000000645371275407571100201510ustar00rootroot00000000000000‰PNG  IHDRf;É^ÀôsBITÛáOà pHYsÄÄ•+ IDATxœìÝwœÕ}7þ3wn¿w‹z[´’n`,ÿ Âå!!N‚iæÁ¯B¶‡`Ù!ŽÁNlÀ'Æq~yp¥X`,0%Ø ‰"!$­,*[´ýÖ)ϳ;š™sæL»õó~éu5wæ´™½s¿÷œiÂÑ#GH•‚à¿BˆïR-Š­\Õ8QjðéíÚë!—CÊVaåò…™‘+¯S ÎY=ç ‡ê+3WnV"§¨‹é=d±Ïå­mü¹Ün=Wéùó¥ ªÆÊ¥Ño¢Õª˜L¬¶¯À©ª„Õm8 µ(ýé¸bZ„/vN”ÊÛBþôÆßDbãçÑ>£%—é#lÎeýˆ;æâË•q"»ã~6±þÜ;¤å\µ]™ŸË¯¾ïfçTž#«ßÐ~®I,RÖZQÕ –šj†LMP“L„ÿ3¨¢¼ÅN‡zõ†‘Þôq´„(çði—Ë>#G.s^÷±+”r”ãºIõÀEÓݬf(NÏy½ÅòPÃ^¨ék©/pQµ±¯U?djœdROÑïøX ýWW±ÓE½žÓwá–î@H,»%:wCéyÍÙýw+ÙåX¨>?¨5ÂÓwPÕ;Ù=ç 'ŒyÈRåHli ,5ÑšIâ.ìRHpÑN+@(ÅGi‚aõxb››zõô†¤NY ÿ’Ò; “ß ´yÄ<Ïf|Õ&¯%»–È6ŽÚg·)gb³0’ºîVŽg«¡½ÆÕfÊE&ßeòÈÒ$×ÜÀRÑßPsqo KBŽôÜí °^îÒüî#5)u·V¬XF;LTUµn¯åË—»*Bû§¢úú¨„hE2þâ­4õÄ?u¢u¬¢&×;¹êSO=•Z>% »=–ÜÖ\*-‹žÚû<›Ùêä¶8e7´Ø¶ûEq´Íí?¾Ê¼üóÜ$óÆãÝ ìªMÇ?m]8Úf·€/•u–Ýg•…¾‡Øçgî„6SôôúÖa¶‡Í²N˱”¦ÿõ¼³ýþ¯ÔYShܱcÇŠ+vìØTÅÖò­iìt2iÀvÙ²eÚÌ·Þz‹–oÙ²eúÒÓ* ¢ß9ñiP 9í´ÓÞ~ûm=ݤ·zÕ†"(µ«†ÿ'UAióäOçĺ™rMž´| U»^¢¥evý:z·Ñ&µjXÈQ¶C=ö(§ôøŒåîÑzä·tû\íæ˜äµ4ó2jZo ¹sMZæmå(ùí³¸©ÂMí}nn–&Êhä›ožcªJÞ|s‡–8õÒ ßûVhì2õMé«juüƒ·bÅò;OÄB}š’ƒBvî|K5}ÖÔGÚüÄsÃôø7ET JÙUT½üUð¶Ù´•ãzFK0²»ÅîHù£ Ô #Øgc~8è¥Y §$ô÷¹·ÿMàíWå¾YÜDM/@J³‹ö¼Ù-!Ò}FoMu{̵öŽV’à‚\]K‹Óôð¦¿Õ&Œ3ý°h£mY}þŽ;ÝÖ²bÅò;vêgíÜùÖòåË´W=Dµ™z}ÎxU”ë­]]Ø¥Úœ·ÞÚå¢eú‡FU­g—,]zš6±k—ÞéTõ™„]oïÖ&\œDÜŸ4Þq”œ÷ü[bÖ ö‰ 'õp”DÍÌ{Ò,o½l•ú¦ð9Lb½. ·O~€$þc$_ÆÀÃä‰2ƒû°5a¤Ô±B¦™ˆ%.ç)”zc-VE ÕiL0c¤Ô¦MP}¾mšåË–Ž×·v]O=âŽ7’eKO{k×ÛZ™K—žv"j"èÒÓNÕ¦!͹ ”ê×)ˆR³Ûí!¶ÙY `ïf|1Ïcá¾ë­¦ ¿ž¸Ã”—z}†Fû uöyù2†&ƒ+4w¤Ô±B&;2j…†sõ¯ú.QU5€MÄNw¡ËÀØ7]¶l©ö‰_fèPòÿrwÑ•œœÑuÞ:”´PêО½ÑexãúóÕó·€ÎýЪ¿îk@Åú¯Ä_Œñ·^Â$A¤œÌûu™Auõ¼Õ«lÓ€- (v]ãø­Þõ>u“Æx'<áüŽóÖ•´ÍËŸÝ6 º½9å¯Àˆ¦2‹¥&¯ìU˜“ŽdW²bRÙžh•zŸæB|‚­jŒœTlM†É`‹ª®/2±ªJw“°Õ ´Œ;vì\±âÄÅ*Ú¡MZbÏç:ÛœR4qîµêïºÓ°­ñ”nÕðÅp¿ê¡=ôì\Ý_Ë?k!nׂ¿@Må«+Œ“YÙª]lÇÚÁS]® äoªµW+ë&»©^oÛÙ±=A•9^²Ó÷gUŠª){™Ú±F}Ú;¬Òªà¬×ø§2u=QÓ/M3õdÚ[UUwìØ9éô;Ž ´ÆÿO¸zŸo½µ‹vJѤù†U¶öÃx:s®»’“³ÓJp[ˆ¹4o÷gçø&(ÈE'²ýÍÊ~˸þõj¥>Ê7çôT”ç¾` µs•xÉÁØxÒJ8røpµÛP9Œa[vwÓmiÞ¹¿]¶l©»“r]ÂóRÊñ[”]æ…þË÷×€šþ—šóð@°åe]–Ò@«Mùah™Í)uµrÙÊ`t=«^š^èøÿåŽÿháÖò«pêJò¶pòÞ5éÛŠÙh^H/ÜÊãFn‚ï ¾áËà:+!î3Â… IÈ1’ L„ÚË´¡ ö|Sù;™ˆväÕÃ%ž ž#¨ñBO݉1Þ`#¨­@zAuI)e\2wîrÕ O|G˜p¿ÃŠ6%û›õZˆ»Šê!F†Q`=j®Y·†2~;Qô‰É°ê0Wä«®ÀGe™å‡UKxh•úùª²ohxöü•_±èh®+¼0Œ0²Úz’I-PUUÿš $ØM|æ‚,S/zbjâBCCáA† CEäÄ ®9•Ûs|&Þ¦ÿyKc•?é&ö˜T'ÐÖÒ×÷ÙS~qå´;,à½4ó¬0D¿w¨(„ÂÃ(³a4×±LnU\¨3–`±“ 7» 'ˆª¶““B©]M̪­7¾³¨NÅrìê–ö»Ì|\¥•ò7zèÙ¸Jñý5í½—ì®êãMHñ a’B¦£B©ØKžT¾M%atFíÃ^#š:µÁ> Zæ±"«S”Ò±2yê${iDËóVYpßÅN±6˜Z\´!ä®* 3’!FzƒéVxÅP»¡dÒŽQ¡8j©×òŽ' òµ‡Y-³Ý {Úuù5äÜè0ãGÐ ¾R† GÇñ¢#këá_Àarœ òŒVK74”ÓeíZÕŠXäP‰þ´²@ÛãT)+µÞwì«ÖšÕÆžo7šZ͆MŽŒ¡·ÄÅÂ}¯¿uc@/3P¹ªÒÐ' -°Ñ~‘V.”Ú´d|†m²ÊŸ+KÿÂ÷eµ†6L…CcejDŒ¬„Ì0Q"( ïÖaÔâXcêuĸßMÕoTÛ¶^=|)W>.V²Þj­]“CȬ úÍw¹ ¤Rq”Q¯¥öpÛà çmƒ8Õþmóî[µu+·Ð‰¬™UU±±Öê´ò ®†}—ƒ°á[,h–MSã¬HuÀ!³Æ0ûˆ•h­ö1ËZ9` A«ñÜU‰Uè>Ö„Ìz`팒ï7Ë=ÊZшåö€e=œÔZ¿jÿt\[Õí¼":Ö;„̺Ō£¤"Ç,͵“_õR«Ë#”µ‰]7×ù·y-ŒèbdµQ!d6–ª´:ޝֿ©@4~ž¡!¨…S~&U>éM ýýE‘e¹\.W»!õ!‹‰¢‰DS"d6‚·v½U.—£¢EUUAÀ+^ñÚ0¯ªªÊ²Æ–/[ÖÞÞÎþB(—˪ªÎ˜93•JUæ+¨Þås¹ÞÞ^Ab±;¥pø½îÊ´ B284ôÆëo,^²ÄqG€º688صwÏéï?½­½–F’¤b±´hñbY–eYªdóê—(FEQìêÚ›L$¢QVO½ÌºwðÀeË—/X° NW»-¢\.ÅömÛ*v]¡ øŒYk_ÊK³{Œb=ÈHïØ~WØÛªê¼z´æâ 9•ŒL8š‚S7óÀÚÄ ´éœÈbwnáÂ…ÐÓkóO¼(Íœ‘^£ÃÑ>UeµŠYWx™ì/}ž¥Æ1XŸ•z.ÐmEµPZà<Ä0Û1aΊ¬#¨aðÖB€ºãx>‹q©6mc]jzÝ¿?!dáÂ…„mZ{µb[;Oh­â¯+X™MŒlìc©Ÿ@b[l‘)¤îf°Å¥2¡ãŸr<5Ô4mcœÞ·o_ggç¾}ûLÓš}ûöY éììd×ÎÓZ«hu+¥M3ðlØ {™ZLÕ§]-%ô“kôŒ¶¹Åšæ[Sç8–̨È1¥µ"Ç­áã=ë¹3œ)yÆN¹øÓ0*²-ДÞÔTþ-ÐÀT§‡,Z´H›èÚ·OȢϱ.%“ Ô¦ONFËhLÉHlœ£WAk#­Ó~ïuã³õ­««ëì| ™L’0 Vìp£ÏŠpÂ4¶B¡ðÊÿh -Fårùí·ßþÿ>ñ‰ÜØ(g· 4‚ d²-ÿµyói§Æ¸9{,ªj©XÔB&4¶b±ÀìCª¢éëëkok+ mY‹'===¢awÑqÙº—L&g[Z"‘Hx¬ŠuÝ|V„.&40EQôßÇ‘H$›Í¾¾}ûGÎ9'žH”K¥J6ÁÚ-ÖŽ€ÖˆX<.•¥×·ooŸÒÎ~j¦ð^÷»k„!Ÿ/‹ù)S¦¶µOI$"ý†ÂP§dY. ƒƒÇS©cTiddd_WW±TZ¶|ù¬Y³ !µð¼Ï=vìèÎ;ñø¢Å‹Ù¸@Èl…B¡X,Åb3hdå²”L&‰#¢(ƒƒƒï¾ûîÑ#G‡†+Ö¶ºÖÖÚ>{Îìùóç··£— ÐLE) ÃÃù|¾Úm©éTªµµ5™L²ã%Á±L€‰DÒét*•R˜Ï±]$'%B&@g6Îáá_ q· B&„L.™\2¸ dpÁ“L¢(²,—Ëåj7¤>Äb1QoýCp+ƒÆ000°k×.I–EQE±nsŒW¼â5ÀWUU%IŠŠÑeË–¶··³¿Êå2!ÂŒ™³Òéte¾‚ê].—ëíé‘e™ñ¤LÐýî;•i„dhhè7ÞXrÊ©Ž;ÔµÁÁÁ={vŸñþ÷·¶µÑÒH’T*•/Y"Ë’$É•l^ýŠFEQŒîÝ»'G£¬ž$z™uïÀƒË—¯X°p!~Q4¶\.‹E÷8xƧÓÒ -ì\$I’$I•l[]+—%U%sfÏ9p`ÿ´iÓ)2ë^$"Ìëè`?ã @KKKGÇü÷º»i dYx_6[,î†ê†,IÙ––öövƽy½Ÿ1{ÆgxÎvÖ”Œ¼®V¤òkí(NÛÆËÓ§é¯Á £LWq6@O6cú´ ¶†Ûr¬)+¶õ !µ´´d2ÚREQò…‚,Ëj£8é¤ùŽs‚¢m=öã_X!ÓhÓ°@΢*_cx ¨/•3¦Oëíëïíë¯|½®@§•ÿßÉ'Ÿ¤ÿs•Ñó?žµEÖuq»vüÿx6l£ ̾öÚkuQcåÛY#*ºª¥yÖ‚òÞ{ï ‚0wî\ãÌîînQçÌ™ãª(­ÛÄŸþÀÁƒÚÄ‚“OÖ§CåXヵU°®ˆ«U –ÃÿŒK­ÓzWiûöñp晓æœyæÛ·¿¦½Z—iEq&3•¯Wm¬Kk¡^”©ý¦Wı ÆŠx¶c›Øæ"t¶A­k¥Ok´9Æ·Ú4;¯Û\Zë+£@Ó|ÇÄŒìú"c £mÆöVµ6Ò8‡ Ó ¾õw‘-U¸Òž‘ˆšóÄôÂ… 8 ½B.\¨-Ñß2&L)okÔÞ™j×RêE™óKuØr¬^¦éûÝô]O&Ë›C-¼™ê².âLFc*ʺv´b½µÁ:Ÿ±5h+˳^n1¾ÊõiÛ(e›ÒZ²5¶ÙF8v¯Ë1ÿJ1Ó²sÎa—À`kLnø_7Þ|Óÿ÷—þ÷~ðÃöööÁÁÁÛo¿]–¥k®¹ÖmQn{™z@Ú¿¿:¢´éÎÎÎýû÷ëÉ´i½pã„1%-#£FcƒsLEuvvV³—lqìÈd]Z³i*{kÐÒÐ"qUxû~·æâ ‡n£¦ˆ[Pƒ–-[vÇ÷Õ¯~åöÛnýÖ?~ûöÛn=røð7¿ù÷Ë–-s[”Û¹oß>m¢³³S›Þ·oŸ5.C[´hѾ}ûôôÚ|ý­^š)#£FFÈ´]Z‡Lö÷{u¿ý]ñßTv—V‘q´¶6—‡æ­Ge ;p¢Ï5ë#çœsó_ÿõwî¹çOÿäŠÑÑÑ[þæo>rÎ9Êq2iኽÔôÚÕÕEY´h!D›Ö^­…pÖXƒ!Óá"ãP¡«aCv/­Ùº›n+ªÁ®yeB N™X¿þòõë/ý³Ï~výú˽âêTQczBìç§÷îíZ¼xñÞ½]¦iíßÞ½]ÖB/^ì¶Fë«)¯±LÚ´Ûíàˆó¶ì*ÏôöíÛ §®l×Cësì–NZ´}ûvF22éÔ˜í¦ u©Öö˜Zk¬‘{EìÛ`©×¦ž4Zigžy¦]½î~R9سž;Ù’gìÔ˜‹? £"ÛMéMMåßüh§óXTдþú–[Ö^xáÒ¥KéIhß ªá«ÆÅ÷Æ’%‹µ‰½{÷š¾¬öîÝk·ÔÔ•²dÉc2zF›‰ …¿R–Ú´ÁnÚ•½é„wß9äµh¨ ]]û>ø¡%“I}Nx+v¸ÑgEa´³’‡Zh …Â^~yÑ¢NÛ¥åry÷îÝŸ8ÿ‚Ñ‘á*Ž^Ö#AZZÛ6?ýÛSO=•qsv+ £èbBÕ)²<8ПL&h "‘H6“}mû¶sÎ97‘H–J¥J6ßäQVBÈøÐj‰'â²$¿¶}[[[;û©™˜­{…B¡PÈO™2uÊ”©‰d’qCa¨S², …ÁãÇO¥ÒŒ¨922²oß¾R©¼|ÅòY³fBjáyŸ5þzìØÑoîˆÇc‹-b?â!³ …R©Ä~ÌÔ;I’‰D"A—„EQß}·ûØÑ£CÃk[]kkmŸ5{öüùííèe4EQ …Âððp>Ÿ¯v[êC*•jmmM&“ìxIp, ÁD"‘t:J¥ØÏ±]$'%B&@g6™pqxøhÐËà‚ À!€ ç“Lšz™\p]&4 EQdY.—ËÕnHˆb±˜(ŠŽ7¬!ͱ5üàß’™ÐhÊå² DfÍž“N§«Ý–år¹žcGeYf<ß‘4ÍÖðƒsKB„w¬H“|x{÷Û²,‹bTÅZ¸ó=^=¼ªª*I’‰,]º´½½½Ú+Ç_åü?KkJ£®—‘$Iå²´ä”SdI’d¹ÚÍ QTÅhtÏžÝñXŒöTmk,^²¤\.KèeRDc±x<¾wÏî}Kާ¬X›<Ú±ó­SO=µÆ¿dÓààà›;vœþ¾÷µ¶µU»-öx~•óÿ,­º^&CÃË-’¤²$IÕnK¸Ê’¢2wöœ}öO›:Õ6ÍÐðð¢ÎE¥R©T*V¸yuD.Ê„¨³gÏÙOß’š:™\±bùÂ…Uh ¹\.îsEÖUsLàæß‚“OvœS¡Ô ‡Ù¹sÇ’%KFGG·oÛ®(Šªª;ÞÜq¬ç؜ٳwíÚyèCj³âÙ’½LãçrÛ¶m<%Ô¯}ú=>ŠÅâwܱwïÞX<þÉO~ŠöŸÔÒîó^Öôìõªñ/Ç/Až¯È… B8ÀY‚qŽ–Wg[ÈÂ… i…KQTUUscc¯¼òÇeK—B¦Ï˜ÞÓÓ»mÛ¶x<ÞÛ×ÛÖÚ*Ér6Û²}Û¶ÖÖöÖɽ”Ÿýì}ú3ŸùŸh0­vZ~ö³G|6Lˆø~^æÊ•+k|¯ å÷»¢(wûÛ{÷î7oÞyý(£€Ý}¸û%õN[Ñé'ý¥qfn4Gˆ@™6ÿÄ¢¾w~Ì.Šs¾iÎþý‰Ùóƒ¥ Ì¦Ò©“N:éð‘£3gÎ%iÊ”ö¾Þ^•–lV’eY’sùÜœ¹s³™´ªšŸMýéOZ›øÙÏѧ+ÆX£µmìùœ¾?„Ãÿ¬KW­ÿá¼uë6Û9«V­Üºu›öj]ªÿî6f×§)àZ¨35ùÕ­ªã7ZoìGÿú¯øÃÚÛÛÿá[ÿ˜J§ÇSZÖEûTÛΤíÆAO©ç¥ínÆ9„ù½Ì^/›,”ðª·såÊ•´6X×Åv}×ÎÃÊžXÓ‰^æ7ÜHTBBT26’Ó&¾ùÀF=ËW?msÑ¢Î}ûöB:;jÚLC]ªíÚ[cJ½ÀÎÎ…Ú[­:ã«© ´?–uk¬X¾bÇŽ=ÇŽµ··+ŠÒÚÚª]w¤(j.Ÿkmm9óŒ3­-7Íѧñ‹_hŸúÔ§Loµim¾mJã"kvFíÆ”ÆÄ?ÿùÏõªM¯¦ŠliUж¤ŽÕË4î´´½šØ?넱LSb€Z¤ªÃCCÏ<óÌ'>ñ ýPú“O>ùØ£Æb±;þîÎö¶VUqý«Öv×`ì Ö ÊžÃ³^ÿTálƒãW‡i;ø\Yu"^Œ Y‘‰18Aû ¡R~Hèóµ‰Å‹uíÛ§ÍY¼h‘JTëcv=Fêiô‰E‹:µiíU˨ÍT-M¢5—ªª*Q•ñB–/[¾sçξþ~m0VUI–ó¹|[[ëï?“¨öCÖzv}ú—¿úå'/ÿ¤6ç¿ø…6­½êoµ Û”¦mÓèô©Ï§U­«ÍÔ¦­-·ßH|ÙáX&ã§¢Î:ÇU,Dà„¤òÌï~÷oÿöo[¶lÙ°aCk[Û«¯¾úàƒ ‚pëm·/Y²X’$ýlCÓNÿŸv®¸HÇßËôCo®#úd¾VvâÇÁØHN%ªö§R'FeUB½ïI8†M­ú´u΄®®.WÙ»ºº´·]]]‹-êêêZ¼x±>ÓUUŒã–‚ ¨Š¬ÇKUQU„ˆª*'~NLöË_ýR›¸|ýz½(}&™Õ™&Œµ«ªrùúõ¿üÕ//_¿þW¿þµ^ µ4Ýåë×ÛK«B/Ó¶"Ê&¢-™ÄÕ“LTBÈÖ­[sV­Z¥ÏYµjÕDiª)å-ÿ4žÊ|{»5Ñ*U]»víïŸ{nÿþý_ûÚ×®¿þúï~ç;Š¢\uÕç>òáM¾NC¥¬Ë‰ý…c× -5Ï1í€Ì2í׋ûû×f½V­ZE ‘lÕª•í±mÉæqQLªÎÓÊŽ·YŠübòt IDATç;¿¢/»æ–¯UòÐw¾9)e›,Y²„²xñbííâÅ‹÷îÝkJ9>”g7bI+ÖCv¾39ÂñB”‰rvïÞÝ×דmm•%YQíUŒˆýý}o¼ùÆŠï³ý-xÙe—B}ôQÅÐm¦F›¯/5MsÑYK£½µ-ж Zªþc}5y¿.Ó¸øT9ÁJ%“ß¾ûž/ýï¿Ù¿ÿwÜ!IÒùçŸÅŸ\Q,ónݺ5ìvµvc¥Z¥% °…î‹¿làèþ‡ôY³;¯Î Âø×¡q‘mXÚ³g>}Ê)§Ð"\H!sÏž=K–,Ù³gçÅlª¢jc’{öìéíëÉf³²$˲46–"ŠQY–T•;vLQÔ÷ÙEM-û¥—\úè£^zɥƙ„ÇL›©Ï1MXGGõ¢¬YôÒLYhsذ֊ì7‘ÿYãþ }^µÝ€6ÇÊš Œኑȷï¾çúë®ëïï›×Ññ×·ÜRÈç9‹p»kئg¤áÙiëÅž Oܦٺu«Ï•µ]Ó±Ñ1ýH¦ãv°Æ¿Ý»wŸrÊ)ì9Æ,ÆE»wï&–©g·.µ-Ð×¥ÚÀl>Ÿ?øÎÁÓghƒ±…B¡µµ5÷;¦ D–dBÈ‘#‡.XÍf­%h—¬[÷Øã]²n6¡Ïd ÌÚ¦´-Ö6 !D_¤-5f4Ua]jªˆ¾‰ØËÇ ‡àJX=ûöíûЇ?’L&«ÝL¡ù¿ÿ»³³Ó9ie•Ëå®®®ÓÏ8³­µµPÈB!’ËçÚ¸ñúÏ_ŸˆÇ‰“©ÔààЯ¿¶xñâ0îÈ`/ͺ^ a¯W¨Êåòî={.¸à‚á¡!S¼™»øú_ôg„¨„¿ÛôÓÃ]V«‘uŠÝ–ÔÕÁ ó!…B!³‘òÎc›U‰D²ÙìömÛÎ=÷Üx"Q*•T¢f2éÛ¿üå|>§N‘MIJ$oß¶­­­µöŸûa]/ZÊúZ/·~·é§ÕnBuè}î™3gªD}k×®éÓ¦/_¶\[tÚiKU"9rxñâ%óæ>QuB&@婪ªÐÏJDž[Ô F]/gºð h[ã½îw6úÖ𣭵möìÙó8W2 Ñðô§瀾5 ½5üHr® d@cb÷§€«!†ß~ðoI€Æ$‚(Ö÷ s€°5áðð/иº-;@óª×óÈ* !€ B&„L.™\2¸pÝÊ`Ç¡¿80’"„dü©æxÅ+^ñŠW¼Öæë‚–ÂçÏk_vÒ”`C¦pðÀ~vŠï þŸßäWÎ.Ïm¯³ç³@s:ûì\på•Wº*!šÈã?þÌ3Ïd³Ù'Ÿ|ò™gžq•! )ŒŒŒ¸ÍrÖYg…Ñ€ ÈÙÎ饗~ö³Ÿ­\¹ê§?ýeË–=üðÃÛ¶mã/6ªr<ýK%*QUUUµ]è•W^Ñæ¯^½ZŸ€š52<òì³[Ö]z©>JeÜy;2Ï÷@­yõÕW[~€Lþ ¿õÖ[7n\¸°ók_ûÚààÀ×7l¸é¦›î¿ÿþÛo¿}Ñ¢E<%£— ÐøZZ[Ö]ziKKKµP Ù–ì¹ýh<ž0Íô±Ç²Ùì×7lU¥X(Üu×?¤R©G}”³d®[½òÊ+Öߤ«W¯Ö—šÞjÓÆß³Æ”P£##ö'BØîž¶ýQìÈPãrc¹RÉ|•ÇW¾òÕx<.KeIV!²,Çb±>ð $•Yæ)ÖuÈ´eÝ£ôýÊ8Á9Á²Ìêû£qOäÜ=±#Cݺu|`ÖHŒ²T–$IŸS.—£Q5" _É^B¦µ£©ÿätÄŸ‚¢ÌŽ2OÂŽ A˜ÝuŒ’3Î7KöLšz™¦ŸœìÄøA PŽ³Ø‘¡‘ØÌúçñôý ¥gø• P1#Ã#ÏnÙb:ùÕö¼·°#C ÒfÃ(9€^&ø4¦Ä¯T€Šá˜¥íÈÖùØ‘¡ÆYfóù|.—Û·¿kp`¨X(BAˆ B"™˜:uÊì9sÓét[[»dáÀþ}ìŸ| çOÏJŸ1?qÒT7Ì€W””wŽË¯½[üÏ­¹_\?“òÎ;ï:tpàø`©TT…L¨ˆDÄT2ÑÒÚ6cÖÌÓN=•]2×­ &îd âºf¨qãÑJŸŽˆâ¾®®r¹<}Æ´³Ï>;™HÊŠ¢*Š¢È²¢ò…×^{-ŸËõ;¶téRöÕ&è5@ƒSd%—Ë}èƒL¥Ò¦E‰DüôÓߟËçdŽK32 Á©D•$)•ÎØ.'2ߥ&\§ÿL™:uî¼ö³SÉ™ 5­P–¥Tþ±AÓu™Ž7ÀrÄ2»öî—ÞÉ*qDL¨m%™tõG Iã©>úc5Sr…ÌÅK–œ}Jûb»^æSOnZ{áE<…T@¡,wÍ+{7ê&Úøø8¦Ä±L.™ÐôXÎùVQÂÝc¨7ª›0ç8Š›@£R¹"æD/S%예Y2cú´j7*€60Ë›ßoÈä?]Ö™j6P͘>Íø–ÆÕ|¨>ßfz’ÉæÍOçÆr—­_ï· µ§·¯¿Â l´ˆéêôÊeé _¸ñÍ7ßüÊW¿‰xì­»ez¼1Íœ1}šþj\ª¿5fÔR2Ê´­Ås#MÍ£5ÒvÔï!ó¢‹.úÕ¯ýË¿øó={vÿà‡d2ö÷îsd xÖ0c E¦ôʤբ³†7k¥ÆªM-aW5&ü^&!dõêÕn|è“—¯¿ï¾{o½õ6BÈSOn2¥ äÞ@þã«£Œn«³¦· ÈšÕD½.“·_×e¾ôÒ‹×\sõ¥—]öÅ/ޤͩٛçU8\™ª3ŽÖ"pTЉ«Lè‘Q_âpIŠ÷3fŸxüñÏ|ú3×\sÍÆ%“IÏåTX…Ojµ= 5„¿—éùV™LæÁ/¾øbÎô´sØÉKõcŠŽ#9sY³ÓÚ©gg/%“û—´ôÕéîÄØÇtJìýXæšÜmkÀ0α=ׯš‹]ˆŸ9ÞÉ^Ê® *‡zÐ’·›é÷VÖó}üÓo#€HasuúOÍñ)hÀÊ÷ÍpYh” ÉÝÍDÈ€æ@‹˜Ü„þ¼LEQ¤ ²,—ËeY–$i|B–•r¹,KRYK Ie©,ËŠ6!I²T.K²$˲öN’Æ“–¥²"+Ú„,I’$—¥²"Ëå²$É’,Iã²<>e¨A–e½IårY–e­a’,ËsBÝ&ÐDQŒF£ÑX,*Š¢(Æb1mN,E}v4‹F£Q1E£ãïÅh4:>!ŠmÂ0;#Ñh4‰Q1‹EÅhDc±hTŒŠÑ¨6ÅD12ñ~¼Qc±¨¡]Q½a±X,z¾±%@=ãyúïu™¡ËŒD"ñx<‡]µ7ìé?’T.•ŠÅdѺ´XÈóÖ²bY.•Š’TæL/ðßcÖó­ jÜä»8„FÇ[àØ4¿'Ì"d@³ÃE&þOÿAÈ€&Ay^fe1MY³f gÊŽŽ}º»»Û8§»»›±Ô6>GK¬¥×§Ì|ß1Ïû­ žyæ™\.wÉ%—ðg1…7S̳.%–@ˆ npÜÊàD( íÓårùæ›o¾ë®»Eñ\ˆOz×]L`£?ú+üë2×®]ûÈ#\{íµ]]]ßûÞ÷2™ŒcãH¬Û¥´4¦®*€ŽëºLÁ6± _Ç2W­Zuß}÷]qÅ<ðÀ-·ÜBÙ²e‹)ñ`'û¸#ÏQI„Fð(ˆÛ²{÷òË/ßpà ëÖ­»ñƵ9ügE‹¯èh€Wá_—¹iÓ¦+¯¼òª«®ºÿþû“ɤçrüÐ#¥õ|Z.ÁÞ–ÝV&“¹ÿþû×®]ËŸÅt$Òt掫c™ìd&´Ó|*q]æyçç*=ãà¥íRž4¸þxù¾.32q ã‹õ|€šÁs]¦éÓÔ¸a45þÎ'B&4ê1KþÓðˆihTŽw' †PŠGLB‚9ý ‰ ^dÆâñD"™JÄDëÒD2å¢eaRE9'Ñh̲„v]&/ô2 )ø—EÈ€&A}ú—‹Yœ2 ÊùV†€Ú#¦ê íºÌðŸdÐ\û«ÁfÉä1Ìê¶DSÅö˜† +\;42• oÙ²åãkÖ´´´hó~ûÛß>þøã±Xìïî¼3›N©²\Ý6{d¶Ê!sË–-Œ¥Æ{q«VŒc{x]ùs™bd­m h *!Ï>ûìÃ?üÜsÏÝqÇ­­­[·n}è_þE„Ûn¿½sáÂR©„û@ó]f­ð7Ìãd=ë p*QÿÇÚµÏ?ÿÂþýûî¼óΫ¯¾úŸÿùŸEùÜç®þÀ>PÈç !*.å†:æp]¦£ˆãC¨ã DAUD+Ý5´žúT{¨j"»ûž»;;:tèë_ÿz.—;ÿ‚ >ó™Or¹FþR€F¥šne@1±À1 Öë±LÛË6´9z@2eá<þG» „ÝSÕ—#ªÅo»íö‘áaE‘…‰o”T:!®;gÏ™ƒ¨ u‚ãºLûÄ6꣗Îȇ MÅéÓ§õõö>÷ì³KN=eÖÌY„AŠÅb"™TUUíõXϱ=oïnmm>}B&4Œ¼.“Íf;u8ppû¶mƒ´díS¦Ì›×±pá‚l6[ÁÖÃñôG™@"‘ÈÔ©S“ÉÔܹsÆr9Z²L:ÝÖÖžN§pu&4ô2ÀH$’Íf2™4ã~ë‘HDà?S Öø¿-;Î 8H C5?5Úá”Ù`1ÆâñD"™JÄlö¥D2ÅSˆ-?y¬TQŽÇI43Í÷?B‚Y§(Š$I¥R‰– G£QÈ„ƒë2ÀR©466–J¥gà …¡¡¡L&Ç+Ù6 —ZRc£`“Øz™@ÊåòÀÀÀÌ™3s¹±ãý}´d‰d²½½½§§gêÔ©±˜yÔ  N¹8ý'ÄV@Èf³¹ÜX>O½Â„¢-Íf2Z|­TëBÆ3qL ÙI’Ô××—ÉdòùœJ7<<ü›ßü¦¿¿/“ÍöõõI’T톸CŒu]æŒéÓôéÞ¾~mŽ6¡'èíëדiÓ¦¦é oÚÖÈ(Ý Û•5Öb*иâ¶uÑr9VÇh$4EQr¹œ,ËŒã8Åbñ¾ÑÕÕÅ;þä¤\.Ǹ| FQŽeº:ý§>Ø~Ý[Ó°—:–à¶=Šâ\cözÑŠåÉeMÈÆ:¥ªöÏöRå»ßýnWW×¼ŽŽóÎûXÅÛ6T«¿uŒ%²T‹í MЄT•üµ¾ðÂKû÷ïûú×7\}õÕßûÞ÷EùÜç®>{õÙÚ& y°š†ßÓšñ#Oô²&ÐŽJjÿ8+ò…í˜%{í¬çÞ0¨_ªªÆ¢Ñoß}wgç¢wÞygÆ ¹\îü .øÔ§?•Ëé‡6«ÝL€À5ÖE&Änðvu„3LY*pˆ.¨ã”¶-gÇBk±<¹lÏ 2.¥e„†¤UQUR¿}÷ÝŸ¿þº¾¾¾ŽŽŽ›nºyddȘ¦Š-¨®ú™´ãyŒ9¦¥œßþ´2i¥ñ×h[Ž«60¦·ÛvB³E±¿¿?ÎŒŽ +²,©Åïß{ïC7^wýçGG†Œ£±™L¦··ƒzD;ÍÇÕé?ÍË:,Yù€Q m€&'ŠbkkëÛ»v­\¹2“mÉ©*‰E£·ÞvÛðа,+úJ:“ñí]»:æÏGÔ„&ÔÔ!³‚S-´šœ(ŠÓ§Oïíéyþùç/Y}:B&4¡(Žå@KKˢŋ÷ïßÿÆëo §%›2ejÇüùúU›5ŽçVú8Šcâ¦îe€&‰L›6-•JÍ›7ollŒ–,“É´··§Ói\ õˆÿ!_4<·2@? ñE"‘l6›Éd÷[D"ü'JÔçGLfãÓÀM¤„æè³’T.•ŠÅd›}©XÈ»hXpy¬Še¹T*JR9ð’ÑË€qŠ¢H’T*Q¿hâñX4ÅLh0ü÷´BÈB)•J…b1›miim¥¥Éç £##Éd"Ç#À þø¿Ý#B&r¹<<22wÎÜ\.×ßÛGK–L¥¦Ï˜qøð{m­­±X¬’-z™Àmpp°}ÊÔ±ÜX>—c$ËåÆ!m­mƒƒ3f̨TëÂÅßùŒ8>„›$IýýýÙl&ŸË«tÃÃÿùÍoúúz³--ýýý’$U»áÎT7OP‰C@¬^fGG‡>ÝÝÝ­ÍÑ&ôÝÝÝz2mÚ”ÀT‚‡ŠLµ0ê2f1UªÍ1•ÉÙcÖBl×Ñ1—cu„¹Å (Š’Ëå$IV õÙ^ÅbñßøFWWW,›Òɹ\Žqù&@m¢}¼]þSIÇC좗Ûx’ÙÆl[ÖpËNÏn {íhçÉeMࡵÐ(#KŠ¢üÓ?ýSWWWGGÇÇ>¶¦òíðÁáî®7ãÉâÖž"Ob·QÄ”ÞÚ æ/ŠÝ0WK­óáÊ`ÔÃÿä•W^iooÿÖ·þ1se¡5Üé?ÖΚâ?2ʬü*›|…k‡jÑX>ûì³ûØÇô¯?ýôÓOüæ‰X,vç_O%“²,W·‘ã?k§Ê!sË–-Œ¥kÖœò3ÂéŠ5T¸%|áÓÛ(«‡Bøs™V¼bj‡JÔgŸ{ö'ÿþ“ç~ÿÜ×¾öµÖÖÖmÛ¶ýè_$Âí·ùä“O*‹¸Ô±º¾.ÓkGÓ†ëY?ÐlTU]{á…/¾ôÒþ}û6lØð¹Ï}îûßÿ¾¢(Ÿ»úêÕ«ÏÊår$ˆ‹Áª…öÙåÿT7ãÆÊt›LG ­•†zDÓñ§`¬BƒPÕ˜(Þ}÷=‹½óÎ;ßøÆ7r¹Ü\ðéO}*76†+ÏêõX¦í5¦ótLY*pÎçAÛö³c!íšþj*Ç[Ë¡N©ªª(ŠZ,Þ}÷=×_wm___GGÇM7Ý<<4hLSÅ„ƒûôçÏ ì Œ‹=hs¬]:Ïù©ËUFo5¹²Ëáß>“ÍFÅþþþt&32<,Ë’ZTï½÷¾¼þúÏ Ãd&›íééÁ ^¨ÆËF¨×eêSÃ(us]f¬’Õ µÓhB¢(¶´´îÚ¹ó¬Õ«³-­cccªJ¢QñÖÛnR”ˆþÞL&#ŠÑ];·Íž3QêD×eÖÍÀlj',ÕNK  ‰¢8}ú´¾ÞÞçž}vÉ©§Ìœ9‹"B©TJ¥Óªª ‚ ½öôÛóöîÖÖÖéÓ§!dBݡƻ.“Íf;u8ppû¶mƒ´díS¦Ì›×±pá‚l6[ÁÖ„«n®Ë€Z‰D¦NšL¦æÎ3F˜I&nkkO§S¸:êõ2Îü™@!‘H$›Íd2iÆýÖ#‘ˆ Ø¨;”Ȉ^&x!RB£ò²+WÈŒFcñx"‘L%b6ûR"™òÝ €`¨¢“h4ÆŸƒ3óu™Í{ Ô¹Iw¬rº.ÓñöVM}]&4:žë2 ÷2Àó2¨¸{Ž™Ðè—˜àI&“Tûy™k/¼ÈUúÓ§éÓ½}ýÚÛÞ¾~ãRÆ[Ó´±4cJ3¿w2¨ìu™Æ˜T9“àGè³›7?½iÓ&ýíO<±åw¿cg¡ÅK½³hJ ½µv%ƒŠ»ÐT¨1ìÓò¹üu×^»uëVBÈ‹/¾øùë¯gÜ—2@Öx9cú4í_j€zF¹.“;¿ÇÙK/»ì7ÞøìŸ]ùпüèš«¯¾éæ›Ö­[GyêÉM¦”<;µ®¤·¾#zœÀÅw7Óû±Ì¯|õ«»wï^Ù¥—­_ÿ¥/ݪÍt{6>T«¿ÕB£Ÿà –^ IDAT`£§ÿD"‘|ðÞ{¿ÿWõEž‡°£u¾é¸&g9®ðŸþãëŒÙt:}ë­·ñ§7Ëã9ì£f @ã†ÆÚ¼È„X¢­si›Ì8Ó6•߈éûî?Öó}ê n˜À·e0¢ËÄmÙ† Íz[vô28|ÃKð¡9®Ëd´ 'ú?þriŒmzÛÆÂÏ™~LÚ.hø! †ë¡—éŠékÝçÑGÆ¥FŽgÇxn’iXÕÏÑ`ך„éDkë‰rú"FFkvë°Ú<÷ Àˆû²Ìú ™Äîz ۶ɬGexbíXŽãe*´Œr6ƒ¿XÇ9©‚zÇþLºýœ{. \Ís]fXWeÇ®‘f4‰ú8ý§ÖÔHdª‘f@cósh#Ø–T nËàScÝý $x’ Àd´Sc10 À#àÓ$©\*‹"È¢ui±wÑ4€0Ër©T”¤²i>50¢— À§ÿù=”‰ ͧÿpð[v„Lhj•»-ûš5k8SvttèÓÝÝÝúLÓ´žÌ8mÊb àÀ÷)³ÞCæ3Ï<“Ëå.¹äþ,¶‘ҚƸÔP&ÀûÐX‰ÓÊåòÍ7ß|×]w)Šâ6¯© P58ýgíÚµ<òÈ#­·¯ß:“¢Íצu½}ý¶sôBl °Ǔɤ D"!‰hQ“R*•J¥2O ÞCææÍOçÆr—­_ï¹=p!‚"Ôï§ÿ”ËÒ¾pã76lPÅ[ Zt´ö&ôÄèb@…y™]tѯ~ýèüÇO¯úË¿ °MF3¦OÓþésLó•áëXæêÕ«ÜøÐ'/_ß}÷Þzëm„§žÜdJðÓB#Ô_!ó¥—^¼æš«/½ì²/~ñ&mŽ«³ˆá”þŽ£–M¨0ï³O<þøg>ý™k®¹fãÆ‡’ɤ‡´™Ú?Î,z¤tuÀ?ï½ÌL&óàÆ_|1=È¹Š‘ú4º•PEÞCæšÜUzSÀ£½e_a‚ëO ZüÞcÖz¾@CÂmÙ¸ dpAÈà‚ À!€ ×E&’T.•ŠÅd›‡V ù [àQ±,—JEIâzž—+èepAÈà‚ À!€ B&_ÏË$„¬Y³†3eGGGww·u&!D›¯M뺻»mçè…èÓz2ý­±"í-­pciÖ*tÞCæ3Ï<“Ëå.¹ä’ šbð£—må,€Ÿ÷Ùr¹|óÍ7ßu×]Š¢x+A `Ö. ƒžX~~B µ4ï½Ìµk×>òÈ#×^{mWW×÷¾÷½L&`³t¦AWB;5u7Ãh 43_Ç2W­Zuß}÷]qÅ<ðÀ-·ÜBÙ²e‹) ÿÁN[œ?Æp.;|âà%pò2_~ùån¸aݺu7Þx£6ÇÕÙ@ÄÏøã–~:Ï!L€ x?–¹iÓ¦+¯¼òª«®ºÿþû“ɤ‡º 8³auáxxïef2™ûï¿íÚµüY¬&ù³0rñ¤qÅC; áy™çwž«ô¦ðC{˾Â唆Q -#Â$@#‰D"ñx<‹ÑÄãñD¢\.—"‡‘W¿wÿ±žïP;"¢HÁ9 DD›\N**˜Ô¤¨(ŠN±"Šb!šY2™â¹s@*•L¦Òì4™ÐÈâ‰Äœ9s‰#M"™˜1sf<gå÷¶ìµìxß‚ Ó™tﱞB±¨È²¾H„¨(Ɠɖ––Ùsæôöô°‹BÈ€FV(zzŽÍž3gÆŒ™…|^Q'Ý="DR©TD9\,ØEq…Ìh4'ÉT"fsh4‘Lñ7 Tª(Çã$=qUI¡?x`¿ÿ’q,€ B&„Lh.Š¢>|ØCF„Lh.¿øÅ/¾ýí»õ«_»Íˆ Mdóæÿzþù²Ùì–-[^xáWyý†Ìµ^Ä™rÆôi3¦OãkšÖèÿŒshÙMé™òÚÖ æÕW_}â‰'V®\õ“ÿé²eË~þó_¼ùæþìÞCææÍO?úk×½Z·fLŸÖÛׯM÷öõëÿ´·ú+žÞ Må@3سgÏüÇÿ¿paç—¿üåwß9xÇ7gÎÜÿøÇ‡â,Á{È,—¥/|áÆolØ (ŠsjB!zè2Bý­)°Y“qîv)­UÐHžÞ¼9›ÍÞyç==GeYîïïýû¿ÿût:ýÛß>ÍY‚÷»ÿ\tÑE¿úõ£ù¾gÏîüðž›Þºb `zÌóجåhQñ }å+ÿ'™Lô˲L‘$©PÈýà‡ …ááAž|Ý0oõêÕn|è“—¯¿ï¾{o½õ6BÈSOn2¥1ìôœsqŽÐЄ ù±|~¬\*ésŠÅâÐàq•»_!ó¥—^¼æš«/½ì²/~ñ&mÿÙ@:Ó98zÌ«dÏO«M€V2KöLïÇ2ŸxüñÏ|ú3×\sÍÆ%“IþŒÖ°D;‡}x’V¸mF84iWÕ@óðÞËÌd2nÜxñÅØ+cçÏtÖ+Ï9;¶‡?MåÞfhHÞCæšÜUzÛÎ¥u¾u&íbkÓ´m8ä/ÀÈï­ ¬çû4$Ü0€ B&4…¾¾¾þ~˱¹Þ^ëL„Lh ÿùŸÿ÷;ßùnooŸ>çØ±cwß}ÏÏ~ösÎ2 )ü¯o,•Ê<ðÃÑÑQBÈèèèÆ)ªzíu×q–€ M¡¥%û·wÜÑ××ÿàƒÇÆÆ|pc__ßßþí­­-œ%p]d"IåR©X,A­K‹…¼‹&„©X–K¥¢$•MósccóæÞ|ó_ç;÷|ýëòùü-·üMǼ¹CC\7˜%èe@ó<ë¬Uë×_žÏçÿ쳟=ë¬Uüñ’¸½•A¡,›æ”›™µ©¯¯÷ÏÿâÏ×^xáÔ©SŽ9ì*¯sÈ\2Uz÷x©cÐþƵGGÅ}=EWU„êð`éÝã¥S¦– ‰[—¾×ýn:“q/ OÈüÓ3ÅøýP$"œ4ÍæÞëûâäÀ˜ÛZÂóNá¿v}åcÔ—ó¹„íÛ^uLt¨¿ô_Wßî‹u·„¡2¡^6u¨»¹^E€É*£‘¾ø·x_°•áîy™aÐ6™ØšAë¿´ÓT°Ý6‚A°û5Ô&â:ýTT?dšh;˜¾›é¿DŒ‘Õ8Çš€Ð÷RZ^kù¶m0Í7µ–ÑfSØÉl˧µ“±vœÕ¹Ú,¶¬Ã8ÖmˤÕNûÅn˜)»uÂZ&ûOÆ™’‘—½ÖœŸs6öŸ˜ç/k­Î¸Ýª¾'ºmO û mƒT·ÍŽ)9ÿF>rŽ;)cWµ-Š‘…½gU]Í…LBù²£ýaø·¦í7 cŽm.m6&³]ijŒí`ûQ£­g«xª³-Ùv>cÝó=lÏ»g!ŽHW%s~ÎÙ±“±%9?ðŒ¦VqO¤ý^Ñgøi·&³nÿ*¶™Ý6Æ´«ugä\íeœE1²ðìYÕRýiýÆgÿZñ³¯†‡óV¨Øõòü„ çŸÆTûfK¯ÝUvcÕ¶%Ø–Ï¿?ü*ð™ñYl€{¢µ›âX;ûÛÖó§Ý³*¶™Ö!óÐBo‰+ À=+TÕ™œ?ÒoÏŸèÚ›Þ†ØJ7ªÒÇ@k•·ÈáˆóOã¿vÿ[ÛUØHÏmé3`±>÷DS¤äi˜ŸMÛ³Zm¶n[vJNµó…© iÏ \Ý\dbüÑFŒsjá7T-´Áª’­òÜýòðSß»Œ£^쎦‡¶™ªÓ ôS­XþE~ŠõS”ÿ=Ñ[×_ít7}–OÏô_{­}MÑ>`5ÒÎê÷2Œû›í¯TÆÖÍ–“/¬¥¹mm»ÍÖEìÆØ–oJÌÓ*?Õ1VŠs‘µ:ÛøüqãíoÊ(„=ßñé¿´¿/;#­cçªyœ{“Ï=‘³aì4þ?ínwŠ*¶™ñÙ íJ¶)ÙÕ±?r®{Ø©Cڳ lßöjµÛP7ª5¶^›cú®¸Z…Xß0„ºY°Íi°eÀ¨¦{™5¢fï@óÀw…a¯[èep©›Óª !€ B&„L.™\2¸ dpAÈà‚»ÿT“$IÇŽõ ŽŒŽÉ’DTµÚ-j2‚ F£ÉD"-Y¼$e…E®©(Š,Ë’$ÔÀ*ˆF£¢(F"νêº^YþÕ€qøÈá¾Þ>B"Éx’īݚ¦¤(J>WJÄ“ )Cf¹\N$'/X˜N§ !„¨„u÷šËåßë~·X,Æb±^YÎÕ€Ú166'ñ8»áQ%‹*#òÈð;¥Ã_H’$Q—,9µT*ŽŽŽ×ÂJ‹Çc§œzêÎ;$I¢}.`eyVjJ©PJ¥3ñBfÕH’WÔX,^,—Ù)þB£££ËW¼¯X(‹…àšW…¼DTµcþü]o½ÕÞÞn›¦V–g5 ¦È²HD"‚Pí¶4©ˆ DH©ä#dʲ<44”Íf†‡†¥îHçó…ö)S†††ZZZDQ4-m˜•e¯&ÔAˆL¨vSš”¶ñ…HDpúÕ ™Š¢ EEQUUQU%ÐŽ;ýô3!¯¿þZ…[²¬­‘b%XÙJa­&ÔžajÏnÔ“áÙ™D˜¬ÚÍiR[_ˆ ‚J?i™óŒYÕ±ãuæ™gêÓÛ·oç)öÌ3ÏÔR*ŠªO‡‡óÓÒʺåyƒð¬¦þø\Ât_è¡ÖëX»‡ì´Òk±9âu•u!X6Q#èeVÛD/S"‚(ŠŒ+&¸B¦cÇkåÊUÛ¶m5¦çl¨žrÛ¶­á÷í¸>Žá­¬[^KvXÍj}í6Ò×}µV¤a6 @â½.SQ¨_ßgµúÕW_±&8ë¬ÕÚÄ«¯¾b|«Ï!„¬\¹J{«bM¦Ï×+2¾Zkaø~À…·²Ö4ìÑ7ŽíRöjÚÆ-k?†öJ =EÓ[ÂìT1ºkœ¥Ó0ÚcªÝ1/O²¶ÊTŽmQÖ h»:ÖMÄX#k'˜½­ X|½LEU™c•Ö¥«Ï>û•?þQ›>ë¬ÕÚ4mŽ–]UTc®ÕgŸ­Ï7U¤e7¥×ˤ×I=!­¬m}E¬é‰aㄱšŽlãíLÆUØoF3xÚCËË϶Lëï ÏEqna#Ú·«üøz™ª¢0 m—gjÓAÍùÃ^Ög®>ûlv3Nà %œ+û|P{û‡?¼lÛ k³­iŒ+¢h[Bà«éÈøåkÛ³ñ†Ñ­tÌH{hëå ;PÙ.µ6˜ÖwtäX‹³—©¨ô±J-{¦6Æœ—ÿû%v3N,e,›Ülž•Õêýà‡>l|Ën6#Í?ôa}©^f¨«é™ÏodÚØ£·M=-? « Û›"«‡«ñ­ŸS€çøžD¨^zñ…~èæ™dâ  >Þµ V¯¬µIÚRv³ii*°šÆƒj>¹*DZ^oÝMŸüh:Niźl ñÖÝD°_/“¨ŒëT!/¾ðü‡?rŽñ­q΋/<¯e7b;ÇTŽíc.ÛZ¨kÁ÷|·+kj$meÙieÒ6¦çÕ4};oÞü45¦dFZXkqUšmF™¦õòº¯$Ñ5rŽˆ26µõD!vÖ”8÷ lÂöm¯Ò–•Ëåýû¬»dÝáînY–+Ù,Bȹ=ïùß?`‘HdÞü“Ÿxü±ÎÎ…Ö»–WweÄ^M¨)ñxü•?þ±½}J"‘À=f«E’¤b±884X(Î=÷ÜR©DKéðÅHoo_¶¥ehp0èFÚ;÷£çiÁÆKBHk[[oo(RÇ¢+¿²ap\M¨QÄMjJ„yÓ4VÈE1NoÛöêG?z^[{ûÈðˆm²œsŽuæ‹/¼àª•þ3²e[ZÄh|ëK/¥ÓiÛÛÈUee縚PS¢¢(F±«ÖŠX<õ2#‘H[[ÛÀ¡Á§žzêôÓß?sæ,Bˆõ;vî¬ús"_{z޽þúë‚ Ìž5Ëö®T±²Ž« 5%™L¥Ó™j·¢Ùéß–™L6™J3þè00›J¥æÍwäÈ‘-¿Û22R—Ô´´dg̘9gΜT*EKÓ+˳šP;â‰Ä¼yóúzûªÝ ±Xô¤ùóãñ8# ëô¢(Åbqtt¬P¨×§HB’Éd6›I$ì¾W½¯,çj@H&“³fÏ9tèàèȨ$•eIæ<·‚"BT%UM&âË–¯8zäã‘ÉÎ!S£ª—^Ô8WÖ©ß•ÅóƒêN2™š=gŽ,Ë…|ÞáÞ^ŽˆI¥RQÆŽØ&F£X,þíãv:ezžwÏ=÷”J¥{`û”J¥^¯' ?PÑëõ–––fggÆ ¾ý'N³¾Œ—|>Ÿ5ü’×Ù³g_yåÕsçÞ “;fSäÂ…>üðR±X¼xñâ¥K—BíKÊL‹ùùùóçÏ:ôèÛ¿ýÝΜ9{ùò§î»“2SáÊ•+ï¼óûýûÌRþ!¹¤pm_BÉ£¦PÃÿÏLŒV³ÞlÖ7:Á–v»½zózß9B””¹Åÿ½,%³­7ƒW5‡©™À’´Ô¼;Hþ¾¤j@i/S6R{WªíÃæ!õˆI9^:ŒvÒ^R(Çÿ9€ÉÖñ%KûF“è)Sbúf|Gk¿¬¥U ½ ue)í(å5 å¼nàø‡§®zc‰ãÒ>ZG¿ˆ×2C%û%7GÒÙ`Kwê"ìåß7ì^¡¤íj|û‰âÙ“±0¼Ð)S{>Ó~»ÿÔRÊÒ7»tÖ²E_z£#Ù4_ÓF—uª6ˆöˆÞµd:ù¬mc920UZ­V³Ù¼víÚ­õõvGáyž'<Ïóödö”J¥Ûo¿#ŸÏ–† 2M‰AÚîruÐÞ,°¥ãHB}êÒ8Úí©Žã<ŒGÏñÈÀô¨Õ®W+•ÕÕµN§Ýïõ„ðÄ7¿ –h%7ÚV³UÚ[Š?e"ÇË´)ÉyV*•ZY^ÞØØ¸ïþÙG9˜I§»½^¿×ëõºÝ^¯Ýj]¾üé­µ[z#•JmnnZBJ)ƒ)·u›+¶C¯Ûk4}ï±l6+}”N§9x°Ñll=¬iGÊL¸¾èonnær9í§ù|®k]\2S!‘Lj·§R®×(I™€Iæyÿ»Õ'‘0¥Ì=RK“‘»ýÇþ”ÅŽõc_qESÑ2Z,q`Äõûÿ«ˆ—LêW‰ÉoV™ƒ–&Sfä²¥Ž7…š*»ÆN;ž‘Í—"¾£Aý<ÓÆ¼ÊtM…S¦TNÖRˆNj?x5¥Æ,ÍýMiX;SFñowytDj/íhï.li²±gk Ã*sÛS¦Ð})KßûÚ„jzT?° ý }µ ¹¶HžšÕº¯jAsu´²Î`h9>êx´,ó2½q<Î0Á¯eêZf`ýÕÀó~ÛwbP›"t§. c€ú¯Ú]BÕ7R¾¶#˜B¦k™;±Ê”X¾¸- 5–ïtÇ‚æ2¨tB5Ôìõüçî¾4ÕÂÕ®¶` íεLÇÂßöklÚ«wRdµÈ¸%©¥ÉMÕÈê)eí¬Ã^\4MÍrÝÔt¡W "¾©$ÅÑ&øÀãlš LŒ^OX–L‚ÞIDAT_ßÇ^$Ï/JÊt)ü=|ÍñÀ¾,-£Ev™—ã¨âš©K¿¡¶õ–`ÝnO»Ý=eŽ})ÿâlDÄ•Hl#ó*sÃ1ÂÈ•2‹¼pÑc• €‹á¯e’2SÁt-ÓñgL)0%Æ`•)=v²õ¶ÙHÝÂca™…Ú2ò§öÞ#ì(ÂŒ&OÏð#ÒÛ{û©ª–úì‡ö+Û^.`gJ»9ÎËô§öI)¾}Ž•`Õ°.æ<€©å /•J5›M¡ûy¯f³™t«fñ¹Léy|©ò€öQ}-÷µš½ ixÂ~\ê!XʸԹ•J:H]›ª+hKÜ™*Üj³:rõh„ýëÀdH$…Bá£?>xð`&öÔnw._þ4ŸË' ?@í}•)}û«¥g´EÆÕâm–ä7 -UÕD¢­ gÉ–y©[Ô8Ò¼Ô%²v–‚‚öYhÓ¤6ñkËæ©‡&R"‘( ×kµóýëf·ëyBOxB‘J¦ò¹|.ŸO$~_Z ùã_Bù {Ì^²Ç.ÔyÎPa¥ÁÆQ‹áÅÈqa«È’&L•l6›Íf777;DÂó¶Ò¦çe2Ïó:N`øKìüwq`a[wa¦þf¡2t`•Zí:UjcŒccn0=Òét6›õ¼D"á% ï›ëšN§Óqº(tÊ” Ô©‹é"œt Ò¿¥¢”q·ÜºâïNM'ê aû™L˼,—µ³°ŒÖtåÒ?©±}õhh¯¹j#û'¥½Ú ° 2£UwßÑ¥6ó¹œãu¼ U½ÇAmj¦¡úry<“1+e0X>jglŸ1+Ëm)ÀðÆl• Àn!eà„” ˜d‰D"NïÙ³ÇÔ Ng2é­–¡bšBzøaÆ­,ûÎÜÎcL„ݹ FP"™Ô––•y^"¨fÞˆ–e妗€Ã<€±cv¡>—IÙX0I%“.õc“Édj;R¦ZÅTªWàþ n*ëª ܨÆq©!gêν÷aÆlªXÈÿ~k±;( A¾¿l6W(L¿ü5Ëe³¹üúúº¥M”³ƒ4éÿ‚”•4S·CYvË^ƒ5í˜/Mmùë…í}˜1òœ:Óh]Êì™>€é”ÎdÊår&“±´Éd33wßþöœ¨F½,»é,n¨^" ì}È1ùÓ¿Ð2L¤ëµêìÏò•å•V»í_nzž—J&ÓÙl©Tº·\®¬¬ØCAYv{UØ@.k¯P%Î]ŽÙñ¼±…¿l%dQx˜­VkeeùÞryfæîV³Ùë÷üŸ&¼D.—K$“K__k·[öP£U–Ýô¾¢T]·2°Z²\¡KïÃŒY{­×žàµ19 v­Vsá?ÿ>Ž÷ÏÌÛ[|vå³'~ôcË-»eSÅ8ŽÆÑÆÆÆ_Îýù¡‡Š1æ˜Õ˜ãùøã8Ž ¿”9Ž«´q3Lª^¯·´´4;;vG æ¦ËÙ³g_yåÕsçÞ »#)0E.\øàÃ/‹Å‹/^ºt)Ô¾¤LÀ´˜ŸŸ?þü¡C¾ýÛß8pàÌ™³—/ê¾ûT—e×#®8|€‘råÊ•wÞùýþý=zôê Ç¿T.Ïž>}zqqÑ1BÄ‚yþì¥Z9ŽåÑw·¾O,†,øa¯áùÿ¦þ?®ãßFÙû.‹Å'N¬¬,u»ÝZ­rêÔ©|>ÿÞ{ï;F˜Ì²ìju`þRBW“Á½P»}j|€Qð /f³Ù›7jÝnW±¹¹Ùj5~ýúíVkmí¦K„É,ËîßKûuï¯@Û—T·=0T(ø£¤Õ¬ß¸Qët:ƒ-ív{õæõf«áaêʲ‡ýöWS~ä®ãÄx4†ç ßL²´o4‰ÿöŸØ—#¦€–¯òh÷ÎX²©?H¨ Zzv G8XbFþC¨'bR˲KÍ'-Õ¤(…²ôUùvtÓ¤ijçî2¯aކö*²}ym™©i˜6“Y–]ûÑd'€Éž„EYv!N´ª+$i¼­ÃÛa\h€3~)ÓåVÕ°»Œ¯ žŒ æ¦BµZ­Õ”5U¥¢n4!e¦ÂþðÇ×^ûU¥RlY^^~õÕ_þéOg#2SáçÏ>Ûél¼ñÆëëëëBˆõõõ·ÞúM¯ßÿÙ3Ï8F ,»föÞ]žî·LÓ}a÷X”JŹãÇ«ÕÚ›o¾U¯×ß|ó­jµ:7w|ïÞ’cʲËZ]ºŽÜÆq^»x4f(Ë`B5êõûï›}î¹çNž|yaaá¹çž¿ÿ¾ÙF½îa*ʲ å‘íàG¨>µâ25íÑp™W´½Lß>MAYvS`uõæáÃ>ñÄß}÷ÜOž|òðáG«ÕŠûîQR¦6Óø+ì ¶h«íh¿ÄM{YÒ³M5ØWª6 jG¸—eR›°óæhHmL3µÌ:Ô§0FªÕÊSO?õƒÇ¿ãŽÛ—¾¾jßà”™H¥*•åÙò}ÂóM9#ì¹» ‘¶‰v^q›ÎFÎkÈ£1ü°ý Í!CÀNë÷++ˉTRûáW_^Í aó¥pI™³å{ª•Ú¾Ûö !D_9rdqaAxÿ?Øräñ#'ñ²ôéÖ{u‹ãû“'_^\\Pûš{ñ˜ßanîØüü'‹‹ G?òÓ§ŸšŸÿdëÓ¹¹cƒÑnE6p+‚i¯¹¹cÚ¦6ŽóòhhǬŽ0pÖ[ûÎòÉ܋DŽ'ãðÊ+¯¼ŽÂëÚÚêúúzùÞ²)µ¹_¿ô ®1+„h·;F]ô#Ä`Š…t:oL§k™™L:“‰¹cÆ ¥ pBÊÀ )'¤Lœ2pBÊÀ )'¤Lœ2pBÊÀÉPGŸJ`dIEND®B`‚flann-1.9.1+dfsg/doc/manual.tex000066400000000000000000001774631275407571100163360ustar00rootroot00000000000000\documentclass[letter,10pt]{article} \usepackage{latexsym} \usepackage{amsmath} \usepackage{amssymb} \usepackage{amsthm} \usepackage{amsfonts} \usepackage{epsfig} \usepackage{url} \usepackage{fancyvrb} \usepackage{hyperref} %opening \title{FLANN - Fast Library for Approximate Nearest Neighbors\\[0.5cm] User Manual\\[1cm]} \author{Marius Muja, mariusm@cs.ubc.ca\\David Lowe, lowe@cs.ubc.ca} \begin{document} \begin{titlepage} \vspace{10cm} \maketitle \thispagestyle{empty} \end{titlepage} \section{Introduction} We can define the \emph{nearest neighbor search (NSS)} problem in the following way: given a set of points $P=p_1,p_2,\dots,p_n$ in a metric space $X$, these points must be preprocessed in such a way that given a new query point $q \in X$, finding the point in $P$ that is nearest to $q$ can be done quickly. The problem of nearest neighbor search is one of major importance in a variety of applications such as image recognition, data compression, pattern recognition and classification, machine learning, document retrieval systems, statistics and data analysis. However, solving this problem in high dimensional spaces seems to be a very difficult task and there is no algorithm that performs significantly better than the standard brute-force search. This has lead to an increasing interest in a class of algorithms that perform approximate nearest neighbor searches, which have proven to be a good-enough approximation in most practical applications and in most cases, orders of magnitude faster that the algorithms performing the exact searches. FLANN (Fast Library for Approximate Nearest Neighbors) is a library for performing fast approximate nearest neighbor searches. FLANN is written in the C++ programming language. FLANN can be easily used in many contexts through the C, MATLAB, Python, and Ruby bindings provided with the library. \subsection{Quick Start} \label{sec:quickstart} This section contains small examples of how to use the FLANN library from different programming languages (C++, C, MATLAB, Python, and Ruby). \begin{itemize} \item \textbf{C++} \begin{Verbatim}[fontsize=\scriptsize,frame=single] // file flann_example.cpp #include #include #include int main(int argc, char** argv) { int nn = 3; flann::Matrix dataset; flann::Matrix query; flann::load_from_file(dataset, "dataset.hdf5","dataset"); flann::load_from_file(query, "dataset.hdf5","query"); flann::Matrix indices(new int[query.rows*nn], query.rows, nn); flann::Matrix dists(new float[query.rows*nn], query.rows, nn); // construct an randomized kd-tree index using 4 kd-trees flann::Index > index(dataset, flann::KDTreeIndexParams(4)); index.buildIndex(); // do a knn search, using 128 checks index.knnSearch(query, indices, dists, nn, flann::SearchParams(128)); flann::save_to_file(indices,"result.hdf5","result"); delete[] dataset.ptr(); delete[] query.ptr(); delete[] indices.ptr(); delete[] dists.ptr(); return 0; } \end{Verbatim} \item \textbf{C} \begin{Verbatim}[fontsize=\scriptsize,frame=single] /* file flann_example.c */ #include "flann.h" #include #include /* Function that reads a dataset */ float* read_points(char* filename, int *rows, int *cols); int main(int argc, char** argv) { int rows,cols; int t_rows, t_cols; float speedup; /* read dataset points from file dataset.dat */ float* dataset = read_points("dataset.dat", &rows, &cols); float* testset = read_points("testset.dat", &t_rows, &t_cols); /* points in dataset and testset should have the same dimensionality */ assert(cols==t_cols); /* number of nearest neighbors to search */ int nn = 3; /* allocate memory for the nearest-neighbors indices */ int* result = (int*) malloc(t_rows*nn*sizeof(int)); /* allocate memory for the distances */ float* dists = (float*) malloc(t_rows*nn*sizeof(float)); /* index parameters are stored here */ struct FLANNParameters p = DEFAULT_FLANN_PARAMETERS; p.algorithm = FLANN_INDEX_AUTOTUNED; /* or FLANN_INDEX_KDTREE, FLANN_INDEX_KMEANS, ... /* p.target_precision = 0.9; /* want 90% target precision */ /* compute the 3 nearest-neighbors of each point in the testset */ flann_find_nearest_neighbors(dataset, rows, cols, testset, t_rows, result, dists, nn, &p); ... free(dataset); free(testset); free(result); free(dists); return 0; } \end{Verbatim} \item \textbf{MATLAB} \begin{Verbatim}[fontsize=\scriptsize,frame=single] % create random dataset and test set dataset = single(rand(128,10000)); testset = single(rand(128,1000)); % define index and search parameters params.algorithm = 'kdtree'; params.trees = 8; params.checks = 64; % perform the nearest-neighbor search [result, dists] = flann_search(dataset,testset,5,params); \end{Verbatim} \item \textbf{Python} \begin{Verbatim}[fontsize=\scriptsize,frame=single] from pyflann import * from numpy import * from numpy.random import * dataset = rand(10000, 128) testset = rand(1000, 128) flann = FLANN() result,dists = flann.nn(dataset,testset,5,algorithm="kmeans", branching=32, iterations=7, checks=16); \end{Verbatim} \item \textbf{Ruby} \begin{Verbatim}[fontsize=\scriptsize,frame=single] require 'flann' # also requires NMatrix dataset = NMatrix.random([10000,128]) testset = NMatrix.random([1000,128]) index = Flann::Index.new(dataset) do |params| params[:algorithm] = :kmeans params[:branching] = 32 params[:iterations] = 7 params[:checks] = 16 end speedup = index.build! # this is optional results, distances = index.nearest_neighbors(testset, 5) index.save "my_index.save" # Alternatively, without an index: results, distances = Flann.nearest_neighbors(dataset, testset, 5, algorithm: :kmeans, branching: 32, iterations: 7, checks: 16) \end{Verbatim} \end{itemize} \section{Downloading and compiling FLANN} \label{sec:downloading_and_compiling} FLANN can be downloaded from the following address: \begin{center} \texttt{http://www.cs.ubc.ca/$\sim$mariusm/flann} \end{center} After downloading and unpacking, the following files and directories should be present: \begin{itemize} \item \texttt{bin}: directory various for scripts and binary files \item \texttt{doc}: directory containg this documentation \item \texttt{examples}: directory containg examples of using FLANN \item \texttt{src}: directory containg the source files \item \texttt{test}: directory containg unit tests for FLANN \end{itemize} To compile the FLANN library the \textit{CMake}\footnote{http://www.cmake.org/} build system is required. Below is an example of how FLANN can be compiled on Linux (replace x.y.z with the corresponding version number). \begin{Verbatim}[fontsize=\scriptsize,frame=single] $ cd flann-x.y.z-src $ mkdir build $ cd build $ cmake .. $ make \end{Verbatim} On windows the steps are very similar: \begin{Verbatim}[fontsize=\scriptsize,frame=single] > "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" > cd flann-x.y.z-src > mkdir build > cd build > cmake .. > nmake \end{Verbatim} There are several compile options that can be configured before FLANN is compiled, for example the build type (Release, RelWithDebInfo, Debug) or whether to compile the C, Python or the MATLAB bindings. To change any of this options use the \texttt{cmake-gui} application after \texttt{cmake} has finished (see figure \ref{fig:cmake-gui}). \begin{Verbatim}[fontsize=\scriptsize,frame=single] > cmake-gui . \end{Verbatim} \begin{figure}[h] \begin{center} \includegraphics[width=0.9\textwidth]{images/cmake-gui.png} \caption{Configuring the FLANN compile options} \label{fig:cmake-gui} \end{center} \end{figure} \subsection{Upgrading from a previous version} This section contains changes that you need to be aware of when upgrading from a previous version of FLANN. \begin{description} \item[Version 1.8.0] Due to changes in the library, the on-disk format of the saved indexes has changed and it is not possible to load indexes previously saved with an older version of the library. \item[Version 1.7.0] A small breaking API change in \texttt{flann::Matrix} requires client code to be updated. In order to release the memory used by a matrix, use: \begin{Verbatim}[fontsize=\scriptsize] delete[] matrix.ptr(); \end{Verbatim} instead of: \begin{Verbatim}[fontsize=\scriptsize] delete[] matrix.data; \end{Verbatim} or: \begin{Verbatim}[fontsize=\scriptsize] matrix.free(); \end{Verbatim} The member \texttt{data} of \texttt{flann::Matrix} is not publicly accessible any more, use the \texttt{ptr()} method to obtain the pointer to the memory buffer. \end{description} \subsection{Compiling FLANN with multithreading support} For taking advantage of multithreaded search, the project that uses FLANN needs to be compiled with a compiler that supports the OpenMP standard and the OpenMP support must be enabled. The number of cores to be used can be selected with the \texttt{cores} field in the \texttt{SearchParams} structure. By default a single core will be used. Setting the \texttt{cores} field to zero will automatically use as many threads as cores available on the machine. \section{Using FLANN} \subsection{Using FLANN from C++} The core of the FLANN library is written in C++. To make use of the full power and flexibility of the templated code one should use the C++ bindings if possible. To use the C++ bindings you only need to include the the library header file \texttt{flann.hpp}. An example of the compile command that must be used will look something like this: \begin{Verbatim}[fontsize=\footnotesize] g++ flann_example.cpp -I $FLANN_ROOT/include -o flann_example_cpp \end{Verbatim} where \texttt{\$FLANN\_ROOT} is the library main directory. The following sections describe the public C++ API. \subsubsection{flann::Index} \label{sec:flann::Index} The FLANN nearest neighbor index class. This class is used to abstract different types of nearest neighbor search indexes. The class is templated on the distance functor to be used for computing distances between pairs of features. \begin{Verbatim}[fontsize=\footnotesize,frame=single] namespace flann { template class Index { typedef typename Distance::ElementType ElementType; typedef typename Distance::ResultType DistanceType; public: Index(const IndexParams& params, Distance distance = Distance() ); Index(const Matrix& points, const IndexParams& params, Distance distance = Distance() ); ~Index(); void buildIndex(); void buildIndex(const Matrix& points); void addPoints(const Matrix& points, float rebuild_threshold = 2); void removePoint(size_t point_id); ElementType* getPoint(size_t point_id); int knnSearch(const Matrix& queries, Matrix& indices, Matrix& dists, size_t knn, const SearchParams& params); int knnSearch(const Matrix& queries, std::vector< std::vector >& indices, std::vector >& dists, size_t knn, const SearchParams& params); int radiusSearch(const Matrix& queries, Matrix& indices, Matrix& dists, float radius, const SearchParams& params); int radiusSearch(const Matrix& queries, std::vector< std::vector >& indices, std::vector >& dists, float radius, const SearchParams& params); void save(std::string filename); int veclen() const; int size() const; IndexParams getParameters() const; flann_algorithm_t getType() const; }; } \end{Verbatim} \textbf{The Distance functor} The distance functor is a class whose \texttt{operator()} computes the distance between two features. If the distance is also a kd-tree compatible distance it should also provide an \texttt{accum\_dist()} method that computes the distance between individual feature dimensions. A typical distance functor looks like this (see the \texttt{dist.h} file for more examples): \begin{Verbatim}[fontsize=\footnotesize,frame=single] template struct L2 { typedef bool is_kdtree_distance; typedef T ElementType; typedef typename Accumulator::Type ResultType; template ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const { ResultType result = ResultType(); ResultType diff; for(size_t i = 0; i < size; ++i ) { diff = *a++ - *b++; result += diff*diff; } return result; } template inline ResultType accum_dist(const U& a, const V& b, int) const { return (a-b)*(a-b); } }; \end{Verbatim} In addition to \texttt{operator()} and \texttt{accum\_dist()}, a distance functor should also define the \texttt{ElementType} and the \texttt{ResultType} as the types of the elements it operates on and the type of the result it computes. If a distance functor can be used as a kd-tree distance (meaning that the full distance between a pair of features can be accumulated from the partial distances between the individual dimensions) a typedef \texttt{is\_kdtree\_distance} should be present inside the distance functor. If the distance is not a kd-tree distance, but it's a distance in a vector space (the individual dimensions of the elements it operates on can be accessed independently) a typedef \texttt{is\_vector\_space\_distance} should be defined inside the functor. If neither typedef is defined, the distance is assumed to be a metric distance and will only be used with indexes operating on generic metric distances. \\ \textbf{flann::Index::Index} Constructs a nearest neighbor search index for a given dataset. \begin{Verbatim}[fontsize=\footnotesize,frame=single] Index(const IndexParams& params, Distance distance = Distance() ); Index(const Matrix& points, const IndexParams& params, Distance distance = Distance() ); \end{Verbatim} \begin{description} \item[features] Matrix containing the features(points) that should be indexed, stored in a row-major order (one point on each row of the matrix). The size of the matrix is $num\_features \times dimensionality$. \item[params] Structure containing the index parameters. The type of index that will be constructed depends on the type of this parameter. The possible parameter types are: \textbf{LinearIndexParams} When passing an object of this type, the index will perform a linear, brute-force search. \begin{Verbatim}[fontsize=\footnotesize] struct LinearIndexParams : public IndexParams { }; \end{Verbatim} \textbf{KDTreeIndexParams} When passing an object of this type the index constructed will consist of a set of randomized kd-trees which will be searched in parallel. \begin{Verbatim}[fontsize=\footnotesize] struct KDTreeIndexParams : public IndexParams { KDTreeIndexParams( int trees = 4 ); }; \end{Verbatim} \begin{description} \item[trees] The number of parallel kd-trees to use. Good values are in the range [1..16] \end{description} \textbf{KMeansIndexParams} When passing an object of this type the index constructed will be a hierarchical k-means tree. \begin{Verbatim}[fontsize=\footnotesize] struct KMeansIndexParams : public IndexParams { KMeansIndexParams( int branching = 32, int iterations = 11, flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM, float cb_index = 0.2 ); }; \end{Verbatim} \begin{description} \item[branching]{ The branching factor to use for the hierarchical k-means tree } \item[iterations]{ The maximum number of iterations to use in the k-means clustering stage when building the k-means tree. If a value of -1 is used here, it means that the k-means clustering should be iterated until convergence} \item[centers\_init]{ The algorithm to use for selecting the initial centers when performing a k-means clustering step. The possible values are CENTERS\_RANDOM (picks the initial cluster centers randomly), CENTERS\_GONZALES (picks the initial centers using Gonzales' algorithm) and CENTERS\_KMEANSPP (picks the initial centers using the algorithm suggested in \cite{arthur_kmeanspp_2007}) } \item[cb\_index]{ This parameter (cluster boundary index) influences the way exploration is performed in the hierarchical kmeans tree. When \texttt{cb\_index} is zero the next kmeans domain to be explored is choosen to be the one with the closest center. A value greater then zero also takes into account the size of the domain.} \end{description} \textbf{CompositeIndexParams} When using a parameters object of this type the index created combines the randomized kd-trees and the hierarchical k-means tree. \begin{Verbatim}[fontsize=\footnotesize] struct CompositeIndexParams : public IndexParams { CompositeIndexParams( int trees = 4, int branching = 32, int iterations = 11, flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM, float cb_index = 0.2 ); }; \end{Verbatim} \textbf{KDTreeSingleIndexParams} When passing an object of this type the index will contain a single kd-tree optimized for searching lower dimensionality data (for example 3D point clouds) \begin{Verbatim}[fontsize=\footnotesize] struct KDTreeSingleIndexParams : public IndexParams { KDTreeSingleIndexParams( int leaf_max_size = 10 ); }; \end{Verbatim} \begin{description} \item[max\_leaf\_size] The maximum number of points to have in a leaf for not branching the tree any more. \end{description} \textbf{KDTreeCuda3dIndexParams} When passing an object of this type the index will be a single kd-tree that is built and performs searches on a CUDA compatible GPU. Search performance is best for large numbers of search and query points. For more information, see section \ref{sec:flann::cuda} \begin{Verbatim}[fontsize=\footnotesize] struct KDTreeCuda3dIndexParams : public IndexParams { KDTreeCuda3dIndexParams( int leaf_max_size = 64 ); }; \end{Verbatim} \begin{description} \item[max\_leaf\_size] The maximum number of points to have in a leaf for not branching the tree any more. \end{description} \textbf{HierarchicalClusteringIndexParams} When passing an object of this type the index constructed will be a hierarchical clustering index. This type of index works with any metric distance and can be used for matching binary features using Hamming distances. \begin{Verbatim}[fontsize=\footnotesize] struct HierarchicalClusteringIndexParams : public IndexParams { HierarchicalClusteringIndexParams(int branching = 32, flann_centers_init_t centers_init = FLANN_CENTERS_RANDOM, int trees = 4, int leaf_max_size = 100) }; \end{Verbatim} \begin{description} \item[branching]{ The branching factor to use for the hierarchical clustering tree } \item[centers\_init]{ The algorithm to use for selecting the initial centers when performing a k-means clustering step. The possible values are CENTERS\_RANDOM (picks the initial cluster centers randomly), CENTERS\_GONZALES (picks the initial centers using Gonzales' algorithm) and CENTERS\_KMEANSPP (picks the initial centers using the algorithm suggested in \cite{arthur_kmeanspp_2007}) } \item[trees] The number of parallel trees to use. Good values are in the range [3..8] \item[leaf\_size] The maximum number of points a leaf node should contain. \end{description} \textbf{LshIndexParams} When passing an object of this type the index constructed will be a multi-probe LSH (Locality-Sensitive Hashing) index. This type of index can only be used for matching binary features using Hamming distances. \begin{Verbatim}[fontsize=\footnotesize] struct LshIndexParams : public IndexParams { LshIndexParams(unsigned int table_number = 12, unsigned int key_size = 20, unsigned int multi_probe_level = 2); }; \end{Verbatim} \begin{description} \item[table\_number]{ The number of hash tables to use } \item[key\_size]{ The length of the key in the hash tables} \item[multi\_probe\_level] Number of levels to use in multi-probe (0 for standard LSH) \end{description} \textbf{AutotunedIndexParams} When passing an object of this type the index created is automatically tuned to offer the best performance, by choosing the optimal index type (randomized kd-trees, hierarchical kmeans, linear) and parameters for the dataset provided. \begin{Verbatim}[fontsize=\footnotesize] struct AutotunedIndexParams : public IndexParams { AutotunedIndexParams( float target_precision = 0.9, float build_weight = 0.01, float memory_weight = 0, float sample_fraction = 0.1 ); }; \end{Verbatim} \begin{description} \item[target\_precision]{ Is a number between 0 and 1 specifying the percentage of the approximate nearest-neighbor searches that return the exact nearest-neighbor. Using a higher value for this parameter gives more accurate results, but the search takes longer. The optimum value usually depends on the application. } \item[build\_weight]{ Specifies the importance of the index build time raported to the nearest-neighbor search time. In some applications it's acceptable for the index build step to take a long time if the subsequent searches in the index can be performed very fast. In other applications it's required that the index be build as fast as possible even if that leads to slightly longer search times.} \item[memory\_weight]{Is used to specify the tradeoff between time (index build time and search time) and memory used by the index. A value less than 1 gives more importance to the time spent and a value greater than 1 gives more importance to the memory usage.} \item[sample\_fraction]{Is a number between 0 and 1 indicating what fraction of the dataset to use in the automatic parameter configuration algorithm. Running the algorithm on the full dataset gives the most accurate results, but for very large datasets can take longer than desired. In such case using just a fraction of the data helps speeding up this algorithm while still giving good approximations of the optimum parameters.} \end{description} \textbf{SavedIndexParams} This object type is used for loading a previously saved index from the disk. \begin{Verbatim}[fontsize=\footnotesize] struct SavedIndexParams : public IndexParams { SavedIndexParams( std::string filename ); }; \end{Verbatim} \begin{description} \item[filename]{ The filename in which the index was saved. } \end{description} \end{description} \subsubsection{flann::Index::buildIndex} Builds the nearest neighbor search index. There are two versions of the \texttt{buildIndex} method, one that uses the points provided as argument and one that uses the points provided to the constructor when the object was constructed. \begin{Verbatim}[fontsize=\footnotesize,frame=single] void buildIndex(); void buildIndex(const Matrix& points); \end{Verbatim} \subsubsection{flann::Index::addPoints} The \texttt{addPoints} method can be used to incrementally add points to the index after the index was build. To avoid the index getting unbalanced, the \texttt{addPoints} method has the option of rebuilding the index after a large number of points have been added. The \texttt{rebuild\_threshold} parameter controls when the index is rebuild, by default this is done when it doubles in size (\texttt{rebuild\_threshold} = 2). \begin{Verbatim}[fontsize=\footnotesize,frame=single] void addPoints(const Matrix& points, float rebuild_threshold = 2); \end{Verbatim} \subsubsection{flann::Index::removePoint} The \texttt{removePoint} method removes one point with the specified \texttt{point\_id} from the index. The indices (of the remaining points) returned by the nearest neighbor operations do not change when points are removed from the index. \begin{Verbatim}[fontsize=\footnotesize,frame=single] void removePoint(size_t point_id); \end{Verbatim} \subsubsection{flann::Index::getPoint} The \texttt{getPoint} method returns a pointer to the data point with the specified \texttt{point\_id}. \begin{Verbatim}[fontsize=\footnotesize,frame=single] ElementType* getPoint(size_t point_id); \end{Verbatim} \subsubsection{flann::Index::knnSearch} Performs a K-nearest neighbor search for a set of query points. There are two signatures for this method, one that takes pre-allocated \texttt{flann::Matrix} objects for returning the indices of and distances to the neighbors found, and one that takes \texttt{std::vector} that will re resized automatically as needed. \begin{Verbatim}[fontsize=\footnotesize,frame=single] int Index::knnSearch(const Matrix& queries, Matrix& indices, Matrix& dists, size_t knn, const SearchParams& params); int Index::knnSearch(const Matrix& queries, std::vector< std::vector >& indices, std::vector >& dists, size_t knn, const SearchParams& params); \end{Verbatim} \begin{description} \item[queries]{Matrix containing the query points. Size of matrix is ($num\_queries \times dimentionality $)} \item[indices]{Matrix that will contain the indices of the K-nearest neighbors found (size should be at least $num\_queries \times knn$ for the pre-allocated version).} \item[dists]{Matrix that will contain the distances to the K-nearest neighbors found (size should be at least $num\_queries \times knn$ for the pre-allocated version). \\ \emph{Note:} For Euclidean distances, the \texttt{flann::L2} functor computes squared distances, so the value passed here needs to be a squared distance as well. } \item[knn]{Number of nearest neighbors to search for.} \item[params]{Search parameters.} Structure containing parameters used during search. \textbf{SearchParameters} \begin{Verbatim}[fontsize=\footnotesize] struct SearchParams { SearchParams(int checks = 32, float eps = 0, bool sorted = true); int checks; float eps; bool sorted; int max_neighbors; tri_type use_heap; int cores; bool matrices_in_gpu_ram; }; \end{Verbatim} \begin{description} \item[checks] specifies the maximum leafs to visit when searching for neighbours. A higher value for this parameter would give better search precision, but also take more time. For all leafs to be checked use the value \texttt{FLANN\_CHECKS\_UNLIMITED}. If automatic configuration was used when the index was created, the number of checks required to achieve the specified precision was also computed, to use that value specify \texttt{FLANN\_CHECKS\_AUTOTUNED}. \item[eps] Search for eps-approximate neighbors (only used by KDTreeSingleIndex and KDTreeCuda3dIndex). \item[sorted] Used only by radius search, specifies if the neighbors returned should be sorted by distance. \item[max\_neighbours] Specifies the maximum number of neighbors radius search should return (default: -1 = unlimited). Only used for radius search. \item[use\_heap] Use a heap data structure to manage the list of neighbors internally (possible values: FLANN\_False, FLANN\_True, FLANN\_Undefined). A heap is more efficient for a large number of neighbors and less efficient for a small number of neighbors. Default value is FLANN\_Undefined, which lets the code choose the best option depending on the number of neighbors requested. Only used for KNN search. \item[cores] How many cores to assign to the search (specify 0 for automatic core selection). \item[matrices\_in\_gpu\_ram] for GPU search indicates if matrices are already in GPU ram. \end{description} \end{description} \subsubsection{flann::Index::radiusSearch} Performs a radius nearest neighbor search for a set of query points. There are two signatures for this method, one that takes pre-allocated \texttt{flann::Matrix} objects for returning the indices of and distances to the neighbors found, and one that takes \texttt{std::vector} that will resized automatically as needed. \begin{Verbatim}[fontsize=\footnotesize,frame=single] int Index::radiusSearch(const Matrix& queries, Matrix& indices, Matrix& dists, float radius, const SearchParams& params); int Index::radiusSearch(const Matrix& queries, std::vector< std::vector >& indices, std::vector >& dists, float radius, const SearchParams& params); \end{Verbatim} \begin{description} \item[queries]{The query point. Size of matrix is ($num\_queries \times dimentionality $).} \item[indices]{Matrix that will contain the indices of the K-nearest neighbors found. For the pre-allocated version, only as many neighbors are returned as many columns in this matrix. If fewer neighbors are found than columns in this matrix, the element after that last index returned is -1. In case of the std::vector version, the rows will be resized as needed to fit all the neighbors to be returned, except if the ``max\_neighbors'' search parameter is set.} \item[dists]{Matrix that will contain the distances to the K-nearest neighbors found. The same number of values are returned here as for the \texttt{indices} matrix. \\ \emph{Note:} For Euclidean distances, the \texttt{flann::L2} functor computes squared distances, so the value passed here needs to be a squared distance as well.} \item[radius]{The search radius. \\ \emph{Note:} For Euclidean distances, the \texttt{flann::L2} functor computes squared distances, so the value passed here needs to be a squared distance as well.} \item[params]{Search parameters.} \end{description} The method returns the number of nearest neighbors found. \subsubsection{flann::Index::save} Saves the index to a file. \begin{Verbatim}[fontsize=\footnotesize,frame=single] void Index::save(std::string filename); \end{Verbatim} \begin{description} \item[filename]{The file to save the index to} \end{description} \subsubsection{flann::hierarchicalClustering} \label{flann::hierarchicalClustering} Clusters the given points by constructing a hierarchical k-means tree and choosing a cut in the tree that minimizes the clusters' variance. \begin{Verbatim}[fontsize=\footnotesize,frame=single] template int hierarchicalClustering(const Matrix& points, Matrix& centers, const KMeansIndexParams& params, Distance d = Distance()) \end{Verbatim} \begin{description} \item[features]{The points to be clustered} \item[centers]{The centers of the clusters obtained. The number of rows in this matrix represents the number of clusters desired. However, because of the way the cut in the hierarchical tree is choosen, the number of clusters computed will be the highest number of the form $(branching-1)*k+1$ that's lower than the number of clusters desired, where $branching$ is the tree's branching factor (see description of the KMeansIndexParams). } \item[params]{Parameters used in the construction of the hierarchical k-means tree} \end{description} The function returns the number of clusters computed. \subsubsection{flann::KdTreeCuda3dIndex} \label{sec:flann::cuda} FLANN provides a CUDA implementation of the kd-tree build and search algorithms to improve the build and query speed for large 3d data sets. This section will provide all the necessary information to use the \texttt{KdTreeCuda3dIndex} index type. \textbf{Building:} If CMake detects a CUDA install during the build (see section \ref{sec:downloading_and_compiling}), a library \texttt{libflann\_cuda.so} will be built. \textbf{Basic Usage:} To be able to use the new index type, you have to include the FLANN header this way: \begin{Verbatim}[fontsize=\footnotesize,frame=single] #define FLANN_USE_CUDA #include \end{Verbatim} If you define the symbol \texttt{FLANN\_USE\_CUDA} before including the FLANN header, you will have to link \texttt{libflann\_cuda.so} or \texttt{libflann\_cuda\_s.a} with your project. However, you will not have to compile your source code with \texttt{nvcc}, except if you use other CUDA code, of course. You can then create your index by using the \texttt{KDTreeCuda3dIndexParams} to create the index. The index will take care of copying all the data from and to the GPU for you, both for index creation and search. A word of caution: A general guideline for deciding whether to use the CUDA kd tree or a (multi-threaded) CPU implementation is hard to give, since it depends on the combination of CPU and GPU in each system and the data sets. For example, on a system with a Phenom II 955 CPU and a Geforce GTX 260 GPU, the maximum search speedup on a synthetic (random) data set is a factor of about 8-9 vs the single-core CPU search, and starts to be reached at about 100k search and query points. (This includes transfer times.) Build time does not profit as much from the GPU acceleration; here the benefit is about 2x at 200k points, but this largely depends on the data set. The only way to know which implementation is best suited is to try it. \textbf{Advanced Usage:} In some cases, you might already have your data in a buffer on the GPU. In this case, you can re-use these buffers instead of copying the buffers back to system RAM for index creation and search. The way to do this is to pass GPU pointers via the \texttt{flann::Matrix} inputs and tell the index via the index and search params to treat the pointers as GPU pointers. \begin{Verbatim}[fontsize=\footnotesize,frame=single] thrust::device_vector points_vector( n_points ); // ... fill vector here... float* gpu_pointer = (float*)thrust::raw_pointer_cast(&points_vector[0]); flann::Matrix matrix_gpu(gpu_pointer,n_points,3, 4); flann::KDTreeCuda3dIndexParams params; params["input_is_gpu_float4"]=true; flann::Index > flannindex( matrix_gpu, params ); flannindex.buildIndex(); \end{Verbatim} \begin{description} \item First, a GPU buffer of float4 values is created and filled with points. \footnote{For index creation, only \texttt{float4} points are supported, \texttt{float3} or structure-of-array (SOA) representations are currently not supported since \texttt{float4} proved to be best in terms of access speed for tree creation and search.} \item Then, a GPU pointer to the buffer is stored in a flann matrix with 3 columns and a stride of 4 (the last element in the \texttt{float4} should be zero). \item Last, the index is created. The \texttt{input\_is\_gpu\_float4} flag tells the index to treat the matrix as a gpu buffer. \end{description} Similarly, you can specify GPU buffers for the search routines that return the result via flann matrices (but not for those that return them via \texttt{std::vector}s). To do this, the pointers in the index and dist matrices have to point to GPU buffers and the \texttt{cols} value has to be set to 3 (as we are dealing with 3d points). Here, any value for \texttt{stride} can be used. \begin{Verbatim}[fontsize=\footnotesize,frame=single] flann::Matrix indices_gpu(gpu_pointer_indices,n_points, knn, stride); flann::Matrix dists_gpu(gpu_pointer_dists,n_points, knn, stride); flann::SearchParams params; params.matrices_in_gpu_ram = true; flannindex.knnSearch( queries_gpu ,indices_gpu,dists_gpu,knn, params); \end{Verbatim} \begin{description} \item Note that you cannot mix matrices in system and CPU ram here! \end{description} \textbf{Search Parameters:} The search routines support three parameters: \begin{itemize} \item \texttt{eps} - used for approximate knn search. The maximum possible error is $e= d_{best} * eps$, i.e. the distance of the returned neighbor is at maximum $eps$ times larget than the distance to the real best neighbor. \item \texttt{use\_heap} - used in knn and radius search. If set to true, a heap structure will be used in the search to keep track of the distance to the farthest neighbor. Beneficial with about $k>64$ elements. \item \texttt{sorted} - if set to true, the results of the radius and knn searches will be sorted in ascending order by their distance to the query point. \item \texttt{matrices\_in\_gpu\_ram} - set to true to indicate that all (input and output) matrices are located in GPU RAM. \end{itemize} \subsection{Using FLANN from C} FLANN can be used in C programs through the C bindings provided with the library. Because there is no template support in C, there are bindings provided for the following data types: \texttt{unsigned char}, \texttt{int}, \texttt{float} and \texttt{double}. For each of the functions below there is a corresponding version for each of the for data types, for example for the function: \begin{Verbatim}[fontsize=\footnotesize,frame=single] flan_index_t flann_build_index(float* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); \end{Verbatim} there are also the following versions: \begin{Verbatim}[fontsize=\footnotesize,frame=single] flan_index_t flann_build_index_byte(unsigned char* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); flan_index_t flann_build_index_int(int* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); flan_index_t flann_build_index_float(float* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); flan_index_t flann_build_index_double(double* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); \end{Verbatim} \subsubsection{flann\_build\_index()} \begin{Verbatim}[fontsize=\footnotesize,frame=single] flan_index_t flann_build_index(float* dataset, int rows, int cols, float* speedup, struct FLANNParameters* flann_params); \end{Verbatim} This function builds an index and return a reference to it. The arguments expected by this function are as follows: \begin{description} \item[dataset, rows and cols] - are used to specify the input dataset of points: dataset is a pointer to a $\rm{rows} \times \rm{cols}$ matrix stored in row-major order (one feature on each row) \item [speedup] - is used to return the approximate speedup over linear search achieved when using the automatic index and parameter configuration (see section \ref{sec:flann_build_index}) \item [flann\_params] - is a structure containing the parameters passed to the function. This structure is defined as follows: \begin{Verbatim}[fontsize=\footnotesize] struct FLANNParameters { enum flann_algorithm_t algorithm; /* the algorithm to use */ /* search time parameters */ int checks; /* how many leafs (features) to check in one search */ float eps; /* eps parameter for eps-knn search */ int sorted; /* indicates if results returned by radius search should be sorted or not */ int max_neighbors; /* limits the maximum number of neighbors should be returned by radius search */ int cores; /* number of paralel cores to use for searching */ /* kdtree index parameters */ int trees; /* number of randomized trees to use (for kdtree) */ int leaf_max_size; /* kmeans index parameters */ int branching; /* branching factor (for kmeans tree) */ int iterations; /* max iterations to perform in one kmeans cluetering (kmeans tree) */ enum flann_centers_init_t centers_init; /* algorithm used for picking the initial cluster centers for kmeans tree */ float cb_index; /* cluster boundary index. Used when searching the kmeans tree */ /* autotuned index parameters */ float target_precision; /* precision desired (used for autotuning, -1 otherwise) */ float build_weight; /* build tree time weighting factor */ float memory_weight; /* index memory weigthing factor */ float sample_fraction; /* what fraction of the dataset to use for autotuning */ /* LSH parameters */ unsigned int table_number_; /** The number of hash tables to use */ unsigned int key_size_; /** The length of the key in the hash tables */ unsigned int multi_probe_level_; /** Number of levels to use in multi-probe LSH, 0 for standard LSH */ /* other parameters */ enum flann_log_level_t log_level; /* determines the verbosity of each flann function */ long random_seed; /* random seed to use */ }; \end{Verbatim} The \texttt{algorithm} and \texttt{centers\_init} fields can take the following values: \begin{Verbatim}[fontsize=\footnotesize] enum flann_algorithm_t { FLANN_INDEX_LINEAR = 0, FLANN_INDEX_KDTREE = 1, FLANN_INDEX_KMEANS = 2, FLANN_INDEX_COMPOSITE = 3, FLANN_INDEX_KDTREE_SINGLE = 4, FLANN_INDEX_HIERARCHICAL = 5, FLANN_INDEX_LSH = 6, FLANN_INDEX_KDTREE_CUDA = 7, // available if compiled with CUDA FLANN_INDEX_SAVED = 254, FLANN_INDEX_AUTOTUNED = 255, }; enum flann_centers_init_t { FLANN_CENTERS_RANDOM = 0, FLANN_CENTERS_GONZALES = 1, FLANN_CENTERS_KMEANSPP = 2 }; \end{Verbatim} The \texttt{algorithm} field is used to manually select the type of index used. The \texttt{centers\_init} field specifies how to choose the inital cluster centers when performing the hierarchical k-means clustering (in case the algorithm used is k-means): \texttt{FLANN\_CENTERS\_RANDOM} chooses the initial centers randomly, \texttt{FLANN\_CENTERS\_GONZALES} chooses the initial centers to be spaced apart from each other by using Gonzales' algorithm and \texttt{FLANN\_CENTERS\_KMEANSPP} chooses the initial centers using the algorithm proposed in \cite{arthur_kmeanspp_2007}. The fields: \texttt{checks}, \texttt{cb\_index}, \texttt{trees}, \texttt{branching}, \texttt{iterations}, \texttt{target\_precision}, \texttt{build\_weight}, \texttt{memory\_weight} and \texttt{sample\_fraction} have the same meaning as described in \ref{sec:flann::Index}. The \texttt{random\_seed} field contains the random seed useed to initialize the random number generator. The field \texttt{log\_level} controls the verbosity of the messages generated by the FLANN library functions. It can take the following values: \begin{Verbatim}[fontsize=\footnotesize] enum flann_log_level_t { FLANN_LOG_NONE = 0, FLANN_LOG_FATAL = 1, FLANN_LOG_ERROR = 2, FLANN_LOG_WARN = 3, FLANN_LOG_INFO = 4, FLANN_LOG_DEBUG = 5 }; \end{Verbatim} \end{description} \subsubsection{flann\_find\_nearest\_neighbors\_index()} \begin{Verbatim}[fontsize=\footnotesize,frame=single] int flann_find_nearest_neighbors_index(flann_index_t index_id, float* testset, int trows, int* indices, float* dists, int nn, struct FLANNParameters* flann_params); \end{Verbatim} This function searches for the nearest neighbors of the \texttt{testset} points using an index already build and referenced by \texttt{index\_id}. The \texttt{testset} is a matrix stored in row-major format with \texttt{trows} rows and the same number of columns as the dimensionality of the points used to build the index. The function computes \texttt{nn} nearest neighbors for each point in the \texttt{testset} and stores them in the \texttt{indices} matrix (which is a $\rm{trows} \times \rm{nn}$ matrix stored in row-major format). The memory for the \texttt{result} matrix must be allocated before the \texttt{flann\_find\_nearest\_neighbors\_index()} function is called. The distances to the nearest neighbors found are stored in the \texttt{dists} matrix. \subsubsection{flann\_find\_nearest\_neighbors()} \begin{Verbatim}[fontsize=\footnotesize,frame=single] int flann_find_nearest_neighbors(float* dataset, int rows, int cols, float* testset, int trows, int* indices, float* dists, int nn, struct FLANNParameters* flann_params); \end{Verbatim} This function is similar to the \texttt{flann\_find\_nearest\_neighbors\_index()} function, but instread of using a previously constructed index, it constructs the index, does the nearest neighbor search and deletes the index in one step. \subsubsection{flann\_radius\_search()} \begin{Verbatim}[fontsize=\footnotesize,frame=single] int flann_radius_search(flann_index_t index_ptr, /* the index */ float* query, /* query point */ int* indices, /* array for storing the indices found (will be modified) */ float* dists, /* similar, but for storing distances */ int max_nn, /* size of arrays indices and dists */ float radius, /* search radius (squared radius for euclidian metric) */ struct FLANNParameters* flann_params); \end{Verbatim} This function performs a radius search to single query point. The indices of the neighbors found and the distances to them are stored in the \texttt{indices} and dists \texttt{arrays}. The \texttt{max\_nn} parameter sets the limit of the neighbors that will be returned (the size of the \texttt{indices} and \texttt{dists} arrays must be at least \texttt{max\_nn}). \subsubsection{flann\_save\_index()} \begin{Verbatim}[fontsize=\footnotesize,frame=single] int flann_save_index(flann_index_t index_id, char* filename); \end{Verbatim} This function saves an index to a file. The dataset for which the index was built is not saved with the index. \subsubsection{flann\_load\_index()} \begin{Verbatim}[fontsize=\footnotesize,frame=single] flann_index_t flann_load_index(char* filename, float* dataset, int rows, int cols); \end{Verbatim} This function loads a previously saved index from a file. Since the dataset is not saved with the index, it must be provided to this function. \subsubsection{flann\_free\_index()} \begin{Verbatim}[fontsize=\footnotesize,frame=single] int flann_free_index(flann_index_t index_id, struct FLANNParameters* flann_params); \end{Verbatim} This function deletes a previously constructed index and frees all the memory used by it. \subsubsection{flann\_set\_distance\_type} \label{flann::setDistanceType} This function chooses the distance function to use when computing distances between data points. \begin{Verbatim}[fontsize=\footnotesize,frame=single] void flann_set_distance_type(enum flann_distance_t distance_type, int order); \end{Verbatim} \begin{description} \item[distance\_type] The distance type to use. Possible values are \begin{Verbatim}[fontsize=\footnotesize] enum flann_distance_t { FLANN_DIST_EUCLIDEAN = 1, FLANN_DIST_L2 = 1, FLANN_DIST_MANHATTAN = 2, FLANN_DIST_L1 = 2, FLANN_DIST_MINKOWSKI = 3, FLANN_DIST_MAX = 4, FLANN_DIST_HIST_INTERSECT = 5, FLANN_DIST_HELLINGER = 6, FLANN_DIST_CHI_SQUARE = 7, FLANN_DIST_KULLBACK_LEIBLER = 8, FLANN_DIST_HAMMING = 9, FLANN_DIST_HAMMING_LUT = 10, FLANN_DIST_HAMMING_POPCNT = 11, FLANN_DIST_L2_SIMPLE = 12, }; \end{Verbatim} \item[order] Used in for the \texttt{FLANN\_DIST\_MINKOWSKI} distance type, to choose the order of the Minkowski distance. \end{description} \subsubsection{flann\_compute\_cluster\_centers()} Performs hierarchical clustering of a set of points (see \ref{flann::hierarchicalClustering}). \begin{Verbatim}[fontsize=\footnotesize,frame=single] int flann_compute_cluster_centers(float* dataset, int rows, int cols, int clusters, float* result, struct FLANNParameters* flann_params); \end{Verbatim} \bigskip See section \ref{sec:quickstart} for an example of how to use the C/C++ bindings. \subsection{Using FLANN from MATLAB} The FLANN library can be used from MATLAB through the following wrapper functions: \texttt{flann\_build\_index}, \texttt{flann\_search}, \texttt{flann\_save\_index}, \texttt{flann\_load\_index}, \texttt{flann\_set\_distance\_type} and \texttt{flann\_free\_index}. The \texttt{flann\_build\_index} function creates a search index from the dataset points, \texttt{flann\_search} uses this index to perform nearest-neighbor searches, \texttt{flann\_save\_index} and \texttt{flann\_load\_index} can be used to save and load an index to/from disk, \texttt{flann\_set\_distance\_type} is used to set the distance type to be used when building an index and \texttt{flann\_free\_index} deletes the index and releases the memory it uses. % Note that in the binary distribution of FLANN the MEX file is linked against % the shared version of FLANN (\texttt{flann.so} or \texttt{flann.dll}), so on Linux you must set the % LD\_LIBRARY\_PATH environment variable accordingly prior to starting MATLAB. On Windows is enough % to have \texttt{flann.dll} in the same directory with the MEX file. The following sections describe in more detail the FLANN matlab wrapper functions and show examples of how they may be used. \subsubsection{flann\_build\_index} \label{sec:flann_build_index} This function creates a search index from the initial dataset of points, index used later for fast nearest-neighbor searches in the dataset. \begin{Verbatim}[fontsize=\footnotesize,frame=single] [index, parameters, speedup] = flann_build_index(dataset, build_params); \end{Verbatim} The arguments passed to the \texttt{flann\_build\_index} function have the following meaning: \begin{description} \item [\texttt{dataset}] is a $d \times n$ matrix containing $n$ $d$-dimensional points, stored in a column-major order (one feature on each column) \item [\texttt{build\_params}] - is a MATLAB structure containing the parameters passed to the function. \end{description} The \texttt{build\_params} is used to specify the type of index to be built and the index parameters. These have a big impact on the performance of the new search index (nearest-neighbor search time) and on the time and memory required to build the index. The optimum parameter values depend on the dataset characteristics (number of dimensions, distribution of points in the dataset) and on the application domain (desired precision for the approximate nearest neighbor searches). The \texttt{build\_params} argument is a structure that contains one or more of the following fields: \begin{description} \item[\texttt{algorithm}] - the algorithm to use for building the index. The possible values are: \texttt{'linear'}, \texttt{'kdtree'}, \texttt{'kmeans'}, \texttt{'composite'} or \texttt{'autotuned'}. The \texttt{'linear'} option does not create any index, it uses brute-force search in the original dataset points, \texttt{'kdtree'} creates one or more randomized kd-trees, \texttt{'kmeans'} creates a hierarchical kmeans clustering tree, \texttt{'composite'} is a mix of both kdtree and kmeans trees and the \texttt{'autotuned'} automatically determines the best index and optimum parameters using a cross-validation technique. \vspace{0.5cm} \hspace{-1cm} \textbf{Autotuned index:} in case the algorithm field is \texttt{'autotuned'}, the following fields should also be present: \item[\texttt{target\_precision}] - is a number between 0 and 1 specifying the percentage of the approximate nearest-neighbor searches that return the exact nearest-neighbor. Using a higher value for this parameter gives more accurate results, but the search takes longer. The optimum value usually depends on the application. \item[\texttt{build\_weight}] - specifies the importance of the index build time raported to the nearest-neighbor search time. In some applications it's acceptable for the index build step to take a long time if the subsequent searches in the index can be performed very fast. In other applications it's required that the index be build as fast as possible even if that leads to slightly longer search times. (Default value: 0.01) \item[\texttt{memory\_weight}] - is used to specify the tradeoff between time (index build time and search time) and memory used by the index. A value less than 1 gives more importance to the time spent and a value greater than 1 gives more importance to the memory usage. \item[\texttt{sample\_fraction}] - is a number between 0 and 1 indicating what fraction of the dataset to use in the automatic parameter configuration algorithm. Running the algorithm on the full dataset gives the most accurate results, but for very large datasets can take longer than desired. In such case, using just a fraction of the data helps speeding up this algorithm, while still giving good approximations of the optimum parameters. \vspace{0.5cm} \hspace{-1cm} \textbf{Randomized kd-trees index:} in case the algorithm field is \texttt{'kdtree'}, the following fields should also be present: \item[\texttt{trees}] - the number of randomized kd-trees to create. \vspace{0.5cm} \hspace{-1cm} \textbf{Hierarchical k-means index:} in case the algorithm type is \texttt{'means'}, the following fields should also be present: \item[\texttt{branching}] - the branching factor to use for the hierarchical kmeans tree creation. While kdtree is always a binary tree, each node in the kmeans tree may have several branches depending on the value of this parameter. \item[\texttt{iterations}] - the maximum number of iterations to use in the kmeans clustering stage when building the kmeans tree. A value of -1 used here means that the kmeans clustering should be performed until convergence. \item[\texttt{centers\_init}] - the algorithm to use for selecting the initial centers when performing a kmeans clustering step. The possible values are 'random' (picks the initial cluster centers randomly), 'gonzales' (picks the initial centers using the Gonzales algorithm) and 'kmeanspp' (picks the initial centers using the algorithm suggested in \cite{arthur_kmeanspp_2007}). If this parameters is omitted, the default value is 'random'. \item[\texttt{cb\_index}] - this parameter (cluster boundary index) influences the way exploration is performed in the hierarchical kmeans tree. When \texttt{cb\_index} is zero the next kmeans domain to be explored is choosen to be the one with the closest center. A value greater then zero also takes into account the size of the domain. \vspace{0.5cm} \hspace{-1cm} \textbf{Composite index:} in case the algorithm type is \texttt{'composite'}, the fields from both randomized kd-tree index and hierarchical k-means index should be present. \end{description} The \texttt{flann\_build\_index} function returns the newly created \texttt{index}, the \texttt{parameters} used for creating the index and, if automatic configuration was used, an estimation of the \texttt{speedup} over linear search that is achieved when searching the index. Since the parameter estimation step is costly, it is possible to save the computed parameters and reuse them the next time an index is created from similar data points (coming from the same distribution). \subsubsection{flann\_search} This function performs nearest-neighbor searches using the index already created: \begin{Verbatim}[fontsize=\footnotesize,frame=single] [result, dists] = flann_search(index, testset, k, parameters); \end{Verbatim} The arguments required by this function are: \begin{description} \item[\texttt{index}] - the index returned by the \texttt{flann\_build\_index} function \item[\texttt{testset}] - a $d \times m$ matrix containing $m$ test points whose k-nearest-neighbors need to be found \item[\texttt{k}] - the number of nearest neighbors to be returned for each point from \texttt{testset} \item[\texttt{parameters}] - structure containing the search parameters. Currently it has only one member, \texttt{parameters.checks}, denoting the number of times the tree(s) in the index should be recursively traversed. A higher value for this parameter would give better search precision, but also take more time. If automatic configuration was used when the index was created, the number of checks required to achieve the specified precision is also computed. In such case, the parameters structure returned by the \texttt{flann\_build\_index} function can be passed directly to the \texttt{flann\_search} function. \end{description} The function returns two matrices, each of size $k \times m$. The first one contains, in which each column, the indexes (in the dataset matrix) of the $k$ nearest neighbors of the corresponding point from testset, while the second one contains the corresponding distances. The second matrix can be omitted when making the call if the distances to the nearest neighbors are not needed. For the case where a single search will be performed with each index, the \texttt{flann\_search} function accepts the dataset instead of the index as first argument, in which case the index is created searched and then deleted in one step. In this case the parameters structure passed to the \texttt{flann\_search} function must also contain the fields of the \texttt{build\_params} structure that would normally be passed to the \texttt{flann\_build\_index} function if the index was build separately. \begin{Verbatim} [result, dists] = flann_search(dataset, testset, k, parameters); \end{Verbatim} \subsubsection{flann\_save\_index} This function saves an index to a file so that it can be reused at a later time without the need to recompute it. Only the index will be saved to the file, not also the data points for which the index was created, so for the index to be reused the data points must be saved separately. \begin{Verbatim}[fontsize=\footnotesize,frame=single] flann_save_index(index, filename) \end{Verbatim} The argumenst required by this function are: \begin{description} \item[\texttt{index}] - the index to be saved, created by \texttt{flann\_build\_index} \item[\texttt{filename}] - the name of the file in which to save the index \end{description} \subsubsection{flann\_load\_index} This function loads a previously saved index from a file. It needs to be passed as a second parameter the dataset for which the index was created, as this is not saved together with the index. \begin{Verbatim}[fontsize=\footnotesize,frame=single] index = flann_load_index(filename, dataset) \end{Verbatim} The argumenst required by this function are: \begin{description} \item[\texttt{filename}] - the file from which to load the index \item[\texttt{dataset}] - the dataset for which the index was created \end{description} This function returns the index object. \subsubsection{flann\_set\_distance\_type} \label{matlab:flannSetDistanceType} This function chooses the distance function to use when computing distances between data points. \begin{Verbatim}[fontsize=\footnotesize,frame=single] flann_set_distance_type(type, order) \end{Verbatim} The argumenst required by this function are: \begin{description} \item[\texttt{type}] - the distance type to use. Possible values are: \texttt{'euclidean'}, \texttt{'manhattan'}, \texttt{'minkowski'}, \texttt{'max\_dist'} ($L\_{infinity}$ - distance type is not valid for kd-tree index type since it's not dimensionwise additive), \texttt{'hik'} (histogram intersection kernel), \texttt{'hellinger'},\texttt{'cs'} (chi-square) and \texttt{'kl'} (Kullback-Leibler). \item[\texttt{order}] - only used if distance type is \texttt{'minkowski'} and represents the order of the minkowski distance. \end{description} \subsubsection{flann\_free\_index} This function must be called to delete an index and release all the memory used by it: \begin{Verbatim}[fontsize=\footnotesize,frame=single] flann_free_index(index); \end{Verbatim} \subsubsection{Examples} Let's look at a few examples showing how the functions described above are used: \subsubsection{Example 1:} In this example the index is constructed using automatic parameter estimation, requesting 70\% as desired precision and using the default values for the build time and memory usage factors. The index is then used to search for the nearest-neighbors of the points in the testset matrix and finally the index is deleted. \begin{Verbatim}[fontsize=\footnotesize,frame=single] dataset = single(rand(128,10000)); testset = single(rand(128,1000)); build_params.algorithm = 'autotuned'; build_params.target_precision = 0.7; build_params.build_weight = 0.01; build_params.memory_weight = 0; [index, parameters] = flann_build_index(dataset, build_params); result = flann_search(index,testset,5,parameters); flann_free_index(index); \end{Verbatim} % \bibliographystyle{alpha} % \bibliography{references} \subsubsection{Example 2:} In this example the index constructed with the parameters specified manually. \begin{Verbatim}[fontsize=\footnotesize,frame=single] dataset = single(rand(128,10000)); testset = single(rand(128,1000)); index = flann_build_index(dataset,struct('algorithm','kdtree','trees',8)); result = flann_search(index,testset,5,struct('checks',128)); flann_free_index(index); \end{Verbatim} \subsubsection{Example 3:} In this example the index creation, searching and deletion are all performed in one step: \begin{Verbatim}[fontsize=\footnotesize,frame=single] dataset = single(rand(128,10000)); testset = single(rand(128,1000)); [result,dists] = flann_search(dataset,testset,5,struct('checks',128,'algorithm',... 'kmeans','branching',64,'iterations',5)); \end{Verbatim} \subsection{Using FLANN from python} The python bindings are automatically installed on the system with the FLANN library if the option \texttt{BUILD\_PYTHON\_BINDINGS} is enabled. You may need to set the \texttt{PYTHONPATH} to the location of the bindings if you installed FLANN in a non-standard location. The python bindings also require the numpy package to be installed. To use the python FLANN bindings the package \texttt{pyflann} must be imported (see the python example in section \ref{sec:quickstart}). This package contains a class called FLANN that handles the nearest-neighbor search operations. This class containg the following methods: \begin{description} \item [\texttt{def build\_index(self, dataset, **kwargs)}] :\\ This method builds and internally stores an index to be used for future nearest neighbor matchings. It erases any previously stored index, so in order to work with multiple indexes, multiple instances of the FLANN class must be used. The \texttt{dataset} argument must be a 2D numpy array or a matrix, stored in a row-major order (a feature on each row of the matrix). The rest of the arguments that can be passed to the method are the same as those used in the \texttt{build\_params} structure from section \ref{sec:flann_build_index}. Similar to the MATLAB version, the index can be created using manually specified parameters or the parameters can be automatically computed (by specifying the target\_precision, build\_weight and memory\_weight arguments). The method returns a dictionary containing the parameters used to construct the index. In case automatic parameter selection is used, the dictionary will also contain the number of checks required to achieve the desired target precision and an estimation of the speedup over linear search that the library will provide. \item [\texttt{def nn\_index(self, testset, num\_neighbors = 1, **kwargs)}] :\\ This method searches for the \texttt{num\_neighbors} nearest neighbors of each point in \texttt{testset} using the index computed by \texttt{build\_index}. Additionally, a parameter called checks, denoting the number of times the index tree(s) should be recursivelly searched, must be given. Example: \begin{Verbatim}[fontsize=\scriptsize,frame=single] from pyflann import * from numpy import * from numpy.random import * dataset = rand(10000, 128) testset = rand(1000, 128) flann = FLANN() params = flann.build_index(dataset, algorithm="autotuned", target_precision=0.9, log_level = "info"); print params result, dists = flann.nn_index(testset,5, checks=params["checks"]); \end{Verbatim} \item[\texttt{def nn(self, dataset, testset, num\_neighbors = 1, **kwargs)}]:\\ This method builds the index, performs the nearest neighbor search and deleted the index, all in one step. \item [\texttt{def save\_index(self, filename)}] :\\ This method saves the index to a file. The dataset from which the index was built is not saved. \item [\texttt{def load\_index(self, filename, pts)}] :\\ Load the index from a file. The dataset for which the index was built must also be provided since it is not saved with the index. \item [\texttt{def set\_distance\_type(distance\_type, order = 0)}] :\\ This function (part of the pyflann module) sets the distance type to be used. See \ref{matlab:flannSetDistanceType} for possible values of the distance\_type. \end{description} See section \ref{sec:quickstart} for an example of how to use the Python and Ruby bindings. \bibliographystyle{alpha} \bibliography{references} \end{document} flann-1.9.1+dfsg/doc/references.bib000066400000000000000000000253561275407571100171270ustar00rootroot00000000000000@inproceedings{arthur_kmeanspp_2007, title = {k-means++: the advantages of careful seeding}, booktitle = {Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms}, publisher = {Society for Industrial and Applied Mathematics Philadelphia, PA, USA}, author = {D. Arthur and S. Vassilvitskii}, year = {2007}, pages = {1027--1035} }, @inproceedings{winder_learning_2007, title = {Learning Local Image Descriptors}, doi = {10.1109/CVPR.2007.382971}, abstract = {In this paper we study interest point descriptors for image matching and 3D reconstruction. We examine the building blocks of descriptor algorithms and evaluate numerous combinations of components. Various published descriptors such as SIFT, GLOH, and Spin images can be cast into our framework. For each candidate algorithm we learn good choices for parameters using a training set consisting of patches from a multi-image 3D reconstruction where accurate ground-truth matches are known. The best descriptors were those with log polar histogramming regions and feature vectors constructed from rectified outputs of steerable quadrature filters. At a 95\% detection rate these gave one third of the incorrect matches produced by SIFT.}, booktitle = {CVPR}, author = {S.A.J. Winder and M. Brown}, year = {2007}, keywords = {3D image reconstruction,feature vectors,GLOH images,image reconstruction,local image descriptors,log polar histogramming,SIFT images,Spin images,steerable quadrature filters,vectors}, pages = {1-8} }, @article{arya_optimal_1998, title = {An optimal algorithm for approximate nearest neighbor searching in fixed dimensions}, volume = {45}, url = {citeseer.ist.psu.edu/article/arya94optimal.html}, journal = {Journal of the ACM}, author = {Sunil Arya and David M. Mount and Nathan S. Netanyahu and Ruth Silverman and Angela Y. Wu}, year = {1998}, pages = {891-923} }, @article{lowe_sift_2004, title = {Distinctive image features from scale-invariant keypoints}, volume = {60}, journal = {Int. Journal of Computer Vision}, author = {David G. Lowe}, year = {2004}, pages = {91-110} }, @inproceedings{liu_efficient_2003, title = {Efficient Exact k-NN and Nonparametric Classification in High Dimensions}, booktitle = {Neural Information Processing Systems}, author = {T. Liu and A. W. Moore and A. Gray}, year = {2003} }, @inproceedings{nister_scalable_2006, title = {Scalable Recognition with a Vocabulary Tree}, isbn = {0-7695-2597-0}, doi = {http://dx.doi.org/10.1109/CVPR.2006.264}, booktitle = {CVPR}, author = {David Nister and Henrik Stewenius}, year = {2006}, pages = {2161-2168} }, @inproceedings{beis_shape_1997, title = {Shape indexing using approximate nearest-neighbor search in high dimensional spaces}, url = {citeseer.ist.psu.edu/beis97shape.html}, booktitle = {CVPR}, author = {Jeffrey S. Beis and David G. Lowe}, year = {1997}, pages = {1000-1006} }, @inproceedings{leibe_efficient_2006, title = {Efficient Clustering and Matching for Object Class Recognition}, url = {http://www.mis.informatik.tu-darmstadt.de/Publications/leibe-efficientclustering-bmvc06.pdf}, abstract = {In this paper we address the problem of building object class representations based on local features and fast matching in a large database. We propose an efficient algorithm for hierarchical agglomerative clustering. We examine different agglomerative and partitional clustering strategies and compare the quality of obtained clusters. Our combination of partitional-agglomerative clustering gives significant improvement in terms of efficiency while maintaining the same quality of clusters. We also propose a method for building data structures for fast matching in high dimensional feature spaces. These improvements allow to deal with large sets of training data typically used in recognition of multiple object classes.}, booktitle = {BMVC}, author = {B. Leibe and K. Mikolajczyk and B. Schiele}, year = {2006} }, @inproceedings{schindler_city-scale_2007, title = {City-Scale Location Recognition}, doi = {10.1109/CVPR.2007.383150}, abstract = {We look at the problem of location recognition in a large image dataset using a vocabulary tree. This entails finding the location of a query image in a large dataset containing 3times104 streetside images of a city. We investigate how the traditional invariant feature matching approach falls down as the size of the database grows. In particular we show that by carefully selecting the vocabulary using the most informative features, retrieval performance is significantly improved, allowing us to increase the number of database images by a factor of 10. We also introduce a generalization of the traditional vocabulary tree search algorithm which improves performance by effectively increasing the branching factor of a fixed vocabulary tree.}, booktitle = {CVPR}, journal = {Computer Vision and Pattern Recognition, 2007. CVPR '07. IEEE Conference on}, author = {G. Schindler and M. Brown and R. Szeliski}, year = {2007}, keywords = {feature matching,image matching,image retrieval,query image,trees (mathematics)city-scale location recognition,vocabulary tree}, pages = {1-7} }, @article{freidman_algorithm_1977, title = {An Algorithm for Finding Best Matches in Logarithmic Expected Time}, volume = {3}, issn = {0098-3500}, doi = {http://doi.acm.org/10.1145/355744.355745}, journal = {ACM Trans. Math. Softw.}, author = {Jerome H. Freidman and Jon Louis Bentley and Raphael Ari Finkel}, year = {1977}, pages = {209--226} }, @inproceedings{brin_near_1995, title = {Near Neighbor Search in Large Metric Spaces}, isbn = {1-55860-379-4}, booktitle = {VLDB}, author = {Sergey Brin}, year = {1995}, pages = {574-584} }, @inproceedings{liu_investigation_2004, title = {An investigation of practical approximate nearest neighbor algorithms}, url = {citeseer.ist.psu.edu/753047.html}, booktitle = {Neural Information Processing Systems}, author = {T. Liu and A. Moore and A. Gray and K. Yang}, year = {2004} }, @article{snavely_photo_2006, title = {Photo tourism: Exploring photo collections in 3{D}}, volume = {25}, journal = {ACM Transactions on Graphics (TOG)}, author = {N. Snavely and S. M. Seitz and R. Szeliski}, year = {2006}, pages = {835-846} }, @inproceedings{silpa-anan_localization_2004, title = {Localization using an imagemap}, booktitle = {Australasian Conference on Robotics and Automation}, author = {C. Silpa-Anan and R. Hartley}, year = {2004} }, @inproceedings{sivic_videogoogle_2003, title = {Video {G}oogle: A Text Retrieval Approach to Object Matching in Videos}, booktitle = {ICCV}, author = {J. Sivic and A. Zisserman}, year = {2003} }, @techreport{torralba_tiny_2007, Author = {A. Torralba and R. Fergus and W. T. Freeman}, Title = {Tiny Images}, Institution = {CSAIL, Massachusetts Institute of Technology}, Year = {2007}, URL = {http://dspace.mit.edu/handle/1721.1/37291}, Number = {MIT-CSAIL-TR-2007-024} }, @article{torralba_80_million_2008, author = {Antonio Torralba and Rob Fergus and William T. Freeman}, title = {80 Million Tiny Images: A Large Data Set for Nonparametric Object and Scene Recognition}, journal ={IEEE Transactions on Pattern Analysis and Machine Intelligence}, volume = {30}, number = {11}, issn = {0162-8828}, year = {2008}, pages = {1958-1970}, doi = {http://doi.ieeecomputersociety.org/10.1109/TPAMI.2008.128}, publisher = {IEEE Computer Society}, address = {Los Alamitos, CA, USA}, } @inproceedings{philbin_oxford_2007, title = {Object retrieval with large vocabularies and fast spatial matching}, booktitle = {CVPR}, author = {J. Philbin and O. Chum and M. Isard and J. Sivic and A. Zisserman}, year = {2007} } @article{andoni_near-optimal_2006, title = {Near-Optimal Hashing Algorithms for Approximate Nearest Neighbor in High Dimensions}, journal = {Proceedings of the 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS'06)}, author = {A. Andoni}, year = {2006}, pages = {459-468} } @article{fukunaga_branch_1975, title = {A Branch and Bound Algorithm for Computing k-Nearest Neighbors}, volume = {24}, url = {http://portal.acm.org/citation.cfm?id=1311063.1311121\&coll=GUIDE\&dl=\&CFID=5674080\&CFTOKEN=11648065}, abstract = {Computation of the k-nearest neighbors generally requires a large number of expensive distance computations. The method of branch and bound is implemented in the present algorithm to facilitate rapid calculation of the k-nearest neighbors, by eliminating the necesssity of calculating many distances. Experimental results demonstrate the efficiency of the algorithm. Typically, an average of only 61 distance computations were made to find the nearest neighbor of a test sample among 1000 design samples.}, journal = {IEEE Trans. Comput.}, author = {K. Fukunaga and P. M. Narendra}, year = {1975}, keywords = {branch and bound,distance computation,hierarchical decomposition,k-nearest neighbors,tree-search algorithm.}, pages = {750-753} } @inproceedings{mikolajczyk_improving_2007, title = {Improving Descriptors for Fast Tree Matching by Optimal Linear Projection}, isbn = {1550-5499}, doi = {10.1109/ICCV.2007.4408871}, abstract = {In this paper we propose to transform an image descriptor so that nearest neighbor (NN) search for correspondences becomes the optimal matching strategy under the assumption that inter-image deviations of corresponding descriptors have Gaussian distribution. The Euclidean NN in the transformed domain corresponds to the NN according to a truncated Mahalanobis metric in the original descriptor space. We provide theoretical justification for the proposed approach and show experimentally that the transformation allows a significant dimensionality reduction and improves matching performance of a state-of-the art SIFT descriptor. We observe consistent improvement in precision-recall and speed of fast matching in tree structures at the expense of little overhead for projecting the descriptors into transformed space. In the context of SIFT vs. transformed M-SIFT comparison, tree search structures are evaluated according to different criteria and query types. All search tree experiments confirm that transformed M-SIFT performs better than the original SIFT.}, booktitle = {Computer Vision, 2007. ICCV 2007. IEEE 11th International Conference on}, journal = {Computer Vision, 2007. ICCV 2007. IEEE 11th International Conference on}, author = {Krystian Mikolajczyk and Jiri Matas}, year = {2007}, pages = {1-8} } @inproceedings{silpa-anan_optimized_2008, author = {Silpa-Anan, C. and Hartley, R.} , title = "Optimised {KD}-trees for fast image descriptor matching" , booktitle = {CVPR} , year = 2008 , url = "../Papers/PDF/SilpaAnan:CVPR08.pdf" , };flann-1.9.1+dfsg/examples/000077500000000000000000000000001275407571100153665ustar00rootroot00000000000000flann-1.9.1+dfsg/examples/CMakeLists.txt000066400000000000000000000022341275407571100201270ustar00rootroot00000000000000add_custom_target(examples ALL) if (BUILD_C_BINDINGS) add_executable(flann_example_c flann_example.c) target_link_libraries(flann_example_c flann) set_target_properties(flann_example_c PROPERTIES COMPILE_FLAGS -std=c99) add_dependencies(examples flann_example_c) install (TARGETS flann_example_c DESTINATION bin ) endif() if (HDF5_FOUND) include_directories(${HDF5_INCLUDE_DIR}) add_executable(flann_example_cpp flann_example.cpp) target_link_libraries(flann_example_cpp ${HDF5_LIBRARIES} flann_cpp) if (HDF5_IS_PARALLEL) target_link_libraries(flann_example_cpp ${MPI_LIBRARIES}) endif() add_dependencies(examples flann_example_cpp) install (TARGETS flann_example_cpp DESTINATION bin) if (USE_MPI AND HDF5_IS_PARALLEL) add_executable(flann_example_mpi flann_example_mpi.cpp) target_link_libraries(flann_example_mpi flann_cpp ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${Boost_LIBRARIES}) add_dependencies(examples flann_example_mpi) install (TARGETS flann_example_mpi DESTINATION bin) endif() else() message("hdf5 library not found, not compiling flann_example.cpp") endif() flann-1.9.1+dfsg/examples/README000066400000000000000000000005131275407571100162450ustar00rootroot00000000000000 These examples use some datasets that are not included in the source distribution. You can download the datasets from here: http://people.cs.ubc.ca/~mariusm/uploads/FLANN/datasets/dataset.hdf5 http://people.cs.ubc.ca/~mariusm/uploads/FLANN/datasets/dataset.dat http://people.cs.ubc.ca/~mariusm/uploads/FLANN/datasets/testset.dat flann-1.9.1+dfsg/examples/flann_example.c000066400000000000000000000045061275407571100203500ustar00rootroot00000000000000 #include #include #include float* read_points(const char* filename, int rows, int cols) { float* data; float *p; FILE* fin; int i,j; fin = fopen(filename,"r"); if (!fin) { printf("Cannot open input file.\n"); exit(1); } data = (float*) malloc(rows*cols*sizeof(float)); if (!data) { printf("Cannot allocate memory.\n"); exit(1); } p = data; for (i=0;i #include #include using namespace flann; int main(int argc, char** argv) { int nn = 3; Matrix dataset; Matrix query; load_from_file(dataset, "dataset.hdf5","dataset"); load_from_file(query, "dataset.hdf5","query"); Matrix indices(new int[query.rows*nn], query.rows, nn); Matrix dists(new float[query.rows*nn], query.rows, nn); // construct an randomized kd-tree index using 4 kd-trees Index > index(dataset, flann::KDTreeIndexParams(4)); index.buildIndex(); // do a knn search, using 128 checks index.knnSearch(query, indices, dists, nn, flann::SearchParams(128)); flann::save_to_file(indices,"result.hdf5","result"); delete[] dataset.ptr(); delete[] query.ptr(); delete[] indices.ptr(); delete[] dists.ptr(); return 0; } flann-1.9.1+dfsg/examples/flann_example_mpi.cpp000066400000000000000000000063321275407571100215540ustar00rootroot00000000000000 #include #include #include #include #include #define IF_RANK0 if (world.rank()==0) timeval start_time_; void start_timer(const std::string& message = "") { if (!message.empty()) { printf("%s", message.c_str()); fflush(stdout); } gettimeofday(&start_time_,NULL); } double stop_timer() { timeval end_time; gettimeofday(&end_time,NULL); return double(end_time.tv_sec-start_time_.tv_sec)+ double(end_time.tv_usec-start_time_.tv_usec)/1000000; } float compute_precision(const flann::Matrix& match, const flann::Matrix& indices) { int count = 0; assert(match.rows == indices.rows); size_t nn = std::min(match.cols, indices.cols); for(size_t i=0; i >* index) { boost::mpi::communicator world; int nn = 1; flann::Matrix query; flann::Matrix match; // flann::Matrix gt_dists; IF_RANK0 { flann::load_from_file(query, "sift100K.h5","query"); flann::load_from_file(match, "sift100K.h5","match"); // flann::load_from_file(gt_dists, "sift100K.h5","dists"); } boost::mpi::broadcast(world, query, 0); boost::mpi::broadcast(world, match, 0); flann::Matrix indices(new int[query.rows*nn], query.rows, nn); flann::Matrix dists(new float[query.rows*nn], query.rows, nn); IF_RANK0 { indices = flann::Matrix(new int[query.rows*nn], query.rows, nn); dists = flann::Matrix(new float[query.rows*nn], query.rows, nn); } // do a knn search, using 128 checks0 IF_RANK0 start_timer("Performing search...\n"); index->knnSearch(query, indices, dists, nn, flann::SearchParams(128)); IF_RANK0 { printf("Search done (%g seconds)\n", stop_timer()); printf("Indices size: (%d,%d)\n", (int)indices.rows, (int)indices.cols); printf("Checking results\n"); float precision = compute_precision(match, indices); printf("Precision is: %g\n", precision); } delete[] query.ptr(); delete[] match.ptr(); IF_RANK0 { delete[] indices.ptr(); delete[] dists.ptr(); } } int main(int argc, char** argv) { boost::mpi::environment env(argc, argv); boost::mpi::communicator world; //flann::Matrix dataset; IF_RANK0 start_timer("Loading data...\n"); // construct an randomized kd-tree index using 4 kd-trees flann::mpi::Index > index("sift100K.h5", "dataset", flann::KDTreeIndexParams(4)); //flann::load_from_file(dataset, "sift100K.h5","dataset"); //flann::Index > index( dataset, flann::KDTreeIndexParams(4)); world.barrier(); IF_RANK0 printf("Loading data done (%g seconds)\n", stop_timer()); IF_RANK0 printf("Index size: (%d,%d)\n", index.size(), index.veclen()); start_timer("Building index...\n"); index.buildIndex(); printf("Building index done (%g seconds)\n", stop_timer()); world.barrier(); printf("Searching...\n"); boost::thread t(boost::bind(search, &index)); t.join(); boost::thread t2(boost::bind(search, &index)); for(;;){}; return 0; } flann-1.9.1+dfsg/src/000077500000000000000000000000001275407571100143375ustar00rootroot00000000000000flann-1.9.1+dfsg/src/CMakeLists.txt000066400000000000000000000002371275407571100171010ustar00rootroot00000000000000 add_subdirectory( cpp ) if (BUILD_MATLAB_BINDINGS) add_subdirectory( matlab ) endif() if (BUILD_PYTHON_BINDINGS) add_subdirectory( python ) endif() flann-1.9.1+dfsg/src/cpp/000077500000000000000000000000001275407571100151215ustar00rootroot00000000000000flann-1.9.1+dfsg/src/cpp/CMakeLists.txt000066400000000000000000000110541275407571100176620ustar00rootroot00000000000000#include_directories(${CMAKE_SOURCE_DIR}/include algorithms ext util nn .) add_definitions(-D_FLANN_VERSION=${FLANN_VERSION}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/flann/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/flann/config.h) file(GLOB_RECURSE C_SOURCES flann.cpp lz4.c lz4hc.c) file(GLOB_RECURSE CPP_SOURCES flann_cpp.cpp lz4.c lz4hc.c) file(GLOB_RECURSE CU_SOURCES *.cu) add_library(flann_cpp_s STATIC ${CPP_SOURCES}) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) set_target_properties(flann_cpp_s PROPERTIES COMPILE_FLAGS -fPIC) endif() set_property(TARGET flann_cpp_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC FLANN_USE_CUDA) if (BUILD_CUDA_LIB) SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-DFLANN_USE_CUDA") if(CMAKE_COMPILER_IS_GNUCC) set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-Xcompiler;-fPIC;" ) if (NVCC_COMPILER_BINDIR) set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};--compiler-bindir=${NVCC_COMPILER_BINDIR}") endif() else() set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};" ) endif() cuda_add_library(flann_cuda_s STATIC ${CU_SOURCES}) set_property(TARGET flann_cuda_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC) endif() if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC) add_library(flann_cpp SHARED "") set_target_properties(flann_cpp PROPERTIES LINKER_LANGUAGE CXX) target_link_libraries(flann_cpp -Wl,-whole-archive flann_cpp_s -Wl,-no-whole-archive) if (BUILD_CUDA_LIB) cuda_add_library(flann_cuda SHARED "") set_target_properties(flann_cuda PROPERTIES LINKER_LANGUAGE CXX) target_link_libraries(flann_cuda -Wl,-whole-archive flann_cuda_s -Wl,-no-whole-archive) set_property(TARGET flann_cpp_s PROPERTY COMPILE_DEFINITIONS FLANN_USE_CUDA) # target_link_libraries(flann_cuda cudpp_x86_64) endif() else() add_library(flann_cpp SHARED ${CPP_SOURCES}) if (BUILD_CUDA_LIB) cuda_add_library(flann_cuda SHARED ${CPP_SOURCES}) set_property(TARGET flann_cpp PROPERTY COMPILE_DEFINITIONS FLANN_USE_CUDA) endif() endif() set_target_properties(flann_cpp PROPERTIES VERSION ${FLANN_VERSION} SOVERSION ${FLANN_SOVERSION} DEFINE_SYMBOL FLANN_EXPORTS ) if (BUILD_CUDA_LIB) set_target_properties(flann_cuda PROPERTIES VERSION ${FLANN_VERSION} SOVERSION ${FLANN_SOVERSION} DEFINE_SYMBOL FLANN_EXPORTS ) endif() if (USE_MPI AND HDF5_IS_PARALLEL) add_executable(flann_mpi_server flann/mpi/flann_mpi_server.cpp) target_link_libraries(flann_mpi_server flann_cpp ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${Boost_LIBRARIES}) add_executable(flann_mpi_client flann/mpi/flann_mpi_client.cpp) target_link_libraries(flann_mpi_client flann_cpp ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${Boost_LIBRARIES}) install (TARGETS flann_mpi_client flann_mpi_server DESTINATION bin) endif() if (BUILD_C_BINDINGS) add_library(flann_s STATIC ${C_SOURCES}) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) set_target_properties(flann_s PROPERTIES COMPILE_FLAGS -fPIC) endif() set_property(TARGET flann_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC) if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC) add_library(flann SHARED "") set_target_properties(flann PROPERTIES LINKER_LANGUAGE CXX) target_link_libraries(flann -Wl,-whole-archive flann_s -Wl,-no-whole-archive) else() add_library(flann SHARED ${C_SOURCES}) if(MINGW AND OPENMP_FOUND) target_link_libraries(flann gomp) endif() endif() set_target_properties(flann PROPERTIES VERSION ${FLANN_VERSION} SOVERSION ${FLANN_SOVERSION} DEFINE_SYMBOL FLANN_EXPORTS ) endif() if(WIN32) if (BUILD_C_BINDINGS AND BUILD_MATLAB_BINDINGS) install ( TARGETS flann RUNTIME DESTINATION share/flann/matlab ) endif() endif(WIN32) install ( TARGETS flann_cpp flann_cpp_s RUNTIME DESTINATION bin LIBRARY DESTINATION ${FLANN_LIB_INSTALL_DIR} ARCHIVE DESTINATION ${FLANN_LIB_INSTALL_DIR} ) if (BUILD_CUDA_LIB) install ( TARGETS flann_cuda flann_cuda_s RUNTIME DESTINATION bin LIBRARY DESTINATION ${FLANN_LIB_INSTALL_DIR} ARCHIVE DESTINATION ${FLANN_LIB_INSTALL_DIR} ) endif() if (BUILD_C_BINDINGS) install ( TARGETS flann flann_s RUNTIME DESTINATION bin LIBRARY DESTINATION ${FLANN_LIB_INSTALL_DIR} ARCHIVE DESTINATION ${FLANN_LIB_INSTALL_DIR} ) endif() install ( DIRECTORY flann DESTINATION include FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" ) flann-1.9.1+dfsg/src/cpp/flann/000077500000000000000000000000001275407571100162175ustar00rootroot00000000000000flann-1.9.1+dfsg/src/cpp/flann/algorithms/000077500000000000000000000000001275407571100203705ustar00rootroot00000000000000flann-1.9.1+dfsg/src/cpp/flann/algorithms/all_indices.h000066400000000000000000000152171275407571100230150ustar00rootroot00000000000000/*********************************************************************** * Software License Agreement (BSD License) * * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *************************************************************************/ #ifndef FLANN_ALL_INDICES_H_ #define FLANN_ALL_INDICES_H_ #include "flann/general.h" #include "flann/algorithms/nn_index.h" #include "flann/algorithms/kdtree_index.h" #include "flann/algorithms/kdtree_single_index.h" #include "flann/algorithms/kmeans_index.h" #include "flann/algorithms/composite_index.h" #include "flann/algorithms/linear_index.h" #include "flann/algorithms/hierarchical_clustering_index.h" #include "flann/algorithms/lsh_index.h" #include "flann/algorithms/autotuned_index.h" #ifdef FLANN_USE_CUDA #include "flann/algorithms/kdtree_cuda_3d_index.h" #endif namespace flann { /** * enable_if sfinae helper */ template struct enable_if{}; template struct enable_if { typedef T type; }; /** * disable_if sfinae helper */ template struct disable_if{ typedef T type; }; template struct disable_if { }; /** * Check if two type are the same */ template struct same_type { enum {value = false}; }; template struct same_type { enum {value = true}; }; #define HAS_MEMBER(member) \ template \ struct member { \ typedef char No; \ typedef long Yes; \ template static Yes test( typename C::member* ); \ template static No test( ... ); \ enum { value = sizeof (test(0))==sizeof(Yes) }; \ }; HAS_MEMBER(needs_kdtree_distance) HAS_MEMBER(needs_vector_space_distance) HAS_MEMBER(is_kdtree_distance) HAS_MEMBER(is_vector_space_distance) struct DummyDistance { typedef float ElementType; typedef float ResultType; template ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const { return ResultType(0); } template inline ResultType accum_dist(const U& a, const V& b, int) const { return ResultType(0); } }; /** * Checks if an index and a distance can be used together */ template