view general/arrutils/maprows.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents fbc0540a9208
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