iRoCS Toolbox  1.1.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends
svt::SparseFV Class Reference

The SparseFV class specifies a vector with sparse storage. More...

#include <SparseFV.hh>

Collaboration diagram for svt::SparseFV:

Public Types

typedef std::list< svt::SparseItem >::const_iterator const_iterator
 
typedef const double & const_reference
 
typedef std::list< svt::SparseItem >::iterator iterator
 
typedef double & reference
 
typedef unsigned int size_type
 

Public Member Functions

 SparseFV ()
 Constructor. More...
 
 ~SparseFV ()
 Destructor. More...
 
const_iterator begin () const
 
iterator begin ()
 
void cleanup ()
 cleanup function to delete items with value 0 (maybe someone needs this) More...
 
void clear ()
 Clear FV's data. More...
 
double dotProduct (const svt::SparseFV &fv) const
 Calculate and return dot product of *this and specified FV. More...
 
const_iterator end () const
 
iterator end ()
 
double getLabel () const
 Returns label of FV. More...
 
void operator*= (double factor)
 
void operator+= (const svt::SparseFV &fv)
 
bool operator== (const svt::SparseFV &fv) const
 comparison More...
 
double operator[] (size_type index) const
 Return const reference to value data item with specified index. More...
 
reference operator[] (size_type index)
 Return reference to value data item with specified index. More...
 
void readWithoutLabel (std::istream &is)
 Read FV from input stream without label. More...
 
void resize (size_type s)
 resizing sparse vector has no effect on the vector. More...
 
void setLabel (double value)
 Set FV's label. More...
 
void setUniqueID (unsigned int uid)
 
void setZero ()
 
size_type size () const
 size of sparse vector is just the value of the last resize() More...
 
double square () const
 Calculate and return square of FV. More...
 
unsigned int uniqueID () const
 
void writeWithoutLabel (std::ostream &os) const
 Write FV to output stream without label. More...
 

Static Public Member Functions

static const char * helpPipeFormat ()
 

Protected Attributes

size_type _size
 
unsigned int _uniqueID
 
std::list< svt::SparseItempFeatures
 
double pLabel
 
double pSquare
 
bool pSquareValid
 

Friends

std::ostream & operator<< (std::ostream &os, const svt::SparseFV &fv)
 
std::istream & operator>> (std::istream &is, svt::SparseFV &fv)
 

Detailed Description

The SparseFV class specifies a vector with sparse storage.

only non-zero elements of thethe vector are stored in a list

Definition at line 137 of file SparseFV.hh.

Member Typedef Documentation

◆ iterator

Definition at line 140 of file SparseFV.hh.

◆ const_iterator

Definition at line 141 of file SparseFV.hh.

◆ reference

typedef double& svt::SparseFV::reference

Definition at line 142 of file SparseFV.hh.

◆ const_reference

typedef const double& svt::SparseFV::const_reference

Definition at line 143 of file SparseFV.hh.

◆ size_type

typedef unsigned int svt::SparseFV::size_type

Definition at line 144 of file SparseFV.hh.

Constructor & Destructor Documentation

◆ SparseFV()

svt::SparseFV::SparseFV ( )
inline

Constructor.

Creates empty FV

Definition at line 151 of file SparseFV.hh.

◆ ~SparseFV()

svt::SparseFV::~SparseFV ( )
inline

Destructor.

Definition at line 164 of file SparseFV.hh.

Member Function Documentation

◆ getLabel()

double svt::SparseFV::getLabel ( ) const
inline

Returns label of FV.

Returns
label

Definition at line 174 of file SparseFV.hh.

◆ setLabel()

void svt::SparseFV::setLabel ( double  value)
inline

Set FV's label.

Parameters
valuenew label value

Definition at line 187 of file SparseFV.hh.

Referenced by svt::operator>>().

◆ setUniqueID()

void svt::SparseFV::setUniqueID ( unsigned int  uid)
inline

Definition at line 192 of file SparseFV.hh.

◆ uniqueID()

unsigned int svt::SparseFV::uniqueID ( ) const
inline

Definition at line 198 of file SparseFV.hh.

◆ clear()

void svt::SparseFV::clear ( )
inline

Clear FV's data.

Definition at line 209 of file SparseFV.hh.

◆ begin() [1/2]

const_iterator svt::SparseFV::begin ( ) const
inline

Definition at line 215 of file SparseFV.hh.

Referenced by dotProduct(), and operator+=().

◆ begin() [2/2]

iterator svt::SparseFV::begin ( )
inline

Definition at line 220 of file SparseFV.hh.

◆ end() [1/2]

const_iterator svt::SparseFV::end ( ) const
inline

Definition at line 226 of file SparseFV.hh.

Referenced by dotProduct().

◆ end() [2/2]

iterator svt::SparseFV::end ( )
inline

Definition at line 231 of file SparseFV.hh.

◆ operator[]() [1/2]

double svt::SparseFV::operator[] ( size_type  index) const
inline

Return const reference to value data item with specified index.

Parameters
index
Returns
value of data[index]

Definition at line 246 of file SparseFV.hh.

◆ operator[]() [2/2]

reference svt::SparseFV::operator[] ( size_type  index)
inline

Return reference to value data item with specified index.

Parameters
index
Returns
reference to value of data[index]

Definition at line 269 of file SparseFV.hh.

◆ resize()

void svt::SparseFV::resize ( size_type  s)
inline

resizing sparse vector has no effect on the vector.

Just remebering this value to return it, if someone asks for size() (just for compatibility to other containters)

Parameters

Definition at line 303 of file SparseFV.hh.

◆ size()

size_type svt::SparseFV::size ( ) const
inline

size of sparse vector is just the value of the last resize()

Parameters

Definition at line 321 of file SparseFV.hh.

◆ cleanup()

void svt::SparseFV::cleanup ( )
inline

cleanup function to delete items with value 0 (maybe someone needs this)

Todo:
optimize
Parameters

Definition at line 339 of file SparseFV.hh.

◆ square()

double svt::SparseFV::square ( ) const
inline

Calculate and return square of FV.

Returns
square of FV

Definition at line 367 of file SparseFV.hh.

◆ dotProduct()

double svt::SparseFV::dotProduct ( const svt::SparseFV fv) const
inline

Calculate and return dot product of *this and specified FV.

Parameters
fv
Returns
dot product of *this and fv

Definition at line 395 of file SparseFV.hh.

◆ operator==()

bool svt::SparseFV::operator== ( const svt::SparseFV fv) const
inline

comparison

Parameters
fv
Returns
true or false

Definition at line 434 of file SparseFV.hh.

◆ operator+=()

void svt::SparseFV::operator+= ( const svt::SparseFV fv)
inline

Definition at line 450 of file SparseFV.hh.

◆ operator*=()

void svt::SparseFV::operator*= ( double  factor)
inline

Definition at line 478 of file SparseFV.hh.

◆ setZero()

void svt::SparseFV::setZero ( )
inline

Definition at line 487 of file SparseFV.hh.

◆ readWithoutLabel()

void svt::SparseFV::readWithoutLabel ( std::istream &  is)
inline

Read FV from input stream without label.

Parameters
is

Definition at line 503 of file SparseFV.hh.

Referenced by svt::operator>>().

◆ writeWithoutLabel()

void svt::SparseFV::writeWithoutLabel ( std::ostream &  os) const
inline

Write FV to output stream without label.

Parameters
os

Definition at line 543 of file SparseFV.hh.

Referenced by svt::operator<<().

◆ helpPipeFormat()

static const char* svt::SparseFV::helpPipeFormat ( )
inlinestatic

Definition at line 553 of file SparseFV.hh.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const svt::SparseFV fv 
)
friend

Definition at line 578 of file SparseFV.hh.

◆ operator>>

std::istream& operator>> ( std::istream &  is,
svt::SparseFV fv 
)
friend

Definition at line 586 of file SparseFV.hh.

Field Documentation

◆ pFeatures

std::list<svt::SparseItem> svt::SparseFV::pFeatures
protected

Definition at line 567 of file SparseFV.hh.

Referenced by operator+=(), and operator==().

◆ pLabel

double svt::SparseFV::pLabel
protected

Definition at line 568 of file SparseFV.hh.

Referenced by svt::operator<<().

◆ _uniqueID

unsigned int svt::SparseFV::_uniqueID
protected

Definition at line 569 of file SparseFV.hh.

◆ pSquareValid

bool svt::SparseFV::pSquareValid
mutableprotected

Definition at line 571 of file SparseFV.hh.

◆ pSquare

double svt::SparseFV::pSquare
mutableprotected

Definition at line 572 of file SparseFV.hh.

◆ _size

size_type svt::SparseFV::_size
protected

Definition at line 573 of file SparseFV.hh.


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