Fast evaluation of modified dot product
- To: mathgroup at smc.vnet.net
- Subject: [mg86720] Fast evaluation of modified dot product
- From: Art <grenander at gmail.com>
- Date: Wed, 19 Mar 2008 05:26:00 -0500 (EST)
I have (below) a vector x and matrix y and would like to compute z efficiently: {n, m, b} = {10000, 100, 10}; (* n >> m > b *) x = RandomReal[{-1.,1.}, n - b +1] y = RandomChoice[{-1,1}, {n, m}]; w = Partition[y, b, 1]; z = Dot[x, w]; I have to compute z for many different x with w fixed. For large n, w becomes prohibitively big. Doing the below is much slower but doesn't require large memory allocation: z2 = Fold[(#1 + x[[#2]] y[[#2;;#2+b-1]]) &, 0., Range[Length[x]] ]; I was wondering if there is a good way to compute z that doesn't require a lot of memory. Thanks, Art.
- Follow-Ups:
- Re: Fast evaluation of modified dot product
- From: Carl Woll <carlw@wolfram.com>
- Re: Fast evaluation of modified dot product
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: Fast evaluation of modified dot product