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
SIMDLabelBundlewith uninitialized weights for all labels in the bundle.Declaration
Swift
public init() -
Constructs a
SIMDLabelBundlewith providedweightsandvalidWeightsMask.Declaration
Swift
public init(weights: SIMDType, validWeightsMask: SIMDType.MaskStorage)Parameters
weightsa vector of weights to be assigned to each label.
validWeightsMaska 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
SIMDLabelBundlewith 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
weightsa 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
SIMDLabelBundlewithvalueset for each label’s weight.All labels are determined to have valid values.
Declaration
Swift
public init(repeating value: Float) -
Scales the weights of
selfbyscalar.Declaration
Swift
public mutating func scale(by scalar: Float) -
Adds
scalarto every weight ofselfwherehasValuehas 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
otherintoselfby summing weights.Declaration
Swift
public mutating func merge(_ other: `Self`) -
Adds
rhsto every defined label’s corresponding weight inlhs.Declaration
Swift
public static func += (lhs: inout `Self`, rhs: Float) -
Adds weights for
rhsintolhs. If a given label does not have a defined weight inlhs, but does inrhs, the label’s weight inlhsbecomes defined withrhs‘s corresponding weight.Declaration
Swift
public static func += (lhs: inout `Self`, rhs: `Self`) -
Divide weights in
lhsby the weights for the corresponding labels inrhs.Precondition
rhsmust 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 }
View on GitHub
SIMDLabelBundle Structure Reference