27 static std::atomic<std::size_t> next_id{0};
28 static_assert(
sizeof(std::size_t) >= 8,
"std::size_t is expected to be at least 64 bit, so that we can be sure our unique ids never wrap around.");
38 m_Data(std::move(data)) {
60 CHECK(hv->coeff(0) == 0.0);
61 CHECK(hv->coeff(1) == 0.0);
62 CHECK(hv->coeff(2) == 0.0);
64 hv = DenseRealVector::Ones(3);
65 CHECK(hv->coeff(0) == 1.0);
66 CHECK(hv->coeff(1) == 1.0);
67 CHECK(hv->coeff(2) == 1.0);
77 CHECK(vh != hv.
hash());
79 CHECK(vh == hv.
hash());
82 auto content = hv.
get();
83 content = hv + DenseRealVector::Ones(3);
84 CHECK(vh == hv.
hash());
85 CHECK(hv->coeff(0) == 0.0);
87 hv = DenseRealVector::Ones(3);
88 CHECK(vh != hv.
hash());
108 CHECK_FALSE(vh == hv.
hash());
109 CHECK_FALSE(hv.
hash() == vh);
An Eigen vector with versioning information, to implement simple caching of results.
VectorHash hash() const
Gets the unique id of this vector.
const DenseRealVector & get() const
Gets a constant reference to the data of this vector.
HashVector(DenseRealVector data)
Creates a new hash vector from the given DenseRealVector.
A unique identifier for a HashVector.
VectorHash()
Default constructor. Initializes the VectorHash to special marker.
TEST_CASE("HashVector content")
std::size_t get_next_id()
Get the next valid id.
Main namespace in which all types, classes, and functions are defined.
types::DenseVector< real_t > DenseRealVector
Any dense, real values vector.