|
NnmfPack
2.1
|
File with functions to calcule NNMF using betadivergence methods with Intel Xeon Phi (MIC) More...
Go to the source code of this file.
Functions | |
| int | dbdivg_mic (const int m, const int n, const int k, const double *A, double *W, double *H, const double expo, const int uType, const int nIter) |
| dbdivg_mic performs the NNMF using beta-divergence when beta is != 1 and !=2, using double precision More... | |
| int | sbdivg_mic (const int m, const int n, const int k, const float *A, float *W, float *H, const float expo, const int uType, const int nIter) |
| sbdivg_mic performs NNMF using betadivergence for general case (beta <> 1 and 2) using simple precision More... | |
| int | dbdivone_mic (const int m, const int n, const int k, const double *A, double *W, double *H, const int uType, const int nIter) |
| dbdivone_mic performs NNMF using betadivergence when beta=1 using double precision More... | |
| int | sbdivone_mic (const int m, const int n, const int k, const float *A, float *W, float *H, const int uType, const int nIter) |
| sbdivone_mic performs NNMF using betadivergence when beta=1 using simple precision More... | |
| int | dbdiv_mic (const int m, const int n, const int k, const double *A, double *W, double *H, const double beta, const int uType, const int nIter) |
| dbdiv_mic is a wrapper that calls the adequate function to performs NNMF using betadivergence using double precision with MIC More... | |
| int | sbdiv_mic (const int m, const int n, const int k, const float *A, float *W, float *H, const float beta, const int uType, const int nIter) |
File with functions to calcule NNMF using betadivergence methods with Intel Xeon Phi (MIC)
Definition in file bdiv_mic.c.
| int dbdiv_mic | ( | const int | m, |
| const int | n, | ||
| const int | k, | ||
| const double * | A, | ||
| double * | W, | ||
| double * | H, | ||
| const double | beta, | ||
| const int | uType, | ||
| const int | nIter | ||
| ) |
dbdiv_mic is a wrapper that calls the adequate function to performs NNMF using betadivergence using double precision with MIC
| m | (input) Number of rows of matrix A and matrix W |
| n | (input) Number of columns of matrix A and matrix H |
| k | (input) Number of columns of matrix W and rows of H |
| A | (input) Double precision input matrix of (m * n) number of elements stored using 1D column-major |
| W | (inout) Double precision input/output matrix of (m * k) number of elements stored using 1D column-major |
| H | (inout) Double precision input/output matrix of (k * n) number of elements stored using 1D column-major |
| beta | (input) Double precision value. The parameter beta of betadivergence method |
| uType | (input) It can be UpdateAll (W and H are updated), UpdateW (only H is updated) or UpdateH (only W is updated) |
| nIter | (input) Number of iterations |
Definition at line 274 of file bdiv_mic.c.
| int dbdivg_mic | ( | const int | m, |
| const int | n, | ||
| const int | k, | ||
| const double * | A, | ||
| double * | W, | ||
| double * | H, | ||
| const double | expo, | ||
| const int | uType, | ||
| const int | nIter | ||
| ) |
dbdivg_mic performs the NNMF using beta-divergence when beta is != 1 and !=2, using double precision
The algorithm is
repit nIter times
STEP 1
L=W*H
L1=L(.^)(beta-2)
L2=L1(.*)A
L1=L1(.*)L
B=W'L2
C=W'*L1
H=H(.)B(./)C
STEP 2
L=W*H
L1=L(.^)(beta-2)
L2=L1(.*)A
L1=L1(.*)L
D=L2*H'
E=L1*H'
W=W(.*)D(./)E
end repit
End algorithm
In real live L1 and L2 are (m*n) matrices used in STEP 1 and 2. For performance reasons only one 1D colum-mayor buffer, named R in next code, of size 2*m*n is used In STEP 1, first part of R (m*n positions) is L2 and the second part is L1. In STEP 2, fisrt column of R (2*m positions) is composed by the first column of L2 following first column of L1. Second column of R (2*m positions) is composed by the sencond column of L2 following second column of L1. 3rd column of R ... and so on In real live B and C are (k*n) matrices used in STEP 1, and D and E are (m*k) matrices used in STEP 2. B/C and D/E are independent. However we do not have L1 and L2, we have R, and we can do B=W'*L2 and C=W'*L1 (or D=L2*H' and E=L1*H') at the same time. For this reason only one matrix is declared to save space. This is matrix M with size 2*max(m,n)*k
| m | (input) Number of rows of matrix A and matrix W |
| n | (input) Number of columns of matrix A and matrix H |
| k | (input) Number of columns of matrix W and rows of H |
| A | (input) Double precision input matrix of (m * n) number of elements stored using 1D column-major |
| W | (inout) Double precision input/output matrix of (m * k) number of elements stored using 1D column-major |
| H | (inout) Double precision input/output matrix of (k * n) number of elements stored using 1D column-major |
| expo | (input) Double precision value. The exponent beta of betadivergence method |
| uType | (input) It can be UpdateAll (W and H are updated), UpdateW (only H is updated) or UpdateH (only W is updated) |
| nIter | (input) Number of iterations |
It returns 0 if all is OK.
Definition at line 88 of file bdiv_mic.c.
| int dbdivone_mic | ( | const int | m, |
| const int | n, | ||
| const int | k, | ||
| const double * | A, | ||
| double * | W, | ||
| double * | H, | ||
| const int | uType, | ||
| const int | nIter | ||
| ) |
dbdivone_mic performs NNMF using betadivergence when beta=1 using double precision
The algorithm is
repit nIter times
STEP 1
y(i)=sum(W(j,i) for all j in range) for all i in range
L=W*H
L=A(./)L
B=W'L
B(i,j)=B(i,j) / y(i) for all B elements
H=H(.)B
STEP 2
y(i)=sum(H(i,j) for all j in range) for all i in range
L=W*H
L=A(./)L
D=L*H'
B(i,j)=B(i,j) / y(j) for all B elements
W=W(.*)D
end repit
End algorithm
In real live B is a (k*n) matrix used in STEP 1, and D is a (m*k) matrix used in STEP 2. B and D are independent. For this reason only 1 matrix of size max(m,n)*k is declared/used
| m | (input) Number of rows of matrix A and matrix W |
| n | (input) Number of columns of matrix A and matrix H |
| k | (input) Number of columns of matrix W and rows of H |
| A | (input) Double precision input matrix of (m * n) number of elements stored using 1D column-major |
| W | (inout) Double precision input/output matrix of (m * k) number of elements stored using 1D column-major |
| H | (inout) Double precision input/output matrix of (k * n) number of elements stored using 1D column-major |
| uType | (input) It can be UpdateAll (W and H are updated), UpdateW (only H is updated) or UpdateH (only W is updated) |
| nIter | (input) Number of iterations |
Definition at line 195 of file bdiv_mic.c.
| int sbdiv_mic | ( | const int | m, |
| const int | n, | ||
| const int | k, | ||
| const float * | A, | ||
| float * | W, | ||
| float * | H, | ||
| const float | beta, | ||
| const int | uType, | ||
| const int | nIter | ||
| ) |
Definition at line 304 of file bdiv_mic.c.
| int sbdivg_mic | ( | const int | m, |
| const int | n, | ||
| const int | k, | ||
| const float * | A, | ||
| float * | W, | ||
| float * | H, | ||
| const float | expo, | ||
| const int | uType, | ||
| const int | nIter | ||
| ) |
sbdivg_mic performs NNMF using betadivergence for general case (beta <> 1 and 2) using simple precision
| m | (input) Number of rows of matrix A and matrix W |
| n | (input) Number of columns of matrix A and matrix H |
| k | (input) Number of columns of matrix W and rows of H |
| A | (input) Simple precision input matrix of (m * n) number of elements stored using 1D column-major |
| W | (inout) Simple precision input/output matrix of (m * k) number of elements stored using 1D column-major |
| H | (inout) Simple precision input/output matrix of (k * n) number of elements stored using 1D column-major |
| expo | (input) Double precision value. The exponent beta of betadivergence method |
| uType | (input) It can be UpdateAll (W and H are updated), UpdateW (only H is updated) or UpdateH (only W is updated) |
| nIter | (input) Number of iterations |
Definition at line 128 of file bdiv_mic.c.
| int sbdivone_mic | ( | const int | m, |
| const int | n, | ||
| const int | k, | ||
| const float * | A, | ||
| float * | W, | ||
| float * | H, | ||
| const int | uType, | ||
| const int | nIter | ||
| ) |
sbdivone_mic performs NNMF using betadivergence when beta=1 using simple precision
| m | (input) Number of rows of matrix A and matrix W |
| n | (input) Number of columns of matrix A and matrix H |
| k | (input) Number of columns of matrix W and rows of H |
| A | (input) Simple precision input matrix of (m * n) number of elements stored using 1D column-major |
| W | (inout) Simple precision input/output matrix of (m * k) number of elements stored using 1D column-major |
| H | (inout) Simple precision input/output matrix of (k * n) number of elements stored using 1D column-major |
| uType | (input) It can be UpdateAll (W and H are updated), UpdateW (only H is updated) or UpdateH (only W is updated) |
| nIter | (input) Number of iterations |
Definition at line 234 of file bdiv_mic.c.
1.8.15