Helpers
Julia 1.7 provides findmin
, argmin
, findmax
, argmax
for generators.
BaseUtilities.decompose_vectype
— FunctionN, T = decompose_vectype(v)
Get eltype
and length
from v::AbstractVector
. The intended use is decomposing parameters of SVector{N,T}
(at no cost).
BaseUtilities.filled
— Functionx = SVector(...)
y = filled(typeof(x), [y1, y2, ...], fill=yend)
y = filled(x, [y1, y2, ...], fill=yend)
Construct an SVector{T, N}
as given by typeof(x)
with components (y1, y2, ..., yend, ..., yend)
, i.e., set the first components and "fills" to match length N
.
BaseUtilities.struct_to_dict
— Methodd = struct_to_dict(s)
Convert struct
type (or named tuple) to Dict
.
One use case is testing implementations of Base.copy
for a new struct
: There is a generic equal comparison for Dict
, and we can easily check that no fields where missed.