ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
flann Namespace Reference

Namespaces

 anyimpl
 
 cuda
 
 lsh
 
 mpi
 
 serialization
 

Classes

struct  enable_if
 
struct  enable_if< true, T >
 
struct  disable_if
 
struct  disable_if< true, T >
 
struct  same_type
 
struct  same_type< T, T >
 
struct  needs_kdtree_distance
 
struct  needs_vector_space_distance
 
struct  is_kdtree_distance
 
struct  is_vector_space_distance
 
struct  DummyDistance
 
struct  valid_combination
 
struct  AutotunedIndexParams
 
class  AutotunedIndex
 
struct  squareDistance
 
struct  squareDistance< L2_Simple< ElementType >, ElementType >
 
struct  squareDistance< L2_3D< ElementType >, ElementType >
 
struct  squareDistance< L2< ElementType >, ElementType >
 
struct  squareDistance< HellingerDistance< ElementType >, ElementType >
 
struct  squareDistance< ChiSquareDistance< ElementType >, ElementType >
 
class  CenterChooser
 
class  RandomCenterChooser
 
class  GonzalesCenterChooser
 
class  KMeansppCenterChooser
 
class  GroupWiseCenterChooser
 
struct  CompositeIndexParams
 
class  CompositeIndex
 
struct  Accumulator
 
struct  Accumulator< unsigned char >
 
struct  Accumulator< unsigned short >
 
struct  Accumulator< unsigned int >
 
struct  Accumulator< char >
 
struct  Accumulator< short >
 
struct  Accumulator< int >
 
struct  L2_Simple
 
struct  L2_3D
 
struct  L2
 
struct  L1
 
struct  MinkowskiDistance
 
struct  MaxDistance
 
struct  HammingLUT
 
struct  HammingPopcnt
 
struct  Hamming
 
struct  HistIntersectionDistance
 
struct  HellingerDistance
 
struct  ChiSquareDistance
 
struct  KL_Divergence
 
struct  HierarchicalClusteringIndexParams
 
class  HierarchicalClusteringIndex
 
struct  KDTreeCuda3dIndexParams
 
class  KDTreeCuda3dIndex
 
class  CudaKdTreeBuilder
 
struct  KDTreeIndexParams
 
class  KDTreeIndex
 
struct  KDTreeSingleIndexParams
 
class  KDTreeSingleIndex
 
struct  KMeansIndexParams
 
class  KMeansIndex
 
struct  LinearIndexParams
 
class  LinearIndex
 
struct  LshIndexParams
 
class  LshIndex
 
class  IndexBase
 
class  NNIndex
 
struct  SavedIndexParams
 
class  Index
 
class  FLANNException
 
struct  flann_datatype_value
 
struct  flann_datatype_value< char >
 
struct  flann_datatype_value< short >
 
struct  flann_datatype_value< int >
 
struct  flann_datatype_value< unsigned char >
 
struct  flann_datatype_value< unsigned short >
 
struct  flann_datatype_value< unsigned int >
 
struct  flann_datatype_value< float >
 
struct  flann_datatype_value< double >
 
struct  flann_datatype_type
 
struct  flann_datatype_type< FLANN_INT8 >
 
struct  flann_datatype_type< FLANN_INT16 >
 
struct  flann_datatype_type< FLANN_INT32 >
 
struct  flann_datatype_type< FLANN_UINT8 >
 
struct  flann_datatype_type< FLANN_UINT16 >
 
struct  flann_datatype_type< FLANN_UINT32 >
 
struct  flann_datatype_type< FLANN_FLOAT32 >
 
struct  flann_datatype_type< FLANN_FLOAT64 >
 
struct  Request
 
struct  Response
 
class  PooledAllocator
 
class  any
 
class  DynamicBitset
 
class  Heap
 
class  IntervalHeap
 
class  BoundedHeap
 
class  Logger
 
class  Matrix_
 
class  Matrix
 
class  CreatorNotFound
 
class  ObjectFactory
 
struct  SearchParams
 
class  RandomGenerator
 
class  UniqueRandom
 
struct  BranchStruct
 
struct  DistanceIndex
 
class  ResultSet
 
class  KNNSimpleResultSet
 
class  KNNResultSet
 
class  KNNResultSet2
 
class  RadiusResultSet
 
class  KNNRadiusResultSet
 
class  CountRadiusResultSet
 
class  UniqueResultSet
 
class  KNNUniqueResultSet
 
class  RadiusUniqueResultSet
 
class  KNNRadiusUniqueResultSet
 
struct  IndexHeader
 
struct  IndexHeaderStruct
 
class  StartStopTimer
 

Typedefs

typedef unsigned char uchar
 
typedef std::map< std::string, anyIndexParams
 

Enumerations

enum  tri_type { FLANN_False = 0 , FLANN_True = 1 , FLANN_Undefined }
 

Functions

template<template< typename > class Index, typename Distance , typename T >
NNIndex< Distance > * create_index_ (flann::Matrix< T > data, const flann::IndexParams &params, const Distance &distance, typename enable_if< valid_combination< Index, Distance, T >::value, void >::type *=0)
 
template<template< typename > class Index, typename Distance , typename T >
NNIndex< Distance > * create_index_ (flann::Matrix< T > data, const flann::IndexParams &params, const Distance &distance, typename disable_if< valid_combination< Index, Distance, T >::value, void >::type *=0)
 
template<typename Distance >
NNIndex< Distance > * create_index_by_type (const flann_algorithm_t index_type, const Matrix< typename Distance::ElementType > &dataset, const IndexParams &params, const Distance &distance)
 
template<typename Distance >
Distance::ResultType ensureSquareDistance (typename Distance::ResultType dist)
 
std::ostream & operator<< (std::ostream &stream, const cuda::kd_tree_builder_detail::SplitInfo &s)
 
void log_verbosity (int level)
 
template<typename Distance >
int hierarchicalClustering (const Matrix< typename Distance::ElementType > &points, Matrix< typename Distance::ResultType > &centers, const KMeansIndexParams &params, Distance d=Distance())
 
size_t flann_datatype_size (flann_datatype_t type)
 
template<typename T >
void save_to_file (const flann::Matrix< T > &dataset, const std::string &filename, const std::string &name)
 
template<typename T >
void load_from_file (flann::Matrix< T > &dataset, const std::string &filename, const std::string &name)
 
template<typename T >
void read_object (tcp::socket &sock, T &val)
 
template<typename T >
void write_object (tcp::socket &sock, const T &val)
 
template<typename Distance >
void find_nearest (const Matrix< typename Distance::ElementType > &dataset, typename Distance::ElementType *query, size_t *matches, size_t nn, size_t skip=0, Distance distance=Distance())
 
template<typename Distance >
void compute_ground_truth (const Matrix< typename Distance::ElementType > &dataset, const Matrix< typename Distance::ElementType > &testset, Matrix< size_t > &matches, int skip=0, Distance d=Distance())
 
int countCorrectMatches (size_t *neighbors, size_t *groundTruth, int n)
 
template<typename Distance >
Distance::ResultType computeDistanceRaport (const Matrix< typename Distance::ElementType > &inputData, typename Distance::ElementType *target, size_t *neighbors, size_t *groundTruth, int veclen, int n, const Distance &distance)
 
template<typename Index , typename Distance >
float search_with_ground_truth (Index &index, const Matrix< typename Distance::ElementType > &inputData, const Matrix< typename Distance::ElementType > &testData, const Matrix< size_t > &matches, int nn, int checks, float &time, typename Distance::ResultType &dist, const Distance &distance, int skipMatches)
 
template<typename Index , typename Distance >
float test_index_checks (Index &index, const Matrix< typename Distance::ElementType > &inputData, const Matrix< typename Distance::ElementType > &testData, const Matrix< size_t > &matches, int checks, float &precision, const Distance &distance, int nn=1, int skipMatches=0)
 
template<typename Index , typename Distance >
float test_index_precision (Index &index, const Matrix< typename Distance::ElementType > &inputData, const Matrix< typename Distance::ElementType > &testData, const Matrix< size_t > &matches, float precision, int &checks, const Distance &distance, int nn=1, int skipMatches=0)
 
template<typename Index , typename Distance >
void test_index_precisions (Index &index, const Matrix< typename Distance::ElementType > &inputData, const Matrix< typename Distance::ElementType > &testData, const Matrix< int > &matches, float *precisions, int precisions_length, const Distance &distance, int nn=1, int skipMatches=0, float maxTime=0)
 
template<typename T >
void addValue (int pos, float val, float *vals, T *point, T *points, int n)
 
template<typename T , typename F >
float optimizeSimplexDownhill (T *points, int n, F func, float *vals=NULL)
 
template<typename T >
T * allocate (size_t count=1)
 
std::ostream & operator<< (std::ostream &out, const any &any_val)
 
bool has_param (const IndexParams &params, std::string name)
 
template<typename T >
get_param (const IndexParams &params, std::string name, const T &default_value)
 
template<typename T >
get_param (const IndexParams &params, std::string name)
 
void print_params (const IndexParams &params)
 
void print_params (const SearchParams &params)
 
void seed_random (unsigned int seed)
 
double rand_double (double high=1.0, double low=0)
 
int rand_int (int high=RAND_MAX, int low=0)
 
template<typename T >
Matrix< T > random_sample (Matrix< T > &srcMatrix, size_t size, bool remove=false)
 
template<typename Index >
void save_header (FILE *stream, const Index &index)
 
IndexHeader load_header (FILE *stream)
 

Variables

const size_t WORDSIZE =16
 
const size_t BLOCKSIZE =8192
 

Typedef Documentation

◆ IndexParams

typedef std::map<std::string, any> flann::IndexParams

Definition at line 51 of file params.h.

◆ uchar

typedef unsigned char flann::uchar

Definition at line 41 of file matrix.h.

Enumeration Type Documentation

◆ tri_type

Enumerator
FLANN_False 
FLANN_True 
FLANN_Undefined 

Definition at line 54 of file params.h.

Function Documentation

◆ addValue()

template<typename T >
void flann::addValue ( int  pos,
float  val,
float *  vals,
T *  point,
T *  points,
int  n 
)

Adds val to array vals (and point to array points) and keeping the arrays sorted by vals.

Definition at line 41 of file simplex_downhill.h.

References points, and cloudViewer::utility::swap().

Referenced by optimizeSimplexDownhill().

◆ allocate()

template<typename T >
T* flann::allocate ( size_t  count = 1)

Allocates (using C's malloc) a generic type T.

Params: count = number of instances to allocate. Returns: pointer (of type T*) to memory buffer

Definition at line 49 of file allocator.h.

References count.

◆ compute_ground_truth()

template<typename Distance >
void flann::compute_ground_truth ( const Matrix< typename Distance::ElementType > &  dataset,
const Matrix< typename Distance::ElementType > &  testset,
Matrix< size_t > &  matches,
int  skip = 0,
Distance  d = Distance() 
)

Definition at line 87 of file ground_truth.h.

References flann::Matrix_::cols, and flann::Matrix_::rows.

◆ computeDistanceRaport()

template<typename Distance >
Distance::ResultType flann::computeDistanceRaport ( const Matrix< typename Distance::ElementType > &  inputData,
typename Distance::ElementType *  target,
size_t *  neighbors,
size_t *  groundTruth,
int  veclen,
int  n,
const Distance distance 
)

Definition at line 64 of file index_testing.h.

◆ countCorrectMatches()

int flann::countCorrectMatches ( size_t *  neighbors,
size_t *  groundTruth,
int  n 
)
inline

Definition at line 48 of file index_testing.h.

References count.

Referenced by search_with_ground_truth().

◆ create_index_() [1/2]

template<template< typename > class Index, typename Distance , typename T >
NNIndex<Distance>* flann::create_index_ ( flann::Matrix< T >  data,
const flann::IndexParams params,
const Distance distance,
typename disable_if< valid_combination< Index, Distance, T >::value, void >::type = 0 
)
inline

Definition at line 136 of file all_indices.h.

References NULL.

◆ create_index_() [2/2]

template<template< typename > class Index, typename Distance , typename T >
NNIndex<Distance>* flann::create_index_ ( flann::Matrix< T >  data,
const flann::IndexParams params,
const Distance distance,
typename enable_if< valid_combination< Index, Distance, T >::value, void >::type = 0 
)
inline

Definition at line 129 of file all_indices.h.

References params.

◆ create_index_by_type()

template<typename Distance >
NNIndex<Distance>* flann::create_index_by_type ( const flann_algorithm_t  index_type,
const Matrix< typename Distance::ElementType > &  dataset,
const IndexParams params,
const Distance distance 
)
inline

#define this symbol before including flann.h to enable GPU search algorithms. But you have to link libflann_cuda then!

Definition at line 144 of file all_indices.h.

References FLANN_INDEX_AUTOTUNED, FLANN_INDEX_COMPOSITE, FLANN_INDEX_HIERARCHICAL, FLANN_INDEX_KDTREE, FLANN_INDEX_KDTREE_SINGLE, FLANN_INDEX_KMEANS, FLANN_INDEX_LINEAR, FLANN_INDEX_LSH, NULL, and params.

Referenced by flann::AutotunedIndex< Distance >::buildIndex().

◆ ensureSquareDistance()

template<typename Distance >
Distance::ResultType flann::ensureSquareDistance ( typename Distance::ResultType  dist)

Definition at line 63 of file center_chooser.h.

References dist().

◆ find_nearest()

template<typename Distance >
void flann::find_nearest ( const Matrix< typename Distance::ElementType > &  dataset,
typename Distance::ElementType *  query,
size_t *  matches,
size_t  nn,
size_t  skip = 0,
Distance  distance = Distance() 
)

Definition at line 42 of file ground_truth.h.

References flann::Matrix_::cols, flann::Matrix_::rows, and std::swap().

◆ flann_datatype_size()

size_t flann::flann_datatype_size ( flann_datatype_t  type)
inline

◆ get_param() [1/2]

template<typename T >
T flann::get_param ( const IndexParams params,
std::string  name 
)

Definition at line 107 of file params.h.

References name, and params.

◆ get_param() [2/2]

◆ has_param()

bool flann::has_param ( const IndexParams params,
std::string  name 
)
inline

Definition at line 89 of file params.h.

References name, and params.

Referenced by update_flann_parameters().

◆ hierarchicalClustering()

template<typename Distance >
int flann::hierarchicalClustering ( const Matrix< typename Distance::ElementType > &  points,
Matrix< typename Distance::ResultType > &  centers,
const KMeansIndexParams params,
Distance  d = Distance() 
)

Performs a hierarchical clustering of the points passed as argument and then takes a cut in the the clustering tree to return a flat clustering.

Parameters
[in]pointsPoints to be clustered
centersThe computed cluster centres. Matrix should be preallocated and centers.rows is the number of clusters requested.
paramsClustering parameters (The same as for flann::KMeansIndex)
dDistance to be used for clustering (eg: flann::L2)
Returns
number of clusters computed (can be different than clusters.rows and is the highest number of the form (branching-1)*K+1 smaller than clusters.rows).

Definition at line 424 of file flann.hpp.

References flann::KMeansIndex< Distance >::buildIndex(), flann::KMeansIndex< Distance >::getClusterCenters(), params, and points.

◆ load_from_file()

template<typename T >
void flann::load_from_file ( flann::Matrix< T > &  dataset,
const std::string &  filename,
const std::string &  name 
)

Definition at line 130 of file hdf5.h.

References CHECK_ERROR, filename, name, and NULL.

Referenced by flann::mpi::Index< Distance >::Index(), and main().

◆ load_header()

IndexHeader flann::load_header ( FILE *  stream)
inline
Parameters
stream- Stream to load from
Returns
Index header

Definition at line 106 of file saving.h.

References FLANN_SIGNATURE_, flann::IndexHeader::h, and flann::IndexHeaderStruct::signature.

◆ log_verbosity()

void flann::log_verbosity ( int  level)
inline

Sets the log level used for all flann functions

Parameters
levelVerbosity level

Definition at line 54 of file flann.hpp.

References flann::Logger::setLevel().

Referenced by flann_log_verbosity().

◆ operator<<() [1/2]

std::ostream& flann::operator<< ( std::ostream &  out,
const any any_val 
)
inline

Definition at line 288 of file any.h.

◆ operator<<() [2/2]

◆ optimizeSimplexDownhill()

template<typename T , typename F >
float flann::optimizeSimplexDownhill ( T *  points,
int  n,
func,
float *  vals = NULL 
)

Simplex downhill optimization function. Preconditions: points is a 2D mattrix of size (n+1) x n func is the cost function taking n an array of n params and returning float vals is the cost function in the n+1 simplex points, if NULL it will be computed

Postcondition: returns optimum value and points[0..n] are the optimum parameters

Definition at line 69 of file simplex_downhill.h.

References addValue(), flann::Logger::info(), NULL, and points.

◆ print_params() [1/2]

void flann::print_params ( const IndexParams params)
inline

Definition at line 118 of file params.h.

References QtCompat::endl(), and params.

Referenced by flann::AutotunedIndex< Distance >::buildIndex().

◆ print_params() [2/2]

void flann::print_params ( const SearchParams params)
inline

Definition at line 127 of file params.h.

References QtCompat::endl(), and params.

◆ rand_double()

double flann::rand_double ( double  high = 1.0,
double  low = 0 
)
inline

Generates a random double value.

Parameters
highUpper limit
lowLower limit
Returns
Random double value

Definition at line 63 of file random.h.

Referenced by flann::KMeansppCenterChooser< Distance >::operator()().

◆ rand_int()

int flann::rand_int ( int  high = RAND_MAX,
int  low = 0 
)
inline

Generates a random integer value.

Parameters
highUpper limit
lowLower limit
Returns
Random integer value

Definition at line 74 of file random.h.

Referenced by flann::GonzalesCenterChooser< Distance >::operator()(), flann::KMeansppCenterChooser< Distance >::operator()(), flann::GroupWiseCenterChooser< Distance >::operator()(), flann::RandomGenerator::operator()(), and random_sample().

◆ random_sample()

template<typename T >
Matrix<T> flann::random_sample ( Matrix< T > &  srcMatrix,
size_t  size,
bool  remove = false 
)

◆ read_object()

template<typename T >
void flann::read_object ( tcp::socket &  sock,
T &  val 
)

Definition at line 72 of file queries.h.

References size.

Referenced by flann::mpi::Client::knnSearch().

◆ save_header()

template<typename Index >
void flann::save_header ( FILE *  stream,
const Index index 
)

◆ save_to_file()

template<typename T >
void flann::save_to_file ( const flann::Matrix< T > &  dataset,
const std::string &  filename,
const std::string &  name 
)

◆ search_with_ground_truth()

template<typename Index , typename Distance >
float flann::search_with_ground_truth ( Index index,
const Matrix< typename Distance::ElementType > &  inputData,
const Matrix< typename Distance::ElementType > &  testData,
const Matrix< size_t > &  matches,
int  nn,
int  checks,
float &  time,
typename Distance::ResultType &  dist,
const Distance distance,
int  skipMatches 
)

◆ seed_random()

void flann::seed_random ( unsigned int  seed)
inline

Seeds the random number generator

Parameters
seedRandom seed

Definition at line 49 of file random.h.

Referenced by init_flann_parameters().

◆ test_index_checks()

template<typename Index , typename Distance >
float flann::test_index_checks ( Index index,
const Matrix< typename Distance::ElementType > &  inputData,
const Matrix< typename Distance::ElementType > &  testData,
const Matrix< size_t > &  matches,
int  checks,
float &  precision,
const Distance distance,
int  nn = 1,
int  skipMatches = 0 
)

Definition at line 142 of file index_testing.h.

References dist(), flann::Logger::info(), and search_with_ground_truth().

◆ test_index_precision()

template<typename Index , typename Distance >
float flann::test_index_precision ( Index index,
const Matrix< typename Distance::ElementType > &  inputData,
const Matrix< typename Distance::ElementType > &  testData,
const Matrix< size_t > &  matches,
float  precision,
int &  checks,
const Distance distance,
int  nn = 1,
int  skipMatches = 0 
)

Definition at line 159 of file index_testing.h.

References dist(), fabs(), flann::Logger::info(), and search_with_ground_truth().

◆ test_index_precisions()

template<typename Index , typename Distance >
void flann::test_index_precisions ( Index index,
const Matrix< typename Distance::ElementType > &  inputData,
const Matrix< typename Distance::ElementType > &  testData,
const Matrix< int > &  matches,
float *  precisions,
int  precisions_length,
const Distance distance,
int  nn = 1,
int  skipMatches = 0,
float  maxTime = 0 
)

Definition at line 232 of file index_testing.h.

References dist(), fabs(), flann::Logger::info(), and search_with_ground_truth().

◆ write_object()

template<typename T >
void flann::write_object ( tcp::socket &  sock,
const T &  val 
)

Definition at line 86 of file queries.h.

References size.

Referenced by flann::mpi::Client::knnSearch().

Variable Documentation

◆ BLOCKSIZE

const size_t flann::BLOCKSIZE =8192

Definition at line 73 of file allocator.h.

Referenced by flann::PooledAllocator::allocateMemory().

◆ WORDSIZE

const size_t flann::WORDSIZE =16

Pooled storage allocator

The following routines allow for the efficient allocation of storage in small chunks from a specified pool. Rather than allowing each structure to be freed individually, an entire pool of storage is freed at once. This method has two advantages over just using malloc() and free(). First, it is far more efficient for allocating small objects, as there is no overhead for remembering all the information needed to free each object or consolidating fragmented memory. Second, the decision about how long to keep an object is made at the time of allocation, and there is no need to track down all the objects to free them.

Definition at line 72 of file allocator.h.

Referenced by flann::PooledAllocator::allocateMemory().