42 #ifndef SPVEC_INDEX_LOOKUP_CLASS_DECL_H
43 #define SPVEC_INDEX_LOOKUP_CLASS_DECL_H
49 namespace AbstractLinAlgPack {
51 namespace SparseVectorUtilityPack {
63 template <
class T_Element>
251 throw NoSpVecSetException(
"The sparse vector (ele, nz, offset) has not been set yet");
283 #endif // SPVEC_INDEX_LOOKUP_CLASS_DECL_H
poss_type binary_ele_search(index_type index, UpperLower uplow) const
Perform a binary search for an element in the sparse vector.
RTOp_index_type index_type
difference_type offset() const
poss_type find_poss(index_type index, UpperLower uplow) const
Lookup an element and cache the result if a binary search was performed.
void incr_nz()
Increment nz only.
element_type * ele() const
void set_sp_vec(element_type *ele, size_type nz, difference_type offset)
Set a new sparse vector.
void assert_sp_vec_setup() const
Assert that a sparse vector has been set up.
poss_type(size_type _poss, ElementRelation _rel)
element_type::index_type index_type
void sp_vec_was_modified()
Called by client to inform the object that the sparse vector was modified so that the cache may be in...
RTOp_index_type size_type
InvalidInternalStateException(const std::string &what_arg)
SpVecIndexLookup(element_type *ele, size_type nz, difference_type offset)
Construct initialize with a sparse vector.
Struct with members: size_type poss; ElementRelation rel;.
SpVecIndexLookup()
Construct uninitialized with not sparse vector set (ele() == 0#)
NoSpVecSetException(const std::string &what_arg)
ptrdiff_t difference_type
Sparse Vector Index Lookup and Caching class.
ElementRelation ele_rel_cached_
size_type find_element(index_type index, bool is_sorted) const
Lookup an element.
size_type adjust_cached_poss(UpperLower uplow) const
Adjust the cached possition.
void validate_state() const
Called by client to ensure that the internal state is valid.