Skip to content

Commit

Permalink
test output ellipsoids
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmuller committed Oct 10, 2024
1 parent 66e9e43 commit e12c071
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
7 changes: 5 additions & 2 deletions src/leastsquares.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ bool LeastSquares::iterate(bool invert, COMPUTE_TYPE compute_type)
m_interrupted = true;
//std::cout<<error_msg.str()<<std::flush;
//project->outputConversion();
project->updateEllipsoids();
m_calculusError = m_calculusError || !project->updateEllipsoids();
return !m_calculusError;
}

Expand Down Expand Up @@ -936,7 +936,10 @@ bool LeastSquares::iterate(bool invert, COMPUTE_TYPE compute_type)
if (!m_calculusError)
{
project->outputConversion();
if (invert) project->updateEllipsoids();
if (invert)
{
m_calculusError = m_calculusError || !project->updateEllipsoids();
}
}
return !m_calculusError;
}
Expand Down
2 changes: 1 addition & 1 deletion src/leastsquares.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class LeastSquares
bool m_interrupted;//<if computatio interrupted by max iter, no redondancy or user interruption (button)
bool m_internalConstr;//m_internalConstr is update during initialize(), and used in iterate
int rankDeficiency;//< if AtPA rank is not equal to cols
bool computeKernel();//returns true if dim(kern)>0

protected:
bool prepareSolve(spSolver &solver);
Expand All @@ -134,7 +135,6 @@ class LeastSquares
bool testStability(spSolver &solver);
#endif

bool computeKernel();//returns true if dim(kern)>0
void kernelMessage();
MatrixOrdering matrixOrdering;
std::vector <std::unique_ptr<Obs> > ICobs;//internal constraints obs
Expand Down
12 changes: 10 additions & 2 deletions src/point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ std::string Point::toString() const
if (ellipsoid.isSet())
{
oss<<" var:";
for (int i=0;i<dimension;i++)
for (int i=0;i<3;i++)
oss<<" "<<ellipsoid.get_variance(i);
}
return oss.str();
Expand Down Expand Up @@ -468,7 +468,7 @@ bool Point::initCoordinates()
return true;
}

void Point::set_posteriori_variance(const MatX &Qxx)
bool Point::set_posteriori_variance(const MatX &Qxx)
{
for (int i=0;i<3;i++)
{
Expand All @@ -484,6 +484,14 @@ void Point::set_posteriori_variance(const MatX &Qxx)
//std::cout<<"For point "<<name<<":\n";

ellipsoid.compute_eigenvalues(Project::theone()->lsquares.sigma_0);
for (int i=0;i<3;i++)
{
if (!std::isfinite(ellipsoid.get_ellipsAxe(i)))
return false;
if (!std::isfinite(ellipsoid.get_variance(i)))
return false;
}
return true;
}

void Point::create_coordinates_constraits()
Expand Down
2 changes: 1 addition & 1 deletion src/point.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class Point
STATION_CREATION_MODE creation_mode=STATION_CREATION_MODE::ST_CREAT_ALLOWED);//where to add new observations

bool initCoordinates();
void set_posteriori_variance(const MatX &Qxx);
bool set_posteriori_variance(const MatX &Qxx); //< return false if error
std::string toString() const;

std::vector<Point *> pointsMeasured() const;//<list of measured point from this
Expand Down
18 changes: 15 additions & 3 deletions src/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1444,13 +1444,23 @@ void Project::outputConversion()
}
}

void Project::updateEllipsoids()
bool Project::updateEllipsoids()
{
biggestEllips = 0;
if (!invertedMatrix) return;
if (!invertedMatrix) return true;

for (auto & point : points)
point.set_posteriori_variance(lsquares.Qxx);
{
bool ptok = point.set_posteriori_variance(lsquares.Qxx);
if (!ptok && std::isfinite(lsquares.sigma_0))
{
Project::theInfo()->warning(INFO_LS,1,
QT_TRANSLATE_NOOP("QObject","Error on output sigmas of point %s: %s"),
point.name.c_str(), point.ellipsoid.sigmasToString(lsquares.sigma_0).c_str());
lsquares.computeKernel();
return false;
}
}

int nbrEllipsTooBig = 0;
Point *ptbig = nullptr;
Expand Down Expand Up @@ -1478,7 +1488,9 @@ void Project::updateEllipsoids()
Project::theInfo()->warning(INFO_LS,1,
QT_TRANSLATE_NOOP("QObject","and sigma0 = %.3f"),
lsquares.sigma_0);
lsquares.computeKernel();
}
return true;
}

bool Project::computation(bool invert, bool saveNew)
Expand Down
2 changes: 1 addition & 1 deletion src/project.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Project
bool exportSightMatrix(const std::string &filename);

bool computation(bool invert, bool saveNew);
void updateEllipsoids();
bool updateEllipsoids(); //< return false if error

bool saveasJSON();

Expand Down

0 comments on commit e12c071

Please sign in to comment.