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 
46 #include <blaze/util/Assert.h>
47 #include <blaze/util/EnableIf.h>
49 
50 
51 namespace blaze {
52 
53 //=================================================================================================
54 //
55 // GLOBAL FUNCTIONS
56 //
57 //=================================================================================================
58 
59 //*************************************************************************************************
62 template< typename VT1, bool TF1, typename VT2, bool TF2 >
63 inline typename EnableIf< IsSparseVector<VT1> >::Type
64  smpAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs );
65 
66 template< typename VT1, bool TF1, typename VT2, bool TF2 >
67 inline typename EnableIf< IsSparseVector<VT1> >::Type
68  smpAddAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs );
69 
70 template< typename VT1, bool TF1, typename VT2, bool TF2 >
71 inline typename EnableIf< IsSparseVector<VT1> >::Type
72  smpSubAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs );
73 
74 template< typename VT1, bool TF1, typename VT2, bool TF2 >
75 inline typename EnableIf< IsSparseVector<VT1> >::Type
76  smpMultAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs );
78 //*************************************************************************************************
79 
80 
81 //*************************************************************************************************
95 template< typename VT1 // Type of the left-hand side sparse vector
96  , bool TF1 // Transpose flag of the left-hand side sparse vector
97  , typename VT2 // Type of the right-hand side vector
98  , bool TF2 > // Transpose flag of the right-hand side vector
99 inline typename EnableIf< IsSparseVector<VT1> >::Type
101 {
103 
104  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
105  assign( ~lhs, ~rhs );
106 }
107 //*************************************************************************************************
108 
109 
110 //*************************************************************************************************
124 template< typename VT1 // Type of the left-hand side sparse vector
125  , bool TF1 // Transpose flag of the left-hand side sparse vector
126  , typename VT2 // Type of the right-hand side vector
127  , bool TF2 > // Transpose flag of the right-hand side vector
128 inline typename EnableIf< IsSparseVector<VT1> >::Type
130 {
132 
133  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
134  addAssign( ~lhs, ~rhs );
135 }
136 //*************************************************************************************************
137 
138 
139 //*************************************************************************************************
154 template< typename VT1 // Type of the left-hand side sparse vector
155  , bool TF1 // Transpose flag of the left-hand side sparse vector
156  , typename VT2 // Type of the right-hand side vector
157  , bool TF2 > // Transpose flag of the right-hand side vector
158 inline typename EnableIf< IsSparseVector<VT1> >::Type
160 {
162 
163  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
164  subAssign( ~lhs, ~rhs );
165 }
166 //*************************************************************************************************
167 
168 
169 //*************************************************************************************************
184 template< typename VT1 // Type of the left-hand side sparse vector
185  , bool TF1 // Transpose flag of the left-hand side sparse vector
186  , typename VT2 // Type of the right-hand side vector
187  , bool TF2 > // Transpose flag of the right-hand side vector
188 inline typename EnableIf< IsSparseVector<VT1> >::Type
190 {
192 
193  BLAZE_INTERNAL_ASSERT( (~lhs).size() == (~rhs).size(), "Invalid vector sizes" );
194  multAssign( ~lhs, ~rhs );
195 }
196 //*************************************************************************************************
197 
198 } // namespace blaze
199 
200 #endif
Header file for the SparseVector base class.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the EnableIf class template.
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Header file for the IsSparseVector type trait.
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Base class for N-dimensional vectors.The Vector class is a base class for all arbitrarily sized (N-di...
Definition: Forward.h:164
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
EnableIf< IsDenseVector< VT1 > >::Type smpMultAssign(Vector< VT1, TF1 > &lhs, const Vector< VT2, TF2 > &rhs)
Default implementation of the SMP multiplication assignment of a vector to a dense vector...
Definition: DenseVector.h:189
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
Header file for the FunctionTrace class.