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