NnmfPack  2.1
bdiv_cpu.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2014 by PIR (University of Oviedo) and *
3  * INCO2 (Polytechnic University of Valencia) groups. *
4  * nnmfpack@gmail.com *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 2 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20  ***************************************************************************
21 */
32 #ifndef BDIV_CPU_H
33 #define BDIV_CPU_H
34 
35 #include <utils_x86.h>
36 #include "mlsa_cpu.h"
37 
38 
39 
40 /* wrappers */
41 int dbdiv_cpu(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);
42 int sbdiv_cpu(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);
43 
44 /* inner functions */
45 /* general cases */
46 int dbdivg_cpu(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);
47 int sbdivg_cpu(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);
48 
49 
50 /* beta=1 */
51 int dbdivone_cpu(const int m, const int n, const int k, const double *A, double *W, double *H, const int uType, const int nIter);
52 int sbdivone_cpu(const int m, const int n, const int k, const float *A, float *W, float *H, const int uType, const int nIter);
53 
54 /* Utility functions*/
55 void dupdate1H_x86(const int n, const double *X, double *__restrict__ H);
56 void supdate1H_x86(const int n, const float *X, float *__restrict__ H);
57 
58 void dupdate1W_x86(const int m, const int n, const double *X, double *__restrict__ W);
59 void supdate1W_x86(const int m, const int n, const float *X, float *__restrict__ W);
60 
61 void dkernelH_x86(const int m, const int n, const double *L, const double *A, double *__restrict__ R, const double expo);
62 void skernelH_x86(const int m, const int n, const float *L, const float *A, float *__restrict__ R, const float expo);
63 
64 void dkernelW_x86(const int m, const int n, const double *L, const double *A, double *__restrict__ R, const double expo);
65 void skernelW_x86(const int m, const int n, const float *L, const float *A, float *__restrict__ R, const float expo);
66 
67 void dupdate2H_x86(const int m, const int n, const double *X, const double *B, double *__restrict__ H);
68 void supdate2H_x86(const int m, const int n, const float *X, const float *B, float *__restrict__ H);
69 
70 void dupdate2W_x86(const int m, const int n, const double *X, const double *B, double *__restrict__ W);
71 void supdate2W_x86(const int m, const int n, const float *X, const float *B, float *__restrict__ W);
72 
73 /* Error measurement functions */
74 void derrorbd0_x86(const int n, const double *x, double *__restrict__ y);
75 void serrorbd0_x86(const int n, const float *x, float *__restrict__ y);
76 void derrorbd1_x86(const int n, const double *x, double *__restrict__ y);
77 void serrorbd1_x86(const int n, const float *x, float *__restrict__ y);
78 void derrorbdg_x86(const int n, const double *x, double *__restrict__ y, const double beta);
79 void serrorbdg_x86(const int n, const float *x, float *__restrict__ y, const float beta);
80 double derrorbd_x86(const int m, const int n, const int k, const double *A, const double *W, const double *H, const double betadiv);
81 float serrorbd_x86(const int m, const int n, const int k, const float *A, const float *W, const float *H, const float betadiv);
82 
83 #endif
int sbdivg_cpu(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)
sbdivg_cpu performs NNMF using betadivergence for general case (beta <> 1 and 2) using simple precisi...
Definition: bdiv_cpu.c:313
void dupdate2W_x86(const int m, const int n, const double *X, const double *B, double *__restrict__ W)
This function performs double precision W(i)=W(i)*(B(i)/y(j))
Definition: bdiv_cpu.c:1503
void supdate2H_x86(const int m, const int n, const float *X, const float *B, float *__restrict__ H)
This function performs the simple H(i)=H(i)*(B(i)/y(j))
Definition: bdiv_cpu.c:1469
void skernelH_x86(const int m, const int n, const float *L, const float *A, float *__restrict__ R, const float expo)
This function computes simple precision R(i)=(L(i)^expo)*A[i] and R(i+m*n)=L[i]*(L(i)^expo) Note "exp...
Definition: bdiv_cpu.c:1160
void supdate1W_x86(const int m, const int n, const float *X, float *__restrict__ W)
This function computes double precision W[i]=W[i]*D[i]/E[i] where matrices D and E are stored in the ...
Definition: bdiv_cpu.c:1397
int sbdiv_cpu(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: bdiv_cpu.c:1089
void serrorbd0_x86(const int n, const float *x, float *__restrict__ y)
This function performs auxiliar simple precision operations when error is computed using betadivergen...
Definition: bdiv_cpu.c:1602
void derrorbd0_x86(const int n, const double *x, double *__restrict__ y)
This function performs auxiliar double precision operations when error is computed using betadivergen...
Definition: bdiv_cpu.c:1569
Header file for using utility modules from CPU/MIC source codes.
void dupdate1W_x86(const int m, const int n, const double *X, double *__restrict__ W)
Definition: bdiv_cpu.c:1359
void dupdate2H_x86(const int m, const int n, const double *X, const double *B, double *__restrict__ H)
This function computes double precision H(i)=H(i)*(B(i)/y(j))
Definition: bdiv_cpu.c:1435
double derrorbd_x86(const int m, const int n, const int k, const double *A, const double *W, const double *H, const double betadiv)
This function returns double precision error when error is computed using betadivergence error formul...
Definition: bdiv_cpu.c:1782
void derrorbdg_x86(const int n, const double *x, double *__restrict__ y, const double beta)
This function performs auxiliar double precision operations when error is computed using betadivergen...
Definition: bdiv_cpu.c:1702
void skernelW_x86(const int m, const int n, const float *L, const float *A, float *__restrict__ R, const float expo)
This function computes simple precision R(pos)=L(i)^expo)*A(i) and R(pos+m)=L(i)*(L(i)^expo) Note exp...
Definition: bdiv_cpu.c:1250
void dupdate1H_x86(const int n, const double *X, double *__restrict__ H)
This function computes double precision H(i)=H(i)*B(i)/C(i) where matrices B and C are stored in the ...
Definition: bdiv_cpu.c:1293
void supdate2W_x86(const int m, const int n, const float *X, const float *B, float *__restrict__ W)
This function computes simple precision W(i)=W(i)*(B(i)/y(j))
Definition: bdiv_cpu.c:1537
int dbdivone_cpu(const int m, const int n, const int k, const double *A, double *W, double *H, const int uType, const int nIter)
dbdivone_cpu performs NNMF using beta-divergence when beta=1, using double precision ...
Definition: bdiv_cpu.c:566
float serrorbd_x86(const int m, const int n, const int k, const float *A, const float *W, const float *H, const float betadiv)
This function returns simple precision error when error is computed using betadivergence error formul...
Definition: bdiv_cpu.c:1849
void serrorbd1_x86(const int n, const float *x, float *__restrict__ y)
This function performs auxiliar simple precision operations when error is computed using betadivergen...
Definition: bdiv_cpu.c:1668
void serrorbdg_x86(const int n, const float *x, float *__restrict__ y, const float beta)
This function performs auxiliar simple precision operations when error is computed using betadivergen...
Definition: bdiv_cpu.c:1741
File with functions to calcule NNMF using the mlsa algorithm for CPUs.
void dkernelW_x86(const int m, const int n, const double *L, const double *A, double *__restrict__ R, const double expo)
This function computes double precision R(pos)=L(i)^expo)*A(i) and R(pos+m)=L(i)*(L(i)^expo) Note exp...
Definition: bdiv_cpu.c:1204
int dbdivg_cpu(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)
dbdivg_cpu performs the NNMF using beta-divergence when beta is != 1 and !=2, using double precision...
Definition: bdiv_cpu.c:87
void dkernelH_x86(const int m, const int n, const double *L, const double *A, double *__restrict__ R, const double expo)
Definition: bdiv_cpu.c:1116
void supdate1H_x86(const int n, const float *X, float *__restrict__ H)
This function computes simple precision H(i)=H(i)*B(i)/C(i) where matrices B and C are stored in the ...
Definition: bdiv_cpu.c:1325
int dbdiv_cpu(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_cpu is a wrapper that calls the adequate function to performs NNMF using betadivergence using d...
Definition: bdiv_cpu.c:1059
void derrorbd1_x86(const int n, const double *x, double *__restrict__ y)
This function performs auxiliar double precision operations when error is computed using betadivergen...
Definition: bdiv_cpu.c:1635
int sbdivone_cpu(const int m, const int n, const int k, const float *A, float *W, float *H, const int uType, const int nIter)
sbdivone_cpu performs NNMF using betadivergence when beta=1 using simple precision ...
Definition: bdiv_cpu.c:813