1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/********************************
Author: Sravanthi Kota Venkata
********************************/
#include "sdvbs_common.h"
F2D* fSum2(F2D* inMat, int dir)
{
F2D *outMat;
int rows, cols, i, j, k;
float temp;
int newRow, newCols;
rows = inMat->height;
cols = inMat->width;
if(dir == 1)
{
newRow = 1;
newCols = cols;
}
else
{
newRow = rows;
newCols = 1;
}
outMat = fSetArray(newRow,newCols,0);
if(dir == 1)
{
for (i=0; i<cols; i++)
{
temp = 0;
for( j=0; j<rows; j++)
temp = temp + subsref(inMat,j,i);
asubsref(outMat,i) = temp;
}
}
else
{
for( i=0; i<rows; i++)
{
temp = 0;
for( j=0; j<cols; j++)
temp = temp + subsref(inMat,i,j);
subsref(outMat,i,0) = temp;
}
}
return outMat;
}
|