Skip to content

Commit 2fce51f

Browse files
committed
removal of member functions 'mapHead' and 'mapTail'
1 parent 8dcfc32 commit 2fce51f

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/conncomp.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818

1919
#include "conncomp.h"
20-
#include "matfun.h"
2120

2221
#include <Eigen/Core>
2322

@@ -71,9 +70,9 @@ int ConnComp::label( const Index i) const
7170
}
7271

7372

74-
VectorXidx ConnComp::mapHead(const int cc, const Index n) const
73+
/* VectorXidx ConnComp::mapHead(const int cc, const Index n) const
7574
{
76-
/* // (1) Vector length: How many elements with value cc? .........
75+
// (1) Vector length: How many elements with value cc? .........
7776
int sz1=0; // TODO(meijoc) remove
7877
for ( Index s=0; s<n; s++ ) {
7978
if ( m_comp(s)==cc ) {
@@ -91,15 +90,15 @@ VectorXidx ConnComp::mapHead(const int cc, const Index n) const
9190
}
9291
}
9392
94-
return map_; */
93+
return map_;
9594
9695
return Matfun::find( m_comp.head(n).array()==cc );
97-
}
96+
}*/
9897

9998

100-
VectorXidx ConnComp::mapTail(const int cc, const Index n) const
99+
/* VectorXidx ConnComp::mapTail(const int cc, const Index n) const
101100
{
102-
/* // (1) Vector length: How many elements with value cc? .........
101+
// (1) Vector length: How many elements with value cc? .........
103102
int sz1=0; // TODO(meijoc) remove
104103
for ( Index s=m_comp.size()-n; s<m_comp.size(); s++ ) {
105104
if ( m_comp(s)==cc ) {
@@ -118,10 +117,10 @@ VectorXidx ConnComp::mapTail(const int cc, const Index n) const
118117
}
119118
}
120119
121-
return map_; */
120+
return map_;
122121
123122
return Matfun::find( m_comp.tail(n).array()==cc);
124-
}
123+
}*/
125124

126125

127126
//! depth-first search

src/conncomp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class ConnComp
4343
public:
4444
explicit ConnComp( const SparseMatrix<int, ColMajor> & BB); //!< Value constructor with sparse matrix
4545

46-
[[nodiscard]] VectorXidx mapHead( int cc, Index n) const; //!< Get linear indices of the elements in 1...n with label 'cc'.
47-
[[nodiscard]] VectorXidx mapTail(int cc, Index n) const; //!< Get linear indices of the elements in n-1...end with label 'cc'.
46+
// [[nodiscard]] VectorXidx mapHead( int cc, Index n) const; //!< Get linear indices of the elements in 1...n with label 'cc'.
47+
// [[nodiscard]] VectorXidx mapTail(int cc, Index n) const; //!< Get linear indices of the elements in n-1...end with label 'cc'.
4848
[[nodiscard]] int label( Index i) const; //!< Get label/index of i-th element
4949
[[nodiscard]] VectorXi head( Index n) const; //!< Get labels/indices of first n elements
5050
[[nodiscard]] VectorXi tail( Index n) const; //!< Get labels/indices of last n elements

src/state.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include "global.h"
20+
#include "matfun.h"
2021

2122
#include "qassert.h"
2223
#include "qcolor.h"
@@ -642,8 +643,8 @@ void impl::reasoning_augment_and_adjust( const Quantiles::Snapping & snap)
642643
for (Index k = 0; k < LabelsNewConstrUnique.size(); k++) {
643644
int const cc = LabelsNewConstrUnique(k);
644645

645-
const Eigen::VectorXidx maps_ = CoCoBi.mapHead(cc, m_segm.length());
646-
const Eigen::VectorXidx mapc_ = CoCoBi.mapTail( cc, m_constr.length());
646+
const Eigen::VectorXidx maps_ = Matfun::find( CoCoBi.head( m_segm.length() ).array()==cc); // CoCoBi.mapHead( cc, m_segm.length());
647+
const Eigen::VectorXidx mapc_ = Matfun::find( CoCoBi.tail( m_constr.length()).array()==cc); // CoCoBi.mapTail( cc, m_constr.length());
647648

648649
assert( mapc_.size()> 0);
649650
qDebug().noquote() << blue << QStringLiteral("Reasoning for connected component #%1/%2...")
@@ -885,7 +886,7 @@ void impl::snap_endpoints( const Index nnc)
885886
qDebug().noquote() << blue << QString(" snap subtask %1/%2")
886887
.arg( cc+1 ).arg( LabelsNewUnique.size() );
887888

888-
const VectorXidx m = CoCoBi.mapHead(cc, m_segm.size());
889+
const VectorXidx m = Matfun::find( CoCoBi.head( m_segm.size()).array()==cc ); // CoCoBi.mapHead(cc, m_segm.size());
889890
for ( Index i=0; i< m.size(); i++) {
890891
const Index s = m(i); // triggering segment...
891892

@@ -1288,8 +1289,8 @@ void impl::reasoning_reduce_and_adjust() {
12881289
// greedy search
12891290
for ( int cc=0; cc<number_of_subtasks_; cc++ )
12901291
{
1291-
const VectorXidx maps_ = CoCoBi.mapHead( cc, m_segm.length());
1292-
const VectorXidx mapc_ = CoCoBi.mapTail( cc, m_constr.length() );
1292+
const VectorXidx maps_ = Matfun::find( CoCoBi.head(m_segm.length()).array()==cc ); // CoCoBi.mapHead( cc, m_segm.length());
1293+
const VectorXidx mapc_ = Matfun::find( CoCoBi.tail(m_constr.length()).array()==cc ); // CoCoBi.mapTail( cc, m_constr.length() );
12931294

12941295
bool greedySearchRequired = false;
12951296

@@ -1440,13 +1441,13 @@ void impl::setAltColors() const
14401441
const QColor col = QColor::fromHsv( hue,255,255, 255);
14411442

14421443
// (1) segments ...
1443-
const VectorXidx idx_s = CoCoBi.mapHead(cc, m_qConstrained.length());
1444+
const VectorXidx idx_s = Matfun::find( CoCoBi.head( m_qConstrained.length()).array()==cc ); // CoCoBi.mapHead(cc, m_qConstrained.length());
14441445
for ( Index s=0; s<idx_s.size(); s++) {
14451446
m_qConstrained.at( idx_s(s) )->setAltColor(col);
14461447
}
14471448

14481449
// (2) constraints ...
1449-
const VectorXidx idx_c = CoCoBi.mapTail(cc, m_qConstraint.length());
1450+
const VectorXidx idx_c = Matfun::find( CoCoBi.tail( m_qConstraint.length()).array()==cc ); // CoCoBi.mapTail(cc, m_qConstraint.length());
14501451
for ( Index c=0; c<idx_c.size(); c++) {
14511452
m_qConstraint.at( idx_c(c) )->setAltColor( col );
14521453
}

0 commit comments

Comments
 (0)