/usr/share/freemat/toolbox/array/circshift.m is in freemat-data 4.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | % CIRCSHIFT CIRCSHIFT Circularly Shift an Array
%
% Usage
%
% Applies a circular shift along each dimension of a given array. The
% syntax for its use is
%
% y = circshift(x,shiftvec)
%
% where x is an n-dimensional array, and shiftvec is a vector of
% integers, each of which specify how much to shift x along the
% corresponding dimension.
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function x = circshift(y,shiftvec)
szey = size(y);
ndim = prod(size(szey));
shiftvec = shiftvec(:);
shiftlen = prod(size(shiftvec));
d = {};
for k=1:ndim
if (k<=shiftlen)
shift = shiftvec(k);
else
shift = 0;
end
d{k} = mod((1:szey(k)) - 1 - shift,szey(k)) + 1;
end;
x = y(d{:});
|