Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:code': 0.07; 'subject:help': 0.08; 'throws': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'computes': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'kevin': 0.30; 'message- id:@mail.gmail.com': 0.30; 'received:google.com': 0.35; 'january': 0.37; 'subject:Need': 0.64; 'to:addr:gmail.com': 0.65; 'skip:w 30': 0.69 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=LQD1VxnresNjFC1tXSVrEfJ/0n4Y/1K2OCjjDvFMAio=; b=cyKKlRdmZl22/K33JqtlrGFuyxgNBu4oHGPIFCVUmxlgvHJ8mLSWIJulRi3hEHDW1e OgIKO2cme7DHWfetduqTuafJ2tuIuIX9oj93uv0593AOaA6FR5l7yA6c/avm9j7ZR33i 4R7WP1JvibMY/4MatMXxm9WkH6bjpHwfAO51XKIj94ly0INVYc8sqadMMgN5+eROIStt ej0Z+5L9ZwOmjxkSaQIFRAAccXT3S8DM0ORSJK8Q44VEZjh0to4r4BQgpm+Y87lJ+QIs A3BSVCEdC6VkS3Qe3fwTB4fEFl52Wh4iEnpCBqoUlN+l2heqBSwQQPKif7QlAoBKpcrD iRQg== X-Received: by 10.112.201.167 with SMTP id kb7mr2427770lbc.32.1390079112796; Sat, 18 Jan 2014 13:05:12 -0800 (PST) MIME-Version: 1.0 Sender: joshua.landau.ws@gmail.com In-Reply-To: <140f8aea-d3c5-4c0d-94f5-6aa064e353d1@googlegroups.com> References: <140f8aea-d3c5-4c0d-94f5-6aa064e353d1@googlegroups.com> From: Joshua Landau Date: Sat, 18 Jan 2014 21:04:32 +0000 X-Google-Sender-Auth: QIAIBgdXBkaNzWHhlzMVYFLDt6U Subject: Re: Need help vectorizing code To: Kevin K Content-Type: text/plain; charset=UTF-8 Cc: python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1390079454 news.xs4all.nl 2965 [2001:888:2000:d::a6]:52361 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:64255 On 18 January 2014 20:51, Kevin K 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...