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>
49 
50 
51 namespace blaze {
52 
53 //=================================================================================================
54 //
55 // GLOBAL FUNCTIONS
56 //
57 //=================================================================================================
58 
59 //*************************************************************************************************
62 template< typename MT1, bool SO1, typename MT2, bool SO2 >
63 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
64  smpAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs );
65 
66 template< typename MT1, bool SO1, typename MT2, bool SO2 >
67 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
68  smpAddAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs );
69 
70 template< typename MT1, bool SO1, typename MT2, bool SO2 >
71 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
72  smpSubAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs );
74 //*************************************************************************************************
75 
76 
77 //*************************************************************************************************
91 template< typename MT1 // Type of the left-hand side sparse matrix
92  , bool SO1 // Storage order of the left-hand side sparse matrix
93  , typename MT2 // Type of the right-hand side matrix
94  , bool SO2 > // Storage order of the right-hand side matrix
95 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
97 {
99 
100  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == (~rhs).rows() , "Invalid number of rows" );
101  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );
102 
103  assign( ~lhs, ~rhs );
104 }
105 //*************************************************************************************************
106 
107 
108 //*************************************************************************************************
122 template< typename MT1 // Type of the left-hand side sparse matrix
123  , bool SO1 // Storage order of the left-hand side sparse matrix
124  , typename MT2 // Type of the right-hand side matrix
125  , bool SO2 > // Storage order of the right-hand side matrix
126 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
128 {
130 
131  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == (~rhs).rows() , "Invalid number of rows" );
132  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );
133 
134  addAssign( ~lhs, ~rhs );
135 }
136 //*************************************************************************************************
137 
138 
139 //*************************************************************************************************
153 template< typename MT1 // Type of the left-hand side sparse matrix
154  , bool SO1 // Storage order of the left-hand side sparse matrix
155  , typename MT2 // Type of the right-hand side matrix
156  , bool SO2 > // Storage order of the right-hand side matrix
157 inline typename EnableIf< IsSparseMatrix<MT1> >::Type
159 {
161 
162  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == (~rhs).rows() , "Invalid number of rows" );
163  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );
164 
165  subAssign( ~lhs, ~rhs );
166 }
167 //*************************************************************************************************
168 
169 } // namespace blaze
170 
171 #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:308
Header file for the SparseMatrix base class.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
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
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:94
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:324
#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.