mirror of
https://github.com/Z3Prover/z3
synced 2025-05-04 22:35:45 +00:00
merge LRA
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
085d31dca2
commit
911b24784a
120 changed files with 23069 additions and 15 deletions
37
src/util/lp/iterator_on_row.h
Normal file
37
src/util/lp/iterator_on_row.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
Author: Lev Nachmanson
|
||||
*/
|
||||
#pragma once
|
||||
#include "util/lp/linear_combination_iterator.h"
|
||||
namespace lean {
|
||||
template <typename T>
|
||||
struct iterator_on_row:linear_combination_iterator<T> {
|
||||
const vector<row_cell<T>> & m_row;
|
||||
unsigned m_i= 0; // offset
|
||||
iterator_on_row(const vector<row_cell<T>> & row) : m_row(row)
|
||||
{}
|
||||
unsigned size() const { return m_row.size(); }
|
||||
bool next(T & a, unsigned & i) {
|
||||
if (m_i == m_row.size())
|
||||
return false;
|
||||
auto &c = m_row[m_i++];
|
||||
i = c.m_j;
|
||||
a = c.get_val();
|
||||
return true;
|
||||
}
|
||||
bool next(unsigned & i) {
|
||||
if (m_i == m_row.size())
|
||||
return false;
|
||||
auto &c = m_row[m_i++];
|
||||
i = c.m_j;
|
||||
return true;
|
||||
}
|
||||
void reset() {
|
||||
m_i = 0;
|
||||
}
|
||||
linear_combination_iterator<T>* clone() {
|
||||
return new iterator_on_row(m_row);
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue