Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: np.matrix exponentiation fails for unsigned integers #9506

Closed
@eric-wieser

Description

@eric-wieser
>>> np.matrix(np.eye(3)) ** np.uint8(1)
Traceback (most recent call last):
  File "<pyshell#53>", line 1, in <module>
    np.matrix(np.eye(3)) ** np.uint8(1)
  File "C:\Users\wiese\AppData\Roaming\Python\Python35\site-packages\numpy\matrixlib\defmatrix.py", line 356, in __pow__
    return matrix_power(self, other)
  File "C:\Users\wiese\AppData\Roaming\Python\Python35\site-packages\numpy\matrixlib\defmatrix.py", line 175, in matrix_power
    raise TypeError("exponent must be an integer")
TypeError: exponent must be an integer

Caused by subdtype(x, Int) meaning subdtype(x, np.unsigned_integer).

Can we change the meaning to np.integer, or is it too late, and we should just deprecate this shorthand?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions