Welcome to arraycontext’s documentation!¶
GPU arrays? Deferred-evaluation arrays? Just plain numpy arrays? You’d like your
code to work with all of them? No problem! Comes with pre-made array context
implementations for:
arraycontext started life as an array abstraction for use with the
meshmode unstrucuted discretization package.
Design Guidelines¶
Here are some of the guidelines we aim to follow in arraycontext. There
exist numerous other, related efforts, such as the Python array API standard. These
points may aid in clarifying and differentiating our objectives.
The array context is about exposing the common subset of operations available in immutable and mutable arrays. As a result, the interface does not seek to support interfaces that provide, enable, or are typically used only with in-place mutation.
For example: The equivalents of
numpy.empty()were deprecated and will eventually be removed.Each array context offers a specific subset of of
numpyunderarraycontext.ArrayContext.np. Functions under this namespace must be unconditionallynumpy-compatible, that is, they may not offer an interface beyond what numpy offers. Functions that are incompatible, for example by supporting tag metadata (cf.arraycontext.ArrayContext.einsum()) should live under theArrayContextdirectly.Similarly, we strive to minimize redundancy between attributes of
ArrayContextandarraycontext.ArrayContext.np.For example:
ArrayContext.empty_likewas deprecated.Array containers are data structures that may contain arrays. See
arraycontext.container. We strive to support these, where sensible, inArrayContextandarraycontext.ArrayContext.np.
Contents¶
- The Array Context Abstraction
- Freezing and thawing
- The
ArrayContextInterfaceArrayContextArrayContext.from_numpy()ArrayContext.to_numpy()ArrayContext.call_loopy()ArrayContext.einsum()ArrayContext.npArrayContext.array_typesArrayContext.is_array_type()ArrayContext.freeze()ArrayContext.thaw()ArrayContext.freeze_thaw()ArrayContext.tag()ArrayContext.tag_axis()ArrayContext.compile()ArrayContext.outline()
tag_axes()P
- Implementations of the Array Context Abstraction
- Array context based on
numpy - Array context based on
pyopencl.array - Lazy/Deferred evaluation array context based on
pytato - Array context based on
jax.numpy numpycoverage
- Array context based on
- Array Containers
ArrayContainerArithArrayContainerArrayContainerTArithArrayContainerTNotAnArrayContainerError- Serialization/deserialization
- Context retrieval
MultiVectorsupport- Canonical locations for type annotations
- References
- Containers with arithmetic
- Containers based on
dataclasses - Traversing containers
rec_map_container()map_array_container()multimap_array_container()rec_map_array_container()rec_multimap_array_container()map_reduce_array_container()multimap_reduce_array_container()rec_map_reduce_array_container()rec_multimap_reduce_array_container()stringify_array_container_tree()- Traversing decorators
- Freezing and thawing
- Flattening and unflattening
- Algebraic operations
- Other functionality
- Types and Type Variables for Arrays and Containers
- Other locations
- Metadata (“tags”) for Arrays and Array Axes
ArrayContext-generating fixture forpytest- Program creation for
loopy - References
- Installation
- User-visible Changes
- Licensing
- Acknowledgments
- 🚀 Github
- 💾 Download Releases