samer@4: function Y=arrshift(O,X) samer@4: % arrshift - columnwise or rowwise subtraction for arrays samer@4: % samer@4: % This SUBTRACTS the first argument (a vector) from each samer@4: % of the vectors (row or column) in the second argument. samer@4: % Works in two modes: row vector or column vector mode. samer@4: % samer@4: % arrshift :: samer@4: % [Size] ~'values to subtract', samer@4: % [[N,M]] ~'array of vectors, array domain is M' samer@4: % -> [[N,M]] ~'vectors relative to new origin'. samer@4: % samer@4: % The first argument is REPMATed up to the size of samer@4: % the second and then subtracted. samer@4: % samer@4: % NB: this used to be called vecshift. vecshift is now samer@4: % specialised to subtract a COLUMN vector from an array samer@4: % the same size in the first dimension. This version samer@4: % retains the generality of the original vecshift. samer@4: samer@4: % note: this now works for any pair of arrays where size O samer@4: % is an integer fraction of size X in any dimension samer@4: Y=X-repmat_to(O,size(X)); samer@4: