|
(*@) :: Affine -> Affine -> AffineMonad Affine |
|
(*@) Empty _ = return Empty |
|
(*@) _ Empty = return Empty |
|
(*@) RealLine _ = return RealLine |
|
(*@) _ RealLine = return RealLine |
|
(*@) x@(Affine cx _) y@(Affine cy _) = do |
|
let rx = radius x |
|
let ry = radius y |
|
let δ = rx *↑ ry |
|
let p = (Interval.make cx cx) *! (Interval.make cy cy) |
|
let δ' = δ +↑ (Interval.radius p) |
|
aζ <- makeFreshAffine (-(Interval.midpoint p)) [] |
|
aδ <- makeFreshAffine δ' [] |
|
a1 <- cy ·@ x |
|
a2 <- cx ·@ y |
|
a3 <- a1 +@ a2 |
|
a4 <- a3 +@ aζ |
|
a5 <- a4 +@ aδ |
|
return a5 |
Hi,
as I understand from this piece of code, for two affines
x = x0 + x1 . e1
y = y0 + y1 . e2
their multiplication are calculated as:
z = x0y0 + y0x0 - x0y0 + y0x1e1 + x0y1e2 + |x1||y1|
= (x0y0 + |x1||y1|) + y0x1e1 + x0y1e2
But by reading Stolffi reference, it should be:
z = x0y0 + y0x1e1 + x0y1e2 + |x1||y1|e3
In my tests your implementation seems to lead to more accurate results. Do you have any reference for that?
levitate/src/Affine.hs
Lines 226 to 244 in 8dfcf39
Hi,
as I understand from this piece of code, for two affines
their multiplication are calculated as:
But by reading Stolffi reference, it should be:
In my tests your implementation seems to lead to more accurate results. Do you have any reference for that?