Skip to content

Question about multiplication #1

@folivetti

Description

@folivetti

levitate/src/Affine.hs

Lines 226 to 244 in 8dfcf39

(*@) :: 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)
<- makeFreshAffine (-(Interval.midpoint p)) []
<- makeFreshAffine δ' []
a1 <- cy ·@ x
a2 <- cx ·@ y
a3 <- a1 +@ a2
a4 <- a3 +@
a5 <- a4 +@
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions