|
17 | 17 | */ |
18 | 18 |
|
19 | 19 | #include "global.h" |
| 20 | +#include "matfun.h" |
20 | 21 |
|
21 | 22 | #include "qassert.h" |
22 | 23 | #include "qcolor.h" |
@@ -642,8 +643,8 @@ void impl::reasoning_augment_and_adjust( const Quantiles::Snapping & snap) |
642 | 643 | for (Index k = 0; k < LabelsNewConstrUnique.size(); k++) { |
643 | 644 | int const cc = LabelsNewConstrUnique(k); |
644 | 645 |
|
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()); |
647 | 648 |
|
648 | 649 | assert( mapc_.size()> 0); |
649 | 650 | qDebug().noquote() << blue << QStringLiteral("Reasoning for connected component #%1/%2...") |
@@ -885,7 +886,7 @@ void impl::snap_endpoints( const Index nnc) |
885 | 886 | qDebug().noquote() << blue << QString(" snap subtask %1/%2") |
886 | 887 | .arg( cc+1 ).arg( LabelsNewUnique.size() ); |
887 | 888 |
|
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()); |
889 | 890 | for ( Index i=0; i< m.size(); i++) { |
890 | 891 | const Index s = m(i); // triggering segment... |
891 | 892 |
|
@@ -1288,8 +1289,8 @@ void impl::reasoning_reduce_and_adjust() { |
1288 | 1289 | // greedy search |
1289 | 1290 | for ( int cc=0; cc<number_of_subtasks_; cc++ ) |
1290 | 1291 | { |
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() ); |
1293 | 1294 |
|
1294 | 1295 | bool greedySearchRequired = false; |
1295 | 1296 |
|
@@ -1440,13 +1441,13 @@ void impl::setAltColors() const |
1440 | 1441 | const QColor col = QColor::fromHsv( hue,255,255, 255); |
1441 | 1442 |
|
1442 | 1443 | // (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()); |
1444 | 1445 | for ( Index s=0; s<idx_s.size(); s++) { |
1445 | 1446 | m_qConstrained.at( idx_s(s) )->setAltColor(col); |
1446 | 1447 | } |
1447 | 1448 |
|
1448 | 1449 | // (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()); |
1450 | 1451 | for ( Index c=0; c<idx_c.size(); c++) { |
1451 | 1452 | m_qConstraint.at( idx_c(c) )->setAltColor( col ); |
1452 | 1453 | } |
|
0 commit comments