DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
spams Namespace Reference

Namespaces

 FISTA
 

Classes

class  AbstractMatrix
 
class  AbstractMatrixB
 
class  BinaryHeap
 
class  Data
 
class  DoubleRowMatrix
 
class  Element
 
class  Graph
 
class  GraphPath
 
struct  GraphPathStruct
 
struct  GraphStruct
 
class  List
 
class  ListIterator
 
class  Matrix
 
class  MaxFlow
 
class  MinCostFlow
 
struct  ParamDictLearn
 
struct  Path
 
class  ProdMatrix
 
class  ShiftMatrix
 
class  SpMatrix
 
class  SpVector
 
class  SubMatrix
 
class  Timer
 
class  Trainer
 
class  Tree_Seq
 
struct  TreeStruct
 
class  Vector
 

Typedefs

typedef ListIterator< int > const_iterator_int
 
typedef std::list< int > group
 
typedef std::list< grouplist_groups
 
typedef List< int > list_int
 
typedef std::vector< groupvector_groups
 

Enumerations

enum  constraint_type {
  L1COEFFS,
  L2ERROR,
  PENALTY,
  SPARSITY,
  L2ERROR2,
  PENALTY2
}
 
enum  constraint_type_D {
  L2,
  L1L2,
  L1L2FL,
  L1L2MU
}
 
enum  mode_compute {
  AUTO,
  PARAM1,
  PARAM2,
  PARAM3
}
 

Functions

template<typename T >
abs (const T x)
 
template<>
double abs (const double x)
 
template<>
float abs (const float x)
 
template<typename T >
static T alt_log (const T x)
 
template<>
double alt_log< double > (const double x)
 
template<>
float alt_log< float > (const float x)
 
template<typename T >
bool compare_abs (T first, T second)
 
template<typename T >
computeError (const T normX2, const Vector< T > &norms, const Matrix< T > &G, const Matrix< T > &RtD, const Matrix< T > &alphat)
 
template<typename T >
computeError (const T normX2, const Matrix< T > &G, const Vector< T > &DtR, const Vector< T > &coeffs, SpVector< T > &coeffs_tmp)
 
template<typename T >
void coreGroupIST (const Matrix< T > &G, Matrix< T > &RtD, Matrix< T > &alphat, const T thrs, const int itermax=500, const T tol=0.5)
 
template<typename T >
void coreGroupISTConstrained (const Matrix< T > &G, Matrix< T > &RtD, Matrix< T > &alphat, const T normR, const T eps, const int itermax=500, const T tol=0.5)
 
template<typename T >
void coreIST (const AbstractMatrix< T > &G, Vector< T > &DtR, Vector< T > &coeffs, const T thrs, const int itermax=500, const T tol=0.5)
 
template<typename T >
void coreISTconstrained (const AbstractMatrix< T > &G, Vector< T > &DtR, Vector< T > &coeffs, const T normX2, const T thrs, const int itermax=500, const T tol=0.5)
 
template<typename T >
void coreLARS (Vector< T > &Rdn, Vector< T > &Xdn, Vector< T > &A, Vector< T > &u, Vector< T > &sig, Vector< T > &av, Vector< T > &RUn, Matrix< T > &Un, Matrix< T > &Unds, Matrix< T > &Gs, Matrix< T > &Gsa, Matrix< T > &workT, Matrix< T > &R, const AbstractMatrix< T > &G, T &normX, Vector< int > &ind, Vector< T > &coeffs, const T constraint, const bool ols=false, const bool pos=false, constraint_type mode=L1COEFFS, T *path=NULL, int length_path=-1)
 
template<typename T >
void coreLARS2 (Vector< T > &DtR, const AbstractMatrix< T > &G, Matrix< T > &Gs, Matrix< T > &Ga, Matrix< T > &invGs, Vector< T > &u, Vector< T > &coeffs, Vector< int > &ind, Matrix< T > &work, T &normX, const constraint_type mode, const T constraint, const bool pos, T *path, int length_path)
 
template<typename T >
void coreLARS2W (Vector< T > &DtR, AbstractMatrix< T > &G, Matrix< T > &Gs, Matrix< T > &Ga, Matrix< T > &invGs, Vector< T > &u, Vector< T > &coeffs, const Vector< T > &weights, Vector< int > &ind, Matrix< T > &work, T &normX, const constraint_type mode, const T constraint, const bool pos)
 
template<typename T >
void coreORMP (Vector< T > &scores, Vector< T > &norm, Vector< T > &tmp, Matrix< T > &Un, Matrix< T > &Undn, Matrix< T > &Unds, Matrix< T > &Gs, Vector< T > &Rdn, const AbstractMatrix< T > &G, Vector< int > &ind, Vector< T > &RUn, T &normX, const T *eps, const int *L, const T *lambda, T *path=NULL)
 
template<typename T >
void coreORMPB (Vector< T > &RtD, const AbstractMatrix< T > &G, Vector< int > &ind, Vector< T > &coeffs, T &normX, const int L, const T eps, const T lambda=0)
 
template<typename T >
void coreSOMP (const Matrix< T > &X, const Matrix< T > &D, const Matrix< T > &G, Matrix< T > &vM, Vector< int > &rv, const int L, const T eps)
 
template<typename T >
int count_cc_graph (const SpMatrix< T > &G, Vector< T > &active)
 
template<typename T >
count_paths_dags (const SpMatrix< T > &G)
 
template<typename T >
void downDateLasso (int &j, int &minBasis, T &normX, const bool ols, const bool pos, Vector< T > &Rdn, int *ind, T *coeffs, Vector< T > &sig, Vector< T > &av, Vector< T > &Xdn, Vector< T > &RUn, Matrix< T > &Unm, Matrix< T > &Gsm, Matrix< T > &Gsam, Matrix< T > &Undsm, Matrix< T > &Rm)
 
template<typename T >
exp_alt (const T x)
 
template<>
double exp_alt (const double x)
 
template<>
float exp_alt (const float x)
 
template<typename T >
static T fusedHomotopyAux (const bool &sign1, const bool &sign2, const bool &sign3, const T &c1, const T &c2)
 
template<typename T >
static T hardThrs (const T x, const T lambda)
 
static int init_omp (const int numThreads)
 
template<typename T >
static bool isEqual (const T lambda1, const T lambda2)
 
template<typename T >
void ist (const Matrix< T > &X, const Matrix< T > &D, SpMatrix< T > &spalpha, T lambda, constraint_type mode, const int itermax=500, const T tol=0.5, const int numThreads=-1)
 
template<typename T >
void ist (const Matrix< T > &X, const Matrix< T > &D, Matrix< T > &spalpha, T lambda, constraint_type mode, const int itermax=500, const T tol=0.5, const int numThreads=-1)
 
template<typename T >
void ist_groupLasso (const Matrix< T > *XT, const Matrix< T > &D, Matrix< T > *alphaT, const int Ngroups, const T lambda, const constraint_type mode, const int itermax=500, const T tol=0.5, const int numThreads=-1)
 
template<typename T >
static bool isZero (const T lambda)
 
template<typename T >
void lasso (const Matrix< T > &X, const Matrix< T > &D, SpMatrix< T > &spalpha, int L, const T constraint, const T lambda2=0, constraint_type mode=PENALTY, const bool pos=false, const bool ols=false, const int numThreads=-1, Matrix< T > *path=NULL, const int length_path=-1)
 
template<typename T >
void lasso (const Data< T > &X, const AbstractMatrix< T > &G, const AbstractMatrix< T > &DtX, SpMatrix< T > &spalpha, int L, const T constraint, constraint_type mode=PENALTY, const bool pos=false, const bool ols=false, const int numThreads=-1, Matrix< T > *path=NULL, const int length_path=-1)
 
template<typename T >
void lasso2 (const Matrix< T > &X, const Matrix< T > &D, SpMatrix< T > &spalpha, int L, const T constraint, const T lambda2=0, constraint_type mode=PENALTY, const bool pos=false, const int numThreads=-1, Matrix< T > *path=NULL, const int length_path=-1)
 
template<typename T >
void lasso2 (const Data< T > &X, const AbstractMatrix< T > &G, const AbstractMatrix< T > &DtX, SpMatrix< T > &spalpha, int L, const T constraint, constraint_type mode=PENALTY, const bool pos=false, const int numThreads=-1, Matrix< T > *path=NULL, const int length_path=-1)
 
template<typename T >
void lasso_mask (const Matrix< T > &X, const Matrix< T > &D, SpMatrix< T > &spalpha, const Matrix< bool > &mask, int L, const T constraint, const T lambda2=0, constraint_type mode=PENALTY, const bool pos=false, const int numThreads=-1)
 
template<typename T >
void lassoReweighted (const Matrix< T > &X, const Matrix< T > &D, SpMatrix< T > &spalpha, int L, const T constraint, constraint_type mode, const bool pos, const T sigma, const int numThreads=-1)
 
template<typename T >
void lassoWeight (const Matrix< T > &X, const Matrix< T > &D, const Matrix< T > &weights, SpMatrix< T > &spalpha, int L, const T constraint, constraint_type mode, const bool pos, const int numThreads)
 
template<typename T >
void lassoWeightPreComputed (const Matrix< T > &X, const Matrix< T > &G, const Matrix< T > &DtR, const Matrix< T > &weights, SpMatrix< T > &spalpha, int L, const T constraint, constraint_type mode, const bool pos, const int numThreads)
 
template<typename T >
log_alt (const T x)
 
template<>
double log_alt (const double x)
 
template<>
float log_alt (const float x)
 
template<typename T >
static T logexp (const T x)
 
template<class T >
void MatrixToUtlMatrix (const Matrix< T > &matSpams, utl::NDArray< T, 2 > &matUtl)
 
template<class T >
void MatrixToVnlMatrix (const Matrix< T > &matSpams, vnl_matrix< T > &matVnl)
 
template<typename T >
static T normalDistrib ()
 
template<typename T >
void omp (const Matrix< T > &X, const Matrix< T > &D, SpMatrix< T > &spalpha, const int *L, const T *eps, const T *lambda, const bool vecL=false, const bool vecEps=false, const bool Lambda=false, const int numThreads=-1, Matrix< T > *path=NULL)
 
template<typename T >
void omp_mask (const Matrix< T > &X, const Matrix< T > &D, SpMatrix< T > &spalpha, const Matrix< bool > &mask, const int *L, const T *eps, const T *lambda, const bool vecL=false, const bool vecEps=false, const bool Lambda=false, const int numThreads=-1, Matrix< T > *path=NULL)
 
template<typename T >
power (const T x, const T y)
 
template<>
double power (const double x, const double y)
 
template<>
float power (const float x, const float y)
 
template<typename T >
project_tree_l1 (T *variables, const int n, const T lambda)
 
template<typename T >
static void quick_sort (int *irOut, T *prOut, const int beg, const int end, const bool incr)
 
template<typename T >
static T ran1 ()
 
template<typename T >
static T ran1b ()
 
template<typename T >
ran1b ()
 
template<typename T >
void remove_cycles (const SpMatrix< T > &G1, SpMatrix< T > &G2)
 
template<typename T >
static T softThrs (const T x, const T lambda)
 
template<typename T >
void somp (const Matrix< T > *X, const Matrix< T > &D, SpMatrix< T > *spalpha, const int Ngroups, const int L, const T *pr_eps, const bool adapt=false, const int numThreads=-1)
 
template<typename T >
void somp (const Matrix< T > *X, const Matrix< T > &D, SpMatrix< T > *spalpha, const int Ngroups, const int L, const T eps, const int numThreads=-1)
 
template<typename T >
static void sort (int *irOut, T *prOut, int beg, int end)
 
template<class T >
void SpMatrixToUtlMatrix (const SpMatrix< T > &mat, utl::NDArray< T, 2 > &result)
 
template<class T >
void SpMatrixToVnlMatrix (const SpMatrix< T > &mat, vnl_matrix< T > &result)
 
template<typename T >
sqr (const T x)
 
template<typename T >
sqr (const int x)
 
template<>
double sqr (const double x)
 
template<>
float sqr (const float x)
 
template<typename T >
sqr_alt (const T x)
 
template<>
double sqr_alt (const double x)
 
template<>
float sqr_alt (const float x)
 
static void stop ()
 
template<class T >
void UtlMatrixToMatrix (const utl::NDArray< T, 2 > &matUtl, Matrix< T > &matSpams)
 
template<class T >
void UtlVectorToVector (const utl::NDArray< T, 1 > &v, Vector< T > &vec)
 
template<class T >
void VectorToUtlVector (const Vector< T > &v, utl::NDArray< T, 1 > &vec)
 
template<class T >
void VectorToVnlVector (const Vector< T > &v, vnl_vector< T > &vec)
 
template<class T >
void VnlMatrixToMatrix (const vnl_matrix< T > &matVnl, Matrix< T > &matSpams)
 
template<class T >
void VnlVectorToVector (const vnl_vector< T > &v, Vector< T > &vec)
 
template<typename T >
void writeLog (const Matrix< T > &D, const T time, int iter, char *name)
 
template<typename T >
static T xlogx (const T x)
 

Variables

static char buffer_string [50]
 
bool cap_heuristic = true
 
bool gap_heuristic = true
 
bool global_heuristic = true
 
int num_gap_relabels
 
int num_global_relabels
 
int num_pushes
 
int num_relabels
 
bool price_heuristic = true
 
bool price_refine_heuristic = false
 
static int seed = 0
 
Timer tglobal1
 
Timer tglobal2
 
Timer tglobal3
 

Detailed Description

/* Software SPAMS v2.3 - Copyright 2009-2011 Julien Mairal

This file is part of SPAMS.

SPAMS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

SPAMS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with SPAMS. If not, see http://www.gnu.org/licenses/.

Typedef Documentation

Definition at line 147 of file list.h.

typedef std::list< int > spams::group

Definition at line 67 of file linalg.h.

typedef std::list< group > spams::list_groups

Definition at line 72 of file linalg.h.

typedef List<int> spams::list_int

Definition at line 146 of file list.h.

typedef std::vector< group > spams::vector_groups

Definition at line 73 of file linalg.h.

Enumeration Type Documentation

Defines different types of problem,

  • constraint on the l1 norm of the coefficients
  • constraint on the reconstruction error
  • l1-sparsity penalty
Enumerator
L1COEFFS 
L2ERROR 
PENALTY 
SPARSITY 
L2ERROR2 
PENALTY2 

Definition at line 88 of file decomp.h.

Enumerator
L2 
L1L2 
L1L2FL 
L1L2MU 

Definition at line 41 of file dicts.h.

Enumerator
AUTO 
PARAM1 
PARAM2 
PARAM3 

Definition at line 42 of file dicts.h.

Function Documentation

template<typename T >
T spams::abs ( const T  x)

template version of the fabs function

Referenced by utl::AbsoluteVector(), utl::BesselJa(), itk::SamplingScheme3D< TPixelType >::CalculateElectrostaticEnergyMatrix(), cblas_iamax(), cblas_iamin(), spams::MaxFlow< T >::check_flow(), spams::Trainer< T >::cleanDict(), itk::SphericalHarmonicsGenerator< PreciseType >::ComplexDerivativeOfTheta(), itk::SphericalHarmonicsGenerator< PreciseType >::ComplexTripleIntegration(), itk::SphericalPolarFourierImageFilter< TInputImage, TOutputImage >::ComputeRegularizationWeight(), coreIST(), coreISTconstrained(), coreLARS2(), coreLARS2W(), spams::FISTA::Lasso< T >::eval(), spams::FISTA::FusedLasso< T >::eval(), itk::SamplingSchemeQSpaceIncrementalEstimationFilter< TSamplingType >::GenerateData(), utl::GetNumberOfNonZeroValues(), itk::SphereTessellator< TElement >::GetPointsMatrixInHemisphere(), utl::NDArrayBase< T, 4 >::GetTwoNorm(), utl::NDArrayBase< T, 4 >::IsEqual(), utl::NDArrayBase< T, 4 >::IsSameValues(), utl::NDArray< T, 2 >::IsSymmetric(), main(), spams::MaxFlow< T >::norm(), utl::NDArrayBase< T, 4 >::operator+=(), utl::PInverseMatrix(), utl::PInverseSymmericMatrix(), itk::DiffusionTensor< TPrecision >::Pow(), spams::Vector< T >::project_sft(), spams::Vector< T >::project_sft_binary(), itk::DWIReader< TPixelType, VImageDimension >::ReadFromConfigurationFile(), itk::SphericalHarmonicsGenerator< PreciseType >::RealTripleIntegration(), utl::RotationMatrixFromVectors(), spams::MaxFlow< T >::set_capacities_variables(), and utl::vAbs().

+ Here is the caller graph for this function:

template<>
double spams::abs ( const double  x)
inline

template version of the fabs function

Definition at line 218 of file misc.h.

template<>
float spams::abs ( const float  x)
inline

Definition at line 222 of file misc.h.

template<typename T >
static T spams::alt_log ( const T  x)
inlinestatic

Referenced by hardThrs().

+ Here is the caller graph for this function:

template<>
double spams::alt_log< double > ( const double  x)
inline

Definition at line 104 of file linalg.h.

template<>
float spams::alt_log< float > ( const float  x)
inline

Definition at line 105 of file linalg.h.

template<typename T >
bool spams::compare_abs ( first,
second 
)

Definition at line 52 of file project.h.

References project_tree_l1().

+ Here is the call graph for this function:

template<typename T >
T spams::computeError ( const T  normX2,
const Vector< T > &  norms,
const Matrix< T > &  G,
const Matrix< T > &  RtD,
const Matrix< T > &  alphat 
)

auxiliary function for ist_groupLasso

Definition at line 2481 of file decomp.h.

References spams::Vector< T >::dot(), EPSILON, spams::Matrix< T >::n(), spams::Vector< T >::nrm2sq(), and spams::Matrix< T >::refCol().

Referenced by ist_groupLasso().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
T spams::computeError ( const T  normX2,
const Matrix< T > &  G,
const Vector< T > &  DtR,
const Vector< T > &  coeffs,
SpVector< T > &  coeffs_tmp 
)

auxiliary function for ist_groupLasso

auxiliary function for

Definition at line 2506 of file decomp.h.

References spams::Vector< T >::dot(), spams::Matrix< T >::quad(), and spams::Vector< T >::toSparse().

+ Here is the call graph for this function:

template<typename T >
void spams::coreGroupIST ( const Matrix< T > &  G,
Matrix< T > &  RtD,
Matrix< T > &  alphat,
const T  thrs,
const int  itermax = 500,
const T  tol = 0.5 
)
template<typename T >
void spams::coreGroupISTConstrained ( const Matrix< T > &  G,
Matrix< T > &  RtD,
Matrix< T > &  alphat,
const T  normR,
const T  eps,
const int  itermax = 500,
const T  tol = 0.5 
)
template<typename T >
void spams::coreIST ( const AbstractMatrix< T > &  G,
Vector< T > &  DtR,
Vector< T > &  coeffs,
const T  thrs,
const int  itermax = 500,
const T  tol = 0.5 
)
inline

coreIST

Definition at line 2052 of file decomp.h.

References abs(), spams::AbstractMatrix< T >::add_rawCol(), spams::Vector< T >::asum(), spams::Vector< T >::fmaxval(), spams::AbstractMatrix< T >::n(), spams::Vector< T >::rawX(), utl::vAdd(), and utl::vSub().

Referenced by ist(), ist_groupLasso(), 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::coreISTconstrained ( const AbstractMatrix< T > &  G,
Vector< T > &  DtR,
Vector< T > &  coeffs,
const T  normX2,
const T  thrs,
const int  itermax = 500,
const T  tol = 0.5 
)

coreIST constrained

Definition at line 2113 of file decomp.h.

References abs(), spams::AbstractMatrix< T >::add_rawCol(), spams::Vector< T >::asum(), spams::Vector< T >::fmaxval(), MAX, spams::AbstractMatrix< T >::n(), spams::Vector< T >::rawX(), and spams::Vector< T >::set().

Referenced by ist(), ist_groupLasso(), 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::coreLARS ( Vector< T > &  Rdn,
Vector< T > &  Xdn,
Vector< T > &  A,
Vector< T > &  u,
Vector< T > &  sig,
Vector< T > &  av,
Vector< T > &  RUn,
Matrix< T > &  Un,
Matrix< T > &  Unds,
Matrix< T > &  Gs,
Matrix< T > &  Gsa,
Matrix< T > &  workT,
Matrix< T > &  R,
const AbstractMatrix< T > &  G,
T &  normX,
Vector< int > &  ind,
Vector< T > &  coeffs,
const T  constraint,
const bool  ols = false,
const bool  pos = false,
constraint_type  mode = L1COEFFS,
T *  path = NULL,
int  length_path = -1 
)

Auxiliary function for lasso.

Un is the orthogonalized vectors in the D basis

voir pour petites valeurs

Un is the orthogonalized vectors in the D basis

voir pour petites valeurs

Definition at line 748 of file decomp.h.

References CblasColMajor, CblasNonUnit, CblasNoTrans, CblasTrans, CblasUpper, spams::Vector< T >::copy(), EPSILON, spams::AbstractMatrix< T >::extract_rawCol(), spams::Vector< T >::fmax(), INFINITY, L1COEFFS, L2ERROR, spams::Matrix< T >::m(), spams::Vector< T >::max(), MIN, spams::Matrix< T >::n(), PENALTY, spams::Matrix< T >::rawX(), spams::Vector< T >::rawX(), spams::Vector< T >::set(), spams::Vector< T >::setZeros(), and SIGN.

Referenced by lasso().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void spams::coreLARS2 ( Vector< T > &  DtR,
const AbstractMatrix< T > &  G,
Matrix< T > &  Gs,
Matrix< T > &  Ga,
Matrix< T > &  invGs,
Vector< T > &  u,
Vector< T > &  coeffs,
Vector< int > &  ind,
Matrix< T > &  work,
T &  normX,
const constraint_type  mode,
const T  constraint,
const bool  pos = false,
T *  pr_path = NULL,
int  length_path = -1 
)

Auxiliary function for lasso.

L2ERROR

L1COEFFS

Downdate, remove first_zero Downdate Ga, Gs, invGs, ind, coeffs

L2ERROR

L1COEFFS

Downdate, remove first_zero Downdate Ga, Gs, invGs, ind, coeffs

Definition at line 1556 of file decomp.h.

References abs(), CblasColMajor, CblasNoTrans, CblasUpper, spams::AbstractMatrix< T >::extract_rawCol(), spams::Vector< T >::fmax(), INFINITY, L1COEFFS, L2ERROR, spams::Vector< T >::max(), MIN, spams::AbstractMatrix< T >::n(), spams::Matrix< T >::n(), PENALTY, spams::Matrix< T >::rawX(), spams::Vector< T >::rawX(), spams::Vector< T >::set(), and spams::Vector< T >::setZeros().

Referenced by lasso2(), lasso_mask(), lassoReweighted(), and 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::coreLARS2W ( Vector< T > &  DtR,
AbstractMatrix< T > &  G,
Matrix< T > &  Gs,
Matrix< T > &  Ga,
Matrix< T > &  invGs,
Vector< T > &  u,
Vector< T > &  coeffs,
const Vector< T > &  weights,
Vector< int > &  ind,
Matrix< T > &  work,
T &  normX,
const constraint_type  mode,
const T  constraint,
const bool  pos = false 
)

Auxiliary function for lasso.

L2ERROR

L1COEFFS

Downdate, remove first_zero Downdate Ga, Gs, invGs, ind, coeffs

L2ERROR

L1COEFFS

Downdate, remove first_zero Downdate Ga, Gs, invGs, ind, coeffs

Definition at line 1764 of file decomp.h.

References abs(), CblasColMajor, CblasNoTrans, CblasUpper, spams::Vector< T >::div(), spams::AbstractMatrix< T >::extract_rawCol(), spams::Vector< T >::fmax(), INFINITY, L1COEFFS, L2ERROR, spams::Vector< T >::max(), MIN, spams::AbstractMatrix< T >::n(), spams::Matrix< T >::n(), PENALTY, spams::Matrix< T >::rawX(), spams::Vector< T >::rawX(), spams::Vector< T >::set(), and spams::Vector< T >::setZeros().

Referenced by lassoReweighted(), lassoWeight(), and lassoWeightPreComputed().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void spams::coreORMP ( Vector< T > &  scores,
Vector< T > &  norm,
Vector< T > &  tmp,
Matrix< T > &  Un,
Matrix< T > &  Undn,
Matrix< T > &  Unds,
Matrix< T > &  Gs,
Vector< T > &  Rdn,
const AbstractMatrix< T > &  G,
Vector< int > &  ind,
Vector< T > &  RUn,
T &  normX,
const T *  eps,
const int *  L,
const T *  lambda,
T *  path = NULL 
)
template<typename T >
void spams::coreORMPB ( Vector< T > &  RtD,
const AbstractMatrix< T > &  G,
Vector< int > &  ind,
Vector< T > &  coeffs,
T &  normX,
const int  L,
const T  eps,
const T  lambda = 0 
)

Auxiliary function of omp.

Definition at line 498 of file decomp.h.

References coreORMP(), spams::AbstractMatrix< T >::n(), and spams::Vector< T >::set().

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::coreSOMP ( const Matrix< T > &  X,
const Matrix< T > &  D,
const Matrix< T > &  G,
Matrix< T > &  vM,
Vector< int > &  rv,
const int  L,
const T  eps 
)
template<typename T >
int spams::count_cc_graph ( const SpMatrix< T > &  G,
Vector< T > &  active 
)
template<typename T >
T spams::count_paths_dags ( const SpMatrix< T > &  G)
template<typename T >
void spams::downDateLasso ( int &  j,
int &  minBasis,
T &  normX,
const bool  ols,
const bool  pos,
Vector< T > &  Rdn,
int *  ind,
T *  coeffs,
Vector< T > &  sig,
Vector< T > &  av,
Vector< T > &  Xdn,
Vector< T > &  RUn,
Matrix< T > &  Unm,
Matrix< T > &  Gsm,
Matrix< T > &  Gsam,
Matrix< T > &  Undsm,
Matrix< T > &  Rm 
)
inline

Auxiliary functoni for coreLARS (Cholesky downdate)

Definition at line 1000 of file decomp.h.

References CblasColMajor, CblasLower, CblasNonUnit, CblasRight, CblasTrans, low, spams::Matrix< T >::m(), spams::Matrix< T >::n(), nonUnit, spams::Matrix< T >::rawX(), and spams::Vector< T >::rawX().

+ Here is the call graph for this function:

template<typename T >
T spams::exp_alt ( const T  x)

Referenced by sqr().

+ Here is the caller graph for this function:

template<>
double spams::exp_alt ( const double  x)
inline

Definition at line 237 of file misc.h.

template<>
float spams::exp_alt ( const float  x)
inline

Definition at line 241 of file misc.h.

template<typename T >
static T spams::fusedHomotopyAux ( const bool &  sign1,
const bool &  sign2,
const bool &  sign3,
const T &  c1,
const T &  c2 
)
inlinestatic

Definition at line 3654 of file linalg.h.

template<typename T >
static T spams::hardThrs ( const T  x,
const T  lambda 
)
inlinestatic

Definition at line 98 of file linalg.h.

References alt_log().

+ Here is the call graph for this function:

static int spams::init_omp ( const int  numThreads)
inlinestatic
template<typename T >
static bool spams::isEqual ( const T  lambda1,
const T  lambda2 
)
inlinestatic

Definition at line 81 of file linalg.h.

Referenced by spams::SpMatrix< T >::addVecToCols(), and spams::SpMatrix< T >::addVecToColsWeighted().

+ Here is the caller graph for this function:

template<typename T >
void spams::ist ( const Matrix< T > &  X,
const Matrix< T > &  D,
SpMatrix< T > &  spalpha,
lambda,
constraint_type  mode,
const int  itermax = 500,
const T  tol = 0.5,
const int  numThreads = -1 
)

Implementation of IST for solving i, {} ||||_1 s.t. ||-D||_2^2 <= constraint or i, {} constraint*||||_1 + ... ... ||-D||_2^2 <= T

Implementation of IST for solving i, {} ||||_1 s.t. ||-D||_2^2 <= constraint or i, {} constraint*||||_1 + ... ... ||-D||_2^2 <= lambda

Definition at line 1966 of file decomp.h.

References spams::SpMatrix< T >::clear(), spams::SpMatrix< T >::toFull(), and spams::Matrix< T >::toSparse().

+ Here is the call graph for this function:

template<typename T >
void spams::ist ( const Matrix< T > &  X,
const Matrix< T > &  D,
Matrix< T > &  spalpha,
lambda,
constraint_type  mode,
const int  itermax = 500,
const T  tol = 0.5,
const int  numThreads = -1 
)
template<typename T >
void spams::ist_groupLasso ( const Matrix< T > *  XT,
const Matrix< T > &  D,
Matrix< T > *  alphaT,
const int  Ngroups,
const T  lambda,
const constraint_type  mode,
const int  itermax = 500,
const T  tol = 0.5,
const int  numThreads = -1 
)
template<typename T >
static bool spams::isZero ( const T  lambda)
inlinestatic

Definition at line 76 of file linalg.h.

template<typename T >
void spams::lasso ( const Matrix< T > &  X,
const Matrix< T > &  D,
SpMatrix< T > &  spalpha,
int  L,
const T  lambda,
const T  lambda2 = 0,
constraint_type  mode = PENALTY,
const bool  pos = false,
const bool  ols = false,
const int  numThreads = -1,
Matrix< T > *  path = NULL,
const int  length_path = -1 
)

Implementation of LARS-Lasso for solving i, {} ||X_i-D||_2^2 s.t. ||||_1 <= constraint or i, {} ||||_1 s.t. ||-D||_2^2 <= constraint or i, {} constraint*||||_1 + ... ... ||-D||_2^2 <= T Optionally, the solution might be positive (boolean pos), and a Least-Square can be solved as a post-processing step. L is a maximum number of coefficients. This function is

  • efficient (Cholesky-based)
  • parallel
  • optimized for a big number of signals (precompute the Gramm matrix

Definition at line 639 of file decomp.h.

References spams::Matrix< T >::addDiag(), MAX, and spams::Matrix< T >::n().

+ Here is the call graph for this function:

template<typename T >
void spams::lasso ( const Data< T > &  X,
const AbstractMatrix< T > &  G,
const AbstractMatrix< T > &  DtX,
SpMatrix< T > &  spalpha,
int  L,
const T  constraint,
constraint_type  mode = PENALTY,
const bool  pos = false,
const bool  ols = false,
const int  numThreads = -1,
Matrix< T > *  path = NULL,
const int  length_path = -1 
)
template<typename T >
void spams::lasso2 ( const Matrix< T > &  X,
const Matrix< T > &  D,
SpMatrix< T > &  spalpha,
int  L,
const T  constraint,
const T  lambda2 = 0,
constraint_type  mode = PENALTY,
const bool  pos = false,
const int  numThreads = -1,
Matrix< T > *  path = NULL,
const int  length_path = -1 
)

second implementation using matrix inversion lemma

Definition at line 1468 of file decomp.h.

References spams::Matrix< T >::addDiag(), MAX, and spams::Matrix< T >::n().

+ Here is the call graph for this function:

template<typename T >
void spams::lasso2 ( const Data< T > &  X,
const AbstractMatrix< T > &  G,
const AbstractMatrix< T > &  DtX,
SpMatrix< T > &  spalpha,
int  L,
const T  constraint,
constraint_type  mode = PENALTY,
const bool  pos = false,
const int  numThreads = -1,
Matrix< T > *  path = NULL,
const int  length_path = -1 
)
template<typename T >
void spams::lasso_mask ( const Matrix< T > &  X,
const Matrix< T > &  D,
SpMatrix< T > &  spalpha,
const Matrix< bool > &  mask,
int  L,
const T  constraint,
const T  lambda2 = 0,
constraint_type  mode = PENALTY,
const bool  pos = false,
const int  numThreads = -1 
)
template<typename T >
void spams::lassoReweighted ( const Matrix< T > &  X,
const Matrix< T > &  D,
SpMatrix< T > &  spalpha,
int  L,
const T  constraint,
constraint_type  mode,
const bool  pos,
const T  sigma,
const int  numThreads = -1 
)

second implementation using matrix inversion lemma

convert the sparse matrix into a proper format

convert the sparse matrix into a proper format

Definition at line 1113 of file decomp.h.

References spams::ProdMatrix< T >::addDiag(), spams::SpMatrix< T >::clear(), spams::SpMatrix< T >::convert(), spams::Vector< T >::copy(), coreLARS2(), coreLARS2W(), init_omp(), MAX, spams::Matrix< T >::multTrans(), spams::Matrix< T >::n(), spams::Vector< T >::nrm2sq(), spams::Matrix< T >::refCol(), spams::Matrix< T >::resize(), spams::Vector< T >::resize(), spams::Vector< T >::set(), and spams::Matrix< T >::setZeros().

+ Here is the call graph for this function:

template<typename T >
void spams::lassoWeight ( const Matrix< T > &  X,
const Matrix< T > &  D,
const Matrix< T > &  weights,
SpMatrix< T > &  spalpha,
int  L,
const T  constraint,
constraint_type  mode,
const bool  pos,
const int  numThreads 
)
template<typename T >
void spams::lassoWeightPreComputed ( const Matrix< T > &  X,
const Matrix< T > &  G,
const Matrix< T > &  DtR,
const Matrix< T > &  weights,
SpMatrix< T > &  spalpha,
int  L,
const T  constraint,
constraint_type  mode,
const bool  pos,
const int  numThreads 
)
template<typename T >
T spams::log_alt ( const T  x)

Referenced by sqr().

+ Here is the caller graph for this function:

template<>
double spams::log_alt ( const double  x)
inline

Definition at line 246 of file misc.h.

template<>
float spams::log_alt ( const float  x)
inline

Definition at line 250 of file misc.h.

template<typename T >
static T spams::logexp ( const T  x)
inlinestatic

Definition at line 119 of file linalg.h.

Referenced by spams::Vector< int >::mult_elementWise().

+ Here is the caller graph for this function:

template<class T >
void spams::MatrixToUtlMatrix ( const Matrix< T > &  matSpams,
utl::NDArray< T, 2 > &  matUtl 
)
template<class T >
void spams::MatrixToVnlMatrix ( const Matrix< T > &  matSpams,
vnl_matrix< T > &  matVnl 
)

Definition at line 54 of file utlITKSpams.h.

References spams::Matrix< T >::m(), spams::Matrix< T >::n(), and spams::Matrix< T >::X().

+ Here is the call graph for this function:

template<typename T >
static T spams::normalDistrib ( )
inlinestatic

random sampling from the normal distribution

Definition at line 117 of file misc.h.

template<typename T >
void spams::omp ( const Matrix< T > &  X,
const Matrix< T > &  D,
SpMatrix< T > &  spalpha,
const int *  pL,
const T *  peps,
const T *  pLambda,
const bool  vecL = false,
const bool  vecEps = false,
const bool  vecLambda = false,
const int  numThreads = -1,
Matrix< T > *  path = NULL 
)

Forward Selection (or Orthogonal matching pursuit) Address the problem of: i, {} ||X_i-D||_2^2 s.t. ||||_0 <= L or i, {} ||||_0 s.t. ||-D||_2^2 <= epsilon This function is

  • based on Cholesky decompositions
  • parallel
  • optimized for a large number of signals (precompute the Gramm matrix

Forward Selection (or Orthogonal matching pursuit) Address the problem of: i, {} ||X_i-D||_2^2 s.t. ||||_0 <= L or i, {} ||||_0 s.t. ||-D||_2^2 <= epsilon This function is

  • efficient (Cholesky-based)
  • parallel
  • optimized for a big number of signals (precompute the Gramm matrix

convert the sparse matrix into a proper format

convert the sparse matrix into a proper format

Definition at line 298 of file decomp.h.

References spams::SpMatrix< T >::clear(), spams::SpMatrix< T >::convert(), coreORMP(), init_omp(), spams::Matrix< T >::m(), spams::Vector< T >::maxval(), MIN, spams::Matrix< T >::multTrans(), spams::Matrix< T >::n(), spams::Vector< T >::nrm2sq(), spams::Matrix< T >::rawX(), spams::Matrix< T >::refCol(), spams::Matrix< T >::resize(), spams::Vector< T >::resize(), spams::Vector< T >::set(), and spams::Matrix< T >::setZeros().

+ Here is the call graph for this function:

template<typename T >
void spams::omp_mask ( const Matrix< T > &  X,
const Matrix< T > &  D,
SpMatrix< T > &  spalpha,
const Matrix< bool > &  mask,
const int *  L,
const T *  eps,
const T *  lambda,
const bool  vecL = false,
const bool  vecEps = false,
const bool  Lambda = false,
const int  numThreads = -1,
Matrix< T > *  path = NULL 
)
template<typename T >
T spams::power ( const T  x,
const T  y 
)

template version of the power function

template<>
double spams::power ( const double  x,
const double  y 
)
inline

template version of the power function

Definition at line 208 of file misc.h.

template<>
float spams::power ( const float  x,
const float  y 
)
inline

Definition at line 212 of file misc.h.

template<typename T >
T spams::project_tree_l1 ( T *  variables,
const int  n,
const T  lambda 
)
inline

Definition at line 59 of file project.h.

References INFINITY, MAX, and MIN.

Referenced by compare_abs(), spams::Tree_Seq< T >::dual_norm_inf(), spams::Tree_Seq< T >::proj(), and spams::FISTA::GraphLasso< T >::prox_split().

+ Here is the caller graph for this function:

template<typename T >
static void spams::quick_sort ( int *  irOut,
T *  prOut,
const int  beg,
const int  end,
const bool  incr 
)
static

Definition at line 171 of file misc.h.

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

+ Here is the caller graph for this function:

template<typename T >
static T spams::ran1 ( )
inlinestatic

first random number generator from Numerical Recipe

Definition at line 80 of file misc.h.

References seed.

template<typename T >
static T spams::ran1b ( )
inlinestatic

standard random number generator

Definition at line 111 of file misc.h.

template<typename T >
T spams::ran1b ( )
inline

standard random number generator

Definition at line 111 of file misc.h.

template<typename T >
void spams::remove_cycles ( const SpMatrix< T > &  G1,
SpMatrix< T > &  G2 
)
template<typename T >
static T spams::softThrs ( const T  x,
const T  lambda 
)
inlinestatic

Definition at line 87 of file linalg.h.

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

+ Here is the caller graph for this function:

template<typename T >
void spams::somp ( const Matrix< T > *  X,
const Matrix< T > &  D,
SpMatrix< T > *  spalpha,
const int  Ngroups,
const int  L,
const T *  pr_eps,
const bool  adapt = false,
const int  numThreads = -1 
)

compute the Gram Matrix G=D'D

compute the Gram Matrix G=D'D

Definition at line 2524 of file decomp.h.

References spams::SpMatrix< T >::clear(), spams::SpMatrix< T >::convert2(), coreSOMP(), init_omp(), spams::Matrix< T >::isNormalized(), spams::Matrix< T >::m(), MIN, spams::Matrix< T >::n(), and spams::Matrix< T >::XtX().

Referenced by somp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T >
void spams::somp ( const Matrix< T > *  X,
const Matrix< T > &  D,
SpMatrix< T > *  spalpha,
const int  Ngroups,
const int  L,
const T  eps,
const int  numThreads = -1 
)

Definition at line 2518 of file decomp.h.

References somp().

+ Here is the call graph for this function:

template<typename T >
static void spams::sort ( int *  irOut,
T *  prOut,
int  beg,
int  end 
)
static
template<class T >
void spams::SpMatrixToUtlMatrix ( const SpMatrix< T > &  mat,
utl::NDArray< T, 2 > &  result 
)
template<class T >
void spams::SpMatrixToVnlMatrix ( const SpMatrix< T > &  mat,
vnl_matrix< T > &  result 
)
template<typename T >
T spams::sqr ( const T  x)

template version of the fabs function

Referenced by coreGroupIST(), coreGroupISTConstrained(), spams::SpVector< T >::setL(), and spams::Vector< int >::setn().

+ Here is the caller graph for this function:

template<typename T >
T spams::sqr ( const int  x)

template version of the fabs function

Definition at line 60 of file misc.h.

References exp_alt(), and log_alt().

+ Here is the call graph for this function:

template<>
double spams::sqr ( const double  x)
inline

template version of the fabs function

Definition at line 228 of file misc.h.

template<>
float spams::sqr ( const float  x)
inline

Definition at line 232 of file misc.h.

template<typename T >
T spams::sqr_alt ( const T  x)
template<>
double spams::sqr_alt ( const double  x)
inline

Definition at line 256 of file misc.h.

template<>
float spams::sqr_alt ( const float  x)
inline

Definition at line 260 of file misc.h.

static void spams::stop ( )
inlinestatic

a useful debugging function

Definition at line 74 of file misc.h.

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

+ Here is the caller graph for this function:

template<class T >
void spams::UtlMatrixToMatrix ( const utl::NDArray< T, 2 > &  matUtl,
Matrix< T > &  matSpams 
)
template<class T >
void spams::UtlVectorToVector ( const utl::NDArray< T, 1 > &  v,
Vector< T > &  vec 
)

Definition at line 66 of file utlSpams.h.

References utl::NDArrayBase< T, Dim >::GetData(), spams::Vector< T >::rawX(), spams::Vector< T >::resize(), and utl::NDArrayBase< T, Dim >::Size().

+ Here is the call graph for this function:

template<class T >
void spams::VectorToUtlVector ( const Vector< T > &  v,
utl::NDArray< T, 1 > &  vec 
)
template<class T >
void spams::VectorToVnlVector ( const Vector< T > &  v,
vnl_vector< T > &  vec 
)

Definition at line 86 of file utlITKSpams.h.

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

+ Here is the call graph for this function:

template<class T >
void spams::VnlMatrixToMatrix ( const vnl_matrix< T > &  matVnl,
Matrix< T > &  matSpams 
)

Definition at line 32 of file utlITKSpams.h.

References spams::Matrix< T >::rawX(), and spams::Matrix< T >::resize().

+ Here is the call graph for this function:

template<class T >
void spams::VnlVectorToVector ( const vnl_vector< T > &  v,
Vector< T > &  vec 
)

Definition at line 76 of file utlITKSpams.h.

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

+ Here is the call graph for this function:

template<typename T >
void spams::writeLog ( const Matrix< T > &  D,
const T  time,
int  iter,
char *  name 
)

Definition at line 717 of file dicts.h.

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

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 >
static T spams::xlogx ( const T  x)
inlinestatic

Definition at line 108 of file linalg.h.

References INFINITY.

Referenced by spams::FISTA::LogLoss< T, weighted >::fenchel(), and spams::FISTA::MultiLogLoss< T >::fenchel().

+ Here is the caller graph for this function:

Variable Documentation

char spams::buffer_string[50]
static

Definition at line 40 of file dicts.h.

bool spams::cap_heuristic = true

Definition at line 41 of file project.h.

bool spams::gap_heuristic = true

Definition at line 40 of file project.h.

bool spams::global_heuristic = true

Definition at line 39 of file project.h.

int spams::num_gap_relabels
int spams::num_global_relabels
int spams::num_pushes

Definition at line 36 of file project.h.

int spams::num_relabels
bool spams::price_heuristic = true

Definition at line 42 of file project.h.

bool spams::price_refine_heuristic = false

Definition at line 43 of file project.h.

int spams::seed = 0
static

seed for random number generation

Definition at line 34 of file misc.h.

Referenced by std::hash< std::vector< T > >::operator()(), and ran1().

Timer spams::tglobal1

Definition at line 49 of file project.h.

Timer spams::tglobal2

Definition at line 49 of file project.h.

Timer spams::tglobal3

Definition at line 49 of file project.h.