Isis Developer Reference
BasisFunction.h
Go to the documentation of this file.
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #ifndef BasisFunction_h
8 #define BasisFunction_h
9 
10 #include <vector>
11 #include <string>
12 
13 #include <QString>
14 
15 namespace Isis {
48  class BasisFunction {
49  public:
50  BasisFunction(const QString &name, int numVars, int numCoefs);
52  virtual ~BasisFunction() {};
53 
54  void SetCoefficients(const std::vector<double> &coefs);
55  double Evaluate(const std::vector<double> &vars);
56  double Evaluate(const double &var);
57  virtual void Expand(const std::vector<double> &vars);
58 
64  int Coefficients() const {
65  return p_numCoefs;
66  };
72  int Variables() const {
73  return p_numVars;
74  };
80  QString Name() const {
81  return p_name;
82  };
97  double Term(int c) const {
98  return p_terms[c];
99  };
107  double Coefficient(int i) const {
108  return p_coefs[i];
109  };
110 
111  protected:
113  QString p_name;
123  std::vector<double> p_coefs;
127  std::vector<double> p_terms;
128 
129  };
130 };
131 
132 #endif
Isis::BasisFunction::p_name
QString p_name
The name of the equation. Call it by using Name()
Definition: BasisFunction.h:109
Isis::BasisFunction::p_numVars
int p_numVars
The number of variables in the equation. Call it by using Variables()
Definition: BasisFunction.h:115
Isis::BasisFunction::SetCoefficients
void SetCoefficients(const std::vector< double > &coefs)
Set the coefficients for the equation.
Definition: BasisFunction.cpp:42
Isis::BasisFunction
Generic linear equation class.
Definition: BasisFunction.h:48
Isis::BasisFunction::Term
double Term(int c) const
Returns the cth term.
Definition: BasisFunction.h:97
Isis::BasisFunction::Name
QString Name() const
Returns the name of the equation.
Definition: BasisFunction.h:80
Isis::BasisFunction::p_coefs
std::vector< double > p_coefs
A vector of the coefficients in the equation.
Definition: BasisFunction.h:123
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
IString.h
Isis::BasisFunction::BasisFunction
BasisFunction(const QString &name, int numVars, int numCoefs)
Creates a BasisFunction object.
Definition: BasisFunction.cpp:29
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::BasisFunction::Expand
virtual void Expand(const std::vector< double > &vars)
This is the function you should replace depending on your needs.
Definition: BasisFunction.cpp:123
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::BasisFunction::p_numCoefs
int p_numCoefs
The number of coefficients in the equation.
Definition: BasisFunction.h:119
BasisFunction.h
Isis::BasisFunction::Variables
int Variables() const
Returns the number of variables in the equation.
Definition: BasisFunction.h:72
IException.h
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::BasisFunction::p_terms
std::vector< double > p_terms
A vector of the terms in the equation.
Definition: BasisFunction.h:127
Isis::BasisFunction::Evaluate
double Evaluate(const std::vector< double > &vars)
Compute the equation using the input variables.
Definition: BasisFunction.cpp:64
Isis::BasisFunction::~BasisFunction
virtual ~BasisFunction()
Destroys the BasisFunction object.
Definition: BasisFunction.h:52
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::BasisFunction::Coefficients
int Coefficients() const
Returns the number of coefficients for the equation.
Definition: BasisFunction.h:64
Isis::BasisFunction::Coefficient
double Coefficient(int i) const
Returns the ith coefficient.
Definition: BasisFunction.h:107