Blaze 3.9
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
51namespace blaze {
52
53//=================================================================================================
54//
55// GLOBAL FUNCTIONS
56//
57//=================================================================================================
58
59//*************************************************************************************************
62template< typename VT1, bool TF1, typename VT2, bool TF2 >
63auto smpAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
64 -> EnableIf_t< IsSparseVector_v<VT1> >;
65
66template< typename VT1, bool TF1, typename VT2, bool TF2 >
67auto smpAddAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
68 -> EnableIf_t< IsSparseVector_v<VT1> >;
69
70template< typename VT1, bool TF1, typename VT2, bool TF2 >
71auto smpSubAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
72 -> EnableIf_t< IsSparseVector_v<VT1> >;
73
74template< typename VT1, bool TF1, typename VT2, bool TF2 >
75auto smpMultAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
76 -> EnableIf_t< IsSparseVector_v<VT1> >;
78//*************************************************************************************************
79
80
81//*************************************************************************************************
95template< 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
99inline auto smpAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
100 -> EnableIf_t< IsSparseVector_v<VT1> >
101{
103
104 BLAZE_INTERNAL_ASSERT( (*lhs).size() == (*rhs).size(), "Invalid vector sizes" );
105 assign( *lhs, *rhs );
106}
107//*************************************************************************************************
108
109
110//*************************************************************************************************
124template< 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
128inline auto smpAddAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
129 -> EnableIf_t< IsSparseVector_v<VT1> >
130{
132
133 BLAZE_INTERNAL_ASSERT( (*lhs).size() == (*rhs).size(), "Invalid vector sizes" );
134 addAssign( *lhs, *rhs );
135}
136//*************************************************************************************************
137
138
139//*************************************************************************************************
154template< 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
158inline auto smpSubAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
159 -> EnableIf_t< IsSparseVector_v<VT1> >
160{
162
163 BLAZE_INTERNAL_ASSERT( (*lhs).size() == (*rhs).size(), "Invalid vector sizes" );
164 subAssign( *lhs, *rhs );
165}
166//*************************************************************************************************
167
168
169//*************************************************************************************************
184template< 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
188inline auto smpMultAssign( Vector<VT1,TF1>& lhs, const Vector<VT2,TF2>& rhs )
189 -> EnableIf_t< IsSparseVector_v<VT1> >
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 run time assertion macros.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the IsSparseVector type trait.
Deactivation of problematic macros.
Header file for the Vector CRTP base class.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
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
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 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:192
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.
Definition: FunctionTrace.h:94