2 #error This class is not to be included by the user directly. Use SparseVectorNf.h or SparseVectorNd.h instead.
10 SPARSEVECTORN(
unsigned n,
const std::map<unsigned, REAL>& values);
11 SPARSEVECTORN(
unsigned n,
unsigned nnz, boost::shared_array<unsigned> indices, boost::shared_array<REAL> data);
15 unsigned size()
const {
return _size; }
16 unsigned num_elements()
const {
return _nelm; }
17 unsigned* get_indices() {
return _indices.get(); }
18 REAL* get_data() {
return _data.get(); }
19 const unsigned* get_indices()
const {
return _indices.get(); }
20 const REAL* get_data()
const {
return _data.get(); }
27 boost::shared_array<unsigned> _indices;
28 boost::shared_array<REAL> _data;
33 std::ostream& operator<<(std::ostream& out,
const SPARSEVECTORN& s);
SPARSEVECTORN & mult(REAL scalar, SPARSEVECTORN &result) const
Multiplies this sparse vector by a scalar and returns the result in a new vector. ...
Definition: SparseVectorN.cpp:110
VECTORN & to_dense(VECTORN &result) const
Gets the dense version of the vector.
Definition: SparseVectorN.cpp:92
SPARSEVECTORN & negate()
Negates this sparse vector in place.
Definition: SparseVectorN.cpp:126
REAL dot(const VECTORN &x) const
Computes the dot product between a sparse vector and a dense vector.
Definition: SparseVectorN.cpp:76
A sparse vector represented in 'CSR' format.
Definition: SparseVectorN.h:6
A generic N-dimensional floating point vector.
Definition: VectorN.h:16
REAL square() const
Computes the dot product between a sparse vector and itself.
Definition: SparseVectorN.cpp:65
SPARSEVECTORN & operator*=(REAL scalar)
Multiplies this sparse vector by a scalar (in place)
Definition: SparseVectorN.cpp:102