SHOGUN  3.2.1
shogun::linalg Namespace Reference

## Namespaces

namespace  implementation
namespace  special_purpose

## Classes

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. More...

## Functions

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 matrix_product (Matrix A, Matrix B, Matrix C, bool transpose_A=false, bool transpose_B=false, bool overwrite=true)
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 >
void subtract (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 >
void scale (Matrix A, Matrix B, typename Matrix::Scalar alpha)
template<Backend backend = linalg_traits<Core>::backend, class Matrix >
void elementwise_product (Matrix A, Matrix B, Matrix C)
template<Backend backend = linalg_traits<Core>::backend, class Matrix >
implementation::elementwise_square
< backend, Matrix >
::ReturnType
elementwise_square (Matrix m)
template<Backend backend = linalg_traits<Core>::backend, class Matrix , class ResultMatrix >
void elementwise_square (Matrix m, ResultMatrix result)
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 sum (Matrix m, bool no_diag=false)
template<Backend backend = linalg_traits<Redux>::backend, class Matrix >
Matrix::Scalar sum_symmetric (Matrix m, bool no_diag=false)
template<Backend backend = linalg_traits<Redux>::backend, class Matrix >
Matrix::Scalar sum_symmetric (Block< Matrix > b, bool no_diag=false)
template<Backend backend = linalg_traits<Redux>::backend, class Matrix >
implementation::colwise_sum
< backend, Matrix >
::ReturnType
colwise_sum (Matrix m, bool no_diag=false)
template<Backend backend = linalg_traits<Redux>::backend, class Matrix , class Vector >
void colwise_sum (Matrix m, Vector result, bool no_diag=false)
template<Backend backend = linalg_traits<Redux>::backend, class Matrix >
implementation::rowwise_sum
< backend, Matrix >
::ReturnType
rowwise_sum (Matrix m, bool no_diag=false)
template<Backend backend = linalg_traits<Redux>::backend, class Matrix , class Vector >
void rowwise_sum (Matrix m, Vector result, bool no_diag=false)
template<Backend backend = linalg_traits<Redux>::backend, class Vector >
Vector::Scalar vector_sum (Vector a)
template<Backend backend = linalg_traits<Redux>::backend, class Matrix >
Matrix::Scalar max (Matrix m)
template<Backend backend = linalg_traits<Core>::backend, class Matrix , class Vector >
void set_rows_const (Matrix A, Vector v)

## Function Documentation

 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

Definition at line 66 of file Core.h.

 Block 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

Parameters
 matrix the matrix on which the block is defined row_begin the row index at which the block starts col_begin the col index at which the block starts row_size the number of rows in the block col_size the number of cols in the block
Returns
a block object on this matrix

Definition at line 101 of file Block.h.

 implementation::colwise_sum::ReturnType shogun::linalg::colwise_sum ( Matrix m, bool no_diag = false )

Wrapper method for internal implementation of matrix colwise sum of values that works with generic dense matrices

Parameters
 m the matrix whose colwise sum of co-efficients has to be computed no_diag if true, diagonal entries are excluded from the sum (default - false)
Returns
the colwise sum of co-efficients computed as $$s_j=\sum_{i}m_{i,j}$$

Definition at line 113 of file Redux.h.

 void shogun::linalg::colwise_sum ( Matrix m, Vector result, bool no_diag = false )

Wrapper method for internal implementation of matrix colwise sum of values that works with generic dense matrices

Parameters
 m the matrix whose colwise sum of co-efficients has to be computed no_diag if true, diagonal entries are excluded from the sum (default - false) result Pre-allocated vector for the result of the computation

Definition at line 128 of file Redux.h.

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

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

Parameters
 a first vector b second vector
Returns
the dot product of $$\mathbf{a}$$ and $$\mathbf{b}$$, represented as $$\sum_i a_i b_i$$

Definition at line 56 of file Redux.h.

 void shogun::linalg::elementwise_product ( Matrix A, Matrix B, Matrix C )

Performs the operation C = A .* B where ".*" denotes elementwise multiplication

Definition at line 89 of file Core.h.

 implementation::elementwise_square::ReturnType shogun::linalg::elementwise_square ( Matrix m )

Wrapper method for internal implementation of square of co-efficients that works with generic dense matrices.

Parameters
 m the matrix whose squared co-efficients matrix has to be computed
Returns
another matrix whose co-efficients are $$m'_{i,j}=m_(i,j}^2$$ for all $$i,j$$

Definition at line 103 of file Core.h.

 void shogun::linalg::elementwise_square ( Matrix m, ResultMatrix result )

Wrapper method for internal implementation of square of co-efficients that works with generic dense matrices.

Parameters
 m the matrix whose squared co-efficients matrix has to be computed result Pre-allocated matrix for the result of the computation

Definition at line 116 of file Core.h.

 void shogun::linalg::matrix_product ( Matrix A, Matrix B, Matrix C, bool transpose_A = false, bool transpose_B = false, bool overwrite = true )

Performs matrix multiplication

Parameters
 A First matrix B Second matrix C Result of the operation transpose_A Whether to the transpose of A should be used instead of A transpose_B Whether to the transpose of B should be used instead of B overwrite If true, the values in C are overwritten with the result, otherwise, the result is added to the existing values

Definition at line 58 of file Core.h.

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

Returns the largest element in a matrix or vector

Definition at line 177 of file Redux.h.

 implementation::rowwise_sum::ReturnType shogun::linalg::rowwise_sum ( Matrix m, bool no_diag = false )

Wrapper method for internal implementation of matrix rowwise sum of values that works with generic dense matrices

Parameters
 m the matrix whose rowwise sum of co-efficients has to be computed no_diag if true, diagonal entries are excluded from the sum (default - false)
Returns
the rowwise sum of co-efficients computed as $$s_i=\sum_{j}m_{i,j}$$

Definition at line 142 of file Redux.h.

 void shogun::linalg::rowwise_sum ( Matrix m, Vector result, bool no_diag = false )

Wrapper method for internal implementation of matrix rowwise sum of values that works with generic dense matrices

Parameters
 m the matrix whose rowwise sum of co-efficients has to be computed no_diag if true, diagonal entries are excluded from the sum (default - false) result Pre-allocated vector for the result of the computation

Definition at line 157 of file Redux.h.

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

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

Definition at line 82 of file Core.h.

 void shogun::linalg::set_rows_const ( Matrix A, Vector v )

Sets each row of a matrix to some constant value. That is, perfoms the operation A[i,j] = v[i], for all i and j

Definition at line 49 of file Util.h.

 void shogun::linalg::subtract ( 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

Definition at line 74 of file Core.h.

 Matrix::Scalar shogun::linalg::sum ( Matrix m, bool no_diag = false )

Wrapper method for internal implementation of matrix sum of values that works with generic dense matrices

Parameters
 m the matrix whose sum of co-efficients has to be computed no_diag if true, diagonal entries are excluded from the sum (default - false)
Returns
the sum of co-efficients computed as $$\sum_{i,j}m_{i,j}$$

Definition at line 70 of file Redux.h.

 Matrix::Scalar shogun::linalg::sum_symmetric ( Matrix m, bool no_diag = false )

Wrapper method for internal implementation of symmetric matrix sum of values that works with generic dense matrices

Parameters
 m the matrix whose sum of co-efficients has to be computed no_diag if true, diagonal entries are excluded from the sum (default - false)
Returns
the sum of co-efficients computed as $$\sum_{i,j}m_{i,j}$$

Definition at line 84 of file Redux.h.

 Matrix::Scalar shogun::linalg::sum_symmetric ( Block< Matrix > b, bool no_diag = false )

Wrapper method for internal implementation of symmetric matrix-block sum of values that works with generic dense matrix blocks

Parameters
 b the matrix-block whose sum of co-efficients has to be computed no_diag if true, diagonal entries are excluded from the sum (default - false)
Returns
the sum of co-efficients computed as $$\sum_{i,j}b_{i,j}$$

Definition at line 98 of file Redux.h.

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

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

Parameters
 a vector whose sum has to be computed
Returns
the vector sum $$\sum_i a_i$$

Definition at line 170 of file Redux.h.

SHOGUN Machine Learning Toolbox - Documentation