On Mon, Apr 11, 2016 at 5:24 PM Chris Barker wrote:
> On Fri, Apr 8, 2016 at 4:37 PM, Ian Henriksen <
> insertinterestingnameh...@gmail.com> wrote:
>
>
>> If we introduced the T2 syntax, this would be valid:
>>
>> a @ b.T2
>>
>> It makes the intent much clearer.
>>
>
>
On Fri, Apr 8, 2016 at 4:37 PM, Ian Henriksen <
insertinterestingnameh...@gmail.com> wrote:
> If we introduced the T2 syntax, this would be valid:
>
> a @ b.T2
>
> It makes the intent much clearer.
>
would:
a @ colvector(b)
work too? or is T2 generalized to more than one column? (though I
On Fri, Apr 8, 2016 at 4:04 PM Alan Isaac wrote:
> On 4/8/2016 5:13 PM, Nathaniel Smith wrote:
> > he doesn't want 2d matrices, he wants
> > tools that make it easy to work with stacks of 2d matrices stored in
> > 2-or-more-dimensional arrays.
>
>
> Like `map`?
>
> Alan
On 4/8/2016 5:13 PM, Nathaniel Smith wrote:
he doesn't want 2d matrices, he wants
tools that make it easy to work with stacks of 2d matrices stored in
2-or-more-dimensional arrays.
Like `map`?
Alan Isaac
___
NumPy-Discussion mailing list
On Fri, Apr 8, 2016 at 5:11 PM, Charles R Harris
wrote:
>
>
> On Fri, Apr 8, 2016 at 2:52 PM, wrote:
>
>>
>>
>> On Fri, Apr 8, 2016 at 3:55 PM, Charles R Harris <
>> charlesr.har...@gmail.com> wrote:
>>
>>>
>>>
>>> On Fri, Apr 8, 2016 at 12:17
On Fri, Apr 8, 2016 at 2:09 PM, Alan Isaac wrote:
> On 4/8/2016 4:28 PM, Ian Henriksen wrote:
>>
>> The biggest things to me are having a broadcasting 2D transpose and having
>> some
>> form of transpose that doesn't silently pass 1D arrays through unchanged.
>
>
>
> This
On Fri, Apr 8, 2016 at 2:52 PM, wrote:
>
>
> On Fri, Apr 8, 2016 at 3:55 PM, Charles R Harris <
> charlesr.har...@gmail.com> wrote:
>
>>
>>
>> On Fri, Apr 8, 2016 at 12:17 PM, Chris Barker
>> wrote:
>>
>>> On Fri, Apr 8, 2016 at 9:59 AM, Charles R
On 4/8/2016 4:28 PM, Ian Henriksen wrote:
The biggest things to me are having a broadcasting 2D transpose and having some
form of transpose that doesn't silently pass 1D arrays through unchanged.
This comment, like much of this thread, seems to long
for the matrix class but not want to
On Fri, Apr 8, 2016 at 3:55 PM, Charles R Harris
wrote:
>
>
> On Fri, Apr 8, 2016 at 12:17 PM, Chris Barker
> wrote:
>
>> On Fri, Apr 8, 2016 at 9:59 AM, Charles R Harris <
>> charlesr.har...@gmail.com> wrote:
>>
>>> Apropos column/row vectors,
On Thu, Apr 7, 2016 at 4:04 PM Stéfan van der Walt
wrote:
> 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
On Fri, Apr 8, 2016 at 12:17 PM, Chris Barker wrote:
> On Fri, Apr 8, 2016 at 9:59 AM, Charles R Harris <
> charlesr.har...@gmail.com> wrote:
>
>> Apropos column/row vectors, I've toyed a bit with the idea of adding a
>> flag to numpy arrays to indicate that the last index
On Fri, Apr 8, 2016 at 9:59 AM, Charles R Harris
wrote:
> Apropos column/row vectors, I've toyed a bit with the idea of adding a
> flag to numpy arrays to indicate that the last index is one or the other,
> and maybe neither.
>
I don't follow this. wouldn't it ony be
On 7 April 2016 at 15:03, Stéfan van der Walt wrote:
> 4) x @ colvec(x) -- gives an error, but perhaps this should work and
> be equivalent to np.dot(colvec(x), rowvec(x)) ?
Sorry, that should have been
4) colvec(x) @ x
Stéfan
On Thu, Apr 7, 2016 at 4:03 PM, Stéfan van der Walt
wrote:
> 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
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:
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
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
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
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 /
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
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
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 =
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
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 =
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 =
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?
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,
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
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
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
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
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),
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
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:
> >> >
> >> >
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.
>> >
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
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`
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
> > 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
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.
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,
On Wed, Apr 6, 2016 at 10:43 AM, Todd wrote:
> On Tue, Apr 5, 2016 at 11:14 PM, Nathaniel Smith wrote:
>>
>> On Tue, Apr 5, 2016 at 7:11 PM, Todd wrote:
>> > When you try to transpose a 1D array, it does nothing. This is the
>> > correct
On Wed, Apr 6, 2016 at 10:47 AM, Todd wrote:
>
> I think that cat is already out of the bag. As long as you can do matrix
> multiplication on arrays using the @ operator, I think they aren't really
> "pure" anymore.
>
not really -- you still need to use arrays that are the
On 4/6/2016 1:47 PM, Todd wrote:
My suggestion is that this explicitly increases the number of
dimensions to at least 2. The result will always have at least 2
dimensions. So 0D -> 2D, 1D -> 2D, 2D -> 2D, 3D -> 3D, 4D -> 4D, etc.
So this would be equivalent to the existing `atleast_2d`
On Wed, Apr 6, 2016 at 11:44 AM, Chris Barker - NOAA Federal <
chris.bar...@noaa.gov> wrote:
> But the truth is that Numpy arrays are arrays, not matrices and vectors.
>
> The "right" way to do this is to properly extend and support the
> matrix object, adding row and column vector objects, and
On Tue, Apr 5, 2016 at 11:14 PM, Nathaniel Smith wrote:
> On Tue, Apr 5, 2016 at 7:11 PM, 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,
I would make `arr.T2` the same as `np.atleast_2d(arr).T`. So a 1D array
would act as a row vector, since that is already the convention for
coercing 1D arrays to 2D.
On Tue, Apr 5, 2016 at 10:49 PM, Juan Nunez-Iglesias
wrote:
> Todd,
>
> Would you consider a 1D array to be
On Tue, Apr 5, 2016 at 9:14 PM Nathaniel Smith wrote:
> On Tue, Apr 5, 2016 at 7:11 PM, 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
Nathaniel Smith pobox.com> writes:
> An alternative that was mentioned in the bug tracker
> (https://github.com/numpy/numpy/issues/7495), possibly by me, would be
> to have arr.T2 act as a stacked-transpose operator, i.e. treat an arr
> with shape (..., n, m) as being a (...)-shaped stack of (n,
On Tue, Apr 5, 2016 at 7:11 PM, 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
On 4/5/2016 10:11 PM, 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
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 `np.atleast_2d` or `arr[None]`, but
52 matches
Mail list logo