From d17b33131c14864bd1eae275f49a3f148e21cf29 Mon Sep 17 00:00:00 2001 From: Leo Chan Date: Thu, 22 Oct 2020 01:53:21 -0400 Subject: Squashed commit of the sb-vbs branch. 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. --- .../common/toolbox/toolbox_basic/stella/showncut.m | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 SD-VBS/common/toolbox/toolbox_basic/stella/showncut.m (limited to 'SD-VBS/common/toolbox/toolbox_basic/stella/showncut.m') diff --git a/SD-VBS/common/toolbox/toolbox_basic/stella/showncut.m b/SD-VBS/common/toolbox/toolbox_basic/stella/showncut.m new file mode 100755 index 0000000..b1fe1f4 --- /dev/null +++ b/SD-VBS/common/toolbox/toolbox_basic/stella/showncut.m @@ -0,0 +1,92 @@ +% function [g,lgd,v,s,dd] = showncut(fn,rec_num) +% Input: +% fn = file / image name +% rec_num = Ncut record number +% Output: +% g = a cell contains 1D, 2D and 3D embeddings +% lgd = legend for g +% v = eigenvectors +% s = eigenvalues +% dd = normalization matrix = 1/sqrt(rowsum(abs(a))) +% an image is displayed + +function [g,lgd,v,s,dd] = showncut(fn,rec_num) + +globalenvar; cd(IMAGE_DIR);cd(fn); feval([fn,'_par']);cd(HOME_DIR); +par = p(rec_num); +no_rep = (par.offset<1e-6); + +[v,s,dd] = firstncut(fn,rec_num); +[m,n,nc] = size(v); + +% generate images for display +nr = 5; +num_plots = nc * nr; +g = cell(num_plots,1); +lgd = g; +names = {'r','\theta','\phi'}; +x = cell(3,1); +for j=1:nc, + g{j} = v(:,:,j); + lgd{j} = sprintf('%s_{%d} = %1.2f','\lambda', j+no_rep, s(j)); + + if j