summaryrefslogtreecommitdiff
path: root/numpy/lib
diff options
context:
space:
mode:
authorNathaniel J. Smith <njs@pobox.com>2012-05-16 14:29:34 +0100
committerNathaniel J. Smith <njs@pobox.com>2012-05-16 14:29:34 +0100
commit0812564322e1cd282cff489c46a8ce51f7fc2a89 (patch)
tree5cb2f66070f4f4f742d5e5f233f16aa204a26ebb /numpy/lib
parentbea52bf307782b2a211b7fcfa6696fad45dae275 (diff)
downloadnumpy-0812564322e1cd282cff489c46a8ce51f7fc2a89.tar.gz
Document the PyArray_Diagonal transition scheme.
Diffstat (limited to 'numpy/lib')
-rw-r--r--numpy/lib/twodim_base.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/lib/twodim_base.py b/numpy/lib/twodim_base.py
index 2b518aeae..eab8f867a 100644
--- a/numpy/lib/twodim_base.py
+++ b/numpy/lib/twodim_base.py
@@ -223,12 +223,15 @@ def diag(v, k=0):
"""
Extract a diagonal or construct a diagonal array.
- As of NumPy 1.7, extracting a diagonal always returns a view into `v`.
+ See the more detailed documentation for ``numpy.diagonal`` if you use this
+ function to extract a diagonal and wish to write to the resulting array;
+ whether it returns a copy or a view depends on what version of numpy you
+ are using.
Parameters
----------
v : array_like
- If `v` is a 2-D array, return a view of its `k`-th diagonal.
+ If `v` is a 2-D array, return a copy of its `k`-th diagonal.
If `v` is a 1-D array, return a 2-D array with `v` on the `k`-th
diagonal.
k : int, optional