Blaze
3.9
Toggle main menu visibility
Loading...
Searching...
No Matches
blaze
math
expressions
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
43
#include <
blaze/math/expressions/Vector.h
>
44
45
46
namespace
blaze {
47
48
//=================================================================================================
49
//
50
// CLASS DEFINITION
51
//
52
//=================================================================================================
53
54
//*************************************************************************************************
68
template
<
typename
VT
// Type of the sparse vector
69
,
bool
TF >
// Transpose flag
70
class
SparseVector
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
//*************************************************************************************************
100
template
<
typename
VT,
bool
TF >
101
typename
VT::Iterator
find
(
SparseVector<VT,TF>
& sv,
size_t
index );
102
103
template
<
typename
VT,
bool
TF >
104
typename
VT::ConstIterator
find
(
const
SparseVector<VT,TF>
& sv,
size_t
index );
105
106
template
<
typename
VT,
bool
TF >
107
typename
VT::Iterator
lowerBound
(
SparseVector<VT,TF>
& sv,
size_t
index );
108
109
template
<
typename
VT,
bool
TF >
110
typename
VT::ConstIterator
lowerBound
(
const
SparseVector<VT,TF>
& sv,
size_t
index );
111
112
template
<
typename
VT,
bool
TF >
113
typename
VT::Iterator
upperBound
(
SparseVector<VT,TF>
& sv,
size_t
index );
114
115
template
<
typename
VT,
bool
TF >
116
typename
VT::ConstIterator
upperBound
(
const
SparseVector<VT,TF>
& sv,
size_t
index );
118
//*************************************************************************************************
119
120
121
//*************************************************************************************************
136
template
<
typename
VT
// Type of the vector
137
,
bool
TF >
// Transpose flag of the vector
138
BLAZE_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
//*************************************************************************************************
161
template
<
typename
VT
// Type of the vector
162
,
bool
TF >
// Transpose flag of the vector
163
BLAZE_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
//*************************************************************************************************
185
template
<
typename
VT
// Type of the vector
186
,
bool
TF >
// Transpose flag of the vector
187
BLAZE_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
//*************************************************************************************************
209
template
<
typename
VT
// Type of the vector
210
,
bool
TF >
// Transpose flag of the vector
211
BLAZE_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
//*************************************************************************************************
233
template
<
typename
VT
// Type of the vector
234
,
bool
TF >
// Transpose flag of the vector
235
BLAZE_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
//*************************************************************************************************
257
template
<
typename
VT
// Type of the vector
258
,
bool
TF >
// Transpose flag of the vector
259
BLAZE_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
blaze::SparseVector
Base class for sparse vectors.
Definition
SparseVector.h:72
Vector.h
Header file for the Vector CRTP base class.
blaze::upperBound
MT::Iterator upperBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index greater than the given index.
Definition
SparseMatrix.h:244
blaze::lowerBound
MT::Iterator lowerBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index not less than the given index.
Definition
SparseMatrix.h:194
blaze::find
MT::Iterator find(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Searches for a specific matrix element.
Definition
SparseMatrix.h:144
BLAZE_ALWAYS_INLINE
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition
Inline.h:85
Generated by
1.18.0