NumPy arrays can be used to model a wide variety of concepts from different branches of mathematics and science. The same word can have a different meaning to people with different academic background. For example, to some people a floating point array of shape (3,) represents a 3-dimensional vector, others will say that it is a 1-dimensional array of length 3. To the first group of people, dimensionality of an array is the dimensionality of the linear space that it models, to the second group, it is the dimensionality of the grid along which the elements of the array are arranged. This glossary defines the terms that are used in numpy documentation and system messages. This glossary should not discourage authors of domain specific packages built on top of numpy from using the terms that are natural to their discipline. For example a linear algebra or image processing library will use a different glossary, but a general purpose component such as masked or sparsed arrays should use the terminology explained here.
- Array
- A container of elements of the same type (and length) organized in a regular N-dimensional grid.
- Axis
- An index into the shape array. Many array functions take axis as an argument.
- Broadcasting
A technique that allows numpy functions to operate on arrays of different, but conformable shapes. The shapes of two arrays are conformable as long as the trailing dimensions which they have in common all have the same lengths or one of the dimensions is 1; the shorter operand simply repeats its values for every index of a dimension equal to 1 or a dimension it doesn't have.
- Dimension
- (1) An axis; (2) The length of an axis; (3) The rank; N-dimensional array is synonymous to array of rank N.
- Index
-
- An integer indicating position of an element along an axis of the grid. The index of the first element is 0.
- Masked array
- An array that stores information about missing elements in a separate boolean array called "mask."
- Matrix
An array of rank 2. Numpy defines a subclass matrix of the ndarray class which is specialized for linear algebra matrices. Most notably, it overrides the multiplication operator on matrix instances to perform matrix multiplication instead of element-wise multiplication.
- Rank
(1) The length of the shape tuple (use not encouraged, because of (2), ndims is better). (2) number of orthogonal dimensions of a matrix
- Record
- A composite element of an array similar to C struct.
- Shape
- A tuple containing the sizes of the grid.
- Size
- Number of elements in the array.
- Stride
- The distance (in bytes) between the two consecutive elements along an axis. Numpy expresses strides in bytes because the distance between elements is not necessarily a multiple of the element size.
- Scalar
- An element in an array.
- Tensor
- An array, generally of rank greater than 2.
- Ufunc
-
- Universal function. Universal functions follow similar rules for broadcasting, coercion and “element-wise operation".
- Vector
- An array of rank 1.