SparseVector.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_SMP_DEFAULT_SPARSEVECTOR_H_
36 #define _BLAZE_MATH_SMP_DEFAULT_SPARSEVECTOR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
45 #include <blaze/util/Assert.h>
46 #include <blaze/util/EnableIf.h>
48 
49 
50 namespace blaze {
51 
52 //=================================================================================================
53 //
54 // GLOBAL FUNCTIONS
55 //
56 //=================================================================================================
57 
58 //*************************************************************************************************
61 template< typename VT1, bool TF1, typename VT2, bool TF2 >
62 auto smpAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
63  -> EnableIf_t< IsSparseVector_v<VT1> >;
64 
65 template< typename VT1, bool TF1, typename VT2, bool TF2 >
66 auto smpAddAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
67  -> EnableIf_t< IsSparseVector_v<VT1> >;
68 
69 template< typename VT1, bool TF1, typename VT2, bool TF2 >
70 auto smpSubAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
71  -> EnableIf_t< IsSparseVector_v<VT1> >;
72 
73 template< typename VT1, bool TF1, typename VT2, bool TF2 >
74 auto smpMultAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
75  -> EnableIf_t< IsSparseVector_v<VT1> >;
77 //*************************************************************************************************
78 
79 
80 //*************************************************************************************************
94 template< typename VT1 // Type of the left-hand side sparse vector
95  , bool TF1 // Transpose flag of the left-hand side sparse vector
96  , typename VT2 // Type of the right-hand side vector
97  , bool TF2 > // Transpose flag of the right-hand side vector
98 inline auto smpAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
99  -> EnableIf_t< IsSparseVector_v<VT1> >
100 {
102 
103  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
104  assign( ~lhs, ~rhs );
105 }
106 //*************************************************************************************************
107 
108 
109 //*************************************************************************************************
123 template< typename VT1 // Type of the left-hand side sparse vector
124  , bool TF1 // Transpose flag of the left-hand side sparse vector
125  , typename VT2 // Type of the right-hand side vector
126  , bool TF2 > // Transpose flag of the right-hand side vector
127 inline auto smpAddAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
128  -> EnableIf_t< IsSparseVector_v<VT1> >
129 {
131 
132  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
133  addAssign( ~lhs, ~rhs );
134 }
135 //*************************************************************************************************
136 
137 
138 //*************************************************************************************************
153 template< typename VT1 // Type of the left-hand side sparse vector
154  , bool TF1 // Transpose flag of the left-hand side sparse vector
155  , typename VT2 // Type of the right-hand side vector
156  , bool TF2 > // Transpose flag of the right-hand side vector
157 inline auto smpSubAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
158  -> EnableIf_t< IsSparseVector_v<VT1> >
159 {
161 
162  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
163  subAssign( ~lhs, ~rhs );
164 }
165 //*************************************************************************************************
166 
167 
168 //*************************************************************************************************
183 template< typename VT1 // Type of the left-hand side sparse vector
184  , bool TF1 // Transpose flag of the left-hand side sparse vector
185  , typename VT2 // Type of the right-hand side vector
186  , bool TF2 > // Transpose flag of the right-hand side vector
187 inline auto smpMultAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
188  -> EnableIf_t< IsSparseVector_v<VT1> >
189 {
191 
192  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
193  multAssign( ~lhs, ~rhs );
194 }
195 //*************************************************************************************************
196 
197 } // namespace blaze
198 
199 #endif
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the EnableIf class template.
Header file for the IsSparseVector type trait.
Header file for run time assertion macros.
auto smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:131
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
auto smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:100
auto smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:162
Header file for the Vector CRTP base class.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
auto smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs) -> EnableIf_t< IsDenseVector_v< VT1 > >
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:191
Header file for the function trace functionality.