@@ -683,16 +683,16 @@ \subsubsection{flann::Index::knnSearch}
683
683
struct SearchParams
684
684
{
685
685
SearchParams(int checks = 32,
686
- float eps = 0,
687
- bool sorted = true);
688
-
689
- int checks;
690
- float eps;
691
- bool sorted;
692
- int max_neighbors;
693
- tri_type use_heap;
694
- int cores;
695
- bool matrices_in_gpu_ram;
686
+ float eps = 0,
687
+ bool sorted = true);
688
+
689
+ int checks;
690
+ float eps;
691
+ bool sorted;
692
+ int max_neighbors;
693
+ tri_type use_heap;
694
+ int cores;
695
+ bool matrices_in_gpu_ram;
696
696
};
697
697
\end {Verbatim }
698
698
\begin {description }
@@ -769,10 +769,10 @@ \subsubsection{flann::hierarchicalClustering}
769
769
770
770
\begin {Verbatim }[fontsize=\footnotesize,frame=single]
771
771
template <typename Distance>
772
- int hierarchicalClustering(const Matrix<typename Distance::ElementType>& features ,
773
- Matrix<typename Distance::ResultType>& centers,
774
- const KMeansIndexParams& params,
775
- Distance d = Distance())
772
+ int hierarchicalClustering(const Matrix<typename Distance::ElementType>& points ,
773
+ Matrix<typename Distance::ResultType>& centers,
774
+ const KMeansIndexParams& params,
775
+ Distance d = Distance())
776
776
\end {Verbatim }
777
777
\begin {description }
778
778
\item [features]{The points to be clustered}
@@ -902,52 +902,66 @@ \subsubsection{flann\_build\_index()}
902
902
\item [flann\_ params] - is a structure containing the parameters passed to
903
903
the function. This structure is defined as follows:
904
904
\begin {Verbatim }[fontsize=\footnotesize]
905
- struct FLANNParameters {
906
- enum flann_algorithm_t algorithm; /* the algorithm to use */
907
-
908
- /* search parameters */
909
- int checks; /* how many leafs (features) to check in one search */
910
- float cb_index; /* cluster boundary index. Used when searching the
911
- kmeans tree */
912
-
913
- /* kdtree index parameters */
914
- int trees; /* number of randomized trees to use (for kdtree) */
915
-
916
- /* kmeans index parameters */
917
- int branching; /* branching factor (for kmeans tree) */
918
- int iterations; /* max iterations to perform in one kmeans cluetering
919
- (kmeans tree) */
920
- enum flann_centers_init_t centers_init; /* algorithm used for picking the initial
921
- cluster centers for kmeans tree */
922
-
923
- /* autotuned index parameters */
924
- float target_precision; /* precision desired (used for autotuning, -1 otherwise) */
925
- float build_weight; /* build tree time weighting factor */
926
- float memory_weight; /* index memory weigthing factor */
927
- float sample_fraction; /* what fraction of the dataset to use for autotuning */
928
-
929
- /* LSH parameters */
930
- unsigned int table_number_; /** The number of hash tables to use */
931
- unsigned int key_size_; /** The length of the key in the hash tables */
932
- unsigned int multi_probe_level_; /** Number of levels to use in multi-probe LSH, 0 for standard LSH */
933
-
934
- /* other parameters */
935
- enum flann_log_level_t log_level; /* determines the verbosity of each flann function */
936
- long random_seed; /* random seed to use */
905
+ struct FLANNParameters
906
+ {
907
+ enum flann_algorithm_t algorithm; /* the algorithm to use */
908
+
909
+ /* search time parameters */
910
+ int checks; /* how many leafs (features) to check in one search */
911
+ float eps; /* eps parameter for eps-knn search */
912
+ int sorted; /* indicates if results returned by radius search should be
913
+ sorted or not */
914
+ int max_neighbors; /* limits the maximum number of neighbors should be
915
+ returned by radius search */
916
+ int cores; /* number of paralel cores to use for searching */
917
+
918
+ /* kdtree index parameters */
919
+ int trees; /* number of randomized trees to use (for kdtree) */
920
+ int leaf_max_size;
921
+
922
+ /* kmeans index parameters */
923
+ int branching; /* branching factor (for kmeans tree) */
924
+ int iterations; /* max iterations to perform in one kmeans cluetering
925
+ (kmeans tree) */
926
+ enum flann_centers_init_t centers_init; /* algorithm used for picking the
927
+ initial cluster centers for kmeans tree */
928
+ float cb_index; /* cluster boundary index. Used when searching the kmeans
929
+ tree */
930
+
931
+ /* autotuned index parameters */
932
+ float target_precision; /* precision desired (used for autotuning, -1
933
+ otherwise) */
934
+ float build_weight; /* build tree time weighting factor */
935
+ float memory_weight; /* index memory weigthing factor */
936
+ float sample_fraction; /* what fraction of the dataset to use for autotuning */
937
+ /* LSH parameters */
938
+ unsigned int table_number_; /** The number of hash tables to use */
939
+ unsigned int key_size_; /** The length of the key in the hash tables */
940
+ unsigned int multi_probe_level_; /** Number of levels to use in multi-probe
941
+ LSH, 0 for standard LSH */
942
+
943
+ /* other parameters */
944
+ enum flann_log_level_t log_level; /* determines the verbosity of each flann
945
+ function */
946
+ long random_seed; /* random seed to use */
937
947
};
938
948
\end {Verbatim }
939
949
940
950
The \texttt {algorithm } and \texttt {centers\_ init } fields can take the
941
951
following values:
942
952
\begin {Verbatim }[fontsize=\footnotesize]
943
- enum flann_algorithm_t {
953
+ enum flann_algorithm_t
954
+ {
944
955
FLANN_INDEX_LINEAR = 0,
945
956
FLANN_INDEX_KDTREE = 1,
946
957
FLANN_INDEX_KMEANS = 2,
947
958
FLANN_INDEX_COMPOSITE = 3,
948
- FLANN_INDEX_KDTREE_SINGLE = 3,
959
+ FLANN_INDEX_KDTREE_SINGLE = 4,
960
+ FLANN_INDEX_HIERARCHICAL = 5,
961
+ FLANN_INDEX_LSH = 6,
962
+ FLANN_INDEX_KDTREE_CUDA = 7, // available if compiled with CUDA
949
963
FLANN_INDEX_SAVED = 254,
950
- FLANN_INDEX_AUTOTUNED = 255
964
+ FLANN_INDEX_AUTOTUNED = 255,
951
965
};
952
966
953
967
enum flann_centers_init_t {
@@ -976,20 +990,22 @@ \subsubsection{flann\_build\_index()}
976
990
The field \texttt {log\_ level } controls the verbosity of the messages generated by the FLANN
977
991
library functions. It can take the following values:
978
992
\begin {Verbatim }[fontsize=\footnotesize]
979
- enum flann_log_level_t {
980
- FLANN_LOG_NONE = 0,
981
- FLANN_LOG_FATAL = 1,
982
- FLANN_LOG_ERROR = 2,
983
- FLANN_LOG_WARN = 3,
984
- FLANN_LOG_INFO = 4
993
+ enum flann_log_level_t
994
+ {
995
+ FLANN_LOG_NONE = 0,
996
+ FLANN_LOG_FATAL = 1,
997
+ FLANN_LOG_ERROR = 2,
998
+ FLANN_LOG_WARN = 3,
999
+ FLANN_LOG_INFO = 4,
1000
+ FLANN_LOG_DEBUG = 5
985
1001
};
986
1002
\end {Verbatim }
987
1003
\end {description }
988
1004
989
1005
990
1006
\subsubsection {flann\_ find\_ nearest\_ neighbors\_ index() }
991
1007
\begin {Verbatim }[fontsize=\footnotesize,frame=single]
992
- int flann_find_nearest_neighbors_index(FLANN_INDEX index_id,
1008
+ int flann_find_nearest_neighbors_index(flann_index_t index_id,
993
1009
float* testset,
994
1010
int trows,
995
1011
int* indices,
@@ -1033,15 +1049,13 @@ \subsubsection{flann\_find\_nearest\_neighbors()}
1033
1049
\subsubsection {flann\_ radius\_ search() }
1034
1050
1035
1051
\begin {Verbatim }[fontsize=\footnotesize,frame=single]
1036
- int flann_radius_search(FLANN_INDEX index_ptr,
1037
- float* query, /* query point */
1038
- int* indices, /* array for storing the indices */
1052
+ int flann_radius_search(flann_index_t index_ptr, /* the index */
1053
+ float* query, /* query point */
1054
+ int* indices, /* array for storing the indices found (will be modified) */
1039
1055
float* dists, /* similar, but for storing distances */
1040
1056
int max_nn, /* size of arrays indices and dists */
1041
1057
float radius, /* search radius (squared radius for euclidian metric) */
1042
- int checks, /* number of features to check, sets the level
1043
- of approximation */
1044
- FLANNParameters* flann_params);
1058
+ struct FLANNParameters* flann_params);
1045
1059
\end {Verbatim }
1046
1060
1047
1061
This function performs a radius search to single query point. The indices of the neighbors found and
@@ -1071,7 +1085,7 @@ \subsubsection{flann\_load\_index()}
1071
1085
1072
1086
\subsubsection {flann\_ free\_ index() }
1073
1087
\begin {Verbatim }[fontsize=\footnotesize,frame=single]
1074
- int flann_free_index(FLANN_INDEX index_id,
1088
+ int flann_free_index(flann_index_t index_id,
1075
1089
struct FLANNParameters* flann_params);
1076
1090
\end {Verbatim }
1077
1091
This function deletes a previously constructed index and frees all the memory
@@ -1087,14 +1101,22 @@ \subsubsection{flann\_set\_distance\_type}
1087
1101
\begin {description }
1088
1102
\item [distance\_ type] The distance type to use. Possible values are
1089
1103
\begin {Verbatim }[fontsize=\footnotesize]
1090
- enum flann_distance_t {
1091
- FLANN_DIST_EUCLIDEAN = 1, // squared euclidean distance
1104
+ enum flann_distance_t
1105
+ {
1106
+ FLANN_DIST_EUCLIDEAN = 1,
1107
+ FLANN_DIST_L2 = 1,
1092
1108
FLANN_DIST_MANHATTAN = 2,
1109
+ FLANN_DIST_L1 = 2,
1093
1110
FLANN_DIST_MINKOWSKI = 3,
1094
- FLANN_DIST_HIST_INTERSECT = 5,
1095
- FlANN_DIST_HELLINGER = 6,
1096
- FLANN_DIST_CHI_SQUARE = 7, // chi-square
1097
- FLANN_DIST_KULLBACK_LEIBLER = 8, // kullback-leibler divergence
1111
+ FLANN_DIST_MAX = 4,
1112
+ FLANN_DIST_HIST_INTERSECT = 5,
1113
+ FLANN_DIST_HELLINGER = 6,
1114
+ FLANN_DIST_CHI_SQUARE = 7,
1115
+ FLANN_DIST_KULLBACK_LEIBLER = 8,
1116
+ FLANN_DIST_HAMMING = 9,
1117
+ FLANN_DIST_HAMMING_LUT = 10,
1118
+ FLANN_DIST_HAMMING_POPCNT = 11,
1119
+ FLANN_DIST_L2_SIMPLE = 12,
1098
1120
};
1099
1121
\end {Verbatim }
1100
1122
\item [order] Used in for the \texttt {FLANN\_ DIST\_ MINKOWSKI } distance type, to choose the order of the Minkowski distance.
0 commit comments