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 public:
20  // 1D minimum finders:
21  //
22 
23  // Returns 1 on success.
24  // Assumed a minimum is bracketted by (a,c). Derivitive required.
25  // Values at a/c need not be defined, as they are assume = INFINITY.
26  int brent(void (*func)(float x, float &val, float &der, void *data),
27  void *data,
28  float ax, float bx, float cx,
29  float tol, float &result, float &val, int maxIter=200) const;
30 
31  // Multi-dimensional minimum finders:
32  //
33 
34 
35  //
36  // Gradient is needed. Specify initial guess in result.
37  // [x1,x2] specify the boundary that the func is defined within.
38  // Note func:R^n->R.
39  int frprPCG(void (*func)(const UT_Vector &x, float &val, UT_Vector &grad,
40  void *data), void *data,
41  const UT_Vector &x1, const UT_Vector &x2,
42  float tol,
43  UT_Vector &result, int maxIter=200);
44 
45 private:
46  // Performs line minimization along line defined by dir, starting
47  // at org. Brackets search by (x1, x2). Before being called,
48  // myOrg, myDir, and myScratch must be allocated to the proper
49  // dimmensions.
50  int lineMin(void (*func)(const UT_Vector &x, float &val, UT_Vector &grad,
51  void *data), void *data,
52  const UT_Vector &org, const UT_Vector &dir,
53  const UT_Vector &x1, const UT_Vector &x2,
54  float tol, UT_Vector &result, UT_Vector &displacement,
55  float &val, int maxIter=200);
56 
57 
58  // Variables required to tell evaluateLine how to translate to/from
59  // n-space
60  void (*myFunc)(const UT_Vector &, float &, UT_Vector &, void *);
61  UT_Vector *myOrg, *myDir, *myScratch, *myGrad;
62  void *myData;
63 
64  // Used internally by lineMin to translate request in terms of 1d
65  // line into terms of n-space.
66  friend void evaluateLine(float x, float &val, float &der, void *data);
67 };
68 
69 #endif
void
Definition: png.h:1083
#define UT_API
Definition: UT_API.h:14
**But if you need a result
Definition: thread.h:613
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:895