@@ -8,8 +8,8 @@ tuple of `AbstractUnitRange{eltype(Dims)}`s. Any integer in `args...` is replace
88instance of `Base.OneTo{eltype(Dims)}`.
99
1010The array dimensions or ranges may also be provided as a tuple.
11- [`RelaxedArrayShape{N}`](@ref) is the union of types of `N`-tuples to which
12- `as_array_axes` is applicable.
11+ [`RelaxedArrayShape{N}`](@ref) is the union of types of `N`-tuples to which `as_array_axes`
12+ is applicable.
1313
1414Also see [`as_array_shape`](@ref), [`as_array_size`](@ref), [`as_array_axis`](@ref),
1515[`ArrayAxes`](@ref), `Dims`, and [`new_array`](@ref).
@@ -25,8 +25,8 @@ as_array_axes(args::RelaxedArrayShape) = map(as_array_axis, args)
2525
2626converts array dimension or range `arg` to a canonical array axis, that is an instance of
2727`AbstractUnitRange{eltype(Dims)}`. If `arg` is an integer, `Base.OneTo{eltype(Dims)}(arg)`
28- is returned. [`eltype(RelaxedArrayShape)`](@ref RelaxedArrayShape) is the union of types
29- to which `as_array_axis` is applicable.
28+ is returned. [`eltype(RelaxedArrayShape)`](@ref RelaxedArrayShape) is the union of types to
29+ which `as_array_axis` is applicable.
3030
3131Also see [`as_array_axes`](@ref), [`as_array_dim`](@ref), and `Dims`.
3232
@@ -62,20 +62,19 @@ as_array_dim(rng::AbstractRange{<:Integer}) =
6262
6363converts array dimensions or ranges `args...` to a canonical form of array shape, one of:
6464
65- * array size, that is a tuple of `Int`s. This is the result if all of `args...` are
66- integers or instances of `Base.OneTo`, the latter, if any, being replaced by their
67- lengths.
65+ * array size, that is a tuple of `Int`s. This is the result if all of `args...` are integers
66+ or instances of `Base.OneTo`, the latter, if any, being replaced by their lengths.
6867
6968* array axes, that is a tuple of `AbstractUnitRange{Int}`s. This is the result if any of
7069 `args...` are non-`Base.OneTo` ranges, the integers being converted to instances of
7170 `Base.OneTo{eltype(Dims)}`.
7271
7372The array dimensions or ranges may also be provided as a tuple.
74- [`RelaxedArrayShape{N}`](@ref) is the union of types of `N`-tuples to which
75- `as_array_shape` is applicable.
73+ [`RelaxedArrayShape{N}`](@ref) is the union of types of `N`-tuples to which `as_array_shape`
74+ is applicable.
7675
77- Also see [`as_array_size`](@ref), [`as_array_axes`](@ref), [`ArrayAxes`](@ref), `Dims`,
78- and [`new_array`](@ref).
76+ Also see [`as_array_size`](@ref), [`as_array_axes`](@ref), [`ArrayAxes`](@ref), `Dims`, and
77+ [`new_array`](@ref).
7978
8079"""
8180as_array_shape(:: Tuple{} ) = ()
@@ -90,11 +89,11 @@ converts array dimensions or ranges `args...` to a canonical form of array size,
9089tuple of `eltype(Dims)`s. Any range in `args...` is replaced by its length.
9190
9291The array dimensions or ranges may also be provided as a tuple.
93- [`RelaxedArrayShape{N}`](@ref) is the union of types of `N`-tuples to which
94- `as_array_size` is applicable.
92+ [`RelaxedArrayShape{N}`](@ref) is the union of types of `N`-tuples to which `as_array_size`
93+ is applicable.
9594
96- Also see [`as_array_shape`](@ref), [`as_array_axes`](@ref), [`as_array_dim`](@ref),
97- `Dims`, and [`new_array`](@ref).
95+ Also see [`as_array_shape`](@ref), [`as_array_axes`](@ref), [`as_array_dim`](@ref), `Dims`,
96+ and [`new_array`](@ref).
9897
9998"""
10099as_array_size(:: Tuple{} ) = ()
@@ -110,8 +109,8 @@ create a new array with element type `T` and shape defined by `inds...`, a list
110109dimension lengths and/or index ranges. The shape may also be specified as a tuple.
111110
112111If `inds...` contains any index range other than `Base.OneTo`, an `OffsetArray{T}` is
113- returned; otherwise an `Array{T}` is returned. In the former case, an exception is thrown
114- if the package `OffsetArrays` has not been loaded.
112+ returned; otherwise an `Array{T}` is returned. In the former case, an exception is thrown if
113+ the package `OffsetArrays` has not been loaded.
115114
116115Also see [`as_array_shape`](@ref), [`as_array_axes`](@ref), and [`as_array_size`](@ref).
117116
@@ -158,10 +157,9 @@ convert_eltype(::Type{T}, ::Type{X}) where {T,X} =
158157 error(" don't know how to convert the element type of type `$X ` to `$T `" )
159158
160159# As of Julia 1.11 `AbstractMatrix{T}(A)` or `AbstractArray{T}(A)` can be used to convert
161- # element type of `A` for Adjoint, Bidiagonal, Diagonal, Hermitian,
162- # LinearAlgebra.LQPackedQ, LowerTriangular, SymTridiagonal, Symmetric, Transpose,
163- # Tridiagonal, UnitLowerTriangular, UnitUpperTriangular, UpperHessenberg, UpperTriangular,
164- # etc.
160+ # element type of `A` for Adjoint, Bidiagonal, Diagonal, Hermitian, LinearAlgebra.LQPackedQ,
161+ # LowerTriangular, SymTridiagonal, Symmetric, Transpose, Tridiagonal, UnitLowerTriangular,
162+ # UnitUpperTriangular, UpperHessenberg, UpperTriangular, etc.
165163convert_eltype(:: Type{T} , A:: AbstractArray{T} ) where {T} = A
166164convert_eltype(:: Type{T} , A:: AbstractArray ) where {T} = AbstractArray{T}(A)
167165convert_eltype(:: Type{T} , :: Type{<:Array{<:Any,N}} ) where {T,N} = Array{T,N}
193191# Convert element type for numbers.
194192convert_eltype(:: Type{T} , :: Type{<:Number} ) where {T} = T
195193
196- # Convert element type for tuples. See `_countuple` in `base/tuple.jl` for the best
197- # way to extract the number of elements in a tuple given its type.
194+ # Convert element type for tuples. See `_countuple` in `base/tuple.jl` for the best way to
195+ # extract the number of elements in a tuple given its type.
198196convert_eltype(:: Type{T} , :: Type{<:NTuple{N,Any}} ) where {N,T} = NTuple{N,T}
199197convert_eltype(:: Type{T} , A:: NTuple{N,T} ) where {N,T} = A
200198convert_eltype(:: Type{T} , A:: Tuple ) where {T} = map(as(T), A)
@@ -237,8 +235,8 @@ convert_eltype(::Type{T}) where {T} = Converter(convert_eltype, T)
237235yields an array which lazily converts its entries to type `T`. More specifically, a call
238236like `B[i]` yields `as(T,A[i])`.
239237
240- Consider using [`convert_eltype(T, A)`](@ref convert_eltype) to perform the conversion
241- once and immediately.
238+ Consider using [`convert_eltype(T, A)`](@ref convert_eltype) to perform the conversion once
239+ and immediately.
242240
243241"""
244242as_eltype(:: Type{T} , A:: AbstractArray{T} ) where {T} = A
0 commit comments