1 -- Created on: 1991-05-14
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
24 class BracketMinimum from math
25 ---Purpose:Given two distinct initial points, BracketMinimum
26 -- implements the computation of three points (a, b, c) which
27 -- bracket the minimum of the function and verify A less than
28 -- B, B less than C and F(A) less than F(B), F(B) less than (C).
29 uses Vector from math,
34 raises NotDone from StdFail
39 Create(F: in out Function; A, B: Real)
41 -- Given two initial values this class computes a
42 -- bracketing triplet of abscissae Ax, Bx, Cx
43 -- (such that Bx is between Ax and Cx, F(Bx) is
44 -- less than both F(Bx) and F(Cx)) the Brent minimization is done
47 returns BracketMinimum;
49 Create(F: in out Function; A, B, FA: Real)
51 -- Given two initial values this class computes a
52 -- bracketing triplet of abscissae Ax, Bx, Cx
53 -- (such that Bx is between Ax and Cx, F(Bx) is
54 -- less than both F(Bx) and F(Cx)) the Brent minimization is done
56 -- This constructor has to be used if F(A) is known.
58 returns BracketMinimum;
61 Create(F: in out Function; A, B, FA, FB: Real)
63 -- Given two initial values this class computes a
64 -- bracketing triplet of abscissae Ax, Bx, Cx
65 -- (such that Bx is between Ax and Cx, F(Bx) is
66 -- less than both F(Bx) and F(Cx)) the Brent minimization is done
68 -- This constructor has to be used if F(A) and F(B) are known.
70 returns BracketMinimum;
73 Perform(me: in out; F: in out Function; A, B: Real)
74 ---Purpose: Is used internally by the constructors.
80 ---Purpose: Returns true if the computations are successful, otherwise returns false.
86 Values(me; A, B, C: out Real)
87 ---Purpose: Returns the bracketed triplet of abscissae.
89 -- StdFail_NotDone if the algorithm fails (and IsDone returns false).
96 FunctionValues(me; FA, FB, FC: out Real)
97 ---Purpose: returns the bracketed triplet function values.
99 -- StdFail_NotDone if the algorithm fails (and IsDone returns false).
105 Dump(me; o: in out OStream)
106 ---Purpose: Prints on the stream o information on the current state
108 -- Is used to redefine the operator <<.