diff options
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c')
-rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c deleted file mode 100755 index 8fa1224..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | /* | ||
2 | RES = innerProd(MAT); | ||
3 | Computes mat'*mat | ||
4 | Odelia Schwartz, 8/97. | ||
5 | */ | ||
6 | |||
7 | #define V4_COMPAT | ||
8 | #include <matrix.h> | ||
9 | |||
10 | #include <stdio.h> | ||
11 | #include <ctype.h> | ||
12 | #include <math.h> | ||
13 | #include <strings.h> | ||
14 | #include <stdlib.h> | ||
15 | |||
16 | void mexFunction(int nlhs, /* Num return vals on lhs */ | ||
17 | mxArray *plhs[], /* Matrices on lhs */ | ||
18 | int nrhs, /* Num args on rhs */ | ||
19 | const mxArray *prhs[] /* Matrices on rhs */ | ||
20 | ) | ||
21 | { | ||
22 | register double *res, *mat, tmp; | ||
23 | register int len, wid, i, k, j, jlen, ilen, imat, jmat; | ||
24 | mxArray *arg; | ||
25 | |||
26 | /* get matrix input argument */ | ||
27 | /* should be matrix in which num rows >= num columns */ | ||
28 | arg=prhs[0]; | ||
29 | mat= mxGetPr(arg); | ||
30 | len = (int) mxGetM(arg); | ||
31 | wid = (int) mxGetN(arg); | ||
32 | if ( wid > len ) | ||
33 | printf("innerProd: Warning: width %d is greater than length %d.\n",wid,len); | ||
34 | plhs[0] = (mxArray *) mxCreateDoubleMatrix(wid,wid,mxREAL); | ||
35 | if (plhs[0] == NULL) | ||
36 | mexErrMsgTxt(sprintf("Error allocating %dx%d result matrix",wid,wid)); | ||
37 | res = mxGetPr(plhs[0]); | ||
38 | |||
39 | for(i=0, ilen=0; i<wid; i++, ilen+=len) | ||
40 | { | ||
41 | for(j=i, jlen=ilen; j<wid; j++, jlen+=len) | ||
42 | { | ||
43 | tmp = 0.0; | ||
44 | for(k=0, imat=ilen, jmat=jlen; k<len; k++, imat++, jmat++) | ||
45 | tmp += mat[imat]*mat[jmat]; | ||
46 | res[i*wid+j] = tmp; | ||
47 | res[j*wid+i] = tmp; | ||
48 | } | ||
49 | } | ||
50 | return; | ||
51 | |||
52 | } | ||