summaryrefslogtreecommitdiff
path: root/doc/source/glossary.rst
diff options
context:
space:
mode:
authormelissawm <melissawm.github@gmail.com>2021-11-23 20:46:41 -0300
committermelissawm <melissawm.github@gmail.com>2022-01-05 14:12:54 -0300
commit4a6f65f10ab65307a9e1118f61d3504a7eca9de1 (patch)
treeed82591f17543b020cb1dca2e409cc0ee41af029 /doc/source/glossary.rst
parentc69ca2e5f95f0bce97422b821a6542f06c44d02d (diff)
downloadnumpy-4a6f65f10ab65307a9e1118f61d3504a7eca9de1.tar.gz
DOC: Refactoring f2py user guide
Diffstat (limited to 'doc/source/glossary.rst')
-rw-r--r--doc/source/glossary.rst34
1 files changed, 30 insertions, 4 deletions
diff --git a/doc/source/glossary.rst b/doc/source/glossary.rst
index aa2dc13df..bd75bf274 100644
--- a/doc/source/glossary.rst
+++ b/doc/source/glossary.rst
@@ -280,10 +280,36 @@ Glossary
contiguous
- An array is contiguous if
- * it occupies an unbroken block of memory, and
- * array elements with higher indexes occupy higher addresses (that
- is, no :term:`stride` is negative).
+
+ An array is contiguous if:
+
+ - it occupies an unbroken block of memory, and
+ - array elements with higher indexes occupy higher addresses (that
+ is, no :term:`stride` is negative).
+
+ There are two types of proper-contiguous NumPy arrays:
+
+ - Fortran-contiguous arrays refer to data that is stored column-wise,
+ i.e. the indexing of data as stored in memory starts from the
+ lowest dimension;
+ - C-contiguous, or simply contiguous arrays, refer to data that is
+ stored row-wise, i.e. the indexing of data as stored in memory
+ starts from the highest dimension.
+
+ For one-dimensional arrays these notions coincide.
+
+ For example, a 2x2 array ``A`` is Fortran-contiguous if its elements are
+ stored in memory in the following order::
+
+ A[0,0] A[1,0] A[0,1] A[1,1]
+
+ and C-contiguous if the order is as follows::
+
+ A[0,0] A[0,1] A[1,0] A[1,1]
+
+ To test whether an array is C-contiguous, use the ``.flags.c_contiguous``
+ attribute of NumPy arrays. To test for Fortran contiguity, use the
+ ``.flags.f_contiguous`` attribute.
copy