annotate general/arrutils/vecop.m @ 4:e44f49929e56
Adding reorganised general toolbox, now in several subdirectories.
author |
samer |
date |
Sat, 12 Jan 2013 19:21:22 +0000 |
parents |
|
children |
|
rev |
line source |
samer@4
|
1 function Z=vecop(F,X,Y)
|
samer@4
|
2 % vecop - apply binary function to different sized arrays
|
samer@4
|
3 %
|
samer@4
|
4 % vecop ::
|
samer@4
|
5 % ([[D]],[[D]]->[[D]]) ~'some function requiring equal size args',
|
samer@4
|
6 % [[DX]] ~'first arg of size DX',
|
samer@4
|
7 % [[DY]] ~'second arg of size DY'
|
samer@4
|
8 % -> [[DZ]] ~'result of size DZ' :- DZ=max(DX,DY).
|
samer@4
|
9 %
|
samer@4
|
10
|
samer@4
|
11
|
samer@4
|
12 DX=size(X); DY=size(Y);
|
samer@4
|
13 E=max(length(DX),length(DY));
|
samer@4
|
14 DZ=max(pad1s(E,DX),pad1s(E,DY));
|
samer@4
|
15 Z=feval(F,repmat_to(X,DZ),repmat_to(Y,DZ));
|
samer@4
|
16
|