Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::glop::SparseVectorEntry< IndexType > Class Template Reference

#include <sparse_vector.h>

Public Types

using Index = IndexType
 

Public Member Functions

Index index () const
 
Fractional coefficient () const
 

Protected Member Functions

 SparseVectorEntry (const Index *indices, const Fractional *coefficients, EntryIndex i)
 

Protected Attributes

EntryIndex i_
 The index of the sparse vector entry represented by this object.
 
const Indexindex_
 
const Fractionalcoefficient_
 

Detailed Description

template<typename IndexType>
class operations_research::glop::SparseVectorEntry< IndexType >

SparseVectorEntry A reference-like class that points to a certain element of a sparse data structure that stores its elements in two parallel arrays. The main purpose of the entry class is to support implementation of iterator objects over the sparse data structure.

Note
the entry object does not own the data, and it is valid only as long as the underlying sparse data structure; it may also be invalidated if the underlying sparse data structure is modified.

Definition at line 417 of file sparse_vector.h.

Member Typedef Documentation

◆ Index

template<typename IndexType >
using operations_research::glop::SparseVectorEntry< IndexType >::Index = IndexType

Definition at line 419 of file sparse_vector.h.

Constructor & Destructor Documentation

◆ SparseVectorEntry()

template<typename IndexType >
operations_research::glop::SparseVectorEntry< IndexType >::SparseVectorEntry ( const Index * indices,
const Fractional * coefficients,
EntryIndex i )
inlineprotected

Creates the sparse vector entry from the given base pointers and the index. We accept the low-level data structures rather than a SparseVector reference to make it possible to use the SparseVectorEntry and SparseVectorIterator classes also for other data structures using the same internal data representation.

Note
the constructor is intentionally made protected, so that the entry can be created only as a part of the construction of an iterator over a sparse data structure.

Definition at line 433 of file sparse_vector.h.

Member Function Documentation

◆ coefficient()

template<typename IndexType >
Fractional operations_research::glop::SparseVectorEntry< IndexType >::coefficient ( ) const
inline

Definition at line 422 of file sparse_vector.h.

◆ index()

template<typename IndexType >
Index operations_research::glop::SparseVectorEntry< IndexType >::index ( ) const
inline

Definition at line 421 of file sparse_vector.h.

Member Data Documentation

◆ coefficient_

template<typename IndexType >
const Fractional* operations_research::glop::SparseVectorEntry< IndexType >::coefficient_
protected

Definition at line 448 of file sparse_vector.h.

◆ i_

template<typename IndexType >
EntryIndex operations_research::glop::SparseVectorEntry< IndexType >::i_
protected

The index of the sparse vector entry represented by this object.

Definition at line 438 of file sparse_vector.h.

◆ index_

template<typename IndexType >
const Index* operations_research::glop::SparseVectorEntry< IndexType >::index_
protected

The index and coefficient arrays of the sparse vector. NOTE(user): Keeping directly the index and the base pointers gives the best performance with a tiny margin of the options:

  1. keep the base pointers and an index of the current entry,
  2. keep pointers to the current index and the current coefficient and increment both when moving the iterator.
  3. keep a pointer to the sparse vector object and the index of the current entry.

Definition at line 447 of file sparse_vector.h.


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