Mercurial > hg > octave-avbm
changeset 10275:19f2107d1fdd
document accumarray complexity
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 08 Feb 2010 13:22:09 +0100 |
parents | db613bccd992 |
children | ad6af249c20e |
files | scripts/ChangeLog scripts/general/accumarray.m |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-02-08 Jaroslav Hajek <highegg@gmail.com> + + * general/accumarray.m: Document complexity. + 2010-02-08 Jaroslav Hajek <highegg@gmail.com> * general/accumarray.m: Add new test that also forces index cache
--- a/scripts/general/accumarray.m +++ b/scripts/general/accumarray.m @@ -52,6 +52,14 @@ ## ans(:,:,2) = [0, 0, 0; 206, 0, 208] ## @end group ## @end example +## +## The complexity in the non-sparse case is generally O(M+N), where N is the number of +## subscripts and M is the maximum subscript (linearized in multidimensional case). +## If @var{func} is one of @code{@@sum} (default), @code{@@max}, @code{@@min} +## or @code{@@(x) @{x@}}, an optimized code path is used. +## Note that for general reduction function the interpreter overhead can play a +## major part and it may be more efficient to do multiple accumarray calls and +## compute the results in a vectorized manner. ## @end deftypefn function A = accumarray (subs, val, sz = [], func = [], fillval = [], isspar = [])