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

#include <linalg.h>

+ Inheritance diagram for spams::Vector< T >:
+ Collaboration diagram for spams::Vector< T >:

Detailed Description

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

Dense Vector class.

Class for dense vector.

Definition at line 65 of file linalg.h.

Public Member Functions

void add (const Vector< T > &x, const T a=1.0)
 
void add (const SpVector< T > &x, const T a=1.0)
 
void add (const T a)
 
afused () const
 
bool allfalse () const
 
template<>
bool allfalse () const
 
bool alltrue () const
 
template<>
bool alltrue () const
 
void applyBayerPattern (const int offset)
 
asum () const
 
void clear ()
 
void copy (const Vector< T > &x)
 
void copyMask (Vector< T > &out, Vector< bool > &mask) const
 
void div (const Vector< T > &x)
 
void div (const Vector< T > &x, const Vector< T > &y)
 
dot (const Vector< T > &x) const
 
dot (const SpVector< T > &x) const
 
void exp ()
 
void fakeSize (const int n)
 
int fmax () const
 
fmaxval () const
 
int fmin () const
 
fminval () const
 
void fusedProject (Vector< T > &out, const T lambda1, const T lambda2, const int itermax)
 
void fusedProjectHomotopy (Vector< T > &out, const T lambda1, const T lambda2, const T lambda3=0, const bool penalty=true)
 
void hardThrshold (const T nu)
 
void inv (const Vector< T > &x)
 
void inv ()
 
void Invsqrt (const Vector< T > &x)
 
void Invsqrt ()
 
KL (const Vector< T > &X)
 
void l1l2project (Vector< T > &out, const T thrs, const T gamma, const bool pos=false) const
 
void l1l2projectb (Vector< T > &out, const T thrs, const T gamma, const bool pos=false, const int mode=1)
 
void l1project (Vector< T > &out, const T thrs, const bool simplex=false) const
 
void l1project_weighted (Vector< T > &out, const Vector< T > &weights, const T thrs, const bool residual=false) const
 
void log ()
 
void logexp ()
 
void logspace (const int n, const T a, const T b)
 
template<>
void logspace (const int n, const int a, const int b)
 
lzero () const
 
int max () const
 
maxval () const
 
mean ()
 
int min () const
 
minval () const
 
void mult (const Vector< T > &x, const Vector< T > &y)
 
void mult_elementWise (const Vector< T > &B, Vector< T > &C) const
 
int n () const
 
void neg ()
 
int nnz () const
 
void normalize ()
 
void normalize2 ()
 
nrm2 () const
 
nrm2sq () const
 
T & operator[] (const int index)
 
operator[] (const int index) const
 
void print (const char *name) const
 
template<>
void print (const char *name) const
 
template<>
void print (const char *name) const
 
template<>
void print (const char *name) const
 
template<>
void print (const char *name) const
 
void project_sft (const Vector< int > &labels, const int clas)
 
void project_sft_binary (const Vector< T > &labels)
 
void randperm (int n)
 
template<>
void randperm (int n)
 
T * rawX () const
 
void resize (const int n)
 
void scal (const T a)
 
void set (const T val)
 
void setAleat ()
 
void setData (T *X, const int n)
 
void setn (const int n)
 
void setPointer (T *X, const int n)
 
void setZeros ()
 
void sign (Vector< T > &signs) const
 
softmax (const int y)
 
void softThrshold (const T nu)
 
void sort (Vector< T > &out, const bool mode) const
 
void sort (const bool mode)
 
void sort2 (Vector< T > &out, Vector< int > &key, const bool mode) const
 
void sort2 (Vector< int > &key, const bool mode)
 
void sparseProject (Vector< T > &out, const T thrs, const int mode=1, const T lambda1=0, const T lambda2=0, const T lambda3=0, const bool pos=false)
 
void sqr (const Vector< T > &x)
 
void Sqrt (const Vector< T > &x)
 
void Sqrt ()
 
std ()
 
void sub (const Vector< T > &x)
 
void sub (const SpVector< T > &x)
 
sum () const
 
void thrsabsmin (const T nu)
 
void thrshold (const T nu)
 
void thrsmax (const T nu)
 
void thrsmin (const T nu)
 
void thrsPos ()
 
void toSparse (SpVector< T > &vec) const
 
void unwhiten (Vector< T > &mean, const bool pattern=false)
 
 Vector ()
 
 Vector (int n)
 
 Vector (const Vector< T > &vec)
 
 Vector (T *X, int n)
 
void whiten (Vector< T > &mean, const bool pattern=false)
 
void whiten (Vector< T > &mean, const Vector< T > &mask)
 
void whiten (const int V)
 
virtual ~Vector ()
 

Private Member Functions

Vector< T > & operator= (const Vector< T > &vec)
 

Private Attributes

bool _externAlloc
 
int _n
 
T * _X
 

Friends

class Matrix< T >
 
class SpMatrix< T >
 
class SpVector< T >
 

Constructor & Destructor Documentation

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

Empty constructor.

Definition at line 2693 of file linalg.h.

template<typename T >
spams::Vector< T >::Vector ( int  n)

Constructor. Create a new vector of size n.

Definition at line 2697 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T>
spams::Vector< T >::Vector ( T *  X,
int  n 
)

Constructor with existing data.

Definition at line 2706 of file linalg.h.

template<typename T>
spams::Vector< T >::Vector ( const Vector< T > &  vec)
explicit

Copy constructor.

Definition at line 2710 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T >
spams::Vector< T >::~Vector ( )
virtual

Destructor.

Definition at line 2720 of file linalg.h.

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

+ Here is the call graph for this function:

Member Function Documentation

template<typename T>
void spams::Vector< T >::add ( const Vector< T > &  x,
const T  a = 1.0 
)
inline
template<typename T>
void spams::Vector< T >::add ( const SpVector< T > &  x,
const T  a = 1.0 
)
inline
template<typename T>
void spams::Vector< T >::add ( const T  a)
inline

adds a to each value in the vector

Definition at line 3047 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T >
T spams::Vector< T >::afused ( ) const
inline

compute the sum of the differences

Definition at line 3336 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and spams::Vector< T >::sum().

Referenced by spams::Vector< T >::fusedProjectHomotopy().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
bool spams::Vector< T >::allfalse ( ) const
inline

Referenced by spams::lasso_mask(), and spams::omp_mask().

+ Here is the caller graph for this function:

template<>
bool spams::Vector< bool >::allfalse ( ) const
inline

Definition at line 2988 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T>
bool spams::Vector< T >::alltrue ( ) const
inline

Referenced by spams::lasso_mask(), and spams::omp_mask().

+ Here is the caller graph for this function:

template<>
bool spams::Vector< bool >::alltrue ( ) const
inline

Definition at line 2980 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T >
void spams::Vector< T >::applyBayerPattern ( const int  offset)
inline

sort the vector

Definition at line 3917 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and spams::Vector< T >::n().

+ Here is the call graph for this function:

template<typename T >
T spams::Vector< T >::asum ( ) const
inline
template<typename T >
void spams::Vector< T >::clear ( )
inline
template<typename T>
void spams::Vector< T >::copy ( const Vector< T > &  x)
inline

make a copy of x

Definition at line 2865 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::n(), and spams::Vector< T >::resize().

Referenced by spams::FISTA::ADMM(), spams::Trainer< T >::cleanDict(), spams::Matrix< T >::conjugateGradient(), spams::SpMatrix< T >::copy_direct(), spams::coreLARS(), spams::coreORMP(), spams::coreSOMP(), spams::Matrix< T >::eigLargestMagnSym(), spams::Matrix< T >::eigLargestSymApprox(), spams::FISTA::SqLossMissing< T >::eval(), spams::FISTA::SqLoss< T >::eval(), spams::FISTA::Lasso< T >::fenchel(), spams::FISTA::LassoConstraint< T >::fenchel(), spams::FISTA::Ridge< T >::fenchel(), spams::FISTA::normL2< T >::fenchel(), spams::FISTA::normLINF< T >::fenchel(), spams::FISTA::GraphLasso< T >::fenchel(), spams::FISTA::TreeLasso< T >::fenchel(), spams::FISTA::GraphPathConv< T >::fenchel(), spams::Vector< T >::fusedProjectHomotopy(), spams::FISTA::SqLossMissing< T >::grad(), spams::FISTA::SqLoss< T >::grad(), spams::Vector< T >::l1l2project(), spams::Vector< T >::l1l2projectb(), spams::Vector< T >::l1project(), spams::Vector< T >::l1project_weighted(), spams::lassoReweighted(), spams::FISTA::LinADMM(), spams::Matrix< T >::merge(), spams::ShiftMatrix< T >::multTrans(), spams::Matrix< T >::NadarayaWatson(), spams::Tree_Seq< T >::proj_weighted_linf(), spams::FISTA::Lasso< T >::prox(), spams::FISTA::LassoConstraint< T >::prox(), spams::FISTA::Lzero< T >::prox(), spams::FISTA::None< T >::prox(), spams::FISTA::Ridge< T >::prox(), spams::FISTA::normL2< T >::prox(), spams::FISTA::normLINF< T >::prox(), spams::FISTA::FusedLasso< T >::prox(), spams::FISTA::GraphLasso< T >::prox(), spams::FISTA::TreeLasso< T >::prox(), spams::FISTA::TreeLzero< T >::prox(), spams::FISTA::GroupProx< T, Reg >::prox(), spams::FISTA::GraphPathL0< T >::prox(), spams::FISTA::GraphPathConv< T >::prox(), spams::FISTA::SqLoss< T >::prox_prim_var(), spams::FISTA::HingeLoss< T >::prox_prim_var(), spams::FISTA::GraphLasso< T >::prox_split(), spams::Vector< T >::sort(), spams::Vector< T >::sort2(), spams::Matrix< T >::sparseProject(), spams::Vector< T >::sparseProject(), spams::FISTA::Ridge< T >::sub_grad(), spams::Matrix< T >::svd(), spams::Matrix< T >::svdRankOne(), spams::FISTA::SqLoss< T >::test_backtracking(), spams::Trainer< T >::train(), spams::Trainer< T >::trainOffline(), spams::FISTA::update_multipliers_ADMM(), spams::FISTA::update_multipliers_weighted_ADMM(), spams::FISTA::SqLossMissing< T >::var_fenchel(), and spams::FISTA::SqLoss< T >::var_fenchel().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::copyMask ( Vector< T > &  out,
Vector< bool > &  mask 
) const
inline

extract the rows of a matrix corresponding to a binary mask

Definition at line 4041 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::resize(), and spams::Vector< T >::setn().

Referenced by spams::lasso_mask(), and spams::omp_mask().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::div ( const Vector< T > &  x)
inline
template<typename T>
void spams::Vector< T >::div ( const Vector< T > &  x,
const Vector< T > &  y 
)
inline

A <- x ./ y.

Definition at line 3070 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

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

returns A'x, when x is sparse

Definition at line 3018 of file linalg.h.

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

+ Here is the call graph for this function:

template<typename T >
void spams::Vector< T >::exp ( )
inline

replace each value by its exponential

Definition at line 3287 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

Referenced by spams::FISTA::MultiLogLoss< T >::grad(), spams::Vector< T >::softmax(), spams::FISTA::LogLoss< T, weighted >::var_fenchel(), and spams::FISTA::MultiLogLoss< T >::var_fenchel().

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::fakeSize ( const int  n)
inline

change artificially the size of the vector, DANGEROUS

Definition at line 595 of file linalg.h.

template<typename T >
int spams::Vector< T >::fmax ( ) const
inline
template<typename T >
T spams::Vector< T >::fmaxval ( ) const
inline
template<typename T >
int spams::Vector< T >::fmin ( ) const
inline

returns the index of the value with smallest magnitude

Definition at line 2848 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

Referenced by spams::Vector< T >::fminval(), and spams::Vector< T >::fusedProjectHomotopy().

+ Here is the caller graph for this function:

template<typename T >
T spams::Vector< T >::fminval ( ) const
inline

returns the minimum magnitude

Definition at line 2804 of file linalg.h.

References spams::Vector< T >::_X, and spams::Vector< T >::fmin().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::fusedProject ( Vector< T > &  out,
const T  lambda1,
const T  lambda2,
const int  itermax 
)
inline

Modification of beta

Update first coordinate

Update alpha_j

Definition at line 3846 of file linalg.h.

References spams::Vector< T >::_X, spams::Vector< T >::n(), spams::Vector< T >::rawX(), spams::softThrs(), spams::Vector< T >::softThrshold(), and spams::Vector< T >::sum().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::fusedProjectHomotopy ( Vector< T > &  out,
const T  lambda1,
const T  lambda2,
const T  lambda3 = 0,
const bool  penalty = true 
)
inline

Computation of DtR

first element is selected, gamma and alpha are updated

update alpha

update DtR

Solve the Lasso using simplified LARS

exit if constraints are satisfied min_u ||b-u||_2^2 + lambda1||u||_1 +lambda2 Fused(u) + 0.5lambda3||u||_2^2

min_u ||b-u||_2^2 / lambda1||u||_1 +lambda2 Fused(u) + 0.5lambda3||u||_2^2 <= 1.0

Update pr_ind and pr_c

Compute DDu

Check constraints

Check changes of sign

Check new variables entering the active set

Update gamma, alpha, DtR, currentLambda

Update signs,pr_ind, pr_c

Definition at line 3675 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::add(), spams::Vector< T >::afused(), spams::Vector< T >::asum(), spams::Vector< T >::copy(), spams::Vector< T >::fmax(), spams::Vector< T >::fmin(), INFINITY, MIN, spams::Vector< T >::nrm2sq(), spams::Vector< T >::rawX(), spams::Vector< T >::scal(), spams::Vector< T >::set(), spams::Vector< T >::setZeros(), spams::Vector< T >::softThrshold(), spams::Vector< T >::sub(), and spams::Vector< T >::sum().

Referenced by spams::FISTA::FusedLasso< T >::prox(), and spams::Vector< T >::sparseProject().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::hardThrshold ( const T  nu)
inline

performs soft-thresholding of the vector

Definition at line 2938 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

Referenced by spams::Matrix< T >::hardThrshold(), and spams::FISTA::Lzero< T >::prox().

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::inv ( const Vector< T > &  x)
inline
template<typename T>
void spams::Vector< T >::inv ( )
inline

A <- 1./A.

Definition at line 3109 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T>
void spams::Vector< T >::Invsqrt ( const Vector< T > &  x)
inline

A <- 1 ./ sqrt(x)

A <- x .^ 2.

Definition at line 3083 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and spams::Vector< T >::resize().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::Invsqrt ( )
inline

A <- 1 ./ sqrt(A)

A <- x .^ 2.

Definition at line 3093 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T>
T spams::Vector< T >::KL ( const Vector< T > &  X)
inline

compute the Kuhlback-Leiber divergence

Definition at line 3212 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::rawX(), and spams::Vector< T >::sum().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::l1l2project ( Vector< T > &  out,
const T  thrs,
const T  gamma,
const bool  pos = false 
) const
inline

projects the vector onto the l1 ball of radius thrs, projects the vector onto the l1 ball of radius thrs, returns true if the returned vector is null

returns true if the returned vector is null min_u ||b-u||_2^2 / ||u||_1 + (gamma/2) ||u||_2^2 <= thrs

BEGIN

Definition at line 3593 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::copy(), spams::Vector< T >::l1project(), spams::Vector< T >::nrm2sq(), spams::Vector< T >::scal(), spams::Vector< T >::softThrshold(), spams::Vector< T >::sum(), and spams::Vector< T >::thrsPos().

Referenced by spams::Vector< T >::l1l2projectb(), and spams::Vector< T >::sparseProject().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::l1l2projectb ( Vector< T > &  out,
const T  thrs,
const T  gamma,
const bool  pos = false,
const int  mode = 1 
)
inline

returns true if the returned vector is null

min_u ||b-u||_2^2 / ||u||_2^2 + gamma ||u||_1 <= thrs

min_u ||b-u||_2^2 / ||u||_1 + (gamma/2) ||u||_2^2 <= thrs

min_u 0.5||b-u||_2^2 + gamma||u||_1 / ||u||_2^2 <= thrs

Definition at line 3567 of file linalg.h.

References spams::Vector< T >::copy(), spams::Vector< T >::l1l2project(), spams::Vector< T >::nrm2(), spams::Vector< T >::scal(), spams::Vector< T >::softThrshold(), and spams::Vector< T >::thrsPos().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::l1project ( Vector< T > &  out,
const T  thrs,
const bool  simplex = false 
) const
inline

projects the vector onto the l1 ball of radius thrs, returns true if the returned vector is null

Definition at line 3364 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::copy(), spams::Vector< T >::softThrshold(), spams::Vector< T >::sum(), and spams::Vector< T >::thrsPos().

Referenced by spams::Vector< T >::l1l2project(), spams::FISTA::normLINF< T >::prox(), and spams::Vector< T >::sparseProject().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::l1project_weighted ( Vector< T > &  out,
const Vector< T > &  weights,
const T  thrs,
const bool  residual = false 
) const
inline

projects the vector onto the l1 ball of radius thrs, returns true if the returned vector is null

Definition at line 3417 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::copy(), spams::Vector< T >::div(), MAX, MIN, spams::Vector< T >::setZeros(), and spams::Vector< T >::sort2().

Referenced by spams::MaxFlow< T >::project_weighted().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void spams::Vector< T >::log ( )
inline

replace each value by its logarithm

Definition at line 3292 of file linalg.h.

References spams::Vector< T >::_X.

template<typename T >
void spams::Vector< T >::logexp ( )
inline

replace each value by its exponential

Definition at line 3297 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T>
void spams::Vector< T >::logspace ( const int  n,
const T  a,
const T  b 
)
inline

generate logarithmically spaced values

Definition at line 2809 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and spams::Vector< T >::resize().

Referenced by spams::Vector< T >::logspace().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<>
void spams::Vector< int >::logspace ( const int  n,
const int  a,
const int  b 
)
inline

generate logarithmically spaced values

Definition at line 2830 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::logspace(), and spams::Vector< T >::resize().

+ Here is the call graph for this function:

template<typename T >
T spams::Vector< T >::lzero ( ) const
inline

Definition at line 3328 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

Referenced by spams::FISTA::Lzero< T >::eval().

+ Here is the caller graph for this function:

template<typename T >
int spams::Vector< T >::max ( ) const
inline

returns the index of the largest value

Definition at line 2761 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

Referenced by spams::coreLARS(), spams::coreLARS2(), spams::coreLARS2W(), spams::coreSOMP(), spams::Vector< T >::maxval(), and spams::Vector< T >::softmax().

+ Here is the caller graph for this function:

template<typename T >
T spams::Vector< T >::maxval ( ) const
inline

returns the maximum value

Definition at line 2789 of file linalg.h.

References spams::Vector< T >::_X, and spams::Vector< T >::max().

Referenced by spams::coreGroupIST(), spams::coreGroupISTConstrained(), spams::FISTA::LassoConstraint< T >::fenchel(), spams::Matrix< T >::NadarayaWatson(), spams::omp(), spams::omp_mask(), and spams::Vector< T >::softmax().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
T spams::Vector< T >::mean ( )
inline

whiten

return the mean

Definition at line 3260 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::sum().

Referenced by spams::Matrix< T >::mean(), spams::Vector< T >::project_sft(), spams::Vector< T >::project_sft_binary(), spams::Vector< T >::std(), spams::Vector< T >::unwhiten(), and spams::Vector< T >::whiten().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
int spams::Vector< T >::min ( ) const
inline

returns the index of the minimum value

Definition at line 2775 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

Referenced by spams::Vector< T >::minval().

+ Here is the caller graph for this function:

template<typename T >
T spams::Vector< T >::minval ( ) const
inline

returns the minimum value

Definition at line 2794 of file linalg.h.

References spams::Vector< T >::_X, and spams::Vector< T >::min().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::mult ( const Vector< T > &  x,
const Vector< T > &  y 
)
inline
template<typename T>
void spams::Vector< T >::mult_elementWise ( const Vector< T > &  B,
Vector< T > &  C 
) const
inline

Definition at line 670 of file linalg.h.

template<typename T>
int spams::Vector< T >::n ( ) const
inline

returns the size of the vector

Definition at line 591 of file linalg.h.

Referenced by spams::SpMatrix< T >::AAt(), spams::Vector< T >::applyBayerPattern(), spams::SubMatrix< T >::convertIndicesI(), spams::SubMatrix< T >::convertIndicesJ(), spams::Vector< T >::copy(), spams::Matrix< T >::copyMask(), spams::coreORMP(), spams::count_cc_graph(), spams::FISTA::SqLossMissing< T >::eval(), spams::FISTA::SqLoss< T >::eval(), spams::FISTA::HingeLoss< T >::eval(), spams::FISTA::LogLoss< T, weighted >::eval(), spams::FISTA::Lasso< T >::eval(), spams::FISTA::Ridge< T >::eval(), spams::FISTA::normL2< T >::eval(), spams::FISTA::normLINF< T >::eval(), spams::FISTA::FusedLasso< T >::eval(), spams::FISTA::ProxMatToVec< T, ProxMat >::eval(), spams::FISTA::GroupProx< T, Reg >::eval(), spams::FISTA::MixedL1L2< T >::eval(), spams::FISTA::MixedL1LINF< T >::eval(), spams::FISTA::LogLoss< T, weighted >::fenchel(), spams::FISTA::Lasso< T >::fenchel(), spams::FISTA::LassoConstraint< T >::fenchel(), spams::FISTA::Ridge< T >::fenchel(), spams::FISTA::normL2< T >::fenchel(), spams::FISTA::normLINF< T >::fenchel(), spams::FISTA::GraphLasso< T >::fenchel(), spams::FISTA::TreeLasso< T >::fenchel(), spams::FISTA::ProxMatToVec< T, ProxMat >::fenchel(), spams::FISTA::GroupProx< T, Reg >::fenchel(), spams::FISTA::MixedL1L2< T >::fenchel(), spams::FISTA::MixedL1LINF< T >::fenchel(), spams::FISTA::GraphPathConv< T >::fenchel(), spams::Vector< T >::fusedProject(), spams::FISTA::SqLossMissing< T >::grad(), spams::FISTA::SqLoss< T >::grad(), spams::FISTA::LogLoss< T, weighted >::grad(), spams::FISTA::MultiLogLoss< T >::grad(), spams::FISTA::LogLoss< T, weighted >::init(), spams::FISTA::MultiLogLoss< T >::init(), spams::MaxFlow< T >::init_split_variables_aux(), spams::Vector< T >::inv(), spams::lasso_mask(), spams::Vector< T >::mult(), spams::Matrix< T >::multDiagLeft(), spams::Matrix< T >::multDiagRight(), spams::ShiftMatrix< T >::multTrans(), spams::Matrix< T >::NadarayaWatson(), spams::omp_mask(), spams::Tree_Seq< T >::proj(), spams::Tree_Seq< T >::proj_weighted_linf(), spams::Tree_Seq< T >::proj_zero(), spams::FISTA::Lasso< T >::prox(), spams::FISTA::LassoConstraint< T >::prox(), spams::FISTA::Lzero< T >::prox(), spams::FISTA::Ridge< T >::prox(), spams::FISTA::normL2< T >::prox(), spams::FISTA::normLINF< T >::prox(), spams::FISTA::FusedLasso< T >::prox(), spams::FISTA::TreeLasso< T >::prox(), spams::FISTA::TreeLzero< T >::prox(), spams::FISTA::ProxMatToVec< T, ProxMat >::prox(), spams::FISTA::GroupProx< T, Reg >::prox(), spams::FISTA::HingeLoss< T >::prox_prim_var(), spams::FISTA::GraphLasso< T >::prox_split(), spams::Matrix< T >::quad_mult(), spams::Vector< T >::randperm(), spams::Matrix< T >::rank1Update_mult(), spams::Vector< T >::resize(), spams::Vector< T >::setPointer(), spams::FISTA::Lasso< T >::sub_grad(), spams::FISTA::Ridge< T >::sub_grad(), spams::FISTA::TreeLasso< T >::sub_grad(), spams::FISTA::MixedL1L2< T >::sub_grad(), spams::Matrix< T >::subMatrixSym(), spams::FISTA::SqLoss< T >::test_backtracking(), spams::Trainer< T >::trainOffline(), spams::Matrix< T >::unwhiten(), spams::Vector< T >::unwhiten(), spams::FISTA::update_multipliers_ADMM(), spams::FISTA::update_multipliers_LinADMM(), spams::FISTA::update_multipliers_weighted_ADMM(), spams::FISTA::SqLossMissing< T >::var_fenchel(), spams::FISTA::SqLoss< T >::var_fenchel(), spams::FISTA::LogLoss< T, weighted >::var_fenchel(), spams::FISTA::MultiLogLoss< T >::var_fenchel(), spams::VectorToUtlVector(), spams::VectorToVnlVector(), spams::Matrix< T >::whiten(), spams::Vector< T >::whiten(), and spams::SpMatrix< T >::XAt().

template<typename T >
void spams::Vector< T >::neg ( )
inline

A <- -A.

Definition at line 3282 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

Referenced by spams::FISTA::LogLoss< T, weighted >::var_fenchel().

+ Here is the caller graph for this function:

template<typename T >
int spams::Vector< T >::nnz ( ) const
inline

Definition at line 2822 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and spams::Vector< T >::sum().

+ Here is the call graph for this function:

template<typename T >
void spams::Vector< T >::normalize ( )
inline

normalize the vector

Definition at line 3122 of file linalg.h.

References EPSILON, spams::Vector< T >::nrm2(), and spams::Vector< T >::scal().

Referenced by spams::Matrix< T >::clean(), spams::Trainer< T >::cleanDict(), spams::Matrix< T >::normalize(), and spams::Matrix< T >::svdRankOne().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void spams::Vector< T >::normalize2 ( )
inline

normalize the vector

Definition at line 3128 of file linalg.h.

References spams::Vector< T >::nrm2(), and spams::Vector< T >::scal().

Referenced by spams::Vector< T >::sparseProject(), 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 >
T spams::Vector< T >::nrm2 ( ) const
inline
template<typename T >
T spams::Vector< T >::nrm2sq ( ) const
inline
template<typename T>
Vector<T>& spams::Vector< T >::operator= ( const Vector< T > &  vec)
private

= operator,

template<typename T >
T & spams::Vector< T >::operator[] ( const int  index)
inline

returns a reference to X[index]

Definition at line 2853 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T >
T spams::Vector< T >::operator[] ( const int  index) const
inline

returns X[index]

Definition at line 2859 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T>
void spams::Vector< T >::print ( const char *  name) const
inline

Accessors Print the vector to std::cout

template<>
void spams::Vector< double >::print ( const char *  name) const
inline

Print the vector to std::cout.

Definition at line 2725 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<>
void spams::Vector< float >::print ( const char *  name) const
inline

Print the vector to std::cout.

Definition at line 2734 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<>
void spams::Vector< int >::print ( const char *  name) const
inline

Print the vector to std::cout.

Definition at line 2743 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<>
void spams::Vector< bool >::print ( const char *  name) const
inline

Print the vector to std::cout.

Definition at line 2752 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T >
void spams::Vector< T >::project_sft ( const Vector< int > &  labels,
const int  clas 
)
inline

Definition at line 3482 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::abs(), EPSILON, and spams::Vector< T >::mean().

Referenced by spams::FISTA::MultiLogLoss< T >::var_fenchel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::project_sft_binary ( const Vector< T > &  labels)
inline

Definition at line 3460 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::abs(), EPSILON, and spams::Vector< T >::mean().

Referenced by spams::FISTA::LogLoss< T, weighted >::var_fenchel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::randperm ( int  n)
inline

put a random permutation of size n (for integral vectors)

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

+ Here is the caller graph for this function:

template<>
void spams::Vector< int >::randperm ( int  n)
inline

put a random permutation of size n (for integral vectors)

Definition at line 2897 of file linalg.h.

References spams::Vector< T >::_X, spams::Vector< T >::n(), and spams::Vector< T >::resize().

+ Here is the call graph for this function:

template<typename T>
T* spams::Vector< T >::rawX ( ) const
inline

returns a modifiable reference of the data, DANGEROUS

Definition at line 593 of file linalg.h.

Referenced by spams::Matrix< T >::addDiag(), spams::SpMatrix< T >::addVecToCols(), spams::SpMatrix< T >::addVecToColsWeighted(), spams::SpMatrix< T >::convert2(), spams::SubMatrix< T >::convertIndicesI(), spams::SubMatrix< T >::convertIndicesJ(), spams::SubMatrix< T >::copyCol(), spams::ShiftMatrix< T >::copyRow(), spams::coreGroupIST(), spams::coreGroupISTConstrained(), spams::coreIST(), spams::coreISTconstrained(), spams::coreLARS(), spams::coreLARS2(), spams::coreLARS2W(), spams::coreORMP(), spams::coreSOMP(), spams::Matrix< T >::diag(), spams::SubMatrix< T >::diag(), spams::downDateLasso(), spams::Tree_Seq< T >::dual_norm_inf(), spams::Graph< T >::dual_norm_inf(), spams::FISTA::normL2< T >::eval(), spams::FISTA::normLINF< T >::eval(), spams::FISTA::GraphLasso< T >::eval(), spams::FISTA::TreeLasso< T >::eval(), spams::FISTA::TreeLzero< T >::eval(), spams::FISTA::ProxMatToVec< T, ProxMat >::eval(), spams::FISTA::GroupProx< T, Reg >::eval(), spams::FISTA::GraphPathL0< T >::eval(), spams::FISTA::GraphPathConv< T >::eval(), spams::FISTA::GraphPathConv< T >::eval_dual_norm(), spams::FISTA::GraphPathConv< T >::eval_dual_norm_paths(), spams::FISTA::GraphPathL0< T >::eval_paths(), spams::FISTA::GraphPathConv< T >::eval_paths(), spams::FISTA::TreeLasso< T >::fenchel(), spams::FISTA::ProxMatToVec< T, ProxMat >::fenchel(), spams::FISTA::GroupProx< T, Reg >::fenchel(), spams::FISTA::GraphPathConv< T >::fenchel(), spams::Vector< T >::fusedProject(), spams::Vector< T >::fusedProjectHomotopy(), spams::Vector< T >::KL(), spams::SpMatrix< T >::mult(), spams::ShiftMatrix< T >::mult(), spams::Matrix< T >::multDiagLeft(), spams::Matrix< T >::multDiagRight(), spams::Matrix< T >::multTrans(), spams::SpMatrix< T >::multTrans(), spams::ShiftMatrix< T >::multTrans(), spams::Tree_Seq< T >::proj(), spams::Tree_Seq< T >::proj_weighted_linf(), spams::Tree_Seq< T >::proj_zero(), spams::FISTA::normL2< T >::prox(), spams::FISTA::normLINF< T >::prox(), spams::FISTA::GraphLasso< T >::prox(), spams::FISTA::TreeLasso< T >::prox(), spams::FISTA::TreeLzero< T >::prox(), spams::FISTA::ProxMatToVec< T, ProxMat >::prox(), spams::FISTA::GroupProx< T, Reg >::prox(), spams::FISTA::GraphPathL0< T >::prox(), spams::FISTA::GraphPathConv< T >::prox(), spams::FISTA::GraphLasso< T >::prox_split(), spams::Matrix< T >::setDiag(), spams::Vector< T >::sign(), spams::Matrix< T >::singularValues(), spams::Vector< T >::sort2(), spams::Tree_Seq< T >::sub_grad(), spams::Matrix< T >::subMatrixSym(), spams::Matrix< T >::svd(), spams::SpVector< T >::toFull(), spams::Trainer< T >::train(), spams::UtlVectorToVector(), spams::VectorToUtlVector(), spams::VectorToVnlVector(), and spams::VnlVectorToVector().

template<typename T >
void spams::Vector< T >::resize ( const int  n)
inline

resize the vector

Definition at line 2876 of file linalg.h.

References spams::Vector< T >::_externAlloc, spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::clear(), spams::Vector< T >::n(), and spams::Vector< T >::setZeros().

Referenced by spams::Matrix< T >::center(), spams::Vector< T >::copy(), spams::Matrix< T >::copyCol(), spams::Vector< T >::copyMask(), spams::Matrix< T >::copyRow(), spams::SpMatrix< T >::copyRow(), spams::coreSOMP(), spams::Matrix< T >::diag(), spams::FISTA::EvalGraphPath(), spams::Matrix< T >::extractRow(), spams::SpMatrix< T >::getData(), spams::FISTA::SqLoss< T >::init_prim_var(), spams::FISTA::HingeLoss< T >::init_prim_var(), spams::Vector< T >::inv(), spams::Vector< T >::Invsqrt(), spams::ist(), spams::lasso(), spams::lasso2(), spams::lasso_mask(), spams::lassoReweighted(), spams::lassoWeight(), spams::lassoWeightPreComputed(), spams::Vector< T >::logspace(), spams::Matrix< T >::mult(), spams::Vector< T >::mult(), spams::SpMatrix< T >::mult(), spams::ShiftMatrix< T >::mult(), spams::DoubleRowMatrix< T >::mult(), spams::Matrix< T >::multTrans(), spams::SpMatrix< T >::multTrans(), spams::ShiftMatrix< T >::multTrans(), spams::SpMatrix< T >::norm_0_cols(), spams::SpMatrix< T >::norm_1_cols(), spams::Matrix< T >::norm_2_cols(), spams::Matrix< T >::norm_2_rows(), spams::Matrix< T >::norm_2sq_cols(), spams::SpMatrix< T >::norm_2sq_cols(), spams::Matrix< T >::norm_2sq_rows(), spams::Matrix< T >::norm_inf_cols(), spams::Matrix< T >::norm_inf_rows(), spams::Matrix< T >::norm_l1_rows(), spams::omp(), spams::omp_mask(), spams::FISTA::FusedLasso< T >::prox(), spams::FISTA::ProxMatToVec< T, ProxMat >::prox(), spams::FISTA::PROX(), spams::Vector< T >::randperm(), spams::Matrix< T >::singularValues(), spams::Matrix< T >::sparseProject(), spams::Vector< T >::sqr(), spams::Vector< T >::Sqrt(), spams::FISTA::Lasso< T >::sub_grad(), spams::FISTA::Ridge< T >::sub_grad(), spams::FISTA::TreeLasso< T >::sub_grad(), spams::Matrix< T >::sum_cols(), spams::SpMatrix< T >::sum_cols(), spams::Matrix< T >::svd(), spams::Matrix< T >::svdRankOne(), spams::Trainer< T >::train(), spams::Trainer< T >::trainOffline(), spams::UtlVectorToVector(), spams::FISTA::LogLoss< T, weighted >::var_fenchel(), and spams::VnlVectorToVector().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::scal ( const T  a)
inline
template<typename T>
void spams::Vector< T >::set ( const T  val)
inline
template<typename T >
void spams::Vector< T >::setAleat ( )
inline

put random values in the vector (White Gaussian Noise)

put random values in the vector (white Gaussian Noise)

Definition at line 2912 of file linalg.h.

Referenced by spams::Matrix< T >::clean(), spams::Matrix< T >::eigLargestMagnSym(), spams::FISTA::Rank< T >::eval(), spams::Matrix< T >::normalize(), and spams::Matrix< T >::svdRankOne().

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::setData ( T *  X,
const int  n 
)
inline
template<typename T>
void spams::Vector< T >::setn ( const int  n)
inline

Definition at line 627 of file linalg.h.

Referenced by spams::Vector< T >::copyMask(), spams::lasso_mask(), spams::omp_mask(), and spams::MaxFlow< T >::project_weighted().

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::setPointer ( T *  X,
const int  n 
)
inline
template<typename T >
void spams::Vector< T >::setZeros ( )
inline

Set all values to zero.

Modifiers Set all values to zero

Definition at line 2871 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

Referenced by spams::Matrix< T >::center_rows(), spams::SpMatrix< T >::copyRow(), spams::coreLARS(), spams::coreLARS2(), spams::coreLARS2W(), spams::coreSOMP(), spams::Vector< T >::fusedProjectHomotopy(), spams::SpMatrix< T >::getData(), spams::FISTA::MultiLogLoss< T >::grad(), spams::FISTA::SqLoss< T >::init_prim_var(), spams::FISTA::HingeLoss< T >::init_prim_var(), spams::MaxFlow< T >::init_split_variables_aux(), spams::ist_groupLasso(), spams::Vector< T >::l1project_weighted(), spams::lasso(), spams::lasso2(), spams::lasso_mask(), spams::lassoWeight(), spams::lassoWeightPreComputed(), spams::Matrix< T >::mult(), spams::SpMatrix< T >::mult(), spams::ShiftMatrix< T >::mult(), spams::DoubleRowMatrix< T >::mult(), spams::Matrix< T >::multTrans(), spams::SpMatrix< T >::multTrans(), spams::ShiftMatrix< T >::multTrans(), spams::Matrix< T >::norm_2_rows(), spams::Matrix< T >::norm_2sq_rows(), spams::Matrix< T >::norm_inf_rows(), spams::Matrix< T >::norm_l1_rows(), spams::FISTA::normL2< T >::prox(), spams::FISTA::Rank< T >::prox(), spams::FISTA::GraphLasso< T >::prox_split(), spams::Vector< T >::resize(), spams::Tree_Seq< T >::sub_grad(), spams::FISTA::None< T >::sub_grad(), spams::MaxFlow< T >::sub_gradient(), spams::Matrix< T >::sum_cols(), spams::SpMatrix< T >::sum_cols(), spams::SpVector< T >::toFull(), spams::Trainer< T >::train(), spams::Trainer< T >::trainOffline(), spams::FISTA::MultiLogLoss< T >::var_fenchel(), and spams::Matrix< T >::whiten().

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::sign ( Vector< T > &  signs) const
inline

puts in signs, the sign of each point in the vector

Definition at line 3351 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and spams::Vector< T >::rawX().

+ Here is the call graph for this function:

template<typename T >
T spams::Vector< T >::softmax ( const int  y)
inline

replace each value by its exponential

Definition at line 3308 of file linalg.h.

References spams::Vector< T >::_X, spams::Vector< T >::add(), spams::Vector< T >::exp(), INFINITY, spams::Vector< T >::max(), spams::Vector< T >::maxval(), and spams::Vector< T >::sum().

Referenced by spams::FISTA::MultiLogLoss< T >::eval().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::softThrshold ( const T  nu)
inline
template<typename T>
void spams::Vector< T >::sort ( Vector< T > &  out,
const bool  mode 
) const
inline

sort the vector

projects the vector onto the l1 ball of radius thrs, sort the vector

Definition at line 3899 of file linalg.h.

References spams::Vector< T >::copy(), and spams::Vector< T >::sort().

Referenced by spams::Vector< T >::sort().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::sort ( const bool  mode)
inline

sort the vector

Definition at line 3888 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, decr, and incr.

template<typename T>
void spams::Vector< T >::sort2 ( Vector< T > &  out,
Vector< int > &  key,
const bool  mode 
) const
inline

Definition at line 3911 of file linalg.h.

References spams::Vector< T >::copy(), and spams::Vector< T >::sort2().

Referenced by spams::Vector< T >::l1project_weighted(), and spams::Vector< T >::sort2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::sort2 ( Vector< int > &  key,
const bool  mode 
)
inline

sort the vector

Definition at line 3905 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::quick_sort(), and spams::Vector< T >::rawX().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::sparseProject ( Vector< T > &  out,
const T  thrs,
const int  mode = 1,
const T  lambda1 = 0,
const T  lambda2 = 0,
const T  lambda3 = 0,
const bool  pos = false 
)
inline

min_u ||b-u||_2^2 / ||u||_1 <= thrs

min_u ||b-u||_2^2 / ||u||_2^2 + lambda1||u||_1 <= thrs

min_u ||b-u||_2^2 / ||u||_1 + (lambda1/2) ||u||_2^2 <= thrs

min_u 0.5||b-u||_2^2 + lambda1||u||_1 / ||u||_2^2 <= thrs

min_u 0.5||b-u||_2^2 + lambda1||u||_1 +lambda2 Fused(u) / ||u||_2^2 <= thrs

min_u 0.5||b-u||_2^2 + lambda1||u||_1 +lambda2 Fused(u) +0.5lambda_3 ||u||_2^2

min_u ||b-u||_2^2 / lambda1||u||_1 +lambda2 Fused(u) + 0.5lambda3||u||_2^2 <= thrs

min_u ||b-u||_2^2 / (1-lambda1)*||u||_2^2 + lambda1||u||_1 <= thrs

Definition at line 3508 of file linalg.h.

References spams::Vector< T >::copy(), spams::Vector< T >::fusedProjectHomotopy(), spams::Vector< T >::l1l2project(), spams::Vector< T >::l1project(), spams::Vector< T >::normalize2(), spams::Vector< T >::nrm2sq(), spams::Vector< T >::scal(), spams::Vector< T >::softThrshold(), and spams::Vector< T >::thrsPos().

Referenced by spams::Trainer< T >::cleanDict(), spams::FISTA::LassoConstraint< T >::prox(), spams::Matrix< T >::sparseProject(), 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::Vector< T >::sqr ( const Vector< T > &  x)
inline

A <- x .^ 2.

Definition at line 3077 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and spams::Vector< T >::resize().

Referenced by spams::coreORMP(), and spams::coreSOMP().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::Sqrt ( const Vector< T > &  x)
inline

A <- 1 ./ sqrt(x)

A <- x .^ 2.

Definition at line 3088 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and spams::Vector< T >::resize().

Referenced by spams::Matrix< T >::singularValues(), and spams::Matrix< T >::svd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::Sqrt ( void  )
inline

A <- 1 ./ sqrt(x)

A <- x .^ 2.

Definition at line 3097 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T >
T spams::Vector< T >::std ( )
inline

whiten

return the std

Definition at line 3265 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, utl::E, and spams::Vector< T >::mean().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::sub ( const Vector< T > &  x)
inline
template<typename T>
void spams::Vector< T >::sub ( const SpVector< T > &  x)
inline
template<typename T >
T spams::Vector< T >::sum ( ) const
inline
template<typename T>
void spams::Vector< T >::thrsabsmin ( const T  nu)
inline

performs thresholding of the vector

Definition at line 2960 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, MAX, and MIN.

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

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::thrshold ( const T  nu)
inline

performs soft-thresholding of the vector

performs thresholding of the vector

Definition at line 2967 of file linalg.h.

References spams::Vector< T >::_n, and spams::Vector< T >::_X.

template<typename T>
void spams::Vector< T >::thrsmax ( const T  nu)
inline

performs soft-thresholding of the vector

performs thresholding of the vector

Definition at line 2948 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and MAX.

Referenced by spams::Matrix< T >::thrsmax().

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::thrsmin ( const T  nu)
inline

performs thresholding of the vector

Definition at line 2954 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and MIN.

Referenced by spams::Matrix< T >::thrsmin().

+ Here is the caller graph for this function:

template<typename T >
void spams::Vector< T >::thrsPos ( )
inline
template<typename T>
void spams::Vector< T >::toSparse ( SpVector< T > &  vec) const
inline
template<typename T>
void spams::Vector< T >::unwhiten ( Vector< T > &  mean,
const bool  pattern = false 
)
inline

whiten

unwhiten

Definition at line 3233 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::mean(), and spams::Vector< T >::n().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::whiten ( Vector< T > &  mean,
const bool  pattern = false 
)
inline

whiten

Definition at line 3134 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, spams::Vector< T >::mean(), and spams::Vector< T >::n().

Referenced by spams::FISTA::SqLossMissing< T >::var_fenchel(), and spams::FISTA::SqLoss< T >::var_fenchel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
void spams::Vector< T >::whiten ( Vector< T > &  mean,
const Vector< T > &  mask 
)
inline

whiten

Definition at line 3179 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, utl::cblas_asum(), spams::Vector< T >::mean(), and spams::Vector< T >::n().

+ Here is the call graph for this function:

template<typename T>
void spams::Vector< T >::whiten ( const int  V)
inline

whiten

Definition at line 3198 of file linalg.h.

References spams::Vector< T >::_n, spams::Vector< T >::_X, and spams::Vector< T >::mean().

+ Here is the call graph for this function:

Friends And Related Function Documentation

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

Definition at line 550 of file linalg.h.

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

Definition at line 549 of file linalg.h.

template<typename T>
friend class SpVector< T >
friend

Definition at line 551 of file linalg.h.

Member Data Documentation

template<typename T>
bool spams::Vector< T >::_externAlloc
private
template<typename T>
int spams::Vector< T >::_n
private

size of the vector

Definition at line 756 of file linalg.h.

Referenced by spams::Vector< T >::add(), spams::Vector< T >::afused(), spams::Vector< T >::allfalse(), spams::Vector< T >::alltrue(), spams::Vector< T >::applyBayerPattern(), spams::Vector< T >::asum(), spams::Vector< T >::clear(), spams::Vector< T >::copy(), spams::Matrix< T >::copyMask(), spams::Vector< T >::copyMask(), spams::Vector< T >::div(), spams::Vector< T >::dot(), spams::Vector< T >::exp(), spams::Vector< T >::fmax(), spams::Vector< T >::fmin(), spams::Vector< T >::fusedProjectHomotopy(), spams::Vector< T >::hardThrshold(), spams::Vector< T >::inv(), spams::Vector< T >::Invsqrt(), spams::Vector< T >::KL(), spams::Vector< T >::l1l2project(), spams::Vector< T >::l1project(), spams::Vector< T >::l1project_weighted(), spams::Vector< T >::logexp(), spams::Vector< T >::logspace(), spams::Vector< T >::lzero(), spams::Vector< T >::max(), spams::Vector< T >::mean(), spams::Vector< T >::min(), spams::Vector< T >::mult(), spams::Vector< T >::neg(), spams::Vector< T >::nnz(), spams::Vector< T >::nrm2(), spams::Vector< T >::nrm2sq(), spams::Vector< T >::operator[](), spams::Vector< T >::print(), spams::Vector< T >::project_sft(), spams::Vector< T >::project_sft_binary(), spams::Matrix< T >::rank1Update(), spams::Matrix< T >::refCol(), spams::Vector< T >::resize(), spams::Vector< T >::scal(), spams::Vector< T >::set(), spams::Vector< T >::setPointer(), spams::Vector< T >::setZeros(), spams::Vector< T >::sign(), spams::Vector< T >::softThrshold(), spams::Vector< T >::sort(), spams::Vector< T >::sort2(), spams::Vector< T >::sqr(), spams::Vector< T >::Sqrt(), spams::Vector< T >::std(), spams::Vector< T >::sub(), spams::Vector< T >::sum(), spams::Vector< T >::thrsabsmin(), spams::Vector< T >::thrshold(), spams::Vector< T >::thrsmax(), spams::Vector< T >::thrsmin(), spams::Vector< T >::thrsPos(), spams::Vector< T >::toSparse(), spams::Matrix< T >::toVect(), spams::Vector< T >::unwhiten(), spams::Vector< T >::Vector(), and spams::Vector< T >::whiten().

template<typename T>
T* spams::Vector< T >::_X
private

data

Definition at line 754 of file linalg.h.

Referenced by spams::Vector< T >::add(), spams::Vector< T >::afused(), spams::Vector< T >::allfalse(), spams::Vector< T >::alltrue(), spams::Vector< T >::applyBayerPattern(), spams::Vector< T >::asum(), spams::Vector< T >::clear(), spams::Vector< T >::copy(), spams::Matrix< T >::copyCol(), spams::Matrix< T >::copyMask(), spams::Vector< T >::copyMask(), spams::Matrix< T >::copyRow(), spams::Vector< T >::div(), spams::Vector< T >::dot(), spams::Vector< T >::exp(), spams::Vector< T >::fmax(), spams::Vector< T >::fmaxval(), spams::Vector< T >::fmin(), spams::Vector< T >::fminval(), spams::Vector< T >::fusedProject(), spams::Vector< T >::fusedProjectHomotopy(), spams::Vector< T >::hardThrshold(), spams::Vector< T >::inv(), spams::Vector< T >::Invsqrt(), spams::Vector< T >::KL(), spams::Vector< T >::l1l2project(), spams::Vector< T >::l1project(), spams::Vector< T >::l1project_weighted(), spams::Vector< T >::log(), spams::Vector< T >::logexp(), spams::Vector< T >::logspace(), spams::Vector< T >::lzero(), spams::Vector< T >::max(), spams::Vector< T >::maxval(), spams::Vector< T >::min(), spams::Vector< T >::minval(), spams::Matrix< T >::mult(), spams::Vector< T >::mult(), spams::Matrix< T >::multTrans(), spams::Vector< T >::neg(), spams::Vector< T >::nnz(), spams::Vector< T >::nrm2(), spams::Vector< T >::nrm2sq(), spams::Vector< T >::operator[](), spams::Vector< T >::print(), spams::Vector< T >::project_sft(), spams::Vector< T >::project_sft_binary(), spams::Vector< T >::randperm(), spams::Matrix< T >::rank1Update(), spams::Matrix< T >::refCol(), spams::Vector< T >::resize(), spams::Vector< T >::scal(), spams::Vector< T >::set(), spams::Vector< T >::setPointer(), spams::Vector< T >::setZeros(), spams::Vector< T >::sign(), spams::Vector< T >::softmax(), spams::Vector< T >::softThrshold(), spams::Vector< T >::sort(), spams::Vector< T >::sort2(), spams::Vector< T >::sqr(), spams::Vector< T >::Sqrt(), spams::Vector< T >::std(), spams::Vector< T >::sub(), spams::Vector< T >::sum(), spams::Vector< T >::thrsabsmin(), spams::Vector< T >::thrshold(), spams::Vector< T >::thrsmax(), spams::Vector< T >::thrsmin(), spams::Vector< T >::thrsPos(), spams::Vector< T >::toSparse(), spams::Matrix< T >::toVect(), spams::Vector< T >::unwhiten(), spams::Vector< T >::Vector(), spams::SpMatrix< T >::wAAt(), spams::Matrix< T >::whiten(), spams::Vector< T >::whiten(), and spams::SpMatrix< T >::wXAt().


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