Skip to content

Possible conversion bug with record array #3351

@rougier

Description

@rougier

I got a weird output from the following script:

import numpy as np

U = np.zeros(1, dtype=[('x', np.float32, (4,4))])

# Problematic
U[0] = np.eye(4)
print U[0]

# Works as expected
U[0] = np.eye(4, dtype=np.float32)
U['x'][0] = np.eye(4)

Output:
([[0.0, 1.875, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.875], [0.0, 0.0, 0.0, 0.0]],)

Tested on numpy 1.7.1, confirmed on 1.6.0.

As noted by Chirs Barker on the mailing list, U is a rank-zero array, not a 4X4 array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions