16. Implementation Begin iterations := 0 Yes Perform clean-up Compute next object iterations := iterations + 1 No iterations < maximumIterations Compute or choose initial object End No Yes precision < desiredPrecision
17. Methods evaluate finalizeIteration hasConverged evaluateIteration initializeIteration Compute or choose initial object Yes No Compute next object iterations := iterations + 1 Perform clean-up No Yes iterations := 0 iterations < maximumIterations Begin End precision < desiredPrecision
18. Simple example of use | iterativeProcess result | iterativeProcess := <a subclass of IterativeProcess> new. result := iterativeProcess evaluate. iterativeProcess hasConverged ifFalse:[ <special case processing> ].
19. Advanced example of use | iterativeProcess result precision | iterativeProcess := < a subclass of DhbIterativeProcess > new. iterativeProcess desiredPrecision: 1.0e-6; maximumIterations: 25. result := iterativeProcess evaluate. iterativeProcess hasConverged ifTrue: [ Transcript nextPutAll: ‘Result obtained after ‘. iterativeProcess iteration printOn: Transcript. Transcript nextPutAll: ‘iterations. Attained precision is ‘. iterativeProcess precision printOn: Transcript. ] ifFalse:[ Transcript nextPutAll: ‘Process did not converge’]. Transcript cr.
20. Class Diagram IterativeProcess evaluate initializeIteration hasConverged evaluateIteration finalizeIteration precisionOf:relativeTo: desiredPrecision (g,s) maximumIterations (g,s) precision (g) iterations (g) result (g)
21.
22. Example of use | iterativeProcess result | iterativeProcess := <a subclass of FunctionalIterator> function: ( DhbPolynomial new: #(1 2 3). result := iterativeProcess evaluate. iterativeProcess hasConverged ifFalse:[ <special case processing> ].
23. Class Diagram initializeIteration computeInitialValues relativePrecision setFunction: functionBlock (s) FunctionalIterator IterativeProcess value: AbstractFunction
28. Example of use | zeroFinder result | zeroFinder:= DhbNewtonZeroFinder function: [ :x | x errorFunction - 0.9] derivative: [ :x | x normal]. zeroFinder initialValue: 1. result := zeroFinder evaluate. zeroFinder hasConverged ifFalse:[ <special case processing> ].
29. Class Diagram evaluateIteration computeInitialValues (o) defaultDerivativeBlock initialValue: setFunction: (o) NewtonZeroFinder IterativeProcess FunctionalIterator value: AbstractFunction derivativeBlock (s)
47. Example of use | server finder | server := < a subclass of DhbAbstractClusterDataServer > new. finder := DhbClusterFinder new: 15 server: server type: DhbEuclidianMetric. finder evaluate. finder tally
At that time, the radius of the earth was not known exactly. The radius of the circle corresponding to the error quoted by Jamshid Masud (0.7mm) is 20 times larger than the half axis of the orbit of Pluto.
DhbFloatingPointMachine is a class which determines automatically the parameters of the floating point representation on the current machine.
In this talk, only the classes in “pink” boxes will be discussed.
Tasks in green boxes are the responsibility of the subclasses.
Methods “evaluate” and “hasConverged” are methods of the super class. Methods “initializeIterations”, “evaluateIterations” and “finalizeIterations” are the responsibility of the subclasses.
This is the abstract class at the top of the hierarchy of any iterative process. The class diagram shows the class name at top (without prefix), the methods (other than “get” and “set” of instance variables) in the middle and the instance variables at bottom. Instance variables have a corresponding “get” methods when tagged with a “g” and a corresponding “set” method when tagged with a “s”. The code is available in Listing 1.