References
ResizingTools.BufferType
— TypeBufferType = Union{Vector,BitVector}
Types which can be a buffer.
ResizingTools.AbstractRDArray
— TypeAbstractRDArray{T,N} <: DenseArray{T,N}
N
-dimensional resizable dense array with elements of type T
with some pre-defined array methods.
ResizingTools.AbstractRNArray
— TypeAbstractRNArray{T,N} <: AbstractArray{T,N}
N
-dimensional resizable (no-dense) array with elements of type T
with some pre-defined array methods.
ResizingTools.AbstractSize
— TypeAbstractSize{N}
Supertype for all array sizes.
ResizingTools.SimpleRDArray
— TypeSimpleRDArray{T,N} <: AbstractRDArray{T,N}
A simple implementation of resizable dense array.
ResizingTools.Size
— TypeSize{N} <: AbstractSize{N}
Size type for resizable arrays, which is a mutable wrapper of Dims{N}
to represent the dimension of an resizable array. Mutate d
th dimension to n
by sz[d] = n
mutate the whole dimensions to nsz
by set!(sz, nsz)
.
Base.resize!
— Methodresize!(A::AbstractArray{T,N}, d::Integer, I)
Resize the d
th dimension to I
, where I
can be an integer or a colon or an iterator.
Base.resize!
— Methodresize!(A::AbstractArray{T,N}, sz)
Resize A
to sz
. sz
can be a tuple of integer or Colon or iterator.
Base.sizehint!
— MethodBase.sizehint!(A::AbstractArray, nl::Integer)
Suggest that array A
reserve capacity for at least nl
elements. This can improve performance.
Base.sizehint!
— Methodsizehint!(A::AbstractArray{T,N}, sz::NTuple{N}) where {T,N}
Suggest that array A
reserve size for at least sz
. This can improve performance.
ResizingTools.after_resize!
— Functionafter_resize!(A::AbstractArray{T,N}, sz::NTuple{N,Any})
after_resize!(A::AbstractArray{T,N}, d::Integer, n::Any)
Do something after resize A
with given arguments (do nothing by default). This methods is called by resize!
with the same arguments.
ResizingTools.copyto_parent!
— Methodcopyto_parent!(dst::AbstractArray, src::AbstractArray, dinds...)
Copy the elements of src
to parent of dst
at the dst
indices dinds
. This method is called by resize_buffer!
to copy elements of the parent. The default method is copyto!(view(dst, dinds...), src)
. The default method assumes that setindex!(parent(dst), v, i...)
is the same as setindex!(dst, v, i...)
. Override this method if they are different.
ResizingTools.getsize
— Functiongetsize(A::AbstractArray, [dim])
Returns the dimensions of A
unlike size
which may not return a Dims{N}
.
You should never call this function directly. Use size
instead.
ResizingTools.has_resize_buffer
— Methodhas_resize_buffer(A::AbstractArray)
Determines if an array has resize_buffer*
methods, if not resize!(A, args...)
would resize its parent.
ResizingTools.isresizable
— Methodisresizable(A::AbstractArray)
Determines if an array is resizable, if not resize!(A, args...)
would throw an error.
ResizingTools.pre_resize!
— Functionpre_resize!(A::AbstractArray{T,N}, sz::NTuple{N,Any})
pre_resize!(A::AbstractArray{T,N}, d::Integer, n::Any)
Do something before resize A
with given arguments (do nothing by default). This method is called by resize!
with the same arguments.
ResizingTools.resize_buffer!
— Methodresize_buffer!(A::AbstractArray, nsz...)
Implementation of resize!(A, nsz)
where parent(A)
is BufferType
.
ResizingTools.resize_buffer_dim!
— Methodresize_buffer_dim!(A::AbstractArray, d::Int, I)
Implementation of resize!(A, d, I)
where parent(A)
is a BufferType
.
ResizingTools.resize_parent!
— Methodresize_parent!(A::AbstractArray, nl::Integer)
Resize the parent of A. This method will (and should only) be called by resize_buffer!
or resize_buffer_dim!
, the default implementation is resize!(parent(A), nl)
, but for arrays with preserved space, this methods can be override to keep size of parent.
ResizingTools.resize_parent!
— Methodresize_parent!(A::AbstractArray{T,N}, sz::NTuple{N})
The same as resize_parent!(A, prod(sz)
.
ResizingTools.set!
— Methodset!(sz::Size{N}, nsz::NTuple{N,Integer})
Set sz
to nsz
.
Example
julia> sz = Size(1, 2, 3)
Size{3}((1, 2, 3))
julia> set!(sz, (3, 2, 1))
Size{3}((3, 2, 1))
ResizingTools.setsize!
— Methodsetsize!(A::AbstractArray, d::Integer, n) -> AbstractArray
Set the d
th dimension to n
.
ResizingTools.setsize!
— Methodsetsize!(A::AbstractArray{T,N}, sz) where {T,N} -> AbstractArray
Set the size of A
to sz
.
ResizingTools.size_type
— Methodsize_type(A::AbstractArray)
Get the size type of A
, determine the methods of setsize!
. The default size_type
is NoneSize
, which means setsize!
will "do nothing".
ResizingTools.to_dims
— Methodto_dims(inds::Tuple) -> Dims
Convert the given indices to Dims
.
The given indices should be a return value of to_indices
. If inds[i]
is an Integer
, this function would converted it to Int
; If inds[i]
is an AbstractVector
, this function would return its length.
ResizingTools.to_parentinds
— Methodto_parentinds(A::AbstractArray, i::Integer, I) -> (i′, I′)
Convert the index(s) I
at d
th dimension of A
to index(s) I′
at d′
th dimension of parent(A)
.
ResizingTools.to_parentinds
— Methodto_parentinds(A::AbstractArray, Is::Tuple) -> Is′
Convert the index(s) Is
of A
to index(s) Is′
of parent(A)
.