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 
46 #include <blaze/util/Assert.h>
47 #include <blaze/util/EnableIf.h>
50 
51 
52 namespace blaze {
53 
54 //=================================================================================================
55 //
56 // GLOBAL FUNCTIONS
57 //
58 //=================================================================================================
59 
60 //*************************************************************************************************
63 template< typename MT1, bool SO1, typename MT2, bool SO2 >
64 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
65  smpAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs );
66 
67 template< typename MT1, bool SO1, typename MT2, bool SO2 >
68 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
69  smpAddAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs );
70 
71 template< typename MT1, bool SO1, typename MT2, bool SO2 >
72 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
73  smpSubAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs );
75 //*************************************************************************************************
76 
77 
78 //*************************************************************************************************
92 template< typename MT1 // Type of the left-hand side sparse matrix
93  , bool SO1 // Storage order of the left-hand side sparse matrix
94  , typename MT2 // Type of the right-hand side matrix
95  , bool SO2 > // Storage order of the right-hand side matrix
96 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
98 {
100 
101  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == (~rhs).rows() , "Invalid number of rows" );
102  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );
103 
104  assign( ~lhs, ~rhs );
105 }
106 //*************************************************************************************************
107 
108 
109 //*************************************************************************************************
123 template< typename MT1 // Type of the left-hand side sparse matrix
124  , bool SO1 // Storage order of the left-hand side sparse matrix
125  , typename MT2 // Type of the right-hand side matrix
126  , bool SO2 > // Storage order of the right-hand side matrix
127 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
129 {
131 
132  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == (~rhs).rows() , "Invalid number of rows" );
133  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );
134 
135  addAssign( ~lhs, ~rhs );
136 }
137 //*************************************************************************************************
138 
139 
140 //*************************************************************************************************
154 template< typename MT1 // Type of the left-hand side sparse matrix
155  , bool SO1 // Storage order of the left-hand side sparse matrix
156  , typename MT2 // Type of the right-hand side matrix
157  , bool SO2 > // Storage order of the right-hand side matrix
158 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
160 {
162 
163  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == (~rhs).rows() , "Invalid number of rows" );
164  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );
165 
166  subAssign( ~lhs, ~rhs );
167 }
168 //*************************************************************************************************
169 
170 } // namespace blaze
171 
172 #endif
Header file for the IsSparseMatrix type trait.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
Header file for the SparseMatrix base class.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Compile time assertion.
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
Header file for the EnableIf class template.
Header file for the Matrix base class.
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 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
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:87
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
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
#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.
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849