Skip to content

Commit 9a28a6d

Browse files
committed
Revert to *
`*` was once changed to `⊗` because Swift for TensorFlow used `⊗`. After that, however, Swift for TensorFlow quitted to use `⊗`. Although Swift for TensorFlow still avoids to use `*` for matmul, CGPointVector reverted `⊗` to `*` temporarily because of the following reasons: 1. CGPointVector had used `*` for matmul until 0.2.0 and `*` is familiar to users 2. APIs of Swift for TensorFlow are unstable and it is inappropriate to follow them for the moment 3. simd uses `*` for matmul
1 parent c904164 commit 9a28a6d

File tree

13 files changed

+29
-41
lines changed

13 files changed

+29
-41
lines changed

CGPointVector.xcodeproj/project.pbxproj

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545
D62C6E0C1FB5658C00E7DF02 /* CGPointVectorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62C6DDF1FB5657000E7DF02 /* CGPointVectorTests.swift */; };
4646
D62C6E0D1FB5658C00E7DF02 /* CGRectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62C6DE01FB5657000E7DF02 /* CGRectTests.swift */; };
4747
D62C6E0E1FB5658C00E7DF02 /* CGSizeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62C6DE11FB5657000E7DF02 /* CGSizeTests.swift */; };
48-
D63F165820DB574100F8B479 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63F165720DB574100F8B479 /* Operators.swift */; };
49-
D63F165920DB574100F8B479 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63F165720DB574100F8B479 /* Operators.swift */; };
50-
D63F165A20DB574100F8B479 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63F165720DB574100F8B479 /* Operators.swift */; };
51-
D63F165B20DB574100F8B479 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63F165720DB574100F8B479 /* Operators.swift */; };
5248
D63F165D20DB641300F8B479 /* CGVector.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63F165C20DB641300F8B479 /* CGVector.swift */; };
5349
D63F165E20DB641300F8B479 /* CGVector.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63F165C20DB641300F8B479 /* CGVector.swift */; };
5450
D63F165F20DB641300F8B479 /* CGVector.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63F165C20DB641300F8B479 /* CGVector.swift */; };
@@ -102,7 +98,6 @@
10298
D62C6DE91FB5657000E7DF02 /* CGRect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGRect.swift; sourceTree = "<group>"; };
10399
D62C6DEA1FB5657000E7DF02 /* CGSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGSize.swift; sourceTree = "<group>"; };
104100
D62C6DEB1FB5657000E7DF02 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
105-
D63F165720DB574100F8B479 /* Operators.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = "<group>"; };
106101
D63F165C20DB641300F8B479 /* CGVector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGVector.swift; sourceTree = "<group>"; };
107102
D63F166120DB64CE00F8B479 /* CGVectorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGVectorTests.swift; sourceTree = "<group>"; };
108103
/* End PBXFileReference section */
@@ -226,7 +221,6 @@
226221
D62C6DEA1FB5657000E7DF02 /* CGSize.swift */,
227222
D63F165C20DB641300F8B479 /* CGVector.swift */,
228223
D62C6DEB1FB5657000E7DF02 /* Info.plist */,
229-
D63F165720DB574100F8B479 /* Operators.swift */,
230224
);
231225
path = CGPointVector;
232226
sourceTree = "<group>";
@@ -523,7 +517,6 @@
523517
buildActionMask = 2147483647;
524518
files = (
525519
D62C6DF01FB5657900E7DF02 /* CGSize.swift in Sources */,
526-
D63F165820DB574100F8B479 /* Operators.swift in Sources */,
527520
D63F165D20DB641300F8B479 /* CGVector.swift in Sources */,
528521
D62C6DED1FB5657900E7DF02 /* CGPoint.swift in Sources */,
529522
D62C6DEF1FB5657900E7DF02 /* CGRect.swift in Sources */,
@@ -549,7 +542,6 @@
549542
buildActionMask = 2147483647;
550543
files = (
551544
D62C6DF51FB5657A00E7DF02 /* CGSize.swift in Sources */,
552-
D63F165920DB574100F8B479 /* Operators.swift in Sources */,
553545
D63F165E20DB641300F8B479 /* CGVector.swift in Sources */,
554546
D62C6DF21FB5657A00E7DF02 /* CGPoint.swift in Sources */,
555547
D62C6DF41FB5657A00E7DF02 /* CGRect.swift in Sources */,
@@ -575,7 +567,6 @@
575567
buildActionMask = 2147483647;
576568
files = (
577569
D62C6DFA1FB5657A00E7DF02 /* CGSize.swift in Sources */,
578-
D63F165A20DB574100F8B479 /* Operators.swift in Sources */,
579570
D63F165F20DB641300F8B479 /* CGVector.swift in Sources */,
580571
D62C6DF71FB5657A00E7DF02 /* CGPoint.swift in Sources */,
581572
D62C6DF91FB5657A00E7DF02 /* CGRect.swift in Sources */,
@@ -601,7 +592,6 @@
601592
buildActionMask = 2147483647;
602593
files = (
603594
D62C6DFF1FB5657B00E7DF02 /* CGSize.swift in Sources */,
604-
D63F165B20DB574100F8B479 /* Operators.swift in Sources */,
605595
D63F166020DB641300F8B479 /* CGVector.swift in Sources */,
606596
D62C6DFC1FB5657B00E7DF02 /* CGPoint.swift in Sources */,
607597
D62C6DFE1FB5657B00E7DF02 /* CGRect.swift in Sources */,

Sources/CGPointVector/CGAffineTransform.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ extension CGAffineTransform: CustomStringConvertible {
1313
}
1414

1515
extension CGAffineTransform {
16-
public static func (lhs: CGAffineTransform, rhs: CGAffineTransform) -> CGAffineTransform {
16+
public static func * (lhs: CGAffineTransform, rhs: CGAffineTransform) -> CGAffineTransform {
1717
return lhs.concatenating(rhs)
1818
}
1919

20-
public static func = (lhs: inout CGAffineTransform, rhs: CGAffineTransform) {
21-
lhs = lhs rhs
20+
public static func *= (lhs: inout CGAffineTransform, rhs: CGAffineTransform) {
21+
lhs = lhs * rhs
2222
}
2323

24-
public static func (lhs: CGAffineTransform, rhs: CGPoint) -> CGPoint {
24+
public static func * (lhs: CGAffineTransform, rhs: CGPoint) -> CGPoint {
2525
return rhs.applying(lhs)
2626
}
2727
}

Sources/CGPointVector/CGPoint.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ extension CGPoint {
8686
return CGPoint(x: lhs.x / rhs, y: lhs.y / rhs)
8787
}
8888

89-
public static func (lhs: CGPoint, rhs: CGAffineTransform) -> CGPoint {
89+
public static func * (lhs: CGPoint, rhs: CGAffineTransform) -> CGPoint {
9090
return lhs.applying(rhs)
9191
}
9292

@@ -114,8 +114,8 @@ extension CGPoint {
114114
lhs = lhs / rhs
115115
}
116116

117-
public static func = (lhs: inout CGPoint, rhs: CGAffineTransform) {
118-
lhs = lhs rhs
117+
public static func *= (lhs: inout CGPoint, rhs: CGAffineTransform) {
118+
lhs = lhs * rhs
119119
}
120120
}
121121

Sources/CGPointVector/CGRect.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ extension CGRect: CustomStringConvertible {
2020
}
2121

2222
extension CGRect {
23-
public static func (lhs: CGRect, rhs: CGAffineTransform) -> CGRect {
23+
public static func * (lhs: CGRect, rhs: CGAffineTransform) -> CGRect {
2424
return lhs.applying(rhs)
2525
}
2626

27-
public static func = (lhs: inout CGRect, rhs: CGAffineTransform) {
28-
lhs = lhs rhs
27+
public static func *= (lhs: inout CGRect, rhs: CGAffineTransform) {
28+
lhs = lhs * rhs
2929
}
3030
}

Sources/CGPointVector/CGSize.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ extension CGSize {
8686
return CGSize(width: lhs.width / rhs, height: lhs.height / rhs)
8787
}
8888

89-
public static func (lhs: CGSize, rhs: CGAffineTransform) -> CGSize {
89+
public static func * (lhs: CGSize, rhs: CGAffineTransform) -> CGSize {
9090
return lhs.applying(rhs)
9191
}
9292

@@ -114,8 +114,8 @@ extension CGSize {
114114
lhs = lhs / rhs
115115
}
116116

117-
public static func = (lhs: inout CGSize, rhs: CGAffineTransform) {
118-
lhs = lhs rhs
117+
public static func *= (lhs: inout CGSize, rhs: CGAffineTransform) {
118+
lhs = lhs * rhs
119119
}
120120
}
121121

Sources/CGPointVector/CGVector.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ extension CGVector {
8686
return CGVector(dx: lhs.dx / rhs, dy: lhs.dy / rhs)
8787
}
8888

89-
public static func (lhs: CGVector, rhs: CGAffineTransform) -> CGVector {
89+
public static func * (lhs: CGVector, rhs: CGAffineTransform) -> CGVector {
9090
let point = CGPoint(x: lhs.dx, y: lhs.dy).applying(rhs)
9191
return CGVector(dx: point.x, dy: point.y)
9292
}
@@ -115,8 +115,8 @@ extension CGVector {
115115
lhs = lhs / rhs
116116
}
117117

118-
public static func = (lhs: inout CGVector, rhs: CGAffineTransform) {
119-
lhs = lhs rhs
118+
public static func *= (lhs: inout CGVector, rhs: CGAffineTransform) {
119+
lhs = lhs * rhs
120120
}
121121
}
122122

Sources/CGPointVector/Operators.swift

Lines changed: 0 additions & 2 deletions
This file was deleted.

Tests/CGPointVectorTests/CGAffineTransformTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ class CGAffineTransormTests: XCTestCase {
6565
}
6666

6767
func testMatmul() {
68-
XCTAssertTrue((CGAffineTransform(a: 1, b: 2, c: 3, d: 4, tx: 5, ty: 6) CGAffineTransform(a: 6, b: 5, c: 4, d: 3, tx: 2, ty: 1))
68+
XCTAssertTrue((CGAffineTransform(a: 1, b: 2, c: 3, d: 4, tx: 5, ty: 6) * CGAffineTransform(a: 6, b: 5, c: 4, d: 3, tx: 2, ty: 1))
6969
.isNearlyEqual(to: CGAffineTransform(a: 14, b: 11, c: 34, d: 27, tx: 56, ty: 44), epsilon: torelance))
70-
XCTAssertTrue((CGAffineTransform(translationX: 1.0, y: -2.0) CGPoint(x: 1.0, y: 1.0))
70+
XCTAssertTrue((CGAffineTransform(translationX: 1.0, y: -2.0) * CGPoint(x: 1.0, y: 1.0))
7171
.isNearlyEqual(to: CGPoint(x: 2.0, y: -1.0), epsilon: torelance))
7272
}
7373

7474
func testMatmulAssignment() {
7575
var a = CGAffineTransform(a: 1, b: 2, c: 3, d: 4, tx: 5, ty: 6)
76-
a = CGAffineTransform(a: 6, b: 5, c: 4, d: 3, tx: 2, ty: 1)
76+
a *= CGAffineTransform(a: 6, b: 5, c: 4, d: 3, tx: 2, ty: 1)
7777
print(a)
7878

7979
XCTAssertTrue(a.isNearlyEqual(to: CGAffineTransform(a: 1, b: 2, c: 3, d: 4, tx: 5, ty: 6)
80-
CGAffineTransform(a: 6, b: 5, c: 4, d: 3, tx: 2, ty: 1), epsilon: torelance))
80+
* CGAffineTransform(a: 6, b: 5, c: 4, d: 3, tx: 2, ty: 1), epsilon: torelance))
8181
}
8282

8383
static var allTests : [(String, (CGAffineTransormTests) -> () throws -> Void)] {

Tests/CGPointVectorTests/CGPointTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class CGPointTests: XCTestCase {
8888
}
8989

9090
func testMatmul() {
91-
XCTAssertTrue((CGPoint(x: 1.0, y: 1.0) CGAffineTransform(rotationAngle: CGFloat.pi / 4))
91+
XCTAssertTrue((CGPoint(x: 1.0, y: 1.0) * CGAffineTransform(rotationAngle: CGFloat.pi / 4))
9292
.isNearlyEqual(to: CGPoint(x: 0.0, y: sqrt(2)), epsilon: torelance))
9393
}
9494

@@ -120,7 +120,7 @@ class CGPointTests: XCTestCase {
120120

121121
func testMatmulAssignment() {
122122
var a = CGPoint(x: 1.0, y: 1.0)
123-
a = CGAffineTransform(rotationAngle: CGFloat.pi / 4)
123+
a *= CGAffineTransform(rotationAngle: CGFloat.pi / 4)
124124
XCTAssertTrue(a.isNearlyEqual(to: CGPoint(x: 0.0, y: sqrt(2)), epsilon: torelance))
125125
}
126126

Tests/CGPointVectorTests/CGPointVectorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CGPointVectorTests: XCTestCase {
1010
let sum = a + b // (-2.0, 7.0)
1111
let distance = (b - a).length // 5.0
1212
let direction = (b - a).unit // (-0.8, 0.6)
13-
let rotated = a CGAffineTransform(rotationAngle: CGFloat.pi / 2) // (-2.0, 1.0)
13+
let rotated = a * CGAffineTransform(rotationAngle: CGFloat.pi / 2) // (-2.0, 1.0)
1414

1515
/**/ XCTAssertTrue(sum.isNearlyEqual(to: CGPoint(x: -2.0, y: 7.0), epsilon: torelance))
1616
/**/ XCTAssertEqual(distance, 5.0, accuracy: torelance)

0 commit comments

Comments
 (0)