Mercurial > hg > ishara
view general/numerical/array/arrshift.m @ 16:db7f4afd27c5
Rearranging numerical toolbox.
author | samer |
---|---|
date | Thu, 17 Jan 2013 13:20:44 +0000 |
parents | general/numerical/arrshift.m@e44f49929e56 |
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));