Coder Social home page Coder Social logo

kevinclancy / levitate Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 10 KB

Utilities for verified floating-point computation in Haskell: Controlled rounding, interval arithmetic, and affine arithmetic.

Haskell 67.90% C 32.10%
affine-arithmetic interval-arithmetic haskell

levitate's Issues

Question about multiplication

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.