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 provided weights and validWeightsMask.

    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 provided weights.

    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 with value 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 by scalar.

    Declaration

    Swift

    public mutating func scale(by scalar: Float)
  • Adds scalar to every weight of self where hasValue 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 in self, and is defined in other.

    Declaration

    Swift

    public mutating func fillMissingFrom(_ other: `Self`)
  • Merges other into self by summing weights.

    Declaration

    Swift

    public mutating func merge(_ other: `Self`)
  • Adds rhs to every defined label’s corresponding weight in lhs.

    Declaration

    Swift

    public static func += (lhs: inout `Self`, rhs: Float)
  • Adds weights for rhs into lhs. If a given label does not have a defined weight in lhs, but does in rhs, the label’s weight in lhs becomes defined with rhs‘s corresponding weight.

    Declaration

    Swift

    public static func += (lhs: inout `Self`, rhs: `Self`)
  • Divide weights in lhs by the weights for the corresponding labels in rhs.

    Precondition

    rhs must have defined weights for every label defined in lhs.

    Declaration

    Swift

    public static func / (lhs: `Self`, rhs: `Self`) -> SIMDLabelBundle<SIMDType>
  • A string representation of SIMDLabelBundle.

    Declaration

    Swift

    public var description: String { get }