SHOGUN  v2.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Protected Member Functions
SGSparseMatrix< T > Class Template Reference

Detailed Description

template<class T>
class shogun::SGSparseMatrix< T >

template class SGSparseMatrix

Definition at line 27 of file SGSparseMatrix.h.

Inheritance diagram for SGSparseMatrix< T >:
Inheritance graph
[legend]

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 (const SGSparseMatrix &orig)
virtual ~SGSparseMatrix ()
const SGSparseVector< T > & operator[] (index_t index) const
SGSparseVector< T > & operator[] (index_t index)
SGSparseMatrix< T > get ()
void load (CFile *loader)
void save (CFile *saver)
int32_t ref_count ()

Public Attributes

index_t num_vectors
 total number of vectors
index_t num_features
 total number of features
SGSparseVector< T > * sparse_matrix
 array of sparse vectors of size num_vectors

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 ()

Constructor & Destructor Documentation

default constructor

Definition at line 8 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 14 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 23 of file SGSparseMatrix.cpp.

SGSparseMatrix ( const SGSparseMatrix< T > &  orig)

copy constructor

Definition at line 31 of file SGSparseMatrix.cpp.

~SGSparseMatrix ( )
virtual

destructor

Definition at line 37 of file SGSparseMatrix.cpp.

Member Function Documentation

void copy_data ( const SGReferencedData orig)
protectedvirtual

copy data

Implements SGReferencedData.

Definition at line 65 of file SGSparseMatrix.cpp.

void copy_refcount ( const SGReferencedData orig)
protectedinherited

copy refcount

Definition at line 67 of file SGReferencedData.cpp.

void free_data ( )
protectedvirtual

free data

Implements SGReferencedData.

Definition at line 81 of file SGSparseMatrix.cpp.

SGSparseMatrix<T> get ( )

get the sparse matrix (no copying is done here)

Returns
the refcount increased matrix

Definition at line 63 of file SGSparseMatrix.h.

void init_data ( )
protectedvirtual

init data

Implements SGReferencedData.

Definition at line 73 of file SGSparseMatrix.cpp.

void load ( CFile loader)

load sparse matrix from file

Parameters
loaderFile object via which to load data

Definition at line 43 of file SGSparseMatrix.cpp.

const SGSparseVector<T>& operator[] ( index_t  index) const

index access operator

Definition at line 47 of file SGSparseMatrix.h.

SGSparseVector<T>& operator[] ( index_t  index)

index access operator

Definition at line 53 of file SGSparseMatrix.h.

int32_t ref ( )
protectedinherited

increase reference counter

Returns
reference count

Definition at line 76 of file SGReferencedData.cpp.

int32_t ref_count ( )
inherited

display reference counter

Returns
reference count

Definition at line 47 of file SGReferencedData.cpp.

void save ( CFile saver)

save sparse matrix to file

Parameters
saverFile object via which to save data

Definition at line 54 of file SGSparseMatrix.cpp.

int32_t unref ( )
protectedinherited

decrement reference counter and deallocate object if refcount is zero before or after decrementing it

Returns
reference count

Definition at line 101 of file SGReferencedData.cpp.

Member Data Documentation

index_t num_features

total number of features

Definition at line 97 of file SGSparseMatrix.h.

index_t num_vectors

total number of vectors

Definition at line 94 of file SGSparseMatrix.h.

SGSparseVector<T>* sparse_matrix

array of sparse vectors of size num_vectors

Definition at line 100 of file SGSparseMatrix.h.


The documentation for this class was generated from the following files:

SHOGUN Machine Learning Toolbox - Documentation