view sequences/slices.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 9e7be347b3a0
children
line wrap: on
line source
% slices - sequence obtained from slices of an array
%
% slices :: 
%    [Size(1:E)->A]	~'E-dimensional array',
% -> seq([Size(1:E-1)->A]).
%
% slices :: 
%    [Size(1:E)->A]	~'E-dimensional array',
%    D:natural       ~'dimension of desired values'
% -> seq([arrset(Size,D,1)->A]).
%
% If 2nd parameter not given, the array is sliced along it's
% last non-singleton dimension. In the second form, arrset(Size1,D,1)
% is the same as Size except that element D is set to 1.

function y=slices(x,dim), 
	if nargin<2, dim=length(size1(x)); end
	if isempty(x), y=nil; else y=seq.slices(x,dim); end
end