SHOGUN
v3.2.0
|
template class SGSparseVector The assumtion is that the stored SGSparseVectorEntry<T>* vector is ordered by SGSparseVectorEntry.feat_index in non-decreasing order. This has to be assured by the user of the class.
在文件 HashedSparseFeatures.h 第 21 行定义.
Public 成员函数 | |
SGSparseVector () | |
SGSparseVector (SGSparseVectorEntry< T > *feats, index_t num_entries, bool ref_counting=true) | |
SGSparseVector (index_t num_entries, bool ref_counting=true) | |
SGSparseVector (const SGSparseVector &orig) | |
virtual | ~SGSparseVector () |
T | dense_dot (T alpha, T *vec, int32_t dim, T b) |
template<typename ST > | |
T | dense_dot (SGVector< ST > vec) |
T | sparse_dot (const SGSparseVector< T > &v) |
SGSparseVector< T > | get () |
int32_t | get_num_dimensions () |
void | sort_features (bool stable_pointer=false) |
T | get_feature (int32_t index) |
SGVector< T > | get_dense (int32_t dimension) |
SGVector< T > | get_dense () |
SGSparseVector< T > | clone () const |
void | load (CFile *loader) |
void | save (CFile *saver) |
void | display_vector (const char *name="vector", const char *prefix="") |
template<> | |
void | load (CFile *loader) |
template<> | |
void | save (CFile *saver) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
template<> | |
void | display_vector (const char *name, const char *prefix) |
int32_t | ref_count () |
静态 Public 成员函数 | |
static T | sparse_dot (const SGSparseVector< T > &a, const SGSparseVector< T > &b) |
Public 属性 | |
index_t | num_feat_entries |
SGSparseVectorEntry< T > * | features |
Protected 成员函数 | |
virtual void | copy_data (const SGReferencedData &orig) |
virtual void | init_data () |
virtual void | free_data () |
void | copy_refcount (const SGReferencedData &orig) |
int32_t | ref () |
int32_t | unref () |
静态 Protected 成员函数 | |
static int32_t | cmp_dot_prod_symmetry_fast (index_t alen, index_t blen) |
static T | dot_prod_asymmetric (const SGSparseVector< T > &a, const SGSparseVector< T > &b) |
static T | dot_prod_symmetric (const SGSparseVector< T > &a, const SGSparseVector< T > &b) |
SGSparseVector | ( | ) |
default constructor
在文件 SGSparseVector.cpp 第 9 行定义.
SGSparseVector | ( | SGSparseVectorEntry< T > * | feats, |
index_t | num_entries, | ||
bool | ref_counting = true |
||
) |
constructor for setting params
feats | vector of SGSparseVectorEntry ordered by SGSparseVectorEntry.feat_index in non-decreasing order |
num_entries | number of elements in feats vector |
ref_counting | use reference counting |
在文件 SGSparseVector.cpp 第 15 行定义.
SGSparseVector | ( | index_t | num_entries, |
bool | ref_counting = true |
||
) |
constructor to create new vector in memory
在文件 SGSparseVector.cpp 第 23 行定义.
SGSparseVector | ( | const SGSparseVector< T > & | orig | ) |
copy constructor
在文件 SGSparseVector.cpp 第 31 行定义.
|
virtual |
在文件 SGSparseVector.cpp 第 38 行定义.
SGSparseVector< T > clone | ( | ) | const |
clone vector
在文件 SGSparseVector.cpp 第 269 行定义.
helper function to compute dot product
determines whether symmetric (similar number of non-zero elements in both sparse vectors) or asymetric (logarithmically more elements in one vector) dot product computation routine shall be taken
alen | length of vector a |
blen | length of vector b |
在文件 SGSparseVector.cpp 第 329 行定义.
|
protectedvirtual |
|
protectedinherited |
copy refcount
在文件 SGReferencedData.cpp 第 58 行定义.
T dense_dot | ( | T | alpha, |
T * | vec, | ||
int32_t | dim, | ||
T | b | ||
) |
compute the dot product between dense weights and a sparse feature vector alpha * sparse^T * w + b
possible with subset
alpha | scalar to multiply with |
vec | dense vector to compute dot product with |
dim | length of the dense vector |
b | bias |
在文件 SGSparseVector.cpp 第 44 行定义.
T dense_dot | ( | SGVector< ST > | vec | ) |
compute the dot product between dense weights and a sparse feature vector sparse^T * w
vec | dense vector to compute dot product with |
在文件 SGSparseVector.cpp 第 63 行定义.
void display_vector | ( | const char * | name = "vector" , |
const char * | prefix = "" |
||
) |
display vector
name | vector name in output |
prefix | prepend on every entry |
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 395 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 404 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 413 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 422 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 431 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 440 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 449 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 458 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 467 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 476 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 485 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 494 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 503 行定义.
void display_vector | ( | const char * | name, |
const char * | prefix | ||
) |
在文件 SGSparseVector.cpp 第 512 行定义.
|
staticprotected |
compute dot product between vectors a and b
particularly fast if len(a) << len(b)
a | vector a |
b | vector b |
在文件 SGSparseVector.cpp 第 342 行定义.
|
staticprotected |
compute dot product between vectors a and b
particularly fast if len(a) ~= len(b)
a | vector a |
b | vector b |
在文件 SGSparseVector.cpp 第 360 行定义.
|
protectedvirtual |
SGSparseVector<T> get | ( | ) |
get the sparse vector (no copying is done here)
在文件 SGSparseVector.h 第 106 行定义.
SGVector< T > get_dense | ( | int32_t | dimension | ) |
get dense representation of given size
dimension | of requested dense vector |
在文件 SGSparseVector.cpp 第 249 行定义.
SGVector< T > get_dense | ( | ) |
T get_feature | ( | int32_t | index | ) |
int32_t get_num_dimensions | ( | ) |
|
protectedvirtual |
needs to be overridden to initialize empty data
实现了 SGReferencedData.
在文件 SGSparseVector.cpp 第 315 行定义.
void load | ( | CFile * | loader | ) |
void load | ( | CFile * | loader | ) |
在文件 SGSparseVector.cpp 第 296 行定义.
|
protectedinherited |
|
inherited |
void save | ( | CFile * | saver | ) |
void save | ( | CFile * | saver | ) |
在文件 SGSparseVector.cpp 第 302 行定义.
void sort_features | ( | bool | stable_pointer = false | ) |
sort features by indices (Setting stable_pointer=true to guarantee that pointer features does not change. On the other hand, stable_pointer=false can shrink the vector if possible.)
stable_pointer | (default false) enforce stable pointer |
在文件 SGSparseVector.cpp 第 132 行定义.
T sparse_dot | ( | const SGSparseVector< T > & | v | ) |
compute the dot product between current sparse vector and a given sparse vector. sparse_a^T * sparse_b
v | sparse vector |
在文件 SGSparseVector.cpp 第 86 行定义.
|
static |
compute the dot product between two sparse vectors. sparse_a^T * sparse_b
a | sparse vector |
b | sparse vector |
在文件 SGSparseVector.cpp 第 92 行定义.
|
protectedinherited |
decrement reference counter and deallocate object if refcount is zero before or after decrementing it
在文件 SGReferencedData.cpp 第 87 行定义.
SGSparseVectorEntry<T>* features |
features
在文件 SGSparseVector.h 第 223 行定义.
index_t num_feat_entries |
number of feature entries
在文件 SGSparseVector.h 第 220 行定义.