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/DisableIf.h>
48 #include <blaze/util/EnableIf.h>
49 #include <blaze/util/Unused.h>
50 
51 
52 namespace blaze {
53 
54 //=================================================================================================
55 //
56 // CLASS DEFINITION
57 //
58 //=================================================================================================
59 
60 //*************************************************************************************************
74 template< typename VT // Type of the dense vector
75  , bool TF > // Transpose flag
77  : public Vector<VT,TF>
78 {};
79 //*************************************************************************************************
80 
81 
82 
83 
84 //=================================================================================================
85 //
86 // GLOBAL FUNCTIONS
87 //
88 //=================================================================================================
89 
90 //*************************************************************************************************
93 template< typename VT, bool TF >
94 typename VT::ElementType* data( DenseVector<VT,TF>& dv ) noexcept;
95 
96 template< typename VT, bool TF >
97 const typename VT::ElementType* data( const DenseVector<VT,TF>& dv ) noexcept;
99 //*************************************************************************************************
100 
101 
102 //*************************************************************************************************
113 template< typename VT // Type of the vector
114  , bool TF > // Transpose flag of the vector
115 BLAZE_ALWAYS_INLINE auto data_backend( DenseVector<VT,TF>& dv ) noexcept
117 {
118  UNUSED_PARAMETER( dv );
119 
120  return nullptr;
121 }
123 //*************************************************************************************************
124 
125 
126 //*************************************************************************************************
136 template< typename VT // Type of the vector
137  , bool TF > // Transpose flag of the vector
138 BLAZE_ALWAYS_INLINE auto data_backend( DenseVector<VT,TF>& dv ) noexcept
139  -> EnableIf_t< HasMutableDataAccess_v<VT>, typename VT::ElementType* >
140 {
141  return (~dv).data();
142 }
144 //*************************************************************************************************
145 
146 
147 //*************************************************************************************************
160 template< typename VT // Type of the vector
161  , bool TF > // Transpose flag of the vector
163 {
164  return data_backend( ~dv );
165 }
166 //*************************************************************************************************
167 
168 
169 //*************************************************************************************************
180 template< typename VT // Type of the vector
181  , bool TF > // Transpose flag of the vector
182 BLAZE_ALWAYS_INLINE auto data_backend( const DenseVector<VT,TF>& dv ) noexcept
183  -> DisableIf_t< HasConstDataAccess_v<VT>, const typename VT::ElementType* >
184 {
185  UNUSED_PARAMETER( dv );
186 
187  return nullptr;
188 }
190 //*************************************************************************************************
191 
192 
193 //*************************************************************************************************
203 template< typename VT // Type of the vector
204  , bool TF > // Transpose flag of the vector
205 BLAZE_ALWAYS_INLINE auto data_backend( const DenseVector<VT,TF>& dv ) noexcept
206  -> EnableIf_t< HasConstDataAccess_v<VT>, const typename VT::ElementType* >
207 {
208  return (~dv).data();
209 }
211 //*************************************************************************************************
212 
213 
214 //*************************************************************************************************
227 template< typename VT // Type of the vector
228  , bool TF > // Transpose flag of the vector
229 BLAZE_ALWAYS_INLINE const typename VT::ElementType* data( const DenseVector<VT,TF>& dv ) noexcept
230 {
231  return data_backend( ~dv );
232 }
233 //*************************************************************************************************
234 
235 } // namespace blaze
236 
237 #endif
Header file for the UNUSED_PARAMETER function template.
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:169
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:76
Header file for the EnableIf class template.
Header file for the HasConstDataAccess type trait.
Header file for the HasMutableDataAccess type trait.
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:186
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
System settings for the inline keywords.
Header file for the Vector CRTP base class.