planc
Parallel Lowrank Approximation with Non-negativity Constraints
Functions | Variables
utils.hpp File Reference
#include <assert.h>
#include <omp.h>
#include <stdio.h>
#include <chrono>
#include <ctime>
#include <stack>
#include <typeinfo>
#include <vector>
#include "common/utils.h"
#include <cblas.h>

Go to the source code of this file.

Functions

void tic ()
 start the timer. easy to call as tic(); some code; double t=toc(); More...
 
double toc ()
 
template<class T >
void fixNumericalError (T *X, const double prec=EPSILON_1EMINUS16)
 
template<class T >
void fixDecimalPlaces (T *X, const int places=NUMBEROF_DECIMAL_PLACES)
 
int random_sieve (const int nthprime)
 
template<class T >
void absmat (T *X)
 
template<class T >
void makeSparse (const double sparsity, T(*X))
 
template<class T >
void randNMF (const UWORD m, const UWORD n, const UWORD k, const double sparsity, T *A)
 
template<class T >
void printVector (const std::vector< T > &x)
 
std::vector< std::vector< size_t > > cartesian_product (const std::vector< std::vector< size_t >> &v)
 
template<class INPUTTYPE , class LRTYPE >
double computeObjectiveError (const INPUTTYPE &A, const LRTYPE &W, const LRTYPE &H)
 
void cblas_sgemm (const MAT &A, const MAT &B, double *C)
 

Variables

static ULONG powersof10 [16]
 
static std::stack< std::chrono::steady_clock::time_point > tictoc_stack
 
static std::stack< double > tictoc_stack_omp_clock
 

Function Documentation

◆ absmat()

template<class T >
void absmat ( T *  X)

Definition at line 116 of file utils.hpp.

◆ cartesian_product()

std::vector<std::vector<size_t> > cartesian_product ( const std::vector< std::vector< size_t >> &  v)

Definition at line 160 of file utils.hpp.

◆ cblas_sgemm()

void cblas_sgemm ( const MAT A,
const MAT B,
double *  C 
)

Definition at line 268 of file utils.hpp.

◆ computeObjectiveError()

template<class INPUTTYPE , class LRTYPE >
double computeObjectiveError ( const INPUTTYPE &  A,
const LRTYPE &  W,
const LRTYPE &  H 
)

Definition at line 180 of file utils.hpp.

◆ fixDecimalPlaces()

template<class T >
void fixDecimalPlaces ( T *  X,
const int  places = NUMBEROF_DECIMAL_PLACES 
)

Definition at line 64 of file utils.hpp.

◆ fixNumericalError()

template<class T >
void fixNumericalError ( T *  X,
const double  prec = EPSILON_1EMINUS16 
)

Definition at line 58 of file utils.hpp.

◆ makeSparse()

template<class T >
void makeSparse ( const double  sparsity,
T *  X 
)

Definition at line 122 of file utils.hpp.

◆ printVector()

template<class T >
void printVector ( const std::vector< T > &  x)

Definition at line 153 of file utils.hpp.

◆ randNMF()

template<class T >
void randNMF ( const UWORD  m,
const UWORD  n,
const UWORD  k,
const double  sparsity,
T *  A 
)

Definition at line 134 of file utils.hpp.

◆ random_sieve()

int random_sieve ( const int  nthprime)

Definition at line 74 of file utils.hpp.

◆ tic()

void tic ( )
inline

start the timer. easy to call as tic(); some code; double t=toc();

Definition at line 42 of file utils.hpp.

◆ toc()

double toc ( )
inline

Definition at line 48 of file utils.hpp.

Variable Documentation

◆ powersof10

ULONG powersof10[16]
static
Initial value:
= {1,
10,
100,
1000,
10000,
100000,
1000000,
10000000,
100000000,
1000000000,
10000000000,
100000000000,
1000000000000,
10000000000000,
100000000000000,
1000000000000000}

Definition at line 20 of file utils.hpp.

◆ tictoc_stack

std::stack<std::chrono::steady_clock::time_point> tictoc_stack
static

Definition at line 37 of file utils.hpp.

◆ tictoc_stack_omp_clock

std::stack<double> tictoc_stack_omp_clock
static

Definition at line 38 of file utils.hpp.