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 --- SD-VBS/benchmarks/texture_synthesis/src/matlab/shift.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/shift.m (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/shift.m') diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/shift.m b/SD-VBS/benchmarks/texture_synthesis/src/matlab/shift.m new file mode 100755 index 0000000..497297e --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/matlab/shift.m @@ -0,0 +1,15 @@ +% [RES] = shift(MTX, OFFSET) +% +% Circular shift 2D matrix samples by OFFSET (a [Y,X] 2-vector), +% such that RES(POS) = MTX(POS-OFFSET). + +function res = shift(mtx, offset) + +dims = size(mtx); + +offset = mod(-offset,dims); + +res = [ mtx(offset(1)+1:dims(1), offset(2)+1:dims(2)), ... + mtx(offset(1)+1:dims(1), 1:offset(2)); ... + mtx(1:offset(1), offset(2)+1:dims(2)), ... + mtx(1:offset(1), 1:offset(2)) ]; -- cgit v1.2.2