SIMDLabelBundle
public struct SIMDLabelBundle<SIMDType> where SIMDType : SIMD, SIMDType.Scalar == Float
extension SIMDLabelBundle: LabelBundle
extension SIMDLabelBundle: CustomStringConvertible
A label bundle backed by SIMD-based types.
See also
LabelBundle
-
Constructs a
SIMDLabelBundle
with uninitialized weights for all labels in the bundle.Declaration
Swift
public init()
-
Constructs a
SIMDLabelBundle
with providedweights
andvalidWeightsMask
.Declaration
Swift
public init(weights: SIMDType, validWeightsMask: SIMDType.MaskStorage)
Parameters
weights
a vector of weights to be assigned to each label.
validWeightsMask
a vector where each element is 0 if the label is not assigned a valid weight, or -1 (all bits set to 1 in 2’s complement) if the corresponding weight is valid.
-
Constructs a
SIMDLabelBundle
with providedweights
.Note: all label weights are assumed valid. If you have some labels that are invalid, use
init(weights:validWeightsMask:)
to specify which weights are invalid.Declaration
Swift
public init(weights: SIMDType)
Parameters
weights
a vector of weights to be assigned to each label.
-
Accesses the weight associated with the given index.
Declaration
Swift
public subscript(index: Int) -> Float? { get set }
-
Creates a
SIMDLabelBundle
withvalue
set for each label’s weight.All labels are determined to have valid values.
Declaration
Swift
public init(repeating value: Float)
-
Scales the weights of
self
byscalar
.Declaration
Swift
public mutating func scale(by scalar: Float)
-
Adds
scalar
to every weight ofself
wherehasValue
has valid weight labels.Declaration
Swift
public mutating func conditionalAdd(_ scalar: Float, where hasValue: `Self`)
-
Sets weights for every label to
other
‘s where the label is not defined inself
, and is defined inother
.Declaration
Swift
public mutating func fillMissingFrom(_ other: `Self`)
-
Merges
other
intoself
by summing weights.Declaration
Swift
public mutating func merge(_ other: `Self`)
-
Adds
rhs
to every defined label’s corresponding weight inlhs
.Declaration
Swift
public static func += (lhs: inout `Self`, rhs: Float)
-
Adds weights for
rhs
intolhs
. If a given label does not have a defined weight inlhs
, but does inrhs
, the label’s weight inlhs
becomes defined withrhs
‘s corresponding weight.Declaration
Swift
public static func += (lhs: inout `Self`, rhs: `Self`)
-
Divide weights in
lhs
by the weights for the corresponding labels inrhs
.Precondition
rhs
must have defined weights for every label defined inlhs
.Declaration
Swift
public static func / (lhs: `Self`, rhs: `Self`) -> SIMDLabelBundle<SIMDType>
-
A string representation of
SIMDLabelBundle
.Declaration
Swift
public var description: String { get }