annotate 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 |
|
rev |
line source |
samer@4
|
1 function Y=maprows(f,X)
|
samer@4
|
2 % maprows - Map a function of a vector over the rows of an array
|
samer@4
|
3 %
|
samer@4
|
4 % maprows ::
|
samer@4
|
5 % ([[1,N]->A] -> [[1,M]->B]) ~'function maps a row of A to a row of B',
|
samer@4
|
6 % [[L,N]->A]
|
samer@4
|
7 % -> [[L,M]->B].
|
samer@4
|
8
|
samer@4
|
9 n=size(X,1);
|
samer@4
|
10 if n==0, Y=[];
|
samer@4
|
11 else
|
samer@4
|
12 for i=n:-1:1
|
samer@4
|
13 Y(i,:)=f(X(i,:));
|
samer@4
|
14 end
|
samer@4
|
15 end
|
samer@4
|
16
|