Re: fast summing alternative?
- To: mathgroup at smc.vnet.net
- Subject: [mg128377] Re: fast summing alternative?
- From: Ray Koopman <koopman at sfu.ca>
- Date: Thu, 11 Oct 2012 02:08:07 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <k4tth1$sgq$1@smc.vnet.net> <k50a7p$3sh$1@smc.vnet.net> <k531af$93q$1@smc.vnet.net>
On Oct 9, 10:34 pm, Ray Koopman <koop... at sfu.ca> wrote: > On Oct 8, 9:48 pm, Ray Koopman <koop... at sfu.ca> wrote:> On Oct 7, 11:59 >> >> tab2 = Transpose @ With[{negnewMat = - newMat}, MapThread[ >> Dot, {weights, UnitStep[# + negnewMat]} ]& /@ sortMat ] > > This should be faster: > > tab3 = Transpose[ MapThread[Dot,{weights,#}]& /@ Partition[ > UnitStep[Plus@@Transpose@Tuples@{sortMat,-newMat}], bNum] ] This may be marginally faster yet: tab4 = Transpose@Developer`PartitionMap[ MapThread[Dot,{weights,#}]&, UnitStep[Plus@@Transpose@Tuples@{sortMat,-newMat}], bNum]