Blaze 3.9
SparseMatrix.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_SMP_DEFAULT_SPARSEMATRIX_H_
36#define _BLAZE_MATH_SMP_DEFAULT_SPARSEMATRIX_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
45#include <blaze/util/Assert.h>
46#include <blaze/util/EnableIf.h>
48
49
50namespace blaze {
51
52//=================================================================================================
53//
54// GLOBAL FUNCTIONS
55//
56//=================================================================================================
57
58//*************************************************************************************************
61template< typename MT1, bool SO1, typename MT2, bool SO2 >
62auto smpAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
63 -> EnableIf_t< IsSparseMatrix_v<MT1> >;
64
65template< typename MT1, bool SO1, typename MT2, bool SO2 >
66auto smpAddAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
67 -> EnableIf_t< IsSparseMatrix_v<MT1> >;
68
69template< typename MT1, bool SO1, typename MT2, bool SO2 >
70auto smpSubAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
71 -> EnableIf_t< IsSparseMatrix_v<MT1> >;
72
73template< typename MT1, bool SO1, typename MT2, bool SO2 >
74auto smpSchurAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
75 -> EnableIf_t< IsSparseMatrix_v<MT1> >;
77//*************************************************************************************************
78
79
80//*************************************************************************************************
94template< typename MT1 // Type of the left-hand side sparse matrix
95 , bool SO1 // Storage order of the left-hand side sparse matrix
96 , typename MT2 // Type of the right-hand side matrix
97 , bool SO2 > // Storage order of the right-hand side matrix
98inline auto smpAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
99 -> EnableIf_t< IsSparseMatrix_v<MT1> >
100{
102
103 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == (*rhs).rows() , "Invalid number of rows" );
104 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == (*rhs).columns(), "Invalid number of columns" );
105
106 assign( *lhs, *rhs );
107}
108//*************************************************************************************************
109
110
111//*************************************************************************************************
125template< typename MT1 // Type of the left-hand side sparse matrix
126 , bool SO1 // Storage order of the left-hand side sparse matrix
127 , typename MT2 // Type of the right-hand side matrix
128 , bool SO2 > // Storage order of the right-hand side matrix
129inline auto smpAddAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
130 -> EnableIf_t< IsSparseMatrix_v<MT1> >
131{
133
134 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == (*rhs).rows() , "Invalid number of rows" );
135 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == (*rhs).columns(), "Invalid number of columns" );
136
137 addAssign( *lhs, *rhs );
138}
139//*************************************************************************************************
140
141
142//*************************************************************************************************
156template< typename MT1 // Type of the left-hand side sparse matrix
157 , bool SO1 // Storage order of the left-hand side sparse matrix
158 , typename MT2 // Type of the right-hand side matrix
159 , bool SO2 > // Storage order of the right-hand side matrix
160inline auto smpSubAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
161 -> EnableIf_t< IsSparseMatrix_v<MT1> >
162{
164
165 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == (*rhs).rows() , "Invalid number of rows" );
166 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == (*rhs).columns(), "Invalid number of columns" );
167
168 subAssign( *lhs, *rhs );
169}
170//*************************************************************************************************
171
172
173//*************************************************************************************************
188template< typename MT1 // Type of the left-hand side sparse matrix
189 , bool SO1 // Storage order of the left-hand side sparse matrix
190 , typename MT2 // Type of the right-hand side matrix
191 , bool SO2 > // Storage order of the right-hand side matrix
192inline auto smpSchurAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
193 -> EnableIf_t< IsSparseMatrix_v<MT1> >
194{
196
197 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == (*rhs).rows() , "Invalid number of rows" );
198 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == (*rhs).columns(), "Invalid number of columns" );
199
200 schurAssign( *lhs, *rhs );
201}
202//*************************************************************************************************
203
204} // namespace blaze
205
206#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 IsSparseMatrix type trait.
Header file for the Matrix 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 smpSchurAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) -> EnableIf_t< IsDenseMatrix_v< MT1 > >
Default implementation of the SMP Schur product assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:194
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