Skip to content

Commit ea9a9d7

Browse files
committed
revision maker method
1 parent 30f22c0 commit ea9a9d7

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/state.cpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,37 +1067,33 @@ void impl::establish_identical( const Index a, const Index b)
10671067

10681068

10691069
std::pair<Eigen::VectorXd, SparseMatrix<double> >
1070-
impl::a_Maker(const ArrayXi &maps_) const
1070+
impl::a_Maker(const ArrayXi & maps) const
10711071
{
1072-
// qDebug() << Q_FUNC_INFO;
1073-
1074-
const Index S = maps_.size(); // number of segments
1075-
const Index N = 3*S; // number of observations
1072+
const Index S = maps.size(); // number of segments
1073+
const Index N = 3*S; // number of observations
10761074
assert( S>0 );
10771075
VectorXd l(N); // vector of observations
1078-
SparseMatrix<double,ColMajor> Cov_ll(N,N); // covariance matrix observations
1079-
Cov_ll.setZero();
1080-
Cov_ll.reserve(3*N);
1076+
SparseMatrix<double,ColMajor> Sigma_ll(N,N); // covariance matrix observations
1077+
Sigma_ll.reserve(3*N);
10811078
int idx = 0; // [~,idx] = max( abs(l(1:2)) )
10821079

1083-
for (int s = 0; s < S; s++) {
1084-
uStraightLine const ul = m_segm.at( maps_(s) )->ul().sphericalNormalized();
1085-
1086-
Vector3d m = ul.v();
1080+
for (Index s=0; s<S; s++) {
1081+
const uStraightLine ul = m_segm.at(maps(s))->ul().sphericalNormalized();
10871082

10881083
// align signs consistently
1089-
m.head(2).cwiseAbs().maxCoeff(&idx); // [~,idx] = max( abs(l(1:2)) )
1090-
const int offset3 = 3*s;
1091-
l.segment(offset3,3) = sign( m(idx) ) * m; // spherical normalized
1092-
1093-
for ( int i=0; i<3; i++ ) {
1094-
for ( int j=0; j<3; j++ ) {
1095-
Cov_ll.insert( offset3+i, offset3+j ) = ul.Cov()(i,j);
1084+
const Vector3d m = ul.v();
1085+
m.head<2>().cwiseAbs().maxCoeff(&idx); // [~,idx] = max( abs(l(1:2)) )
1086+
const Index offset3 = 3*s;
1087+
l.segment<3>(offset3) = sign(m(idx))*m; // spherically normalized
1088+
1089+
for (Index i=0; i<3; i++) {
1090+
for (Index j=0; j<3; j++) {
1091+
Sigma_ll.insert( offset3+i, offset3+j ) = ul.Cov(i,j);
10961092
}
10971093
}
10981094
}
10991095

1100-
return { l, Cov_ll};
1096+
return {l, Sigma_ll};
11011097
}
11021098

11031099

src/uncertain/uelement.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ class uElement
7070
//! Get covariance matrix
7171
[[nodiscard]] Matrix<double,N,N> Cov() const {return m_cov;}
7272

73+
//! Get element (i,j) of covariance matrix
74+
[[nodiscard]] double
75+
Cov(const Eigen::Index i, const Eigen::Index j) const {return m_cov(i,j);}
76+
7377
//! Get homogeneous N-vector representing the geometric element
7478
[[nodiscard]] Vector<double,N> v() const {return m_val;}
7579

0 commit comments

Comments
 (0)