Protocolswift 6.0.1Swift
SIMD
A SIMD vector of a fixed number of elements.
protocol SIMD<Scalar> : CustomStringConvertible, Decodable, Encodable, ExpressibleByArrayLiteral, Hashable, SIMDStorage
Supertypes
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByArrayLiteral
A type that can be initialized using an array literal.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol SIMDStorage
A type that can function as storage for a SIMD vector type.
Requirements
Type members
associatedtype MaskStorage
The mask type resulting from pointwise comparisons of this vector type.
Citizens in Swift
Type members
init<S>(S
) Creates a vector from the given sequence.
init(arrayLiteral: Self.Scalar...
) Creates a vector from the specified elements.
init(from: any Decoder
) throws Creates a new vector by decoding scalars from the given decoder.
init(repeating: Self.Scalar
) A vector with the specified value in all lanes.
static func .!= (a: Self.Scalar, b: Self
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise inequality comparison.
static func .!= (a: Self, b: Self.Scalar
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise inequality comparison.
static func .!= (a: Self, b: Self
) -> SIMDMask<Self.MaskStorage> A vector mask with the result of a pointwise inequality comparison.
static func .== (a: Self.Scalar, b: Self
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise equality comparison.
static func .== (a: Self, b: Self.Scalar
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise equality comparison.
static func .== (a: Self, b: Self
) -> SIMDMask<Self.MaskStorage> A vector mask with the result of a pointwise equality comparison.
static func == (a: Self, b: Self
) -> Bool Returns a Boolean value indicating whether two vectors are equal.
Instance members
var description: String
A textual description of the vector.
var indices: Range<Int>
The valid indices for subscripting the vector.
subscript<Index>(SIMD2<Index>
) -> SIMD2<Self.Scalar> Extracts the scalars at specified indices to form a SIMD2.
subscript<Index>(SIMD3<Index>
) -> SIMD3<Self.Scalar> Extracts the scalars at specified indices to form a SIMD3.
subscript<Index>(SIMD4<Index>
) -> SIMD4<Self.Scalar> Extracts the scalars at specified indices to form a SIMD4.
subscript<Index>(SIMD8<Index>
) -> SIMD8<Self.Scalar> Extracts the scalars at specified indices to form a SIMD8.
subscript<Index>(SIMD16<Index>
) -> SIMD16<Self.Scalar> Extracts the scalars at specified indices to form a SIMD16.
subscript<Index>(SIMD32<Index>
) -> SIMD32<Self.Scalar> Extracts the scalars at specified indices to form a SIMD32.
subscript<Index>(SIMD64<Index>
) -> SIMD64<Self.Scalar> Extracts the scalars at specified indices to form a SIMD64.
func encode(to: any Encoder
) throws Encodes the scalars of this vector into the given encoder in an unkeyed container.
func hash(into: inout Hasher
) Hashes the elements of the vector using the given hasher.
func replace(with: Self.Scalar, where: SIMDMask<Self.MaskStorage>
) Replaces elements of this vector with
other
in the lanes wheremask
istrue
.func replace(with: Self, where: SIMDMask<Self.MaskStorage>
) Replaces elements of this vector with elements of
other
in the lanes wheremask
istrue
.func replacing(with: Self.Scalar, where: SIMDMask<Self.MaskStorage>
) -> Self Returns a copy of this vector, with elements
other
in the lanes wheremask
istrue
.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 wheremask
istrue
.
Citizens in Swift
where Self:AdditiveArithmetic, Self.Scalar:FloatingPoint
Type members
Citizens in Swift
where Self.Scalar:BinaryFloatingPoint, Self.Scalar.RawSignificand:FixedWidthInteger
Type members
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.
Citizens in Swift
where Self.Scalar:FloatingPoint
Type members
static var one: Self
A vector with one in all lanes.
static var zero: Self
A vector with zero in all lanes.
static func * (a: Self.Scalar, b: Self
) -> Self static func * (a: Self, b: Self.Scalar
) -> Self static func * (a: Self, b: Self
) -> Self static func *= (a: inout Self, b: Self.Scalar
) static func *= (a: inout Self, b: Self
) static func + (a: Self.Scalar, b: Self
) -> Self static func + (a: Self, b: Self.Scalar
) -> Self static func + (a: Self, b: Self
) -> Self static func += (a: inout Self, b: Self.Scalar
) static func += (a: inout Self, b: Self
) static func - (a: Self
) -> Self static func - (a: Self.Scalar, b: Self
) -> Self static func - (a: Self, b: Self.Scalar
) -> Self static func - (a: Self, b: Self
) -> Self static func -= (a: inout Self, b: Self.Scalar
) static func -= (a: inout Self, b: Self
) static func / (a: Self.Scalar, b: Self
) -> Self static func / (a: Self, b: Self.Scalar
) -> Self static func / (a: Self, b: Self
) -> Self static func /= (a: inout Self, b: Self.Scalar
) static func /= (a: inout Self, b: Self
)
Instance members
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 clamped(lowerBound: Self, upperBound: Self
) -> Self func formSquareRoot(
) func max(
) -> Self.Scalar The greatest scalar in the vector.
func min(
) -> Self.Scalar The least scalar in the vector.
func round(FloatingPointRoundingRule
) func rounded(FloatingPointRoundingRule
) -> Self A vector formed by rounding each lane of the source vector to an integral value according to the specified rounding
rule
.func squareRoot(
) -> Self func sum(
) -> Self.Scalar The sum of the scalars in the vector.
Citizens in Swift
where Self.Scalar:Comparable
Type members
static func .< (a: Self.Scalar, b: Self
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise less than comparison.
static func .< (a: Self, b: Self.Scalar
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise less than comparison.
static func .< (a: Self, b: Self
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise less than comparison.
static func .<= (a: Self.Scalar, b: Self
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise less than or equal comparison.
static func .<= (a: Self, b: Self.Scalar
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise less than or equal comparison.
static func .<= (a: Self, b: Self
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise less than or equal comparison.
static func .> (a: Self.Scalar, b: Self
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise greater than comparison.
static func .> (a: Self, b: Self.Scalar
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise greater than comparison.
static func .> (a: Self, b: Self
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise greater than comparison.
static func .>= (a: Self.Scalar, b: Self
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise greater than or equal comparison.
static func .>= (a: Self, b: Self.Scalar
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise greater than or equal comparison.
static func .>= (a: Self, b: Self
) -> SIMDMask<Self.MaskStorage> Returns a vector mask with the result of a pointwise greater than or equal comparison.
Instance members
func clamp(lowerBound: Self, upperBound: Self
) func clamped(lowerBound: Self, upperBound: Self
) -> Self func max(
) -> Self.Scalar The greatest element in the vector.
func min(
) -> Self.Scalar The least element in the vector.
Citizens in Swift
where Self.Scalar:FixedWidthInteger
Type members
static var one: Self
A vector with one in all lanes.
static var zero: Self
A vector with zero 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 % (a: Self.Scalar, b: Self
) -> Self static func % (a: Self, b: Self.Scalar
) -> Self static func % (a: Self, b: Self
) -> Self static func %= (a: inout Self, b: Self.Scalar
) static func %= (a: inout Self, b: Self
) static func & (a: Self.Scalar, b: Self
) -> Self static func & (a: Self, b: Self.Scalar
) -> Self static func & (a: Self, b: Self
) -> Self static func &* (a: Self.Scalar, b: Self
) -> Self static func &* (a: Self, b: Self.Scalar
) -> Self static func &* (a: Self, b: Self
) -> Self static func &*= (a: inout Self, b: Self.Scalar
) static func &*= (a: inout Self, b: Self
) static func &+ (a: Self.Scalar, b: Self
) -> Self static func &+ (a: Self, b: Self.Scalar
) -> Self static func &+ (a: Self, b: Self
) -> Self static func &+= (a: inout Self, b: Self.Scalar
) static func &+= (a: inout Self, b: Self
) static func &- (a: Self.Scalar, b: Self
) -> Self static func &- (a: Self, b: Self.Scalar
) -> Self static func &- (a: Self, b: Self
) -> Self static func &-= (a: inout Self, b: Self.Scalar
) static func &-= (a: inout Self, b: Self
) static func &<< (a: Self.Scalar, b: Self
) -> Self static func &<< (a: Self, b: Self.Scalar
) -> Self static func &<< (a: Self, b: Self
) -> Self static func &<<= (a: inout Self, b: Self.Scalar
) static func &<<= (a: inout Self, b: Self
) static func &= (a: inout Self, b: Self.Scalar
) static func &= (a: inout Self, b: Self
) static func &>> (a: Self.Scalar, b: Self
) -> Self static func &>> (a: Self, b: Self.Scalar
) -> Self static func &>> (a: Self, b: Self
) -> Self static func &>>= (a: inout Self, b: Self.Scalar
) static func &>>= (a: inout Self, b: Self
) static func / (a: Self.Scalar, b: Self
) -> Self static func / (a: Self, b: Self.Scalar
) -> Self static func / (a: Self, b: Self
) -> Self static func /= (a: inout Self, b: Self.Scalar
) static func /= (a: inout Self, b: Self
) static func ^ (a: Self.Scalar, b: Self
) -> Self static func ^ (a: Self, b: Self.Scalar
) -> Self static func ^ (a: Self, b: Self
) -> Self static func ^= (a: inout Self, b: Self.Scalar
) static func ^= (a: inout Self, b: Self
) static func | (a: Self.Scalar, b: Self
) -> Self static func | (a: Self, b: Self.Scalar
) -> Self static func | (a: Self, b: Self
) -> Self static func |= (a: inout Self, b: Self.Scalar
) static func |= (a: inout Self, b: Self
) static func ~ (a: Self
) -> Self
Instance members
var leadingZeroBitCount: Self
var nonzeroBitCount: Self
var trailingZeroBitCount: Self
func wrappedSum(
) -> Self.Scalar Returns the sum of the scalars in the vector, computed with wrapping addition.