view general/arrutils/vecop.m @ 13:03694e5c8365

Reorganised some high order list functions to correct class-based method dispatch; fixed some docs.
author samer
date Wed, 16 Jan 2013 12:12:34 +0000
parents e44f49929e56
children
line wrap: on
line source
function Z=vecop(F,X,Y)
% vecop - apply binary function to different sized arrays
%
% vecop ::
%    ([[D]],[[D]]->[[D]])  ~'some function requiring equal size args',
%    [[DX]]                ~'first arg of size DX',
%    [[DY]]                ~'second arg of size DY'
% -> [[DZ]]                ~'result of size DZ' :- DZ=max(DX,DY).
%


DX=size(X); DY=size(Y); 
E=max(length(DX),length(DY));
DZ=max(pad1s(E,DX),pad1s(E,DY));
Z=feval(F,repmat_to(X,DZ),repmat_to(Y,DZ));