diff options
Diffstat (limited to 'SD-VBS/benchmarks/localization/src/c/mcl.c')
| -rw-r--r-- | SD-VBS/benchmarks/localization/src/c/mcl.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/localization/src/c/mcl.c b/SD-VBS/benchmarks/localization/src/c/mcl.c new file mode 100644 index 0000000..a3c56b6 --- /dev/null +++ b/SD-VBS/benchmarks/localization/src/c/mcl.c | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | #include <stdlib.h> | ||
| 7 | #include "localization.h" | ||
| 8 | |||
| 9 | F2D* mcl(F2D* x, F2D* sData, F2D* invConv) | ||
| 10 | { | ||
| 11 | int i, j; | ||
| 12 | F2D *retW, *retX, *sum; | ||
| 13 | float sumVal; | ||
| 14 | |||
| 15 | retX = fDeepCopy(x); | ||
| 16 | retW = get3DGaussianProb(retX, sData, invConv); | ||
| 17 | sum = fSum(retW); | ||
| 18 | if(sum->height == 1 && sum->width ==1) | ||
| 19 | { | ||
| 20 | sumVal = asubsref(sum,0); | ||
| 21 | for(i=0; i<retW->height; i++) | ||
| 22 | for(j=0; j<retW->width; j++) | ||
| 23 | subsref(retW,i,j) = subsref(retW,i,j)/sumVal; | ||
| 24 | } | ||
| 25 | else | ||
| 26 | retW = fMdivide(retW, sum); | ||
| 27 | |||
| 28 | fFreeHandle(retX); | ||
| 29 | fFreeHandle(sum); | ||
| 30 | |||
| 31 | return retW; | ||
| 32 | } | ||
| 33 | |||
| 34 | |||
