Blaze 3.9
DenseVector.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_EXPRESSIONS_DENSEVECTOR_H_
36#define _BLAZE_MATH_EXPRESSIONS_DENSEVECTOR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
46#include <blaze/system/Inline.h>
47#include <blaze/util/EnableIf.h>
49
50
51namespace blaze {
52
53//=================================================================================================
54//
55// CLASS DEFINITION
56//
57//=================================================================================================
58
59//*************************************************************************************************
73template< typename VT // Type of the dense vector
74 , bool TF > // Transpose flag
76 : public Vector<VT,TF>
77{
78 protected:
79 //**Special member functions********************************************************************
82 DenseVector() = default;
83 DenseVector( const DenseVector& ) = default;
84 DenseVector( DenseVector&& ) = default;
85 ~DenseVector() = default;
86 DenseVector& operator=( const DenseVector& ) = default;
87 DenseVector& operator=( DenseVector&& ) = default;
89 //**********************************************************************************************
90};
91//*************************************************************************************************
92
93
94
95
96//=================================================================================================
97//
98// GLOBAL FUNCTIONS
99//
100//=================================================================================================
101
102//*************************************************************************************************
105template< typename VT, bool TF >
106typename VT::ElementType* data( DenseVector<VT,TF>& dv ) noexcept;
107
108template< typename VT, bool TF >
109const typename VT::ElementType* data( const DenseVector<VT,TF>& dv ) noexcept;
111//*************************************************************************************************
112
113
114//*************************************************************************************************
125template< typename VT // Type of the vector
126 , bool TF > // Transpose flag of the vector
127BLAZE_ALWAYS_INLINE auto data_backend( DenseVector<VT,TF>& dv ) noexcept
128 -> DisableIf_t< HasMutableDataAccess_v<VT>, typename VT::ElementType* >
129{
130 MAYBE_UNUSED( dv );
131
132 return nullptr;
133}
135//*************************************************************************************************
136
137
138//*************************************************************************************************
148template< typename VT // Type of the vector
149 , bool TF > // Transpose flag of the vector
150BLAZE_ALWAYS_INLINE auto data_backend( DenseVector<VT,TF>& dv ) noexcept
151 -> EnableIf_t< HasMutableDataAccess_v<VT>, typename VT::ElementType* >
152{
153 return (*dv).data();
154}
156//*************************************************************************************************
157
158
159//*************************************************************************************************
172template< typename VT // Type of the vector
173 , bool TF > // Transpose flag of the vector
174BLAZE_ALWAYS_INLINE typename VT::ElementType* data( DenseVector<VT,TF>& dv ) noexcept
175{
176 return data_backend( *dv );
177}
178//*************************************************************************************************
179
180
181//*************************************************************************************************
192template< typename VT // Type of the vector
193 , bool TF > // Transpose flag of the vector
194BLAZE_ALWAYS_INLINE auto data_backend( const DenseVector<VT,TF>& dv ) noexcept
195 -> DisableIf_t< HasConstDataAccess_v<VT>, const typename VT::ElementType* >
196{
197 MAYBE_UNUSED( dv );
198
199 return nullptr;
200}
202//*************************************************************************************************
203
204
205//*************************************************************************************************
215template< typename VT // Type of the vector
216 , bool TF > // Transpose flag of the vector
217BLAZE_ALWAYS_INLINE auto data_backend( const DenseVector<VT,TF>& dv ) noexcept
218 -> EnableIf_t< HasConstDataAccess_v<VT>, const typename VT::ElementType* >
219{
220 return (*dv).data();
221}
223//*************************************************************************************************
224
225
226//*************************************************************************************************
239template< typename VT // Type of the vector
240 , bool TF > // Transpose flag of the vector
241BLAZE_ALWAYS_INLINE const typename VT::ElementType* data( const DenseVector<VT,TF>& dv ) noexcept
242{
243 return data_backend( *dv );
244}
245//*************************************************************************************************
246
247} // namespace blaze
248
249#endif
Header file for the EnableIf class template.
Header file for the HasConstDataAccess type trait.
Header file for the HasMutableDataAccess type trait.
Header file for the MAYBE_UNUSED function template.
Base class for N-dimensional dense vectors.
Definition: DenseVector.h:77
Base class for N-dimensional vectors.
Definition: Vector.h:82
Header file for the Vector CRTP base class.
BLAZE_ALWAYS_INLINE const VT::ElementType * data(const DenseVector< VT, TF > &dv) noexcept
Low-level data access to the dense vector elements.
Definition: DenseVector.h:241
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
System settings for the inline keywords.