/usr/share/freemat/toolbox/array/ipermute.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 | % IPERMUTE IPERMUTE Array Inverse Permutation Function
%
% Usage
%
% The ipermute function rearranges the contents of an array according
% to the inverse of the specified permutation vector. The syntx for
% its use is
%
% y = ipermute(x,p)
%
% where p is a permutation vector - i.e., a vector containing the
% integers 1...ndims(x) each occuring exactly once. The resulting
% array y contains the same data as the array x, but ordered
% according to the inverse of the given permutation. This function and
% the permute function are inverses of each other.
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = ipermute(x,p)
iperm = zeros(1,ndims(x));
iperm(p) = 1:ndims(x);
y = permute(x,iperm);
|