view arrows/@abuffer/construct.m @ 0:672052bd81f8

Initial partial import.
author samer
date Wed, 19 Dec 2012 22:38:28 +0000
parents
children
line wrap: on
line source
function u=construct(s,sizes_in)
	u=construct(s.base,sizes_in);

	u.sizes_out = {[u.sizes_out{1}(1),s.width]};
	subproc = u.process;
	width   = s.width;

	if nargin(s.base)==0 && nargout(s.base)==1
		u.process = @proc01;
	elseif nargin(s.base)==1 && nargout(s.base)==0
		u.process = @proc10;
	else 
		u.process = @proc11;
	end

	function proc10(X)
		for i=1:width, subproc(X(:,i)); end
	end

	function Y=proc11(X)
		y=subproc(X(:,1));
		Y=repmat(y,1,width);
		for i=2:width
			Y(:,i)=subproc(X(:,i));
		end
	end

	function Y=proc01
		y=subproc();
		Y=repmat(y,1,width);
		for i=2:width
			Y(:,i)=subproc();
		end
	end
end