Ravelin
Public Member Functions | Protected Attributes | List of all members
SPARSEVECTORN Class Reference

A sparse vector represented in 'CSR' format. More...

#include <SparseVectorN.h>

Public Member Functions

 SPARSEVECTORN (unsigned n, const std::map< unsigned, REAL > &values)
 
 SPARSEVECTORN (unsigned n, unsigned nnz, boost::shared_array< unsigned > indices, boost::shared_array< REAL > data)
 
 SPARSEVECTORN (const VECTORN &v)
 Creates a sparse vector from a dense vector.
 
REAL dot (const VECTORN &x) const
 Computes the dot product between a sparse vector and a dense vector.
 
REAL square () const
 Computes the dot product between a sparse vector and itself.
 
unsigned size () const
 
unsigned num_elements () const
 
unsigned * get_indices ()
 
REAL * get_data ()
 
const unsigned * get_indices () const
 
const REAL * get_data () const
 
VECTORNto_dense (VECTORN &result) const
 Gets the dense version of the vector.
 
SPARSEVECTORNnegate ()
 Negates this sparse vector in place.
 
SPARSEVECTORNoperator*= (REAL scalar)
 Multiplies this sparse vector by a scalar (in place)
 
SPARSEVECTORNmult (REAL scalar, SPARSEVECTORN &result) const
 Multiplies this sparse vector by a scalar and returns the result in a new vector.
 

Protected Attributes

boost::shared_array< unsigned > _indices
 
boost::shared_array< REAL > _data
 
unsigned _size
 
unsigned _nelm
 

Detailed Description

A sparse vector represented in 'CSR' format.


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