Skip to content

Commit 521fedc

Browse files
committed
c-code in manual upated
1 parent 4f4683b commit 521fedc

File tree

1 file changed

+91
-69
lines changed

1 file changed

+91
-69
lines changed

doc/manual.tex

Lines changed: 91 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -683,16 +683,16 @@ \subsubsection{flann::Index::knnSearch}
683683
struct SearchParams
684684
{
685685
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;
696696
};
697697
\end{Verbatim}
698698
\begin{description}
@@ -769,10 +769,10 @@ \subsubsection{flann::hierarchicalClustering}
769769

770770
\begin{Verbatim}[fontsize=\footnotesize,frame=single]
771771
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())
776776
\end{Verbatim}
777777
\begin{description}
778778
\item[features]{The points to be clustered}
@@ -902,52 +902,66 @@ \subsubsection{flann\_build\_index()}
902902
\item [flann\_params] - is a structure containing the parameters passed to
903903
the function. This structure is defined as follows:
904904
\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 */
937947
};
938948
\end{Verbatim}
939949

940950
The \texttt{algorithm} and \texttt{centers\_init} fields can take the
941951
following values:
942952
\begin{Verbatim}[fontsize=\footnotesize]
943-
enum flann_algorithm_t {
953+
enum flann_algorithm_t
954+
{
944955
FLANN_INDEX_LINEAR = 0,
945956
FLANN_INDEX_KDTREE = 1,
946957
FLANN_INDEX_KMEANS = 2,
947958
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
949963
FLANN_INDEX_SAVED = 254,
950-
FLANN_INDEX_AUTOTUNED = 255
964+
FLANN_INDEX_AUTOTUNED = 255,
951965
};
952966
953967
enum flann_centers_init_t {
@@ -976,20 +990,22 @@ \subsubsection{flann\_build\_index()}
976990
The field \texttt{log\_level} controls the verbosity of the messages generated by the FLANN
977991
library functions. It can take the following values:
978992
\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
9851001
};
9861002
\end{Verbatim}
9871003
\end{description}
9881004

9891005

9901006
\subsubsection{flann\_find\_nearest\_neighbors\_index()}
9911007
\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,
9931009
float* testset,
9941010
int trows,
9951011
int* indices,
@@ -1033,15 +1049,13 @@ \subsubsection{flann\_find\_nearest\_neighbors()}
10331049
\subsubsection{flann\_radius\_search()}
10341050

10351051
\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) */
10391055
float* dists, /* similar, but for storing distances */
10401056
int max_nn, /* size of arrays indices and dists */
10411057
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);
10451059
\end{Verbatim}
10461060

10471061
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()}
10711085

10721086
\subsubsection{flann\_free\_index()}
10731087
\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,
10751089
struct FLANNParameters* flann_params);
10761090
\end{Verbatim}
10771091
This function deletes a previously constructed index and frees all the memory
@@ -1087,14 +1101,22 @@ \subsubsection{flann\_set\_distance\_type}
10871101
\begin{description}
10881102
\item[distance\_type] The distance type to use. Possible values are
10891103
\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,
10921108
FLANN_DIST_MANHATTAN = 2,
1109+
FLANN_DIST_L1 = 2,
10931110
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,
10981120
};
10991121
\end{Verbatim}
11001122
\item[order] Used in for the \texttt{FLANN\_DIST\_MINKOWSKI} distance type, to choose the order of the Minkowski distance.

0 commit comments

Comments
 (0)