OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Private Attributes | Friends | List of all members
ossimLagrangeInterpolator Class Reference

#include <ossimLagrangeInterpolator.h>

Inheritance diagram for ossimLagrangeInterpolator:
ossimReferenced

Public Member Functions

 ossimLagrangeInterpolator ()
 
 ossimLagrangeInterpolator (std::istream &)
 
 ossimLagrangeInterpolator (const std::vector< double > &t_array, const std::vector< NEWMAT::ColumnVector > &data_array)
 
 ~ossimLagrangeInterpolator ()
 
void addData (const double &t, const NEWMAT::ColumnVector &data)
 
bool interpolate (const double &t, NEWMAT::ColumnVector &result) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 

Private Attributes

std::vector< double > theTeeArray
 
std::vector< NEWMAT::ColumnVector > theDataArray
 
std::vector< double > theNormalizer
 
ossim_uint32 theNumElements
 

Friends

std::ostream & operator<< (std::ostream &, const ossimLagrangeInterpolator &)
 
std::istream & operator>> (std::istream &, ossimLagrangeInterpolator &)
 

Additional Inherited Members

- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Detailed Description

Definition at line 23 of file ossimLagrangeInterpolator.h.

Constructor & Destructor Documentation

◆ ossimLagrangeInterpolator() [1/3]

ossimLagrangeInterpolator::ossimLagrangeInterpolator ( )
inline

Definition at line 29 of file ossimLagrangeInterpolator.h.

◆ ossimLagrangeInterpolator() [2/3]

ossimLagrangeInterpolator::ossimLagrangeInterpolator ( std::istream &  )

◆ ossimLagrangeInterpolator() [3/3]

ossimLagrangeInterpolator::ossimLagrangeInterpolator ( const std::vector< double > &  t_array,
const std::vector< NEWMAT::ColumnVector > &  data_array 
)

Definition at line 42 of file ossimLagrangeInterpolator.cpp.

44 : theTeeArray (t_array),
45  theDataArray(data_array),
47 {
48  static const char MODULE[]="ossimLagrangeInterpolator(int, double, Vector) CONSTRUCTOR";
49  if (traceDebug()) CLOG << "entering..." << endl;
50 
51  // Assign data members:
52  ossim_uint32 numPoints = (ossim_uint32) theTeeArray.size();
53  if (theDataArray.size() > 0)
54  theNumElements = theDataArray[0].Nrows();
55 
56  ossim_uint32 i;
57  double n;
58  for (i=0; i<numPoints; i++)
59  {
60  // Compute the normalizer value at this data point:
61  n = 1.0;
62  for (ossim_uint32 j=0; j<numPoints; j++)
63  {
64  if (i != j)
65  n *= (theTeeArray[i] - theTeeArray[j]);
66  }
67  theNormalizer.push_back(n);
68  }
69 
70  if (traceDebug()) CLOG << "returning..." << endl;
71 }
#define CLOG
Definition: ossimTrace.h:23
os2<< "> n<< " > nendobj n
unsigned int ossim_uint32
std::vector< double > theNormalizer
std::vector< NEWMAT::ColumnVector > theDataArray

◆ ~ossimLagrangeInterpolator()

ossimLagrangeInterpolator::~ossimLagrangeInterpolator ( )

Definition at line 77 of file ossimLagrangeInterpolator.cpp.

78 {
79 }

Member Function Documentation

◆ addData()

void ossimLagrangeInterpolator::addData ( const double &  t,
const NEWMAT::ColumnVector &  data 
)

Definition at line 84 of file ossimLagrangeInterpolator.cpp.

References theDataArray, and theTeeArray.

85 {
86  theTeeArray.push_back(t);
87  theDataArray.push_back(data);
88 }
std::vector< NEWMAT::ColumnVector > theDataArray

◆ interpolate()

bool ossimLagrangeInterpolator::interpolate ( const double &  t,
NEWMAT::ColumnVector &  result 
) const

Definition at line 93 of file ossimLagrangeInterpolator.cpp.

Referenced by ossimRS1SarModel::imagingRay().

94 {
95  static const char MODULE[] = "ossimLagrangeInterpolator::interpolate()";
96  if (traceDebug()) CLOG << "entering..." << endl;
97 
98  // Prepare to sum:
99  double weight;
100 
101  // Perform interpolation:
102  ossim_uint32 numPoints = (ossim_uint32) theTeeArray.size();
103  for (ossim_uint32 i=0; i<numPoints; i++)
104  {
105  weight = 1.0/theNormalizer[i];
106  for (ossim_uint32 j=0; j<numPoints; j++)
107  {
108  if (i != j)
109  weight *= (t - theTeeArray[j]);
110  }
111 
112  result += theDataArray[i] * weight;
113  }
114 
115  if (traceDebug()) CLOG << "leaving." << endl;
116  return true;
117 }
#define CLOG
Definition: ossimTrace.h:23
unsigned int ossim_uint32
std::vector< double > theNormalizer
std::vector< NEWMAT::ColumnVector > theDataArray

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  ,
const ossimLagrangeInterpolator  
)
friend

◆ operator>>

std::istream& operator>> ( std::istream &  ,
ossimLagrangeInterpolator  
)
friend

Member Data Documentation

◆ theDataArray

std::vector<NEWMAT::ColumnVector> ossimLagrangeInterpolator::theDataArray
private

Definition at line 41 of file ossimLagrangeInterpolator.h.

Referenced by addData(), and operator>>().

◆ theNormalizer

std::vector<double> ossimLagrangeInterpolator::theNormalizer
private

Definition at line 42 of file ossimLagrangeInterpolator.h.

Referenced by operator>>().

◆ theNumElements

ossim_uint32 ossimLagrangeInterpolator::theNumElements
private

Definition at line 43 of file ossimLagrangeInterpolator.h.

Referenced by operator>>().

◆ theTeeArray

std::vector<double> ossimLagrangeInterpolator::theTeeArray
private

Definition at line 40 of file ossimLagrangeInterpolator.h.

Referenced by addData(), and operator>>().


The documentation for this class was generated from the following files: