SHOGUN
4.2.0
|
template class SGSparseMatrix
Definition at line 27 of file base/Parameter.h.
Public Member Functions | |
SGSparseMatrix () | |
SGSparseMatrix (SGSparseVector< T > *vecs, index_t num_feat, index_t num_vec, bool ref_counting=true) | |
SGSparseMatrix (index_t num_feat, index_t num_vec, bool ref_counting=true) | |
SGSparseMatrix (SGMatrix< T > dense) | |
SGSparseMatrix (const SGSparseMatrix &orig) | |
virtual | ~SGSparseMatrix () |
const SGSparseVector< T > & | operator[] (index_t index) const |
SGSparseVector< T > & | operator[] (index_t index) |
SGSparseMatrix< T > | get () |
const SGVector< T > | operator* (SGVector< T > v) const |
template<class ST > | |
const SGVector< T > | operator* (SGVector< ST > v) const |
const T | operator() (index_t i_row, index_t i_col) const |
T & | operator() (index_t i_row, index_t i_col) |
void | load (CFile *loader) |
SGVector< float64_t > | load_with_labels (CLibSVMFile *libsvm_file, bool do_sort_features=true) |
void | save (CFile *saver) |
void | save_with_labels (CLibSVMFile *saver, SGVector< float64_t > labels) |
SGSparseMatrix< T > | get_transposed () |
void | from_dense (SGMatrix< T > full) |
void | sort_features () |
template<> | |
const SGVector< complex128_t > | operator* (SGVector< float64_t > v) const |
template<> | |
const SGVector< complex128_t > | operator* (SGVector< int32_t > v) const |
template<> | |
const SGVector< float64_t > | operator* (SGVector< int32_t > v) const |
template<> | |
void | load (CFile *loader) |
template<> | |
SGVector< float64_t > | load_with_labels (CLibSVMFile *file, bool do_sort_features) |
template<> | |
void | save (CFile *saver) |
template<> | |
void | save_with_labels (CLibSVMFile *saver, SGVector< float64_t > labels) |
int32_t | ref_count () |
Public Attributes | |
index_t | num_vectors |
total number of vectors More... | |
index_t | num_features |
total number of features More... | |
SGSparseVector< T > * | sparse_matrix |
array of sparse vectors of size num_vectors More... | |
Protected Member Functions | |
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 () |
SGSparseMatrix | ( | ) |
default constructor
Definition at line 11 of file SGSparseMatrix.cpp.
SGSparseMatrix | ( | SGSparseVector< T > * | vecs, |
index_t | num_feat, | ||
index_t | num_vec, | ||
bool | ref_counting = true |
||
) |
constructor for setting params
Definition at line 17 of file SGSparseMatrix.cpp.
SGSparseMatrix | ( | index_t | num_feat, |
index_t | num_vec, | ||
bool | ref_counting = true |
||
) |
constructor to create new matrix in memory
Definition at line 26 of file SGSparseMatrix.cpp.
SGSparseMatrix | ( | SGMatrix< T > | dense | ) |
constructor to create new sparse matrix from a dense one
dense | dense matrix to be converted |
Definition at line 34 of file SGSparseMatrix.cpp.
SGSparseMatrix | ( | const SGSparseMatrix< T > & | orig | ) |
copy constructor
Definition at line 40 of file SGSparseMatrix.cpp.
|
virtual |
destructor
Definition at line 46 of file SGSparseMatrix.cpp.
|
protectedvirtual |
|
protectedinherited |
copy refcount
Definition at line 55 of file SGReferencedData.cpp.
|
protectedvirtual |
void from_dense | ( | SGMatrix< T > | full | ) |
create a sparse matrix from a dense one
full | the dense matrix to create the sparse one from |
Definition at line 232 of file SGSparseMatrix.cpp.
SGSparseMatrix<T> get | ( | ) |
get the sparse matrix (no copying is done here)
Definition at line 75 of file SGSparseMatrix.h.
SGSparseMatrix< T > get_transposed | ( | ) |
return the transposed of the sparse matrix
Definition at line 182 of file SGSparseMatrix.cpp.
|
protectedvirtual |
void load | ( | CFile * | loader | ) |
Definition at line 102 of file SGSparseMatrix.cpp.
void load | ( | CFile * | loader | ) |
load sparse matrix from file
loader | File object via which to load data |
Definition at line 91 of file SGSparseMatrix.cpp.
SGVector< float64_t > load_with_labels | ( | CLibSVMFile * | file, |
bool | do_sort_features | ||
) |
Definition at line 123 of file SGSparseMatrix.cpp.
SGVector< float64_t > load_with_labels | ( | CLibSVMFile * | libsvm_file, |
bool | do_sort_features = true |
||
) |
load sparse matrix from libsvm file together with labels
libsvm_file | the libsvm file |
do_sort_features | whether to sort the vector indices (such that they are in ascending order) after loading |
Definition at line 107 of file SGSparseMatrix.cpp.
operator overload for sparse-matrix read only access
i_row | |
i_col |
Definition at line 106 of file SGSparseMatrix.h.
operator overload for sparse-matrix r/w access
i_row | |
i_col |
Definition at line 127 of file SGSparseMatrix.h.
const SGVector< complex128_t > operator* | ( | SGVector< float64_t > | v | ) | const |
Definition at line 52 of file SGSparseMatrix.cpp.
const SGVector< complex128_t > operator* | ( | SGVector< int32_t > | v | ) | const |
Definition at line 65 of file SGSparseMatrix.cpp.
Definition at line 78 of file SGSparseMatrix.cpp.
compute sparse-matrix dense-vector multiplication
v | the dense-vector to be multiplied with |
Definition at line 84 of file SGSparseMatrix.h.
compute sparse-matrix dense-vector multiplication
v | the dense-vector to be multiplied with |
const SGSparseVector<T>& operator[] | ( | index_t | index | ) | const |
index access operator
Definition at line 59 of file SGSparseMatrix.h.
SGSparseVector<T>& operator[] | ( | index_t | index | ) |
index access operator
Definition at line 65 of file SGSparseMatrix.h.
|
protectedinherited |
increase reference counter
Definition at line 64 of file SGReferencedData.cpp.
|
inherited |
display reference counter
Definition at line 41 of file SGReferencedData.cpp.
void save | ( | CFile * | saver | ) |
Definition at line 137 of file SGSparseMatrix.cpp.
void save | ( | CFile * | saver | ) |
save sparse matrix to file
saver | File object via which to save data |
Definition at line 127 of file SGSparseMatrix.cpp.
void save_with_labels | ( | CLibSVMFile * | saver, |
SGVector< float64_t > | labels | ||
) |
Definition at line 155 of file SGSparseMatrix.cpp.
void save_with_labels | ( | CLibSVMFile * | saver, |
SGVector< float64_t > | labels | ||
) |
save sparse matrix together with labels to file
saver | File object via which to save data |
labels | label vector |
Definition at line 142 of file SGSparseMatrix.cpp.
void sort_features | ( | ) |
sort the indices of the sparse matrix such that they are in ascending order
Definition at line 224 of file SGSparseMatrix.cpp.
|
protectedinherited |
decrement reference counter and deallocate object if refcount is zero before or after decrementing it
Definition at line 84 of file SGReferencedData.cpp.
index_t num_features |
total number of features
Definition at line 207 of file SGSparseMatrix.h.
index_t num_vectors |
total number of vectors
Definition at line 204 of file SGSparseMatrix.h.
SGSparseVector<T>* sparse_matrix |
array of sparse vectors of size num_vectors
Definition at line 210 of file SGSparseMatrix.h.