6.2 Definitions

► |  | Math Library

1 | Constants and Elementary Functions
2 | Flonums
3 | Special Functions
4 | Number Theory
5 | Arbitrary-Precision Floating-Point Numbers (Bigfloats)
6 | Arrays
7 | Matrices and Linear Algebra
8 | Statistics Functions
9 | Probability Distributions
10 | Stuff That Doesn’t Belong Anywhere Else

▼ | 6 | Arrays

6.1 | Quick Start
6.2 | Definitions
6.3 | Broadcasting
6.4 | Slicing
6.5 | Nonstrict Arrays
6.6 | Types, Predicates and Accessors
6.7 | Construction
6.8 | Conversion
6.9 | Comprehensions and Sequences
6.10 | Pointwise Operations
6.11 | Indexing and Slicing
6.12 | Transformations
6.13 | Folds, Reductions and Expansions
6.14 | Other Array Operations
6.15 | Subtypes
6.16 | Strictness

Racket
top contents ← prev up next →

### 6.2 Definitions🔗ℹ

An array’s domain is determined by its shape, a vector of nonnegative integers such as #(4 5), #(10 1 5 8) or #(). The shape’s length is the number of array dimensions, or axes. The shape’s contents are the length of each axis.

The product of the axis lengths is the array’s size. In particular, an array with shape #() has one element.

Indexes are a vector of nonnegative integers that identify a particular element. Indexes are in-bounds when there are the same number of them as axes, and each is less than its corresponding axis length.

An array’s contents are determined by its procedure, which returns an element when applied to in-bounds indexes. By default, most arrays’ procedures look up elements in memory. Others, such as those returned by make-array, return computed values.

A pointwise operation is one that operates on each array element independently, on each corresponding pair of elements from two arrays independently, or on a corresponding collection of elements from many arrays independently. This is usually done using array-map.

When a pointwise operation is performed on arrays with different shapes, the arrays are broadcast so that their shapes match. See Broadcasting for details.

top contents ← prev up next →