23 throw std::runtime_error(
"Error in GaussianEliminationAlg: Cannot construct with negative step or max.");
57 const std::vector<float>& sigmaVector,
58 const std::vector<float>& heightVector)
61 if(meanVector.size()!=sigmaVector.size() ||
62 meanVector.size()!=heightVector.size())
63 throw std::runtime_error(
"Error in GaussianEliminationAlg: Vector sizes not equal.");
73 const std::vector<float>& sigmaVector,
74 const std::vector<float>& heightVector)
77 fMatrix.resize(meanVector.size());
78 for(
size_t i=0; i<meanVector.size(); i++){
80 fMatrix[i].resize(meanVector.size()+1);
81 for(
size_t j=0; j<meanVector.size(); j++){
82 if(sigmaVector[j] < std::numeric_limits<float>::epsilon()){
91 fMatrix[i][meanVector.size()] = heightVector[i];
102 for(
size_t i=0; i<
fMatrix.size(); i++){
104 for(
size_t j=i+1; j<(
fMatrix[i].size()-1); j++){
112 for(
int i=
fMatrix.size()-1; i>=0; i--){
115 for(
size_t j=i+1; j<
fMatrix.size(); j++)
125 std::cout <<
"GaussianEliminationAlg." <<
std::endl;
132 std::cout <<
"\tAugmented matrix " <<
std::endl;
133 for(
size_t i=0; i<
fMatrix.size(); i++){
134 std::cout <<
"\t\t | ";
135 for(
size_t j=0; j<
fMatrix[i].size()-1; j++)
136 std::cout <<
fMatrix[i][j] <<
" ";
142 std::cout <<
"\t\t" << i <<
" " <<
fSolutions[i] << std::endl;
double GetDistance(float) const
void FillDistanceLookupTable()
void GaussianElimination()
void FillAugmentedMatrix(const std::vector< float > &meanVector, const std::vector< float > &sigmaVector, const std::vector< float > &heightVector)
std::vector< std::vector< double > > fMatrix
const std::vector< float > & SolveEquations(const std::vector< float > &meanVector, const std::vector< float > &sigmaVector, const std::vector< float > &heightVector)
static int max(int a, int b)
std::vector< double > fDistanceLookupTable
GaussianEliminationAlg(float, float)
std::vector< float > fSolutions
QTextStream & endl(QTextStream &s)