-
Notifications
You must be signed in to change notification settings - Fork 137
Conform Tensor
to PointwiseMultiplicative
.
#297
Conform Tensor
to PointwiseMultiplicative
.
#297
Conversation
ad05147
to
f861b3f
Compare
f861b3f
to
bdb0913
Compare
swiftlang/swift#25772 has been merged, so this PR can be merged once CI gets a new toolchain. |
@dan-zheng Why did you add a reciprocal but not a |
|
Good question. We decided not to add a division operator for mathematical reasons. My understanding:
Adding a default implementation ( |
The goal shouldn't be to model the exact algebraic structure, but to make these APIs practically useful. Division is by definition multiplication with multiplicative inverse, so it should be added as a default implementation at least. The reason we want to add a protocol requirement (aka. customization point) is that
I think this is a different problem. What In short, this protocol is a prototype that shouldn't be taken super seriously. Ideally, we want to be able to use |
This is indeed a pain, but it's a compiler limitation/bug. Derived conformances are supposed to use each field's protocol requirement to implement the corresponding parent type's protocol requirement. The derived conformances code path isn't able trigger this automatically yet AFAIK. |
Friend PR: swiftlang/swift#25772