Julia's Array Wrapping Interface
The following functions make it easier to handle array wrappers, such as Adjoint, which can obscure an underlying array's properties under a layer of indirection.
ArrayInterface.is_forwarding_wrapper — Functionis_forwarding_wrapper(::Type{T}) -> BoolReturns true if the type T wraps another data type and does not alter any of its standard interface. For example, if T were an array then its size, indices, and elements would all be equivalent to its wrapped data.
ArrayInterface.buffer — Functionbuffer(x)Return the buffer data that x points to. Unlike parent(x::AbstractArray), buffer(x) may not return another array type.
ArrayInterface.parent_type — Functionparent_type(::Type{T}) -> TypeReturns the parent array that type T wraps.
Additional Array Wrapping Libraries
If dealing with array wrappers, additionally consider:
- Adapt.jl: conversions for handling device (GPU) wrappers.