Sorry a correction to my last posting. I had accumulate switched
between prod and cumprod and I had also forgotten to included time for
conversion from list back to matrix for cumprod. Now as Chuck stated
the results for Reduce are about the same or worse than a loop.
regards--jeff
Thanks for the tips on inline, jit and Reduce. The latter was exactly
what I wanted although the loop
is still the fastest for the simple product (accumulate=TRUE for
reduce). With regards to Moshe's comment,
I was just surprised by the timing difference. I tend to use apply
without giving it
needed to multiply N pairs of
numbers.
--- On Mon, 18/8/08, Jeff Laake <[EMAIL PROTECTED]> wrote:
> From: Jeff Laake <[EMAIL PROTECTED]>
> Subject: [R] matrix row product and cumulative product
> To: r-help@r-project.org
> Received: Monday, 18 August, 2008, 12:49 PM
On Sun, 17 Aug 2008, Jeff Laake wrote:
I spent a lot of time searching and came up empty handed on the following
query. Is there an equivalent to rowSums that does product or cumulative
product and avoids use of apply or looping? I found a rowProd in a package
but it was a convenience function
I spent a lot of time searching and came up empty handed on the
following query. Is there an equivalent to rowSums that does product or
cumulative product and avoids use of apply or looping? I found a rowProd
in a package but it was a convenience function for apply. As part of a
likelihood calc
5 matches
Mail list logo