In-place resampling
UncertainData.Resampling.resample!
— Functionresample!(v::AbstractArray{T, 1}, x::AbstractUncertainValue)
resample!(v::MVector{N, T}, x::AbstractUncertainValue) where {N, T}
resample!(v::FieldVector{N, T}, x::AbstractUncertainValue) where {N, T}
resample!(v::MVector{N, T}, x::Vararg{AbstractUncertainValue, N}) where {N, T}
resample!(v::FieldVector{N, T}, x::Vararg{AbstractUncertainValue, N}) where {N, T}
resample!(v::AbstractArray{T, 1}, x::UVAL_COLLECTION_TYPES) where T
resample!(v::AbstractArray{T, 2}, x::UVAL_COLLECTION_TYPES) where T
resample!(idxs::AbstractArray{T, 1}, vals::AbstractArray{T, 1},
x::AbstractUncertainIndexValueDataset) where T
resample!(idxs::AbstractArray{T, 2}, vals::AbstractArray{T, 2},
x::AbstractUncertainIndexValueDataset) where T
Resample a uncertain value x
, or a collection of uncertain values x
, into a pre-allocated container v
.
Uncertain values
- If
x
is a single uncertain value, andv
is vector-like, then fillv
withN
draws ofx
. Works with vectors of lengthN
,MVector{N, T}
s orFieldVector{N, T}
s.
Uncertain collections
Uncertain collections may be a Vector{AbstractUncertainValue}
of length N
, an AbstractUncertainValueDataset
, or an NTuple{N, AbstractUncertainValue}
. See also UVAL_COLLECTION_TYPES
.
- If
x
is a collection of uncertain values andv
is vector-like, then fillv[i]
with a draw ofx[i]
fori = 1:N
. - If
x
is a collection of uncertain values andv
is a 2D-array, then fill thei
-th column ofv
withlength(x)
draws of thei
-th uncertain value inx
.
Uncertain index-value collections
- If two mutable vector-like containers,
idxs
andvals
, are provided along with an uncertain index-value datasetx
, then fillidxs[i]
with a random draw fromx.indices[i]
and fillvals[i]
with a random draw fromx.values[i]
. - If two mutable matrix-like containers,
idxs
andvals
are provided along with an uncertain index-value datasetx
(where the number of columns in bothidxs
andvals
matcheslength(x)
), then fill thei
-th column ofidxs
withsize(idxs, 1)
draws fromx.indices[i]
, and fill thei
-th column ofvals
withsize(idxs, 1)
draws fromx.values[i]
.