#include <indexVector.h>
|
| void | setupVecs (const std::vector< double > &vec, int hashPrecision) |
| | Sets up the internal representations of the vector and precision.
|
| |
|
| std::vector< double > | m_vector |
| | The vector of floating-point values.
|
| |
| std::vector< uint64_t > | m_vectorInt |
| | Internal representation of the vector for hashing, storing scaled integer values.
|
| |
| int | m_hashPrescision |
| | The precision (number of decimal places) used for rounding and hashing.
|
| |
| bool | m_initialized = false |
| | Flag indicating whether the vector and precision have been initialized.
|
| |
◆ FloatIndexVector() [1/4]
| FloatIndexVector::FloatIndexVector |
( |
| ) |
|
◆ FloatIndexVector() [2/4]
| FloatIndexVector::FloatIndexVector |
( |
const std::vector< double > & | vec | ) |
|
Constructor with vector initialization.
- Parameters
-
| vec | The vector of floating-point values to initialize with. |
- Exceptions
-
| std::invalid_argument | if the input vector is empty. |
◆ FloatIndexVector() [3/4]
| FloatIndexVector::FloatIndexVector |
( |
const std::vector< double > & | vec, |
|
|
int | hashPrecision ) |
Constructor with vector and precision initialization.
- Parameters
-
| vec | The vector of floating-point values to initialize with. |
| hashPrecision | The precision to use for hashing. |
- Exceptions
-
| std::invalid_argument | if the input vector is empty. |
| std::invalid_argument | if hashPrescision is not a positive integer or is >= 14. |
◆ FloatIndexVector() [4/4]
Copy constructor.
- Parameters
-
- Exceptions
-
| std::invalid_argument | if the input vector in the other object is empty. |
◆ getHashPrecision()
| int FloatIndexVector::getHashPrecision |
( |
| ) |
const |
Gets the current hash precision.
- Returns
- The current hash precision.
- Exceptions
-
| std::runtime_error | if the object is not initialized. |
◆ getVector()
| std::vector< double > FloatIndexVector::getVector |
( |
| ) |
const |
Gets the current vector of floating-point values.
- Returns
- The current vector.
- Exceptions
-
| std::runtime_error | if the object is not initialized. |
◆ hash()
| size_t FloatIndexVector::hash |
( |
| ) |
const |
Computes the hash of the vector.
- Returns
- The hash value of the vector.
- Exceptions
-
| std::runtime_error | if the object is not initialized. |
◆ initialize() [1/2]
| void FloatIndexVector::initialize |
( |
const std::vector< double > & | vec | ) |
|
Initializes the vector without precision.
- Parameters
-
| vec | The vector of floating-point values to initialize with. |
- Exceptions
-
| std::runtime_error | if the object is already initialized. |
| std::invalid_argument | if the input vector is empty. |
◆ initialize() [2/2]
| void FloatIndexVector::initialize |
( |
const std::vector< double > & | vec, |
|
|
int | hashPrecision ) |
Initializes the vector with precision.
- Parameters
-
| vec | The vector of floating-point values to initialize with. |
| hashPrecision | The precision to use for hashing. |
- Exceptions
-
| std::runtime_error | if the object is already initialized. |
| std::invalid_argument | if the input vector is empty. |
| std::invalid_argument | if hashPrescision is not a positive integer or is >= 14. |
◆ operator!=()
Inequality operator.
- Parameters
-
- Returns
- True if the vectors are not equal, false otherwise.
◆ operator=()
Copy assignment operator.
- Parameters
-
- Returns
- Reference to the assigned FloatIndexVector.
◆ operator==()
Equality operator.
- Parameters
-
- Returns
- True if the vectors are equal, false otherwise.
◆ operator[]()
| double FloatIndexVector::operator[] |
( |
const size_t | index | ) |
const |
Access element at a specific index.
- Parameters
-
| index | The index of the element to access. |
- Returns
- The value at the specified index.
- Exceptions
-
| std::out_of_range | if the index is out of bounds. |
◆ reserve()
| void FloatIndexVector::reserve |
( |
size_t | size | ) |
|
|
inline |
Reserves memory for the vector and its internal representation.
- Parameters
-
| size | The number of elements to reserve. |
◆ setHashPrecision()
| void FloatIndexVector::setHashPrecision |
( |
int | hashPrecision | ) |
|
Sets the hash precision.
- Parameters
-
| hashPrecision | The precision to use for hashing. |
- Exceptions
-
| std::runtime_error | if the object is already initialized. |
| std::invalid_argument | if hashPrescision is not a positive integer or is >= 14. |
◆ setupVecs()
| void FloatIndexVector::setupVecs |
( |
const std::vector< double > & | vec, |
|
|
int | hashPrecision ) |
|
private |
Sets up the internal representations of the vector and precision.
This method initializes the internal vector representations (m_vector and m_vectorInt) based on the provided floating-point vector and hash precision. It converts the floating-point values into integer representations for consistent hashing.
- Parameters
-
| vec | The vector of floating-point values to initialize with. |
| hashPrecision | The precision to use for hashing. Values are rounded to this precision. |
- Exceptions
-
| std::invalid_argument | if the input vector is empty. |
| std::invalid_argument | if hashPrescision is not a positive integer or is >= 14. |
Example Usage:
std::vector<double> vec = {1.2345, 2.3456, 3.4567};
Definition indexVector.h:38
void setupVecs(const std::vector< double > &vec, int hashPrecision)
Sets up the internal representations of the vector and precision.
Definition indexVector.cpp:58
◆ setVector()
| void FloatIndexVector::setVector |
( |
const std::vector< double > & | vec | ) |
|
Sets the vector of floating-point values.
- Parameters
-
- Exceptions
-
| std::runtime_error | if the object is already initialized. |
| std::invalid_argument | if the input vector is empty. |
◆ size()
| int FloatIndexVector::size |
( |
| ) |
const |
Get the size of the index vector.
- Returns
- size The dimension / size of the index vector
◆ operator<<
Overloads the << operator for ostream to print FloatIndexVector.
- Parameters
-
- Returns
- Reference to the output stream.
◆ m_hashPrescision
| int FloatIndexVector::m_hashPrescision |
|
private |
The precision (number of decimal places) used for rounding and hashing.
◆ m_initialized
| bool FloatIndexVector::m_initialized = false |
|
private |
Flag indicating whether the vector and precision have been initialized.
◆ m_vector
| std::vector<double> FloatIndexVector::m_vector |
|
private |
The vector of floating-point values.
◆ m_vectorInt
| std::vector<uint64_t> FloatIndexVector::m_vectorInt |
|
private |
Internal representation of the vector for hashing, storing scaled integer values.
The documentation for this class was generated from the following files: