On 7 April 2016 at 11:17, Chris Barker wrote:
> np.col_vector(arr)
>
> which would be a synonym for np.reshape(arr, (-1,1))
>
> would that make anyone happy?
I'm curious to see use cases where this doesn't solve the problem.
The most common operations that I run into:
colvec = lambda x: np.c_[x
On Thu, Apr 7, 2016 at 11:31 AM, wrote:
> maybe a warning?
>>
>
> AFAIR, there is a lot of code that works correctly with .T being a noop
> for 1D
> e.g. covariance matrix/inner product x.T dot y as mentioned before.
>
oh well, then no warning, either.
> write unit tests with non square 2d arr
On Thu, Apr 7, 2016 at 10:00 AM, Ian Henriksen
wrote:
>
> Here's another example that I've seen catch people now and again.
>
> A = np.random.rand(100, 100)
> b = np.random.rand(10)
> A * b.T
>
> In this case the user pretty clearly meant to be broadcasting along the rows
> of A
> rather than alo
On Thu, Apr 7, 2016 at 4:07 PM, Ian Henriksen <
insertinterestingnameh...@gmail.com> wrote:
> On Thu, Apr 7, 2016 at 1:53 PM wrote:
>
>> On Thu, Apr 7, 2016 at 3:26 PM, Ian Henriksen <
>> insertinterestingnameh...@gmail.com> wrote:
>>
>>> On Thu, Apr 7, 2016 at 12:31 PM wrote:
>>>
write uni
On Thu, Apr 7, 2016 at 1:53 PM wrote:
> On Thu, Apr 7, 2016 at 3:26 PM, Ian Henriksen <
> insertinterestingnameh...@gmail.com> wrote:
>
>> On Thu, Apr 7, 2016 at 12:31 PM wrote:
>>
>>> write unit tests with non square 2d arrays and the exception / test
>>> error shows up fast.
>>>
>>> Josef
>>>
On Thu, Apr 7, 2016 at 3:26 PM, Ian Henriksen <
insertinterestingnameh...@gmail.com> wrote:
> On Thu, Apr 7, 2016 at 12:31 PM wrote:
>
>> write unit tests with non square 2d arrays and the exception / test error
>> shows up fast.
>>
>> Josef
>>
>>
> Absolutely, but good programming practices don'
On Thu, Apr 7, 2016 at 12:31 PM wrote:
> write unit tests with non square 2d arrays and the exception / test error
> shows up fast.
>
> Josef
>
>
Absolutely, but good programming practices don't totally obviate helpful
error
messages.
Best,
-Ian
___
Nu
On Thu, Apr 7, 2016 at 12:18 PM Chris Barker wrote:
> On Thu, Apr 7, 2016 at 10:00 AM, Ian Henriksen <
> insertinterestingnameh...@gmail.com> wrote:
>
>> Here's another example that I've seen catch people now and again.
>>
>> A = np.random.rand(100, 100)
>> b = np.random.rand(10)
>> A * b.T
>>
>
On Thu, 7 Apr 2016 14:31:17 -0400, josef.p...@gmail.com wrote:
So this discussion brings up that we also need an easy an obvious
way to make a column vector --
maybe:
np.col_vector(arr)
FWIW I would give a +1e42 to something like np.colvect and np.rowvect
(or whatever variant of these name
On Thu, Apr 7, 2016 at 2:17 PM, Chris Barker wrote:
> On Thu, Apr 7, 2016 at 10:00 AM, Ian Henriksen <
> insertinterestingnameh...@gmail.com> wrote:
>
>> Here's another example that I've seen catch people now and again.
>>
>> A = np.random.rand(100, 100)
>> b = np.random.rand(10)
>> A * b.T
>>
>
On Thu, Apr 7, 2016 at 11:17 AM, Chris Barker wrote:
> On Thu, Apr 7, 2016 at 10:00 AM, Ian Henriksen
> wrote:
>>
>> Here's another example that I've seen catch people now and again.
>>
>> A = np.random.rand(100, 100)
>> b = np.random.rand(10)
>> A * b.T
>
>
> typo? that was supposed to be
>
> b
On Thu, Apr 7, 2016 at 10:00 AM, Ian Henriksen <
insertinterestingnameh...@gmail.com> wrote:
> Here's another example that I've seen catch people now and again.
>
> A = np.random.rand(100, 100)
> b = np.random.rand(10)
> A * b.T
>
typo? that was supposed to be
b = np.random.rand(100). yes?
Th
On Thu, Apr 7, 2016 at 1:35 PM, Sebastian Berg
wrote:
> On Do, 2016-04-07 at 13:29 -0400, josef.p...@gmail.com wrote:
> >
> >
> > On Thu, Apr 7, 2016 at 1:20 PM, Sebastian Berg <
> > sebast...@sipsolutions.net> wrote:
> > > On Do, 2016-04-07 at 11:56 -0400, josef.p...@gmail.com wrote:
> > > >
> >
On Do, 2016-04-07 at 13:29 -0400, josef.p...@gmail.com wrote:
>
>
> On Thu, Apr 7, 2016 at 1:20 PM, Sebastian Berg <
> sebast...@sipsolutions.net> wrote:
> > On Do, 2016-04-07 at 11:56 -0400, josef.p...@gmail.com wrote:
> > >
> > >
> >
> >
> >
> > >
> > > I don't think numpy treats 1d arrays a
On Thu, Apr 7, 2016 at 1:20 PM, Sebastian Berg
wrote:
> On Do, 2016-04-07 at 11:56 -0400, josef.p...@gmail.com wrote:
> >
> >
>
>
>
> >
> > I don't think numpy treats 1d arrays as row vectors. numpy has C
> > -order for axis preference which coincides in many cases with row
> > vector behavior.
On Do, 2016-04-07 at 17:00 +, Ian Henriksen wrote:
>
>
> On Wed, Apr 6, 2016 at 3:21 PM Nathaniel Smith wrote:
> > Can you elaborate on what you're doing that you find verbose and
> > confusing, maybe paste an example? I've never had any trouble like
> > this doing linear algebra with @ or
On Do, 2016-04-07 at 11:56 -0400, josef.p...@gmail.com wrote:
>
>
>
> I don't think numpy treats 1d arrays as row vectors. numpy has C
> -order for axis preference which coincides in many cases with row
> vector behavior.
>
Well, broadcasting rules, are that (n,) should typically behave sim
On Thu, Apr 7, 2016 at 8:13 AM, Todd wrote:
> First you need to turn a into a 2D array. I can think of 10 ways to do
> this off the top of my head, and there may be more:
>
> snip
Basically, my argument here is the same as the argument from pep465 for the
> inclusion of the @ operator:
>
> http
On Wed, Apr 6, 2016 at 3:21 PM Nathaniel Smith wrote:
> Can you elaborate on what you're doing that you find verbose and
> confusing, maybe paste an example? I've never had any trouble like
> this doing linear algebra with @ or dot (which have similar semantics
> for 1d arrays), which is probably
On Thu, Apr 7, 2016 at 11:42 AM, Todd wrote:
> On Thu, Apr 7, 2016 at 11:35 AM, wrote:
>>
>> On Thu, Apr 7, 2016 at 11:13 AM, Todd wrote:
>> > On Wed, Apr 6, 2016 at 5:20 PM, Nathaniel Smith wrote:
>> >>
>> >> On Wed, Apr 6, 2016 at 10:43 AM, Todd wrote:
>> >> >
>> >> > My intention was to mak
On Thu, Apr 7, 2016 at 11:35 AM, wrote:
> On Thu, Apr 7, 2016 at 11:13 AM, Todd wrote:
> > On Wed, Apr 6, 2016 at 5:20 PM, Nathaniel Smith wrote:
> >>
> >> On Wed, Apr 6, 2016 at 10:43 AM, Todd wrote:
> >> >
> >> > My intention was to make linear algebra operations easier in numpy.
> >> > With
On Thu, Apr 7, 2016 at 11:13 AM, Todd wrote:
> On Wed, Apr 6, 2016 at 5:20 PM, Nathaniel Smith wrote:
>>
>> On Wed, Apr 6, 2016 at 10:43 AM, Todd wrote:
>> >
>> > My intention was to make linear algebra operations easier in numpy.
>> > With
>> > the @ operator available, it is now very easy to d
On Thu, Apr 7, 2016 at 3:39 AM, Irvin Probst wrote:
> On 06/04/2016 04:11, Todd wrote:
>
> When you try to transpose a 1D array, it does nothing. This is the
> correct behavior, since it transposing a 1D array is meaningless. However,
> this can often lead to unexpected errors since this is rar
On Thu, Apr 7, 2016 at 4:59 AM, Joseph Martinot-Lagarde <
contreba...@gmail.com> wrote:
> Alan Isaac gmail.com> writes:
>
> > But underlying the proposal is apparently the
> > idea that there be an attribute equivalent to
> > `atleast_2d`. Then call it `d2p`.
> > You can now have `a.d2p.T` which
On Wed, Apr 6, 2016 at 5:20 PM, Nathaniel Smith wrote:
> On Wed, Apr 6, 2016 at 10:43 AM, Todd wrote:
> >
> > My intention was to make linear algebra operations easier in numpy. With
> > the @ operator available, it is now very easy to do basic linear algebra
> on
> > arrays without needing the
=
Announcing bcolz 1.0.0 final
=
What's new
==
Yeah, 1.0.0 is finally here. We are not introducing any exciting new
feature (just some optimizations and bug fixes), but bcolz is already 6
years old and it implements most of the capa
=
Announcing python-blosc 1.3.1
=
What is new?
This is an important release in terms of stability. Now, the -O1 flag
for compiling the included C-Blosc sources on Linux. This represents
slower performance, but fixes the nasty
=
Announcing Numexpr 2.5.2
=
Numexpr is a fast numerical expression evaluator for NumPy. With it,
expressions that operate on arrays (like "3*a+4*b") are accelerated
and use less memory than doing the same calculation in Python.
It wears multi-thr
> > For a 1D array a of shape (N,), I expect a.T2 to be of shape (N, 1),
>
> Why not (1,N)? -- it is not well defined, though I suppose it's not so
> bad to establish a convention that a 1-D array is a "row vector"
> rather than a "column vector".
I like Todd's simple proposal: a.T2 should be equi
Advanced Scientific Programming in Python
=
a Summer School by the G-Node, and the Centre for Integrative Neuroscience and
Neurodynamics, School of Psychology and Clinical Language Sciences, University
of Reading, UK
Scientists spend more and more time wri
Alan Isaac gmail.com> writes:
> But underlying the proposal is apparently the
> idea that there be an attribute equivalent to
> `atleast_2d`. Then call it `d2p`.
> You can now have `a.d2p.T` which is a lot
> more explicit and general than say `a.T2`,
> while requiring only 3 more keystrokes.
H
On 06/04/2016 04:11, Todd wrote:
When you try to transpose a 1D array, it does nothing. This is the
correct behavior, since it transposing a 1D array is meaningless.
However, this can often lead to unexpected errors since this is rarely
what you want. You can convert the array to 2D, using
32 matches
Mail list logo