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


Groups > comp.lang.python > #105583

Re: numpy arrays

Path csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Nobody <nobody@nowhere.invalid>
Newsgroups comp.lang.python
Subject Re: numpy arrays
Date Wed, 23 Mar 2016 13:45:29 +0000
Organization A noiseless patient Spider
Lines 15
Message-ID <pan.2016.03.23.13.45.27.770000@nowhere.invalid> (permalink)
References <3774dc9b-f9d3-462b-bbe4-41b8b2244db7@googlegroups.com> <mailman.43.1458729342.2244.python-list@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Info mx02.eternal-september.org; posting-host="152d4dee6f95183c956ee6fa63d7e69f"; logging-data="5215"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195bEte+NdzMdLWfRiixM/N"
User-Agent Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)
Cancel-Lock sha1:z3bQztE5/JMalJQxyJePAwmVpZc=
Xref csiph.com comp.lang.python:105583

Show key headers only | View raw


> What you want is called *transposing* the array:
> 
> http://docs.scipy.org/doc/numpy/reference/generated/numpy.transpose.html
> 
> That should be a sufficiently fast operation.

Transposing itself is fast, as it just swaps the strides and dimensions
without touching the data (i.e. it returns a new view of the original
array), but subsequent operations may be slower as the data is no longer
contiguous (i.e. iterating over the flattened array in order won't result
in sequential memory access).

If that's an issue, you can use numpy.ascontiguousarray() to make a
contiguous copy of the data.

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


Thread

numpy arrays Heli <hemla21@gmail.com> - 2016-03-23 03:06 -0700
  Re: numpy arrays Steven D'Aprano <steve@pearwood.info> - 2016-03-23 21:32 +1100
  Re: numpy arrays Chris Angelico <rosuav@gmail.com> - 2016-03-23 21:35 +1100
    Re: numpy arrays Nobody <nobody@nowhere.invalid> - 2016-03-23 13:45 +0000
      Re: numpy arrays Heli <hemla21@gmail.com> - 2016-04-06 09:26 -0700
        Re: numpy arrays Heli <hemla21@gmail.com> - 2016-04-07 07:31 -0700
          Re: numpy arrays Heli <hemla21@gmail.com> - 2016-04-11 02:17 -0700
          Re: numpy arrays Heli <hemla21@gmail.com> - 2016-04-11 02:32 -0700
  Re: numpy arrays Manolo Martínez <manolo@austrohungaro.com> - 2016-03-23 11:26 +0100
  Re: numpy arrays Heli <hemla21@gmail.com> - 2016-03-23 03:47 -0700
  Re: numpy arrays Simon Ward <simon+python@bleah.co.uk> - 2016-03-23 10:47 +0000

csiph-web