SIMD3

struct SIMD3

A vector of three scalar values.

Inheritance SIMD, CustomDebugStringConvertible
Associated Types
public typealias MaskStorage = SIMD3<Scalar.SIMDMaskScalar>

Initializers

init init() Required

Creates a vector with zero in all lanes.

Declaration

public init()
init init(_:) Required

Creates a vector from the given sequence.

Precondition: scalars must have the same number of elements as the vector type.

  • Parameter scalars: The elements to use in the vector.

Declaration

@inlinable public init<S>(_ scalars: S) where S: Sequence, Self.Scalar == S.Element
init init(_:_:) Required

A three-element vector created by appending a scalar to a two-element vector.

Declaration

public init(_ xy: SIMD2<Scalar>, _ z: Scalar)
init init(_:_:_:) Required

Creates a new vector from the given elements.

Declaration

public init(_ v0: Scalar, _ v1: Scalar, _ v2: Scalar)
init init(arrayLiteral:) Required

Creates a vector from the specified elements.

  • Parameter scalars: The elements to use in the vector. scalars must have the same number of elements as the vector type.

Declaration

@inlinable public init(arrayLiteral scalars: Self.Scalar)
init init(from:) Required

Creates a new vector by decoding scalars from the given decoder.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

  • Parameter decoder: The decoder to read data from.

Declaration

public init(from decoder: Decoder) throws
init init(repeating:) Required

A vector with the specified value in all lanes.

Declaration

public init(repeating value: Self.Scalar)
init init(x:y:z:) Required

Creates a new vector from the given elements.

Declaration

public init(x: Scalar, y: Scalar, z: Scalar)

Instance Variables

var debugDescription Required

A textual representation of this instance, suitable for debugging.

Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(reflecting:) initializer. This initializer works with any type, and uses the custom debugDescription property for types that conform to CustomDebugStringConvertible:

struct Point: CustomDebugStringConvertible {
    let x: Int, y: Int

    var debugDescription: String {
        return "(\(x), \(y))"
    }
}

let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints "(21, 30)"

The conversion of p to a string in the assignment to s uses the Point type's debugDescription property.

Declaration

var debugDescription: String
var description Required

A textual description of the vector.

Declaration

var description: String
var indices Required

The valid indices for subscripting the vector.

Declaration

var indices: Range<Int>
var scalarCount Required

The number of scalars in the vector.

Declaration

var scalarCount: Int
var x Required

The first element of the vector.

Declaration

var x: Scalar
var y Required

The second element of the vector.

Declaration

var y: Scalar
var z Required

The third element of the vector.

Declaration

var z: Scalar

Subscripts

subscript subscript(index:) Required

Accesses the scalar at the specified position.

Declaration

public subscript(index: Int) -> Scalar
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD2.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD2<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD2<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD3.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD3<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD3<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD4.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD4<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD4<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD8.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD8<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD8<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD16.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD16<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD16<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD32.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD32<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD32<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD64.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD64<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD64<Self.Scalar>

Instance Methods

func encode(to encoder: Encoder) throws Required

Encodes the scalars of this vector into the given encoder in an unkeyed container.

This function throws an error if any values are invalid for the given encoder's format.

  • Parameter encoder: The encoder to write data to.

Declaration

public func encode(to encoder: Encoder) throws
func hash(into hasher: inout Hasher) Required

Hashes the elements of the vector using the given hasher.

Declaration

@inlinable public func hash(into hasher: inout Hasher)
func replace(with other: Self, where mask: SIMDMask<Self.MaskStorage>) Required

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

Declaration

public mutating func replace(with other: Self, where mask: SIMDMask<Self.MaskStorage>)
func replace(with other: Self.Scalar, where mask: SIMDMask<Self.MaskStorage>) Required

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

Declaration

public mutating func replace(with other: Self.Scalar, where mask: SIMDMask<Self.MaskStorage>)
func replacing(with other: Self, where mask: SIMDMask<Self.MaskStorage>) -> Self Required

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

Declaration

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

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

Declaration

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

Type Methods

func .!=(lhs: Self, rhs: Self) -> SIMDMask<Self.MaskStorage> Required

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

Declaration

public static func .!=(lhs: Self, rhs: Self) -> SIMDMask<Self.MaskStorage>
func .!=(lhs: Self.Scalar, rhs: Self) -> SIMDMask<Self.MaskStorage> Required

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

Declaration

public static func .!=(lhs: Self.Scalar, rhs: Self) -> SIMDMask<Self.MaskStorage>
func .!=(lhs: Self, rhs: Self.Scalar) -> SIMDMask<Self.MaskStorage> Required

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

Declaration

public static func .!=(lhs: Self, rhs: Self.Scalar) -> SIMDMask<Self.MaskStorage>
func .==(lhs: Self, rhs: Self) -> SIMDMask<Self.MaskStorage> Required

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

Declaration

public static func .==(lhs: Self, rhs: Self) -> SIMDMask<Self.MaskStorage>
func .==(lhs: Self.Scalar, rhs: Self) -> SIMDMask<Self.MaskStorage> Required

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

Declaration

public static func .==(lhs: Self.Scalar, rhs: Self) -> SIMDMask<Self.MaskStorage>
func .==(lhs: Self, rhs: Self.Scalar) -> SIMDMask<Self.MaskStorage> Required

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

Declaration

public static func .==(lhs: Self, rhs: Self.Scalar) -> SIMDMask<Self.MaskStorage>
func ==(lhs: Self, rhs: Self) -> Bool Required

Returns a Boolean value indicating whether two vectors are equal.

Declaration

public static func ==(lhs: Self, rhs: Self) -> Bool