[swift-evolution] Epic: Typesafe calculations
Stephen Canon
scanon at apple.com
Wed Jan 13 13:16:02 CST 2016
… in exact arithmetic, not in floating-point, which is what people tend to actually use for matrices. For that matter, the entire notion of “invertible” as a binary attribute is problematic when dealing with approximate arithmetic; a matrix may be formally invertible but so ill-conditioned that the result is effectively meaningless.
Not really trying to shoot you down, just observing that this is an extremely subtle example with lots of hidden sharp edges.
– Steve
> On Jan 13, 2016, at 1:19 PM, Matt Whiteside via swift-evolution <swift-evolution at swift.org> wrote:
>
> That was my thinking when I wrote it, but I’m not sure exactly what the limits would be. For example, the product of 2 invertible matrices is an invertible matrix, giving you another way to construct one.
>
> Matt
>
>
>> On Jan 13, 2016, at 09:56, Thorsten Seitz <tseitz42 at icloud.com <mailto:tseitz42 at icloud.com>> wrote:
>>
>>
>> Am 12.01.2016 um 23:49 schrieb Matt Whiteside via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>>:
>>
>>> struct InvertibleMatrix: SquareMatrix where determinant() != 0
>>> // ^~~ 'restriction’ clause, i.e., not inheritance;
>>> // determinant() is executed at compile time,
>>> // since `entries` is a constexpr
>>
>> Wouldn't that only work for literal matrices?
>>
>> -Thorsten
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160113/8ec93789/attachment.html>
More information about the swift-evolution
mailing list