/usr/include/ossim/base/ossimLeastSquaresBilin.h is in libossim-dev 1.7.21-3ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | //*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// Author: Garrett Potts (gpotts@imagelinks.com
//
// Description: Source code produced by Dave Knopp
//
//*******************************************************************
// $Id: ossimLeastSquaresBilin.h 9968 2006-11-29 14:01:53Z gpotts $
#ifndef ossimLeastSquaresBilin_INCLUDE
#define ossimLeastSquaresBilin_INCLUDE
#include <ossim/base/ossimConstants.h>
#include <ossim/matrix/newmat.h>
/**
* @brief Provide 2D Least Squares Bilinear model fitting
* The math model is that of a bilinear surface of the form:
@code
z(x,y) = a + b*x + c*y + d*x*y
@endcode
* The getLSParms() method returns parameter values which are the least
* squares solution associated with the samples added via addSample(). Note
* that it is necessary to add at least four sample to obtain a solution.
*/
class OSSIMDLLEXPORT ossimLeastSquaresBilin
{
public:
ossimLeastSquaresBilin(const ossimLeastSquaresBilin &);
/**
* Instantiate as zero surface.
*/
ossimLeastSquaresBilin();
ossimLeastSquaresBilin & operator = (const ossimLeastSquaresBilin &);
/**
* Free internal storage.
*/
virtual ~ossimLeastSquaresBilin();
/**
* Will clear everything and set it up to
* for another solve. Just add points
* and call the solve method.
*/
virtual void clear();
/**
* add a single data sample.
*
* @param xx "x" coordinate of sample location.
* @param yy "y" "y" coordinate of sample location.
* @param zmea sample value measured at (xx,yy)
*/
virtual void addSample(double x, double yy, double zmea);
/**
* return LS solution parameters.
*
* @param pa set to constant coefficient.
* @param pb_x set to linear coefficient of "x"
* @param pc_y set to linear coefficient of "y"
* @param pd_xy set to cross coefficient of "x*y"
*/
virtual bool getLSParms(double& pa, double& pb_x, double& pc_y, double& pd_xy)const;
/**
* @param pa set to constant coefficient.
* @param pb_x set to linear coefficient of "x"
* @param pc_y set to linear coefficient of "y"
* @param pd_xy set to cross coefficient of "x*y"
*/
virtual void setLSParams(double pa, //constant
double pb_x, // linear coefficient of x,
double pc_y, // linear coefficient of y
double pd_xy); // coefficient of x*y
/**
* interpolate LS-fit value at location (xx,yy) - returns z(xx,yy).
*
* @param xx "x" coordinate at which to interpolate.
* @param yy "y" "y" coordinate at which to interpolate.
*
*/
virtual inline double lsFitValue(double xx, double yy) const
{
return (bl_a + bl_b*xx + bl_c*yy + bl_d*xx*yy);
}
/**
* compute least squares parameter solution - true if succesfull.
*/
bool solveLS();
private:
/**
* constant term.
*/
double bl_a;
/**
* linear-X term.
*/
double bl_b;
/**
* linear-Y term.
*/
double bl_c;
/**
* cross-XY term
*/
double bl_d;
/**
* Normal system coefficient matrix.
*/
NEWMAT::Matrix* AtA;
/**
* Normal system RHS vector
*/
NEWMAT::Matrix* Atb;
};
#endif // LeastSquaresBilinilin_INCL_
|