Templates -- Meow
1.1.2
不能,也不應該先編譯成obj-file的templates
|
跟KD_Tree很像歐 More...
#include "VP_Tree.h"
Public Types | |
typedef std::vector< Vector > | Vectors |
Public Member Functions | |
VP_Tree () | |
constructor, with dimension = 1 More... | |
VP_Tree (VP_Tree const &tree2) | |
constructor, 複製資料 More... | |
VP_Tree (size_t dimension) | |
constructor, 給定dimension More... | |
~VP_Tree () | |
destructor More... | |
VP_Tree & | copyFrom (VP_Tree const &tree2) |
複製資料 More... | |
void | insert (Vector const &vector) |
將給定的Vector加到set中 More... | |
bool | erase (Vector const &vector) |
將給定的Vector從set移除 More... | |
void | build () |
檢查至今是否有 insert/erase 被呼叫來決定是否 rebuild() More... | |
void | forceBuild () |
重新建樹 More... | |
Vectors | query (Vector const &vector, size_t nearestNumber, bool compareWholeVector) const |
查找 More... | |
void | clear () |
清空所有資料 More... | |
size_t | reset (size_t dimension) |
清空所有資料並重新給定維度 More... | |
VP_Tree & | operator= (VP_Tree const &tree2) |
same as copyFrom(tree2) More... | |
跟KD_Tree很像歐
VP_Tree
用來維護由 N個K維度向量所成的集合 , 並可於該set中查找 前i個離給定向量最接近的向量* . 不像 KD_Tree
二分樹每次都選擇一個維度去分, 分成小的跟大的, VP_Tree
每次選一個點, 將資料分成 離這個點近的, 跟離這個點遠的. 至於怎麼選呢...., 嘛還沒研究, 先random
參考資料連結:
const? | Typename | Operator | Parameters | Return Type | Description |
---|---|---|---|---|---|
const | Vector | operator[] | (size_t n ) | Scalar | 取得第n 維度量 |
const | Vector | operator= | (Vector v ) | Vector& | copy operator |
const | Vector | operator< | (Vector v ) | bool | 權重比較 |
const | Scalar | 'Scalar' | (int n ) | Scalar | 建構子, |
其中一定n=0or4
| |const | Scalar|operator* |(Scalar s
) | Scalar | 相乘 | |const | Scalar|operator+ |(Scalar s
) | Scalar | 相加 | |const | Scalar|operator- |(Scalar s
) | Scalar | 相差 | |const | Scalar|operator- |( ) | Scalar | 取負號 | |const | Scalar|operator< |(Scalar s
) | bool | 大小比較 |
typedef std::vector<Vector> meow::VP_Tree< Vector, Scalar >::Vectors |
|
inline |
constructor, with dimension = 1
|
inline |
constructor, 複製資料
|
inline |
constructor, 給定dimension
|
inline |
destructor
|
inline |
檢查至今是否有 insert/erase 被呼叫來決定是否 rebuild()
|
inline |
清空所有資料
|
inline |
複製資料
|
inline |
將給定的Vector從set移除
|
inline |
重新建樹
|
inline |
將給定的Vector加到set中
|
inline |
same as copyFrom(tree2)
|
inline |
查找
於set中找尋距離指定向量前 i
近的向量, 並依照由近而遠的順序排序. 如果有兩個向量v1
,v2 距離一樣, 且 cmp
為true
, 則直接依照 v1<v2
來決定誰在前面. 最後回傳一陣列包含所有解.
|
inline |
清空所有資料並重新給定維度