3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 11:25:51 +00:00

merge LRA

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-05-09 10:46:11 -07:00
parent 085d31dca2
commit 911b24784a
120 changed files with 23069 additions and 15 deletions

View file

@ -0,0 +1,74 @@
/*
Copyright (c) 2017 Microsoft Corporation
Author: Lev Nachmanson
*/
#pragma once
#include "util/vector.h"
#include "util/debug.h"
#include <string>
#include "util/lp/sparse_vector.h"
#include "util/lp/indexed_vector.h"
#include "util/lp/permutation_matrix.h"
namespace lean {
// This is the sum of a unit matrix and a lower triangular matrix
// with non-zero elements only in one row
template <typename T, typename X>
class row_eta_matrix
: public tail_matrix<T, X> {
#ifdef LEAN_DEBUG
unsigned m_dimension;
#endif
unsigned m_row_start;
unsigned m_row;
sparse_vector<T> m_row_vector;
public:
#ifdef LEAN_DEBUG
row_eta_matrix(unsigned row_start, unsigned row, unsigned dim):
#else
row_eta_matrix(unsigned row_start, unsigned row):
#endif
#ifdef LEAN_DEBUG
m_dimension(dim),
#endif
m_row_start(row_start), m_row(row) {
}
bool is_dense() const { return false; }
void print(std::ostream & out) {
print_matrix(*this, out);
}
const T & get_diagonal_element() const {
return m_row_vector.m_data[m_row];
}
void apply_from_left(vector<X> & w, lp_settings &);
void apply_from_left_local_to_T(indexed_vector<T> & w, lp_settings & settings);
void apply_from_left_local_to_X(indexed_vector<X> & w, lp_settings & settings);
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings) {
apply_from_left_local_to_T(w, settings);
}
void push_back(unsigned row_index, T val ) {
lean_assert(row_index != m_row);
m_row_vector.push_back(row_index, val);
}
void apply_from_right(vector<T> & w);
void apply_from_right(indexed_vector<T> & w);
void conjugate_by_permutation(permutation_matrix<T, X> & p);
#ifdef LEAN_DEBUG
T get_elem(unsigned row, unsigned col) const;
unsigned row_count() const { return m_dimension; }
unsigned column_count() const { return m_dimension; }
void set_number_of_rows(unsigned m) { m_dimension = m; }
void set_number_of_columns(unsigned n) { m_dimension = n; }
#endif
}; // end of row_eta_matrix
}