Skip to content

Commit 5155a4a

Browse files
committed
VectorXidx removed from namespace Eigen
1 parent 3093594 commit 5155a4a

File tree

7 files changed

+41
-43
lines changed

7 files changed

+41
-43
lines changed

src/adjustment.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ using Eigen::Index;
4848
using Eigen::VectorXd;
4949
using Eigen::MatrixXd;
5050
using Eigen::SparseMatrix;
51-
using Eigen::VectorXidx;
51+
using VectorXidx = Eigen::Vector<Index,Eigen::Dynamic>;
5252

5353
using Geometry::Rot_ab;
5454

@@ -318,8 +318,8 @@ void AdjustmentFramework::Jacobian(
318318
void AdjustmentFramework::check_constraints(
319319
const QVector<std::shared_ptr<ConstraintBase> > &constr,
320320
const IncidenceMatrix &bi,
321-
const Eigen::VectorXidx & maps,
322-
const Eigen::VectorXidx & mapc) const
321+
const VectorXidx & maps,
322+
const VectorXidx & mapc) const
323323
{
324324
// double d = NAN; // distance to be checked, d = 0?
325325
const Index C = mapc.size();

src/adjustment.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the GreasePad distribution (https://github.com/FraunhoferIOSB/GreasePad).
3-
* Copyright (c) 2022-2025 Jochen Meidow, Fraunhofer IOSB
3+
* Copyright (c) 2022-2026 Jochen Meidow, Fraunhofer IOSB
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -34,6 +34,8 @@
3434
#include "qcontainerfwd.h"
3535

3636

37+
using VectorXidx = Eigen::Vector<Eigen::Index,Eigen::Dynamic>;
38+
3739

3840
//! Adjustment framework: observations, Jacobians, optimization...
3941
class AdjustmentFramework
@@ -58,8 +60,8 @@ class AdjustmentFramework
5860
//! Enforce the constraints of a subtask (adjustment)
5961
bool enforce_constraints(const QVector<std::shared_ptr<Constraint::ConstraintBase> > &constr,
6062
const Graph::IncidenceMatrix &Bi,
61-
const Eigen::VectorXidx &maps,
62-
const Eigen::VectorXidx &mapc);
63+
const VectorXidx &maps,
64+
const VectorXidx &mapc);
6365

6466
//! Get s-th entity, i.e., segment, represented by vector of length len
6567
[[nodiscard]] std::pair<Eigen::VectorXd, Eigen::MatrixXd> getEntity( Eigen::Index s) const;
@@ -85,15 +87,15 @@ class AdjustmentFramework
8587
const Graph::IncidenceMatrix &Bi,
8688
Eigen::SparseMatrix<double, Eigen::ColMajor> & BBr,
8789
Eigen::VectorXd & g0,
88-
const Eigen::VectorXidx & maps,
89-
const Eigen::VectorXidx & mapc) const;
90+
const VectorXidx & maps,
91+
const VectorXidx & mapc) const;
9092
//! compute reduced coordinates
9193
void reduce ( Eigen::VectorXd &, Eigen::SparseMatrix<double,Eigen::ColMajor> &) const;
9294

9395
void check_constraints( const QVector<std::shared_ptr<Constraint::ConstraintBase> > & constr,
9496
const Graph::IncidenceMatrix & bi,
95-
const Eigen::VectorXidx & maps,
96-
const Eigen::VectorXidx & mapc ) const;
97+
const VectorXidx & maps,
98+
const VectorXidx & mapc ) const;
9799

98100
bool verbose = true;
99101

src/matrix.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@
2727

2828
#include <vector>
2929

30-
namespace Graph {
31-
3230
using Eigen::Triplet;
3331
using Eigen::Index;
34-
using Eigen::VectorXidx;
32+
using VectorXidx = Eigen::Vector<Index,Eigen::Dynamic>;
3533

3634

35+
namespace Graph {
3736

3837
bool IncidenceMatrix::isSet( const Index r, const Index c) const
3938
{

src/matrix.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the GreasePad distribution (https://github.com/FraunhoferIOSB/GreasePad).
3-
* Copyright (c) 2022-2025 Jochen Meidow, Fraunhofer IOSB
3+
* Copyright (c) 2022-2026 Jochen Meidow, Fraunhofer IOSB
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -23,9 +23,7 @@
2323
#include <Eigen/Dense>
2424
#include <Eigen/SparseCore>
2525

26-
namespace Eigen {
27-
using VectorXidx = Matrix<Index,Dynamic,1>;
28-
} // namespace Eigen
26+
2927

3028
namespace Graph {
3129

@@ -40,17 +38,17 @@ class IncidenceMatrix : public SparseMatrix<int, ColMajor, int>
4038
public:
4139
//! Copy assignment operator
4240
template<typename OtherDerived>
43-
IncidenceMatrix& operator=( const Eigen::SparseMatrixBase <OtherDerived>& other)
41+
IncidenceMatrix& operator=( const SparseMatrixBase <OtherDerived>& other)
4442
{
45-
this->Eigen::SparseMatrix<int, ColMajor,int>::operator=(other);
43+
this->SparseMatrix<int, ColMajor,int>::operator=(other);
4644
return *this;
4745
}
4846

4947
[[nodiscard]] bool isSet( Index r, Index c) const; //!< Check if r and c are related
5048
[[nodiscard]] SparseMatrix<int> biadjacency() const; //!< Create biadjacency matrix [O, A; A', O]
5149

52-
void set( Index r, Index c) { coeffRef(r,c) = 1; } //!< Set relation (row r, column c)
53-
void unset( Index r, Index c) { coeffRef(r,c) = 0; } //!< Delete relation (row r, column c)
50+
void set( const Index r, const Index c) { coeffRef(r,c) = 1; } //!< Set relation (row r, column c)
51+
void unset( const Index r, const Index c) { coeffRef(r,c) = 0; } //!< Delete relation (row r, column c)
5452

5553
void remove_row( Index r ); //!< Remove r-th row
5654
void remove_column( Index c ); //!< Remove c-th column

src/qconstraints.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ std::shared_ptr<QConstraintBase> QAligned::doClone() const
265265

266266

267267
void QAligned::setGeometry( QVector<std::shared_ptr<const uStraightLineSegment>> &s,
268-
const Eigen::VectorXidx &idx)
268+
const VectorXidx &idx)
269269
{
270270
assert( idx.size()==1 );
271271
const Index i = idx(0);
@@ -344,7 +344,7 @@ qreal QOrthogonal::markerSize() const
344344

345345

346346
void QOrthogonal::setGeometry( QVector<std::shared_ptr<const uStraightLineSegment>> &s,
347-
const Eigen::VectorXidx &idx)
347+
const VectorXidx &idx)
348348
{
349349
// qDebug() << Q_FUNC_INFO;
350350
assert( idx.size()==2 );
@@ -406,7 +406,7 @@ std::shared_ptr<QConstraintBase> QCopunctual::create()
406406
}
407407

408408
void QCopunctual::setGeometry( QVector<std::shared_ptr<const uStraightLineSegment>> &s,
409-
const Eigen::VectorXidx &idx)
409+
const VectorXidx &idx)
410410
{
411411
assert( idx.size()==3 );
412412
const Index i = idx(0);
@@ -504,7 +504,7 @@ qreal QParallel::markerSize() const
504504

505505

506506
void QParallel::setGeometry( QVector<std::shared_ptr<const uStraightLineSegment>> &s,
507-
const Eigen::VectorXidx &idx)
507+
const VectorXidx &idx)
508508
{
509509
assert( idx.size()==2 );
510510
const Index i = idx(0);
@@ -587,7 +587,7 @@ qreal QIdentical::markerSize() const
587587

588588

589589
void QIdentical::setGeometry( QVector<std::shared_ptr<const uStraightLineSegment>> &s,
590-
const Eigen::VectorXidx &idx)
590+
const VectorXidx &idx)
591591
{
592592
assert( idx.size()==2 );
593593
const Index i = idx(0);

src/qconstraints.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of the GreasePad distribution (https://github.com/FraunhoferIOSB/GreasePad).
3-
* Copyright (c) 2022-2025 Jochen Meidow, Fraunhofer IOSB
3+
* Copyright (c) 2022-2026 Jochen Meidow, Fraunhofer IOSB
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -48,7 +48,8 @@ class uStraightLineSegment;
4848
namespace QConstraint {
4949

5050
using Uncertain::uStraightLineSegment;
51-
using Eigen::VectorXidx;
51+
using VectorXidx = Eigen::Vector<Eigen::Index,Eigen::Dynamic>;
52+
5253

5354
//! Graphics: Base class for markers depicting constraints
5455
class QConstraintBase : public QGraphicsItem
@@ -77,7 +78,7 @@ class QConstraintBase : public QGraphicsItem
7778

7879
virtual void setMarkerSize ( qreal s) = 0; //!< Set marker size
7980
virtual void setGeometry( QVector<std::shared_ptr< const uStraightLineSegment>> &,
80-
const Eigen::VectorXidx &idx) = 0; //!< Set geometry
81+
const VectorXidx &idx) = 0; //!< Set geometry
8182

8283
static QPen defaultPenReq() { return s_defaultPenReq; } //!< Get default pen for required constraints
8384
static QPen defaultPenRed() { return s_defaultPenRed; } //!< Get default pen for redundant constraints
@@ -138,7 +139,7 @@ class QCopunctual : public QConstraintBase,
138139
static std::shared_ptr<QConstraintBase> create(); //!< Create copunctual constraint
139140

140141
void setGeometry( QVector<std::shared_ptr<const uStraightLineSegment>> &s,
141-
const Eigen::VectorXidx &idx) override;
142+
const VectorXidx &idx) override;
142143
void setMarkerSize ( qreal s) override;
143144
[[nodiscard]] qreal markerSize() const override;
144145

@@ -163,7 +164,7 @@ class QAligned : public QConstraintBase
163164
static std::shared_ptr<QConstraintBase> create();
164165

165166
void setGeometry( QVector<std::shared_ptr<const uStraightLineSegment>> &s,
166-
const Eigen::VectorXidx & idx) override;
167+
const VectorXidx & idx) override;
167168
void setMarkerSize ( qreal s) override;
168169
[[nodiscard]] qreal markerSize() const override;
169170

@@ -190,7 +191,7 @@ class QOrthogonal : public QConstraintBase,
190191
static std::shared_ptr<QConstraintBase> create(); //!< Create orthogonallity constraint
191192

192193
void setGeometry( QVector<std::shared_ptr<const uStraightLineSegment>> &s,
193-
const Eigen::VectorXidx & idx) override;
194+
const VectorXidx & idx) override;
194195
void setMarkerSize ( qreal s) override;
195196
[[nodiscard]] qreal markerSize() const override;
196197

@@ -217,7 +218,7 @@ class QIdentical : public QConstraintBase,
217218
void setMarkerSize ( qreal s) override;
218219
[[nodiscard]] qreal markerSize() const override;
219220
void setGeometry( QVector<std::shared_ptr<const uStraightLineSegment>> &s,
220-
const Eigen::VectorXidx &idx) override;
221+
const VectorXidx &idx) override;
221222

222223
protected:
223224
QIdentical();
@@ -240,7 +241,7 @@ class QParallel : public QConstraintBase
240241
static std::shared_ptr<QConstraintBase> create(); //!< Create parallelism constraint
241242

242243
void setGeometry( QVector<std::shared_ptr<const uStraightLineSegment >> &s,
243-
const Eigen::VectorXidx &idx) override;
244+
const VectorXidx &idx) override;
244245
void setMarkerSize ( qreal s) override;
245246
[[nodiscard]] qreal markerSize() const override;
246247

src/state.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ using Eigen::Index;
6868
using Eigen::SparseMatrix;
6969
using Eigen::RowVectorXi;
7070
using Eigen::ColMajor;
71-
using Eigen::VectorXidx;
72-
7371

7472
using Constraint::ConstraintBase;
7573
using Constraint::Parallel;
@@ -165,8 +163,8 @@ class impl {
165163
void remove_segment( Index i );
166164

167165
// augment & reduce
168-
void search_subtask( const Eigen::VectorXidx & mapc_,
169-
const Eigen::VectorXidx & maps_);
166+
void search_subtask( const VectorXidx & mapc_,
167+
const VectorXidx & maps_);
170168

171169
//! Estimation of two points delimiting an uncertain straight line segment
172170
static std::pair<uPoint,uPoint> uEndPoints( const Eigen::VectorXd & xi,
@@ -546,8 +544,8 @@ void impl::reasoning_augment_and_adjust( const Quantiles::Snapping & snap)
546544

547545
// const Eigen::VectorXidx maps_ = Matfun::find( CoCoBi.head( m_segm.length() ).array()==cc); // CoCoBi.mapHead( cc, m_segm.length());
548546
// const Eigen::VectorXidx mapc_ = Matfun::find( CoCoBi.tail( m_constr.length()).array()==cc); // CoCoBi.mapTail( cc, m_constr.length());
549-
const Eigen::VectorXidx maps_ = find( arr_segm ==cc);
550-
const Eigen::VectorXidx mapc_ = find( arr_constr==cc);
547+
const VectorXidx maps_ = find( arr_segm ==cc);
548+
const VectorXidx mapc_ = find( arr_constr==cc);
551549

552550
assert( mapc_.size()> 0);
553551
qDebug().noquote() << blue << QStringLiteral("Reasoning for connected component #%1/%2...")
@@ -692,8 +690,8 @@ Index impl::find_new_constraints()
692690
return m_constr.length() -previously;
693691
}
694692

695-
void impl::search_subtask( const Eigen::VectorXidx & mapc_,
696-
const Eigen::VectorXidx & maps_ )
693+
void impl::search_subtask( const VectorXidx & mapc_,
694+
const VectorXidx & maps_ )
697695
{
698696
qDebug() << Q_FUNC_INFO;
699697
assert( mapc_.size()>0 );
@@ -987,7 +985,7 @@ void impl::establish_identical( const Index a, const Index b)
987985
}
988986

989987
std::pair<Eigen::VectorXd, SparseMatrix<double> >
990-
impl::a_Maker( const Eigen::VectorXidx & maps_) const
988+
impl::a_Maker( const VectorXidx & maps_) const
991989
{
992990
// qDebug() << Q_FUNC_INFO;
993991

0 commit comments

Comments
 (0)