HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_MinimumFinder.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: Minimum finding (C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef _UT_MinimumFinder_h_
13 #define _UT_MinimumFinder_h_
14 
15 #include "UT_API.h"
16 #include "UT_Vector.h"
17 
19 {
20 public:
21  // 1D minimum finders:
22  //
23 
24  // Returns 1 on success.
25  // Assumed a minimum is bracketted by (a,c). Derivitive required.
26  // Values at a/c need not be defined, as they are assume = INFINITY.
27  int brent(void (*func)(float x, float &val, float &der, void *data),
28  void *data,
29  float ax, float bx, float cx,
30  float tol, float &result, float &val, int maxIter=200) const;
31 
32  // Multi-dimensional minimum finders:
33  //
34 
35 
36  //
37  // Gradient is needed. Specify initial guess in result.
38  // [x1,x2] specify the boundary that the func is defined within.
39  // Note func:R^n->R.
40  int frprPCG(void (*func)(const UT_Vector &x, float &val, UT_Vector &grad,
41  void *data), void *data,
42  const UT_Vector &x1, const UT_Vector &x2,
43  float tol,
44  UT_Vector &result, int maxIter=200);
45 
46 private:
47  // Performs line minimization along line defined by dir, starting
48  // at org. Brackets search by (x1, x2). Before being called,
49  // myOrg, myDir, and myScratch must be allocated to the proper
50  // dimmensions.
51  int lineMin(void (*func)(const UT_Vector &x, float &val, UT_Vector &grad,
52  void *data), void *data,
53  const UT_Vector &org, const UT_Vector &dir,
54  const UT_Vector &x1, const UT_Vector &x2,
55  float tol, UT_Vector &result, UT_Vector &displacement,
56  float &val, int maxIter=200);
57 
58 
59  // Variables required to tell evaluateLine how to translate to/from
60  // n-space
61  void (*myFunc)(const UT_Vector &, float &, UT_Vector &, void *);
62  UT_Vector *myOrg, *myDir, *myScratch, *myGrad;
63  void *myData;
64 
65  // Used internally by lineMin to translate request in terms of 1d
66  // line into terms of n-space.
67  friend void evaluateLine(float x, float &val, float &der, void *data);
68 };
69 
70 #endif
void
Definition: png.h:1083
#define UT_API
Definition: UT_API.h:14
**But if you need a result
Definition: thread.h:622
GLdouble GLdouble x2
Definition: glad.h:2349
GLint GLenum GLint x
Definition: glcorearb.h:409
GLenum func
Definition: glcorearb.h:783
GLuint GLfloat * val
Definition: glcorearb.h:1608
Definition: format.h:1821