From f618466c25d43f3bae9e40920273bf77de1e1149 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Mon, 19 Oct 2020 23:09:30 -0400 Subject: initial sd-vbs initial sd-vbs add sd-vbs sd-vbs --- .../benchmarks/texture_synthesis/src/matlab/factorial.m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/factorial.m (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/factorial.m') diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/factorial.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/factorial.m new file mode 100755 index 0000000..9255f43 --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/matlab/factorial.m @@ -0,0 +1,16 @@ +%% RES = factorial(NUM) +% +% Factorial function that works on matrices (matlab's does not). + +% EPS, 11/02 + +function res = factorial(num) + +res = ones(size(num)); + +ind = find(num > 0); +if ( ~isempty(ind) ) + subNum = num(ind); + res(ind) = subNum .* factorial(subNum-1); +end + -- cgit v1.2.2