HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_ScatteredInterpRBF.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: GU_ScatteredInterpRBF.h (GU Library, C++)
7 *
8 * COMMENTS: Each column is an example, one value for each DOF.
9 * Each row is a DOF, one value for each example.
10 */
11 
12 #ifndef __GU_SCATTEREDINTERPRBF_H__
13 #define __GU_SCATTEREDINTERPRBF_H__
14 
15 #include "GU_API.h"
16 #include <SYS/SYS_Types.h>
17 #include <UT/UT_Functor.h>
18 
19 #include "GU_LeastSquares.h"
20 #include "GU_ScatteredInterp.h"
21 
23 {
24 public:
26  : myNumDOF(-1),
27  myNumExamples(-1),
28  myNumInputDimensions(-1)
29  {
30  }
31 
33  {
34  }
35 
36  struct Parms
37  {
40 
41  // rbf kernel params
43  bool theHyperplane; //for rbf
44  bool theMaximizeHyperplane; //for rbf
45  int theExp; //for thinplate rbf
46  fpreal theFalloff; //for gaussian, multiquadric, inverse-multiquadric, and exponential bump
47  bool thePositiveWeights; //for interpolate examples
48 
49  // LeastSquares solver parms
53 
55  : theClampInput(false),
56  theFormulationType(GU_SCATTERED_INTERP_AUTO),
57  theHyperplane(false),
58  theMaximizeHyperplane(false),
59  theKernelType(GU_KERNEL_GAUSSIAN),
60  theExp(0),
61  theFalloff(0.0),
62  thePositiveWeights(false),
63  theSolverType(GU_FAST_LEAST_SQUARES),
64  theDamping(0.0),
65  theMaxIterations(0)
66  {
67  }
68  };
69 
70  bool solveForCoefficients(
71  const Eigen::Matrix<fpreal, Eigen::Dynamic, Eigen::Dynamic> &source, bool source_changed,
72  const Parms &params);
73 
74  bool solveForCoefficients(
75  const Eigen::Matrix<fpreal, Eigen::Dynamic, Eigen::Dynamic> &source, bool source_changed,
76  const Eigen::Matrix<fpreal, Eigen::Dynamic, Eigen::Dynamic> &target, bool target_changed,
77  const Parms &params);
78 
79  template <typename U>
80  typename std::enable_if<GU_Matrix<U>::has_row, void>::type
81  computeOutput(
82  const Eigen::Matrix<fpreal, Eigen::Dynamic, Eigen::Dynamic> &input,
83  const Eigen::Matrix<fpreal, Eigen::Dynamic, Eigen::Dynamic> &source,
84  const Eigen::Matrix<fpreal, Eigen::Dynamic, Eigen::Dynamic> &target,
85  U *output_data);
86 
87 private:
88  typedef UT_Functor1<fpreal, fpreal> EvalFunctor1;
89 
90  bool hasChanged(
91  const Eigen::Matrix<fpreal, Eigen::Dynamic, Eigen::Dynamic> &source,
92  const Eigen::Matrix<fpreal, Eigen::Dynamic, Eigen::Dynamic> &target,
93  const Parms &parms) const;
94 
95  Eigen::Matrix<fpreal, Eigen::Dynamic, Eigen::Dynamic> myRadialCoefficients;
96  Eigen::Matrix<fpreal, Eigen::Dynamic, Eigen::Dynamic> myLinearCoefficients;
97  Eigen::Matrix<fpreal, Eigen::Dynamic, 1> mySourceMin;
98  Eigen::Matrix<fpreal, Eigen::Dynamic, 1> mySourceMax;
99  EvalFunctor1 myRadialKernel;
100 
101  // Cached params
102  int myNumDOF;
103  int myNumExamples;
104  int myNumInputDimensions;
105  Parms myParms;
106 };
107 
108 #include "GU_ScatteredInterpRBFImpl.h"
109 
110 #endif // __GU_SCATTEREDINTERPRBF_H__
GLenum GLenum GLenum input
Definition: glew.h:13879
GU_FAST_LEAST_SQUARES
GLenum target
Definition: glew.h:2865
GU_SCATTERED_INTERP_AUTO
GLsizei GLsizei GLchar * source
Definition: glew.h:1832
enum GU_API GU_LeastSquaresSolverType
GU_KERNEL_GAUSSIAN
#define GU_API
Definition: GU_API.h:14
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
GU_LeastSquaresSolverType theSolverType
GU_ScatteredInterpType theFormulationType
double fpreal
Definition: SYS_Types.h:276
enum GU_API GU_RadialBasisKernelType
enum GU_API GU_ScatteredInterpType
const GLfloat * params
Definition: glew.h:1531
GU_RadialBasisKernelType theKernelType