diff general/arrutils/vecop1.m @ 4:e44f49929e56

Adding reorganised general toolbox, now in several subdirectories.
author samer
date Sat, 12 Jan 2013 19:21:22 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/general/arrutils/vecop1.m	Sat Jan 12 19:21:22 2013 +0000
@@ -0,0 +1,13 @@
+function Z=vecop1(F,X,Y)
+% vecop1 - apply binary function to different sized arrays
+%
+% vecop1 ::
+%    ([[D]],[[D]]->[[D]])  ~'some function requiring equal size args',
+%    [[DX]]                ~'first arg of size DX',
+%    [[DY]]                ~'second arg of size DY'
+% -> [[DX]]                ~'result of size DX' :- all(DX>=DY).
+%
+% this is a slightly simpler version of vecop that assumes that the
+% first argument is at least as big as the second in every dimension.
+Z=feval(F,X,repmat_to(Y,size(X)));
+