Marten van Kerkwijk

Results 224 comments of Marten van Kerkwijk

Indeed, I think for, say, 3-D vectors I'd recommend something like `np.dtype([('vector', '3f8')])` or perhaps `np.dtype([('x', 'f8'), ('y', 'f8'), ('z', 'f8')])`. The huge advantage is that the shape is automatically...

The representations generally store `x`, `y`, `z` as individual `Quantity` arrays (i.e., they carry a unit); there is some special [code](https://github.com/astropy/astropy/blob/master/astropy/coordinates/representation.py#L1252) in place that for an array with dimension 3...

(Hoping this is the right place) For complex numbers, it would be important to think through exact definitions for some of the elementwise functions. While most are clear, some are...

@asmeurer - yes. Complementary to the argument (`angle`) is of course the modulus, which is captured by `abs`. The latter is not complex-specific, but it would also be really good...

@asmeurer - Julia has [`abs2`](https://docs.julialang.org/en/v1/base/math/#Base.abs2). C++ has (the rather badly named) [`std::norm`](https://www.cplusplus.com/reference/complex/norm/).

@barentsen - indeed, I was looking and thinking similarly. As @dhomeier notes, `Masked` prefers not to discard the mask, unlike numpy's `MaskedArray`, which does discard the mask in those operations....

On `np.in1d` - oops - see https://github.com/astropy/astropy/blob/b740594dcc9f8aacae0c14a5774e09f0732d1aef/astropy/utils/masked/function_helpers.py#L140-L142

Great! Feel free to ping if there are issues. I'll look into `np.in1d`, since it would be nice to support that and the other set-like functions -- but I may...

Note that the dtypes have a hierarchy, ``` dt = np.dtype(('u2', [('x', 'u1'), ('y', 'u1')])) np.issubdtype(dt, np.void) # True ``` Also, since ``` type(dt) # numpy.dtype[void] ``` it would make...

Saw this by chance. The relevant speed comparison then is: ``` In [10]: a = np.arange(1e6).reshape(1000, 1000) In [11]: %timeit np.fastCopyAndTranspose(a) 2.16 ms ± 5.15 µs per loop (mean ±...