Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions

SGSparseVector< T > Class Template Reference


Detailed Description

template<class T>
class shogun::SGSparseVector< T >

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.

Definition at line 39 of file SGSparseVector.h.

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

List of all members.

Public Member Functions

 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 ()
dense_dot (T alpha, T *vec, int32_t dim, T b)
sparse_dot (const SGSparseVector< T > &v)
int32_t ref_count ()

Static Public Member Functions

static T sparse_dot (const SGSparseVector< T > &a, const SGSparseVector< T > &b)

Public Attributes

index_t num_feat_entries
SGSparseVectorEntry< T > * features

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

Static Protected Member Functions

static int32_t floor_log (index_t n)
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)

Constructor & Destructor Documentation

SGSparseVector (  ) 

default constructor

Definition at line 43 of file SGSparseVector.h.

SGSparseVector ( SGSparseVectorEntry< T > *  feats,
index_t  num_entries,
bool  ref_counting = true 
)

constructor for setting params

Parameters:
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

Definition at line 54 of file SGSparseVector.h.

SGSparseVector ( index_t  num_entries,
bool  ref_counting = true 
)

constructor to create new vector in memory

Definition at line 62 of file SGSparseVector.h.

SGSparseVector ( const SGSparseVector< T > &  orig  ) 

copy constructor

Definition at line 70 of file SGSparseVector.h.

virtual ~SGSparseVector (  )  [virtual]

Definition at line 76 of file SGSparseVector.h.


Member Function Documentation

static int32_t cmp_dot_prod_symmetry_fast ( index_t  alen,
index_t  blen 
) [static, protected]

Definition at line 178 of file SGSparseVector.h.

virtual void copy_data ( const SGReferencedData orig  )  [protected, virtual]

needs to be overridden to copy data

Implements SGReferencedData.

Definition at line 151 of file SGSparseVector.h.

void copy_refcount ( const SGReferencedData orig  )  [protected, inherited]

copy refcount

Definition at line 102 of file SGReferencedData.h.

T dense_dot ( alpha,
T *  vec,
int32_t  dim,
b 
)

compute the dot product between dense weights and a sparse feature vector alpha * sparse^T * w + b

possible with subset

Parameters:
alpha scalar to multiply with
vec dense vector to compute dot product with
dim length of the dense vector
b bias
Returns:
dot product between dense weights and a sparse feature vector

Definition at line 92 of file SGSparseVector.h.

static T dot_prod_asymmetric ( const SGSparseVector< T > &  a,
const SGSparseVector< T > &  b 
) [static, protected]

Definition at line 190 of file SGSparseVector.h.

static T dot_prod_symmetric ( const SGSparseVector< T > &  a,
const SGSparseVector< T > &  b 
) [static, protected]

Definition at line 207 of file SGSparseVector.h.

static int32_t floor_log ( index_t  n  )  [static, protected]

Definition at line 169 of file SGSparseVector.h.

virtual void free_data (  )  [protected, virtual]

needs to be overridden to free data

Implements SGReferencedData.

Definition at line 163 of file SGSparseVector.h.

virtual void init_data (  )  [protected, virtual]

needs to be overridden to initialize empty data

Implements SGReferencedData.

Definition at line 157 of file SGSparseVector.h.

int32_t ref (  )  [protected, inherited]

increase reference counter

Returns:
reference count

Definition at line 111 of file SGReferencedData.h.

int32_t ref_count (  )  [inherited]

display reference counter

Returns:
reference count

Definition at line 81 of file SGReferencedData.h.

static T sparse_dot ( const SGSparseVector< T > &  a,
const SGSparseVector< T > &  b 
) [static]

compute the dot product between two sparse vectors. sparse_a^T * sparse_b

Parameters:
a sparse vector
b sparse vector
Returns:
dot product between a and b

Definition at line 128 of file SGSparseVector.h.

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

Parameters:
v sparse vector
Returns:
dot product between the current sparse vector and v sparse vector

Definition at line 116 of file SGSparseVector.h.

int32_t unref (  )  [protected, inherited]

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

Returns:
reference count

Definition at line 136 of file SGReferencedData.h.


Member Data Documentation

features

Definition at line 246 of file SGSparseVector.h.

number of feature entries

Definition at line 243 of file SGSparseVector.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation