SHOGUN  6.0.0
Classes | Macros
LinalgBackendBase.h File Reference

Go to the source code of this file.

Classes

class  LinalgBackendBase
 Base interface of generic linalg methods and generic memory transfer methods. More...
 

Macros

#define DEFINE_FOR_ALL_PTYPE(METHODNAME, Container)
 
#define DEFINE_FOR_REAL_PTYPE(METHODNAME, Container)
 
#define DEFINE_FOR_NON_INTEGER_PTYPE(METHODNAME, Container)
 
#define BACKEND_GENERIC_IN_PLACE_ADD(Type, Container)
 
#define BACKEND_GENERIC_CHOLESKY_FACTOR(Type, Container)
 
#define BACKEND_GENERIC_CHOLESKY_SOLVER(Type, Container)
 
#define BACKEND_GENERIC_DOT(Type, Container)
 
#define BACKEND_GENERIC_IN_PLACE_ELEMENT_PROD(Type, Container)
 
#define BACKEND_GENERIC_IN_PLACE_BLOCK_ELEMENT_PROD(Type, Container)
 
#define BACKEND_GENERIC_LOGISTIC(Type, Container)
 
#define BACKEND_GENERIC_IN_PLACE_MATRIX_PROD(Type, Container)
 
#define BACKEND_GENERIC_MAX(Type, Container)
 
#define BACKEND_GENERIC_REAL_MEAN(Type, Container)
 
#define BACKEND_GENERIC_COMPLEX_MEAN(Container)
 
#define BACKEND_GENERIC_RANGE_FILL(Type, Container)
 
#define BACKEND_GENERIC_IN_PLACE_SCALE(Type, Container)
 
#define BACKEND_GENERIC_SET_CONST(Type, Container)
 
#define BACKEND_GENERIC_SUM(Type, Container)
 
#define BACKEND_GENERIC_BLOCK_SUM(Type, Container)
 
#define BACKEND_GENERIC_SYMMETRIC_SUM(Type, Container)
 
#define BACKEND_GENERIC_SYMMETRIC_BLOCK_SUM(Type, Container)
 
#define BACKEND_GENERIC_COLWISE_SUM(Type, Container)
 
#define BACKEND_GENERIC_BLOCK_COLWISE_SUM(Type, Container)
 
#define BACKEND_GENERIC_ROWWISE_SUM(Type, Container)
 
#define BACKEND_GENERIC_BLOCK_ROWWISE_SUM(Type, Container)
 
#define BACKEND_GENERIC_TO_GPU(Type, Container)
 
#define BACKEND_GENERIC_FROM_GPU(Type, Container)
 

Macro Definition Documentation

◆ BACKEND_GENERIC_BLOCK_COLWISE_SUM

#define BACKEND_GENERIC_BLOCK_COLWISE_SUM (   Type,
  Container 
)
Value:
virtual SGVector<Type> colwise_sum(const linalg::Block<Container<Type>>& a, bool no_diag) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
SGVector< T > colwise_sum(const SGMatrix< T > &mat, bool no_diag=false)

Wrapper method of matrix colwise sum that works with dense matrices.

See also
linalg::colwise_sum

Definition at line 370 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_BLOCK_ROWWISE_SUM

#define BACKEND_GENERIC_BLOCK_ROWWISE_SUM (   Type,
  Container 
)
Value:
virtual SGVector<Type> rowwise_sum(const linalg::Block<Container<Type>>& a, bool no_diag) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
SGVector< T > rowwise_sum(const SGMatrix< T > &mat, bool no_diag=false)

Wrapper method of matrix rowwise sum that works with dense matrices.

See also
linalg::rowwise_sum

Definition at line 398 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_BLOCK_SUM

#define BACKEND_GENERIC_BLOCK_SUM (   Type,
  Container 
)
Value:
virtual Type sum(const linalg::Block<Container<Type>>& a, bool no_diag) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
T sum(const Container< T > &a, bool no_diag=false)

Wrapper method of sum that works with matrix blocks.

See also
linalg::sum

Definition at line 314 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_CHOLESKY_FACTOR

#define BACKEND_GENERIC_CHOLESKY_FACTOR (   Type,
  Container 
)
Value:
virtual Container<Type> cholesky_factor(const Container<Type>& A, \
const bool lower) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
SGMatrix< T > cholesky_factor(const SGMatrix< T > &A, const bool lower=true)

Wrapper method of Cholesky decomposition.

See also
linalg::cholesky_factor

Definition at line 110 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_CHOLESKY_SOLVER

#define BACKEND_GENERIC_CHOLESKY_SOLVER (   Type,
  Container 
)
Value:
virtual SGVector<Type> cholesky_solver(const Container<Type>& L, \
const SGVector<Type>& b, const bool lower) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
SGVector< T > cholesky_solver(const SGMatrix< T > &L, const SGVector< T > &b, const bool lower=true)

Wrapper triangular solver with Choleksy decomposition.

See also
linalg::cholesky_solver

Definition at line 125 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_COLWISE_SUM

#define BACKEND_GENERIC_COLWISE_SUM (   Type,
  Container 
)
Value:
virtual SGVector<Type> colwise_sum(const Container<Type>& a, bool no_diag) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
SGVector< T > colwise_sum(const SGMatrix< T > &mat, bool no_diag=false)

Wrapper method of matrix rowwise sum that works with dense matrices.

See also
linalg::colwise_sum

Definition at line 356 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_COMPLEX_MEAN

#define BACKEND_GENERIC_COMPLEX_MEAN (   Container)
Value:
virtual complex128_t mean(const Container<complex128_t>& a) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
std::complex< float64_t > complex128_t
Definition: common.h:77
std::enable_if<!std::is_same< T, complex128_t >::value, float64_t >::type mean(const Container< T > &a)

Wrapper method that computes mean of SGVectors and SGMatrices that are composed of complex numbers.

See also
linalg::mean

Definition at line 242 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_DOT

#define BACKEND_GENERIC_DOT (   Type,
  Container 
)
Value:
virtual Type dot(const Container<Type>& a, const Container<Type>& b) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
T dot(const SGVector< T > &a, const SGVector< T > &b)

Wrapper method of vector dot-product that works with generic vectors.

See also
linalg::dot

Definition at line 140 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_FROM_GPU

#define BACKEND_GENERIC_FROM_GPU (   Type,
  Container 
)
Value:
virtual void from_gpu(const Container<Type>&, Type* data) const \
{ \
SG_SNOTIMPLEMENTED; \
}
void from_gpu(SGVector< T > &a, SGVector< T > &b)

Wrapper method of fetching data from GPU memory.

See also
linalg::from_gpu

Definition at line 428 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_IN_PLACE_ADD

#define BACKEND_GENERIC_IN_PLACE_ADD (   Type,
  Container 
)
Value:
virtual void add(Container<Type>& a, Container<Type>& b, Type alpha, Type beta, Container<Type>& result) const \
{ \
SG_SNOTIMPLEMENTED; \
}
void add(SGVector< T > &a, SGVector< T > &b, SGVector< T > &result, T alpha=1, T beta=1)

Wrapper method of add operation the operation result = alpha*a + beta*b.

See also
linalg::add

Definition at line 96 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_IN_PLACE_BLOCK_ELEMENT_PROD

#define BACKEND_GENERIC_IN_PLACE_BLOCK_ELEMENT_PROD (   Type,
  Container 
)
Value:
virtual void element_prod(linalg::Block<Container<Type>>& a, \
linalg::Block<Container<Type>>& b, Container<Type>& result) const \
{ \
SG_SNOTIMPLEMENTED; \
}
void element_prod(Block< SGMatrix< T >> &a, Block< SGMatrix< T >> &b, SGMatrix< T > &result)

Wrapper method of in-place matrix block elementwise product.

See also
linalg::element_prod

Definition at line 168 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_IN_PLACE_ELEMENT_PROD

#define BACKEND_GENERIC_IN_PLACE_ELEMENT_PROD (   Type,
  Container 
)
Value:
virtual void element_prod(Container<Type>& a, Container<Type>& b,\
Container<Type>& result) const \
{ \
SG_SNOTIMPLEMENTED; \
}
void element_prod(Block< SGMatrix< T >> &a, Block< SGMatrix< T >> &b, SGMatrix< T > &result)

Wrapper method of in-place matrix elementwise product.

See also
linalg::element_prod

Definition at line 154 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_IN_PLACE_MATRIX_PROD

#define BACKEND_GENERIC_IN_PLACE_MATRIX_PROD (   Type,
  Container 
)
Value:
virtual void matrix_prod(SGMatrix<Type>& a, Container<Type>& b,\
Container<Type>& result, bool transpose_A, bool transpose_B) const \
{ \
SG_SNOTIMPLEMENTED; \
}
void matrix_prod(SGMatrix< T > &A, SGVector< T > &b, SGVector< T > &result, bool transpose=false)

Wrapper method of matrix product method.

See also
linalg::matrix_prod

Definition at line 195 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_IN_PLACE_SCALE

#define BACKEND_GENERIC_IN_PLACE_SCALE (   Type,
  Container 
)
Value:
virtual void scale(Container<Type>& a, Type alpha, Container<Type>& result) const \
{ \
SG_SNOTIMPLEMENTED; \
}
void scale(SGVector< T > &a, SGVector< T > &result, T alpha=1)

Wrapper method of scale operation the operation result = alpha*A.

See also
linalg::scale

Definition at line 271 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_LOGISTIC

#define BACKEND_GENERIC_LOGISTIC (   Type,
  Container 
)
Value:
virtual void logistic(Container<Type>& a, Container<Type>& result) const \
{ \
SG_SNOTIMPLEMENTED; \
}
void logistic(Matrix A, Matrix result)

Wrapper method of logistic function f(x) = 1/(1+exp(-x))

See also
linalg::logistic

Definition at line 182 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_MAX

#define BACKEND_GENERIC_MAX (   Type,
  Container 
)
Value:
virtual Type max(const Container<Type>& a) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
T max(const Container< T > &a)

Wrapper method of max method. Return the largest element in a vector or matrix.

See also
linalg::max

Definition at line 210 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_RANGE_FILL

#define BACKEND_GENERIC_RANGE_FILL (   Type,
  Container 
)
Value:
virtual void range_fill(Container<Type>& a, const Type start) const \
{ \
SG_SNOTIMPLEMENTED; \
}
void range_fill(Container< T > &a, const T start=0)

Wrapper method that range fills a vector of matrix.

See also
linalg::range_fill

Definition at line 257 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_REAL_MEAN

#define BACKEND_GENERIC_REAL_MEAN (   Type,
  Container 
)
Value:
virtual float64_t mean(const Container<Type>& a) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
std::enable_if<!std::is_same< T, complex128_t >::value, float64_t >::type mean(const Container< T > &a)
double float64_t
Definition: common.h:60

Wrapper method that computes mean of SGVectors and SGMatrices that are composed of real numbers.

See also
linalg::mean

Definition at line 226 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_ROWWISE_SUM

#define BACKEND_GENERIC_ROWWISE_SUM (   Type,
  Container 
)
Value:
virtual SGVector<Type> rowwise_sum(const Container<Type>& a, bool no_diag) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
SGVector< T > rowwise_sum(const SGMatrix< T > &mat, bool no_diag=false)

Wrapper method of matrix rowwise sum that works with dense matrices.

See also
linalg::rowwise_sum

Definition at line 384 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_SET_CONST

#define BACKEND_GENERIC_SET_CONST (   Type,
  Container 
)
Value:
virtual void set_const(Container<Type>& a, const Type value) const \
{ \
SG_SNOTIMPLEMENTED; \
}
void set_const(Container< T > &a, T value)

Wrapper method that sets const values to vectors or matrices.

See also
linalg::set_const

Definition at line 285 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_SUM

#define BACKEND_GENERIC_SUM (   Type,
  Container 
)
Value:
virtual Type sum(const Container<Type>& a, bool no_diag) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
T sum(const Container< T > &a, bool no_diag=false)

Wrapper method of sum that works with generic vectors or matrices.

See also
linalg::sum

Definition at line 299 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_SYMMETRIC_BLOCK_SUM

#define BACKEND_GENERIC_SYMMETRIC_BLOCK_SUM (   Type,
  Container 
)
Value:
virtual Type sum_symmetric(const linalg::Block<Container<Type>>& a, bool no_diag) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
T sum_symmetric(const SGMatrix< T > &a, bool no_diag=false)

Wrapper method of sum that works with symmetric matrix blocks.

See also
linalg::sum

Definition at line 342 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_SYMMETRIC_SUM

#define BACKEND_GENERIC_SYMMETRIC_SUM (   Type,
  Container 
)
Value:
virtual Type sum_symmetric(const Container<Type>& a, bool no_diag) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
T sum_symmetric(const SGMatrix< T > &a, bool no_diag=false)

Wrapper method of sum that works with symmetric matrices.

See also
linalg::sum_symmetric

Definition at line 328 of file LinalgBackendBase.h.

◆ BACKEND_GENERIC_TO_GPU

#define BACKEND_GENERIC_TO_GPU (   Type,
  Container 
)
Value:
virtual GPUMemoryBase<Type>* to_gpu(const Container<Type>&) const \
{ \
SG_SNOTIMPLEMENTED; \
return 0; \
}
void to_gpu(SGVector< T > &a, SGVector< T > &b)

Wrapper method of Transferring data to GPU memory. Does nothing if no GPU backend registered.

See also
linalg::to_gpu

Definition at line 413 of file LinalgBackendBase.h.

◆ DEFINE_FOR_ALL_PTYPE

#define DEFINE_FOR_ALL_PTYPE (   METHODNAME,
  Container 
)
Value:
METHODNAME(bool, Container); \
METHODNAME(char, Container); \
METHODNAME(int8_t, Container); \
METHODNAME(uint8_t, Container); \
METHODNAME(int16_t, Container); \
METHODNAME(uint16_t, Container); \
METHODNAME(int32_t, Container); \
METHODNAME(uint32_t, Container); \
METHODNAME(int64_t, Container); \
METHODNAME(uint64_t, Container); \
METHODNAME(float32_t, Container); \
METHODNAME(float64_t, Container); \
METHODNAME(floatmax_t, Container); \
METHODNAME(complex128_t, Container); \
std::complex< float64_t > complex128_t
Definition: common.h:77
double float64_t
Definition: common.h:60
long double floatmax_t
Definition: common.h:61
float float32_t
Definition: common.h:59

Definition at line 54 of file LinalgBackendBase.h.

◆ DEFINE_FOR_NON_INTEGER_PTYPE

#define DEFINE_FOR_NON_INTEGER_PTYPE (   METHODNAME,
  Container 
)
Value:
METHODNAME(float32_t, Container); \
METHODNAME(float64_t, Container); \
METHODNAME(floatmax_t, Container); \
METHODNAME(complex128_t, Container);
std::complex< float64_t > complex128_t
Definition: common.h:77
double float64_t
Definition: common.h:60
long double floatmax_t
Definition: common.h:61
float float32_t
Definition: common.h:59

Definition at line 85 of file LinalgBackendBase.h.

◆ DEFINE_FOR_REAL_PTYPE

#define DEFINE_FOR_REAL_PTYPE (   METHODNAME,
  Container 
)
Value:
METHODNAME(bool, Container); \
METHODNAME(char, Container); \
METHODNAME(int8_t, Container); \
METHODNAME(uint8_t, Container); \
METHODNAME(int16_t, Container); \
METHODNAME(uint16_t, Container); \
METHODNAME(int32_t, Container); \
METHODNAME(uint32_t, Container); \
METHODNAME(int64_t, Container); \
METHODNAME(uint64_t, Container); \
METHODNAME(float32_t, Container); \
METHODNAME(float64_t, Container); \
METHODNAME(floatmax_t, Container);
double float64_t
Definition: common.h:60
long double floatmax_t
Definition: common.h:61
float float32_t
Definition: common.h:59

Definition at line 70 of file LinalgBackendBase.h.


SHOGUN Machine Learning Toolbox - Documentation