Protocol

SIMD

A SIMD vector of a fixed number of elements.

Declaration

protocol SIMD

Topics

Associated Types

associatedtype MaskStorage

The mask type resulting from pointwise comparisons of this vector type.

Required.

Initializers

init<S>(S)

Creates a vector from the given sequence.

init(repeating: Self.Scalar)

A vector with the specified value in all lanes.

Instance Properties

var indices: Range<Int>

The valid indices for subscripting the vector.

var leadingZeroBitCount: Self
var nonzeroBitCount: Self
var trailingZeroBitCount: Self

Type Properties

static var one: Self

A vector with one in all lanes.

static var one: Self

A vector with one in all lanes.

static var zero: Self

A vector with zero in all lanes.

static var zero: Self

A vector with zero in all lanes.

Instance Methods

func addProduct(Self.Scalar, Self)
func addProduct(Self, Self.Scalar)
func addProduct(Self, Self)
func addingProduct(Self.Scalar, Self) -> Self
func addingProduct(Self, Self.Scalar) -> Self
func addingProduct(Self, Self) -> Self
func clamp(lowerBound: Self, upperBound: Self)
func clamp(lowerBound: Self, upperBound: Self)
func clamped(lowerBound: Self, upperBound: Self) -> Self
func clamped(lowerBound: Self, upperBound: Self) -> Self
func formSquareRoot()
func max() -> Self.Scalar

Returns the greatest scalar in the vector.

func max() -> Self.Scalar

The greatest element in the vector.

func min() -> Self.Scalar

Returns the least scalar in the vector.

func min() -> Self.Scalar

The least element in the vector.

func replace(with: Self.Scalar, where: SIMDMask<Self.MaskStorage>)

Replaces elements of this vector with other in the lanes where mask is true.

func replace(with: Self, where: SIMDMask<Self.MaskStorage>)

Replaces elements of this vector with elements of other in the lanes where mask is true.

func replacing(with: Self.Scalar, where: SIMDMask<Self.MaskStorage>) -> Self

Returns a copy of this vector, with elements other in the lanes where mask is true.

func replacing(with: Self, where: SIMDMask<Self.MaskStorage>) -> Self

Returns a copy of this vector, with elements replaced by elements of other in the lanes where mask is true.

func round(FloatingPointRoundingRule)
func rounded(FloatingPointRoundingRule) -> Self
func squareRoot() -> Self
func sum() -> Self.Scalar

Returns the sum of the scalars in the vector.

func wrappedSum() -> Self.Scalar

Returns the sum of the scalars in the vector, computed with wrapping addition.

Type Methods

static func random(in: ClosedRange<Self.Scalar>) -> Self

Returns a vector with random values from within the specified range in all lanes.

static func random(in: Range<Self.Scalar>) -> Self

Returns a vector with random values from within the specified range in all lanes.

static func random(in: ClosedRange<Self.Scalar>) -> Self

Returns a vector with random values from within the specified range in all lanes.

static func random(in: Range<Self.Scalar>) -> Self

Returns a vector with random values from within the specified range in all lanes.

static func random<T>(in: ClosedRange<Self.Scalar>, using: inout T) -> Self

Returns a vector with random values from within the specified range in all lanes, using the given generator as a source for randomness.

static func random<T>(in: Range<Self.Scalar>, using: inout T) -> Self

Returns a vector with random values from within the specified range in all lanes, using the given generator as a source for randomness.

static func random<T>(in: ClosedRange<Self.Scalar>, using: inout T) -> Self

Returns a vector with random values from within the specified range in all lanes, using the given generator as a source for randomness.

static func random<T>(in: Range<Self.Scalar>, using: inout T) -> Self

Returns a vector with random values from within the specified range in all lanes, using the given generator as a source for randomness.

Operator Functions

static func % (Self.Scalar, Self) -> Self
static func % (Self, Self.Scalar) -> Self
static func % (Self, Self) -> Self
static func %= (inout Self, Self.Scalar)
static func %= (inout Self, Self)
static func & (Self.Scalar, Self) -> Self
static func & (Self, Self.Scalar) -> Self
static func & (Self, Self) -> Self
static func &* (Self.Scalar, Self) -> Self
static func &* (Self, Self.Scalar) -> Self
static func &* (Self, Self) -> Self
static func &*= (inout Self, Self.Scalar)
static func &*= (inout Self, Self)
static func &+ (Self.Scalar, Self) -> Self
static func &+ (Self, Self.Scalar) -> Self
static func &+ (Self, Self) -> Self
static func &+= (inout Self, Self.Scalar)
static func &+= (inout Self, Self)
static func &- (Self.Scalar, Self) -> Self
static func &- (Self, Self.Scalar) -> Self
static func &- (Self, Self) -> Self
static func &-= (inout Self, Self.Scalar)
static func &-= (inout Self, Self)
static func &<< (Self.Scalar, Self) -> Self
static func &<< (Self, Self.Scalar) -> Self
static func &<< (Self, Self) -> Self
static func &<<= (inout Self, Self.Scalar)
static func &<<= (inout Self, Self)
static func &= (inout Self, Self.Scalar)
static func &= (inout Self, Self)
static func &>> (Self.Scalar, Self) -> Self
static func &>> (Self, Self.Scalar) -> Self
static func &>> (Self, Self) -> Self
static func &>>= (inout Self, Self.Scalar)
static func &>>= (inout Self, Self)
static func * (Self.Scalar, Self) -> Self
static func * (Self, Self.Scalar) -> Self
static func * (Self, Self) -> Self
static func *= (inout Self, Self.Scalar)
static func *= (inout Self, Self)
static func + (Self.Scalar, Self) -> Self
static func + (Self, Self.Scalar) -> Self
static func + (Self, Self) -> Self
static func += (inout Self, Self.Scalar)
static func += (inout Self, Self)
static func += (inout Self, Self)
Beta
static func - (Self) -> Self
static func - (Self) -> Self
Deprecated
static func - (Self.Scalar, Self) -> Self
static func - (Self, Self.Scalar) -> Self
static func - (Self, Self) -> Self
static func -= (inout Self, Self.Scalar)
static func -= (inout Self, Self)
static func -= (inout Self, Self)
Beta
static func .!= (Self.Scalar, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise inequality comparison.

static func .!= (Self, Self.Scalar) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise inequality comparison.

static func .!= (Self, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise inequality comparison.

static func .< (Self.Scalar, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise less than comparison.

static func .< (Self, Self.Scalar) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise less than comparison.

static func .< (Self, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise less than comparison.

static func .<= (Self.Scalar, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise less than or equal comparison.

static func .<= (Self, Self.Scalar) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise less than or equal comparison.

static func .<= (Self, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise less than or equal comparison.

static func .== (Self.Scalar, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise equality comparison.

static func .== (Self, Self.Scalar) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise equality comparison.

static func .== (Self, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise equality comparison.

static func .> (Self.Scalar, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise greater than comparison.

static func .> (Self, Self.Scalar) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise greater than comparison.

static func .> (Self, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise greater than comparison.

static func .>= (Self.Scalar, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise greater than or equal comparison.

static func .>= (Self, Self.Scalar) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise greater than or equal comparison.

static func .>= (Self, Self) -> SIMDMask<Self.MaskStorage>

Returns a vector mask with the result of a pointwise greater than or equal comparison.

static func / (Self.Scalar, Self) -> Self
static func / (Self, Self.Scalar) -> Self
static func / (Self, Self) -> Self
static func / (Self.Scalar, Self) -> Self
static func / (Self, Self.Scalar) -> Self
static func / (Self, Self) -> Self
static func /= (inout Self, Self.Scalar)
static func /= (inout Self, Self)
static func /= (inout Self, Self.Scalar)
static func /= (inout Self, Self)
static func == (Self, Self) -> Bool

Returns a Boolean value indicating whether two vectors are equal.

static func ^ (Self.Scalar, Self) -> Self
static func ^ (Self, Self.Scalar) -> Self
static func ^ (Self, Self) -> Self
static func ^= (inout Self, Self.Scalar)
static func ^= (inout Self, Self)
static func | (Self.Scalar, Self) -> Self
static func | (Self, Self.Scalar) -> Self
static func | (Self, Self) -> Self
static func |= (inout Self, Self.Scalar)
static func |= (inout Self, Self)
static func ~ (Self) -> Self

See Also

Supporting Types

protocol SIMDScalar

A type that can be used as an element in a SIMD vector.

protocol SIMDStorage

A type that can function as storage for a SIMD vector type.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software