diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2009-07-08 20:46:26 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2009-07-08 20:46:26 +0000 |
commit | 8ba97d80c6b0e2834b92e1d85bb63430917bcc7b (patch) | |
tree | f3bef52834c3b13112515edd4087ff29817fb669 /numpy/lib/index_tricks.py | |
parent | ac0c117f877f28290e58c6df4b3f6f1dead26776 (diff) | |
download | numpy-8ba97d80c6b0e2834b92e1d85bb63430917bcc7b.tar.gz |
Improvement to fill_diagonal suggested by Anand Patil.
Diffstat (limited to 'numpy/lib/index_tricks.py')
-rw-r--r-- | numpy/lib/index_tricks.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py index cec7a7ac9..eeb1d37aa 100644 --- a/numpy/lib/index_tricks.py +++ b/numpy/lib/index_tricks.py @@ -742,7 +742,7 @@ def fill_diagonal(a, val): # all dimensions equal, so we check first. if not alltrue(diff(a.shape)==0): raise ValueError("All dimensions of input must be of equal length") - step = cumprod((1,) + a.shape[:-1]).sum() + step = 1 + (cumprod(a.shape[:-1])).sum() # Write the value out into the diagonal. a.flat[::step] = val |