Blaze 3.9
SparseVector.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_SPARSEVECTOR_H_
36#define _BLAZE_MATH_EXPRESSIONS_SPARSEVECTOR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
44
45
46namespace blaze {
47
48//=================================================================================================
49//
50// CLASS DEFINITION
51//
52//=================================================================================================
53
54//*************************************************************************************************
68template< typename VT // Type of the sparse vector
69 , bool TF > // Transpose flag
71 : public Vector<VT,TF>
72{
73 protected:
74 //**Special member functions********************************************************************
77 SparseVector() = default;
78 SparseVector( const SparseVector& ) = default;
79 SparseVector( SparseVector&& ) = default;
80 ~SparseVector() = default;
81 SparseVector& operator=( const SparseVector& ) = default;
82 SparseVector& operator=( SparseVector&& ) = default;
84 //**********************************************************************************************
85};
86//*************************************************************************************************
87
88
89
90
91//=================================================================================================
92//
93// GLOBAL FUNCTIONS
94//
95//=================================================================================================
96
97//*************************************************************************************************
100template< typename VT, bool TF >
101typename VT::Iterator find( SparseVector<VT,TF>& sv, size_t index );
102
103template< typename VT, bool TF >
104typename VT::ConstIterator find( const SparseVector<VT,TF>& sv, size_t index );
105
106template< typename VT, bool TF >
107typename VT::Iterator lowerBound( SparseVector<VT,TF>& sv, size_t index );
108
109template< typename VT, bool TF >
110typename VT::ConstIterator lowerBound( const SparseVector<VT,TF>& sv, size_t index );
111
112template< typename VT, bool TF >
113typename VT::Iterator upperBound( SparseVector<VT,TF>& sv, size_t index );
114
115template< typename VT, bool TF >
116typename VT::ConstIterator upperBound( const SparseVector<VT,TF>& sv, size_t index );
118//*************************************************************************************************
119
120
121//*************************************************************************************************
136template< typename VT // Type of the vector
137 , bool TF > // Transpose flag of the vector
138BLAZE_ALWAYS_INLINE typename VT::Iterator
139 find( SparseVector<VT,TF>& sv, size_t index )
140{
141 return (*sv).find( index );
142}
143//*************************************************************************************************
144
145
146//*************************************************************************************************
161template< typename VT // Type of the vector
162 , bool TF > // Transpose flag of the vector
163BLAZE_ALWAYS_INLINE typename VT::ConstIterator
164 find( const SparseVector<VT,TF>& sv, size_t index )
165{
166 return (*sv).find( index );
167}
168//*************************************************************************************************
169
170
171//*************************************************************************************************
185template< typename VT // Type of the vector
186 , bool TF > // Transpose flag of the vector
187BLAZE_ALWAYS_INLINE typename VT::Iterator
188 lowerBound( SparseVector<VT,TF>& sv, size_t index )
189{
190 return (*sv).lowerBound( index );
191}
192//*************************************************************************************************
193
194
195//*************************************************************************************************
209template< typename VT // Type of the vector
210 , bool TF > // Transpose flag of the vector
211BLAZE_ALWAYS_INLINE typename VT::ConstIterator
212 lowerBound( const SparseVector<VT,TF>& sv, size_t index )
213{
214 return (*sv).lowerBound( index );
215}
216//*************************************************************************************************
217
218
219//*************************************************************************************************
233template< typename VT // Type of the vector
234 , bool TF > // Transpose flag of the vector
235BLAZE_ALWAYS_INLINE typename VT::Iterator
236 upperBound( SparseVector<VT,TF>& sv, size_t index )
237{
238 return (*sv).upperBound( index );
239}
240//*************************************************************************************************
241
242
243//*************************************************************************************************
257template< typename VT // Type of the vector
258 , bool TF > // Transpose flag of the vector
259BLAZE_ALWAYS_INLINE typename VT::ConstIterator
260 upperBound( const SparseVector<VT,TF>& sv, size_t index )
261{
262 return (*sv).upperBound( index );
263}
264//*************************************************************************************************
265
266} // namespace blaze
267
268#endif
Base class for sparse vectors.
Definition: SparseVector.h:72
Base class for N-dimensional vectors.
Definition: Vector.h:82
Header file for the Vector CRTP base class.
BLAZE_ALWAYS_INLINE VT::ConstIterator find(const SparseVector< VT, TF > &sv, size_t index)
Searches for a specific sparse vector element.
Definition: SparseVector.h:164
BLAZE_ALWAYS_INLINE VT::ConstIterator upperBound(const SparseVector< VT, TF > &sv, size_t index)
Returns an iterator to the first index greater then the given index.
Definition: SparseVector.h:260
BLAZE_ALWAYS_INLINE VT::ConstIterator lowerBound(const SparseVector< VT, TF > &sv, size_t index)
Returns an iterator to the first index not less then the given index.
Definition: SparseVector.h:212
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85