NICE
Northeastern Interactive Clustering Engine
Static Public Member Functions | List of all members
Nice::CpuOperations< T > Class Template Reference

#include <cpu_operations.h>

Static Public Member Functions

static Matrix< T > Transpose (const Matrix< T > &a)
 
static Vector< T > Transpose (const Vector< T > &a)
 
static Matrix< T > Multiply (const Matrix< T > &a, const T &scalar)
 
static Matrix< T > Multiply (const Matrix< T > &a, const Matrix< T > &b)
 
static Matrix< T > Add (const Matrix< T > &a, const T &scalar)
 
static Matrix< T > Add (const Matrix< T > &a, const Matrix< T > &b)
 
static Matrix< T > Subtract (const Matrix< T > &a, const T &scalar)
 
static Matrix< T > Subtract (const Matrix< T > &a, const Matrix< T > &b)
 
static Matrix< bool > LogicalOr (const Matrix< bool > &a, const Matrix< bool > &b)
 
static Matrix< bool > LogicalNot (const Matrix< bool > &a)
 
static Matrix< bool > LogicalAnd (const Matrix< bool > &a, const Matrix< bool > &b)
 
static Matrix< T > Inverse (const Matrix< T > &a)
 
static Vector< T > Norm (const Matrix< T > &a, const int &p=2, const int &axis=0)
 
static T Determinant (const Matrix< T > &a)
 
static int Rank (const Matrix< T > &a)
 
static T FrobeniusNorm (const Matrix< T > &a)
 
static T Trace (const Matrix< T > &a)
 
static T DotProduct (const Vector< T > &a, const Vector< T > &b)
 
static Matrix< T > OuterProduct (const Vector< T > &a, const Vector< T > &b)
 
static Vector< bool > LogicalAnd (const Vector< T > &a, const Vector< T > &b)
 
static Vector< bool > LogicalOr (const Vector< bool > &a, const Vector< bool > &b)
 
static Vector< bool > LogicalNot (const Vector< bool > &a)
 
static Matrix< T > Normalize (const Matrix< T > &a, const int &p=2, const int &axis=0)
 
static Matrix< T > GenKernelMatrix (const Matrix< T > &data_matrix, const KernelType kernel_type=kGaussianKernel, const float constant=1.0)
 
static void GenDegreeMatrix (const Matrix< T > &kernel_matrix, Matrix< T > &degree_matrix, Matrix< T > &degree_matrix_to_the_minus_half)
 

Member Function Documentation

template<typename T >
static Matrix<T> Nice::CpuOperations< T >::Add ( const Matrix< T > &  a,
const T &  scalar 
)
inlinestatic

This is a function that adds each element in the matrix to a scalar and returns the resulting matrix.

Parameters
aInput Matrix
scalarInput Scalar
Returns
This function returns a matrix that is the resulatant of adding the input matrix and scalar.
See also
Add(const Matrix<T> &a, const Matrix<T> &b)
template<typename T >
static Matrix<T> Nice::CpuOperations< T >::Add ( const Matrix< T > &  a,
const Matrix< T > &  b 
)
inlinestatic

This is a function that adds two matricies and returns the resulting matrix.

Parameters
aInput Matrix 1
bInput Matrix 2
Returns
This function returns a matrix that is the resulatant of adding two input matricies.
See also
Add(const Matrix<T> &a, const T &scalar)
template<typename T >
static T Nice::CpuOperations< T >::Determinant ( const Matrix< T > &  a)
static
template<typename T >
static T Nice::CpuOperations< T >::DotProduct ( const Vector< T > &  a,
const Vector< T > &  b 
)
inlinestatic

This is a function that calculates the dot product of two vectors.

Parameters
aInput Vector 1
bInput Vector 2
Returns
This function returns a value of type T which is the dot product of the two vectors.
template<typename T >
static T Nice::CpuOperations< T >::FrobeniusNorm ( const Matrix< T > &  a)
inlinestatic

This is a function that returns the frobenius norm of Matrix a

Parameters
a
Returns
This function returns a value of type T
template<typename T >
static void Nice::CpuOperations< T >::GenDegreeMatrix ( const Matrix< T > &  kernel_matrix,
Matrix< T > &  degree_matrix,
Matrix< T > &  degree_matrix_to_the_minus_half 
)
inlinestatic

Generates a degree matrix D from an input kernel matrix It also generates D^(-1/2)

Parameters
kernel_matrixInput matrix: a squared kernel matrix
degree_matrixOutput degree matrix D
degree_matrix_to_the_minus_halfOutput matrix D^(-1/2)
template<typename T >
static Matrix<T> Nice::CpuOperations< T >::GenKernelMatrix ( const Matrix< T > &  data_matrix,
const KernelType  kernel_type = kGaussianKernel,
const float  constant = 1.0 
)
inlinestatic

Generates a kernel matrix from an input data_matrix

Parameters
data_matrixInput matrix whose rows represent samples and columns represent features
kernel_typeKernel type could be chosen from Gaussian, Linear and Polynomial
constantIn Gaussian kernel, this is sigma; In Polynomial kernel, this is constant c In Linear kernel, this is c as well
Returns
An nxn kernel matrix where n is the number of samples in data_matrix
template<typename T >
static Matrix<T> Nice::CpuOperations< T >::Inverse ( const Matrix< T > &  a)
inlinestatic

This is a function that returns the inverse of a matrix.

Parameters
aInput Matrix
Returns
This function returns a matrix that is the inverse of the input matrix.
template<typename T >
static Matrix<bool> Nice::CpuOperations< T >::LogicalAnd ( const Matrix< bool > &  a,
const Matrix< bool > &  b 
)
inlinestatic

This is a function that calculates the "logical and" of the two input Matrices

Parameters
aInput Matrix 1
bInput Matrix 2
Returns
This function returns a Matrix of type bool
template<typename T >
static Vector<bool> Nice::CpuOperations< T >::LogicalAnd ( const Vector< T > &  a,
const Vector< T > &  b 
)
inlinestatic

This is a function that calculates the "logical and" of the two input Vectors

Parameters
aInput Vector 1
bInput Vector 2
Returns
This function returns a Vector of type bool
template<typename T >
static Matrix<bool> Nice::CpuOperations< T >::LogicalNot ( const Matrix< bool > &  a)
inlinestatic

This is a funtion that returns the "logical not" of the input Matrix

Parameters
aInput Matrix 1
Returns
This funtion returns a Matrix of type bool
template<typename T >
static Vector<bool> Nice::CpuOperations< T >::LogicalNot ( const Vector< bool > &  a)
inlinestatic

This is a funtion that returns the "logical not" of the input Vector

Parameters
aInput Vector 1
Returns
This funtion returns a Vector of type bool
template<typename T >
static Matrix<bool> Nice::CpuOperations< T >::LogicalOr ( const Matrix< bool > &  a,
const Matrix< bool > &  b 
)
inlinestatic

This is a function that calculates the "logical or" of the two input Matrices

Parameters
aInput Matrix 1
bInput Matrix 2
Returns
This function returns a Matrix of type bool
template<typename T >
static Vector<bool> Nice::CpuOperations< T >::LogicalOr ( const Vector< bool > &  a,
const Vector< bool > &  b 
)
inlinestatic

This is a function that calculates the "logical or" of the two input Vectors

Parameters
aInput Vector 1
bInput Vector 2
Returns
This function returns a Vector of type bool
template<typename T >
static Matrix<T> Nice::CpuOperations< T >::Multiply ( const Matrix< T > &  a,
const T &  scalar 
)
inlinestatic

This is a function that calculates the product Matrix of the input Matrix and a scalar

Parameters
aInput Matrix
scalarInput scalar
Returns
This function returns a Matrix of type T
template<typename T >
static Matrix<T> Nice::CpuOperations< T >::Multiply ( const Matrix< T > &  a,
const Matrix< T > &  b 
)
inlinestatic

This is a funtion that calculates the product Matrix of the two input Matrices

Parameters
aInput Matrix 1
bInput Matrix 2
Returns
This function returns a Matrix of type T
template<typename T >
static Vector<T> Nice::CpuOperations< T >::Norm ( const Matrix< T > &  a,
const int &  p = 2,
const int &  axis = 0 
)
inlinestatic

static Vector <T> Norm( const Matrix <T> &a, const int &p = 2, const int &axis = 0) calculates the norm of the values in an m x n dependent of the input p and axis. The norm is returned in the form of a vector. If the axis is 0, the norm will be calulated column wise and the size of the output vector will be dependent on n. If the axis is 1, the norm will be calculated row-wise and the size of the vector will be dependent on m.

Parameters
aconst Matrix <T> &a
bint &p
cint &axis
Returns
Vector <T>
template<typename T >
static Matrix<T> Nice::CpuOperations< T >::Normalize ( const Matrix< T > &  a,
const int &  p = 2,
const int &  axis = 0 
)
inlinestatic

statix Matrix <T> Normalize(const Matrix <T> &a, const int &p =2, const int &axis = 0) normalizes a m x n matrix by element.

Parameters
aconst Matrix<T> &a
bconst int &p = 2
cconst int &axis = 0
Returns
Matrix <T>
See also
Norm
template<typename T >
static Matrix<T> Nice::CpuOperations< T >::OuterProduct ( const Vector< T > &  a,
const Vector< T > &  b 
)
inlinestatic

This is a function that calculates the "Outer Product of the input Vectors

Parameters
aInput Vector 1
bInput Vector 2
Returns
This function returns a Matrix of type T
template<typename T >
static int Nice::CpuOperations< T >::Rank ( const Matrix< T > &  a)
inlinestatic

static int Rank(const Matrix <T> &a) is a function that returns the rank of a m x n matrix

Parameters
aMatrix<T> &a
Returns
This function returns an int value of the matrix's rank.
template<typename T >
static Matrix<T> Nice::CpuOperations< T >::Subtract ( const Matrix< T > &  a,
const T &  scalar 
)
inlinestatic
template<typename T >
static Matrix<T> Nice::CpuOperations< T >::Subtract ( const Matrix< T > &  a,
const Matrix< T > &  b 
)
inlinestatic
template<typename T >
static T Nice::CpuOperations< T >::Trace ( const Matrix< T > &  a)
inlinestatic

This is a function that returns the sum of the diagonal coefficiants of a Matrix

Parameters
aInput Matrix
Returns
This function returns a value of type T
template<typename T >
static Matrix<T> Nice::CpuOperations< T >::Transpose ( const Matrix< T > &  a)
inlinestatic

This is a function that calculates the transpose Matrix of the input Matrix

Parameters
aInput Matrix
Returns
This function returns a Matrix of type T
template<typename T >
static Vector<T> Nice::CpuOperations< T >::Transpose ( const Vector< T > &  a)
inlinestatic

This is a function that calculates the transpose Vector of the input Vector

Parameters
aInput Vector
Returns
This function returns a Vector of type T

The documentation for this class was generated from the following file: