@@ -13,12 +13,14 @@ class SimSIMDTests: XCTestCase {
13
13
XCTAssertEqual ( result, 0.00012027938 , accuracy: 0.01 )
14
14
}
15
15
16
+ #if !arch(x86_64)
16
17
func testCosineFloat16( ) throws {
17
18
let a : [ Float16 ] = [ 1.0 , 2.0 , 3.0 ]
18
19
let b : [ Float16 ] = [ 1.0 , 2.0 , 3.0 ]
19
20
let result = try XCTUnwrap ( a. cosine ( b) )
20
21
XCTAssertEqual ( result, 0.004930496 , accuracy: 0.01 )
21
22
}
23
+ #endif
22
24
23
25
func testCosineFloat32( ) throws {
24
26
let a : [ Float32 ] = [ 1.0 , 2.0 , 3.0 ]
@@ -41,12 +43,14 @@ class SimSIMDTests: XCTestCase {
41
43
XCTAssertEqual ( result, 32.0 , accuracy: 0.01 )
42
44
}
43
45
46
+ #if !arch(x86_64)
44
47
func testDotFloat16( ) throws {
45
48
let a : [ Float16 ] = [ 1.0 , 2.0 , 3.0 ]
46
49
let b : [ Float16 ] = [ 4.0 , 5.0 , 6.0 ]
47
50
let result = try XCTUnwrap ( a. dot ( b) )
48
51
XCTAssertEqual ( result, 32.0 , accuracy: 0.01 )
49
52
}
53
+ #endif
50
54
51
55
func testDotFloat32( ) throws {
52
56
let a : [ Float32 ] = [ 1.0 , 2.0 , 3.0 ]
@@ -62,19 +66,51 @@ class SimSIMDTests: XCTestCase {
62
66
XCTAssertEqual ( result, 32.0 , accuracy: 0.01 )
63
67
}
64
68
69
+ func testEuclideanInt8( ) throws {
70
+ let a : [ Int8 ] = [ 1 , 2 , 3 ]
71
+ let b : [ Int8 ] = [ 4 , 5 , 6 ]
72
+ let result = try XCTUnwrap ( a. euclidean ( b) )
73
+ XCTAssertEqual ( result, 5.196152422706632 , accuracy: 0.01 )
74
+ }
75
+
76
+ #if !arch(x86_64)
77
+ func testEuclideanFloat16( ) throws {
78
+ let a : [ Float16 ] = [ 1.0 , 2.0 , 3.0 ]
79
+ let b : [ Float16 ] = [ 4.0 , 5.0 , 6.0 ]
80
+ let result = try XCTUnwrap ( a. euclidean ( b) )
81
+ XCTAssertEqual ( result, 5.196152422706632 , accuracy: 0.01 )
82
+ }
83
+ #endif
84
+
85
+ func testEuclideanFloat32( ) throws {
86
+ let a : [ Float32 ] = [ 1.0 , 2.0 , 3.0 ]
87
+ let b : [ Float32 ] = [ 4.0 , 5.0 , 6.0 ]
88
+ let result = try XCTUnwrap ( a. euclidean ( b) )
89
+ XCTAssertEqual ( result, 5.196152422706632 , accuracy: 0.01 )
90
+ }
91
+
92
+ func testEuclideanFloat64( ) throws {
93
+ let a : [ Float64 ] = [ 1.0 , 2.0 , 3.0 ]
94
+ let b : [ Float64 ] = [ 4.0 , 5.0 , 6.0 ]
95
+ let result = try XCTUnwrap ( a. euclidean ( b) )
96
+ XCTAssertEqual ( result, 5.196152422706632 , accuracy: 0.01 )
97
+ }
98
+
65
99
func testSqeuclideanInt8( ) throws {
66
100
let a : [ Int8 ] = [ 1 , 2 , 3 ]
67
101
let b : [ Int8 ] = [ 4 , 5 , 6 ]
68
102
let result = try XCTUnwrap ( a. sqeuclidean ( b) )
69
103
XCTAssertEqual ( result, 27.0 , accuracy: 0.01 )
70
104
}
71
105
106
+ #if !arch(x86_64)
72
107
func testSqeuclideanFloat16( ) throws {
73
108
let a : [ Float16 ] = [ 1.0 , 2.0 , 3.0 ]
74
109
let b : [ Float16 ] = [ 4.0 , 5.0 , 6.0 ]
75
110
let result = try XCTUnwrap ( a. sqeuclidean ( b) )
76
111
XCTAssertEqual ( result, 27.0 , accuracy: 0.01 )
77
112
}
113
+ #endif
78
114
79
115
func testSqeuclideanFloat32( ) throws {
80
116
let a : [ Float32 ] = [ 1.0 , 2.0 , 3.0 ]
0 commit comments