DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
spams::SpVector< T > Class Template Reference

#include <linalg.h>

Detailed Description

template<typename T>
class spams::SpVector< T >

Sparse Vector class.

Sparse vector class.

Definition at line 67 of file linalg.h.

Public Member Functions

asum () const
 
void clear ()
 
dot (const SpVector< T > &vec) const
 
fmaxval () const
 
int L () const
 
length () const
 
nrm2 () const
 
nrm2sq () const
 
nzmax () const
 
void print (const string &name) const
 
int r (const int i) const
 
T * rawX () const
 
void refIndices (Vector< int > &indices) const
 
void refVal (Vector< T > &val) const
 
void resize (const int nzmax)
 
void setL (const int L)
 
 SpVector (T *v, int *r, int L, int nzmax)
 
 SpVector (int nzmax)
 
 SpVector ()
 
void sqr ()
 
void toFull (Vector< T > &out) const
 
void toSpMatrix (SpMatrix< T > &out, const int m, const int n) const
 
v (const int i) const
 
 ~SpVector ()
 

Private Member Functions

SpVector< T > & operator= (const SpVector< T > &vector)
 
 SpVector (const SpVector< T > &vector)
 

Private Attributes

bool _externAlloc
 
int _L
 
int _nzmax
 
int * _r
 
T * _v
 

Friends

class Matrix< T >
 
class SpMatrix< T >
 
class Vector< T >
 

Constructor & Destructor Documentation

template<typename T >
spams::SpVector< T >::SpVector ( T *  v,
int *  r,
int  L,
int  nzmax 
)

Constructor, of the sparse vector of size L.

Definition at line 4868 of file linalg.h.

template<typename T >
spams::SpVector< T >::SpVector ( int  nzmax)

Constructor, allocates nzmax slots.

Definition at line 4872 of file linalg.h.

References spams::SpVector< T >::_r, spams::SpVector< T >::_v, and spams::SpVector< T >::nzmax().

+ Here is the call graph for this function:

template<typename T >
spams::SpVector< T >::SpVector ( )

Empty constructor.

Definition at line 4882 of file linalg.h.

template<typename T >
spams::SpVector< T >::~SpVector ( )

Destructor.

Definition at line 4887 of file linalg.h.

References spams::SpVector< T >::clear().

+ Here is the call graph for this function:

template<typename T>
spams::SpVector< T >::SpVector ( const SpVector< T > &  vector)
explicitprivate

forbids lazy copies

Member Function Documentation

template<typename T >
T spams::SpVector< T >::asum ( ) const
inline

computes the sum of the magnitude of the elements

Definition at line 4891 of file linalg.h.

References spams::SpVector< T >::_L, and spams::SpVector< T >::_v.

Referenced by spams::SpMatrix< T >::norm_1_cols().

+ Here is the caller graph for this function:

template<typename T >
void spams::SpVector< T >::clear ( )
inline

clears the vector

Modifiers clears the vector

Definition at line 4958 of file linalg.h.

References spams::SpVector< T >::_externAlloc, spams::SpVector< T >::_L, spams::SpVector< T >::_nzmax, spams::SpVector< T >::_r, and spams::SpVector< T >::_v.

Referenced by spams::SpMatrix< T >::refCol(), spams::SpVector< T >::resize(), and spams::SpVector< T >::~SpVector().

+ Here is the caller graph for this function:

template<typename T >
T spams::SpVector< T >::dot ( const SpVector< T > &  vec) const
inline

dot product

Definition at line 4937 of file linalg.h.

References spams::SpVector< T >::_L, spams::SpVector< T >::_r, and spams::SpVector< T >::_v.

Referenced by spams::ShiftMatrix< T >::m(), spams::DoubleRowMatrix< T >::m(), and spams::SpMatrix< T >::multTrans().

+ Here is the caller graph for this function:

template<typename T >
T spams::SpVector< T >::fmaxval ( ) const
inline

computes the linf norm of the vector

computes the l2 norm of the vector

Definition at line 4906 of file linalg.h.

References spams::SpVector< T >::_L, spams::SpVector< T >::_v, and spams::Vector< T >::fmaxval().

Referenced by spams::FISTA::GraphLasso< T >::eval_split().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
int spams::SpVector< T >::L ( ) const
inline
template<typename T>
T spams::SpVector< T >::length ( ) const
inline

returns the length of the vector

Definition at line 937 of file linalg.h.

Referenced by spams::SpMatrix< T >::norm_0_cols().

+ Here is the caller graph for this function:

template<typename T >
T spams::SpVector< T >::nrm2 ( ) const
inline

computes the l2 norm of the vector

Definition at line 4901 of file linalg.h.

References spams::SpVector< T >::_L, and spams::SpVector< T >::_v.

Referenced by spams::FISTA::GraphLasso< T >::eval_split().

+ Here is the caller graph for this function:

template<typename T >
T spams::SpVector< T >::nrm2sq ( ) const
inline

computes the l2 norm ^2 of the vector

Definition at line 4896 of file linalg.h.

References spams::SpVector< T >::_L, and spams::SpVector< T >::_v.

Referenced by spams::SpMatrix< T >::norm_2sq_cols().

+ Here is the caller graph for this function:

template<typename T>
T spams::SpVector< T >::nzmax ( ) const
inline

Accessors returns the length of the vector

Definition at line 935 of file linalg.h.

Referenced by spams::FISTA::GraphLasso< T >::prox_split(), spams::SpVector< T >::resize(), and spams::SpVector< T >::SpVector().

+ Here is the caller graph for this function:

template<typename T>
SpVector<T>& spams::SpVector< T >::operator= ( const SpVector< T > &  vector)
private
template<typename T >
void spams::SpVector< T >::print ( const string &  name) const
inline

print the vector to std::cerr

Definition at line 4912 of file linalg.h.

References spams::SpVector< T >::_L, spams::SpVector< T >::_nzmax, spams::SpVector< T >::_r, and spams::SpVector< T >::_v.

Referenced by spams::ShiftMatrix< T >::m(), and spams::DoubleRowMatrix< T >::m().

+ Here is the caller graph for this function:

template<typename T>
int spams::SpVector< T >::r ( const int  i) const
inline
template<typename T>
T* spams::SpVector< T >::rawX ( ) const
inline

Definition at line 956 of file linalg.h.

Referenced by spams::FISTA::GraphLasso< T >::prox_split().

+ Here is the caller graph for this function:

template<typename T >
void spams::SpVector< T >::refIndices ( Vector< int > &  indices) const
inline

create a reference on the vector r

Definition at line 4920 of file linalg.h.

References spams::SpVector< T >::_L, spams::SpVector< T >::_r, and spams::Vector< T >::setPointer().

Referenced by spams::Trainer< T >::train().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void spams::SpVector< T >::refVal ( Vector< T > &  val) const
inline

creates a reference on the vector val

Definition at line 4926 of file linalg.h.

References spams::SpVector< T >::_L, spams::SpVector< T >::_v, and spams::Vector< T >::setPointer().

Referenced by spams::Trainer< T >::train().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void spams::SpVector< T >::resize ( const int  nzmax)
inline

resizes the vector

Definition at line 4971 of file linalg.h.

References spams::SpVector< T >::_externAlloc, spams::SpVector< T >::_L, spams::SpVector< T >::_nzmax, spams::SpVector< T >::_r, spams::SpVector< T >::_v, spams::SpVector< T >::clear(), and spams::SpVector< T >::nzmax().

Referenced by spams::ist(), spams::Trainer< T >::train(), and spams::Trainer< T >::trainOffline().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::SpVector< T >::setL ( const int  L)
inline

Definition at line 960 of file linalg.h.

References spams::Data< T >::m(), spams::Data< T >::n(), and spams::sqr().

Referenced by spams::Trainer< T >::train().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void spams::SpVector< T >::sqr ( )
inline

a <- a.^2

Definition at line 4932 of file linalg.h.

References spams::SpVector< T >::_L, and spams::SpVector< T >::_v.

template<typename T >
void spams::SpVector< T >::toFull ( Vector< T > &  out) const
inline

resize the vector as a sparse matrix

Definition at line 5008 of file linalg.h.

References spams::SpVector< T >::_L, spams::SpVector< T >::_r, spams::SpVector< T >::_v, spams::Vector< T >::rawX(), and spams::Vector< T >::setZeros().

Referenced by spams::ShiftMatrix< T >::mult().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void spams::SpVector< T >::toSpMatrix ( SpMatrix< T > &  out,
const int  m,
const int  n 
) const
inline

resize the vector as a sparse matrix

Definition at line 4985 of file linalg.h.

References spams::SpVector< T >::_L, spams::SpMatrix< T >::_pB, spams::SpMatrix< T >::_r, spams::SpVector< T >::_r, spams::SpMatrix< T >::_v, spams::SpVector< T >::_v, and spams::SpMatrix< T >::resize().

+ Here is the call graph for this function:

template<typename T>
T spams::SpVector< T >::v ( const int  i) const
inline

access table r

Definition at line 955 of file linalg.h.

Referenced by spams::SpMatrix< T >::mult(), and spams::FISTA::update_multipliers_weighted_ADMM().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

template<typename T>
friend class Matrix< T >
friend

Definition at line 919 of file linalg.h.

template<typename T>
friend class SpMatrix< T >
friend

Definition at line 920 of file linalg.h.

template<typename T>
friend class Vector< T >
friend

Definition at line 921 of file linalg.h.

Member Data Documentation

template<typename T>
bool spams::SpVector< T >::_externAlloc
private

external allocation

Definition at line 985 of file linalg.h.

Referenced by spams::SpVector< T >::clear(), spams::SpMatrix< T >::refCol(), and spams::SpVector< T >::resize().

template<typename T>
int spams::SpVector< T >::_L
private
template<typename T>
int spams::SpVector< T >::_nzmax
private

maximum number of nonzeros elements

Definition at line 993 of file linalg.h.

Referenced by spams::SpVector< T >::clear(), spams::SpVector< T >::print(), spams::SpMatrix< T >::refCol(), and spams::SpVector< T >::resize().

template<typename T>
int* spams::SpVector< T >::_r
private
template<typename T>
T* spams::SpVector< T >::_v
private

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