[Numpy-discussion] Re: Allow matrix multiplication in structured arrays

2025-06-17 Thread abel . gutierrez
Hi, Thanks for replying. I was using: ``` from numpy.lib import recfunctions as rfn xyz = rfn.structured_to_unstructured(atoms[["x", "y", "z"]]) xyz = xyz @ transform.T atoms[["x", "y", "z"]] = rfn.unstructured_to_structured( xyz, dtype=atoms[["x", "y", "z"]].dtype ) ``` But I think this is cr

[Numpy-discussion] Re: Allow matrix multiplication in structured arrays

2025-06-13 Thread Marten van Kerkwijk
Hi Abel, As long as your x,y,z are next to each other, you can transform from your structure to an unstructured array via a view, which has very little cost. Though you need to be a bit careful with offsets, etc., if there are also other elements in the structured dtype. Example, with some extra