From 3da7c73103d653a6e431924f6f4084224b8bb73b Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Wed, 31 Oct 2018 16:59:58 -0500 Subject: DOC: Clarify that 0d arrays are dimension-lifted to 1d in asfortranarray and ascontiguousarray --- numpy/core/numeric.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 5d82bbd8d..bfe72ceb6 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -587,7 +587,7 @@ def asanyarray(a, dtype=None, order=None): def ascontiguousarray(a, dtype=None): """ - Return a contiguous array in memory (C order). + Return a contiguous array (ndim >= 1) in memory (C order). Parameters ---------- @@ -618,13 +618,16 @@ def ascontiguousarray(a, dtype=None): >>> x.flags['C_CONTIGUOUS'] True + Note: This function returns an array with at least one-dimension (1-d) + so it will not preserve 0-d arrays. + """ return array(a, dtype, copy=False, order='C', ndmin=1) def asfortranarray(a, dtype=None): """ - Return an array laid out in Fortran order in memory. + Return an array (ndim >= 1) laid out in Fortran order in memory. Parameters ---------- @@ -655,6 +658,9 @@ def asfortranarray(a, dtype=None): >>> y.flags['F_CONTIGUOUS'] True + Note: This function returns an array with at least one-dimension (1-d) + so it will not preserve 0-d arrays. + """ return array(a, dtype, copy=False, order='F', ndmin=1) -- cgit v1.2.1 From 7f48bb921863b2d1a64f511f0d8f05a1590b2b2a Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Wed, 31 Oct 2018 17:02:22 -0500 Subject: DOC: remove excess indentation in Note: --- numpy/core/numeric.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index bfe72ceb6..265c3636f 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -619,7 +619,7 @@ def ascontiguousarray(a, dtype=None): True Note: This function returns an array with at least one-dimension (1-d) - so it will not preserve 0-d arrays. + so it will not preserve 0-d arrays. """ return array(a, dtype, copy=False, order='C', ndmin=1) @@ -659,7 +659,7 @@ def asfortranarray(a, dtype=None): True Note: This function returns an array with at least one-dimension (1-d) - so it will not preserve 0-d arrays. + so it will not preserve 0-d arrays. """ return array(a, dtype, copy=False, order='F', ndmin=1) -- cgit v1.2.1