Skip to content

Commit 30f22c0

Browse files
committed
template using typename
1 parent 73298ed commit 30f22c0

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/adjustment.h

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ class AdjustmentFramework
6060
Eigen::Array<Attribute,Eigen::Dynamic,1> & status,
6161
Eigen::Array<bool,Eigen::Dynamic,1> & enforced);
6262

63-
//! Get s-th entity represented by vector of length N and covariance matrix
64-
template <int N>
65-
std::pair< Eigen::Vector<double,N>, Eigen::Matrix<double,N,N> >
66-
getEntity( Eigen::Index s) const;
63+
//! Get i-th uncertain entity represented by N-vector and covariance matrix
64+
template<typename T,int N>
65+
std::pair< Eigen::Vector<T,N>, Eigen::Matrix<T,N,N> >
66+
getEntity( Eigen::Index i) const;
6767

6868
private:
6969
[[nodiscard]] static int nIterMax() { return nIterMax_; }
@@ -110,18 +110,17 @@ class AdjustmentFramework
110110
};
111111

112112

113-
//! Get s-th entity represented by vector of length N and covariance matrix
114-
template <int N>
115-
std::pair< Eigen::Vector<double,N>, Eigen::Matrix<double,N,N> >
116-
AdjustmentFramework::getEntity( const Eigen::Index s) const
113+
//! Get i-th uncertain entity represented by N-vector and covariance matrix
114+
template<typename T,int N>
115+
std::pair< Eigen::Vector<T,N>, Eigen::Matrix<T,N,N> >
116+
AdjustmentFramework::getEntity( const Eigen::Index i) const
117117
{
118-
const Eigen::Index offset = N*s;
119-
const Eigen::Matrix<double,N,N> RR = Geometry::Rot_ab<double,N>(
120-
l_.segment(offset,N),
121-
l0_.segment(offset,N) );
118+
const Eigen::Index offset = N*i; // start position
119+
const Eigen::Matrix<T,N,N> RR = Geometry::Rot_ab<T,N>(
120+
l_.segment<N>(offset), l0_.segment<N>(offset) );
122121

123-
return { l0_.segment(offset,N),
124-
RR*Sigma_ll_.block(offset,offset,N,N)*RR.transpose() };
122+
return {l0_.segment<N>(offset),
123+
RR*Sigma_ll_.block(offset,offset,N,N)*RR.transpose()};
125124
}
126125

127126

src/state.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ void impl::update_segments( const ArrayXi & maps_,
825825
{
826826
for ( Index s=0; s<maps_.size(); s++ ) {
827827
// straight line: s-th 3-vector
828-
const std::pair<Vector3d,Matrix3d> p = a.getEntity<3>(s);
828+
const std::pair<Vector3d,Matrix3d> p = a.getEntity<double,3>(s);
829829
const uStraightLine ul( p.first, p.second );
830830

831831
const uPoint ux = m_segm.at( maps_(s) )->ux();

0 commit comments

Comments
 (0)