diff options
author | leochanj105 <leochanj@live.unc.edu> | 2020-10-19 23:09:30 -0400 |
---|---|---|
committer | leochanj105 <leochanj@live.unc.edu> | 2020-10-20 02:40:39 -0400 |
commit | f618466c25d43f3bae9e40920273bf77de1e1149 (patch) | |
tree | 460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/benchmarks/localization/src/matlab/weightedSample.m | |
parent | 47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff) |
initial sd-vbs
initial sd-vbs
add sd-vbs
sd-vbs
Diffstat (limited to 'SD-VBS/benchmarks/localization/src/matlab/weightedSample.m')
-rw-r--r-- | SD-VBS/benchmarks/localization/src/matlab/weightedSample.m | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/localization/src/matlab/weightedSample.m b/SD-VBS/benchmarks/localization/src/matlab/weightedSample.m new file mode 100644 index 0000000..dc9274b --- /dev/null +++ b/SD-VBS/benchmarks/localization/src/matlab/weightedSample.m | |||
@@ -0,0 +1,20 @@ | |||
1 | %function x_gen_id=weightedSample(w) | ||
2 | function bin=weightedSample(w) | ||
3 | n=size(w,1); | ||
4 | seed=randWrapper(n,1); | ||
5 | bin = zeros(n,1); | ||
6 | %x_gen_id=zeros(n,1); | ||
7 | for i=1:n | ||
8 | for j=1:n | ||
9 | if(seed(j,1) > 0) | ||
10 | bin(j,1) = bin(j,1) + 1; | ||
11 | % x_gen_id(j,1) = x_gen_id(j,1) + bin(j,1); | ||
12 | end | ||
13 | end | ||
14 | % bin = (seed>0); | ||
15 | % x_gen_id=x_gen_id+bin; | ||
16 | seed=seed-w(i,1); | ||
17 | end | ||
18 | % x_gen_id = bin; | ||
19 | %x_gen=x(:,x_gen_id); | ||
20 | |||