geos::algorithm::distance::DiscreteFrechetDistance::CsrMatrix Class Reference

`#include <DiscreteFrechetDistance.h>`

Inheritance diagram for geos::algorithm::distance::DiscreteFrechetDistance::CsrMatrix:

## Public Member Functions

| CsrMatrix (std::size_t numRows, std::size_t numCols, double defaultValue, std::size_t expectedValues)
| CsrMatrix (std::size_t numRows, std::size_t numCols, double defaultValue)
std::pair< bool, std::size_t > | cppBinarySearch (const std::vector< std::size_t > &vec, std::size_t fromIndex, std::size_t toIndex, std::size_t key) const
std::pair< bool, std::size_t > | indexOf (std::size_t i, std::size_t j) const
double | get (std::size_t i, std::size_t j) const override
void | set (std::size_t i, std::size_t j, double value) override
bool | isValueSet (std::size_t i, std::size_t j) const override
void | ensureCapacity (std::size_t required)
Public Member Functions inherited from geos::algorithm::distance::DiscreteFrechetDistance::MatrixStorage
| MatrixStorage (std::size_t numRows, std::size_t numCols, double defaultValue)

## Static Public Member Functions

static std::size_t | expectedValuesHeuristic (std::size_t numRows, std::size_t numCols)

## Additional Inherited Members

Public Attributes inherited from geos::algorithm::distance::DiscreteFrechetDistance::MatrixStorage
std::size_t | m_numRows
std::size_t | m_numCols
double | m_defaultValue

## Detailed Description

A matrix implementation that adheres to the Compressed sparse row format. Note: Unfortunately not as fast as hoped.

## Member Function Documentation

## cppBinarySearch()

std::pair< bool, std::size_t > geos::algorithm::distance::DiscreteFrechetDistance::CsrMatrix::cppBinarySearch | ( | const std::vector< std::size_t > & | vec,
|  | std::size_t | fromIndex,
|  | std::size_t | toIndex,
|  | std::size_t | key ) const

inline

A work-alike for Java Arrays.binarySearch(), used for searching ordered arrays. This variant searches for the key value within a bounded subset of the array.

Parameters

  vec | the vector to search
  fromIndex | the lower bound index for the search
  toIndex | the upper bound index for the search
  key | the value to hunt for

Returns
  a pair with the first item being true if the key was found and false otherwise, and the second being the index of the key found, or the insertion point of the key if not found

## ensureCapacity()

void geos::algorithm::distance::DiscreteFrechetDistance::CsrMatrix::ensureCapacity | ( | std::size_t | required | ) |

inline

Ensures that the column index vector (m_ci) and value vector (m_v) are sufficiently large.

Parameters

  required | the number of items to store in the matrix

Referenced by set().

## expectedValuesHeuristic()

std::size_t geos::algorithm::distance::DiscreteFrechetDistance::CsrMatrix::expectedValuesHeuristic | ( | std::size_t | numRows,
|  | std::size_t | numCols )

inline static

Computes an initial value for the number of expected values

Parameters

  numRows | the number of rows
  numCols | the number of columns

Returns
  the expected number of values in the sparse matrix

## get()

double geos::algorithm::distance::DiscreteFrechetDistance::CsrMatrix::get | ( | std::size_t | i,
|  | std::size_t | j ) const

inline override virtual

Gets the matrix value at i, j

Parameters

  i | the row index
  j | the column index

Returns
  The matrix value at i, j

Implements geos::algorithm::distance::DiscreteFrechetDistance::MatrixStorage.

## isValueSet()

bool geos::algorithm::distance::DiscreteFrechetDistance::CsrMatrix::isValueSet | ( | std::size_t | i,
|  | std::size_t | j ) const

inline override virtual

Gets a flag indicating if the matrix has a set value, e.g. one that is different than MatrixStorage defaultValue.

Parameters

  i | the row index
  j | the column index

Returns
  a flag indicating if the matrix has a set value

Implements geos::algorithm::distance::DiscreteFrechetDistance::MatrixStorage.

## set()

void geos::algorithm::distance::DiscreteFrechetDistance::CsrMatrix::set | ( | std::size_t | i,
|  | std::size_t | j,
|  | double | value )

inline override virtual

Sets the matrix value at i, j

Parameters

  i | the row index
  j | the column index
  value | The matrix value to set at i, j

Implements geos::algorithm::distance::DiscreteFrechetDistance::MatrixStorage.

References ensureCapacity().

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

- DiscreteFrechetDistance.h