Hi, I must thank y'all for the exceptionally fast responses (and apologize
for my own tragically slow response!)
On Sat, Mar 13, 2021 at 1:32 AM Eric Wieser
wrote:
> Einsum has a secret integer argument format that appears in the Examples
section of the
> `np.einsum` docs, but appears not to be m
Greetings,
I have something in my code where I can receive an array M of unknown
dimensionality and a list of "labels" for each axis. E.g. perhaps I might
get an array of shape (2, 47, 3, 47, 3) with labels ['spin', 'atom',
'coord', 'atom', 'coord'].
For every axis that is labeled "coord", I wan
> There is a way that will generally work using triple indexing:
>
> arr[..., None, None][orig_indx + (slice(None), np.array(0))][..., 0]
Impressive! (note: I fixed the * typo in the quote)
> The first and last indexing operation is just a view creation, so it is
> basically a no-op. Now doing th
Hi all,
So, in advanced indexing, numpy decides where to put new axes based on
whether the "advanced indices" are all next to each other.
>>> np.random.random((3,4,5,6,7,8))[:, [[0,0],[0,0]], 1, :].shape
(3, 2, 2, 6, 7, 8)
>>> np.random.random((3,4,5,6,7,8))[:, [[0,0],[0,0]], :, 1].shape
(2, 2, 3
On Tue, Aug 22, 2017 at 12:31 PM, Chris Barker
wrote:
> Personally, I've thought for years that Python's "Truthiness" concept is
a wart.
> Sure, empty sequences, and zero values are often "False" in nature,
> but truthiness really is application-dependent -- in particular, sometimes
> a value of
On Sat, Aug 19, 2017 at 2:00 PM, Eric Firing wrote:
> On 2017/08/19 7:18 AM, Michael Lamparski wrote:
>
>> While there's no way to really reach out to the silent majority, I am
>> going to at least make a github issue and summarize the points from this
>> discussion
On Sat, Aug 19, 2017 at 9:22 AM, Pauli Virtanen wrote:
> While the intention of making it harder to write code with bugs
> is good, it should not come at the cost of having everyone fix
> their old scripts, which worked correctly previously, but then
> suddenly stop working.
This is a good point.
bugs.
I can get behind this as well, though I just keep wondering in the back of
my mind whether there's some tricky but legitimate use case that I'm not
thinking about, where arrays of size 1 just happen to have a natural
tendency to arise.
On Sat, Aug 19, 2017, 10:34 Eric Firing
these to raise ValueErrors recommending any()
> and all():
> >>> bool(np.array([1]))
> True
> >>> bool(np.array([0]))
> False
>
> On Fri, Aug 18, 2017 at 3:00 PM, Stephan Hoyer wrote:
>
>> I agree, this behavior seems actively harmful. Let's fix it.
&
Greetings, all. I am troubled.
The TL;DR is that `bool(array([])) is False` is misleading, dangerous, and
unnecessary. Let's begin with some examples:
>>> bool(np.array(1))
True
>>> bool(np.array(0))
False
>>> bool(np.array([0, 1]))
ValueError: The truth value of an array with more than one elem
10 matches
Mail list logo