14#ifndef OR_TOOLS_LP_DATA_SPARSE_COLUMN_H_
15#define OR_TOOLS_LP_DATA_SPARSE_COLUMN_H_
85 coefficients_(
column.coefficient_) {}
88 return coefficients_[i.value()];
93 RowIndex
EntryRow(EntryIndex i)
const {
return rows_[i.value()]; }
97 return Iterator(this->rows_, this->coefficients_, EntryIndex(0));
101 return Iterator(this->rows_, this->coefficients_, num_entries_);
106 for (
const auto e : *
this) {
107 if (e.row() ==
index) {
112 value = e.coefficient();
118 bool IsEmpty()
const {
return num_entries_ == EntryIndex(0); }
121 const EntryIndex num_entries_;
122 const RowIndex*
const rows_;
134class RandomAccessSparseColumn {
150 void Resize(RowIndex num_rows);
184 void MarkRowAsChanged(RowIndex
row) {
185 if (!changed_[
row]) {
186 changed_[
row] =
true;
187 row_change_.push_back(
row);
198 std::vector<RowIndex> row_change_;
ColumnView(const SparseColumn &column)
VectorIterator< Entry > Iterator
Fractional LookUpCoefficient(RowIndex index) const
ColumnView(EntryIndex num_entries, const RowIndex *rows, const Fractional *const coefficients)
RowIndex EntryRow(EntryIndex i) const
EntryIndex num_entries() const
RowIndex GetFirstRow() const
Fractional GetFirstCoefficient() const
Fractional EntryCoefficient(EntryIndex i) const
void PopulateFromSparseColumn(const SparseColumn &sparse_column)
RandomAccessSparseColumn(RowIndex num_rows)
RandomAccessSparseColumn & operator=(const RandomAccessSparseColumn &)=delete
void PopulateSparseColumn(SparseColumn *sparse_column) const
RowIndex GetNumberOfRows() const
void SetCoefficient(RowIndex row, Fractional value)
void Resize(RowIndex num_rows)
Fractional GetCoefficient(RowIndex row) const
void AddToCoefficient(RowIndex row, Fractional value)
virtual ~RandomAccessSparseColumn()
SparseColumnEntry(const RowIndex *indices, const Fractional *coefficients, EntryIndex i)
RowIndex row() const
Returns the row of the current entry.
RowIndex GetFirstRow() const
Fractional EntryCoefficient(EntryIndex i) const
RowIndex GetLastRow() const
void ApplyPartialRowPermutation(const RowPermutation &p)
void ApplyRowPermutation(const RowPermutation &p)
RowIndex EntryRow(EntryIndex i) const
Use a separate API to get the row and coefficient of entry #i.
void ApplyPartialIndexPermutation(const IndexPermutation &index_perm)
void ApplyIndexPermutation(const IndexPermutation &index_perm)
Index GetFirstIndex() const
Fractional GetCoefficient(EntryIndex i) const
Index GetLastIndex() const
Index GetIndex(EntryIndex i) const
absl::Span< const double > coefficients
const RowIndex kNonPivotal(-1)
In SWIG mode, we don't want anything besides these top-level includes.