You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Delayed transposition (t() or aperm()) significantly slows down block processing of a DelayedMatrix or DelayedArray object. However the result of block-processed operations like mean(), anyNA(), and members of the "Summary" group generic does not change if the input is transposed. So these operations should be smart enough to "untranspose" their input in order to be faster.
The exact algorithm for "untransposing" could be:
Go up the tree of delayed ops in x until a DelayedAperm op is found. Only climb the trunk of the tree i.e. start from x@seed and go up only if there is exactly 1 "next seed", that is, if the current seed is a DelayedUnaryOp object. Stop on the first DelayedAperm op (i.e. the most recently applied DelayedAperm op), or when the next seed is no longer a DelayedUnaryOp object.
If no DelayedAperm op was found then there is nothing to do.
If a DelayedAperm op is found, do y <- aperm(x, ....) where the exact aperm() transformation is the reverse of this DelayedAperm op. The tree trunk in y should be either shorter than the tree trunk in x (if the 2 DelayedAperm ops could be simplified) or longer (if they couldn't). If it's shorter then replace x with y before computing mean(), anyNA(), etc...
The advantage of this algo is that it doesn't need to know anything about the delayed ops found between the root of the tree and the first DelayedAperm op found on the trunk. It just relies on simplify().
The text was updated successfully, but these errors were encountered:
Delayed transposition (
t()
oraperm()
) significantly slows down block processing of a DelayedMatrix or DelayedArray object. However the result of block-processed operations likemean()
,anyNA()
, and members of the "Summary" group generic does not change if the input is transposed. So these operations should be smart enough to "untranspose" their input in order to be faster.The exact algorithm for "untransposing" could be:
x
until a DelayedAperm op is found. Only climb the trunk of the tree i.e. start fromx@seed
and go up only if there is exactly 1 "next seed", that is, if the current seed is a DelayedUnaryOp object. Stop on the first DelayedAperm op (i.e. the most recently applied DelayedAperm op), or when the next seed is no longer a DelayedUnaryOp object.y <- aperm(x, ....)
where the exactaperm()
transformation is the reverse of this DelayedAperm op. The tree trunk iny
should be either shorter than the tree trunk inx
(if the 2 DelayedAperm ops could be simplified) or longer (if they couldn't). If it's shorter then replacex
withy
before computingmean()
,anyNA()
, etc...The advantage of this algo is that it doesn't need to know anything about the delayed ops found between the root of the tree and the first DelayedAperm op found on the trunk. It just relies on
simplify()
.The text was updated successfully, but these errors were encountered: