GPUMLib  0.2.2
GPU Machine Learning Library
Macros | Functions
Non-negative Matrix Factorization kernels

Macros

#define HMATRIX(_ROW, _COL, _R, _M)   (H[(_COL) * (_R) + (_ROW)])
 
#define IDX_HMATRIX(_ROW, _COL, _R, _M)   ((_COL) * (_R) + (_ROW))
 
#define WMATRIX(_ROW, _COL, _N, _R)   (W[(_COL) * (_N) + (_ROW)])
 
#define IDX_WMATRIX(_ROW, _COL, _N, _R)   ((_COL) * (_N) + (_ROW))
 
#define SW(_R, _C)   (sw[(_C)][(_R)])
 
#define SVH(_R, _C)   svh[(_R)][(_C)]
 
#define SH(_R, _C)   sh[(_C)][(_R)]
 
#define SVW(_R, _C)   svw[(_R)][(_C)]
 
#define HMATRIX(_ROW, _COL, _R, _M)   (H[(_COL) * (_R) + (_ROW)])
 
#define WMATRIX(_ROW, _COL, _N, _R)   (W[(_COL) * (_N) + (_ROW)])
 
#define SW(_R, _C)   (sw[(_C)][(_R)])
 
#define SVH(_R, _C)   svh[(_R)][(_C)]
 
#define SH(_R, _C)   sh[(_C)][(_R)]
 
#define SVW(_R, _C)   svw[(_R)][(_C)]
 
#define SMALL_VALUE_TO_ADD_DENOMINATOR   (CUDA_VALUE(10e-9))
 Small value added to the denominator of a fraction to prevent division by zero.
 
#define BLOCK_SIZE_NMF   (16)
 
#define BLOCK_MULTIPLIER_NMF   (2)
 

Functions

KERNEL UpdateW_AD (cudafloat *W, cudafloat *H, cudafloat *V, cudafloat *WH, cudafloat *sumH, int n, int m, int r)
 
KERNEL UpdateH_AD (cudafloat *H, cudafloat *W, cudafloat *V, cudafloat *WH, cudafloat *sumW, int n, int m, int r)
 
KERNEL UpdateMatrix_AE (cudafloat *X, cudafloat *deltaX1, cudafloat *deltaX2, int elements)
 
KERNEL UpdateMatrix_ME (cudafloat *nm, cudafloat *dm, cudafloat *m, int elements)
 
template<int blockSize>
KERNEL SumW (cudafloat *W, int n, cudafloat *sumW)
 
void KernelSumW (int blockSize, cudafloat *W, int n, int r, cudafloat *sumW)
 
template<int blockSize>
KERNEL SumH (cudafloat *H, int m, cudafloat *sumH)
 
void KernelSumH (int blockSize, cudafloat *H, int r, int m, cudafloat *sumH)
 
KERNEL UpdateW_MD (cudafloat *W, cudafloat *H, cudafloat *V, cudafloat *WH, cudafloat *sumH, int n, int m, int r)
 
KERNEL UpdateH_MD (cudafloat *H, cudafloat *W, cudafloat *V, cudafloat *WH, cudafloat *sumW, int n, int m, int r)
 
void KernelNMFquality (int blockSize, cudafloat *V, cudafloat *WH, int n, cudafloat *quality)
 
template<int blockSize>
KERNEL NMFquality (cudafloat *V, cudafloat *WH, int n, cudafloat *quality)
 

Detailed Description

Function Documentation

void KernelNMFquality ( int  blockSize,
cudafloat V,
cudafloat WH,
int  n,
cudafloat quality 
)

Kernel used to determine the quality improvement (regarding the approximation obtained) caused by the previous iteration

Parameters
[in]blockSizeBlock size
[in]Vmatrix V
[in]WHWH (approximation of the V matix) matrix
[in]nnumber of elements of the matrix V (and WH)
[out]qualityQuality improvement
See also
QualityImprovement

Definition at line 72 of file NMFquality.cu.

void KernelSumH ( int  blockSize,
cudafloat H,
int  r,
int  m,
cudafloat sumH 
)

Calculates the sums of all columns for each row of H and places the results in a array. Used by the NMF_MultiplicativeDivergence class.

Parameters
[in]blockSizeNumber of threads per block. Must be a multiple of 2 and can not exceed the maximum number of threads per block.
[in]HMatrix H.
[in]rnumber of H rows.
[in]mnumber of H columns.
[out]sumHwill contain the sums of the columns for each row.
See also
NMF_MultiplicativeDivergence

Definition at line 198 of file NMFkernels.cu.

void KernelSumW ( int  blockSize,
cudafloat W,
int  n,
int  r,
cudafloat sumW 
)

Calculates the sums of all rows for each column of W and places the results in a array. Used by the NMF_MultiplicativeDivergence class.

Parameters
[in]blockSizeNumber of threads per block. Must be a multiple of 2 and can not exceed the maximum number of threads per block.
[in]WMatrix W.
[in]nnumber of W rows.
[in]rnumber of W columns.
[out]sumWwill contain the sums of the rows for each column.
See also
NMF_MultiplicativeDivergence

Definition at line 110 of file NMFkernels.cu.

KERNEL UpdateH_AD ( cudafloat H,
cudafloat W,
cudafloat V,
cudafloat WH,
cudafloat sumW,
int  n,
int  m,
int  r 
)

Updates the matrix H. Used by the NMF_AdditiveDivergence class.

Parameters
[in,out]HMatrix H.
[in]WMatrix W.
[in]VMatrix V.
[in]WHWH matrix approximation (of V).
[in]sumWsums of the rows for each column.
[in]nnumber of rows of V.
[in]mnumber of columns of V.
[in]rnumber of rows of H (and columns of W).
See also
KernelSumW, NMF_AdditiveDivergence

Definition at line 125 of file NMFadditiveDivergenceKernels.cu.

KERNEL UpdateH_MD ( cudafloat H,
cudafloat W,
cudafloat V,
cudafloat WH,
cudafloat sumW,
int  n,
int  m,
int  r 
)

Updates the matrix H. Used by the NMF_MultiplicativeDivergence class.

Parameters
[in,out]HMatrix H.
[in]WMatrix W.
[in]VMatrix V.
[in]WHWH matrix approximation (of V).
[in]sumWsums of the rows for each column.
[in]nnumber of rows of V.
[in]mnumber of columns of V.
[in]rnumber of rows of H (and columns of W).
See also
KernelSumW, NMF_MultiplicativeDivergence

Definition at line 298 of file NMFkernels.cu.

KERNEL UpdateMatrix_ME ( cudafloat nm,
cudafloat dm,
cudafloat m,
int  elements 
)

Kernel used by the NMF_MultiplicativeEuclidianDistance class to update matrices W and H

Parameters
[in]nmnumerator matrix
[in]dmdenominator matrix
[in,out]mmatrix being updated
[in]elementsnumber of elements (rows * columns) of the matrices
See also
NMF_MultiplicativeEuclidianDistance

Definition at line 42 of file NMFkernels.cu.

KERNEL UpdateW_AD ( cudafloat W,
cudafloat H,
cudafloat V,
cudafloat WH,
cudafloat sumH,
int  n,
int  m,
int  r 
)

Updates the matrix W. Used by the NMF_AdditiveDivergence class.

Parameters
[in,out]WMatrix W.
[in]HMatrix H.
[in]VMatrix V.
[in]WHWH matrix approximation (of V).
[in]sumHsums of the columns for each row.
[in]nnumber of rows of V.
[in]mnumber of columns of V.
[in]rnumber of columns of W (and rows of H).
See also
KernelSumH, NMF_AdditiveDivergence

Definition at line 56 of file NMFadditiveDivergenceKernels.cu.

KERNEL UpdateW_MD ( cudafloat W,
cudafloat H,
cudafloat V,
cudafloat WH,
cudafloat sumH,
int  n,
int  m,
int  r 
)

Updates the matrix W. Used by the NMF_MultiplicativeDivergence class.

Parameters
[in,out]WMatrix W.
[in]HMatrix H.
[in]VMatrix V.
[in]WHWH matrix approximation (of V).
[in]sumHsums of the columns for each row.
[in]nnumber of rows of V.
[in]mnumber of columns of V.
[in]rnumber of columns of W (and rows of H).
See also
KernelSumH, NMF_MultiplicativeDivergence

Definition at line 250 of file NMFkernels.cu.