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

#include <sparse_column.h>

Public Member Functions

 RandomAccessSparseColumn (RowIndex num_rows)
 
 RandomAccessSparseColumn (const RandomAccessSparseColumn &)=delete
 This type is neither copyable nor movable.
 
RandomAccessSparseColumnoperator= (const RandomAccessSparseColumn &)=delete
 
virtual ~RandomAccessSparseColumn ()
 
void Clear ()
 
void Resize (RowIndex num_rows)
 
void SetCoefficient (RowIndex row, Fractional value)
 
void AddToCoefficient (RowIndex row, Fractional value)
 
void PopulateFromSparseColumn (const SparseColumn &sparse_column)
 
void PopulateSparseColumn (SparseColumn *sparse_column) const
 
RowIndex GetNumberOfRows () const
 
Fractional GetCoefficient (RowIndex row) const
 

Detailed Description

RandomAccessSparseColumn A RandomAccessSparseColumn is a mix between a DenseColumn and a SparseColumn. It makes it possible to populate a dense column from a sparse column in O(num_entries) instead of O(num_rows), and to access an entry in O(1). As the constructor runs in O(num_rows), a RandomAccessSparseColumn should be used several times to amortize the creation cost.

Definition at line 136 of file sparse_column.h.

Constructor & Destructor Documentation

◆ RandomAccessSparseColumn() [1/2]

operations_research::glop::RandomAccessSparseColumn::RandomAccessSparseColumn ( RowIndex num_rows)
explicit

Creates a RandomAccessSparseColumn. Runs in O(num_rows).

RandomAccessSparseColumn

Definition at line 30 of file sparse_column.cc.

◆ RandomAccessSparseColumn() [2/2]

operations_research::glop::RandomAccessSparseColumn::RandomAccessSparseColumn ( const RandomAccessSparseColumn & )
delete

This type is neither copyable nor movable.

◆ ~RandomAccessSparseColumn()

operations_research::glop::RandomAccessSparseColumn::~RandomAccessSparseColumn ( )
virtualdefault

Member Function Documentation

◆ AddToCoefficient()

void operations_research::glop::RandomAccessSparseColumn::AddToCoefficient ( RowIndex row,
Fractional value )
inline

Adds value to the current value at row. Runs in O(1).

Definition at line 163 of file sparse_column.h.

◆ Clear()

void operations_research::glop::RandomAccessSparseColumn::Clear ( )

Clears the column. Runs in O(num_entries).

Definition at line 35 of file sparse_column.cc.

◆ GetCoefficient()

Fractional operations_research::glop::RandomAccessSparseColumn::GetCoefficient ( RowIndex row) const
inline

Returns the value in position row. Runs in O(1).

Definition at line 182 of file sparse_column.h.

◆ GetNumberOfRows()

RowIndex operations_research::glop::RandomAccessSparseColumn::GetNumberOfRows ( ) const
inline

Returns the number of rows. Runs in O(1).

Definition at line 178 of file sparse_column.h.

◆ operator=()

RandomAccessSparseColumn & operations_research::glop::RandomAccessSparseColumn::operator= ( const RandomAccessSparseColumn & )
delete

◆ PopulateFromSparseColumn()

void operations_research::glop::RandomAccessSparseColumn::PopulateFromSparseColumn ( const SparseColumn & sparse_column)

Populates from a sparse column. Runs in O(num_entries).

Definition at line 53 of file sparse_column.cc.

◆ PopulateSparseColumn()

void operations_research::glop::RandomAccessSparseColumn::PopulateSparseColumn ( SparseColumn * sparse_column) const

Populates a sparse column from the lazy dense column. Runs in O(num_entries).

Todo
(user): Do that only if (value != 0.0) ?

Definition at line 61 of file sparse_column.cc.

◆ Resize()

void operations_research::glop::RandomAccessSparseColumn::Resize ( RowIndex num_rows)

Definition at line 45 of file sparse_column.cc.

◆ SetCoefficient()

void operations_research::glop::RandomAccessSparseColumn::SetCoefficient ( RowIndex row,
Fractional value )
inline

Sets value at row. Runs in O(1).

Definition at line 156 of file sparse_column.h.


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