view general/arrutils/maprows.m @ 12:fbc0540a9208

Moved some high-order functions from funutils to arrutils, updated docs and cleaned up funutils.
author samer
date Mon, 14 Jan 2013 22:21:11 +0000
parents general/funutils/maprows.m@e44f49929e56
children
line wrap: on
line source
function Y=maprows(f,X)
% maprows - Map a function of a vector over the rows of an array
%
% maprows :: 
%    ([[1,N]->A] -> [[1,M]->B]) ~'function maps a row of A to a row of B',
%    [[L,N]->A]
% -> [[L,M]->B].

n=size(X,1);
if n==0, Y=[];
else
	for i=n:-1:1
		Y(i,:)=f(X(i,:));
	end
end