summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/c/fMdivide.c
blob: 671e7d17f5bd36ebd167439e68a16bc95b54450a (plain) (blame)
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
/********************************
Author: Sravanthi Kota Venkata
********************************/

#include "sdvbs_common.h"

F2D* fMdivide(F2D* a, F2D* b)
{
    F2D *c;
    int i, j, rows, cols;

    rows = a->height;
    cols = a->width;

    if(rows != b->height || cols != b->width)
    {
        printf("fMDivide Mismatch = \nrows: %d\t%d\ncols: %d\t%d\n", rows, b->height, cols, b->width);
        return NULL;
    }

    c = fMallocHandle(rows, cols);
    
    for(i=0; i<(rows*cols); i++)
        asubsref(c,i) = asubsref(a,i) / asubsref(b,i);

    return c;
}