Isis 3 Developer Reference
BasisFunction.h
Go to the documentation of this file.
1 
23 #ifndef BasisFunction_h
24 #define BasisFunction_h
25 
26 #include <vector>
27 #include <string>
28 
29 #include <QString>
30 
31 namespace Isis {
64  class BasisFunction {
65  public:
66  BasisFunction(const QString &name, int numVars, int numCoefs);
68  virtual ~BasisFunction() {};
69 
70  void SetCoefficients(const std::vector<double> &coefs);
71  double Evaluate(const std::vector<double> &vars);
72  double Evaluate(const double &var);
73  virtual void Expand(const std::vector<double> &vars);
74 
80  int Coefficients() const {
81  return p_numCoefs;
82  };
88  int Variables() const {
89  return p_numVars;
90  };
96  QString Name() const {
97  return p_name;
98  };
113  double Term(int c) const {
114  return p_terms[c];
115  };
123  double Coefficient(int i) const {
124  return p_coefs[i];
125  };
126 
127  protected:
129  QString p_name;
139  std::vector<double> p_coefs;
143  std::vector<double> p_terms;
144 
145  };
146 };
147 
148 #endif
void SetCoefficients(const std::vector< double > &coefs)
Set the coefficients for the equation.
Definition: BasisFunction.cpp:58
int p_numVars
The number of variables in the equation. Call it by using Variables()
Definition: BasisFunction.h:131
QString Name() const
Returns the name of the equation.
Definition: BasisFunction.h:96
BasisFunction(const QString &name, int numVars, int numCoefs)
Creates a BasisFunction object.
Definition: BasisFunction.cpp:45
std::vector< double > p_terms
A vector of the terms in the equation.
Definition: BasisFunction.h:143
std::vector< double > p_coefs
A vector of the coefficients in the equation.
Definition: BasisFunction.h:139
int p_numCoefs
The number of coefficients in the equation.
Definition: BasisFunction.h:135
double Term(int c) const
Returns the cth term.
Definition: BasisFunction.h:113
virtual ~BasisFunction()
Destroys the BasisFunction object.
Definition: BasisFunction.h:68
virtual void Expand(const std::vector< double > &vars)
This is the function you should replace depending on your needs.
Definition: BasisFunction.cpp:139
double Coefficient(int i) const
Returns the ith coefficient.
Definition: BasisFunction.h:123
double Evaluate(const std::vector< double > &vars)
Compute the equation using the input variables.
Definition: BasisFunction.cpp:80
Generic linear equation class.
Definition: BasisFunction.h:64
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
int Variables() const
Returns the number of variables in the equation.
Definition: BasisFunction.h:88
QString p_name
The name of the equation. Call it by using Name()
Definition: BasisFunction.h:125
int Coefficients() const
Returns the number of coefficients for the equation.
Definition: BasisFunction.h:80