Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64255

Re: Need help vectorizing code

References <140f8aea-d3c5-4c0d-94f5-6aa064e353d1@googlegroups.com>
From Joshua Landau <joshua@landau.ws>
Date 2014-01-18 21:04 +0000
Subject Re: Need help vectorizing code
Newsgroups comp.lang.python
Message-ID <mailman.5689.1390079454.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 18 January 2014 20:51, Kevin K <richyokevin@gmail.com> wrote:
> def foo(X, y, mylambda, N, D, epsilon):
> ...
>         for j in xrange(D):
>             aj = 0
>             cj = 0
>             for i in xrange(N):
>                 aj += 2 * (X[i,j] ** 2)
>                 cj += 2 * (X[i,j] * (y[i] - w.transpose()*X[i].transpose() + w[j]*X[i,j]))

Currently this just computes and throws away values...

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Need help vectorizing code Kevin K <richyokevin@gmail.com> - 2014-01-18 12:51 -0800
  Re: Need help vectorizing code Joshua Landau <joshua@landau.ws> - 2014-01-18 21:04 +0000
  Re: Need help vectorizing code Kevin K <richyokevin@gmail.com> - 2014-01-18 13:18 -0800
  Re: Need help vectorizing code Peter Otten <__peter__@web.de> - 2014-01-18 22:50 +0100
  Re: Need help vectorizing code Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-01-19 15:46 +0000

csiph-web