SHOGUN  4.1.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
命名空间 | | 函数
shogun::linalg 命名空间参考

命名空间

 implementation
 
 ocl
 
 operations
 
 util
 

struct  Block
 Generic class Block which wraps a matrix class and contains block specific information, providing a uniform way to deal with matrix blocks for all supported backend matrices. 更多...
 

函数

template<class Matrix >
Block< Matrix > block (Matrix matrix, index_t row_begin, index_t col_begin, index_t row_size, index_t col_size)
 
template<Backend backend = linalg_traits<Core>::backend, class Matrix >
void add (Matrix A, Matrix B, Matrix C, typename Matrix::Scalar alpha=1.0, typename Matrix::Scalar beta=1.0)
 
template<Backend backend = linalg_traits<Core>::backend, class Matrix >
Matrix add (Matrix A, Matrix B, typename Matrix::Scalar alpha=1.0, typename Matrix::Scalar beta=1.0)
 
template<Backend backend = linalg_traits<Core>::backend, class Matrix >
void scale (Matrix A, Matrix B, typename Matrix::Scalar alpha)
 
template<Backend backend = linalg_traits<Core>::backend, class Matrix >
void scale (Matrix A, typename Matrix::Scalar alpha)
 
template<class Operand , class UnaryOp >
auto elementwise_compute (Operand operand, UnaryOp unary_op) -> typename Operand::template container_type< decltype(unary_op(operand.data()[0]))>
 
template<class Operand , class UnaryOp >
void elementwise_compute_inplace (Operand operand, UnaryOp unary_op)
 
template<Backend backend, class Operand >
Operand::template
container_type< typename
operations::sin< typename
Operand::Scalar >::return_type > 
elementwise_sin (Operand operand)
 
template<Backend backend, class Operand >
void elementwise_sin_inplace (Operand operand)
 
template<Backend backend = linalg_traits<Redux>::backend, class Vector >
Vector::Scalar dot (Vector a, Vector b)
 
template<Backend backend = linalg_traits<Redux>::backend, class Matrix >
Matrix::Scalar max (Matrix m)
 
template<Backend backend = linalg_traits<Redux>::backend, class Vector >
Vector::Scalar vector_sum (Vector a)
 

函数说明

void shogun::linalg::add ( Matrix  A,
Matrix  B,
Matrix  C,
typename Matrix::Scalar  alpha = 1.0,
typename Matrix::Scalar  beta = 1.0 
)

Performs the operation \(C = \alpha A + \beta B\). Works for both matrices and vectors.

This version should be used for backend specific code requirements. For example, use this with CGPUMatrix and explicitly set ViennaCL backend, or SGMatrix and explicitly set Eigen3 backend. If matrix-type/backend-type independent code is desired, use the version that does not support preallocated result matrix but returns the result in a newly created matrix instead.

参数
AFirst matrix/vector
BSecond matrix/vector
CResult of the operation
alphascaling parameter for first matrix/vector
betascaling parameter for second matrix/vector

在文件 Core.h65 行定义.

Matrix shogun::linalg::add ( Matrix  A,
Matrix  B,
typename Matrix::Scalar  alpha = 1.0,
typename Matrix::Scalar  beta = 1.0 
)

Performs the operation \(C = \alpha A + \beta B\). Works for both matrices and vectors.

This version returns the result in a newly created matrix/vector. If add is desired that will work irrespective of the backend and the matrix/vector type used, then this method should be used.

参数
AFirst matrix/vector
BSecond matrix/vector
alphascaling parameter for first matrix/vector
betascaling parameter for second matrix/vector
返回
The result of the operation

在文件 Core.h85 行定义.

Block<Matrix> shogun::linalg::block ( Matrix  matrix,
index_t  row_begin,
index_t  col_begin,
index_t  row_size,
index_t  col_size 
)

Method that returns a block object. Suited for Eigen3/SGMatrix

参数
matrixthe matrix on which the block is defined
row_beginthe row index at which the block starts
col_beginthe col index at which the block starts
row_sizethe number of rows in the block
col_sizethe number of cols in the block
返回
a block object on this matrix

在文件 Block.h102 行定义.

Vector::Scalar shogun::linalg::dot ( Vector  a,
Vector  b 
)

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

参数
afirst vector
bsecond vector
返回
the dot product of \(\mathbf{a}\) and \(\mathbf{b}\), represented as \(\sum_i a_i b_i\)

在文件 Redux.h56 行定义.

auto shogun::linalg::elementwise_compute ( Operand  operand,
UnaryOp  unary_op 
) -> typename Operand::template container_type<decltype(unary_op(operand.data()[0]))>

Template method for computing custom unary operations element-wise for matrices and vectors using NATIVE backend. Works for SGMatrix/SGVector.

This method returns the result in a newly allocated matrix/vector.

参数
operandThe operand on which the element-wise operation has to be performed
unary_opThe custom unary operator
返回
The result of the unary operator applied element-wise on the operand

在文件 ElementwiseOperations.h56 行定义.

void shogun::linalg::elementwise_compute_inplace ( Operand  operand,
UnaryOp  unary_op 
)

Template method for computing custom unary operations element-wise for matrices and vectors using NATIVE backend. Works for SGMatrix/SGVector.

This method computes the result in-place.

参数
operandThe operand on which the element-wise operation has to be performed
unary_opThe custom unary operator

在文件 ElementwiseOperations.h80 行定义.

Operand::template container_type<typename operations::sin<typename Operand::Scalar>::return_type> shogun::linalg::elementwise_sin ( Operand  operand)

Template method for computing element-wise sin for matrices and vectors.

This method returns the result in a newly allocated matrix/vector.

参数
operandThe operand on which the element-wise operation has to be performed
返回
The result of the unary operator applied element-wise on the operand

在文件 ElementwiseOperations.h141 行定义.

void shogun::linalg::elementwise_sin_inplace ( Operand  operand)

Template method for computing element-wise sin for matrices and vectors.

This method computes the result in-place.

参数
operandThe operand on which the element-wise operation has to be performed
返回
The result of the unary operator applied element-wise on the operand

在文件 ElementwiseOperations.h165 行定义.

Matrix::Scalar shogun::linalg::max ( Matrix  m)

Returns the largest element in a matrix or vector

参数
mthe matrix or the vector
返回
the value of the largest element

在文件 Redux.h66 行定义.

void shogun::linalg::scale ( Matrix  A,
Matrix  B,
typename Matrix::Scalar  alpha 
)

Performs the operation B = alpha*A. Works for both matrices and vectors

在文件 Core.h93 行定义.

void shogun::linalg::scale ( Matrix  A,
typename Matrix::Scalar  alpha 
)

Performs the operation A = alpha*A. Works for both matrices and vectors

在文件 Core.h100 行定义.

Vector::Scalar shogun::linalg::vector_sum ( Vector  a)

Wrapper method for internal implementation of vector sum of values that works with generic dense vectors

参数
avector whose sum has to be computed
返回
the vector sum \(\sum_i a_i\)

在文件 Redux.h79 行定义.


SHOGUN 机器学习工具包 - 项目文档