@@ -391,7 +391,7 @@ namespace lp {
391391 unsigned ei = m_entries.size () - 1 ;
392392
393393 if (m_k2s.has_val (ei)) {
394- m_k2s. erase_val (ei);
394+ remove_from_S (ei);
395395 }
396396 m_entries.pop_back ();
397397 }
@@ -478,7 +478,7 @@ namespace lp {
478478
479479
480480 if (m_k2s.has_val (i)) {
481- m_k2s. erase_val (i);
481+ remove_from_S (i);
482482 }
483483
484484 m_entries.pop_back ();
@@ -711,7 +711,6 @@ namespace lp {
711711 std::unordered_set<unsigned > entries_to_recalculate;
712712 std::unordered_set<unsigned > changed_terms; // a term is signified by the term column, like j in lra.get_term(j)
713713 std_vector<unsigned > fresh_entries_to_remove;
714-
715714 for (unsigned j : m_changed_columns) {
716715 const auto it = m_columns_to_terms.find (j);
717716 if (it != m_columns_to_terms.end ())
@@ -776,7 +775,8 @@ namespace lp {
776775 }
777776 for (unsigned ei : entries_to_recalculate) {
778777 if (ei < m_e_matrix.row_count ())
779- move_entry_from_s_to_f (ei);
778+ if (belongs_to_s (ei))
779+ remove_from_S (ei);
780780 }
781781
782782 for (unsigned ei : entries_to_recalculate) {
@@ -792,7 +792,7 @@ namespace lp {
792792 }
793793 }
794794
795- eliminate_substituted ();
795+ eliminate_substituted (entries_to_recalculate );
796796 SASSERT (entries_are_ok ());
797797 m_changed_columns.clear ();
798798 }
@@ -811,13 +811,9 @@ namespace lp {
811811 return it->coeff ();
812812 }
813813
814- void eliminate_substituted () {
815- for (const auto &p: m_k2s.m_map ) {
816- unsigned j = p.first ;
817- unsigned ei = p.second ;
818- int j_sign = get_sign_in_e_row (ei, j);
819- eliminate_var_in_f (ei, j, j_sign);
820- }
814+ void eliminate_substituted (std::unordered_set<unsigned > entries_to_recalculate) {
815+ for (unsigned ei: entries_to_recalculate)
816+ subs_entry (ei);
821817 }
822818
823819 void transpose_entries (unsigned i, unsigned k) {
@@ -1827,7 +1823,6 @@ namespace lp {
18271823 const auto &row = m_e_matrix.m_rows [ei];
18281824 for (const auto & p : row) {
18291825 if (p.var () == j) {
1830- std::cout << " not eliminated from row " << ei << std::endl;
18311826 return false ;
18321827 }
18331828 }
@@ -1991,8 +1986,7 @@ namespace lp {
19911986 }
19921987
19931988 m_l_matrix.add_row ();
1994-
1995- m_k2s.add (k, fresh_row);
1989+ move_entry_from_f_to_s (k, fresh_row);
19961990 fresh_definition fd (-1 , -1 );
19971991
19981992 m_fresh_definitions.resize (xt + 1 , fd);
@@ -2042,7 +2036,7 @@ namespace lp {
20422036 return !m_k2s.has_val (ei);
20432037 }
20442038
2045- void move_entry_from_s_to_f (unsigned ei) {
2039+ void remove_from_S (unsigned ei) {
20462040 m_k2s.erase_val (ei);
20472041 }
20482042
0 commit comments