Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97309
| Path | csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.077 |
| X-Spam-Evidence | '*H*': 0.85; '*S*': 0.00; 'subject:skip:m 10': 0.09; 'subject: \n ': 0.15; 'thu,': 0.15; 'numpy': 0.16; 'paulo': 0.16; 'wrote:': 0.16; '2015': 0.20; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; 'message-id:@mail.gmail.com': 0.27; 'fastest': 0.27; 'initial': 0.28; 'looks': 0.29; 'received:google.com': 0.35; 'something': 0.35; 'depends': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'skip:v 20': 0.38; 'subject:from': 0.39; 'to:addr:python.org': 0.40; 'better.': 0.66; '2:45': 0.84; 'subject:value': 0.84; 'to:name:python': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=zLH2pOWgS0GsYTHqO504ua5PwXWglfoDtH4ySQ3cxec=; b=vx9jxB2Rlw4DFUgznacg9+cqlPsoU+V8eg2bKM/p8ot1/Te8iOcarEJQybEMVW9pju gmq5QDUNzikbRxKpjLkUKVbZ7Jm4Sh9M7ljuMh6hdk1Id5druDGi9M/HxntOiKF+w2Of Gxc23OJNP438L+v2y0oeK2p72HuThhgfzOgIWxM3++5ZB4dg9ee+QPObJgF8ANLrHwDD Y08lnlqA6cpXvrSst+6d+6MAq7TGUSpS21uHmstT9Px/Fea1d+voxnGyf0W/b3FqI+MJ gXBMQjiaJH0U+fe2U8itRLr/YgBgZDkLQ2B1hrPueR5IU51tO6H2hRsfHH49E8SbECPR VyUw== |
| X-Received | by 10.13.204.81 with SMTP id o78mr10469498ywd.108.1443733890348; Thu, 01 Oct 2015 14:11:30 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <muk61h$eka$1@speranza.aioe.org> |
| References | <muk61h$eka$1@speranza.aioe.org> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Thu, 1 Oct 2015 15:10:50 -0600 |
| Subject | Re: Generating a vector from successive multiplications of another vector from an initial value |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.310.1443733899.28679.python-list@python.org> (permalink) |
| Lines | 19 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1443733899 news.xs4all.nl 23777 [2001:888:2000:d::a6]:49002 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:97309 |
Show key headers only | View raw
On Thu, Oct 1, 2015 at 2:45 PM, Paulo da Silva
<p_s_d_a_s_i_l_v_a_ns@netcabo.pt> wrote:
> Hi all.
>
> What is the fastest way to do the following:
>
> I have an initial value V and a vector vec of (financial) indexes.
> I want to generate a new vector nvec as
>
> V, V*vec[0], V*vec[0]*vec[1], V*vec[0]*vec[1]*vec[2], ...
>
> A numpy vectorized solution would be better.
That looks hard to vectorize since each calculation depends on the
previous. You might be stuck with something like:
result = [V]
for x in vec:
result.append(result[-1] * x)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Generating a vector from successive multiplications of another vector from an initial value Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2015-10-01 21:45 +0100 Re: Generating a vector from successive multiplications of another vector from an initial value Ian Kelly <ian.g.kelly@gmail.com> - 2015-10-01 15:10 -0600 Re: Generating a vector from successive multiplications of another vector from an initial value duncan smith <buzzard@invalid.invalid> - 2015-10-02 00:44 +0100 Re: Generating a vector from successive multiplications of another vector from an initial value Paulo da Silva <p_s_d_a_s_i_l_v_a_ns@netcabo.pt> - 2015-10-02 02:01 +0100
csiph-web