diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2014-02-25 10:26:01 -0500 |
---|---|---|
committer | Nathaniel J. Smith <njs@pobox.com> | 2014-02-25 10:26:01 -0500 |
commit | 07ef37039541f7c1167c234f44f83504bee5ad4c (patch) | |
tree | 6dcc6f7d7dd945b8f72ad5779ea29925d4897973 /doc/neps | |
parent | 3b94837afe99022a4c24a055cc2fe26754c78653 (diff) | |
download | numpy-07ef37039541f7c1167c234f44f83504bee5ad4c.tar.gz |
add negative power support to @@
Diffstat (limited to 'doc/neps')
-rw-r--r-- | doc/neps/return-of-revenge-of-matmul-pep.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/neps/return-of-revenge-of-matmul-pep.rst b/doc/neps/return-of-revenge-of-matmul-pep.rst index cd4a476a7..69aa77f9e 100644 --- a/doc/neps/return-of-revenge-of-matmul-pep.rst +++ b/doc/neps/return-of-revenge-of-matmul-pep.rst @@ -446,11 +446,18 @@ The recommended semantics for ``@`` are: The recommended semantics for ``@@`` are:: def __matpow__(self, n): + if not isinstance(n, numbers.Integral): + raise TypeError("n must be integer") if n == 0: return identity_matrix_with_shape(self.shape) + elif n < 0: + return inverse(self) @ (self @@ (n + 1)) else: return self @ (self @@ (n - 1)) +(Of course we expect that much more efficient implementations will be +used in practice.) + The following projects have expressed an intention to implement ``@`` and ``@@`` on their matrix-like types in a manner consistent with the above definitions: |