Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::glop::SparseRow Class Reference

#include <sparse_row.h>

Inheritance diagram for operations_research::glop::SparseRow:
operations_research::glop::SparseVector< ColIndex, SparseRowIterator >

Public Member Functions

 SparseRow ()
ColIndex EntryCol (EntryIndex i) const
 Use a separate API to get the column and coefficient of entry #i.
Fractional EntryCoefficient (EntryIndex i) const
ColIndex GetFirstCol () const
ColIndex GetLastCol () const
void ApplyColPermutation (const ColumnPermutation &p)
void ApplyPartialColPermutation (const ColumnPermutation &p)
Public Member Functions inherited from operations_research::glop::SparseVector< ColIndex, SparseRowIterator >
 SparseVector ()
SparseVectoroperator= (const SparseVector &other)
Iterator begin () const
Iterator end () const
void Clear ()
 Clears the vector, i.e. removes all entries.
void ClearAndRelease ()
 Clears the vector and releases the memory it uses.
void Reserve (EntryIndex new_capacity)
 Reserve the underlying storage for the given number of entries.
bool IsEmpty () const
 Returns true if the vector is empty.
void CleanUp ()
bool IsCleanedUp () const
void Swap (SparseVector *other)
void PopulateFromSparseVector (const SparseVector &sparse_vector)
void PopulateFromDenseVector (const DenseVector &dense_vector)
void AppendEntriesWithOffset (const SparseVector &sparse_vector, Index offset)
bool CheckNoDuplicates () const
void SetCoefficient (Index index, Fractional value)
 Defines the coefficient at index, i.e. vector[index] = value;.
void DeleteEntry (Index index)
void RemoveNearZeroEntries (Fractional threshold)
void RemoveNearZeroEntriesWithWeights (Fractional threshold, const DenseVector &weights)
void MoveEntryToFirstPosition (Index index)
void MoveEntryToLastPosition (Index index)
void MultiplyByConstant (Fractional factor)
void ComponentWiseMultiply (const DenseVector &factors)
void DivideByConstant (Fractional factor)
void ComponentWiseDivide (const DenseVector &factors)
void CopyToDenseVector (Index num_indices, DenseVector *dense_vector) const
void PermutedCopyToDenseVector (const IndexPermutation &index_perm, Index num_indices, DenseVector *dense_vector) const
void AddMultipleToDenseVector (Fractional multiplier, DenseVector *dense_vector) const
void AddMultipleToSparseVectorAndDeleteCommonIndex (Fractional multiplier, Index removed_common_index, Fractional drop_tolerance, SparseVector *accumulator_vector) const
void AddMultipleToSparseVectorAndIgnoreCommonIndex (Fractional multiplier, Index removed_common_index, Fractional drop_tolerance, SparseVector *accumulator_vector) const
void ApplyIndexPermutation (const IndexPermutation &index_perm)
 Applies the index permutation to all entries: index = index_perm[index];.
void ApplyPartialIndexPermutation (const IndexPermutation &index_perm)
void MoveTaggedEntriesTo (const IndexPermutation &index_perm, SparseVector *output)
Fractional LookUpCoefficient (Index index) const
EntryIndex num_entries () const
 Note this method can only be used when the vector has no duplicates.
Index GetFirstIndex () const
Fractional GetFirstCoefficient () const
Index GetLastIndex () const
 Like GetFirst*, but for the last entry.
Fractional GetLastCoefficient () const
::util::IntegerRange< EntryIndex > AllEntryIndices () const
bool IsEqualTo (const SparseVector &other) const
std::string DebugString () const

Additional Inherited Members

Public Types inherited from operations_research::glop::SparseVector< ColIndex, SparseRowIterator >
typedef ColIndex Index
typedef StrictITIVector< Index, FractionalDenseVector
typedef Permutation< IndexIndexPermutation
using Iterator
using Entry
Protected Member Functions inherited from operations_research::glop::SparseVector< ColIndex, SparseRowIterator >
void AddEntry (Index index, Fractional value)
void ResizeDown (EntryIndex new_size)
Index GetIndex (EntryIndex i) const
Fractional GetCoefficient (EntryIndex i) const
IndexMutableIndex (EntryIndex i)
FractionalMutableCoefficient (EntryIndex i)
Protected Attributes inherited from operations_research::glop::SparseVector< ColIndex, SparseRowIterator >
std::unique_ptr< char[]> buffer_
EntryIndex num_entries_
EntryIndex capacity_
Indexindex_
 Pointers to the first elements of the index and coefficient arrays.
Fractionalcoefficient_
bool may_contain_duplicates_

Detailed Description

Todo
(user): Use this class where appropriate, i.e. when a SparseColumn is used to store a row vector (by means of RowIndex to ColIndex casting).

A SparseRow is a SparseVector<ColIndex>, with a few methods renamed to help readability on the client side.

Definition at line 43 of file sparse_row.h.

Constructor & Destructor Documentation

◆ SparseRow()

operations_research::glop::SparseRow::SparseRow ( )
inline

Definition at line 45 of file sparse_row.h.

Member Function Documentation

◆ ApplyColPermutation()

void operations_research::glop::SparseRow::ApplyColPermutation ( const ColumnPermutation & p)
inline

Definition at line 52 of file sparse_row.h.

◆ ApplyPartialColPermutation()

void operations_research::glop::SparseRow::ApplyPartialColPermutation ( const ColumnPermutation & p)
inline

Definition at line 55 of file sparse_row.h.

◆ EntryCoefficient()

Fractional operations_research::glop::SparseRow::EntryCoefficient ( EntryIndex i) const
inline

Definition at line 49 of file sparse_row.h.

◆ EntryCol()

ColIndex operations_research::glop::SparseRow::EntryCol ( EntryIndex i) const
inline

Use a separate API to get the column and coefficient of entry #i.

Definition at line 48 of file sparse_row.h.

◆ GetFirstCol()

ColIndex operations_research::glop::SparseRow::GetFirstCol ( ) const
inline

Definition at line 50 of file sparse_row.h.

◆ GetLastCol()

ColIndex operations_research::glop::SparseRow::GetLastCol ( ) const
inline

Definition at line 51 of file sparse_row.h.


The documentation for this class was generated from the following file: