summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/c/fCopy.c
Commit message (Collapse)AuthorAge
* Squashed commit of the sb-vbs branch.Leo Chan2020-10-22
Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT.
j@live.unc.edu> 2020-10-22 01:53:21 -0400 committer Joshua Bakita <jbakita@cs.unc.edu> 2020-10-22 01:56:35 -0400 Squashed commit of the sb-vbs branch.' href='/cgit/cgit.cgi/mc2-scripts-and-benchmarks.git/commit/SD-VBS/benchmarks/localization/src/c/get3DGaussianProb.c?h=rtas22&id=d17b33131c14864bd1eae275f49a3f148e21cf29'>d17b331
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
















































                                                     
/********************************
Author: Sravanthi Kota Venkata
********************************/

#include <stdio.h>
#include <stdlib.h>
#include "localization.h"

F2D* get3DGaussianProb( F2D* data, F2D* mean, F2D* A)
{
    F2D *p, *diff, *temp1, *temp2, *mt;
    float temp;
    int n_data, n_channel;
    int i, j, k;
    F2D* t;
    float pi = 3.1412;

    n_data = data->height;
    n_channel = data->width;

    t = fSetArray(n_data, 1, 1);

    mt = fMtimes(t, mean); 
    diff = fMinus( data, mt);
    p = fSetArray(diff->height, 1, 0);

    temp = sqrt(1.0/(pow(2*pi, n_channel)));
    temp2 = randWrapper(diff->height,1);

    j = (temp2->height*temp2->width);
    for(i=0; i<j; i++)
    {
        float temp2i;
        temp2i = asubsref(temp2,i);

        temp2i = exp(-0.5*temp2i);
        asubsref(p,i) = temp2i*temp;
    }

    fFreeHandle(t);
    fFreeHandle(temp2);
    fFreeHandle(mt);
    fFreeHandle(diff);
    
    return p;
}