Algebraic Tools for Exact Geometric Computing I - Exact Arithmetic - - PowerPoint PPT Presentation

algebraic tools for exact geometric computing i exact
SMART_READER_LITE
LIVE PREVIEW

Algebraic Tools for Exact Geometric Computing I - Exact Arithmetic - - PowerPoint PPT Presentation

Algebraic Tools for Exact Geometric Computing I - Exact Arithmetic and Filtering Michael Hemmer School of Computer Science - University of Tel Aviv 2010, Tel Aviv Michael Hemmer Exact Arithmetic and Filtering Outline Motivate Exact


slide-1
SLIDE 1

Algebraic Tools for Exact Geometric Computing I

  • Exact Arithmetic and Filtering

Michael Hemmer

School of Computer Science - University of Tel Aviv

2010, Tel Aviv

Michael Hemmer Exact Arithmetic and Filtering

slide-2
SLIDE 2

Outline

◮ Motivate Exact Computing ◮ Filtered Predicates ◮ Lazy Constructions ◮ CGAL Kernels

Michael Hemmer Exact Arithmetic and Filtering

slide-3
SLIDE 3

Outline

◮ Motivate Exact Computing ◮ Filtered Predicates ◮ Lazy Constructions ◮ CGAL Kernels ◮ leda::real and CORE::Expr

Michael Hemmer Exact Arithmetic and Filtering

slide-4
SLIDE 4

Talk of Kurt Mehlhorn: Classroom Examples

  • f Robustness Problems

in Geometric Computations

Michael Hemmer Exact Arithmetic and Filtering

slide-5
SLIDE 5

Recall Motivation

Geometric algorithms are a mix of

◮ Numerical computation

(Point coordinates, distances, ...)

◮ Combinatorial techniques

(Convex hull, Delaunay Triangulation, ...) ⇒ Small numerical errors can lead to: Inconsistencies, infinite loops, crashes ...

Michael Hemmer Exact Arithmetic and Filtering

slide-6
SLIDE 6

Exact Geometric-Computation Paradigm

Michael Hemmer Exact Arithmetic and Filtering

slide-7
SLIDE 7

Exact Geometric-Computation Paradigm

Ensure correct control flow of algorithm by:

◮ Exact evaluation of geometric predicates

  • functions computing discrete results from numerical input
  • Orientation, Compare xy, ...

Michael Hemmer Exact Arithmetic and Filtering

slide-8
SLIDE 8

Exact Geometric-Computation Paradigm

Ensure correct control flow of algorithm by:

◮ Exact evaluation of geometric predicates

  • functions computing discrete results from numerical input
  • Orientation, Compare xy, ...

◮ Enforces exactness of geometric constructions

  • Intersection, Projection, ...
  • If there are any !

[C. Yap, T. Dub´ e, 1995]

Michael Hemmer Exact Arithmetic and Filtering

slide-9
SLIDE 9

The Easy Solution

Use exact multi-precision arithmetic

◮ integers, rational (e.g. GMP

, CORE, LEDA)

◮ even algebraic numbers (e.g. CORE, LEDA) ◮ exact up to memory limit

Disadvantage: TOO SLOW

Michael Hemmer Exact Arithmetic and Filtering

slide-10
SLIDE 10

The Easy Solution

Use exact multi-precision arithmetic

◮ integers, rational (e.g. GMP

, CORE, LEDA)

◮ even algebraic numbers (e.g. CORE, LEDA) ◮ exact up to memory limit

Disadvantage: TOO SLOW

No solution for transcendental numbers!

Michael Hemmer Exact Arithmetic and Filtering

slide-11
SLIDE 11

Find the Balance !

Requirements of the Real RAM model:

◮ arithmetic operations in constant time ◮ exact computation over the reals

The naive solutions:

◮ constant time floating point arithmetic that fails ◮ exact multi precision arithmetic that is too slow

Michael Hemmer Exact Arithmetic and Filtering

slide-12
SLIDE 12

The Answer are Filters

General filter scheme:

◮ try to compute a certified result fast (usually constant time) ◮ if certification fails may try another filter ◮ if nothing helps, use exact arithmetic

The hope:

◮ require only constant time for easy instances ◮ amortize cost for hard cases that use exact arithmetic

Michael Hemmer Exact Arithmetic and Filtering

slide-13
SLIDE 13

General Idea

General idea for filtered predicate:

◮ For expression E compute approximation ˜

E and bound B, such that |E − ˜ E| B or equivalently: E ∈ I = [˜ E − B, ˜ E + B]

◮ If 0 ∈ I report failure, else return sign(˜

E).

Michael Hemmer Exact Arithmetic and Filtering

slide-14
SLIDE 14

Recall: Floating Point Arithmetic

◮ A double float f uses 64 bits

  • 1 bit for the sign s
  • 52 bits for the mantissa m = m1 . . . m52
  • 11 bits for the exponent e = e1 . . . e11

◮ f = −1s · (1 + 1i52 mi2−i) · 2e−2013, if 0 < e < 211 − 1

. . .

◮ for a ∈ R, let fl(a) be the closest float to a

for a ∈ Z: |a − fl(a)| ε|fl(a)|, where ε = 2−53 for o ∈ {+, −, ×}: |f1of2 − f1˜

  • f2| ε|f1˜
  • f2|

◮ floating point arithmetic is monotone

e.g.: b c ⇒ a ⊕ b a ⊕ c

Michael Hemmer Exact Arithmetic and Filtering

slide-15
SLIDE 15

Computing B

For expression E define dE and mesE recursively: E ˜ E mesE dE a, float fl(a) |fl(a)| a ∈ Z fl(a) |fl(a)| 1 X + Y ˜ X ⊕ ˜ Y |˜ X| ⊕ | ˜ Y| 1 + max(dX, dY) X − Y ˜ X ⊖ ˜ Y |˜ X| ⊕ | ˜ Y| 1 + max(dX, dY) X × Y ˜ X ⊗ ˜ Y |˜ X| ⊗ | ˜ Y| 1 + dX + dY Then B is defined as follows: |E − ˜ E| B = ((1 + ε)dE − 1) · mesE [K. Mehlhorn, S.N¨ aher; LEDA BOOK]

Michael Hemmer Exact Arithmetic and Filtering

slide-16
SLIDE 16

Proof

◮ Monotonicity of floats always guarantees: ˜

E mesE

◮ First two rows are trivial ◮ Lets proof invariant for addition

|˜ E − E| = |(˜ X ⊕ ˜ Y) − (X + Y)|

Michael Hemmer Exact Arithmetic and Filtering

slide-17
SLIDE 17

Proof

◮ Monotonicity of floats always guarantees: ˜

E mesE

◮ First two rows are trivial ◮ Lets proof invariant for addition

|˜ E − E| = |(˜ X ⊕ ˜ Y) − (X + Y)|

  • |(˜

X ⊕ ˜ Y) − (˜ X + ˜ Y)| + |X − ˜ X| + |Y − ˜ Y|

Michael Hemmer Exact Arithmetic and Filtering

slide-18
SLIDE 18

Proof

◮ Monotonicity of floats always guarantees: ˜

E mesE

◮ First two rows are trivial ◮ Lets proof invariant for addition

|˜ E − E| = |(˜ X ⊕ ˜ Y) − (X + Y)|

  • |(˜

X ⊕ ˜ Y) − (˜ X + ˜ Y)| + |X − ˜ X| + |Y − ˜ Y|

  • ε · mesE + |X − ˜

X| + |Y − ˜ Y|

Michael Hemmer Exact Arithmetic and Filtering

slide-19
SLIDE 19

Proof

◮ Monotonicity of floats always guarantees: ˜

E mesE

◮ First two rows are trivial ◮ Lets proof invariant for addition

|˜ E − E| = |(˜ X ⊕ ˜ Y) − (X + Y)|

  • |(˜

X ⊕ ˜ Y) − (˜ X + ˜ Y)| + |X − ˜ X| + |Y − ˜ Y|

  • ε · mesE + |X − ˜

X| + |Y − ˜ Y|

  • ε · mesE + ((1 + ε)dX − 1)mesX + ((1 + ε)dY − 1)mesY

Michael Hemmer Exact Arithmetic and Filtering

slide-20
SLIDE 20

Proof

◮ Monotonicity of floats always guarantees: ˜

E mesE

◮ First two rows are trivial ◮ Lets proof invariant for addition

|˜ E − E| = |(˜ X ⊕ ˜ Y) − (X + Y)|

  • |(˜

X ⊕ ˜ Y) − (˜ X + ˜ Y)| + |X − ˜ X| + |Y − ˜ Y|

  • ε · mesE + |X − ˜

X| + |Y − ˜ Y|

  • ε · mesE + ((1 + ε)dX − 1)mesX + ((1 + ε)dY − 1)mesY
  • ε · mesE + ((1 + ε)max(dX ,dY ) − 1) · mesE

Michael Hemmer Exact Arithmetic and Filtering

slide-21
SLIDE 21

Proof

◮ Monotonicity of floats always guarantees: ˜

E mesE

◮ First two rows are trivial ◮ Lets proof invariant for addition

|˜ E − E| = |(˜ X ⊕ ˜ Y) − (X + Y)|

  • |(˜

X ⊕ ˜ Y) − (˜ X + ˜ Y)| + |X − ˜ X| + |Y − ˜ Y|

  • ε · mesE + |X − ˜

X| + |Y − ˜ Y|

  • ε · mesE + ((1 + ε)dX − 1)mesX + ((1 + ε)dY − 1)mesY
  • ε · mesE + ((1 + ε)max(dX ,dY ) − 1) · mesE
  • ((1 + ε)1+max(dX ,dY ) − 1) · mesE = B

Michael Hemmer Exact Arithmetic and Filtering

slide-22
SLIDE 22

Proof

◮ Monotonicity of floats always guarantees: ˜

E mesE

◮ First two rows are trivial ◮ Lets proof invariant for addition

|˜ E − E| = |(˜ X ⊕ ˜ Y) − (X + Y)|

  • |(˜

X ⊕ ˜ Y) − (˜ X + ˜ Y)| + |X − ˜ X| + |Y − ˜ Y|

  • ε · mesE + |X − ˜

X| + |Y − ˜ Y|

  • ε · mesE + ((1 + ε)dX − 1)mesX + ((1 + ε)dY − 1)mesY
  • ε · mesE + ((1 + ε)max(dX ,dY ) − 1) · mesE
  • ((1 + ε)1+max(dX ,dY ) − 1) · mesE = B

Remark: ((1 + ε)1+dE − 1) ε · (1 + dE), for dE <

  • 1/ε − 1.

Michael Hemmer Exact Arithmetic and Filtering

slide-23
SLIDE 23

Static and Semi-Static Filter

Static Filter:

◮ compute B once for all

Michael Hemmer Exact Arithmetic and Filtering

slide-24
SLIDE 24

Static and Semi-Static Filter

Static Filter:

◮ compute B once for all ⇒ very fast

Michael Hemmer Exact Arithmetic and Filtering

slide-25
SLIDE 25

Static and Semi-Static Filter

Static Filter:

◮ compute B once for all ⇒ very fast ◮ requires an assumption on the range of the input ◮ for many calls this assumption may be to large

Michael Hemmer Exact Arithmetic and Filtering

slide-26
SLIDE 26

Static and Semi-Static Filter

Static Filter:

◮ compute B once for all ⇒ very fast ◮ requires an assumption on the range of the input ◮ for many calls this assumption may be to large

Almost-static filter:

◮ initialize B based on optimistic assumption ◮ adjust B if necessary

Michael Hemmer Exact Arithmetic and Filtering

slide-27
SLIDE 27

Static and Semi-Static Filter

Static Filter:

◮ compute B once for all ⇒ very fast ◮ requires an assumption on the range of the input ◮ for many calls this assumption may be to large

Almost-static filter:

◮ initialize B based on optimistic assumption ◮ adjust B if necessary

Semi-static Filter:

◮ compute B depending on the input of each call

Michael Hemmer Exact Arithmetic and Filtering

slide-28
SLIDE 28

Static and Semi-Static Filter

Static Filter:

◮ compute B once for all ⇒ very fast ◮ requires an assumption on the range of the input ◮ for many calls this assumption may be to large

Almost-static filter:

◮ initialize B based on optimistic assumption ◮ adjust B if necessary

Semi-static Filter:

◮ compute B depending on the input of each call ◮ still fast, since it essentially only doubles the costs

Michael Hemmer Exact Arithmetic and Filtering

slide-29
SLIDE 29

Static and Semi-Static Filter

Static Filter:

◮ compute B once for all ⇒ very fast ◮ requires an assumption on the range of the input ◮ for many calls this assumption may be to large

Almost-static filter:

◮ initialize B based on optimistic assumption ◮ adjust B if necessary

Semi-static Filter:

◮ compute B depending on the input of each call ◮ still fast, since it essentially only doubles the costs

Michael Hemmer Exact Arithmetic and Filtering

slide-30
SLIDE 30

Combine Static and Semi-Static Filter

◮ Compute ˜

E

Michael Hemmer Exact Arithmetic and Filtering

slide-31
SLIDE 31

Combine Static and Semi-Static Filter

◮ Compute ˜

E

◮ try to certify using almost-static B

Michael Hemmer Exact Arithmetic and Filtering

slide-32
SLIDE 32

Combine Static and Semi-Static Filter

◮ Compute ˜

E

◮ try to certify using almost-static B ◮ otherwise compute semi-static B′ and try to certify

Michael Hemmer Exact Arithmetic and Filtering

slide-33
SLIDE 33

Combine Static and Semi-Static Filter

◮ Compute ˜

E

◮ try to certify using almost-static B ◮ otherwise compute semi-static B′ and try to certify

Disadvantage: Still considerable overestimation of error

Michael Hemmer Exact Arithmetic and Filtering

slide-34
SLIDE 34

Combine Static and Semi-Static Filter

◮ Compute ˜

E

◮ try to certify using almost-static B ◮ otherwise compute semi-static B′ and try to certify

Disadvantage: Still considerable overestimation of error Idea: Observe concrete error while computing ˜ E

Michael Hemmer Exact Arithmetic and Filtering

slide-35
SLIDE 35

Interval Arithmetic

For operands x = [x, x] and y = [y, y] set: [x] + [y] := [x + y, x + y] [x] − [y] := [x − y, x − y] [x] · [y] := [min{xy, xy, xy, xy}, max{xy, xy, xy, xy}] [x]/[y] := x · [1/y, 1/y] if 0 ∈ [y] [x]1/2 := [x1/2, x1/2] if 0 [x]

Michael Hemmer Exact Arithmetic and Filtering

slide-36
SLIDE 36

Interval Arithmetic

For operands x = [x, x] and y = [y, y] set: [x] + [y] := [x + y, x + y] [x] − [y] := [x − y, x − y] [x] · [y] := [min{xy, xy, xy, xy}, max{xy, xy, xy, xy}] [x]/[y] := x · [1/y, 1/y] if 0 ∈ [y] [x]1/2 := [x1/2, x1/2] if 0 [x] Round in proper directions for floating point interval arithmetic

Michael Hemmer Exact Arithmetic and Filtering

slide-37
SLIDE 37

Interval Arithmetic

For operands x = [x, x] and y = [y, y] set: [x] + [y] := [x + y, x + y] [x] − [y] := [x − y, x − y] [x] · [y] := [min{xy, xy, xy, xy}, max{xy, xy, xy, xy}] [x]/[y] := x · [1/y, 1/y] if 0 ∈ [y] [x]1/2 := [x1/2, x1/2] if 0 [x] Round in proper directions for floating point interval arithmetic ⇒ Inclusion Property

Michael Hemmer Exact Arithmetic and Filtering

slide-38
SLIDE 38

Dynamic Filter

◮ compute ˜

E = [E] using floating point interval arithmetic

◮ result is certified if 0 ∈ [E] ◮ disadvantage: a bit slower than semi static filter ◮ advantage: better control of the error ⇒ less filter failures

Remark: It is possible to avoid changes in rounding mode △, ▽, e.g.: [x] + [y] := [− △ (−x − y), △(x + y)]

Michael Hemmer Exact Arithmetic and Filtering

slide-39
SLIDE 39

Filter Summary

Three main types: (almost) static filter B is pre-computed as fast as floating point arithmetic very low accuracy semi-static filter B depends on input of each call 2 times slower than floating point still low accuracy dynamic filter compute ˜ E = [E] with interval arithmetic 3-8 times slower than floating point high accuracy

Michael Hemmer Exact Arithmetic and Filtering

slide-40
SLIDE 40

What about geometric constructions ?

Michael Hemmer Exact Arithmetic and Filtering

slide-41
SLIDE 41

What about geometric constructions ?

Michael Hemmer Exact Arithmetic and Filtering

slide-42
SLIDE 42

What about geometric constructions ?

  • rientation 3(a, m, b)?

Michael Hemmer Exact Arithmetic and Filtering

slide-43
SLIDE 43

Delayed / Lazy Constructions

Lazy Number Type

◮ always compute an interval ◮ also store history in a DAG∗ ◮ ⇒ can compute exact if needed

∗DAG = Directed Acyclic Graph

+ : adaptive

  • : time lost in DAG management
  • : high memory consumption

Michael Hemmer Exact Arithmetic and Filtering

slide-44
SLIDE 44

Lazy Kernel

◮ DAG nodes for constructions ◮ DAG nodes for predicates

Michael Hemmer Exact Arithmetic and Filtering

slide-45
SLIDE 45

Lazy Kernel

◮ DAG nodes for constructions ◮ DAG nodes for predicates

+ reduce management cost + reduce memory consumption + reduce rounding mode changes

Michael Hemmer Exact Arithmetic and Filtering

slide-46
SLIDE 46

(Simplified) Overview CGAL Kernel

◮ CGAL::Cartesian<double> : fast but not exact ◮ CGAL::Cartesian< Q > : exact but slow ◮ CGAL::Filtered kernel< K >

  • uses constructions of kernel K
  • dynamic filter for all predicates
  • semi-static filter for some predicates
  • predicates are exact

Predefined kernels:

◮ Exact predicates inexact constructions kernel

= Filtered kernel< Cartesian<double>>

◮ Exact predicates exact constructions kernel

≃ Lazy exact kernel< Cartesian< Q >>

Michael Hemmer Exact Arithmetic and Filtering

slide-47
SLIDE 47

Alternatives to Exact Computation Paradigm

Controlled Perturbation:

◮ Run algorithm on a slightly perturbed input ◮ ensure generic position ◮ reduce arithmetic demand

Topological Consistency

◮ hazard the consequences of inexactness ◮ but ensure consistency ◮ e.g. snap rounding

Michael Hemmer Exact Arithmetic and Filtering

slide-48
SLIDE 48

Exact Expression Evaluation using Separation Bounds LEDA::real and CORE::Expr

Michael Hemmer Exact Arithmetic and Filtering

slide-49
SLIDE 49

Recall Lazy Evaluation

Lazy Number Type

◮ compute double interval first ◮ also store history in a DAG∗

⇒ can compute exact if needed

∗DAG = Directed Acyclic Graph

+ : adaptive

  • : time lost in DAG management
  • : high memory consumption

Michael Hemmer Exact Arithmetic and Filtering

slide-50
SLIDE 50

Possible Variant:

Use multi-precision floating point intervals

◮ try with doubles first ◮ otherwise try with more precision if needed ◮ and so on ...

Michael Hemmer Exact Arithmetic and Filtering

slide-51
SLIDE 51

Possible Variant:

Use multi-precision floating point intervals

◮ try with doubles first ◮ otherwise try with more precision if needed ◮ and so on ... ◮ .. an expression that is zero leads to an infinite loop !

Michael Hemmer Exact Arithmetic and Filtering

slide-52
SLIDE 52

Possible Variant:

Use multi-precision floating point intervals

◮ try with doubles first ◮ otherwise try with more precision if needed ◮ and so on ... ◮ .. an expression that is zero leads to an infinite loop !

Simple solution:

◮ just stop at some high precision

Michael Hemmer Exact Arithmetic and Filtering

slide-53
SLIDE 53

Can we do better ?

Suppose the expression is just made of:

◮ integers (in the leaves of the DAG) ◮ operations: {+,-,*} ◮ Example: E = 23 · 60 · 234 + 634 · 234 · 12 − 87633 · 24

Michael Hemmer Exact Arithmetic and Filtering

slide-54
SLIDE 54

Can we do better ?

Suppose the expression is just made of:

◮ integers (in the leaves of the DAG) ◮ operations: {+,-,*} ◮ Example: E = 23 · 60 · 234 + 634 · 234 · 12 − 87633 · 24

Yes we can !

◮ The value of E must be an integer (val(E) ∈ Z)

⇒ Compute interval I with increasing precision until:

◮ 0 ∈ I: return sign(I); ◮ I ∩ Z = {0}: return 0; Michael Hemmer Exact Arithmetic and Filtering

slide-55
SLIDE 55

Can we do better ?

Suppose the expression is just made of:

◮ integers (in the leaves of the DAG) ◮ operations: {+,-,*} ◮ Example: E = 23 · 60 · 234 + 634 · 234 · 12 − 87633 · 24

Or in other words:

◮ 0 is separated from all other possible values by 1,

the separation bound of E, sep(E) = 1

◮ The process stops once the width of I is less than 1,

∆(I) < 1 = sep(E)

Michael Hemmer Exact Arithmetic and Filtering

slide-56
SLIDE 56

Extend set of operations by

k

√·

Definition

An algebraic integer is a root of a polynomial with integer coefficients and leading coefficient one. It follows that this is also the case for its minimal polynomial. Example: X 2 − 2 = (X − √ 2)(X + √ 2) or X k − a Remark I: An integer is an algebraic integer.

Michael Hemmer Exact Arithmetic and Filtering

slide-57
SLIDE 57

Remark II: Algebraic integers are closed under op ∈ {+, −, ∗} For algebraic integers α and β consider the minimal polynomials:

◮ PA(X) = X n + n−1 i=0 aiX i = n i=1(X − αi) ∈ Z[X] ◮ PB(X) = X m + m−1 j=0 bjX i = m j=1(X − βj) ∈ Z[X],

where α is a root of PA(X) and β is a root of PB(X). The result of α op β, with op ∈ {+, −, ∗} is the root of PA op B(X) =

n

  • i=1

m

  • j=1

(X − (αi op βj)) ∈ Z[X], which is a monic polynomial of degree n · m.

(*) The αi are the algebraic conjugates of α. (**) The degree of PA(X) is the algebraic degree of α.

Michael Hemmer Exact Arithmetic and Filtering

slide-58
SLIDE 58

Lemma

Let α be an algebraic integer and let deg(α) be its algebraic

  • degree. If U > 0 is an upper bound on the absolute values of all

algebraic conjugates of α, then |α| 1/Udeg(α)−1.

Proof.

Consider the minimal polynomial Pα = n

i=1(X − αi) ∈ Z[X].

The constant coefficient is n

i=1 αi which is at least one, since it

is in Z. ⇒ |α| · Udeg(α)−1 1

Michael Hemmer Exact Arithmetic and Filtering

slide-59
SLIDE 59

We obtain algebraic integers by expressions that are made of:

◮ integers (in the leaves of the DAG) ◮ operations: {+,-,*, k

√·} An upper bound on the

◮ algebraic degree, D(E), is the product of all occurring k. ◮ the absolute value of the algebraic conjugates, U(E), is

given by the following recursive table: E U(E) n ∈ Z |n| X ± Y U(X) + U(Y) X · Y U(X) · U(Y)

k

√ X

k

  • U(X)

⇒ 1/U(E)D(E)−1 val(E) U(E) or val(E) = 0

Michael Hemmer Exact Arithmetic and Filtering

slide-60
SLIDE 60

Introducing devisions Devision destroys algebraic integer property ! ⇒ Treat numerator and denominator separately An Ad ± Bn Bd ⇒ AnBd ± BnAd AdBd , . . . ,

k

  • An

Ad ⇒

k

  • AnAk−1

d

Ad we obtain the following table: E Un(E) Ud(E) n ∈ Z |n| 1 X ± Y Un(X)Ud(Y) + Un(Y)Ud(X) Ud(X)Ud(Y) X · Y Un(X) · Un(Y) Ud(X) · Ud(Y) X/Y Un(X) · Ud(Y) Ud(X) · Un(Y)

k

√ X

k

  • Un(X)Uk−1

d

Ud(X) ⇒ 1/(Ud(E)Un(E)D(E)−1) val(E) Un(E)Ud(E)D(E)−1

  • r val(E) = 0

Michael Hemmer Exact Arithmetic and Filtering

slide-61
SLIDE 61

Final Remarks

◮ leda::real and CORE::Expr are essentially the same ◮ both also allow to define a value as the root of a polynomial

Michael Hemmer Exact Arithmetic and Filtering

slide-62
SLIDE 62

Final Remarks

◮ leda::real and CORE::Expr are essentially the same ◮ both also allow to define a value as the root of a polynomial

Advantages & Disadvantages + : Allow cascaded constructions + : Lazy evaluation

  • : time lost in DAG management
  • : high memory consumption

Michael Hemmer Exact Arithmetic and Filtering

slide-63
SLIDE 63

Final Remarks

◮ leda::real and CORE::Expr are essentially the same ◮ both also allow to define a value as the root of a polynomial

Advantages & Disadvantages + : Allow cascaded constructions + : Lazy evaluation

  • : time lost in DAG management
  • : high memory consumption

General guidelines:

◮ never use them as your main type ◮ try to produce balanced expressions ◮ try to simplify expressions ◮ do you realy need to use √· ? ◮ avoid unnecessary test against zero

Michael Hemmer Exact Arithmetic and Filtering

slide-64
SLIDE 64

References:

◮ www.mpi-inf.mpg.de/departments/d1/ClassroomExamples/ ◮ www-sop.inria.fr/members/Sylvain.Pion/publications/ ◮ LEDA Book

Michael Hemmer Exact Arithmetic and Filtering

slide-65
SLIDE 65

Thank You !

Michael Hemmer Exact Arithmetic and Filtering

slide-66
SLIDE 66

Ahhh... before I forget

Michael Hemmer Exact Arithmetic and Filtering

slide-67
SLIDE 67

Ahhh... before I forget Danny asked me to prepare some assignments for you...

Michael Hemmer Exact Arithmetic and Filtering

slide-68
SLIDE 68

Ahhh... before I forget Danny asked me to prepare some assignments for you... ... and – DISCLOSED – even kindly reminded me .-)

Michael Hemmer Exact Arithmetic and Filtering

slide-69
SLIDE 69

Assignments I

◮ Have a look at the program in fp scope.tgz, which

demonstrates failures of the orientation predicate when using floating point arithmetic.

◮ Modify point coordinates such that you obtain other

interesting pictures.

◮ ∗ write a demonstrator for another geometric predicate,

such as InCircle.

◮ Compute the Delaunay triangulation of a cloud of random

points with double coordinates.

◮ Argue which CGAL Kernel one should choose. ◮ Write a small program that compares the performance of

three different kernels.

◮ See http://www.cgal.org/Manual/latest/doc_

html/cgal_manual/contents.html for examples to start from.

Michael Hemmer Exact Arithmetic and Filtering

slide-70
SLIDE 70

Assignments II

◮ Provide a static bound for the expression:

(ax − cx)(by − cy) − (bx − cx)(by − cy)

◮ Proof the remark:

((1 + ε)1+dE − 1) ε · (1 + dE), for dE <

  • 1/ε − 1.

Michael Hemmer Exact Arithmetic and Filtering

slide-71
SLIDE 71

Thank You !

Michael Hemmer Exact Arithmetic and Filtering