NnmfPack  2.1
utils_x86.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 UTILSX86_H
33 #define UTILSX86_H
34 
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <math.h>
38 #include <assert.h>
39 
40 #ifdef With_OMP
41  #include <omp.h>
42 #endif
43 
44 #ifdef With_MKL
45  #include <mkl.h>
46 #else
47  #include <cblas.h>
48  #ifndef With_ARM
49  #include <mm_malloc.h>
50  #endif
51  extern void dlarnv_(int *, int *, int *, double *);
52  extern void slarnv_(int *, int *, int *, float *);
53 #endif
54 
55 #ifdef With_MIC
56  #define WRDLEN 64
57 #else
58  #define WRDLEN 32
59 #endif
60 
61 #define max(a,b) (((a)>(b ))?( a):(b))
62 #define min(a,b) (((a)<(b ))?( a):(b))
63 
64 void dmemset_x86(const int n, double *__restrict__ x, const double val);
65 void smemset_x86(const int n, float *__restrict__ x, const float val);
66 
67 void ddiv_x86(const int n, const double *x, double *__restrict__ y);
68 void sdiv_x86(const int n, const float *x, float *__restrict__ y);
69 
70 void dsub_x86(const int n, const double *x, double *__restrict__ y);
71 void ssub_x86(const int n, const float *x, float *__restrict__ y);
72 
73 void dlarngenn_x86(const int m, const int n, const int seed, double *X);
74 void slarngenn_x86(const int m, const int n, const int seed, float *X);
75 
76 double derror_x86(const int m, const int n, const int k, const double *A, const double *W, const double *H);
77 float serror_x86(const int m, const int n, const int k, const float *A, const float *W, const float *H);
78 
79 
80 #endif
void dlarnv_(int *, int *, int *, double *)
float serror_x86(const int m, const int n, const int k, const float *A, const float *W, const float *H)
serror_x86 returns simple precision "2norm(A - WH) / sqrt(m x n)"
Definition: utils_x86.c:329
void dsub_x86(const int n, const double *x, double *__restrict__ y)
This function performs double precision element-wise substraction y[i]=x[i]-y[i]. ...
Definition: utils_x86.c:162
void dmemset_x86(const int n, double *__restrict__ x, const double val)
This function fills all positions of x with val.
Definition: utils_x86.c:42
void ddiv_x86(const int n, const double *x, double *__restrict__ y)
This function calls the appropiate funtions to performs double precision element-wise y[i]=x[i]/y[i] ...
Definition: utils_x86.c:91
void smemset_x86(const int n, float *__restrict__ x, const float val)
This function fills all positions of x with val.
Definition: utils_x86.c:66
void sdiv_x86(const int n, const float *x, float *__restrict__ y)
This function calls the appropiate funtions to performs simple precision element-wise x[i]=x[i]/y[i] ...
Definition: utils_x86.c:127
void slarngenn_x86(const int m, const int n, const int seed, float *X)
slarngenn_x86 returns an (m x n) random simple precision matrix. An uniform (0, 1) distribution is us...
Definition: utils_x86.c:251
void slarnv_(int *, int *, int *, float *)
double derror_x86(const int m, const int n, const int k, const double *A, const double *W, const double *H)
derror_x86 returns double precision "2norm(A - WH) / sqrt(m x n)"
Definition: utils_x86.c:283
void dlarngenn_x86(const int m, const int n, const int seed, double *X)
dlarngenn_x86 returns an (m x n) random double precision matrix. An uniform (0, 1) distribution is us...
Definition: utils_x86.c:220
void ssub_x86(const int n, const float *x, float *__restrict__ y)
This function performs simple precision element-wise substraction y[i]=x[i]-y[i]. ...
Definition: utils_x86.c:190