Documentation ¶
Overview ¶
SIMD support via Go assembly for arithmetic and bitwise operations. Allowing for parallel element-wise computations.
Index ¶
- func AddFloat32(left, right, result []float32) int
- func AddFloat64(left, right, result []float64) int
- func AddInt32(left, right, result []int32) int
- func AddInt64(left, right, result []int64) int
- func AndInt32(left, right, result []int32) int
- func AndInt64(left, right, result []int64) int
- func DivFloat32(left, right, result []float32) int
- func DivFloat64(left, right, result []float64) int
- func DivInt32(left, right, result []int32) int
- func DivInt64(left, right, result []int64) int
- func MulFloat32(left, right, result []float32) int
- func MulFloat64(left, right, result []float64) int
- func MulInt32(left, right, result []int32) int
- func MulInt64(left, right, result []int64) int
- func OrInt32(left, right, result []int32) int
- func OrInt64(left, right, result []int64) int
- func SubFloat32(left, right, result []float32) int
- func SubFloat64(left, right, result []float64) int
- func SubInt32(left, right, result []int32) int
- func SubInt64(left, right, result []int64) int
- func XorInt32(left, right, result []int32) int
- func XorInt64(left, right, result []int64) int
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFloat32 ¶
AddFloat32 performs element-wise addition on left and right, storing the sums in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []float32{1, 9, 2, 8} right := []float32{3, 7, 4, 6, 5} result := []float32{0, 0, 0, 0, 0, 0} length := AddFloat32(left, right, result) fmt.Print(length, result)
Output: 4 [4 16 6 14 0 0]
func AddFloat64 ¶
AddFloat64 performs element-wise addition on left and right, storing the sums in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []float64{1, 9, 2, 8} right := []float64{3, 7, 4, 6, 5} result := []float64{0, 0, 0, 0, 0, 0} length := AddFloat64(left, right, result) fmt.Print(length, result)
Output: 4 [4 16 6 14 0 0]
func AddInt32 ¶
AddInt32 performs element-wise addition on left and right, storing the sums in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int32{1, 9, 2, 8} right := []int32{3, 7, 4, 6, 5} result := []int32{0, 0, 0, 0, 0, 0} length := AddInt32(left, right, result) fmt.Print(length, result)
Output: 4 [4 16 6 14 0 0]
func AddInt64 ¶
AddInt64 performs element-wise addition on left and right, storing the sums in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int64{1, 9, 2, 8} right := []int64{3, 7, 4, 6, 5} result := []int64{0, 0, 0, 0, 0, 0} length := AddInt64(left, right, result) fmt.Print(length, result)
Output: 4 [4 16 6 14 0 0]
func AndInt32 ¶
AndInt32 performs element-wise AND on left and right, storing the results in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int32{1, 9, 2, 8} right := []int32{3, 7, 4, 6, 5} result := []int32{0, 0, 0, 0, 0, 0} length := AndInt32(left, right, result) fmt.Print(length, result)
Output: 4 [1 1 0 0 0 0]
func AndInt64 ¶
AndInt64 performs element-wise AND on left and right, storing the results in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int64{1, 9, 2, 8} right := []int64{3, 7, 4, 6, 5} result := []int64{0, 0, 0, 0, 0, 0} length := AndInt64(left, right, result) fmt.Print(length, result)
Output: 4 [1 1 0 0 0 0]
func DivFloat32 ¶
DivFloat32 performs element-wise division on left and right, storing the quotients in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []float32{1, 9, 2, 8} right := []float32{3, 7, 4, 6, 5} result := []float32{0, 0, 0, 0, 0, 0} length := DivFloat32(left, right, result) fmt.Print(length, result)
Output: 4 [0.33333334 1.2857143 0.5 1.3333334 0 0]
func DivFloat64 ¶
DivFloat64 performs element-wise division on left and right, storing the quotients in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []float64{1, 9, 2, 8} right := []float64{3, 7, 4, 6, 5} result := []float64{0, 0, 0, 0, 0, 0} length := DivFloat64(left, right, result) fmt.Print(length, result)
Output: 4 [0.3333333333333333 1.2857142857142858 0.5 1.3333333333333333 0 0]
func DivInt32 ¶
DivInt32 performs element-wise division on left and right, storing the quotients in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int32{1, 9, 2, 8} right := []int32{3, 7, 4, 6, 5} result := []int32{0, 0, 0, 0, 0, 0} length := DivInt32(left, right, result) fmt.Print(length, result)
Output: 4 [0 1 0 1 0 0]
func DivInt64 ¶
DivInt64 performs element-wise division on left and right, storing the quotients in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int64{1, 9, 2, 8} right := []int64{3, 7, 4, 6, 5} result := []int64{0, 0, 0, 0, 0, 0} length := DivInt64(left, right, result) fmt.Print(length, result)
Output: 4 [0 1 0 1 0 0]
func MulFloat32 ¶
MulFloat32 performs element-wise multiplication on left and right, storing the products in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
func MulFloat64 ¶
MulFloat64 performs element-wise multiplication on left and right, storing the products in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
func MulInt32 ¶
MulInt32 performs element-wise multiplication on left and right, storing the products in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
func MulInt64 ¶
MulInt64 performs element-wise multiplication on left and right, storing the products in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
func OrInt32 ¶
OrInt32 performs element-wise OR on left and right, storing the results in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int32{1, 9, 2, 8} right := []int32{3, 7, 4, 6, 5} result := []int32{0, 0, 0, 0, 0, 0} length := OrInt32(left, right, result) fmt.Print(length, result)
Output: 4 [3 15 6 14 0 0]
func OrInt64 ¶
OrInt64 performs element-wise OR on left and right, storing the results in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int64{1, 9, 2, 8} right := []int64{3, 7, 4, 6, 5} result := []int64{0, 0, 0, 0, 0, 0} length := OrInt64(left, right, result) fmt.Print(length, result)
Output: 4 [3 15 6 14 0 0]
func SubFloat32 ¶
SubFloat32 performs element-wise subtraction on left and right, storing the differences in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []float32{1, 9, 2, 8} right := []float32{3, 7, 4, 6, 5} result := []float32{0, 0, 0, 0, 0, 0} length := SubFloat32(left, right, result) fmt.Print(length, result)
Output: 4 [-2 2 -2 2 0 0]
func SubFloat64 ¶
SubFloat64 performs element-wise subtraction on left and right, storing the differences in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []float64{1, 9, 2, 8} right := []float64{3, 7, 4, 6, 5} result := []float64{0, 0, 0, 0, 0, 0} length := SubFloat64(left, right, result) fmt.Print(length, result)
Output: 4 [-2 2 -2 2 0 0]
func SubInt32 ¶
SubInt32 performs element-wise subtraction on left and right, storing the differences in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int32{1, 9, 2, 8} right := []int32{3, 7, 4, 6, 5} result := []int32{0, 0, 0, 0, 0, 0} length := SubInt32(left, right, result) fmt.Print(length, result)
Output: 4 [-2 2 -2 2 0 0]
func SubInt64 ¶
SubInt64 performs element-wise subtraction on left and right, storing the differences in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int64{1, 9, 2, 8} right := []int64{3, 7, 4, 6, 5} result := []int64{0, 0, 0, 0, 0, 0} length := SubInt64(left, right, result) fmt.Print(length, result)
Output: 4 [-2 2 -2 2 0 0]
func XorInt32 ¶
XorInt32 performs element-wise XOR on left and right, storing the results in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int32{1, 9, 2, 8} right := []int32{3, 7, 4, 6, 5} result := []int32{0, 0, 0, 0, 0, 0} length := XorInt32(left, right, result) fmt.Print(length, result)
Output: 4 [2 14 6 14 0 0]
func XorInt64 ¶
XorInt64 performs element-wise XOR on left and right, storing the results in result. The operation is performed up to the shortest length of left, right, and result. Returns the number of operations performed.
Example ¶
left := []int64{1, 9, 2, 8} right := []int64{3, 7, 4, 6, 5} result := []int64{0, 0, 0, 0, 0, 0} length := XorInt64(left, right, result) fmt.Print(length, result)
Output: 4 [2 14 6 14 0 0]
Types ¶
This section is empty.