Re: help to make code run faster (mathematica v8.01)
- To: mathgroup at smc.vnet.net
- Subject: [mg121363] Re: help to make code run faster (mathematica v8.01)
- From: Ray Koopman <koopman at sfu.ca>
- Date: Mon, 12 Sep 2011 04:22:13 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <j4fhn1$2em$1@smc.vnet.net> <j4i6a7$c0a$1@smc.vnet.net>
On Sep 11, 4:33 am, Ray Koopman <koop... at sfu.ca> wrote: > > Think in terms of vectors: > > 1.5 Times @@ Transpose@Subsets[fit["FitResiduals"],{2}] . > Clip[1. - ((Subtract @@ Transpose@Subsets[reg,{2}])/h)^2, {0.,1.}] This is about 10% faster. There are several variants of this that are just about as fast, so experiment a little. (-1.5/h^2) Times @@ Transpose@Subsets[fit["FitResiduals"],{2}] . Clip[(Subsets[reg,{2}].{1.,-1.})^2 - h^2, {-h^2,0.}]