summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/localization
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/localization')
-rw-r--r--SD-VBS/benchmarks/localization/Makefile3
-rw-r--r--SD-VBS/benchmarks/localization/data/Makefile3
-rw-r--r--SD-VBS/benchmarks/localization/data/qcif/1.txt89
-rw-r--r--SD-VBS/benchmarks/localization/data/qcif/Makefile8
-rw-r--r--SD-VBS/benchmarks/localization/data/qcif/expected.m3
-rw-r--r--SD-VBS/benchmarks/localization/data/qcif/expected_C.txt3
-rwxr-xr-xSD-VBS/benchmarks/localization/result/log1_whist.txtbin228 -> 0 bytes
-rw-r--r--SD-VBS/benchmarks/localization/src/c/eul2quat.c50
-rw-r--r--SD-VBS/benchmarks/localization/src/c/generateSample.c88
-rw-r--r--SD-VBS/benchmarks/localization/src/c/get3DGaussianProb.c49
-rw-r--r--SD-VBS/benchmarks/localization/src/c/input.txt8
-rw-r--r--SD-VBS/benchmarks/localization/src/c/localization.h24
-rw-r--r--SD-VBS/benchmarks/localization/src/c/mcl.c34
-rw-r--r--SD-VBS/benchmarks/localization/src/c/quat2eul.c47
-rw-r--r--SD-VBS/benchmarks/localization/src/c/quatConj.c32
-rw-r--r--SD-VBS/benchmarks/localization/src/c/quatMul.c55
-rw-r--r--SD-VBS/benchmarks/localization/src/c/quatRot.c47
-rw-r--r--SD-VBS/benchmarks/localization/src/c/readSensorData.c63
-rw-r--r--SD-VBS/benchmarks/localization/src/c/script_localization.c525
-rw-r--r--SD-VBS/benchmarks/localization/src/c/weightedSample.c37
20 files changed, 0 insertions, 1168 deletions
diff --git a/SD-VBS/benchmarks/localization/Makefile b/SD-VBS/benchmarks/localization/Makefile
deleted file mode 100644
index 60cc0ec..0000000
--- a/SD-VBS/benchmarks/localization/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
1include ../../common/makefiles/Makefile.include
2include $(MAKEFILE_COMMON_DIR)/Makefile.recurse
3
diff --git a/SD-VBS/benchmarks/localization/data/Makefile b/SD-VBS/benchmarks/localization/data/Makefile
deleted file mode 100644
index ba33d35..0000000
--- a/SD-VBS/benchmarks/localization/data/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
1include ../../../common/makefiles/Makefile.include
2include $(MAKEFILE_COMMON_DIR)/Makefile.recurse
3
diff --git a/SD-VBS/benchmarks/localization/data/qcif/1.txt b/SD-VBS/benchmarks/localization/data/qcif/1.txt
deleted file mode 100644
index 45e0aa5..0000000
--- a/SD-VBS/benchmarks/localization/data/qcif/1.txt
+++ /dev/null
@@ -1,89 +0,0 @@
15 88
21116844391.040066 4 4422626.016689 483672.632936 33.995049
3-0.000663 -0.000692 0.021303 9.463761 21.130848
41116844391.227129 3 -0.093291 0.256632 9.634049
51116844391.227129 2 0.010578 -0.007365 -0.001416
61116844391.227168 1 -0.000000 0.000000 0.000000
71116844391.237148 3 -0.096652 0.272799 9.624180
81116844391.237148 2 0.015798 -0.008073 -0.007254
91116844391.247181 3 -0.090515 0.261556 9.615353
101116844391.247181 2 0.002099 0.000225 -0.007616
111116844391.257148 3 -0.085976 0.240636 9.597824
121116844391.257148 2 0.012628 0.005128 0.006299
131116844391.267143 3 -0.104367 0.255003 9.615442
141116844391.267143 2 0.017556 0.011023 -0.006589
151116844391.277133 3 -0.112190 0.274331 9.618944
161116844391.277133 2 0.025863 -0.013523 -0.002331
171116844391.277173 1 -0.000000 0.000000 0.000000
181116844391.287135 3 -0.093472 0.250217 9.618351
191116844391.287135 2 0.024307 0.015800 -0.008811
201116844391.297185 3 -0.094906 0.259862 9.630996
211116844391.297185 2 0.002086 0.020161 0.005693
221116844391.307142 3 -0.107477 0.275957 9.625149
231116844391.307142 2 0.007412 -0.007638 0.003438
241116844391.317280 3 -0.087117 0.266351 9.638790
251116844391.317280 2 0.007944 0.002905 0.009063
261116844391.327142 3 -0.083806 0.232450 9.635920
271116844391.327142 2 -0.002186 -0.007303 -0.002470
281116844391.327195 1 -0.000000 0.000000 0.000000
291116844391.337139 3 -0.088611 0.256652 9.637110
301116844391.337139 2 0.018712 -0.009002 0.000068
311116844391.347169 3 -0.119894 0.283955 9.625427
321116844391.347169 2 0.008961 -0.020078 -0.005236
331116844391.357151 3 -0.093643 0.245413 9.604237
341116844391.357151 2 -0.007274 0.004253 0.003544
351116844391.367134 3 -0.109132 0.242096 9.599711
361116844391.367134 2 0.010254 -0.001354 -0.007168
371116844391.377130 3 -0.098272 0.261513 9.613113
381116844391.377130 2 0.024695 0.003973 -0.010004
391116844391.377335 1 -0.000000 0.000000 0.000000
401116844391.387136 3 -0.085493 0.242148 9.631398
411116844391.387136 2 0.018667 -0.014620 -0.001184
421116844391.397172 3 -0.080866 0.230888 9.624932
431116844391.397172 2 0.001064 0.020162 0.005671
441116844391.407155 3 -0.087562 0.255152 9.602736
451116844391.407155 2 0.007214 0.007715 -0.002903
461116844391.417139 3 -0.098358 0.247013 9.599640
471116844391.417139 2 0.020322 -0.001303 0.001078
481116844391.427133 3 -0.085717 0.229291 9.609365
491116844391.427133 2 0.016397 -0.004758 0.016558
501116844391.427175 1 -0.000000 0.000000 0.000000
511116844391.437139 3 -0.079424 0.253503 9.629919
521116844391.437139 2 0.000389 0.000235 0.001411
531116844391.447169 3 -0.102437 0.243642 9.635546
541116844391.447169 2 0.024045 -0.007895 -0.010443
551116844391.457145 3 -0.105676 0.245266 9.626246
561116844391.457145 2 0.007637 0.005470 0.000232
571116844391.467146 3 -0.079413 0.230918 9.618670
581116844391.467146 2 0.002375 -0.000431 0.004049
591116844391.477142 3 -0.096475 0.263084 9.631063
601116844391.477142 2 0.009385 0.006065 -0.010352
611116844391.487134 3 -0.112058 0.287208 9.634735
621116844391.487134 2 0.002942 0.005215 0.004793
631116844391.497175 3 -0.082458 0.235728 9.624242
641116844391.497175 2 0.012165 -0.002726 -0.001159
651116844391.507136 3 -0.104136 0.254955 9.631047
661116844391.507136 2 0.011057 0.000532 0.005265
671116844391.517304 3 -0.114911 0.251651 9.631923
681116844391.517304 2 0.012523 0.006833 0.012757
691116844391.527140 3 -0.088748 0.253455 9.626140
701116844391.527140 2 0.013050 -0.005606 0.004062
711116844391.527211 1 -0.000000 0.000000 0.000000
721116844391.537137 3 -0.089157 0.264831 9.604456
731116844391.537137 2 0.019766 -0.004421 0.001349
741116844391.547164 3 -0.104299 0.258215 9.621731
751116844391.547164 2 0.017782 0.017719 0.012267
761116844391.557149 3 -0.104582 0.272792 9.610237
771116844391.557149 2 0.009933 -0.004741 0.007095
781116844391.567137 3 -0.104419 0.267919 9.618750
791116844391.567137 2 0.015320 -0.009478 -0.009842
801116844391.577132 3 -0.112248 0.274343 9.615043
811116844391.577132 2 0.014851 -0.011780 0.012695
821116844391.577349 1 -0.000000 0.000000 0.000000
831116844391.587134 3 -0.099579 0.271132 9.634340
841116844391.587134 2 0.004095 0.005577 -0.001659
851116844391.597172 3 -0.096420 0.267911 9.637374
861116844391.597172 2 0.013570 -0.000091 0.007137
871116844391.607140 3 -0.122865 0.253262 9.617223
881116844391.607140 2 0.007069 0.009807 0.005882
891116844391.617132 3 -0.094853 0.245334 9.626884
diff --git a/SD-VBS/benchmarks/localization/data/qcif/Makefile b/SD-VBS/benchmarks/localization/data/qcif/Makefile
deleted file mode 100644
index d18c02d..0000000
--- a/SD-VBS/benchmarks/localization/data/qcif/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
1include ../../../../common/makefiles/Makefile.include
2
3BMARK=localization
4INPUT=qcif
5
6include $(MAKEFILE_COMMON_DIR)/Makefile.common
7
8
diff --git a/SD-VBS/benchmarks/localization/data/qcif/expected.m b/SD-VBS/benchmarks/localization/data/qcif/expected.m
deleted file mode 100644
index 4263b3d..0000000
--- a/SD-VBS/benchmarks/localization/data/qcif/expected.m
+++ /dev/null
@@ -1,3 +0,0 @@
1631.976450 516.498284 -197.996728 663.497659 -22.288426 -28.903321 647.817138 -351.955521 -312.433355 44.896667 -150.353868 -67.000702 -370.502974 26.299828 -488.261017 -321.672753 -20.467725 -293.286835 -85.465502 -243.718793 -74.565859 -549.266195 30.999329 -160.813808 -121.355881 -483.242401 -79.323855 -151.906467 -595.771606 12.823360 -12.448671 -172.470587 -511.488467 -21.514722 42.089059 -185.300910 -324.317055 89.756283 -187.135260 -628.505815 29.732164 124.069805 -182.587245 -367.573870 -76.374400 148.479017 -172.587616 -145.562423 167.983942 -157.609772 -529.296685 21.322336 179.630194 -137.981888 -185.584066 -112.106506 185.662406 -114.184459 25.859838 -163.799486 189.409619 -87.299860 149.829422 -166.716356 189.327882 -58.163997 221.918824 -144.524825 183.798380 253.096143 -116.072162 284.431081 -110.520707 261.347591 -74.376768 318.351401 -83.847971 256.673574 -30.452642 285.051087 232.480691 6.336376 352.034688 -65.985798 202.705055 47.633804 382.774465 0.000000
274.359725 55442.431887 55442.431887 916.112559 85048.747743 85048.747743 57211.398438 57211.398438 105779.314664 105779.314664 87600.029083 87600.029083 121512.447801 121512.447801 52860.067135 133141.106400 133141.106400 94517.909665 94517.909665 143946.045181 143946.045181 117118.457039 117118.457039 153064.488091 153064.488091 77359.640694 160318.887671 160318.887671 115674.880954 115674.880954 167827.918882 167827.918882 135968.435504 135968.435504 174698.161121 174698.161121 94713.555770 180133.542229 180133.542229 131871.515823 131871.515823 186165.689411 186165.689411 151252.883116 151252.883116 191909.078626 191909.078626 109392.213684 196358.978485 196358.978485 146078.668403 146078.668403 201651.395781 201651.395781 165046.805127 165046.805127 206711.131954 206711.131954 178320.376082 178320.376082 211596.482547 211596.482547 188947.507546 188947.507546 216497.738288 216497.738288 197921.386091 197921.386091 165985.571620 205091.855127 205091.855127 196779.521358 196779.521358 212609.207639 212609.207639 211533.666997 211533.666997 219561.468379 219561.468379 166056.319552 225227.570848 225227.570848 200047.795792 200047.795792 231596.764178 231596.764178 216995.904046 0.000000
32453723755.101060 2473138738.478060 2473138738.478060 2453633812.224546 2466744375.113051 2466744375.113051 2453912441.757200 2453912441.757200 2463514723.222767 2463514723.222767 2454091490.868995 2454091490.868995 2461535850.721794 2461535850.721794 2453959313.433379 2460231345.559122 2460231345.559122 2454218817.973337 2454218817.973337 2459307064.549955 2459307064.549955 2454389996.064240 2454389996.064240 2458639118.655468 2458639118.655468 2454254726.669796 2458128486.626955 2458128486.626955 2454513520.017527 2454513520.017527 2457726299.581051 2457726299.581051 2454684774.597973 2454684774.597973 2457410967.437045 2457410967.437045 2454549597.959815 2457150540.743558 2457150540.743558 2454807555.250977 2454807555.250977 2456916627.143601 2456916627.143601 2454977251.488404 2454977251.488404 2456719675.377667 2456719675.377667 2454837557.911356 2456573728.470717 2456573728.470717 2455086906.118260 2455086906.118260 2456453336.049111 2456453336.049111 2455239927.219034 2455239927.219034 2456371158.832802 2456371158.832802 2455342631.649824 2455342631.649824 2456355762.744594 2456355762.744594 2455396094.462677 2455396094.462677 2456381099.252142 2456381099.252142 2455441691.541200 2455441691.541200 2456128146.863575 2455477781.414840 2455477781.414840 2456282488.340037 2456282488.340037 2455516633.096739 2455516633.096739 2456357066.451140 2456357066.451140 2455552537.419121 2455552537.419121 2456129670.296010 2455581213.884797 2455581213.884797 2456300055.909151 2456300055.909151 2455615007.049098 2455615007.049098 2456385531.538922 0.000000
diff --git a/SD-VBS/benchmarks/localization/data/qcif/expected_C.txt b/SD-VBS/benchmarks/localization/data/qcif/expected_C.txt
deleted file mode 100644
index e511c1f..0000000
--- a/SD-VBS/benchmarks/localization/data/qcif/expected_C.txt
+++ /dev/null
@@ -1,3 +0,0 @@
1631.976685 516.497070 -197.996780 663.498474 -22.288383 -28.903017 647.817627 -351.955444 -312.433563 44.896759 -150.352570 -67.000694 -370.501801 26.299685 -488.263245 -321.673676 -20.467754 -293.287750 -85.465439 -243.718719 -74.565903 -549.264099 30.999359 -160.812958 -121.356056 -483.237793 -79.321159 -151.906555 -595.768494 12.823376 -12.449110 -172.470673 -511.491058 -21.514660 42.089039 -185.300903 -324.315338 89.754517 -187.135193 -628.505798 29.732241 124.067482 -182.587418 -367.575897 -76.374428 148.479248 -172.587677 -145.559784 167.983521 -157.609528 -529.298279 21.322149 179.629654 -137.981812 -185.582245 -112.106697 185.663269 -114.184387 25.861784 -163.799500 189.411011 -87.299828 149.829376 -166.716431 189.328384 -58.164036 221.919037 -144.524857 183.798859 253.097870 -116.072098 284.431763 -110.520599 261.346863 -74.376396 318.351013 -83.847771 256.671356 -30.452496 285.051758 232.481445 6.336341 352.032623 -65.985649 202.703217 47.633900 382.778015 382.778015
274.359306 55442.425781 55442.425781 916.098450 85048.742188 85048.742188 57211.437500 57211.437500 105779.367188 105779.367188 87600.015625 87600.015625 121512.453125 121512.453125 52859.875000 133141.109375 133141.109375 94517.937500 94517.937500 143946.046875 143946.046875 117118.484375 117118.484375 153064.421875 153064.421875 77359.625000 160318.890625 160318.890625 115674.929688 115674.929688 167828.000000 167828.000000 135968.515625 135968.515625 174698.140625 174698.140625 94713.718750 180133.609375 180133.609375 131871.437500 131871.437500 186165.781250 186165.781250 151252.812500 151252.812500 191909.125000 191909.125000 109392.984375 196359.140625 196359.140625 146078.609375 146078.609375 201651.437500 201651.437500 165046.718750 165046.718750 206711.156250 206711.156250 178320.406250 178320.406250 211596.515625 211596.515625 188947.546875 188947.546875 216497.656250 216497.656250 197921.375000 197921.375000 165984.234375 205091.906250 205091.906250 196779.640625 196779.640625 212609.140625 212609.140625 211533.718750 211533.718750 219561.359375 219561.359375 166056.312500 225227.546875 225227.546875 200047.734375 200047.734375 231596.734375 231596.734375 216995.796875 216995.796875
32453704192.000000 2473137664.000000 2473137664.000000 2453603584.000000 2466751232.000000 2466751232.000000 2453914880.000000 2453914880.000000 2463516928.000000 2463516928.000000 2454079232.000000 2454079232.000000 2461551360.000000 2461551360.000000 2453976064.000000 2460228608.000000 2460228608.000000 2454217472.000000 2454217472.000000 2459319552.000000 2459319552.000000 2454396672.000000 2454396672.000000 2458622720.000000 2458622720.000000 2454242048.000000 2458117376.000000 2458117376.000000 2454516224.000000 2454516224.000000 2457734144.000000 2457734144.000000 2454672640.000000 2454672640.000000 2457424640.000000 2457424640.000000 2454540288.000000 2457167872.000000 2457167872.000000 2454803712.000000 2454803712.000000 2456922112.000000 2456922112.000000 2454974720.000000 2454974720.000000 2456722944.000000 2456722944.000000 2454825472.000000 2456564992.000000 2456564992.000000 2455102976.000000 2455102976.000000 2456450304.000000 2456450304.000000 2455238912.000000 2455238912.000000 2456363776.000000 2456363776.000000 2455336192.000000 2455336192.000000 2456359680.000000 2456359680.000000 2455387648.000000 2455387648.000000 2456377088.000000 2456377088.000000 2455433728.000000 2455433728.000000 2456112128.000000 2455470336.000000 2455470336.000000 2456286464.000000 2456286464.000000 2455517952.000000 2455517952.000000 2456360960.000000 2456360960.000000 2455565056.000000 2455565056.000000 2456129536.000000 2455589120.000000 2455589120.000000 2456304128.000000 2456304128.000000 2455619840.000000 2455619840.000000 2456390144.000000 2456390144.000000
diff --git a/SD-VBS/benchmarks/localization/result/log1_whist.txt b/SD-VBS/benchmarks/localization/result/log1_whist.txt
deleted file mode 100755
index 7ab4e16..0000000
--- a/SD-VBS/benchmarks/localization/result/log1_whist.txt
+++ /dev/null
Binary files differ
diff --git a/SD-VBS/benchmarks/localization/src/c/eul2quat.c b/SD-VBS/benchmarks/localization/src/c/eul2quat.c
deleted file mode 100644
index bea75cf..0000000
--- a/SD-VBS/benchmarks/localization/src/c/eul2quat.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* eul2quat(F2D* angle)
10{
11 F2D *ret;
12 F2D *x, *y, *z;
13 int k, i, j;
14 int rows, cols;
15
16 rows = angle->height;
17 cols = angle->width;
18
19 x = fDeepCopyRange(angle, 0, angle->height, 0, 1);
20 y = fDeepCopyRange(angle, 0, angle->height, 1, 1);
21 z = fDeepCopyRange(angle, 0, angle->height, 2, 1);
22
23 ret = fSetArray(x->height, 4, 0);
24
25 for(i=0; i<rows; i++)
26 {
27 float xi, yi, zi;
28 k = 0;
29 xi = asubsref(x,i);
30 yi = asubsref(y,i);
31 zi = asubsref(z,i);
32
33 subsref(ret,i,k) = cos(xi/2)*cos(yi/2)*cos(zi/2)+sin(xi/2)*sin(yi/2)*sin(zi/2);
34 k++;
35 subsref(ret,i,k) = sin(xi/2)*cos(yi/2)*cos(zi/2)-cos(xi/2)*sin(yi/2)*sin(zi/2);
36 k++;
37 subsref(ret,i,k) = cos(xi/2)*sin(yi/2)*cos(zi/2)+sin(xi/2)*cos(yi/2)*sin(zi/2);
38 k++;
39 subsref(ret,i,k) = cos(xi/2)*cos(yi/2)*sin(zi/2)-sin(xi/2)*sin(yi/2)*cos(zi/2);
40 }
41
42 fFreeHandle(x);
43 fFreeHandle(y);
44 fFreeHandle(z);
45
46 return ret;
47}
48
49
50
diff --git a/SD-VBS/benchmarks/localization/src/c/generateSample.c b/SD-VBS/benchmarks/localization/src/c/generateSample.c
deleted file mode 100644
index 3acb4d7..0000000
--- a/SD-VBS/benchmarks/localization/src/c/generateSample.c
+++ /dev/null
@@ -1,88 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9void generateSample(F2D *w, F2D *quat, F2D *vel, F2D *pos)
10{
11 int rows, cols, i, j, index;
12 I2D *sampleXId;
13 F2D *retQuat, *retVel, *retPos;
14
15 sampleXId = weightedSample(w);
16
17 rows = sampleXId->height;
18 cols = sampleXId->width;
19
20 if(cols > 1)
21 printf("ERROR: Cols more than 1.. Handle this case \n");
22
23 retQuat = fSetArray(quat->height, quat->width, 0);
24 retVel = fSetArray(vel->height, vel->width, 0);
25 retPos = fSetArray(pos->height, pos->width, 0);
26
27 for(i=0; i<rows; i++)
28 {
29 index = asubsref(sampleXId, i) - 1;
30 for(j=0; j<quat->width; j++)
31 {
32 subsref(retQuat,i,j) = subsref(quat,index,j);
33 }
34 }
35
36 for(i=0; i<rows; i++)
37 {
38 index = asubsref(sampleXId, i) - 1;
39 for(j=0; j<vel->width; j++)
40 {
41 subsref(retVel,i,j) = subsref(vel,index,j);
42 }
43 }
44
45 for(i=0; i<rows; i++)
46 {
47 index = asubsref(sampleXId, i) - 1;
48 for(j=0; j<pos->width; j++)
49 {
50 subsref(retPos,i,j) = subsref(pos,index,j);
51 }
52 }
53
54 for(i=0; i<quat->height; i++)
55 {
56 for(j=0; j<quat->width; j++)
57 {
58 subsref(quat,i,j) = subsref(retQuat,i,j);
59 }
60 }
61
62 for(i=0; i<vel->height; i++)
63 {
64 for(j=0; j<vel->width; j++)
65 {
66 subsref(vel,i,j) = subsref(retVel,i,j);
67 }
68 }
69
70 for(i=0; i<pos->height; i++)
71 {
72 for(j=0; j<pos->width; j++)
73 {
74 subsref(pos,i,j) = subsref(retPos,i,j);
75 }
76 }
77
78 fFreeHandle(retQuat);
79 fFreeHandle(retVel);
80 fFreeHandle(retPos);
81 iFreeHandle(sampleXId);
82
83 return;
84}
85
86
87
88
diff --git a/SD-VBS/benchmarks/localization/src/c/get3DGaussianProb.c b/SD-VBS/benchmarks/localization/src/c/get3DGaussianProb.c
deleted file mode 100644
index 58c4475..0000000
--- a/SD-VBS/benchmarks/localization/src/c/get3DGaussianProb.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* get3DGaussianProb( F2D* data, F2D* mean, F2D* A)
10{
11 F2D *p, *diff, *temp1, *temp2, *mt;
12 float temp;
13 int n_data, n_channel;
14 int i, j, k;
15 F2D* t;
16 float pi = 3.1412;
17
18 n_data = data->height;
19 n_channel = data->width;
20
21 t = fSetArray(n_data, 1, 1);
22
23 mt = fMtimes(t, mean);
24 diff = fMinus( data, mt);
25 p = fSetArray(diff->height, 1, 0);
26
27 temp = sqrt(1.0/(pow(2*pi, n_channel)));
28 temp2 = randWrapper(diff->height,1);
29
30 j = (temp2->height*temp2->width);
31 for(i=0; i<j; i++)
32 {
33 float temp2i;
34 temp2i = asubsref(temp2,i);
35
36 temp2i = exp(-0.5*temp2i);
37 asubsref(p,i) = temp2i*temp;
38 }
39
40 fFreeHandle(t);
41 fFreeHandle(temp2);
42 fFreeHandle(mt);
43 fFreeHandle(diff);
44
45 return p;
46}
47
48
49
diff --git a/SD-VBS/benchmarks/localization/src/c/input.txt b/SD-VBS/benchmarks/localization/src/c/input.txt
deleted file mode 100644
index dd6d1cf..0000000
--- a/SD-VBS/benchmarks/localization/src/c/input.txt
+++ /dev/null
@@ -1,8 +0,0 @@
15 6
211168.4 3 -0.098 0.247 9.59
311168.175 1 -0.000000 0.000000 0.000000
411168.04 4 4422.01 4836.36 33.99
5-0.0006 -0.0007 0.021 9.463 21.130
611168.4 3 -0.098 0.247 9.59
711168.4 3 -0.098 0.247 9.59
8
diff --git a/SD-VBS/benchmarks/localization/src/c/localization.h b/SD-VBS/benchmarks/localization/src/c/localization.h
deleted file mode 100644
index b2c03bb..0000000
--- a/SD-VBS/benchmarks/localization/src/c/localization.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#ifndef _LOCALIZATION_
6#define _LOCALIZATION_
7
8#include "sdvbs_common.h"
9
10int script_localization();
11F2D* eul2quat(F2D* angle);
12void generateSample(F2D *w, F2D *quat, F2D *vel, F2D *pos);
13F2D* get3DGaussianProb( F2D* data, F2D* mean, F2D* A);
14F2D* mcl(F2D* x, F2D* sData, F2D* invConv);
15F2D* quat2eul(F2D* quat);
16F2D* quatConj(F2D* a);
17F2D* quatMul(F2D* a, F2D* b);
18F2D* quatRot(F2D* vec, F2D* rQuat);
19F2D* readSensorData(I2D* index, F2D* fid, I2D* type, I2D* eof);
20I2D* weightedSample(F2D* w);
21
22#endif
23
24
diff --git a/SD-VBS/benchmarks/localization/src/c/mcl.c b/SD-VBS/benchmarks/localization/src/c/mcl.c
deleted file mode 100644
index a3c56b6..0000000
--- a/SD-VBS/benchmarks/localization/src/c/mcl.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* 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
diff --git a/SD-VBS/benchmarks/localization/src/c/quat2eul.c b/SD-VBS/benchmarks/localization/src/c/quat2eul.c
deleted file mode 100644
index bc581c9..0000000
--- a/SD-VBS/benchmarks/localization/src/c/quat2eul.c
+++ /dev/null
@@ -1,47 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8#include <math.h>
9
10F2D* quat2eul(F2D* quat)
11{
12 F2D *retEul;
13 int i, j, k;
14 int rows, cols;
15
16 rows = quat->height;
17 cols = quat->width;
18
19 retEul = fSetArray(rows, 3, 0);
20
21 for(i=0; i<rows; i++)
22 {
23 float temp, temp1, temp2, temp3, temp4;
24 float quati2, quati3, quati1, quati0;
25
26 quati0 = subsref(quat,i,0);
27 quati1 = subsref(quat,i,1);
28 quati2 = subsref(quat,i,2);
29 quati3 = subsref(quat,i,3);
30
31 temp = 2 *quati2 * quati3 + quati0 * quati1;
32 temp1 = pow(quati0,2) - pow(quati1,2) - pow(quati2,2) + pow(quati3,2);
33 temp2 = -2*quati1 * quati2 + quati0 * quati3;
34 temp3 = 2*quati1 * quati2 + quati0 * quati3;
35 temp4 = pow(quati0,2) + pow(quati1,2) - pow(quati2,2) - pow(quati3,2);
36
37 asubsref(retEul,k++) = atan2(temp, temp1);
38 asubsref(retEul,k++) = asin(temp2);
39 asubsref(retEul,k++) = atan2(temp3, temp4);
40 }
41
42 return retEul;
43}
44
45
46
47
diff --git a/SD-VBS/benchmarks/localization/src/c/quatConj.c b/SD-VBS/benchmarks/localization/src/c/quatConj.c
deleted file mode 100644
index 6607186..0000000
--- a/SD-VBS/benchmarks/localization/src/c/quatConj.c
+++ /dev/null
@@ -1,32 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* quatConj(F2D* a)
10{
11 F2D* retQuat;
12 int rows, cols;
13 int i, j, k;
14
15 rows = a->height;
16 cols = a->width;
17 retQuat = fSetArray(rows, 4, 0);
18
19 for(i=0; i<rows; i++)
20 {
21 k=0;
22 subsref(retQuat,i,k++) = subsref(a,i,0);
23 subsref(retQuat,i,k++) = -subsref(a,i,1);
24 subsref(retQuat,i,k++) = -subsref(a,i,2);
25 subsref(retQuat,i,k) = -subsref(a,i,3);
26 }
27
28 return retQuat;
29}
30
31
32
diff --git a/SD-VBS/benchmarks/localization/src/c/quatMul.c b/SD-VBS/benchmarks/localization/src/c/quatMul.c
deleted file mode 100644
index 8b8dafe..0000000
--- a/SD-VBS/benchmarks/localization/src/c/quatMul.c
+++ /dev/null
@@ -1,55 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* quatMul(F2D* a, F2D* b)
10{
11 int ra, ca, rb, cb;
12 F2D *ret;
13 int i, j, k=0;
14
15 ra = a->height;
16 ca = a->width;
17
18 rb = b->height;
19 cb = b->width;
20
21 ret = fSetArray(ra, 4, 0);
22
23 j = 0;
24 for(i=0; i<ra; i++)
25 {
26 k = 0;
27 float ai0, ai1, ai2, ai3;
28 float bj0, bj1, bj2, bj3;
29
30 ai0 = subsref(a,i,0);
31 ai1 = subsref(a,i,1);
32 ai2 = subsref(a,i,2);
33 ai3 = subsref(a,i,3);
34
35 bj0 = subsref(b,j,0);
36 bj1 = subsref(b,j,1);
37 bj2 = subsref(b,j,2);
38 bj3 = subsref(b,j,3);
39
40 subsref(ret,i,k++) = ai0*bj0 - ai1*bj1 - ai2*bj2 - ai3*bj3;
41 subsref(ret,i,k++) = ai0*bj1 + ai1*bj0 + ai2*bj3 - ai3*bj2;
42 subsref(ret,i,k++) = ai0*bj2 - ai1*bj3 + ai2*bj0 + ai3*bj1;
43 subsref(ret,i,k++) = ai0*bj3 + ai1*bj2 - ai2*bj1 + ai3*bj0;
44
45 if(rb == ra)
46 j++;
47 }
48
49 return ret;
50}
51
52
53
54
55
diff --git a/SD-VBS/benchmarks/localization/src/c/quatRot.c b/SD-VBS/benchmarks/localization/src/c/quatRot.c
deleted file mode 100644
index 4962b55..0000000
--- a/SD-VBS/benchmarks/localization/src/c/quatRot.c
+++ /dev/null
@@ -1,47 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* quatRot(F2D* vec, F2D* rQuat)
10{
11 F2D *ret;
12 int nr, i, j, k, rows, cols;
13 F2D *tv, *vQuat, *temp, *temp1;
14 F2D *retVec;
15
16 nr = vec->height;
17 tv = fSetArray(nr, 1, 0);
18 vQuat = fHorzcat(tv, vec);
19 temp = quatMul(rQuat, vQuat);
20 temp1 = quatConj(rQuat);
21 retVec = quatMul(temp, temp1);
22
23 rows = retVec->height;
24 cols = retVec->width;
25
26 ret = fSetArray(rows, 3, 0);
27
28 for(i=0; i<rows; i++)
29 {
30 k = 0;
31 for(j=1; j<4; j++)
32 {
33 subsref(ret,i,k) = subsref(retVec,i,j);
34 k++;
35 }
36 }
37
38 fFreeHandle(tv);
39 fFreeHandle(vQuat);
40 fFreeHandle(temp);
41 fFreeHandle(temp1);
42 fFreeHandle(retVec);
43
44 return ret;
45}
46
47
diff --git a/SD-VBS/benchmarks/localization/src/c/readSensorData.c b/SD-VBS/benchmarks/localization/src/c/readSensorData.c
deleted file mode 100644
index 12c0dc0..0000000
--- a/SD-VBS/benchmarks/localization/src/c/readSensorData.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include "localization.h"
8
9F2D* readSensorData(I2D* index, F2D* fid, I2D* type, I2D* eof)
10{
11 F2D *retData;
12 int rows, i, j, k;
13 int atype=-1, aindex;
14
15 aindex = asubsref(index, 0);
16
17 asubsref(index,0) = asubsref(index,0) + 1;
18 rows = fid->height;
19 asubsref(type,0) = 0;
20 retData = fSetArray(1, 8, 0);
21
22 if( asubsref(index,0) > (rows-1) )
23 asubsref(eof,0) = 1;
24 else
25 {
26 if( asubsref(index,0) == rows)
27 asubsref(eof,0) = 1;
28 else
29 asubsref(eof,0) = 0;
30
31 k = asubsref(index,0);
32 atype = subsref(fid, k, 1);
33 if( (atype == 1) || (atype == 2) || (atype == 3) )
34 {
35 for(i=0; i<3; i++)
36 {
37 asubsref(retData,i) = subsref(fid,k,(i+2));
38 }
39 }
40 if( atype == 4 )
41 {
42 for(i=0; i<3; i++)
43 {
44 asubsref(retData,i) = subsref(fid,k,(i+2));
45 }
46 for(i=3; i<8; i++)
47 {
48 asubsref(retData,i) = subsref(fid,k+1,(i-3));
49 }
50 aindex = aindex + 1;
51 }
52 aindex = aindex + 1;
53 }
54
55 asubsref(index,0) = aindex;
56 asubsref(type, 0) = atype;
57
58 return retData;
59}
60
61
62
63
diff --git a/SD-VBS/benchmarks/localization/src/c/script_localization.c b/SD-VBS/benchmarks/localization/src/c/script_localization.c
deleted file mode 100644
index ddd2215..0000000
--- a/SD-VBS/benchmarks/localization/src/c/script_localization.c
+++ /dev/null
@@ -1,525 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <malloc.h>
8#include "localization.h"
9#include "extra.h"
10#define LOCOLIZATION_MEM 1<<24
11int main(int argc, char* argv[])
12{
13 SET_UP
14 mallopt(M_TOP_PAD, LOCOLIZATION_MEM);
15 mallopt(M_MMAP_MAX, 0);
16 int n, i, j, k, icount=-1;
17 F2D* fid;
18 float gyroTimeInterval=0.01;
19 float acclTimeInterval=0.01;
20
21 float STDDEV_GPSVel=0.5;
22 float STDDEV_ODOVel=0.1;
23 float STDDEV_ACCL=1;
24 float M_STDDEV_GYRO=0.1;
25 float M_STDDEV_POS=0.1;
26 float M_STDDEV_VEL=0.02;
27
28 F2D *pos, *vel;
29 float pi = 3.1416;
30 F2D *eul1, *eul2, *quat;
31 F2D *sData, *gyro, *norm_gyro, *angleAlpha;
32 F2D *quatDelta, *Opos, *temp_STDDEV_GPSPos, *w;
33 F2D *qConj, *orgWorld, *accl, *gtemp;
34 F2D *gravity, *t1;
35 I2D *tStamp, *sType, *isEOF;
36 I2D *index;
37 int rows, cols;
38 F2D *resultMat;
39 F2D *STDDEV_GPSPos;
40 F2D *ones, *randW;
41
42 char im1[100];
43
44 scanf("%s", im1);
45
46 fid = readFile(im1);
47
48 n = 1000;
49
50 #ifdef test
51 n = 3;
52 gyroTimeInterval = 0.1;
53 acclTimeInterval = 0.1;
54 M_STDDEV_VEL = 0.2;
55 #endif
56 #ifdef sim_fast
57 n = 3;
58 #endif
59 #ifdef sim
60 n = 10;
61 #endif
62 #ifdef sqcif
63 n = 800;
64 #endif
65 #ifdef qcif
66 n = 500;
67 #endif
68 #ifdef vga
69 n = 2000;
70 #endif
71 #ifdef wuxga
72 n = 3000;
73 #endif
74
75 resultMat = fSetArray(3,fid->height, 0);
76
77 pos = fSetArray(n, 3, 0);
78 vel = fSetArray(n, 3, 0);
79 ones = fSetArray(n,1,1);
80
81
82 F2D *randn;
83
84 randn = randWrapper(n,3);
85 for_each_job {
86 fResetArray(pos,n, 3, 0);
87 fResetArray(vel,n, 3, 0);
88 fResetArray(ones,n,1,1);
89
90 {
91 int j;
92 for(i=0; i<n; i++)
93 for(j=0; j<3; j++)
94 subsref(vel, i, j) += subsref(randn,i,j) * STDDEV_ODOVel;
95
96 }
97
98
99
100 {
101 F2D *eulAngle, *randn;
102 eulAngle = fSetArray(n, 3, 0);
103 randn = randWrapper(n,1);
104
105 for(i=0; i<n; i++)
106 {
107 subsref(eulAngle, i, 2) = subsref(randn, i, 0) * 2 * pi;
108 }
109
110 eul1 = eul2quat(eulAngle);
111 fFreeHandle(eulAngle);
112
113 eulAngle = fSetArray(1, 3, 0);
114 subsref(eulAngle, 0, 0) = pi;
115 eul2 = eul2quat(eulAngle);
116
117 fFreeHandle(randn);
118 fFreeHandle(eulAngle);
119 }
120
121 quat = quatMul(eul1, eul2);
122 fFreeHandle(eul1);
123 fFreeHandle(eul2);
124
125 i=0;
126 index = iSetArray(1,1,-1);
127 sType = iSetArray(1,1,-1);
128 isEOF = iSetArray(1,1,-1);
129
130
131 rows =0;
132 cols = 5;
133 STDDEV_GPSPos = fSetArray(3,3,0);
134 randW = randnWrapper(n,3);
135 icount=-1;
136 while(1)
137 {
138 icount=icount+1;
139
140 /*
141 S = 4
142 A = 3
143 G = 2
144 V = 1
145 */
146
147 sData = readSensorData(index, fid, sType, isEOF);
148 rows++;
149
150
151
152 if( asubsref(sType,0) ==2)
153 {
154
155 //Motion model
156
157 {
158 int i;
159 F2D *t, *t1;
160 F2D *abc, *abcd;
161 int qD_r=0, qD_c=0;
162 F2D *cosA, *sinA;
163
164 t = fDeepCopyRange(sData, 0, 1, 0, 3);
165 gyro = fMtimes(ones, t);
166 abc = fMallocHandle(gyro->height, gyro->width);
167 t1 = fDeepCopy(randW);
168
169 for(i=0; i<(n*3); i++)
170 {
171 asubsref(t1,i) = asubsref(randW,i) * M_STDDEV_GYRO;
172 asubsref(gyro, i) += asubsref(t1,i);
173 asubsref(abc, i) = pow(asubsref(gyro, i), 2);
174 }
175 fFreeHandle(t1);
176 abcd = fSum2(abc, 2);
177
178 norm_gyro = fMallocHandle(abcd->height,abcd->width);
179 angleAlpha = fMallocHandle(abcd->height, abcd->width);
180
181 for(i=0; i<(abcd->height*abcd->width); i++)
182 {
183 asubsref(norm_gyro, i) = sqrt(asubsref(abcd,i));
184 asubsref(angleAlpha,i) = asubsref(norm_gyro,i) * gyroTimeInterval;
185 }
186
187 qD_r += angleAlpha->height + gyro->height;
188 qD_c += angleAlpha->width + 3;
189
190 fFreeHandle(t);
191 fFreeHandle(abcd);
192
193 cosA = fSetArray(angleAlpha->height, angleAlpha->width, 0);
194 sinA = fSetArray(angleAlpha->height, angleAlpha->width, 0);
195
196 for(i=0; i<(cosA->height*cosA->width); i++)
197 asubsref(cosA,i) = cos( asubsref(angleAlpha,i) /2 );
198
199 for(i=0; i<(sinA->height*sinA->width); i++)
200 asubsref(sinA,i) = sin( asubsref(angleAlpha,i) /2 );
201
202
203 fFreeHandle(abc);
204 abc = fSetArray(1,3,1);
205 t1 = fMtimes(norm_gyro, abc);
206 t = ffDivide(gyro, t1);
207 fFreeHandle(t1);
208
209 abcd = fMtimes(sinA, abc);
210 t1 = fTimes(t, abcd);
211 quatDelta = fHorzcat(cosA, t1);
212
213 fFreeHandle(abcd);
214 fFreeHandle(t);
215 fFreeHandle(t1);
216 fFreeHandle(abc);
217
218 t = quatMul(quat, quatDelta);
219 fFreeHandle(quat);
220 fFreeHandle(quatDelta);
221 quat = fDeepCopy(t);
222
223 fFreeHandle(t);
224 fFreeHandle(norm_gyro);
225 fFreeHandle(gyro);
226 fFreeHandle(angleAlpha);
227 fFreeHandle(cosA);
228 fFreeHandle(sinA);
229 }
230 }
231
232 if( asubsref(sType,0) ==4)
233 {
234 //Observation
235 float tempSum=0;
236 F2D *Ovel;
237 float OvelNorm;
238 int i;
239
240 asubsref(STDDEV_GPSPos, 0) = asubsref(sData, 6);
241 asubsref(STDDEV_GPSPos, 4) = asubsref(sData,7);
242 asubsref(STDDEV_GPSPos, 8) = 15;
243
244 Opos = fDeepCopyRange(sData, 0, 1, 0, 3);
245
246 //Initialize
247 for(i=0; i<(pos->height*pos->width); i++)
248 tempSum += asubsref(pos,i);
249
250 if(tempSum == 0)
251 {
252 F2D *t, *t1;
253 t = fMtimes( randW, STDDEV_GPSPos);
254 t1 = fMtimes(ones, Opos);
255
256 for(i=0; i<(pos->height*pos->width); i++)
257 asubsref(pos,i) = asubsref(t,i) + asubsref(t1,i);
258
259 fFreeHandle(t);
260 fFreeHandle(t1);
261 }
262 else
263 {
264 int rows, cols;
265 int mnrows, mncols;
266
267 rows = STDDEV_GPSPos->height;
268 cols = STDDEV_GPSPos->width;
269
270 temp_STDDEV_GPSPos = fSetArray(rows,cols,1);
271 for( mnrows=0; mnrows<rows; mnrows++)
272 {
273 for( mncols=0; mncols<cols; mncols++)
274 {
275 subsref(temp_STDDEV_GPSPos,mnrows,mncols) = pow(subsref(STDDEV_GPSPos,mnrows,mncols),-1);
276 }
277 }
278
279 w = mcl(pos, Opos , temp_STDDEV_GPSPos);
280 generateSample(w, quat, vel, pos);
281 }
282 fFreeHandle(Opos);
283
284 //compare direction
285 Ovel = fDeepCopyRange(sData, 0, 1, 3, 3);
286 OvelNorm=2;//1.1169e+09;
287
288 if (OvelNorm>0.5)
289 {
290 F2D *t;
291 t = fDeepCopy(Ovel);
292 fFreeHandle(Ovel);
293 /* This is a double precision division */
294 Ovel = fDivide(t, OvelNorm);
295 qConj = quatConj(quat);
296 fFreeHandle(t);
297
298 {
299 t = fSetArray(1,3,0);
300 subsref(t,0,0) = 1;
301 orgWorld = quatRot(t, qConj);
302 fFreeHandle(t);
303 fFreeHandle(qConj);
304 t = fSetArray(3,3,0);
305 asubsref(t,0) = 1;
306 asubsref(t,4) = 1;
307 asubsref(t,8) = 1;
308
309 {
310 int i;
311 for(i=0; i<(t->height*t->width); i++)
312 asubsref(t, i) = asubsref(t,i)/STDDEV_GPSVel;
313 w = mcl( orgWorld, Ovel, t);
314 generateSample(w, quat, vel, pos);
315 }
316
317 fFreeHandle(t);
318 fFreeHandle(w);
319 fFreeHandle(orgWorld);
320 }
321 }
322 fFreeHandle(Ovel);
323 }
324
325 if( asubsref(sType,0) ==1)
326 {
327 //Observation
328 F2D *Ovel;
329 F2D *t, *t1, *t2;
330 float valVel;
331
332 t = fSetArray(vel->height, 1, 0);
333
334 for(i=0; i<vel->height; i++)
335 {
336 subsref(t,i,0) = sqrt(pow(subsref(vel,i,0),2) + pow(subsref(vel,i,1),2) + pow(subsref(vel,i,2),2));
337 }
338
339 Ovel = fSetArray(1, 1, asubsref(sData,0));
340 valVel = 1.0/STDDEV_ODOVel;
341
342 t1 = fSetArray(1,1,(1.0/STDDEV_ODOVel));
343 w = mcl (t, Ovel, t1);
344 generateSample(w, quat, vel, pos);
345
346
347 fFreeHandle(w);
348 fFreeHandle(t);
349 fFreeHandle(t1);
350 fFreeHandle(Ovel);
351 }
352
353 if( asubsref(sType,0) ==3)
354 {
355 //Observation
356 F2D *t;
357 t = fSetArray(1, 3, 0);
358 asubsref(t,2) = -9.8;
359
360 accl = fDeepCopyRange(sData, 0, 1, 0, 3);
361 gtemp = fMtimes( ones, t);
362 gravity = quatRot(gtemp, quat);
363
364 fFreeHandle(gtemp);
365 fFreeHandle(t);
366 t = fSetArray(3,3,0);
367 asubsref(t,0) = 1;
368 asubsref(t,4) = 1;
369 asubsref(t,8) = 1;
370
371 {
372 int i;
373 for(i=0; i<(t->height*t->width); i++)
374 asubsref(t,i) = asubsref(t,i)/STDDEV_ACCL;
375 w = mcl( gravity, accl, t);
376 }
377
378 generateSample(w, quat, vel, pos);
379 fFreeHandle(t);
380 //Motion model
381 t = fMtimes(ones, accl);
382 fFreeHandle(accl);
383
384 accl = fMinus(t, gravity);
385
386 fFreeHandle(w);
387 fFreeHandle(gravity);
388 fFreeHandle(t);
389
390 {
391 //pos=pos+quatRot(vel,quatConj(quat))*acclTimeInterval+1/2*quatRot(accl,quatConj(quat))*acclTimeInterval^2+randn(n,3)*M_STDDEV_POS;
392
393 F2D *s, *is;
394 int i;
395 is = quatConj(quat);
396 s = quatRot(vel, is);
397 fFreeHandle(is);
398
399 for(i=0; i<(s->height*s->width); i++)
400 {
401 asubsref(s,i) = asubsref(s,i)*acclTimeInterval; //+(1/2);
402 }
403 is = fPlus(pos, s);
404 fFreeHandle(pos);
405 pos = fDeepCopy(is);
406 fFreeHandle(is);
407 fFreeHandle(s);
408
409 /** pos_ above stores: pos+quatRot(vel,quatConj(quat))*acclTimeInterval **/
410
411 is = quatConj(quat);
412 s = quatRot(accl, is);
413 t = fDeepCopy(s);
414 for(i=0; i<(s->height*s->width); i++)
415 {
416 asubsref(t,i) = 1/2*asubsref(s,i)*acclTimeInterval*acclTimeInterval;
417 }
418
419 /** t_ above stores: 1/2*quatRot(accl,quatCong(quat))*acclTimeInterval^2 **/
420
421 fFreeHandle(s);
422 fFreeHandle(is);
423 s = randnWrapper(n,3);
424
425 for(i=0; i<(s->height*s->width); i++)
426 {
427 asubsref(s,i) = asubsref(s,i) * M_STDDEV_POS;
428 }
429
430 /** s_ above stores: randn(n,3)*M_STDDEV_POS **/
431
432 is = fPlus(pos, t);
433 fFreeHandle(pos);
434 pos = fPlus(is, s);
435
436 fFreeHandle(s);
437 fFreeHandle(t);
438 fFreeHandle(is);
439
440 // vel=vel+accl*acclTimeInterval+randn(n,3)*M_STDDEV_VEL; %??
441
442 t = fDeepCopy(accl);
443 for(i=0; i<(accl->height*accl->width); i++)
444 asubsref(t,i) = asubsref(accl,i) * acclTimeInterval;
445
446 is = fPlus(vel, t);
447
448 fFreeHandle(accl);
449 fFreeHandle(t);
450 s = randnWrapper(n,3);
451 for(i=0; i<(s->height*s->width); i++)
452 {
453 asubsref(s,i) = asubsref(s,i) * M_STDDEV_VEL;
454 }
455
456 fFreeHandle(vel);
457 vel = fPlus(is, s);
458 fFreeHandle(is);
459 fFreeHandle(s);
460 }
461
462 }
463
464 // Self check
465 {
466 F2D* temp;
467 float quatOut=0, velOut=0, posOut=0;
468 int i;
469
470 for(i=0; i<(quat->height*quat->width); i++)
471 quatOut += asubsref(quat, i);
472
473 for(i=0; i<(vel->height*vel->width); i++)
474 velOut += asubsref(vel, i);
475
476 for(i=0; i<(pos->height*pos->width); i++)
477 posOut += asubsref(pos, i);
478
479 subsref(resultMat,0,icount) = quatOut;
480 subsref(resultMat,1,icount) = velOut;
481 subsref(resultMat,2,icount) = posOut;
482 }
483
484 fFreeHandle(sData);
485
486 if (asubsref(isEOF,0) == 1)
487 break;
488 }
489 fFreeHandle(STDDEV_GPSPos);
490 iFreeHandle(index);
491 iFreeHandle(sType);
492 iFreeHandle(isEOF);
493 fFreeHandle(quat);
494 fFreeHandle(randW);
495 }
496
497#ifdef CHECK
498
499 // Self checking - use expected.txt from data directory
500 {
501 int ret=0;
502 float tol = 2.0;
503#ifdef GENERATE_OUTPUT
504 fWriteMatrix(resultMat, argv[1]);
505#endif
506 ret = fSelfCheck(resultMat, "./expected_C.txt", tol);
507 if (ret == -1)
508 printf("Error in Localization\n");
509 }
510 // Self checking done
511#endif
512
513 fFreeHandle(fid);
514 fFreeHandle(resultMat);
515 fFreeHandle(pos);
516 fFreeHandle(vel);
517 fFreeHandle(ones);
518 fFreeHandle(randn);
519 WRITE_TO_FILE
520 return 0;
521
522}
523
524
525
diff --git a/SD-VBS/benchmarks/localization/src/c/weightedSample.c b/SD-VBS/benchmarks/localization/src/c/weightedSample.c
deleted file mode 100644
index 28099e8..0000000
--- a/SD-VBS/benchmarks/localization/src/c/weightedSample.c
+++ /dev/null
@@ -1,37 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <math.h>
8#include "localization.h"
9
10I2D* weightedSample(F2D* w)
11{
12 I2D *bin;
13 F2D *seed;
14 int n, i, j;
15
16 n = w->height;
17 seed = randWrapper(n, 1);
18 bin = iSetArray(n, 1, 0);
19
20 for(i=0; i<n; i++)
21 {
22 for(j=0; j<n; j++)
23 {
24 if(asubsref(seed,j) > 0)
25 asubsref(bin,j) = asubsref(bin,j) + 1;
26 }
27 for(j=0; j<n; j++)
28 asubsref(seed,j) = asubsref(seed,j) - asubsref(w,i);
29 }
30
31 free(seed);
32 return bin;
33}
34
35
36
37