Reference
FunctionImplementations.AbstractArrayImplementationStyle — Type
FunctionImplementations.AbstractArrayImplementationStyle <: ImplementationStyle is the abstract supertype for any style associated with an AbstractArray type.
Note that if two or more AbstractArrayImplementationStyle subtypes conflict, the resulting style will fall back to that of Arrays. If this is undesirable, you may need to define binary ImplementationStyle rules to control the output type.
See also FunctionImplementations.DefaultArrayImplementationStyle.
FunctionImplementations.DefaultArrayImplementationStyle — Type
FunctionImplementations.DefaultArrayImplementationStyle() is a FunctionImplementations.ImplementationStyle indicating that an object behaves as an array. Specifically, DefaultArrayImplementationStyle is used for any AbstractArray type that hasn't defined a specialized style, and in the absence of overrides from other arguments the resulting output type is Array.
FunctionImplementations.Implementation — Type
FunctionImplementations.Implementation(f, s) wraps a function f with a style s. This can be used to create function implementations that behave differently based on the style of their arguments.
FunctionImplementations.ImplementationStyle — Type
ImplementationStyle is an abstract type and trait-function used to determine behavior of objects. ImplementationStyle(typeof(x)) returns the style associated with x. To customize the behavior of a type, one can declare a style by defining a type/method pair
struct MyContainerImplementationStyle <: ImplementationStyle end
FunctionImplementations.ImplementationStyle(::Type{<:MyContainer}) = MyContainerImplementationStyle()FunctionImplementations.ImplementationStyle — Method
(s::ImplementationStyle)(f)Calling a ImplementationStyle s with a function f as s(f) is a shorthand for creating a FunctionImplementations.Implementation object wrapping the function f with ImplementationStyle s.
FunctionImplementations.ImplementationStyle — Method
ImplementationStyle(::ImplementationStyle1, ::ImplementationStyle2) = ImplementationStyle3()Indicate how to resolve different ImplementationStyles. For example,
ImplementationStyle(::Primary, ::Secondary) = Primary()would indicate that style Primary has precedence over Secondary. You do not have to (and generally should not) define both argument orders. The result does not have to be one of the input arguments, it could be a third type.
FunctionImplementations.permuteddims — Method
permuteddims(a::AbstractArray, perm)Lazy version of permutedims. Defaults to constructing a Base.PermutedDimsArray but can be customized to output a different type of array.
FunctionImplementations.result_style — Function
result_style(s1::ImplementationStyle[, s2::ImplementationStyle])::ImplementationStyleTakes one or two ImplementationStyles and combines them using ImplementationStyle to determine a common ImplementationStyle.
Examples
julia> FunctionImplementations.result_style(
FunctionImplementations.DefaultArrayImplementationStyle(),
FunctionImplementations.DefaultArrayImplementationStyle()
)
FunctionImplementations.DefaultArrayImplementationStyle()
julia> FunctionImplementations.result_style(
FunctionImplementations.UnknownImplementationStyle(),
FunctionImplementations.DefaultArrayImplementationStyle()
)
FunctionImplementations.DefaultArrayImplementationStyle()FunctionImplementations.style — Function
style(cs...)::ImplementationStyleDecides which ImplementationStyle to use for any number of value arguments. Uses ImplementationStyle to get the style for each argument, and uses result_style to combine styles.
Examples
julia> FunctionImplementations.style([1], [1 2; 3 4])
FunctionImplementations.DefaultArrayImplementationStyle()FunctionImplementations.zero! — Method
zero!(a::AbstractArray)In-place version of zero(a), sets all entries of a to zero.
FunctionImplementations.Concatenate — Module
module ConcatenateAlternative implementation for Base.cat through Concatenate.cat(!).
This is mostly a copy of the Base implementation, with the main difference being that the destination is chosen based on all inputs instead of just the first.
Additionally, we have an intermediate representation in terms of a Concatenated object, reminiscent of how Broadcast works.
The various entry points for specializing behavior are:
- Destination selection can be achieved through:
Base.similar(concat::Concatenated{Style}, ::Type{T}, axes) where {Style}- Custom implementations:
Base.copy(concat::Concatenated{Style}) # custom implementation of cat
Base.copyto!(dest, concat::Concatenated{Style}) # custom implementation of cat! based on style
Base.copyto!(dest, concat::Concatenated{Nothing}) # custom implementation of cat! based on typeof(dest)FunctionImplementations.Concatenate.Concatenated — Type
Concatenated{Style, Dims, Args <: Tuple}Lazy representation of the concatenation of various Args along Dims, in order to provide hooks to customize the implementation.
FunctionImplementations.Concatenate.cat! — Method
Concatenate.cat!(dest, args...; dims)Concatenate the supplied args along dimensions dims, placing the result into dest.
FunctionImplementations.Concatenate.cat — Method
Concatenate.cat(args...; dims)Concatenate the supplied args along dimensions dims.
See also concatenate and cat!.
FunctionImplementations.Concatenate.concatenate — Method
concatenate(dims, args...)Concatenate the supplied args along dimensions dims.