1 //=================================================================================================
2 /*!
3 // \file blazetest/mathtest/operations/dmatsmatadd/OperationTest.h
4 // \brief Header file for the dense matrix/sparse matrix addition operation test
5 //
6 // Copyright (C) 2012-2020 Klaus Iglberger - All Rights Reserved
7 //
8 // This file is part of the Blaze library. You can redistribute it and/or modify it under
9 // the terms of the New (Revised) BSD License. Redistribution and use in source and binary
10 // forms, with or without modification, are permitted provided that the following conditions
11 // are met:
12 //
13 // 1. Redistributions of source code must retain the above copyright notice, this list of
14 // conditions and the following disclaimer.
15 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
16 // of conditions and the following disclaimer in the documentation and/or other materials
17 // provided with the distribution.
18 // 3. Neither the names of the Blaze development group nor the names of its contributors
19 // may be used to endorse or promote products derived from this software without specific
20 // prior written permission.
21 //
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
23 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31 // DAMAGE.
32 */
33 //=================================================================================================
34
35 #ifndef _BLAZETEST_MATHTEST_OPERATIONS_DMATSMATADD_OPERATIONTEST_H_
36 #define _BLAZETEST_MATHTEST_OPERATIONS_DMATSMATADD_OPERATIONTEST_H_
37
38
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42
43 #include <algorithm>
44 #include <sstream>
45 #include <stdexcept>
46 #include <string>
47 #include <typeinfo>
48 #include <utility>
49 #include <vector>
50 #include <blaze/math/Aliases.h>
51 #include <blaze/math/CompressedMatrix.h>
52 #include <blaze/math/constraints/ColumnMajorMatrix.h>
53 #include <blaze/math/constraints/DenseMatrix.h>
54 #include <blaze/math/constraints/RowMajorMatrix.h>
55 #include <blaze/math/constraints/Scalar.h>
56 #include <blaze/math/constraints/SparseMatrix.h>
57 #include <blaze/math/constraints/StorageOrder.h>
58 #include <blaze/math/DynamicMatrix.h>
59 #include <blaze/math/Functors.h>
60 #include <blaze/math/shims/Equal.h>
61 #include <blaze/math/shims/IsDefault.h>
62 #include <blaze/math/traits/AddTrait.h>
63 #include <blaze/math/typetraits/IsDiagonal.h>
64 #include <blaze/math/typetraits/IsHermitian.h>
65 #include <blaze/math/typetraits/IsResizable.h>
66 #include <blaze/math/typetraits/IsRowMajorMatrix.h>
67 #include <blaze/math/typetraits/IsSquare.h>
68 #include <blaze/math/typetraits/IsSymmetric.h>
69 #include <blaze/math/typetraits/IsTriangular.h>
70 #include <blaze/math/typetraits/IsUniform.h>
71 #include <blaze/math/typetraits/UnderlyingBuiltin.h>
72 #include <blaze/math/typetraits/UnderlyingScalar.h>
73 #include <blaze/math/Views.h>
74 #include <blaze/util/algorithms/Min.h>
75 #include <blaze/util/constraints/DerivedFrom.h>
76 #include <blaze/util/constraints/SameType.h>
77 #include <blaze/util/IntegralConstant.h>
78 #include <blaze/util/mpl/If.h>
79 #include <blaze/util/mpl/Nor.h>
80 #include <blaze/util/mpl/Not.h>
81 #include <blaze/util/mpl/Or.h>
82 #include <blaze/util/Random.h>
83 #include <blaze/util/typetraits/IsComplex.h>
84 #include <blaze/util/typetraits/RemoveCVRef.h>
85 #include <blazetest/system/LAPACK.h>
86 #include <blazetest/system/MathTest.h>
87 #include <blazetest/mathtest/Creator.h>
88 #include <blazetest/mathtest/IsEqual.h>
89 #include <blazetest/mathtest/MatchAdaptor.h>
90 #include <blazetest/mathtest/MatchSymmetry.h>
91 #include <blazetest/mathtest/RandomMaximum.h>
92 #include <blazetest/mathtest/RandomMinimum.h>
93
94
95 namespace blazetest {
96
97 namespace mathtest {
98
99 namespace operations {
100
101 namespace dmatsmatadd {
102
103 //=================================================================================================
104 //
105 // CLASS DEFINITION
106 //
107 //=================================================================================================
108
109 //*************************************************************************************************
110 /*!\brief Auxiliary class template for the dense matrix/sparse matrix addition operation test.
111 //
112 // This class template represents one particular matrix addition test between two matrices of
113 // a particular type. The two template arguments \a MT1 and \a MT2 represent the types of the
114 // left-hand side and right-hand side matrix, respectively.
115 */
116 template< typename MT1 // Type of the left-hand side dense matrix
117 , typename MT2 > // Type of the right-hand side sparse matrix
118 class OperationTest
119 {
120 private:
121 //**Type definitions****************************************************************************
122 using ET1 = blaze::ElementType_t<MT1>; //!< Element type 1
123 using ET2 = blaze::ElementType_t<MT2>; //!< Element type 2
124
125 using OMT1 = blaze::OppositeType_t<MT1>; //!< Matrix type 1 with opposite storage order
126 using OMT2 = blaze::OppositeType_t<MT2>; //!< Matrix type 2 with opposite storage order
127 using TMT1 = blaze::TransposeType_t<MT1>; //!< Transpose matrix type 1
128 using TMT2 = blaze::TransposeType_t<MT2>; //!< Transpose matrix type 2
129 using TOMT1 = blaze::TransposeType_t<OMT1>; //!< Transpose matrix type 1 with opposite storage order
130 using TOMT2 = blaze::TransposeType_t<OMT2>; //!< Transpose matrix type 2 with opposite storage order
131
132 //! Dense result type
133 using DRE = blaze::AddTrait_t<MT1,MT2>;
134
135 using DET = blaze::ElementType_t<DRE>; //!< Element type of the dense result
136 using ODRE = blaze::OppositeType_t<DRE>; //!< Dense result type with opposite storage order
137 using TDRE = blaze::TransposeType_t<DRE>; //!< Transpose dense result type
138 using TODRE = blaze::TransposeType_t<ODRE>; //!< Transpose dense result type with opposite storage order
139
140 //! Sparse result type
141 using SRE = MatchAdaptor_t< DRE, blaze::CompressedMatrix<DET,false> >;
142
143 using SET = blaze::ElementType_t<SRE>; //!< Element type of the sparse result
144 using OSRE = blaze::OppositeType_t<SRE>; //!< Sparse result type with opposite storage order
145 using TSRE = blaze::TransposeType_t<SRE>; //!< Transpose sparse result type
146 using TOSRE = blaze::TransposeType_t<OSRE>; //!< Transpose sparse result type with opposite storage order
147
148 using RT1 = blaze::DynamicMatrix<ET1,false>; //!< Reference type 1
149 using RT2 = blaze::DynamicMatrix<ET2,false>; //!< Reference type 2
150
151 //! Reference result type
152 using RRE = MatchSymmetry_t< DRE, blaze::AddTrait_t<RT1,RT2> >;
153
154 //! Type of the matrix/matrix addition expression
155 using MatMatAddExprType =
156 blaze::RemoveCVRef_t< decltype( std::declval<MT1>() + std::declval<MT2>() ) >;
157
158 //! Type of the matrix/transpose matrix addition expression
159 using MatTMatAddExprType =
160 blaze::RemoveCVRef_t< decltype( std::declval<MT1>() + std::declval<OMT2>() ) >;
161
162 //! Type of the transpose matrix/matrix addition expression
163 using TMatMatAddExprType =
164 blaze::RemoveCVRef_t< decltype( std::declval<OMT1>() + std::declval<MT2>() ) >;
165
166 //! Type of the transpose matrix/transpose matrix addition expression
167 using TMatTMatAddExprType =
168 blaze::RemoveCVRef_t< decltype( std::declval<OMT1>() + std::declval<OMT2>() ) >;
169 //**********************************************************************************************
170
171 public:
172 //**Constructors********************************************************************************
173 /*!\name Constructors */
174 //@{
175 explicit OperationTest( const Creator<MT1>& creator1, const Creator<MT2>& creator2 );
176 // No explicitly declared copy constructor.
177 //@}
178 //**********************************************************************************************
179
180 //**Destructor**********************************************************************************
181 // No explicitly declared destructor.
182 //**********************************************************************************************
183
184 private:
185 //**Test functions******************************************************************************
186 /*!\name Test functions */
187 //@{
188 void testInitialStatus ();
189 void testAssignment ();
190 void testEvaluation ();
191 void testElementAccess ();
192 void testBasicOperation ();
193 void testNegatedOperation ();
194 template< typename T > void testScaledOperation ( T scalar );
195 void testTransOperation ();
196 void testCTransOperation ();
197 void testAbsOperation ();
198 void testConjOperation ();
199 void testRealOperation ();
200 void testImagOperation ();
201 void testInvOperation ( blaze::TrueType );
202 void testInvOperation ( blaze::FalseType );
203 void testEvalOperation ();
204 void testSerialOperation ();
205 void testNoAliasOperation ();
206 void testNoSIMDOperation ();
207 void testDeclSymOperation ( blaze::TrueType );
208 void testDeclSymOperation ( blaze::FalseType );
209 void testDeclHermOperation ( blaze::TrueType );
210 void testDeclHermOperation ( blaze::FalseType );
211 void testDeclLowOperation ( blaze::TrueType );
212 void testDeclLowOperation ( blaze::FalseType );
213 void testDeclUppOperation ( blaze::TrueType );
214 void testDeclUppOperation ( blaze::FalseType );
215 void testDeclDiagOperation ( blaze::TrueType );
216 void testDeclDiagOperation ( blaze::FalseType );
217 void testSubmatrixOperation( blaze::TrueType );
218 void testSubmatrixOperation( blaze::FalseType );
219 void testRowOperation ( blaze::TrueType );
220 void testRowOperation ( blaze::FalseType );
221 void testRowsOperation ( blaze::TrueType );
222 void testRowsOperation ( blaze::FalseType );
223 void testColumnOperation ( blaze::TrueType );
224 void testColumnOperation ( blaze::FalseType );
225 void testColumnsOperation ( blaze::TrueType );
226 void testColumnsOperation ( blaze::FalseType );
227 void testBandOperation ( blaze::TrueType );
228 void testBandOperation ( blaze::FalseType );
229
230 template< typename OP > void testCustomOperation( OP op, const std::string& name );
231 //@}
232 //**********************************************************************************************
233
234 //**Error detection functions*******************************************************************
235 /*!\name Error detection functions */
236 //@{
237 template< typename LT, typename RT > void checkResults();
238 template< typename LT, typename RT > void checkTransposeResults();
239 void checkExceptionMessage( const std::exception& ex, const std::string& message );
240 //@}
241 //**********************************************************************************************
242
243 //**Utility functions***************************************************************************
244 /*!\name Utility functions */
245 //@{
246 void initResults();
247 void initTransposeResults();
248 template< typename LT, typename RT > void convertException( const std::exception& ex );
249 //@}
250 //**********************************************************************************************
251
252 //**Member variables****************************************************************************
253 /*!\name Member variables */
254 //@{
255 MT1 lhs_; //!< The left-hand side dense matrix.
256 MT2 rhs_; //!< The right-hand side sparse matrix.
257 OMT1 olhs_; //!< The left-hand side dense matrix with opposite storage order.
258 OMT2 orhs_; //!< The right-hand side sparse matrix with opposite storage order.
259 DRE dres_; //!< The dense result matrix.
260 SRE sres_; //!< The sparse result matrix.
261 ODRE odres_; //!< The dense result matrix with opposite storage order.
262 OSRE osres_; //!< The sparse result matrix with opposite storage order.
263 TDRE tdres_; //!< The transpose dense result matrix.
264 TSRE tsres_; //!< The transpose sparse result matrix.
265 TODRE todres_; //!< The transpose dense result matrix with opposite storage order.
266 TOSRE tosres_; //!< The transpose sparse result matrix with opposite storage order.
267 RT1 reflhs_; //!< The reference left-hand side matrix.
268 RT2 refrhs_; //!< The reference right-hand side matrix.
269 RRE refres_; //!< The reference result.
270
271 std::string test_; //!< Label of the currently performed test.
272 std::string error_; //!< Description of the current error type.
273 //@}
274 //**********************************************************************************************
275
276 //**Compile time checks*************************************************************************
277 /*! \cond BLAZE_INTERNAL */
278 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( MT1 );
279 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( MT2 );
280 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( OMT1 );
281 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( OMT2 );
282 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( TMT1 );
283 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TMT2 );
284 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( TOMT1 );
285 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TOMT2 );
286 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( RT1 );
287 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( RT2 );
288 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( RRE );
289 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( DRE );
290 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( SRE );
291 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( ODRE );
292 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( OSRE );
293 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( TDRE );
294 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TSRE );
295 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( TODRE );
296 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TOSRE );
297
298 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( MT1 );
299 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( MT2 );
300 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OMT1 );
301 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OMT2 );
302 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TMT1 );
303 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TMT2 );
304 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TOMT1 );
305 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TOMT2 );
306 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( RT1 );
307 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( RT2 );
308 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( DRE );
309 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( SRE );
310 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( ODRE );
311 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OSRE );
312 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TDRE );
313 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TSRE );
314 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TODRE );
315 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TOSRE );
316
317 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET1, blaze::ElementType_t<OMT1> );
318 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET2, blaze::ElementType_t<OMT2> );
319 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET1, blaze::ElementType_t<TMT1> );
320 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET2, blaze::ElementType_t<TMT2> );
321 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET1, blaze::ElementType_t<TOMT1> );
322 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET2, blaze::ElementType_t<TOMT2> );
323 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<DRE> );
324 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<ODRE> );
325 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<TDRE> );
326 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<TODRE> );
327 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<SRE> );
328 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<SRE> );
329 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<OSRE> );
330 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<TSRE> );
331 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<TOSRE> );
332 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<DRE> );
333 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT1, blaze::OppositeType_t<OMT1> );
334 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT2, blaze::OppositeType_t<OMT2> );
335 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT1, blaze::TransposeType_t<TMT1> );
336 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT2, blaze::TransposeType_t<TMT2> );
337 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DRE, blaze::OppositeType_t<ODRE> );
338 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DRE, blaze::TransposeType_t<TDRE> );
339 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SRE, blaze::OppositeType_t<OSRE> );
340 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SRE, blaze::TransposeType_t<TSRE> );
341
342 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( MatMatAddExprType, blaze::ResultType_t<MatMatAddExprType> );
343 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatMatAddExprType, blaze::OppositeType_t<MatMatAddExprType> );
344 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatMatAddExprType, blaze::TransposeType_t<MatMatAddExprType> );
345
346 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( MatTMatAddExprType, blaze::ResultType_t<MatTMatAddExprType> );
347 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatTMatAddExprType, blaze::OppositeType_t<MatTMatAddExprType> );
348 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatTMatAddExprType, blaze::TransposeType_t<MatTMatAddExprType> );
349
350 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( TMatMatAddExprType, blaze::ResultType_t<TMatMatAddExprType> );
351 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatMatAddExprType, blaze::OppositeType_t<TMatMatAddExprType> );
352 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatMatAddExprType, blaze::TransposeType_t<TMatMatAddExprType> );
353
354 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( TMatTMatAddExprType, blaze::ResultType_t<TMatTMatAddExprType> );
355 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatTMatAddExprType, blaze::OppositeType_t<TMatTMatAddExprType> );
356 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatTMatAddExprType, blaze::TransposeType_t<TMatTMatAddExprType> );
357
358 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( MatMatAddExprType , blaze::BaseType_t<MatMatAddExprType > );
359 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( MatTMatAddExprType , blaze::BaseType_t<MatTMatAddExprType > );
360 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( TMatMatAddExprType , blaze::BaseType_t<TMatMatAddExprType > );
361 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( TMatTMatAddExprType, blaze::BaseType_t<TMatTMatAddExprType> );
362 /*! \endcond */
363 //**********************************************************************************************
364 };
365 //*************************************************************************************************
366
367
368
369
370 //=================================================================================================
371 //
372 // CONSTRUCTORS
373 //
374 //=================================================================================================
375
376 //*************************************************************************************************
377 /*!\brief Constructor for the dense matrix/sparse matrix addition operation test.
378 //
379 // \param creator1 The creator for the left-hand side dense matrix of the matrix addition.
380 // \param creator2 The creator for the right-hand side sparse matrix of the matrix addition.
381 // \exception std::runtime_error Operation error detected.
382 */
383 template< typename MT1 // Type of the left-hand side dense matrix
384 , typename MT2 > // Type of the right-hand side sparse matrix
OperationTest(const Creator<MT1> & creator1,const Creator<MT2> & creator2)385 OperationTest<MT1,MT2>::OperationTest( const Creator<MT1>& creator1, const Creator<MT2>& creator2 )
386 : lhs_( creator1() ) // The left-hand side dense matrix
387 , rhs_( creator2() ) // The right-hand side sparse matrix
388 , olhs_( lhs_ ) // The left-hand side dense matrix with opposite storage order
389 , orhs_( rhs_ ) // The right-hand side sparse matrix with opposite storage order
390 , dres_() // The dense result matrix
391 , sres_() // The sparse result matrix
392 , odres_() // The dense result matrix with opposite storage order
393 , osres_() // The sparse result matrix with opposite storage order
394 , tdres_() // The transpose dense result matrix
395 , tsres_() // The transpose sparse result matrix
396 , todres_() // The transpose dense result matrix with opposite storage order
397 , tosres_() // The transpose sparse result matrix with opposite storage order
398 , reflhs_( lhs_ ) // The reference left-hand side matrix
399 , refrhs_( rhs_ ) // The reference right-hand side matrix
400 , refres_() // The reference result
401 , test_() // Label of the currently performed test
402 , error_() // Description of the current error type
403 {
404 using namespace blaze;
405
406 using Scalar = UnderlyingScalar_t<DET>;
407
408 testInitialStatus();
409 testAssignment();
410 testEvaluation();
411 testElementAccess();
412 testBasicOperation();
413 testNegatedOperation();
414 testScaledOperation( 2 );
415 testScaledOperation( 2UL );
416 testScaledOperation( 2.0F );
417 testScaledOperation( 2.0 );
418 testScaledOperation( Scalar( 2 ) );
419 testTransOperation();
420 testCTransOperation();
421 testAbsOperation();
422 testConjOperation();
423 testRealOperation();
424 testImagOperation();
425 testInvOperation( Not_t< IsUniform<DRE> >() );
426 testEvalOperation();
427 testSerialOperation();
428 testNoAliasOperation();
429 testNoSIMDOperation();
430 testDeclSymOperation( Or_t< IsSquare<DRE>, IsResizable<DRE> >() );
431 testDeclHermOperation( Or_t< IsSquare<DRE>, IsResizable<DRE> >() );
432 testDeclLowOperation( Or_t< IsSquare<DRE>, IsResizable<DRE> >() );
433 testDeclUppOperation( Or_t< IsSquare<DRE>, IsResizable<DRE> >() );
434 testDeclDiagOperation( Or_t< IsSquare<DRE>, IsResizable<DRE> >() );
435 testSubmatrixOperation( Not_t< IsUniform<DRE> >() );
436 testRowOperation( Not_t< IsUniform<DRE> >() );
437 testRowsOperation( Nor_t< IsUniform<DRE>, IsSymmetric<DRE>, IsHermitian<DRE> >() );
438 testColumnOperation( Not_t< IsUniform<DRE> >() );
439 testColumnsOperation( Nor_t< IsUniform<DRE>, IsSymmetric<DRE>, IsHermitian<DRE> >() );
440 testBandOperation( Not_t< IsUniform<DRE> >() );
441 }
442 //*************************************************************************************************
443
444
445
446
447 //=================================================================================================
448 //
449 // TEST FUNCTIONS
450 //
451 //=================================================================================================
452
453 //*************************************************************************************************
454 /*!\brief Tests on the initial status of the matrices.
455 //
456 // \return void
457 // \exception std::runtime_error Initialization error detected.
458 //
459 // This function runs tests on the initial status of the matrices. In case any initialization
460 // error is detected, a \a std::runtime_error exception is thrown.
461 */
462 template< typename MT1 // Type of the left-hand side dense matrix
463 , typename MT2 > // Type of the right-hand side sparse matrix
testInitialStatus()464 void OperationTest<MT1,MT2>::testInitialStatus()
465 {
466 //=====================================================================================
467 // Performing initial tests with the row-major types
468 //=====================================================================================
469
470 // Checking the number of rows of the left-hand side operand
471 if( lhs_.rows() != reflhs_.rows() ) {
472 std::ostringstream oss;
473 oss << " Test: Initial size comparison of left-hand side row-major dense operand\n"
474 << " Error: Invalid number of rows\n"
475 << " Details:\n"
476 << " Random seed = " << blaze::getSeed() << "\n"
477 << " Row-major dense matrix type:\n"
478 << " " << typeid( MT1 ).name() << "\n"
479 << " Detected number of rows = " << lhs_.rows() << "\n"
480 << " Expected number of rows = " << reflhs_.rows() << "\n";
481 throw std::runtime_error( oss.str() );
482 }
483
484 // Checking the number of columns of the left-hand side operand
485 if( lhs_.columns() != reflhs_.columns() ) {
486 std::ostringstream oss;
487 oss << " Test: Initial size comparison of left-hand side row-major dense operand\n"
488 << " Error: Invalid number of columns\n"
489 << " Details:\n"
490 << " Random seed = " << blaze::getSeed() << "\n"
491 << " Row-major dense matrix type:\n"
492 << " " << typeid( MT1 ).name() << "\n"
493 << " Detected number of columns = " << lhs_.columns() << "\n"
494 << " Expected number of columns = " << reflhs_.columns() << "\n";
495 throw std::runtime_error( oss.str() );
496 }
497
498 // Checking the number of rows of the right-hand side operand
499 if( rhs_.rows() != refrhs_.rows() ) {
500 std::ostringstream oss;
501 oss << " Test: Initial size comparison of right-hand side row-major sparse operand\n"
502 << " Error: Invalid number of rows\n"
503 << " Details:\n"
504 << " Random seed = " << blaze::getSeed() << "\n"
505 << " Row-major sparse matrix type:\n"
506 << " " << typeid( MT2 ).name() << "\n"
507 << " Detected number of rows = " << rhs_.rows() << "\n"
508 << " Expected number of rows = " << refrhs_.rows() << "\n";
509 throw std::runtime_error( oss.str() );
510 }
511
512 // Checking the number of columns of the right-hand side operand
513 if( rhs_.columns() != refrhs_.columns() ) {
514 std::ostringstream oss;
515 oss << " Test: Initial size comparison of right-hand side row-major sparse operand\n"
516 << " Error: Invalid number of columns\n"
517 << " Details:\n"
518 << " Random seed = " << blaze::getSeed() << "\n"
519 << " Row-major sparse matrix type:\n"
520 << " " << typeid( MT2 ).name() << "\n"
521 << " Detected number of columns = " << rhs_.columns() << "\n"
522 << " Expected number of columns = " << refrhs_.columns() << "\n";
523 throw std::runtime_error( oss.str() );
524 }
525
526 // Checking the initialization of the left-hand side operand
527 if( !isEqual( lhs_, reflhs_ ) ) {
528 std::ostringstream oss;
529 oss << " Test: Initial test of initialization of left-hand side row-major dense operand\n"
530 << " Error: Invalid matrix initialization\n"
531 << " Details:\n"
532 << " Random seed = " << blaze::getSeed() << "\n"
533 << " Row-major dense matrix type:\n"
534 << " " << typeid( MT1 ).name() << "\n"
535 << " Current initialization:\n" << lhs_ << "\n"
536 << " Expected initialization:\n" << reflhs_ << "\n";
537 throw std::runtime_error( oss.str() );
538 }
539
540 // Checking the initialization of the right-hand side operand
541 if( !isEqual( rhs_, refrhs_ ) ) {
542 std::ostringstream oss;
543 oss << " Test: Initial test of initialization of right-hand side row-major sparse operand\n"
544 << " Error: Invalid matrix initialization\n"
545 << " Details:\n"
546 << " Random seed = " << blaze::getSeed() << "\n"
547 << " Row-major sparse matrix type:\n"
548 << " " << typeid( MT2 ).name() << "\n"
549 << " Current initialization:\n" << rhs_ << "\n"
550 << " Expected initialization:\n" << refrhs_ << "\n";
551 throw std::runtime_error( oss.str() );
552 }
553
554
555 //=====================================================================================
556 // Performing initial tests with the column-major types
557 //=====================================================================================
558
559 // Checking the number of rows of the left-hand side operand
560 if( olhs_.rows() != reflhs_.rows() ) {
561 std::ostringstream oss;
562 oss << " Test: Initial size comparison of left-hand side column-major dense operand\n"
563 << " Error: Invalid number of rows\n"
564 << " Details:\n"
565 << " Random seed = " << blaze::getSeed() << "\n"
566 << " Column-major dense matrix type:\n"
567 << " " << typeid( OMT1 ).name() << "\n"
568 << " Detected number of rows = " << olhs_.rows() << "\n"
569 << " Expected number of rows = " << reflhs_.rows() << "\n";
570 throw std::runtime_error( oss.str() );
571 }
572
573 // Checking the number of columns of the left-hand side operand
574 if( olhs_.columns() != reflhs_.columns() ) {
575 std::ostringstream oss;
576 oss << " Test: Initial size comparison of left-hand side column-major dense operand\n"
577 << " Error: Invalid number of columns\n"
578 << " Details:\n"
579 << " Random seed = " << blaze::getSeed() << "\n"
580 << " Column-major dense matrix type:\n"
581 << " " << typeid( OMT1 ).name() << "\n"
582 << " Detected number of columns = " << olhs_.columns() << "\n"
583 << " Expected number of columns = " << reflhs_.columns() << "\n";
584 throw std::runtime_error( oss.str() );
585 }
586
587 // Checking the number of rows of the right-hand side operand
588 if( orhs_.rows() != refrhs_.rows() ) {
589 std::ostringstream oss;
590 oss << " Test: Initial size comparison of right-hand side column-major sparse operand\n"
591 << " Error: Invalid number of rows\n"
592 << " Details:\n"
593 << " Random seed = " << blaze::getSeed() << "\n"
594 << " Column-major sparse matrix type:\n"
595 << " " << typeid( OMT2 ).name() << "\n"
596 << " Detected number of rows = " << orhs_.rows() << "\n"
597 << " Expected number of rows = " << refrhs_.rows() << "\n";
598 throw std::runtime_error( oss.str() );
599 }
600
601 // Checking the number of columns of the right-hand side operand
602 if( orhs_.columns() != refrhs_.columns() ) {
603 std::ostringstream oss;
604 oss << " Test: Initial size comparison of right-hand side column-major sparse operand\n"
605 << " Error: Invalid number of columns\n"
606 << " Details:\n"
607 << " Random seed = " << blaze::getSeed() << "\n"
608 << " Column-major sparse matrix type:\n"
609 << " " << typeid( OMT2 ).name() << "\n"
610 << " Detected number of columns = " << orhs_.columns() << "\n"
611 << " Expected number of columns = " << refrhs_.columns() << "\n";
612 throw std::runtime_error( oss.str() );
613 }
614
615 // Checking the initialization of the left-hand side operand
616 if( !isEqual( olhs_, reflhs_ ) ) {
617 std::ostringstream oss;
618 oss << " Test: Initial test of initialization of left-hand side column-major dense operand\n"
619 << " Error: Invalid matrix initialization\n"
620 << " Details:\n"
621 << " Random seed = " << blaze::getSeed() << "\n"
622 << " Column-major dense matrix type:\n"
623 << " " << typeid( OMT1 ).name() << "\n"
624 << " Current initialization:\n" << olhs_ << "\n"
625 << " Expected initialization:\n" << reflhs_ << "\n";
626 throw std::runtime_error( oss.str() );
627 }
628
629 // Checking the initialization of the right-hand side operand
630 if( !isEqual( orhs_, refrhs_ ) ) {
631 std::ostringstream oss;
632 oss << " Test: Initial test of initialization of right-hand side column-major sparse operand\n"
633 << " Error: Invalid matrix initialization\n"
634 << " Details:\n"
635 << " Random seed = " << blaze::getSeed() << "\n"
636 << " Column-major sparse matrix type:\n"
637 << " " << typeid( OMT2 ).name() << "\n"
638 << " Current initialization:\n" << orhs_ << "\n"
639 << " Expected initialization:\n" << refrhs_ << "\n";
640 throw std::runtime_error( oss.str() );
641 }
642 }
643 //*************************************************************************************************
644
645
646 //*************************************************************************************************
647 /*!\brief Testing the matrix assignment.
648 //
649 // \return void
650 // \exception std::runtime_error Assignment error detected.
651 //
652 // This function tests the matrix assignment. In case any error is detected, a
653 // \a std::runtime_error exception is thrown.
654 */
655 template< typename MT1 // Type of the left-hand side dense matrix
656 , typename MT2 > // Type of the right-hand side sparse matrix
testAssignment()657 void OperationTest<MT1,MT2>::testAssignment()
658 {
659 //=====================================================================================
660 // // Performing an assignment with the row-major types
661 //=====================================================================================
662
663 try {
664 lhs_ = reflhs_;
665 rhs_ = refrhs_;
666 }
667 catch( std::exception& ex ) {
668 std::ostringstream oss;
669 oss << " Test: Assignment with the row-major types\n"
670 << " Error: Failed assignment\n"
671 << " Details:\n"
672 << " Random seed = " << blaze::getSeed() << "\n"
673 << " Left-hand side row-major dense matrix type:\n"
674 << " " << typeid( MT1 ).name() << "\n"
675 << " Right-hand side row-major sparse matrix type:\n"
676 << " " << typeid( MT2 ).name() << "\n"
677 << " Error message: " << ex.what() << "\n";
678 throw std::runtime_error( oss.str() );
679 }
680
681 if( !isEqual( lhs_, reflhs_ ) ) {
682 std::ostringstream oss;
683 oss << " Test: Checking the assignment result of left-hand side row-major dense operand\n"
684 << " Error: Invalid matrix initialization\n"
685 << " Details:\n"
686 << " Random seed = " << blaze::getSeed() << "\n"
687 << " Row-major dense matrix type:\n"
688 << " " << typeid( MT1 ).name() << "\n"
689 << " Current initialization:\n" << lhs_ << "\n"
690 << " Expected initialization:\n" << reflhs_ << "\n";
691 throw std::runtime_error( oss.str() );
692 }
693
694 if( !isEqual( rhs_, refrhs_ ) ) {
695 std::ostringstream oss;
696 oss << " Test: Checking the assignment result of right-hand side row-major sparse operand\n"
697 << " Error: Invalid matrix initialization\n"
698 << " Details:\n"
699 << " Random seed = " << blaze::getSeed() << "\n"
700 << " Row-major sparse matrix type:\n"
701 << " " << typeid( MT2 ).name() << "\n"
702 << " Current initialization:\n" << rhs_ << "\n"
703 << " Expected initialization:\n" << refrhs_ << "\n";
704 throw std::runtime_error( oss.str() );
705 }
706
707
708 //=====================================================================================
709 // Performing an assignment with the column-major types
710 //=====================================================================================
711
712 try {
713 olhs_ = reflhs_;
714 orhs_ = refrhs_;
715 }
716 catch( std::exception& ex ) {
717 std::ostringstream oss;
718 oss << " Test: Assignment with the column-major types\n"
719 << " Error: Failed assignment\n"
720 << " Details:\n"
721 << " Random seed = " << blaze::getSeed() << "\n"
722 << " Left-hand side column-major dense matrix type:\n"
723 << " " << typeid( OMT1 ).name() << "\n"
724 << " Right-hand side column-major sparse matrix type:\n"
725 << " " << typeid( OMT2 ).name() << "\n"
726 << " Error message: " << ex.what() << "\n";
727 throw std::runtime_error( oss.str() );
728 }
729
730 if( !isEqual( olhs_, reflhs_ ) ) {
731 std::ostringstream oss;
732 oss << " Test: Checking the assignment result of left-hand side column-major dense operand\n"
733 << " Error: Invalid matrix initialization\n"
734 << " Details:\n"
735 << " Random seed = " << blaze::getSeed() << "\n"
736 << " Column-major dense matrix type:\n"
737 << " " << typeid( OMT1 ).name() << "\n"
738 << " Current initialization:\n" << olhs_ << "\n"
739 << " Expected initialization:\n" << reflhs_ << "\n";
740 throw std::runtime_error( oss.str() );
741 }
742
743 if( !isEqual( orhs_, refrhs_ ) ) {
744 std::ostringstream oss;
745 oss << " Test: Checking the assignment result of right-hand side column-major sparse operand\n"
746 << " Error: Invalid matrix initialization\n"
747 << " Details:\n"
748 << " Random seed = " << blaze::getSeed() << "\n"
749 << " Column-major sparse matrix type:\n"
750 << " " << typeid( OMT2 ).name() << "\n"
751 << " Current initialization:\n" << orhs_ << "\n"
752 << " Expected initialization:\n" << refrhs_ << "\n";
753 throw std::runtime_error( oss.str() );
754 }
755 }
756 //*************************************************************************************************
757
758
759 //*************************************************************************************************
760 /*!\brief Testing the explicit evaluation.
761 //
762 // \return void
763 // \exception std::runtime_error Evaluation error detected.
764 //
765 // This function tests the explicit evaluation. In case any error is detected, a
766 // \a std::runtime_error exception is thrown.
767 */
768 template< typename MT1 // Type of the left-hand side dense matrix
769 , typename MT2 > // Type of the right-hand side sparse matrix
testEvaluation()770 void OperationTest<MT1,MT2>::testEvaluation()
771 {
772 using blaze::IsRowMajorMatrix;
773
774
775 //=====================================================================================
776 // Testing the evaluation with two row-major matrices
777 //=====================================================================================
778
779 {
780 const auto res ( evaluate( lhs_ + rhs_ ) );
781 const auto refres( evaluate( reflhs_ + refrhs_ ) );
782
783 if( !isEqual( res, refres ) ) {
784 std::ostringstream oss;
785 oss << " Test: Evaluation with the given matrices\n"
786 << " Error: Failed evaluation\n"
787 << " Details:\n"
788 << " Random seed = " << blaze::getSeed() << "\n"
789 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
790 << " " << typeid( lhs_ ).name() << "\n"
791 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
792 << " " << typeid( rhs_ ).name() << "\n"
793 << " Deduced result type:\n"
794 << " " << typeid( res ).name() << "\n"
795 << " Deduced reference result type:\n"
796 << " " << typeid( refres ).name() << "\n"
797 << " Result:\n" << res << "\n"
798 << " Expected result:\n" << refres << "\n";
799 throw std::runtime_error( oss.str() );
800 }
801 }
802
803 {
804 const auto res ( evaluate( eval( lhs_ ) + eval( rhs_ ) ) );
805 const auto refres( evaluate( eval( reflhs_ ) + eval( refrhs_ ) ) );
806
807 if( !isEqual( res, refres ) ) {
808 std::ostringstream oss;
809 oss << " Test: Evaluation with evaluated matrices\n"
810 << " Error: Failed evaluation\n"
811 << " Details:\n"
812 << " Random seed = " << blaze::getSeed() << "\n"
813 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
814 << " " << typeid( lhs_ ).name() << "\n"
815 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
816 << " " << typeid( rhs_ ).name() << "\n"
817 << " Deduced result type:\n"
818 << " " << typeid( res ).name() << "\n"
819 << " Deduced reference result type:\n"
820 << " " << typeid( refres ).name() << "\n"
821 << " Result:\n" << res << "\n"
822 << " Expected result:\n" << refres << "\n";
823 throw std::runtime_error( oss.str() );
824 }
825 }
826
827
828 //=====================================================================================
829 // Testing the evaluation with a row-major matrix and a column-major matrix
830 //=====================================================================================
831
832 {
833 const auto res ( evaluate( lhs_ + orhs_ ) );
834 const auto refres( evaluate( reflhs_ + refrhs_ ) );
835
836 if( !isEqual( res, refres ) ) {
837 std::ostringstream oss;
838 oss << " Test: Evaluation with the given matrices\n"
839 << " Error: Failed evaluation\n"
840 << " Details:\n"
841 << " Random seed = " << blaze::getSeed() << "\n"
842 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
843 << " " << typeid( lhs_ ).name() << "\n"
844 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
845 << " " << typeid( orhs_ ).name() << "\n"
846 << " Deduced result type:\n"
847 << " " << typeid( res ).name() << "\n"
848 << " Deduced reference result type:\n"
849 << " " << typeid( refres ).name() << "\n"
850 << " Result:\n" << res << "\n"
851 << " Expected result:\n" << refres << "\n";
852 throw std::runtime_error( oss.str() );
853 }
854 }
855
856 {
857 const auto res ( evaluate( eval( lhs_ ) + eval( orhs_ ) ) );
858 const auto refres( evaluate( eval( reflhs_ ) + eval( refrhs_ ) ) );
859
860 if( !isEqual( res, refres ) ) {
861 std::ostringstream oss;
862 oss << " Test: Evaluation with the given matrices\n"
863 << " Error: Failed evaluation\n"
864 << " Details:\n"
865 << " Random seed = " << blaze::getSeed() << "\n"
866 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
867 << " " << typeid( lhs_ ).name() << "\n"
868 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
869 << " " << typeid( orhs_ ).name() << "\n"
870 << " Deduced result type:\n"
871 << " " << typeid( res ).name() << "\n"
872 << " Deduced reference result type:\n"
873 << " " << typeid( refres ).name() << "\n"
874 << " Result:\n" << res << "\n"
875 << " Expected result:\n" << refres << "\n";
876 throw std::runtime_error( oss.str() );
877 }
878 }
879
880
881 //=====================================================================================
882 // Testing the evaluation with a column-major matrix and a row-major matrix
883 //=====================================================================================
884
885 {
886 const auto res ( evaluate( olhs_ + rhs_ ) );
887 const auto refres( evaluate( reflhs_ + refrhs_ ) );
888
889 if( !isEqual( res, refres ) ) {
890 std::ostringstream oss;
891 oss << " Test: Evaluation with the given matrices\n"
892 << " Error: Failed evaluation\n"
893 << " Details:\n"
894 << " Random seed = " << blaze::getSeed() << "\n"
895 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
896 << " " << typeid( olhs_ ).name() << "\n"
897 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
898 << " " << typeid( rhs_ ).name() << "\n"
899 << " Deduced result type:\n"
900 << " " << typeid( res ).name() << "\n"
901 << " Deduced reference result type:\n"
902 << " " << typeid( refres ).name() << "\n"
903 << " Result:\n" << res << "\n"
904 << " Expected result:\n" << refres << "\n";
905 throw std::runtime_error( oss.str() );
906 }
907 }
908
909 {
910 const auto res ( evaluate( eval( olhs_ ) + eval( rhs_ ) ) );
911 const auto refres( evaluate( eval( reflhs_ ) + eval( refrhs_ ) ) );
912
913 if( !isEqual( res, refres ) ) {
914 std::ostringstream oss;
915 oss << " Test: Evaluation with the given matrices\n"
916 << " Error: Failed evaluation\n"
917 << " Details:\n"
918 << " Random seed = " << blaze::getSeed() << "\n"
919 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
920 << " " << typeid( olhs_ ).name() << "\n"
921 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
922 << " " << typeid( rhs_ ).name() << "\n"
923 << " Deduced result type:\n"
924 << " " << typeid( res ).name() << "\n"
925 << " Deduced reference result type:\n"
926 << " " << typeid( refres ).name() << "\n"
927 << " Result:\n" << res << "\n"
928 << " Expected result:\n" << refres << "\n";
929 throw std::runtime_error( oss.str() );
930 }
931 }
932
933
934 //=====================================================================================
935 // Testing the evaluation with two column-major matrices
936 //=====================================================================================
937
938 {
939 const auto res ( evaluate( olhs_ + orhs_ ) );
940 const auto refres( evaluate( reflhs_ + refrhs_ ) );
941
942 if( !isEqual( res, refres ) ) {
943 std::ostringstream oss;
944 oss << " Test: Evaluation with the given matrices\n"
945 << " Error: Failed evaluation\n"
946 << " Details:\n"
947 << " Random seed = " << blaze::getSeed() << "\n"
948 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
949 << " " << typeid( olhs_ ).name() << "\n"
950 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
951 << " " << typeid( orhs_ ).name() << "\n"
952 << " Deduced result type:\n"
953 << " " << typeid( res ).name() << "\n"
954 << " Deduced reference result type:\n"
955 << " " << typeid( refres ).name() << "\n"
956 << " Result:\n" << res << "\n"
957 << " Expected result:\n" << refres << "\n";
958 throw std::runtime_error( oss.str() );
959 }
960 }
961
962 {
963 const auto res ( evaluate( eval( olhs_ ) + eval( orhs_ ) ) );
964 const auto refres( evaluate( eval( reflhs_ ) + eval( refrhs_ ) ) );
965
966 if( !isEqual( res, refres ) ) {
967 std::ostringstream oss;
968 oss << " Test: Evaluation with the given matrices\n"
969 << " Error: Failed evaluation\n"
970 << " Details:\n"
971 << " Random seed = " << blaze::getSeed() << "\n"
972 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
973 << " " << typeid( olhs_ ).name() << "\n"
974 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
975 << " " << typeid( orhs_ ).name() << "\n"
976 << " Deduced result type:\n"
977 << " " << typeid( res ).name() << "\n"
978 << " Deduced reference result type:\n"
979 << " " << typeid( refres ).name() << "\n"
980 << " Result:\n" << res << "\n"
981 << " Expected result:\n" << refres << "\n";
982 throw std::runtime_error( oss.str() );
983 }
984 }
985 }
986 //*************************************************************************************************
987
988
989 //*************************************************************************************************
990 /*!\brief Testing the matrix element access.
991 //
992 // \return void
993 // \exception std::runtime_error Element access error detected.
994 //
995 // This function tests the element access via the subscript operator. In case any
996 // error is detected, a \a std::runtime_error exception is thrown.
997 */
998 template< typename MT1 // Type of the left-hand side dense matrix
999 , typename MT2 > // Type of the right-hand side sparse matrix
testElementAccess()1000 void OperationTest<MT1,MT2>::testElementAccess()
1001 {
1002 using blaze::equal;
1003
1004
1005 //=====================================================================================
1006 // Testing the element access with two row-major matrices
1007 //=====================================================================================
1008
1009 if( lhs_.rows() > 0UL && lhs_.columns() > 0UL )
1010 {
1011 const size_t m( lhs_.rows() - 1UL );
1012 const size_t n( lhs_.columns() - 1UL );
1013
1014 if( !equal( ( lhs_ + rhs_ )(m,n), ( reflhs_ + refrhs_ )(m,n) ) ||
1015 !equal( ( lhs_ + rhs_ ).at(m,n), ( reflhs_ + refrhs_ ).at(m,n) ) ) {
1016 std::ostringstream oss;
1017 oss << " Test : Element access of addition expression\n"
1018 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1019 << " Details:\n"
1020 << " Random seed = " << blaze::getSeed() << "\n"
1021 << " Left-hand side row-major dense matrix type:\n"
1022 << " " << typeid( MT1 ).name() << "\n"
1023 << " Right-hand side row-major sparse matrix type:\n"
1024 << " " << typeid( MT2 ).name() << "\n";
1025 throw std::runtime_error( oss.str() );
1026 }
1027
1028 if( !equal( ( lhs_ + eval( rhs_ ) )(m,n), ( reflhs_ + eval( refrhs_ ) )(m,n) ) ||
1029 !equal( ( lhs_ + eval( rhs_ ) ).at(m,n), ( reflhs_ + eval( refrhs_ ) ).at(m,n) ) ) {
1030 std::ostringstream oss;
1031 oss << " Test : Element access of right evaluated addition expression\n"
1032 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1033 << " Details:\n"
1034 << " Random seed = " << blaze::getSeed() << "\n"
1035 << " Left-hand side row-major dense matrix type:\n"
1036 << " " << typeid( MT1 ).name() << "\n"
1037 << " Right-hand side row-major sparse matrix type:\n"
1038 << " " << typeid( MT2 ).name() << "\n";
1039 throw std::runtime_error( oss.str() );
1040 }
1041
1042 if( !equal( ( eval( lhs_ ) + rhs_ )(m,n), ( eval( reflhs_ ) + refrhs_ )(m,n) ) ||
1043 !equal( ( eval( lhs_ ) + rhs_ ).at(m,n), ( eval( reflhs_ ) + refrhs_ ).at(m,n) ) ) {
1044 std::ostringstream oss;
1045 oss << " Test : Element access of left evaluated addition expression\n"
1046 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1047 << " Details:\n"
1048 << " Random seed = " << blaze::getSeed() << "\n"
1049 << " Left-hand side row-major dense matrix type:\n"
1050 << " " << typeid( MT1 ).name() << "\n"
1051 << " Right-hand side row-major sparse matrix type:\n"
1052 << " " << typeid( MT2 ).name() << "\n";
1053 throw std::runtime_error( oss.str() );
1054 }
1055
1056 if( !equal( ( eval( lhs_ ) + eval( rhs_ ) )(m,n), ( eval( reflhs_ ) + eval( refrhs_ ) )(m,n) ) ||
1057 !equal( ( eval( lhs_ ) + eval( rhs_ ) ).at(m,n), ( eval( reflhs_ ) + eval( refrhs_ ) ).at(m,n) ) ) {
1058 std::ostringstream oss;
1059 oss << " Test : Element access of fully evaluated addition expression\n"
1060 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1061 << " Details:\n"
1062 << " Random seed = " << blaze::getSeed() << "\n"
1063 << " Left-hand side row-major dense matrix type:\n"
1064 << " " << typeid( MT1 ).name() << "\n"
1065 << " Right-hand side row-major sparse matrix type:\n"
1066 << " " << typeid( MT2 ).name() << "\n";
1067 throw std::runtime_error( oss.str() );
1068 }
1069 }
1070
1071 try {
1072 ( lhs_ + rhs_ ).at( 0UL, lhs_.columns() );
1073
1074 std::ostringstream oss;
1075 oss << " Test : Checked element access of addition expression\n"
1076 << " Error: Out-of-bound access succeeded\n"
1077 << " Details:\n"
1078 << " Random seed = " << blaze::getSeed() << "\n"
1079 << " Left-hand side row-major dense matrix type:\n"
1080 << " " << typeid( MT1 ).name() << "\n"
1081 << " Right-hand side row-major sparse matrix type:\n"
1082 << " " << typeid( MT2 ).name() << "\n";
1083 throw std::runtime_error( oss.str() );
1084 }
1085 catch( std::out_of_range& ) {}
1086
1087 try {
1088 ( lhs_ + rhs_ ).at( lhs_.rows(), 0UL );
1089
1090 std::ostringstream oss;
1091 oss << " Test : Checked element access of addition expression\n"
1092 << " Error: Out-of-bound access succeeded\n"
1093 << " Details:\n"
1094 << " Random seed = " << blaze::getSeed() << "\n"
1095 << " Left-hand side row-major dense matrix type:\n"
1096 << " " << typeid( MT1 ).name() << "\n"
1097 << " Right-hand side row-major sparse matrix type:\n"
1098 << " " << typeid( MT2 ).name() << "\n";
1099 throw std::runtime_error( oss.str() );
1100 }
1101 catch( std::out_of_range& ) {}
1102
1103
1104 //=====================================================================================
1105 // Testing the element access with a row-major matrix and a column-major matrix
1106 //=====================================================================================
1107
1108 if( lhs_.rows() > 0UL && lhs_.columns() > 0UL )
1109 {
1110 const size_t m( lhs_.rows() - 1UL );
1111 const size_t n( lhs_.columns() - 1UL );
1112
1113 if( !equal( ( lhs_ + orhs_ )(m,n), ( reflhs_ + refrhs_ )(m,n) ) ||
1114 !equal( ( lhs_ + orhs_ ).at(m,n), ( reflhs_ + refrhs_ ).at(m,n) ) ) {
1115 std::ostringstream oss;
1116 oss << " Test : Element access of addition expression\n"
1117 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1118 << " Details:\n"
1119 << " Random seed = " << blaze::getSeed() << "\n"
1120 << " Left-hand side row-major dense matrix type:\n"
1121 << " " << typeid( MT1 ).name() << "\n"
1122 << " Right-hand side column-major sparse matrix type:\n"
1123 << " " << typeid( OMT2 ).name() << "\n";
1124 throw std::runtime_error( oss.str() );
1125 }
1126
1127 if( !equal( ( lhs_ + eval( orhs_ ) )(m,n), ( reflhs_ + eval( refrhs_ ) )(m,n) ) ||
1128 !equal( ( lhs_ + eval( orhs_ ) ).at(m,n), ( reflhs_ + eval( refrhs_ ) ).at(m,n) ) ) {
1129 std::ostringstream oss;
1130 oss << " Test : Element access of right evaluated addition expression\n"
1131 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1132 << " Details:\n"
1133 << " Random seed = " << blaze::getSeed() << "\n"
1134 << " Left-hand side row-major dense matrix type:\n"
1135 << " " << typeid( MT1 ).name() << "\n"
1136 << " Right-hand side column-major sparse matrix type:\n"
1137 << " " << typeid( OMT2 ).name() << "\n";
1138 throw std::runtime_error( oss.str() );
1139 }
1140
1141 if( !equal( ( eval( lhs_ ) + orhs_ )(m,n), ( eval( reflhs_ ) + refrhs_ )(m,n) ) ||
1142 !equal( ( eval( lhs_ ) + orhs_ ).at(m,n), ( eval( reflhs_ ) + refrhs_ ).at(m,n) ) ) {
1143 std::ostringstream oss;
1144 oss << " Test : Element access of left evaluated addition expression\n"
1145 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1146 << " Details:\n"
1147 << " Random seed = " << blaze::getSeed() << "\n"
1148 << " Left-hand side row-major dense matrix type:\n"
1149 << " " << typeid( MT1 ).name() << "\n"
1150 << " Right-hand side column-major sparse matrix type:\n"
1151 << " " << typeid( OMT2 ).name() << "\n";
1152 throw std::runtime_error( oss.str() );
1153 }
1154
1155 if( !equal( ( eval( lhs_ ) + eval( orhs_ ) )(m,n), ( eval( reflhs_ ) + eval( refrhs_ ) )(m,n) ) ||
1156 !equal( ( eval( lhs_ ) + eval( orhs_ ) ).at(m,n), ( eval( reflhs_ ) + eval( refrhs_ ) ).at(m,n) ) ) {
1157 std::ostringstream oss;
1158 oss << " Test : Element access of fully evaluated addition expression\n"
1159 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1160 << " Details:\n"
1161 << " Random seed = " << blaze::getSeed() << "\n"
1162 << " Left-hand side row-major dense matrix type:\n"
1163 << " " << typeid( MT1 ).name() << "\n"
1164 << " Right-hand side column-major sparse matrix type:\n"
1165 << " " << typeid( OMT2 ).name() << "\n";
1166 throw std::runtime_error( oss.str() );
1167 }
1168 }
1169
1170 try {
1171 ( lhs_ + orhs_ ).at( 0UL, lhs_.columns() );
1172
1173 std::ostringstream oss;
1174 oss << " Test : Checked element access of addition expression\n"
1175 << " Error: Out-of-bound access succeeded\n"
1176 << " Details:\n"
1177 << " Random seed = " << blaze::getSeed() << "\n"
1178 << " Left-hand side row-major dense matrix type:\n"
1179 << " " << typeid( MT1 ).name() << "\n"
1180 << " Right-hand side column-major sparse matrix type:\n"
1181 << " " << typeid( OMT2 ).name() << "\n";
1182 throw std::runtime_error( oss.str() );
1183 }
1184 catch( std::out_of_range& ) {}
1185
1186 try {
1187 ( lhs_ + orhs_ ).at( lhs_.rows(), 0UL );
1188
1189 std::ostringstream oss;
1190 oss << " Test : Checked element access of addition expression\n"
1191 << " Error: Out-of-bound access succeeded\n"
1192 << " Details:\n"
1193 << " Random seed = " << blaze::getSeed() << "\n"
1194 << " Left-hand side row-major dense matrix type:\n"
1195 << " " << typeid( MT1 ).name() << "\n"
1196 << " Right-hand side column-major sparse matrix type:\n"
1197 << " " << typeid( OMT2 ).name() << "\n";
1198 throw std::runtime_error( oss.str() );
1199 }
1200 catch( std::out_of_range& ) {}
1201
1202
1203 //=====================================================================================
1204 // Testing the element access with a column-major matrix and a row-major matrix
1205 //=====================================================================================
1206
1207 if( olhs_.rows() > 0UL && olhs_.columns() > 0UL )
1208 {
1209 const size_t m( olhs_.rows() - 1UL );
1210 const size_t n( olhs_.columns() - 1UL );
1211
1212 if( !equal( ( olhs_ + rhs_ )(m,n), ( reflhs_ + refrhs_ )(m,n) ) ||
1213 !equal( ( olhs_ + rhs_ ).at(m,n), ( reflhs_ + refrhs_ ).at(m,n) ) ) {
1214 std::ostringstream oss;
1215 oss << " Test : Element access of addition expression\n"
1216 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1217 << " Details:\n"
1218 << " Random seed = " << blaze::getSeed() << "\n"
1219 << " Left-hand side column-major dense matrix type:\n"
1220 << " " << typeid( OMT1 ).name() << "\n"
1221 << " Right-hand side row-major sparse matrix type:\n"
1222 << " " << typeid( MT2 ).name() << "\n";
1223 throw std::runtime_error( oss.str() );
1224 }
1225
1226 if( !equal( ( olhs_ + eval( rhs_ ) )(m,n), ( reflhs_ + eval( refrhs_ ) )(m,n) ) ||
1227 !equal( ( olhs_ + eval( rhs_ ) ).at(m,n), ( reflhs_ + eval( refrhs_ ) ).at(m,n) ) ) {
1228 std::ostringstream oss;
1229 oss << " Test : Element access of right evaluated addition expression\n"
1230 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1231 << " Details:\n"
1232 << " Random seed = " << blaze::getSeed() << "\n"
1233 << " Left-hand side column-major dense matrix type:\n"
1234 << " " << typeid( OMT1 ).name() << "\n"
1235 << " Right-hand side row-major sparse matrix type:\n"
1236 << " " << typeid( MT2 ).name() << "\n";
1237 throw std::runtime_error( oss.str() );
1238 }
1239
1240 if( !equal( ( eval( olhs_ ) + rhs_ )(m,n), ( eval( reflhs_ ) + refrhs_ )(m,n) ) ||
1241 !equal( ( eval( olhs_ ) + rhs_ ).at(m,n), ( eval( reflhs_ ) + refrhs_ ).at(m,n) ) ) {
1242 std::ostringstream oss;
1243 oss << " Test : Element access of left evaluated addition expression\n"
1244 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1245 << " Details:\n"
1246 << " Random seed = " << blaze::getSeed() << "\n"
1247 << " Left-hand side column-major dense matrix type:\n"
1248 << " " << typeid( OMT1 ).name() << "\n"
1249 << " Right-hand side row-major sparse matrix type:\n"
1250 << " " << typeid( MT2 ).name() << "\n";
1251 throw std::runtime_error( oss.str() );
1252 }
1253
1254 if( !equal( ( eval( olhs_ ) + eval( rhs_ ) )(m,n), ( eval( reflhs_ ) + eval( refrhs_ ) )(m,n) ) ||
1255 !equal( ( eval( olhs_ ) + eval( rhs_ ) ).at(m,n), ( eval( reflhs_ ) + eval( refrhs_ ) ).at(m,n) ) ) {
1256 std::ostringstream oss;
1257 oss << " Test : Element access of fully evaluated addition expression\n"
1258 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1259 << " Details:\n"
1260 << " Random seed = " << blaze::getSeed() << "\n"
1261 << " Left-hand side column-major dense matrix type:\n"
1262 << " " << typeid( OMT1 ).name() << "\n"
1263 << " Right-hand side row-major sparse matrix type:\n"
1264 << " " << typeid( MT2 ).name() << "\n";
1265 throw std::runtime_error( oss.str() );
1266 }
1267 }
1268
1269 try {
1270 ( olhs_ + rhs_ ).at( 0UL, lhs_.columns() );
1271
1272 std::ostringstream oss;
1273 oss << " Test : Checked element access of addition expression\n"
1274 << " Error: Out-of-bound access succeeded\n"
1275 << " Details:\n"
1276 << " Random seed = " << blaze::getSeed() << "\n"
1277 << " Left-hand side column-major dense matrix type:\n"
1278 << " " << typeid( OMT1 ).name() << "\n"
1279 << " Right-hand side row-major sparse matrix type:\n"
1280 << " " << typeid( MT2 ).name() << "\n";
1281 throw std::runtime_error( oss.str() );
1282 }
1283 catch( std::out_of_range& ) {}
1284
1285 try {
1286 ( olhs_ + rhs_ ).at( lhs_.rows(), 0UL );
1287
1288 std::ostringstream oss;
1289 oss << " Test : Checked element access of addition expression\n"
1290 << " Error: Out-of-bound access succeeded\n"
1291 << " Details:\n"
1292 << " Random seed = " << blaze::getSeed() << "\n"
1293 << " Left-hand side column-major dense matrix type:\n"
1294 << " " << typeid( OMT1 ).name() << "\n"
1295 << " Right-hand side row-major sparse matrix type:\n"
1296 << " " << typeid( MT2 ).name() << "\n";
1297 throw std::runtime_error( oss.str() );
1298 }
1299 catch( std::out_of_range& ) {}
1300
1301
1302 //=====================================================================================
1303 // Testing the element access with two column-major matrices
1304 //=====================================================================================
1305
1306 if( olhs_.rows() > 0UL && olhs_.columns() > 0UL )
1307 {
1308 const size_t m( olhs_.rows() - 1UL );
1309 const size_t n( olhs_.columns() - 1UL );
1310
1311 if( !equal( ( olhs_ + orhs_ )(m,n), ( reflhs_ + refrhs_ )(m,n) ) ||
1312 !equal( ( olhs_ + orhs_ ).at(m,n), ( reflhs_ + refrhs_ ).at(m,n) ) ) {
1313 std::ostringstream oss;
1314 oss << " Test : Element access of addition expression\n"
1315 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1316 << " Details:\n"
1317 << " Random seed = " << blaze::getSeed() << "\n"
1318 << " Left-hand side column-major dense matrix type:\n"
1319 << " " << typeid( OMT1 ).name() << "\n"
1320 << " Right-hand side column-major sparse matrix type:\n"
1321 << " " << typeid( OMT2 ).name() << "\n";
1322 throw std::runtime_error( oss.str() );
1323 }
1324
1325 if( !equal( ( olhs_ + eval( orhs_ ) )(m,n), ( reflhs_ + eval( refrhs_ ) )(m,n) ) ||
1326 !equal( ( olhs_ + eval( orhs_ ) ).at(m,n), ( reflhs_ + eval( refrhs_ ) ).at(m,n) ) ) {
1327 std::ostringstream oss;
1328 oss << " Test : Element access of right evaluated addition expression\n"
1329 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1330 << " Details:\n"
1331 << " Random seed = " << blaze::getSeed() << "\n"
1332 << " Left-hand side column-major dense matrix type:\n"
1333 << " " << typeid( OMT1 ).name() << "\n"
1334 << " Right-hand side column-major sparse matrix type:\n"
1335 << " " << typeid( OMT2 ).name() << "\n";
1336 throw std::runtime_error( oss.str() );
1337 }
1338
1339 if( !equal( ( eval( olhs_ ) + orhs_ )(m,n), ( eval( reflhs_ ) + refrhs_ )(m,n) ) ||
1340 !equal( ( eval( olhs_ ) + orhs_ ).at(m,n), ( eval( reflhs_ ) + refrhs_ ).at(m,n) ) ) {
1341 std::ostringstream oss;
1342 oss << " Test : Element access of left evaluated addition expression\n"
1343 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1344 << " Details:\n"
1345 << " Random seed = " << blaze::getSeed() << "\n"
1346 << " Left-hand side column-major dense matrix type:\n"
1347 << " " << typeid( OMT1 ).name() << "\n"
1348 << " Right-hand side column-major sparse matrix type:\n"
1349 << " " << typeid( OMT2 ).name() << "\n";
1350 throw std::runtime_error( oss.str() );
1351 }
1352
1353 if( !equal( ( eval( olhs_ ) + eval( orhs_ ) )(m,n), ( eval( reflhs_ ) + eval( refrhs_ ) )(m,n) ) ||
1354 !equal( ( eval( olhs_ ) + eval( orhs_ ) ).at(m,n), ( eval( reflhs_ ) + eval( refrhs_ ) ).at(m,n) ) ) {
1355 std::ostringstream oss;
1356 oss << " Test : Element access of fully evaluated addition expression\n"
1357 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1358 << " Details:\n"
1359 << " Random seed = " << blaze::getSeed() << "\n"
1360 << " Left-hand side column-major dense matrix type:\n"
1361 << " " << typeid( OMT1 ).name() << "\n"
1362 << " Right-hand side column-major sparse matrix type:\n"
1363 << " " << typeid( OMT2 ).name() << "\n";
1364 throw std::runtime_error( oss.str() );
1365 }
1366 }
1367
1368 try {
1369 ( olhs_ + orhs_ ).at( 0UL, lhs_.columns() );
1370
1371 std::ostringstream oss;
1372 oss << " Test : Checked element access of addition expression\n"
1373 << " Error: Out-of-bound access succeeded\n"
1374 << " Details:\n"
1375 << " Random seed = " << blaze::getSeed() << "\n"
1376 << " Left-hand side column-major dense matrix type:\n"
1377 << " " << typeid( OMT1 ).name() << "\n"
1378 << " Right-hand side column-major sparse matrix type:\n"
1379 << " " << typeid( OMT2 ).name() << "\n";
1380 throw std::runtime_error( oss.str() );
1381 }
1382 catch( std::out_of_range& ) {}
1383
1384 try {
1385 ( olhs_ + orhs_ ).at( lhs_.rows(), 0UL );
1386
1387 std::ostringstream oss;
1388 oss << " Test : Checked element access of addition expression\n"
1389 << " Error: Out-of-bound access succeeded\n"
1390 << " Details:\n"
1391 << " Random seed = " << blaze::getSeed() << "\n"
1392 << " Left-hand side column-major dense matrix type:\n"
1393 << " " << typeid( OMT1 ).name() << "\n"
1394 << " Right-hand side column-major sparse matrix type:\n"
1395 << " " << typeid( OMT2 ).name() << "\n";
1396 throw std::runtime_error( oss.str() );
1397 }
1398 catch( std::out_of_range& ) {}
1399 }
1400 //*************************************************************************************************
1401
1402
1403 //*************************************************************************************************
1404 /*!\brief Testing the plain dense matrix/sparse matrix addition.
1405 //
1406 // \return void
1407 // \exception std::runtime_error Addition error detected.
1408 //
1409 // This function tests the plain matrix addition with plain assignment, addition assignment,
1410 // subtraction assignment, and Schur product assignment. In case any error resulting from the
1411 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
1412 // thrown.
1413 */
1414 template< typename MT1 // Type of the left-hand side dense matrix
1415 , typename MT2 > // Type of the right-hand side sparse matrix
testBasicOperation()1416 void OperationTest<MT1,MT2>::testBasicOperation()
1417 {
1418 #if BLAZETEST_MATHTEST_TEST_BASIC_OPERATION
1419 if( BLAZETEST_MATHTEST_TEST_BASIC_OPERATION > 1 )
1420 {
1421 //=====================================================================================
1422 // Addition
1423 //=====================================================================================
1424
1425 // Addition with the given matrices
1426 {
1427 test_ = "Addition with the given matrices";
1428 error_ = "Failed addition operation";
1429
1430 try {
1431 initResults();
1432 dres_ = lhs_ + rhs_;
1433 odres_ = lhs_ + rhs_;
1434 sres_ = lhs_ + rhs_;
1435 osres_ = lhs_ + rhs_;
1436 refres_ = reflhs_ + refrhs_;
1437 }
1438 catch( std::exception& ex ) {
1439 convertException<MT1,MT2>( ex );
1440 }
1441
1442 checkResults<MT1,MT2>();
1443
1444 try {
1445 initResults();
1446 dres_ = lhs_ + orhs_;
1447 odres_ = lhs_ + orhs_;
1448 sres_ = lhs_ + orhs_;
1449 osres_ = lhs_ + orhs_;
1450 refres_ = reflhs_ + refrhs_;
1451 }
1452 catch( std::exception& ex ) {
1453 convertException<MT1,OMT2>( ex );
1454 }
1455
1456 checkResults<MT1,OMT2>();
1457
1458 try {
1459 initResults();
1460 dres_ = olhs_ + rhs_;
1461 odres_ = olhs_ + rhs_;
1462 sres_ = olhs_ + rhs_;
1463 osres_ = olhs_ + rhs_;
1464 refres_ = reflhs_ + refrhs_;
1465 }
1466 catch( std::exception& ex ) {
1467 convertException<OMT1,MT2>( ex );
1468 }
1469
1470 checkResults<OMT1,MT2>();
1471
1472 try {
1473 initResults();
1474 dres_ = olhs_ + orhs_;
1475 odres_ = olhs_ + orhs_;
1476 sres_ = olhs_ + orhs_;
1477 osres_ = olhs_ + orhs_;
1478 refres_ = reflhs_ + refrhs_;
1479 }
1480 catch( std::exception& ex ) {
1481 convertException<OMT1,OMT2>( ex );
1482 }
1483
1484 checkResults<OMT1,OMT2>();
1485 }
1486
1487 // Addition with evaluated matrices
1488 {
1489 test_ = "Addition with evaluated matrices";
1490 error_ = "Failed addition operation";
1491
1492 try {
1493 initResults();
1494 dres_ = eval( lhs_ ) + eval( rhs_ );
1495 odres_ = eval( lhs_ ) + eval( rhs_ );
1496 sres_ = eval( lhs_ ) + eval( rhs_ );
1497 osres_ = eval( lhs_ ) + eval( rhs_ );
1498 refres_ = eval( reflhs_ ) + eval( refrhs_ );
1499 }
1500 catch( std::exception& ex ) {
1501 convertException<MT1,MT2>( ex );
1502 }
1503
1504 checkResults<MT1,MT2>();
1505
1506 try {
1507 initResults();
1508 dres_ = eval( lhs_ ) + eval( orhs_ );
1509 odres_ = eval( lhs_ ) + eval( orhs_ );
1510 sres_ = eval( lhs_ ) + eval( orhs_ );
1511 osres_ = eval( lhs_ ) + eval( orhs_ );
1512 refres_ = eval( reflhs_ ) + eval( refrhs_ );
1513 }
1514 catch( std::exception& ex ) {
1515 convertException<MT1,OMT2>( ex );
1516 }
1517
1518 checkResults<MT1,OMT2>();
1519
1520 try {
1521 initResults();
1522 dres_ = eval( olhs_ ) + eval( rhs_ );
1523 odres_ = eval( olhs_ ) + eval( rhs_ );
1524 sres_ = eval( olhs_ ) + eval( rhs_ );
1525 osres_ = eval( olhs_ ) + eval( rhs_ );
1526 refres_ = eval( reflhs_ ) + eval( refrhs_ );
1527 }
1528 catch( std::exception& ex ) {
1529 convertException<OMT1,MT2>( ex );
1530 }
1531
1532 checkResults<OMT1,MT2>();
1533
1534 try {
1535 initResults();
1536 dres_ = eval( olhs_ ) + eval( orhs_ );
1537 odres_ = eval( olhs_ ) + eval( orhs_ );
1538 sres_ = eval( olhs_ ) + eval( orhs_ );
1539 osres_ = eval( olhs_ ) + eval( orhs_ );
1540 refres_ = eval( reflhs_ ) + eval( refrhs_ );
1541 }
1542 catch( std::exception& ex ) {
1543 convertException<OMT1,OMT2>( ex );
1544 }
1545
1546 checkResults<OMT1,OMT2>();
1547 }
1548
1549
1550 //=====================================================================================
1551 // Addition with addition assignment
1552 //=====================================================================================
1553
1554 // Addition with addition assignment with the given matrices
1555 {
1556 test_ = "Addition with addition assignment with the given matrices";
1557 error_ = "Failed addition assignment operation";
1558
1559 try {
1560 initResults();
1561 dres_ += lhs_ + rhs_;
1562 odres_ += lhs_ + rhs_;
1563 sres_ += lhs_ + rhs_;
1564 osres_ += lhs_ + rhs_;
1565 refres_ += reflhs_ + refrhs_;
1566 }
1567 catch( std::exception& ex ) {
1568 convertException<MT1,MT2>( ex );
1569 }
1570
1571 checkResults<MT1,MT2>();
1572
1573 try {
1574 initResults();
1575 dres_ += lhs_ + orhs_;
1576 odres_ += lhs_ + orhs_;
1577 sres_ += lhs_ + orhs_;
1578 osres_ += lhs_ + orhs_;
1579 refres_ += reflhs_ + refrhs_;
1580 }
1581 catch( std::exception& ex ) {
1582 convertException<MT1,OMT2>( ex );
1583 }
1584
1585 checkResults<MT1,OMT2>();
1586
1587 try {
1588 initResults();
1589 dres_ += olhs_ + rhs_;
1590 odres_ += olhs_ + rhs_;
1591 sres_ += olhs_ + rhs_;
1592 osres_ += olhs_ + rhs_;
1593 refres_ += reflhs_ + refrhs_;
1594 }
1595 catch( std::exception& ex ) {
1596 convertException<OMT1,MT2>( ex );
1597 }
1598
1599 checkResults<OMT1,MT2>();
1600
1601 try {
1602 initResults();
1603 dres_ += olhs_ + orhs_;
1604 odres_ += olhs_ + orhs_;
1605 sres_ += olhs_ + orhs_;
1606 osres_ += olhs_ + orhs_;
1607 refres_ += reflhs_ + refrhs_;
1608 }
1609 catch( std::exception& ex ) {
1610 convertException<OMT1,OMT2>( ex );
1611 }
1612
1613 checkResults<OMT1,OMT2>();
1614 }
1615
1616 // Addition with addition assignment with evaluated matrices
1617 {
1618 test_ = "Addition with addition assignment with evaluated matrices";
1619 error_ = "Failed addition assignment operation";
1620
1621 try {
1622 initResults();
1623 dres_ += eval( lhs_ ) + eval( rhs_ );
1624 odres_ += eval( lhs_ ) + eval( rhs_ );
1625 sres_ += eval( lhs_ ) + eval( rhs_ );
1626 osres_ += eval( lhs_ ) + eval( rhs_ );
1627 refres_ += eval( reflhs_ ) + eval( refrhs_ );
1628 }
1629 catch( std::exception& ex ) {
1630 convertException<MT1,MT2>( ex );
1631 }
1632
1633 checkResults<MT1,MT2>();
1634
1635 try {
1636 initResults();
1637 dres_ += eval( lhs_ ) + eval( orhs_ );
1638 odres_ += eval( lhs_ ) + eval( orhs_ );
1639 sres_ += eval( lhs_ ) + eval( orhs_ );
1640 osres_ += eval( lhs_ ) + eval( orhs_ );
1641 refres_ += eval( reflhs_ ) + eval( refrhs_ );
1642 }
1643 catch( std::exception& ex ) {
1644 convertException<MT1,OMT2>( ex );
1645 }
1646
1647 checkResults<MT1,OMT2>();
1648
1649 try {
1650 initResults();
1651 dres_ += eval( olhs_ ) + eval( rhs_ );
1652 odres_ += eval( olhs_ ) + eval( rhs_ );
1653 sres_ += eval( olhs_ ) + eval( rhs_ );
1654 osres_ += eval( olhs_ ) + eval( rhs_ );
1655 refres_ += eval( reflhs_ ) + eval( refrhs_ );
1656 }
1657 catch( std::exception& ex ) {
1658 convertException<OMT1,MT2>( ex );
1659 }
1660
1661 checkResults<OMT1,MT2>();
1662
1663 try {
1664 initResults();
1665 dres_ += eval( olhs_ ) + eval( orhs_ );
1666 odres_ += eval( olhs_ ) + eval( orhs_ );
1667 sres_ += eval( olhs_ ) + eval( orhs_ );
1668 osres_ += eval( olhs_ ) + eval( orhs_ );
1669 refres_ += eval( reflhs_ ) + eval( refrhs_ );
1670 }
1671 catch( std::exception& ex ) {
1672 convertException<OMT1,OMT2>( ex );
1673 }
1674
1675 checkResults<OMT1,OMT2>();
1676 }
1677
1678
1679 //=====================================================================================
1680 // Addition with subtraction assignment with the given matrices
1681 //=====================================================================================
1682
1683 // Addition with subtraction assignment with the given matrices
1684 {
1685 test_ = "Addition with subtraction assignment with the given matrices";
1686 error_ = "Failed subtraction assignment operation";
1687
1688 try {
1689 initResults();
1690 dres_ -= lhs_ + rhs_;
1691 odres_ -= lhs_ + rhs_;
1692 sres_ -= lhs_ + rhs_;
1693 osres_ -= lhs_ + rhs_;
1694 refres_ -= reflhs_ + refrhs_;
1695 }
1696 catch( std::exception& ex ) {
1697 convertException<MT1,MT2>( ex );
1698 }
1699
1700 checkResults<MT1,MT2>();
1701
1702 try {
1703 initResults();
1704 dres_ -= lhs_ + orhs_;
1705 odres_ -= lhs_ + orhs_;
1706 sres_ -= lhs_ + orhs_;
1707 osres_ -= lhs_ + orhs_;
1708 refres_ -= reflhs_ + refrhs_;
1709 }
1710 catch( std::exception& ex ) {
1711 convertException<MT1,OMT2>( ex );
1712 }
1713
1714 checkResults<MT1,OMT2>();
1715
1716 try {
1717 initResults();
1718 dres_ -= olhs_ + rhs_;
1719 odres_ -= olhs_ + rhs_;
1720 sres_ -= olhs_ + rhs_;
1721 osres_ -= olhs_ + rhs_;
1722 refres_ -= reflhs_ + refrhs_;
1723 }
1724 catch( std::exception& ex ) {
1725 convertException<OMT1,MT2>( ex );
1726 }
1727
1728 checkResults<OMT1,MT2>();
1729
1730 try {
1731 initResults();
1732 dres_ -= olhs_ + orhs_;
1733 odres_ -= olhs_ + orhs_;
1734 sres_ -= olhs_ + orhs_;
1735 osres_ -= olhs_ + orhs_;
1736 refres_ -= reflhs_ + refrhs_;
1737 }
1738 catch( std::exception& ex ) {
1739 convertException<OMT1,OMT2>( ex );
1740 }
1741
1742 checkResults<OMT1,OMT2>();
1743 }
1744
1745 // Addition with subtraction assignment with evaluated matrices
1746 {
1747 test_ = "Addition with subtraction assignment with evaluated matrices";
1748 error_ = "Failed subtraction assignment operation";
1749
1750 try {
1751 initResults();
1752 dres_ -= eval( lhs_ ) + eval( rhs_ );
1753 odres_ -= eval( lhs_ ) + eval( rhs_ );
1754 sres_ -= eval( lhs_ ) + eval( rhs_ );
1755 osres_ -= eval( lhs_ ) + eval( rhs_ );
1756 refres_ -= eval( reflhs_ ) + eval( refrhs_ );
1757 }
1758 catch( std::exception& ex ) {
1759 convertException<MT1,MT2>( ex );
1760 }
1761
1762 checkResults<MT1,MT2>();
1763
1764 try {
1765 initResults();
1766 dres_ -= eval( lhs_ ) + eval( orhs_ );
1767 odres_ -= eval( lhs_ ) + eval( orhs_ );
1768 sres_ -= eval( lhs_ ) + eval( orhs_ );
1769 osres_ -= eval( lhs_ ) + eval( orhs_ );
1770 refres_ -= eval( reflhs_ ) + eval( refrhs_ );
1771 }
1772 catch( std::exception& ex ) {
1773 convertException<MT1,OMT2>( ex );
1774 }
1775
1776 checkResults<MT1,OMT2>();
1777
1778 try {
1779 initResults();
1780 dres_ -= eval( olhs_ ) + eval( rhs_ );
1781 odres_ -= eval( olhs_ ) + eval( rhs_ );
1782 sres_ -= eval( olhs_ ) + eval( rhs_ );
1783 osres_ -= eval( olhs_ ) + eval( rhs_ );
1784 refres_ -= eval( reflhs_ ) + eval( refrhs_ );
1785 }
1786 catch( std::exception& ex ) {
1787 convertException<OMT1,MT2>( ex );
1788 }
1789
1790 checkResults<OMT1,MT2>();
1791
1792 try {
1793 initResults();
1794 dres_ -= eval( olhs_ ) + eval( orhs_ );
1795 odres_ -= eval( olhs_ ) + eval( orhs_ );
1796 sres_ -= eval( olhs_ ) + eval( orhs_ );
1797 osres_ -= eval( olhs_ ) + eval( orhs_ );
1798 refres_ -= eval( reflhs_ ) + eval( refrhs_ );
1799 }
1800 catch( std::exception& ex ) {
1801 convertException<OMT1,OMT2>( ex );
1802 }
1803
1804 checkResults<OMT1,OMT2>();
1805 }
1806
1807
1808 //=====================================================================================
1809 // Addition with Schur product assignment
1810 //=====================================================================================
1811
1812 // Addition with Schur product assignment with the given matrices
1813 {
1814 test_ = "Addition with Schur product assignment with the given matrices";
1815 error_ = "Failed Schur product assignment operation";
1816
1817 try {
1818 initResults();
1819 dres_ %= lhs_ + rhs_;
1820 odres_ %= lhs_ + rhs_;
1821 sres_ %= lhs_ + rhs_;
1822 osres_ %= lhs_ + rhs_;
1823 refres_ %= reflhs_ + refrhs_;
1824 }
1825 catch( std::exception& ex ) {
1826 convertException<MT1,MT2>( ex );
1827 }
1828
1829 checkResults<MT1,MT2>();
1830
1831 try {
1832 initResults();
1833 dres_ %= lhs_ + orhs_;
1834 odres_ %= lhs_ + orhs_;
1835 sres_ %= lhs_ + orhs_;
1836 osres_ %= lhs_ + orhs_;
1837 refres_ %= reflhs_ + refrhs_;
1838 }
1839 catch( std::exception& ex ) {
1840 convertException<MT1,OMT2>( ex );
1841 }
1842
1843 checkResults<MT1,OMT2>();
1844
1845 try {
1846 initResults();
1847 dres_ %= olhs_ + rhs_;
1848 odres_ %= olhs_ + rhs_;
1849 sres_ %= olhs_ + rhs_;
1850 osres_ %= olhs_ + rhs_;
1851 refres_ %= reflhs_ + refrhs_;
1852 }
1853 catch( std::exception& ex ) {
1854 convertException<OMT1,MT2>( ex );
1855 }
1856
1857 checkResults<OMT1,MT2>();
1858
1859 try {
1860 initResults();
1861 dres_ %= olhs_ + orhs_;
1862 odres_ %= olhs_ + orhs_;
1863 sres_ %= olhs_ + orhs_;
1864 osres_ %= olhs_ + orhs_;
1865 refres_ %= reflhs_ + refrhs_;
1866 }
1867 catch( std::exception& ex ) {
1868 convertException<OMT1,OMT2>( ex );
1869 }
1870
1871 checkResults<OMT1,OMT2>();
1872 }
1873
1874 // Addition with Schur product assignment with evaluated matrices
1875 {
1876 test_ = "Addition with Schur product assignment with evaluated matrices";
1877 error_ = "Failed Schur product assignment operation";
1878
1879 try {
1880 initResults();
1881 dres_ %= eval( lhs_ ) + eval( rhs_ );
1882 odres_ %= eval( lhs_ ) + eval( rhs_ );
1883 sres_ %= eval( lhs_ ) + eval( rhs_ );
1884 osres_ %= eval( lhs_ ) + eval( rhs_ );
1885 refres_ %= eval( reflhs_ ) + eval( refrhs_ );
1886 }
1887 catch( std::exception& ex ) {
1888 convertException<MT1,MT2>( ex );
1889 }
1890
1891 checkResults<MT1,MT2>();
1892
1893 try {
1894 initResults();
1895 dres_ %= eval( lhs_ ) + eval( orhs_ );
1896 odres_ %= eval( lhs_ ) + eval( orhs_ );
1897 sres_ %= eval( lhs_ ) + eval( orhs_ );
1898 osres_ %= eval( lhs_ ) + eval( orhs_ );
1899 refres_ %= eval( reflhs_ ) + eval( refrhs_ );
1900 }
1901 catch( std::exception& ex ) {
1902 convertException<MT1,OMT2>( ex );
1903 }
1904
1905 checkResults<MT1,OMT2>();
1906
1907 try {
1908 initResults();
1909 dres_ %= eval( olhs_ ) + eval( rhs_ );
1910 odres_ %= eval( olhs_ ) + eval( rhs_ );
1911 sres_ %= eval( olhs_ ) + eval( rhs_ );
1912 osres_ %= eval( olhs_ ) + eval( rhs_ );
1913 refres_ %= eval( reflhs_ ) + eval( refrhs_ );
1914 }
1915 catch( std::exception& ex ) {
1916 convertException<OMT1,MT2>( ex );
1917 }
1918
1919 checkResults<OMT1,MT2>();
1920
1921 try {
1922 initResults();
1923 dres_ %= eval( olhs_ ) + eval( orhs_ );
1924 odres_ %= eval( olhs_ ) + eval( orhs_ );
1925 sres_ %= eval( olhs_ ) + eval( orhs_ );
1926 osres_ %= eval( olhs_ ) + eval( orhs_ );
1927 refres_ %= eval( reflhs_ ) + eval( refrhs_ );
1928 }
1929 catch( std::exception& ex ) {
1930 convertException<OMT1,OMT2>( ex );
1931 }
1932
1933 checkResults<OMT1,OMT2>();
1934 }
1935 }
1936 #endif
1937 }
1938 //*************************************************************************************************
1939
1940
1941 //*************************************************************************************************
1942 /*!\brief Testing the negated dense matrix/sparse matrix addition.
1943 //
1944 // \return void
1945 // \exception std::runtime_error Addition error detected.
1946 //
1947 // This function tests the negated matrix addition with plain assignment, addition assignment,
1948 // subtraction assignment, and Schur product assignment. In case any error resulting from the
1949 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
1950 // thrown.
1951 */
1952 template< typename MT1 // Type of the left-hand side dense matrix
1953 , typename MT2 > // Type of the right-hand side sparse matrix
testNegatedOperation()1954 void OperationTest<MT1,MT2>::testNegatedOperation()
1955 {
1956 #if BLAZETEST_MATHTEST_TEST_NEGATED_OPERATION
1957 if( BLAZETEST_MATHTEST_TEST_NEGATED_OPERATION > 1 )
1958 {
1959 //=====================================================================================
1960 // Negated addition
1961 //=====================================================================================
1962
1963 // Negated addition with the given matrices
1964 {
1965 test_ = "Negated addition with the given matrices";
1966 error_ = "Failed addition operation";
1967
1968 try {
1969 initResults();
1970 dres_ = -( lhs_ + rhs_ );
1971 odres_ = -( lhs_ + rhs_ );
1972 sres_ = -( lhs_ + rhs_ );
1973 osres_ = -( lhs_ + rhs_ );
1974 refres_ = -( reflhs_ + refrhs_ );
1975 }
1976 catch( std::exception& ex ) {
1977 convertException<MT1,MT2>( ex );
1978 }
1979
1980 checkResults<MT1,MT2>();
1981
1982 try {
1983 initResults();
1984 dres_ = -( lhs_ + orhs_ );
1985 odres_ = -( lhs_ + orhs_ );
1986 sres_ = -( lhs_ + orhs_ );
1987 osres_ = -( lhs_ + orhs_ );
1988 refres_ = -( reflhs_ + refrhs_ );
1989 }
1990 catch( std::exception& ex ) {
1991 convertException<MT1,OMT2>( ex );
1992 }
1993
1994 checkResults<MT1,OMT2>();
1995
1996 try {
1997 initResults();
1998 dres_ = -( olhs_ + rhs_ );
1999 odres_ = -( olhs_ + rhs_ );
2000 sres_ = -( olhs_ + rhs_ );
2001 osres_ = -( olhs_ + rhs_ );
2002 refres_ = -( reflhs_ + refrhs_ );
2003 }
2004 catch( std::exception& ex ) {
2005 convertException<OMT1,MT2>( ex );
2006 }
2007
2008 checkResults<OMT1,MT2>();
2009
2010 try {
2011 initResults();
2012 dres_ = -( olhs_ + orhs_ );
2013 odres_ = -( olhs_ + orhs_ );
2014 sres_ = -( olhs_ + orhs_ );
2015 osres_ = -( olhs_ + orhs_ );
2016 refres_ = -( reflhs_ + refrhs_ );
2017 }
2018 catch( std::exception& ex ) {
2019 convertException<OMT1,OMT2>( ex );
2020 }
2021
2022 checkResults<OMT1,OMT2>();
2023 }
2024
2025 // Negated addition with evaluated matrices
2026 {
2027 test_ = "Negated addition with evaluated matrices";
2028 error_ = "Failed addition operation";
2029
2030 try {
2031 initResults();
2032 dres_ = -( eval( lhs_ ) + eval( rhs_ ) );
2033 odres_ = -( eval( lhs_ ) + eval( rhs_ ) );
2034 sres_ = -( eval( lhs_ ) + eval( rhs_ ) );
2035 osres_ = -( eval( lhs_ ) + eval( rhs_ ) );
2036 refres_ = -( eval( reflhs_ ) + eval( refrhs_ ) );
2037 }
2038 catch( std::exception& ex ) {
2039 convertException<MT1,MT2>( ex );
2040 }
2041
2042 checkResults<MT1,MT2>();
2043
2044 try {
2045 initResults();
2046 dres_ = -( eval( lhs_ ) + eval( orhs_ ) );
2047 odres_ = -( eval( lhs_ ) + eval( orhs_ ) );
2048 sres_ = -( eval( lhs_ ) + eval( orhs_ ) );
2049 osres_ = -( eval( lhs_ ) + eval( orhs_ ) );
2050 refres_ = -( eval( reflhs_ ) + eval( refrhs_ ) );
2051 }
2052 catch( std::exception& ex ) {
2053 convertException<MT1,OMT2>( ex );
2054 }
2055
2056 checkResults<MT1,OMT2>();
2057
2058 try {
2059 initResults();
2060 dres_ = -( eval( olhs_ ) + eval( rhs_ ) );
2061 odres_ = -( eval( olhs_ ) + eval( rhs_ ) );
2062 sres_ = -( eval( olhs_ ) + eval( rhs_ ) );
2063 osres_ = -( eval( olhs_ ) + eval( rhs_ ) );
2064 refres_ = -( eval( reflhs_ ) + eval( refrhs_ ) );
2065 }
2066 catch( std::exception& ex ) {
2067 convertException<OMT1,MT2>( ex );
2068 }
2069
2070 checkResults<OMT1,MT2>();
2071
2072 try {
2073 initResults();
2074 dres_ = -( eval( olhs_ ) + eval( orhs_ ) );
2075 odres_ = -( eval( olhs_ ) + eval( orhs_ ) );
2076 sres_ = -( eval( olhs_ ) + eval( orhs_ ) );
2077 osres_ = -( eval( olhs_ ) + eval( orhs_ ) );
2078 refres_ = -( eval( reflhs_ ) + eval( refrhs_ ) );
2079 }
2080 catch( std::exception& ex ) {
2081 convertException<OMT1,OMT2>( ex );
2082 }
2083
2084 checkResults<OMT1,OMT2>();
2085 }
2086
2087
2088 //=====================================================================================
2089 // Negated addition with addition assignment
2090 //=====================================================================================
2091
2092 // Negated addition with addition assignment with the given matrices
2093 {
2094 test_ = "Negated addition with addition assignment with the given matrices";
2095 error_ = "Failed addition assignment operation";
2096
2097 try {
2098 initResults();
2099 dres_ += -( lhs_ + rhs_ );
2100 odres_ += -( lhs_ + rhs_ );
2101 sres_ += -( lhs_ + rhs_ );
2102 osres_ += -( lhs_ + rhs_ );
2103 refres_ += -( reflhs_ + refrhs_ );
2104 }
2105 catch( std::exception& ex ) {
2106 convertException<MT1,MT2>( ex );
2107 }
2108
2109 checkResults<MT1,MT2>();
2110
2111 try {
2112 initResults();
2113 dres_ += -( lhs_ + orhs_ );
2114 odres_ += -( lhs_ + orhs_ );
2115 sres_ += -( lhs_ + orhs_ );
2116 osres_ += -( lhs_ + orhs_ );
2117 refres_ += -( reflhs_ + refrhs_ );
2118 }
2119 catch( std::exception& ex ) {
2120 convertException<MT1,OMT2>( ex );
2121 }
2122
2123 checkResults<MT1,OMT2>();
2124
2125 try {
2126 initResults();
2127 dres_ += -( olhs_ + rhs_ );
2128 odres_ += -( olhs_ + rhs_ );
2129 sres_ += -( olhs_ + rhs_ );
2130 osres_ += -( olhs_ + rhs_ );
2131 refres_ += -( reflhs_ + refrhs_ );
2132 }
2133 catch( std::exception& ex ) {
2134 convertException<OMT1,MT2>( ex );
2135 }
2136
2137 checkResults<OMT1,MT2>();
2138
2139 try {
2140 initResults();
2141 dres_ += -( olhs_ + orhs_ );
2142 odres_ += -( olhs_ + orhs_ );
2143 sres_ += -( olhs_ + orhs_ );
2144 osres_ += -( olhs_ + orhs_ );
2145 refres_ += -( reflhs_ + refrhs_ );
2146 }
2147 catch( std::exception& ex ) {
2148 convertException<OMT1,OMT2>( ex );
2149 }
2150
2151 checkResults<OMT1,OMT2>();
2152 }
2153
2154 // Negated addition with addition assignment with the given matrices
2155 {
2156 test_ = "Negated addition with addition assignment with evaluated matrices";
2157 error_ = "Failed addition assignment operation";
2158
2159 try {
2160 initResults();
2161 dres_ += -( eval( lhs_ ) + eval( rhs_ ) );
2162 odres_ += -( eval( lhs_ ) + eval( rhs_ ) );
2163 sres_ += -( eval( lhs_ ) + eval( rhs_ ) );
2164 osres_ += -( eval( lhs_ ) + eval( rhs_ ) );
2165 refres_ += -( eval( reflhs_ ) + eval( refrhs_ ) );
2166 }
2167 catch( std::exception& ex ) {
2168 convertException<MT1,MT2>( ex );
2169 }
2170
2171 checkResults<MT1,MT2>();
2172
2173 try {
2174 initResults();
2175 dres_ += -( eval( lhs_ ) + eval( orhs_ ) );
2176 odres_ += -( eval( lhs_ ) + eval( orhs_ ) );
2177 sres_ += -( eval( lhs_ ) + eval( orhs_ ) );
2178 osres_ += -( eval( lhs_ ) + eval( orhs_ ) );
2179 refres_ += -( eval( reflhs_ ) + eval( refrhs_ ) );
2180 }
2181 catch( std::exception& ex ) {
2182 convertException<MT1,OMT2>( ex );
2183 }
2184
2185 checkResults<MT1,OMT2>();
2186
2187 try {
2188 initResults();
2189 dres_ += -( eval( olhs_ ) + eval( rhs_ ) );
2190 odres_ += -( eval( olhs_ ) + eval( rhs_ ) );
2191 sres_ += -( eval( olhs_ ) + eval( rhs_ ) );
2192 osres_ += -( eval( olhs_ ) + eval( rhs_ ) );
2193 refres_ += -( eval( reflhs_ ) + eval( refrhs_ ) );
2194 }
2195 catch( std::exception& ex ) {
2196 convertException<OMT1,MT2>( ex );
2197 }
2198
2199 checkResults<OMT1,MT2>();
2200
2201 try {
2202 initResults();
2203 dres_ += -( eval( olhs_ ) + eval( orhs_ ) );
2204 odres_ += -( eval( olhs_ ) + eval( orhs_ ) );
2205 sres_ += -( eval( olhs_ ) + eval( orhs_ ) );
2206 osres_ += -( eval( olhs_ ) + eval( orhs_ ) );
2207 refres_ += -( eval( reflhs_ ) + eval( refrhs_ ) );
2208 }
2209 catch( std::exception& ex ) {
2210 convertException<OMT1,OMT2>( ex );
2211 }
2212
2213 checkResults<OMT1,OMT2>();
2214 }
2215
2216
2217 //=====================================================================================
2218 // Negated addition with subtraction assignment
2219 //=====================================================================================
2220
2221 // Negated addition with subtraction assignment with the given matrices
2222 {
2223 test_ = "Negated addition with subtraction assignment with the given matrices";
2224 error_ = "Failed subtraction assignment operation";
2225
2226 try {
2227 initResults();
2228 dres_ -= -( lhs_ + rhs_ );
2229 odres_ -= -( lhs_ + rhs_ );
2230 sres_ -= -( lhs_ + rhs_ );
2231 osres_ -= -( lhs_ + rhs_ );
2232 refres_ -= -( reflhs_ + refrhs_ );
2233 }
2234 catch( std::exception& ex ) {
2235 convertException<MT1,MT2>( ex );
2236 }
2237
2238 checkResults<MT1,MT2>();
2239
2240 try {
2241 initResults();
2242 dres_ -= -( lhs_ + orhs_ );
2243 odres_ -= -( lhs_ + orhs_ );
2244 sres_ -= -( lhs_ + orhs_ );
2245 osres_ -= -( lhs_ + orhs_ );
2246 refres_ -= -( reflhs_ + refrhs_ );
2247 }
2248 catch( std::exception& ex ) {
2249 convertException<MT1,OMT2>( ex );
2250 }
2251
2252 checkResults<MT1,OMT2>();
2253
2254 try {
2255 initResults();
2256 dres_ -= -( olhs_ + rhs_ );
2257 odres_ -= -( olhs_ + rhs_ );
2258 sres_ -= -( olhs_ + rhs_ );
2259 osres_ -= -( olhs_ + rhs_ );
2260 refres_ -= -( reflhs_ + refrhs_ );
2261 }
2262 catch( std::exception& ex ) {
2263 convertException<OMT1,MT2>( ex );
2264 }
2265
2266 checkResults<OMT1,MT2>();
2267
2268 try {
2269 initResults();
2270 dres_ -= -( olhs_ + orhs_ );
2271 odres_ -= -( olhs_ + orhs_ );
2272 sres_ -= -( olhs_ + orhs_ );
2273 osres_ -= -( olhs_ + orhs_ );
2274 refres_ -= -( reflhs_ + refrhs_ );
2275 }
2276 catch( std::exception& ex ) {
2277 convertException<OMT1,OMT2>( ex );
2278 }
2279
2280 checkResults<OMT1,OMT2>();
2281 }
2282
2283 // Negated addition with subtraction assignment with evaluated matrices
2284 {
2285 test_ = "Negated addition with subtraction assignment with evaluated matrices";
2286 error_ = "Failed subtraction assignment operation";
2287
2288 try {
2289 initResults();
2290 dres_ -= -( eval( lhs_ ) + eval( rhs_ ) );
2291 odres_ -= -( eval( lhs_ ) + eval( rhs_ ) );
2292 sres_ -= -( eval( lhs_ ) + eval( rhs_ ) );
2293 osres_ -= -( eval( lhs_ ) + eval( rhs_ ) );
2294 refres_ -= -( eval( reflhs_ ) + eval( refrhs_ ) );
2295 }
2296 catch( std::exception& ex ) {
2297 convertException<MT1,MT2>( ex );
2298 }
2299
2300 checkResults<MT1,MT2>();
2301
2302 try {
2303 initResults();
2304 dres_ -= -( eval( lhs_ ) + eval( orhs_ ) );
2305 odres_ -= -( eval( lhs_ ) + eval( orhs_ ) );
2306 sres_ -= -( eval( lhs_ ) + eval( orhs_ ) );
2307 osres_ -= -( eval( lhs_ ) + eval( orhs_ ) );
2308 refres_ -= -( eval( reflhs_ ) + eval( refrhs_ ) );
2309 }
2310 catch( std::exception& ex ) {
2311 convertException<MT1,OMT2>( ex );
2312 }
2313
2314 checkResults<MT1,OMT2>();
2315
2316 try {
2317 initResults();
2318 dres_ -= -( eval( olhs_ ) + eval( rhs_ ) );
2319 odres_ -= -( eval( olhs_ ) + eval( rhs_ ) );
2320 sres_ -= -( eval( olhs_ ) + eval( rhs_ ) );
2321 osres_ -= -( eval( olhs_ ) + eval( rhs_ ) );
2322 refres_ -= -( eval( reflhs_ ) + eval( refrhs_ ) );
2323 }
2324 catch( std::exception& ex ) {
2325 convertException<OMT1,MT2>( ex );
2326 }
2327
2328 checkResults<OMT1,MT2>();
2329
2330 try {
2331 initResults();
2332 dres_ -= -( eval( olhs_ ) + eval( orhs_ ) );
2333 odres_ -= -( eval( olhs_ ) + eval( orhs_ ) );
2334 sres_ -= -( eval( olhs_ ) + eval( orhs_ ) );
2335 osres_ -= -( eval( olhs_ ) + eval( orhs_ ) );
2336 refres_ -= -( eval( reflhs_ ) + eval( refrhs_ ) );
2337 }
2338 catch( std::exception& ex ) {
2339 convertException<OMT1,OMT2>( ex );
2340 }
2341
2342 checkResults<OMT1,OMT2>();
2343 }
2344
2345
2346 //=====================================================================================
2347 // Negated addition with Schur product assignment
2348 //=====================================================================================
2349
2350 // Negated addition with Schur product assignment with the given matrices
2351 {
2352 test_ = "Negated addition with Schur product assignment with the given matrices";
2353 error_ = "Failed Schur product assignment operation";
2354
2355 try {
2356 initResults();
2357 dres_ %= -( lhs_ + rhs_ );
2358 odres_ %= -( lhs_ + rhs_ );
2359 sres_ %= -( lhs_ + rhs_ );
2360 osres_ %= -( lhs_ + rhs_ );
2361 refres_ %= -( reflhs_ + refrhs_ );
2362 }
2363 catch( std::exception& ex ) {
2364 convertException<MT1,MT2>( ex );
2365 }
2366
2367 checkResults<MT1,MT2>();
2368
2369 try {
2370 initResults();
2371 dres_ %= -( lhs_ + orhs_ );
2372 odres_ %= -( lhs_ + orhs_ );
2373 sres_ %= -( lhs_ + orhs_ );
2374 osres_ %= -( lhs_ + orhs_ );
2375 refres_ %= -( reflhs_ + refrhs_ );
2376 }
2377 catch( std::exception& ex ) {
2378 convertException<MT1,OMT2>( ex );
2379 }
2380
2381 checkResults<MT1,OMT2>();
2382
2383 try {
2384 initResults();
2385 dres_ %= -( olhs_ + rhs_ );
2386 odres_ %= -( olhs_ + rhs_ );
2387 sres_ %= -( olhs_ + rhs_ );
2388 osres_ %= -( olhs_ + rhs_ );
2389 refres_ %= -( reflhs_ + refrhs_ );
2390 }
2391 catch( std::exception& ex ) {
2392 convertException<OMT1,MT2>( ex );
2393 }
2394
2395 checkResults<OMT1,MT2>();
2396
2397 try {
2398 initResults();
2399 dres_ %= -( olhs_ + orhs_ );
2400 odres_ %= -( olhs_ + orhs_ );
2401 sres_ %= -( olhs_ + orhs_ );
2402 osres_ %= -( olhs_ + orhs_ );
2403 refres_ %= -( reflhs_ + refrhs_ );
2404 }
2405 catch( std::exception& ex ) {
2406 convertException<OMT1,OMT2>( ex );
2407 }
2408
2409 checkResults<OMT1,OMT2>();
2410 }
2411
2412 // Negated addition with Schur product assignment with the given matrices
2413 {
2414 test_ = "Negated addition with Schur product assignment with evaluated matrices";
2415 error_ = "Failed Schur product assignment operation";
2416
2417 try {
2418 initResults();
2419 dres_ %= -( eval( lhs_ ) + eval( rhs_ ) );
2420 odres_ %= -( eval( lhs_ ) + eval( rhs_ ) );
2421 sres_ %= -( eval( lhs_ ) + eval( rhs_ ) );
2422 osres_ %= -( eval( lhs_ ) + eval( rhs_ ) );
2423 refres_ %= -( eval( reflhs_ ) + eval( refrhs_ ) );
2424 }
2425 catch( std::exception& ex ) {
2426 convertException<MT1,MT2>( ex );
2427 }
2428
2429 checkResults<MT1,MT2>();
2430
2431 try {
2432 initResults();
2433 dres_ %= -( eval( lhs_ ) + eval( orhs_ ) );
2434 odres_ %= -( eval( lhs_ ) + eval( orhs_ ) );
2435 sres_ %= -( eval( lhs_ ) + eval( orhs_ ) );
2436 osres_ %= -( eval( lhs_ ) + eval( orhs_ ) );
2437 refres_ %= -( eval( reflhs_ ) + eval( refrhs_ ) );
2438 }
2439 catch( std::exception& ex ) {
2440 convertException<MT1,OMT2>( ex );
2441 }
2442
2443 checkResults<MT1,OMT2>();
2444
2445 try {
2446 initResults();
2447 dres_ %= -( eval( olhs_ ) + eval( rhs_ ) );
2448 odres_ %= -( eval( olhs_ ) + eval( rhs_ ) );
2449 sres_ %= -( eval( olhs_ ) + eval( rhs_ ) );
2450 osres_ %= -( eval( olhs_ ) + eval( rhs_ ) );
2451 refres_ %= -( eval( reflhs_ ) + eval( refrhs_ ) );
2452 }
2453 catch( std::exception& ex ) {
2454 convertException<OMT1,MT2>( ex );
2455 }
2456
2457 checkResults<OMT1,MT2>();
2458
2459 try {
2460 initResults();
2461 dres_ %= -( eval( olhs_ ) + eval( orhs_ ) );
2462 odres_ %= -( eval( olhs_ ) + eval( orhs_ ) );
2463 sres_ %= -( eval( olhs_ ) + eval( orhs_ ) );
2464 osres_ %= -( eval( olhs_ ) + eval( orhs_ ) );
2465 refres_ %= -( eval( reflhs_ ) + eval( refrhs_ ) );
2466 }
2467 catch( std::exception& ex ) {
2468 convertException<OMT1,OMT2>( ex );
2469 }
2470
2471 checkResults<OMT1,OMT2>();
2472 }
2473 }
2474 #endif
2475 }
2476 //*************************************************************************************************
2477
2478
2479 //*************************************************************************************************
2480 /*!\brief Testing the scaled dense matrix/sparse matrix addition.
2481 //
2482 // \param scalar The scalar value.
2483 // \return void
2484 // \exception std::runtime_error Addition error detected.
2485 //
2486 // This function tests the scaled matrix addition with plain assignment, addition assignment,
2487 // subtraction assignment, and Schur product assignment. In case any error resulting from the
2488 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
2489 // thrown.
2490 */
2491 template< typename MT1 // Type of the left-hand side dense matrix
2492 , typename MT2 > // Type of the right-hand side sparse matrix
2493 template< typename T > // Type of the scalar
testScaledOperation(T scalar)2494 void OperationTest<MT1,MT2>::testScaledOperation( T scalar )
2495 {
2496 BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE( T );
2497
2498 if( scalar == T(0) )
2499 throw std::invalid_argument( "Invalid scalar parameter" );
2500
2501
2502 #if BLAZETEST_MATHTEST_TEST_SCALED_OPERATION
2503 if( BLAZETEST_MATHTEST_TEST_SCALED_OPERATION > 1 )
2504 {
2505 //=====================================================================================
2506 // Self-scaling (M*=s)
2507 //=====================================================================================
2508
2509 // Self-scaling (M*=s)
2510 {
2511 test_ = "Self-scaling (M*=s)";
2512
2513 try {
2514 dres_ = lhs_ + rhs_;
2515 odres_ = dres_;
2516 sres_ = dres_;
2517 osres_ = dres_;
2518 refres_ = dres_;
2519
2520 dres_ *= scalar;
2521 odres_ *= scalar;
2522 sres_ *= scalar;
2523 osres_ *= scalar;
2524 refres_ *= scalar;
2525 }
2526 catch( std::exception& ex ) {
2527 std::ostringstream oss;
2528 oss << " Test : " << test_ << "\n"
2529 << " Error: Failed self-scaling operation\n"
2530 << " Details:\n"
2531 << " Random seed = " << blaze::getSeed() << "\n"
2532 << " Scalar = " << scalar << "\n"
2533 << " Error message: " << ex.what() << "\n";
2534 throw std::runtime_error( oss.str() );
2535 }
2536
2537 checkResults<MT1,MT2>();
2538 }
2539
2540
2541 //=====================================================================================
2542 // Self-scaling (M=M*s)
2543 //=====================================================================================
2544
2545 // Self-scaling (M=M*s)
2546 {
2547 test_ = "Self-scaling (M=M*s)";
2548
2549 try {
2550 dres_ = lhs_ + rhs_;
2551 odres_ = dres_;
2552 sres_ = dres_;
2553 osres_ = dres_;
2554 refres_ = dres_;
2555
2556 dres_ = dres_ * scalar;
2557 odres_ = odres_ * scalar;
2558 sres_ = sres_ * scalar;
2559 osres_ = osres_ * scalar;
2560 refres_ = refres_ * scalar;
2561 }
2562 catch( std::exception& ex ) {
2563 std::ostringstream oss;
2564 oss << " Test : " << test_ << "\n"
2565 << " Error: Failed self-scaling operation\n"
2566 << " Details:\n"
2567 << " Random seed = " << blaze::getSeed() << "\n"
2568 << " Scalar = " << scalar << "\n"
2569 << " Error message: " << ex.what() << "\n";
2570 throw std::runtime_error( oss.str() );
2571 }
2572
2573 checkResults<MT1,MT2>();
2574 }
2575
2576
2577 //=====================================================================================
2578 // Self-scaling (M=s*M)
2579 //=====================================================================================
2580
2581 // Self-scaling (M=s*M)
2582 {
2583 test_ = "Self-scaling (M=s*M)";
2584
2585 try {
2586 dres_ = lhs_ + rhs_;
2587 odres_ = dres_;
2588 sres_ = dres_;
2589 osres_ = dres_;
2590 refres_ = dres_;
2591
2592 dres_ = scalar * dres_;
2593 odres_ = scalar * odres_;
2594 sres_ = scalar * sres_;
2595 osres_ = scalar * osres_;
2596 refres_ = scalar * refres_;
2597 }
2598 catch( std::exception& ex ) {
2599 std::ostringstream oss;
2600 oss << " Test : " << test_ << "\n"
2601 << " Error: Failed self-scaling operation\n"
2602 << " Details:\n"
2603 << " Random seed = " << blaze::getSeed() << "\n"
2604 << " Scalar = " << scalar << "\n"
2605 << " Error message: " << ex.what() << "\n";
2606 throw std::runtime_error( oss.str() );
2607 }
2608
2609 checkResults<MT1,MT2>();
2610 }
2611
2612
2613 //=====================================================================================
2614 // Self-scaling (M/=s)
2615 //=====================================================================================
2616
2617 // Self-scaling (M/=s)
2618 {
2619 test_ = "Self-scaling (M/=s)";
2620
2621 try {
2622 dres_ = lhs_ + rhs_;
2623 odres_ = dres_;
2624 sres_ = dres_;
2625 osres_ = dres_;
2626 refres_ = dres_;
2627
2628 dres_ /= scalar;
2629 odres_ /= scalar;
2630 sres_ /= scalar;
2631 osres_ /= scalar;
2632 refres_ /= scalar;
2633 }
2634 catch( std::exception& ex ) {
2635 std::ostringstream oss;
2636 oss << " Test : " << test_ << "\n"
2637 << " Error: Failed self-scaling operation\n"
2638 << " Details:\n"
2639 << " Random seed = " << blaze::getSeed() << "\n"
2640 << " Scalar = " << scalar << "\n"
2641 << " Error message: " << ex.what() << "\n";
2642 throw std::runtime_error( oss.str() );
2643 }
2644
2645 checkResults<MT1,MT2>();
2646 }
2647
2648
2649 //=====================================================================================
2650 // Self-scaling (M=M/s)
2651 //=====================================================================================
2652
2653 // Self-scaling (M=M/s)
2654 {
2655 test_ = "Self-scaling (M=M/s)";
2656
2657 try {
2658 dres_ = lhs_ + rhs_;
2659 odres_ = dres_;
2660 sres_ = dres_;
2661 osres_ = dres_;
2662 refres_ = dres_;
2663
2664 dres_ = dres_ / scalar;
2665 odres_ = odres_ / scalar;
2666 sres_ = sres_ / scalar;
2667 osres_ = osres_ / scalar;
2668 refres_ = refres_ / scalar;
2669 }
2670 catch( std::exception& ex ) {
2671 std::ostringstream oss;
2672 oss << " Test : " << test_ << "\n"
2673 << " Error: Failed self-scaling operation\n"
2674 << " Details:\n"
2675 << " Random seed = " << blaze::getSeed() << "\n"
2676 << " Scalar = " << scalar << "\n"
2677 << " Error message: " << ex.what() << "\n";
2678 throw std::runtime_error( oss.str() );
2679 }
2680
2681 checkResults<MT1,MT2>();
2682 }
2683
2684
2685 //=====================================================================================
2686 // Scaled addition (s*OP)
2687 //=====================================================================================
2688
2689 // Scaled addition with the given matrices
2690 {
2691 test_ = "Scaled addition with the given matrices (s*OP)";
2692 error_ = "Failed addition operation";
2693
2694 try {
2695 initResults();
2696 dres_ = scalar * ( lhs_ + rhs_ );
2697 odres_ = scalar * ( lhs_ + rhs_ );
2698 sres_ = scalar * ( lhs_ + rhs_ );
2699 osres_ = scalar * ( lhs_ + rhs_ );
2700 refres_ = scalar * ( reflhs_ + refrhs_ );
2701 }
2702 catch( std::exception& ex ) {
2703 convertException<MT1,MT2>( ex );
2704 }
2705
2706 checkResults<MT1,MT2>();
2707
2708 try {
2709 initResults();
2710 dres_ = scalar * ( lhs_ + orhs_ );
2711 odres_ = scalar * ( lhs_ + orhs_ );
2712 sres_ = scalar * ( lhs_ + orhs_ );
2713 osres_ = scalar * ( lhs_ + orhs_ );
2714 refres_ = scalar * ( reflhs_ + refrhs_ );
2715 }
2716 catch( std::exception& ex ) {
2717 convertException<MT1,OMT2>( ex );
2718 }
2719
2720 checkResults<MT1,OMT2>();
2721
2722 try {
2723 initResults();
2724 dres_ = scalar * ( olhs_ + rhs_ );
2725 odres_ = scalar * ( olhs_ + rhs_ );
2726 sres_ = scalar * ( olhs_ + rhs_ );
2727 osres_ = scalar * ( olhs_ + rhs_ );
2728 refres_ = scalar * ( reflhs_ + refrhs_ );
2729 }
2730 catch( std::exception& ex ) {
2731 convertException<OMT1,MT2>( ex );
2732 }
2733
2734 checkResults<OMT1,MT2>();
2735
2736 try {
2737 initResults();
2738 dres_ = scalar * ( olhs_ + orhs_ );
2739 odres_ = scalar * ( olhs_ + orhs_ );
2740 sres_ = scalar * ( olhs_ + orhs_ );
2741 osres_ = scalar * ( olhs_ + orhs_ );
2742 refres_ = scalar * ( reflhs_ + refrhs_ );
2743 }
2744 catch( std::exception& ex ) {
2745 convertException<OMT1,OMT2>( ex );
2746 }
2747
2748 checkResults<OMT1,OMT2>();
2749 }
2750
2751 // Scaled addition with evaluated matrices
2752 {
2753 test_ = "Scaled addition with evaluated matrices (s*OP)";
2754 error_ = "Failed addition operation";
2755
2756 try {
2757 initResults();
2758 dres_ = scalar * ( eval( lhs_ ) + eval( rhs_ ) );
2759 odres_ = scalar * ( eval( lhs_ ) + eval( rhs_ ) );
2760 sres_ = scalar * ( eval( lhs_ ) + eval( rhs_ ) );
2761 osres_ = scalar * ( eval( lhs_ ) + eval( rhs_ ) );
2762 refres_ = scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
2763 }
2764 catch( std::exception& ex ) {
2765 convertException<MT1,MT2>( ex );
2766 }
2767
2768 checkResults<MT1,MT2>();
2769
2770 try {
2771 initResults();
2772 dres_ = scalar * ( eval( lhs_ ) + eval( orhs_ ) );
2773 odres_ = scalar * ( eval( lhs_ ) + eval( orhs_ ) );
2774 sres_ = scalar * ( eval( lhs_ ) + eval( orhs_ ) );
2775 osres_ = scalar * ( eval( lhs_ ) + eval( orhs_ ) );
2776 refres_ = scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
2777 }
2778 catch( std::exception& ex ) {
2779 convertException<MT1,OMT2>( ex );
2780 }
2781
2782 checkResults<MT1,OMT2>();
2783
2784 try {
2785 initResults();
2786 dres_ = scalar * ( eval( olhs_ ) + eval( rhs_ ) );
2787 odres_ = scalar * ( eval( olhs_ ) + eval( rhs_ ) );
2788 sres_ = scalar * ( eval( olhs_ ) + eval( rhs_ ) );
2789 osres_ = scalar * ( eval( olhs_ ) + eval( rhs_ ) );
2790 refres_ = scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
2791 }
2792 catch( std::exception& ex ) {
2793 convertException<OMT1,MT2>( ex );
2794 }
2795
2796 checkResults<OMT1,MT2>();
2797
2798 try {
2799 initResults();
2800 dres_ = scalar * ( eval( olhs_ ) + eval( orhs_ ) );
2801 odres_ = scalar * ( eval( olhs_ ) + eval( orhs_ ) );
2802 sres_ = scalar * ( eval( olhs_ ) + eval( orhs_ ) );
2803 osres_ = scalar * ( eval( olhs_ ) + eval( orhs_ ) );
2804 refres_ = scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
2805 }
2806 catch( std::exception& ex ) {
2807 convertException<OMT1,OMT2>( ex );
2808 }
2809
2810 checkResults<OMT1,OMT2>();
2811 }
2812
2813
2814 //=====================================================================================
2815 // Scaled addition (OP*s)
2816 //=====================================================================================
2817
2818 // Scaled addition with the given matrices
2819 {
2820 test_ = "Scaled addition with the given matrices (OP*s)";
2821 error_ = "Failed addition operation";
2822
2823 try {
2824 initResults();
2825 dres_ = ( lhs_ + rhs_ ) * scalar;
2826 odres_ = ( lhs_ + rhs_ ) * scalar;
2827 sres_ = ( lhs_ + rhs_ ) * scalar;
2828 osres_ = ( lhs_ + rhs_ ) * scalar;
2829 refres_ = ( reflhs_ + refrhs_ ) * scalar;
2830 }
2831 catch( std::exception& ex ) {
2832 convertException<MT1,MT2>( ex );
2833 }
2834
2835 checkResults<MT1,MT2>();
2836
2837 try {
2838 initResults();
2839 dres_ = ( lhs_ + orhs_ ) * scalar;
2840 odres_ = ( lhs_ + orhs_ ) * scalar;
2841 sres_ = ( lhs_ + orhs_ ) * scalar;
2842 osres_ = ( lhs_ + orhs_ ) * scalar;
2843 refres_ = ( reflhs_ + refrhs_ ) * scalar;
2844 }
2845 catch( std::exception& ex ) {
2846 convertException<MT1,OMT2>( ex );
2847 }
2848
2849 checkResults<MT1,OMT2>();
2850
2851 try {
2852 initResults();
2853 dres_ = ( olhs_ + rhs_ ) * scalar;
2854 odres_ = ( olhs_ + rhs_ ) * scalar;
2855 sres_ = ( olhs_ + rhs_ ) * scalar;
2856 osres_ = ( olhs_ + rhs_ ) * scalar;
2857 refres_ = ( reflhs_ + refrhs_ ) * scalar;
2858 }
2859 catch( std::exception& ex ) {
2860 convertException<OMT1,MT2>( ex );
2861 }
2862
2863 checkResults<OMT1,MT2>();
2864
2865 try {
2866 initResults();
2867 dres_ = ( olhs_ + orhs_ ) * scalar;
2868 odres_ = ( olhs_ + orhs_ ) * scalar;
2869 sres_ = ( olhs_ + orhs_ ) * scalar;
2870 osres_ = ( olhs_ + orhs_ ) * scalar;
2871 refres_ = ( reflhs_ + refrhs_ ) * scalar;
2872 }
2873 catch( std::exception& ex ) {
2874 convertException<OMT1,OMT2>( ex );
2875 }
2876
2877 checkResults<OMT1,OMT2>();
2878 }
2879
2880 // Scaled addition with evaluated matrices
2881 {
2882 test_ = "Scaled addition with evaluated matrices (OP*s)";
2883 error_ = "Failed addition operation";
2884
2885 try {
2886 initResults();
2887 dres_ = ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
2888 odres_ = ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
2889 sres_ = ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
2890 osres_ = ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
2891 refres_ = ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
2892 }
2893 catch( std::exception& ex ) {
2894 convertException<MT1,MT2>( ex );
2895 }
2896
2897 checkResults<MT1,MT2>();
2898
2899 try {
2900 initResults();
2901 dres_ = ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
2902 odres_ = ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
2903 sres_ = ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
2904 osres_ = ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
2905 refres_ = ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
2906 }
2907 catch( std::exception& ex ) {
2908 convertException<MT1,OMT2>( ex );
2909 }
2910
2911 checkResults<MT1,OMT2>();
2912
2913 try {
2914 initResults();
2915 dres_ = ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
2916 odres_ = ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
2917 sres_ = ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
2918 osres_ = ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
2919 refres_ = ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
2920 }
2921 catch( std::exception& ex ) {
2922 convertException<OMT1,MT2>( ex );
2923 }
2924
2925 checkResults<OMT1,MT2>();
2926
2927 try {
2928 initResults();
2929 dres_ = ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
2930 odres_ = ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
2931 sres_ = ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
2932 osres_ = ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
2933 refres_ = ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
2934 }
2935 catch( std::exception& ex ) {
2936 convertException<OMT1,OMT2>( ex );
2937 }
2938
2939 checkResults<OMT1,OMT2>();
2940 }
2941
2942
2943 //=====================================================================================
2944 // Scaled addition (OP/s)
2945 //=====================================================================================
2946
2947 // Scaled addition with the given matrices
2948 {
2949 test_ = "Scaled addition with the given matrices (OP/s)";
2950 error_ = "Failed addition operation";
2951
2952 try {
2953 initResults();
2954 dres_ = ( lhs_ + rhs_ ) / scalar;
2955 odres_ = ( lhs_ + rhs_ ) / scalar;
2956 sres_ = ( lhs_ + rhs_ ) / scalar;
2957 osres_ = ( lhs_ + rhs_ ) / scalar;
2958 refres_ = ( reflhs_ + refrhs_ ) / scalar;
2959 }
2960 catch( std::exception& ex ) {
2961 convertException<MT1,MT2>( ex );
2962 }
2963
2964 checkResults<MT1,MT2>();
2965
2966 try {
2967 initResults();
2968 dres_ = ( lhs_ + orhs_ ) / scalar;
2969 odres_ = ( lhs_ + orhs_ ) / scalar;
2970 sres_ = ( lhs_ + orhs_ ) / scalar;
2971 osres_ = ( lhs_ + orhs_ ) / scalar;
2972 refres_ = ( reflhs_ + refrhs_ ) / scalar;
2973 }
2974 catch( std::exception& ex ) {
2975 convertException<MT1,OMT2>( ex );
2976 }
2977
2978 checkResults<MT1,OMT2>();
2979
2980 try {
2981 initResults();
2982 dres_ = ( olhs_ + rhs_ ) / scalar;
2983 odres_ = ( olhs_ + rhs_ ) / scalar;
2984 sres_ = ( olhs_ + rhs_ ) / scalar;
2985 osres_ = ( olhs_ + rhs_ ) / scalar;
2986 refres_ = ( reflhs_ + refrhs_ ) / scalar;
2987 }
2988 catch( std::exception& ex ) {
2989 convertException<OMT1,MT2>( ex );
2990 }
2991
2992 checkResults<OMT1,MT2>();
2993
2994 try {
2995 initResults();
2996 dres_ = ( olhs_ + orhs_ ) / scalar;
2997 odres_ = ( olhs_ + orhs_ ) / scalar;
2998 sres_ = ( olhs_ + orhs_ ) / scalar;
2999 osres_ = ( olhs_ + orhs_ ) / scalar;
3000 refres_ = ( reflhs_ + refrhs_ ) / scalar;
3001 }
3002 catch( std::exception& ex ) {
3003 convertException<OMT1,OMT2>( ex );
3004 }
3005
3006 checkResults<OMT1,OMT2>();
3007 }
3008
3009 // Scaled addition with evaluated matrices
3010 {
3011 test_ = "Scaled addition with evaluated matrices (OP/s)";
3012 error_ = "Failed addition operation";
3013
3014 try {
3015 initResults();
3016 dres_ = ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3017 odres_ = ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3018 sres_ = ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3019 osres_ = ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3020 refres_ = ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3021 }
3022 catch( std::exception& ex ) {
3023 convertException<MT1,MT2>( ex );
3024 }
3025
3026 checkResults<MT1,MT2>();
3027
3028 try {
3029 initResults();
3030 dres_ = ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3031 odres_ = ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3032 sres_ = ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3033 osres_ = ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3034 refres_ = ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3035 }
3036 catch( std::exception& ex ) {
3037 convertException<MT1,OMT2>( ex );
3038 }
3039
3040 checkResults<MT1,OMT2>();
3041
3042 try {
3043 initResults();
3044 dres_ = ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3045 odres_ = ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3046 sres_ = ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3047 osres_ = ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3048 refres_ = ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3049 }
3050 catch( std::exception& ex ) {
3051 convertException<OMT1,MT2>( ex );
3052 }
3053
3054 checkResults<OMT1,MT2>();
3055
3056 try {
3057 initResults();
3058 dres_ = ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3059 odres_ = ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3060 sres_ = ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3061 osres_ = ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3062 refres_ = ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3063 }
3064 catch( std::exception& ex ) {
3065 convertException<OMT1,OMT2>( ex );
3066 }
3067
3068 checkResults<OMT1,OMT2>();
3069 }
3070
3071
3072 //=====================================================================================
3073 // Scaled addition with addition assignment (s*OP)
3074 //=====================================================================================
3075
3076 // Scaled addition with addition assignment with the given matrices
3077 {
3078 test_ = "Scaled addition with addition assignment with the given matrices (s*OP)";
3079 error_ = "Failed addition assignment operation";
3080
3081 try {
3082 initResults();
3083 dres_ += scalar * ( lhs_ + rhs_ );
3084 odres_ += scalar * ( lhs_ + rhs_ );
3085 sres_ += scalar * ( lhs_ + rhs_ );
3086 osres_ += scalar * ( lhs_ + rhs_ );
3087 refres_ += scalar * ( reflhs_ + refrhs_ );
3088 }
3089 catch( std::exception& ex ) {
3090 convertException<MT1,MT2>( ex );
3091 }
3092
3093 checkResults<MT1,MT2>();
3094
3095 try {
3096 initResults();
3097 dres_ += scalar * ( lhs_ + orhs_ );
3098 odres_ += scalar * ( lhs_ + orhs_ );
3099 sres_ += scalar * ( lhs_ + orhs_ );
3100 osres_ += scalar * ( lhs_ + orhs_ );
3101 refres_ += scalar * ( reflhs_ + refrhs_ );
3102 }
3103 catch( std::exception& ex ) {
3104 convertException<MT1,OMT2>( ex );
3105 }
3106
3107 checkResults<MT1,OMT2>();
3108
3109 try {
3110 initResults();
3111 dres_ += scalar * ( olhs_ + rhs_ );
3112 odres_ += scalar * ( olhs_ + rhs_ );
3113 sres_ += scalar * ( olhs_ + rhs_ );
3114 osres_ += scalar * ( olhs_ + rhs_ );
3115 refres_ += scalar * ( reflhs_ + refrhs_ );
3116 }
3117 catch( std::exception& ex ) {
3118 convertException<OMT1,MT2>( ex );
3119 }
3120
3121 checkResults<OMT1,MT2>();
3122
3123 try {
3124 initResults();
3125 dres_ += scalar * ( olhs_ + orhs_ );
3126 odres_ += scalar * ( olhs_ + orhs_ );
3127 sres_ += scalar * ( olhs_ + orhs_ );
3128 osres_ += scalar * ( olhs_ + orhs_ );
3129 refres_ += scalar * ( reflhs_ + refrhs_ );
3130 }
3131 catch( std::exception& ex ) {
3132 convertException<OMT1,OMT2>( ex );
3133 }
3134
3135 checkResults<OMT1,OMT2>();
3136 }
3137
3138 // Scaled addition with addition assignment with evaluated matrices
3139 {
3140 test_ = "Scaled addition with addition assignment with evaluated matrices (s*OP)";
3141 error_ = "Failed addition assignment operation";
3142
3143 try {
3144 initResults();
3145 dres_ += scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3146 odres_ += scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3147 sres_ += scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3148 osres_ += scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3149 refres_ += scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3150 }
3151 catch( std::exception& ex ) {
3152 convertException<MT1,MT2>( ex );
3153 }
3154
3155 checkResults<MT1,MT2>();
3156
3157 try {
3158 initResults();
3159 dres_ += scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3160 odres_ += scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3161 sres_ += scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3162 osres_ += scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3163 refres_ += scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3164 }
3165 catch( std::exception& ex ) {
3166 convertException<MT1,OMT2>( ex );
3167 }
3168
3169 checkResults<MT1,OMT2>();
3170
3171 try {
3172 initResults();
3173 dres_ += scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3174 odres_ += scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3175 sres_ += scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3176 osres_ += scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3177 refres_ += scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3178 }
3179 catch( std::exception& ex ) {
3180 convertException<OMT1,MT2>( ex );
3181 }
3182
3183 checkResults<OMT1,MT2>();
3184
3185 try {
3186 initResults();
3187 dres_ += scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3188 odres_ += scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3189 sres_ += scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3190 osres_ += scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3191 refres_ += scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3192 }
3193 catch( std::exception& ex ) {
3194 convertException<OMT1,OMT2>( ex );
3195 }
3196
3197 checkResults<OMT1,OMT2>();
3198 }
3199
3200
3201 //=====================================================================================
3202 // Scaled addition with addition assignment (OP*s)
3203 //=====================================================================================
3204
3205 // Scaled addition with addition assignment with the given matrices
3206 {
3207 test_ = "Scaled addition with addition assignment with the given matrices (OP*s)";
3208 error_ = "Failed addition assignment operation";
3209
3210 try {
3211 initResults();
3212 dres_ += ( lhs_ + rhs_ ) * scalar;
3213 odres_ += ( lhs_ + rhs_ ) * scalar;
3214 sres_ += ( lhs_ + rhs_ ) * scalar;
3215 osres_ += ( lhs_ + rhs_ ) * scalar;
3216 refres_ += ( reflhs_ + refrhs_ ) * scalar;
3217 }
3218 catch( std::exception& ex ) {
3219 convertException<MT1,MT2>( ex );
3220 }
3221
3222 checkResults<MT1,MT2>();
3223
3224 try {
3225 initResults();
3226 dres_ += ( lhs_ + orhs_ ) * scalar;
3227 odres_ += ( lhs_ + orhs_ ) * scalar;
3228 sres_ += ( lhs_ + orhs_ ) * scalar;
3229 osres_ += ( lhs_ + orhs_ ) * scalar;
3230 refres_ += ( reflhs_ + refrhs_ ) * scalar;
3231 }
3232 catch( std::exception& ex ) {
3233 convertException<MT1,OMT2>( ex );
3234 }
3235
3236 checkResults<MT1,OMT2>();
3237
3238 try {
3239 initResults();
3240 dres_ += ( olhs_ + rhs_ ) * scalar;
3241 odres_ += ( olhs_ + rhs_ ) * scalar;
3242 sres_ += ( olhs_ + rhs_ ) * scalar;
3243 osres_ += ( olhs_ + rhs_ ) * scalar;
3244 refres_ += ( reflhs_ + refrhs_ ) * scalar;
3245 }
3246 catch( std::exception& ex ) {
3247 convertException<OMT1,MT2>( ex );
3248 }
3249
3250 checkResults<OMT1,MT2>();
3251
3252 try {
3253 initResults();
3254 dres_ += ( olhs_ + orhs_ ) * scalar;
3255 odres_ += ( olhs_ + orhs_ ) * scalar;
3256 sres_ += ( olhs_ + orhs_ ) * scalar;
3257 osres_ += ( olhs_ + orhs_ ) * scalar;
3258 refres_ += ( reflhs_ + refrhs_ ) * scalar;
3259 }
3260 catch( std::exception& ex ) {
3261 convertException<OMT1,OMT2>( ex );
3262 }
3263
3264 checkResults<OMT1,OMT2>();
3265 }
3266
3267 // Scaled addition with addition assignment with evaluated matrices
3268 {
3269 test_ = "Scaled addition with addition assignment with evaluated matrices (OP*s)";
3270 error_ = "Failed addition assignment operation";
3271
3272 try {
3273 initResults();
3274 dres_ += ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
3275 odres_ += ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
3276 sres_ += ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
3277 osres_ += ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
3278 refres_ += ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
3279 }
3280 catch( std::exception& ex ) {
3281 convertException<MT1,MT2>( ex );
3282 }
3283
3284 checkResults<MT1,MT2>();
3285
3286 try {
3287 initResults();
3288 dres_ += ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
3289 odres_ += ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
3290 sres_ += ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
3291 osres_ += ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
3292 refres_ += ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
3293 }
3294 catch( std::exception& ex ) {
3295 convertException<MT1,OMT2>( ex );
3296 }
3297
3298 checkResults<MT1,OMT2>();
3299
3300 try {
3301 initResults();
3302 dres_ += ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
3303 odres_ += ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
3304 sres_ += ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
3305 osres_ += ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
3306 refres_ += ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
3307 }
3308 catch( std::exception& ex ) {
3309 convertException<OMT1,MT2>( ex );
3310 }
3311
3312 checkResults<OMT1,MT2>();
3313
3314 try {
3315 initResults();
3316 dres_ += ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
3317 odres_ += ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
3318 sres_ += ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
3319 osres_ += ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
3320 refres_ += ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
3321 }
3322 catch( std::exception& ex ) {
3323 convertException<OMT1,OMT2>( ex );
3324 }
3325
3326 checkResults<OMT1,OMT2>();
3327 }
3328
3329
3330 //=====================================================================================
3331 // Scaled addition with addition assignment (OP/s)
3332 //=====================================================================================
3333
3334 // Scaled addition with addition assignment with the given matrices
3335 {
3336 test_ = "Scaled addition with addition assignment with the given matrices (OP/s)";
3337 error_ = "Failed addition assignment operation";
3338
3339 try {
3340 initResults();
3341 dres_ += ( lhs_ + rhs_ ) / scalar;
3342 odres_ += ( lhs_ + rhs_ ) / scalar;
3343 sres_ += ( lhs_ + rhs_ ) / scalar;
3344 osres_ += ( lhs_ + rhs_ ) / scalar;
3345 refres_ += ( reflhs_ + refrhs_ ) / scalar;
3346 }
3347 catch( std::exception& ex ) {
3348 convertException<MT1,MT2>( ex );
3349 }
3350
3351 checkResults<MT1,MT2>();
3352
3353 try {
3354 initResults();
3355 dres_ += ( lhs_ + orhs_ ) / scalar;
3356 odres_ += ( lhs_ + orhs_ ) / scalar;
3357 sres_ += ( lhs_ + orhs_ ) / scalar;
3358 osres_ += ( lhs_ + orhs_ ) / scalar;
3359 refres_ += ( reflhs_ + refrhs_ ) / scalar;
3360 }
3361 catch( std::exception& ex ) {
3362 convertException<MT1,OMT2>( ex );
3363 }
3364
3365 checkResults<MT1,OMT2>();
3366
3367 try {
3368 initResults();
3369 dres_ += ( olhs_ + rhs_ ) / scalar;
3370 odres_ += ( olhs_ + rhs_ ) / scalar;
3371 sres_ += ( olhs_ + rhs_ ) / scalar;
3372 osres_ += ( olhs_ + rhs_ ) / scalar;
3373 refres_ += ( reflhs_ + refrhs_ ) / scalar;
3374 }
3375 catch( std::exception& ex ) {
3376 convertException<OMT1,MT2>( ex );
3377 }
3378
3379 checkResults<OMT1,MT2>();
3380
3381 try {
3382 initResults();
3383 dres_ += ( olhs_ + orhs_ ) / scalar;
3384 odres_ += ( olhs_ + orhs_ ) / scalar;
3385 sres_ += ( olhs_ + orhs_ ) / scalar;
3386 osres_ += ( olhs_ + orhs_ ) / scalar;
3387 refres_ += ( reflhs_ + refrhs_ ) / scalar;
3388 }
3389 catch( std::exception& ex ) {
3390 convertException<OMT1,OMT2>( ex );
3391 }
3392
3393 checkResults<OMT1,OMT2>();
3394 }
3395
3396 // Scaled addition with addition assignment with evaluated matrices
3397 {
3398 test_ = "Scaled addition with addition assignment with evaluated matrices (OP/s)";
3399 error_ = "Failed addition assignment operation";
3400
3401 try {
3402 initResults();
3403 dres_ += ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3404 odres_ += ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3405 sres_ += ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3406 osres_ += ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3407 refres_ += ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3408 }
3409 catch( std::exception& ex ) {
3410 convertException<MT1,MT2>( ex );
3411 }
3412
3413 checkResults<MT1,MT2>();
3414
3415 try {
3416 initResults();
3417 dres_ += ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3418 odres_ += ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3419 sres_ += ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3420 osres_ += ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3421 refres_ += ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3422 }
3423 catch( std::exception& ex ) {
3424 convertException<MT1,OMT2>( ex );
3425 }
3426
3427 checkResults<MT1,OMT2>();
3428
3429 try {
3430 initResults();
3431 dres_ += ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3432 odres_ += ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3433 sres_ += ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3434 osres_ += ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3435 refres_ += ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3436 }
3437 catch( std::exception& ex ) {
3438 convertException<OMT1,MT2>( ex );
3439 }
3440
3441 checkResults<OMT1,MT2>();
3442
3443 try {
3444 initResults();
3445 dres_ += ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3446 odres_ += ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3447 sres_ += ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3448 osres_ += ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3449 refres_ += ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3450 }
3451 catch( std::exception& ex ) {
3452 convertException<OMT1,OMT2>( ex );
3453 }
3454
3455 checkResults<OMT1,OMT2>();
3456 }
3457
3458
3459 //=====================================================================================
3460 // Scaled addition with subtraction assignment (s*OP)
3461 //=====================================================================================
3462
3463 // Scaled addition with subtraction assignment with the given matrices
3464 {
3465 test_ = "Scaled addition with subtraction assignment with the given matrices (s*OP)";
3466 error_ = "Failed subtraction assignment operation";
3467
3468 try {
3469 initResults();
3470 dres_ -= scalar * ( lhs_ + rhs_ );
3471 odres_ -= scalar * ( lhs_ + rhs_ );
3472 sres_ -= scalar * ( lhs_ + rhs_ );
3473 osres_ -= scalar * ( lhs_ + rhs_ );
3474 refres_ -= scalar * ( reflhs_ + refrhs_ );
3475 }
3476 catch( std::exception& ex ) {
3477 convertException<MT1,MT2>( ex );
3478 }
3479
3480 checkResults<MT1,MT2>();
3481
3482 try {
3483 initResults();
3484 dres_ -= scalar * ( lhs_ + orhs_ );
3485 odres_ -= scalar * ( lhs_ + orhs_ );
3486 sres_ -= scalar * ( lhs_ + orhs_ );
3487 osres_ -= scalar * ( lhs_ + orhs_ );
3488 refres_ -= scalar * ( reflhs_ + refrhs_ );
3489 }
3490 catch( std::exception& ex ) {
3491 convertException<MT1,OMT2>( ex );
3492 }
3493
3494 checkResults<MT1,OMT2>();
3495
3496 try {
3497 initResults();
3498 dres_ -= scalar * ( olhs_ + rhs_ );
3499 odres_ -= scalar * ( olhs_ + rhs_ );
3500 sres_ -= scalar * ( olhs_ + rhs_ );
3501 osres_ -= scalar * ( olhs_ + rhs_ );
3502 refres_ -= scalar * ( reflhs_ + refrhs_ );
3503 }
3504 catch( std::exception& ex ) {
3505 convertException<OMT1,MT2>( ex );
3506 }
3507
3508 checkResults<OMT1,MT2>();
3509
3510 try {
3511 initResults();
3512 dres_ -= scalar * ( olhs_ + orhs_ );
3513 odres_ -= scalar * ( olhs_ + orhs_ );
3514 sres_ -= scalar * ( olhs_ + orhs_ );
3515 osres_ -= scalar * ( olhs_ + orhs_ );
3516 refres_ -= scalar * ( reflhs_ + refrhs_ );
3517 }
3518 catch( std::exception& ex ) {
3519 convertException<OMT1,OMT2>( ex );
3520 }
3521
3522 checkResults<OMT1,OMT2>();
3523 }
3524
3525 // Scaled addition with subtraction assignment with evaluated matrices
3526 {
3527 test_ = "Scaled addition with subtraction assignment with evaluated matrices (s*OP)";
3528 error_ = "Failed subtraction assignment operation";
3529
3530 try {
3531 initResults();
3532 dres_ -= scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3533 odres_ -= scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3534 sres_ -= scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3535 osres_ -= scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3536 refres_ -= scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3537 }
3538 catch( std::exception& ex ) {
3539 convertException<MT1,MT2>( ex );
3540 }
3541
3542 checkResults<MT1,MT2>();
3543
3544 try {
3545 initResults();
3546 dres_ -= scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3547 odres_ -= scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3548 sres_ -= scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3549 osres_ -= scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3550 refres_ -= scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3551 }
3552 catch( std::exception& ex ) {
3553 convertException<MT1,OMT2>( ex );
3554 }
3555
3556 checkResults<MT1,OMT2>();
3557
3558 try {
3559 initResults();
3560 dres_ -= scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3561 odres_ -= scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3562 sres_ -= scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3563 osres_ -= scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3564 refres_ -= scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3565 }
3566 catch( std::exception& ex ) {
3567 convertException<OMT1,MT2>( ex );
3568 }
3569
3570 checkResults<OMT1,MT2>();
3571
3572 try {
3573 initResults();
3574 dres_ -= scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3575 odres_ -= scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3576 sres_ -= scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3577 osres_ -= scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3578 refres_ -= scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3579 }
3580 catch( std::exception& ex ) {
3581 convertException<OMT1,OMT2>( ex );
3582 }
3583
3584 checkResults<OMT1,OMT2>();
3585 }
3586
3587
3588 //=====================================================================================
3589 // Scaled addition with subtraction assignment (OP*s)
3590 //=====================================================================================
3591
3592 // Scaled addition with subtraction assignment with the given matrices
3593 {
3594 test_ = "Scaled addition with subtraction assignment with the given matrices (OP*s)";
3595 error_ = "Failed subtraction assignment operation";
3596
3597 try {
3598 initResults();
3599 dres_ -= ( lhs_ + rhs_ ) * scalar;
3600 odres_ -= ( lhs_ + rhs_ ) * scalar;
3601 sres_ -= ( lhs_ + rhs_ ) * scalar;
3602 osres_ -= ( lhs_ + rhs_ ) * scalar;
3603 refres_ -= ( reflhs_ + refrhs_ ) * scalar;
3604 }
3605 catch( std::exception& ex ) {
3606 convertException<MT1,MT2>( ex );
3607 }
3608
3609 checkResults<MT1,MT2>();
3610
3611 try {
3612 initResults();
3613 dres_ -= ( lhs_ + orhs_ ) * scalar;
3614 odres_ -= ( lhs_ + orhs_ ) * scalar;
3615 sres_ -= ( lhs_ + orhs_ ) * scalar;
3616 osres_ -= ( lhs_ + orhs_ ) * scalar;
3617 refres_ -= ( reflhs_ + refrhs_ ) * scalar;
3618 }
3619 catch( std::exception& ex ) {
3620 convertException<MT1,OMT2>( ex );
3621 }
3622
3623 checkResults<MT1,OMT2>();
3624
3625 try {
3626 initResults();
3627 dres_ -= ( olhs_ + rhs_ ) * scalar;
3628 odres_ -= ( olhs_ + rhs_ ) * scalar;
3629 sres_ -= ( olhs_ + rhs_ ) * scalar;
3630 osres_ -= ( olhs_ + rhs_ ) * scalar;
3631 refres_ -= ( reflhs_ + refrhs_ ) * scalar;
3632 }
3633 catch( std::exception& ex ) {
3634 convertException<OMT1,MT2>( ex );
3635 }
3636
3637 checkResults<OMT1,MT2>();
3638
3639 try {
3640 initResults();
3641 dres_ -= ( olhs_ + orhs_ ) * scalar;
3642 odres_ -= ( olhs_ + orhs_ ) * scalar;
3643 sres_ -= ( olhs_ + orhs_ ) * scalar;
3644 osres_ -= ( olhs_ + orhs_ ) * scalar;
3645 refres_ -= ( reflhs_ + refrhs_ ) * scalar;
3646 }
3647 catch( std::exception& ex ) {
3648 convertException<OMT1,OMT2>( ex );
3649 }
3650
3651 checkResults<OMT1,OMT2>();
3652 }
3653
3654 // Scaled addition with subtraction assignment with evaluated matrices
3655 {
3656 test_ = "Scaled addition with subtraction assignment with evaluated matrices (OP*s)";
3657 error_ = "Failed subtraction assignment operation";
3658
3659 try {
3660 initResults();
3661 dres_ -= ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
3662 odres_ -= ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
3663 sres_ -= ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
3664 osres_ -= ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
3665 refres_ -= ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
3666 }
3667 catch( std::exception& ex ) {
3668 convertException<MT1,MT2>( ex );
3669 }
3670
3671 checkResults<MT1,MT2>();
3672
3673 try {
3674 initResults();
3675 dres_ -= ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
3676 odres_ -= ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
3677 sres_ -= ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
3678 osres_ -= ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
3679 refres_ -= ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
3680 }
3681 catch( std::exception& ex ) {
3682 convertException<MT1,OMT2>( ex );
3683 }
3684
3685 checkResults<MT1,OMT2>();
3686
3687 try {
3688 initResults();
3689 dres_ -= ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
3690 odres_ -= ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
3691 sres_ -= ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
3692 osres_ -= ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
3693 refres_ -= ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
3694 }
3695 catch( std::exception& ex ) {
3696 convertException<OMT1,MT2>( ex );
3697 }
3698
3699 checkResults<OMT1,MT2>();
3700
3701 try {
3702 initResults();
3703 dres_ -= ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
3704 odres_ -= ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
3705 sres_ -= ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
3706 osres_ -= ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
3707 refres_ -= ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
3708 }
3709 catch( std::exception& ex ) {
3710 convertException<OMT1,OMT2>( ex );
3711 }
3712
3713 checkResults<OMT1,OMT2>();
3714 }
3715
3716
3717 //=====================================================================================
3718 // Scaled addition with subtraction assignment (OP/s)
3719 //=====================================================================================
3720
3721 // Scaled addition with subtraction assignment with the given matrices
3722 {
3723 test_ = "Scaled addition with subtraction assignment with the given matrices (OP/s)";
3724 error_ = "Failed subtraction assignment operation";
3725
3726 try {
3727 initResults();
3728 dres_ -= ( lhs_ + rhs_ ) / scalar;
3729 odres_ -= ( lhs_ + rhs_ ) / scalar;
3730 sres_ -= ( lhs_ + rhs_ ) / scalar;
3731 osres_ -= ( lhs_ + rhs_ ) / scalar;
3732 refres_ -= ( reflhs_ + refrhs_ ) / scalar;
3733 }
3734 catch( std::exception& ex ) {
3735 convertException<MT1,MT2>( ex );
3736 }
3737
3738 checkResults<MT1,MT2>();
3739
3740 try {
3741 initResults();
3742 dres_ -= ( lhs_ + orhs_ ) / scalar;
3743 odres_ -= ( lhs_ + orhs_ ) / scalar;
3744 sres_ -= ( lhs_ + orhs_ ) / scalar;
3745 osres_ -= ( lhs_ + orhs_ ) / scalar;
3746 refres_ -= ( reflhs_ + refrhs_ ) / scalar;
3747 }
3748 catch( std::exception& ex ) {
3749 convertException<MT1,OMT2>( ex );
3750 }
3751
3752 checkResults<MT1,OMT2>();
3753
3754 try {
3755 initResults();
3756 dres_ -= ( olhs_ + rhs_ ) / scalar;
3757 odres_ -= ( olhs_ + rhs_ ) / scalar;
3758 sres_ -= ( olhs_ + rhs_ ) / scalar;
3759 osres_ -= ( olhs_ + rhs_ ) / scalar;
3760 refres_ -= ( reflhs_ + refrhs_ ) / scalar;
3761 }
3762 catch( std::exception& ex ) {
3763 convertException<OMT1,MT2>( ex );
3764 }
3765
3766 checkResults<OMT1,MT2>();
3767
3768 try {
3769 initResults();
3770 dres_ -= ( olhs_ + orhs_ ) / scalar;
3771 odres_ -= ( olhs_ + orhs_ ) / scalar;
3772 sres_ -= ( olhs_ + orhs_ ) / scalar;
3773 osres_ -= ( olhs_ + orhs_ ) / scalar;
3774 refres_ -= ( reflhs_ + refrhs_ ) / scalar;
3775 }
3776 catch( std::exception& ex ) {
3777 convertException<OMT1,OMT2>( ex );
3778 }
3779
3780 checkResults<OMT1,OMT2>();
3781 }
3782
3783 // Scaled addition with subtraction assignment with evaluated matrices
3784 {
3785 test_ = "Scaled addition with subtraction assignment with evaluated matrices (OP/s)";
3786 error_ = "Failed subtraction assignment operation";
3787
3788 try {
3789 initResults();
3790 dres_ -= ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3791 odres_ -= ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3792 sres_ -= ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3793 osres_ -= ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
3794 refres_ -= ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3795 }
3796 catch( std::exception& ex ) {
3797 convertException<MT1,MT2>( ex );
3798 }
3799
3800 checkResults<MT1,MT2>();
3801
3802 try {
3803 initResults();
3804 dres_ -= ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3805 odres_ -= ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3806 sres_ -= ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3807 osres_ -= ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
3808 refres_ -= ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3809 }
3810 catch( std::exception& ex ) {
3811 convertException<MT1,OMT2>( ex );
3812 }
3813
3814 checkResults<MT1,OMT2>();
3815
3816 try {
3817 initResults();
3818 dres_ -= ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3819 odres_ -= ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3820 sres_ -= ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3821 osres_ -= ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
3822 refres_ -= ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3823 }
3824 catch( std::exception& ex ) {
3825 convertException<OMT1,MT2>( ex );
3826 }
3827
3828 checkResults<OMT1,MT2>();
3829
3830 try {
3831 initResults();
3832 dres_ -= ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3833 odres_ -= ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3834 sres_ -= ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3835 osres_ -= ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
3836 refres_ -= ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
3837 }
3838 catch( std::exception& ex ) {
3839 convertException<OMT1,OMT2>( ex );
3840 }
3841
3842 checkResults<OMT1,OMT2>();
3843 }
3844
3845
3846 //=====================================================================================
3847 // Scaled addition with Schur product assignment (s*OP)
3848 //=====================================================================================
3849
3850 // Scaled addition with Schur product assignment with the given matrices
3851 {
3852 test_ = "Scaled addition with Schur product assignment with the given matrices (s*OP)";
3853 error_ = "Failed Schur product assignment operation";
3854
3855 try {
3856 initResults();
3857 dres_ %= scalar * ( lhs_ + rhs_ );
3858 odres_ %= scalar * ( lhs_ + rhs_ );
3859 sres_ %= scalar * ( lhs_ + rhs_ );
3860 osres_ %= scalar * ( lhs_ + rhs_ );
3861 refres_ %= scalar * ( reflhs_ + refrhs_ );
3862 }
3863 catch( std::exception& ex ) {
3864 convertException<MT1,MT2>( ex );
3865 }
3866
3867 checkResults<MT1,MT2>();
3868
3869 try {
3870 initResults();
3871 dres_ %= scalar * ( lhs_ + orhs_ );
3872 odres_ %= scalar * ( lhs_ + orhs_ );
3873 sres_ %= scalar * ( lhs_ + orhs_ );
3874 osres_ %= scalar * ( lhs_ + orhs_ );
3875 refres_ %= scalar * ( reflhs_ + refrhs_ );
3876 }
3877 catch( std::exception& ex ) {
3878 convertException<MT1,OMT2>( ex );
3879 }
3880
3881 checkResults<MT1,OMT2>();
3882
3883 try {
3884 initResults();
3885 dres_ %= scalar * ( olhs_ + rhs_ );
3886 odres_ %= scalar * ( olhs_ + rhs_ );
3887 sres_ %= scalar * ( olhs_ + rhs_ );
3888 osres_ %= scalar * ( olhs_ + rhs_ );
3889 refres_ %= scalar * ( reflhs_ + refrhs_ );
3890 }
3891 catch( std::exception& ex ) {
3892 convertException<OMT1,MT2>( ex );
3893 }
3894
3895 checkResults<OMT1,MT2>();
3896
3897 try {
3898 initResults();
3899 dres_ %= scalar * ( olhs_ + orhs_ );
3900 odres_ %= scalar * ( olhs_ + orhs_ );
3901 sres_ %= scalar * ( olhs_ + orhs_ );
3902 osres_ %= scalar * ( olhs_ + orhs_ );
3903 refres_ %= scalar * ( reflhs_ + refrhs_ );
3904 }
3905 catch( std::exception& ex ) {
3906 convertException<OMT1,OMT2>( ex );
3907 }
3908
3909 checkResults<OMT1,OMT2>();
3910 }
3911
3912 // Scaled addition with Schur product assignment with evaluated matrices
3913 {
3914 test_ = "Scaled addition with Schur product assignment with evaluated matrices (s*OP)";
3915 error_ = "Failed Schur product assignment operation";
3916
3917 try {
3918 initResults();
3919 dres_ %= scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3920 odres_ %= scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3921 sres_ %= scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3922 osres_ %= scalar * ( eval( lhs_ ) + eval( rhs_ ) );
3923 refres_ %= scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3924 }
3925 catch( std::exception& ex ) {
3926 convertException<MT1,MT2>( ex );
3927 }
3928
3929 checkResults<MT1,MT2>();
3930
3931 try {
3932 initResults();
3933 dres_ %= scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3934 odres_ %= scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3935 sres_ %= scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3936 osres_ %= scalar * ( eval( lhs_ ) + eval( orhs_ ) );
3937 refres_ %= scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3938 }
3939 catch( std::exception& ex ) {
3940 convertException<MT1,OMT2>( ex );
3941 }
3942
3943 checkResults<MT1,OMT2>();
3944
3945 try {
3946 initResults();
3947 dres_ %= scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3948 odres_ %= scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3949 sres_ %= scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3950 osres_ %= scalar * ( eval( olhs_ ) + eval( rhs_ ) );
3951 refres_ %= scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3952 }
3953 catch( std::exception& ex ) {
3954 convertException<OMT1,MT2>( ex );
3955 }
3956
3957 checkResults<OMT1,MT2>();
3958
3959 try {
3960 initResults();
3961 dres_ %= scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3962 odres_ %= scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3963 sres_ %= scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3964 osres_ %= scalar * ( eval( olhs_ ) + eval( orhs_ ) );
3965 refres_ %= scalar * ( eval( reflhs_ ) + eval( refrhs_ ) );
3966 }
3967 catch( std::exception& ex ) {
3968 convertException<OMT1,OMT2>( ex );
3969 }
3970
3971 checkResults<OMT1,OMT2>();
3972 }
3973
3974
3975 //=====================================================================================
3976 // Scaled addition with Schur product assignment (OP*s)
3977 //=====================================================================================
3978
3979 // Scaled addition with Schur product assignment with the given matrices
3980 {
3981 test_ = "Scaled addition with Schur product assignment with the given matrices (OP*s)";
3982 error_ = "Failed Schur product assignment operation";
3983
3984 try {
3985 initResults();
3986 dres_ %= ( lhs_ + rhs_ ) * scalar;
3987 odres_ %= ( lhs_ + rhs_ ) * scalar;
3988 sres_ %= ( lhs_ + rhs_ ) * scalar;
3989 osres_ %= ( lhs_ + rhs_ ) * scalar;
3990 refres_ %= ( reflhs_ + refrhs_ ) * scalar;
3991 }
3992 catch( std::exception& ex ) {
3993 convertException<MT1,MT2>( ex );
3994 }
3995
3996 checkResults<MT1,MT2>();
3997
3998 try {
3999 initResults();
4000 dres_ %= ( lhs_ + orhs_ ) * scalar;
4001 odres_ %= ( lhs_ + orhs_ ) * scalar;
4002 sres_ %= ( lhs_ + orhs_ ) * scalar;
4003 osres_ %= ( lhs_ + orhs_ ) * scalar;
4004 refres_ %= ( reflhs_ + refrhs_ ) * scalar;
4005 }
4006 catch( std::exception& ex ) {
4007 convertException<MT1,OMT2>( ex );
4008 }
4009
4010 checkResults<MT1,OMT2>();
4011
4012 try {
4013 initResults();
4014 dres_ %= ( olhs_ + rhs_ ) * scalar;
4015 odres_ %= ( olhs_ + rhs_ ) * scalar;
4016 sres_ %= ( olhs_ + rhs_ ) * scalar;
4017 osres_ %= ( olhs_ + rhs_ ) * scalar;
4018 refres_ %= ( reflhs_ + refrhs_ ) * scalar;
4019 }
4020 catch( std::exception& ex ) {
4021 convertException<OMT1,MT2>( ex );
4022 }
4023
4024 checkResults<OMT1,MT2>();
4025
4026 try {
4027 initResults();
4028 dres_ %= ( olhs_ + orhs_ ) * scalar;
4029 odres_ %= ( olhs_ + orhs_ ) * scalar;
4030 sres_ %= ( olhs_ + orhs_ ) * scalar;
4031 osres_ %= ( olhs_ + orhs_ ) * scalar;
4032 refres_ %= ( reflhs_ + refrhs_ ) * scalar;
4033 }
4034 catch( std::exception& ex ) {
4035 convertException<OMT1,OMT2>( ex );
4036 }
4037
4038 checkResults<OMT1,OMT2>();
4039 }
4040
4041 // Scaled addition with Schur product assignment with evaluated matrices
4042 {
4043 test_ = "Scaled addition with Schur product assignment with evaluated matrices (OP*s)";
4044 error_ = "Failed Schur product assignment operation";
4045
4046 try {
4047 initResults();
4048 dres_ %= ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
4049 odres_ %= ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
4050 sres_ %= ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
4051 osres_ %= ( eval( lhs_ ) + eval( rhs_ ) ) * scalar;
4052 refres_ %= ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
4053 }
4054 catch( std::exception& ex ) {
4055 convertException<MT1,MT2>( ex );
4056 }
4057
4058 checkResults<MT1,MT2>();
4059
4060 try {
4061 initResults();
4062 dres_ %= ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
4063 odres_ %= ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
4064 sres_ %= ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
4065 osres_ %= ( eval( lhs_ ) + eval( orhs_ ) ) * scalar;
4066 refres_ %= ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
4067 }
4068 catch( std::exception& ex ) {
4069 convertException<MT1,OMT2>( ex );
4070 }
4071
4072 checkResults<MT1,OMT2>();
4073
4074 try {
4075 initResults();
4076 dres_ %= ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
4077 odres_ %= ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
4078 sres_ %= ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
4079 osres_ %= ( eval( olhs_ ) + eval( rhs_ ) ) * scalar;
4080 refres_ %= ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
4081 }
4082 catch( std::exception& ex ) {
4083 convertException<OMT1,MT2>( ex );
4084 }
4085
4086 checkResults<OMT1,MT2>();
4087
4088 try {
4089 initResults();
4090 dres_ %= ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
4091 odres_ %= ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
4092 sres_ %= ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
4093 osres_ %= ( eval( olhs_ ) + eval( orhs_ ) ) * scalar;
4094 refres_ %= ( eval( reflhs_ ) + eval( refrhs_ ) ) * scalar;
4095 }
4096 catch( std::exception& ex ) {
4097 convertException<OMT1,OMT2>( ex );
4098 }
4099
4100 checkResults<OMT1,OMT2>();
4101 }
4102
4103
4104 //=====================================================================================
4105 // Scaled addition with Schur product assignment (OP/s)
4106 //=====================================================================================
4107
4108 // Scaled addition with Schur product assignment with the given matrices
4109 {
4110 test_ = "Scaled addition with Schur product assignment with the given matrices (OP/s)";
4111 error_ = "Failed Schur product assignment operation";
4112
4113 try {
4114 initResults();
4115 dres_ %= ( lhs_ + rhs_ ) / scalar;
4116 odres_ %= ( lhs_ + rhs_ ) / scalar;
4117 sres_ %= ( lhs_ + rhs_ ) / scalar;
4118 osres_ %= ( lhs_ + rhs_ ) / scalar;
4119 refres_ %= ( reflhs_ + refrhs_ ) / scalar;
4120 }
4121 catch( std::exception& ex ) {
4122 convertException<MT1,MT2>( ex );
4123 }
4124
4125 checkResults<MT1,MT2>();
4126
4127 try {
4128 initResults();
4129 dres_ %= ( lhs_ + orhs_ ) / scalar;
4130 odres_ %= ( lhs_ + orhs_ ) / scalar;
4131 sres_ %= ( lhs_ + orhs_ ) / scalar;
4132 osres_ %= ( lhs_ + orhs_ ) / scalar;
4133 refres_ %= ( reflhs_ + refrhs_ ) / scalar;
4134 }
4135 catch( std::exception& ex ) {
4136 convertException<MT1,OMT2>( ex );
4137 }
4138
4139 checkResults<MT1,OMT2>();
4140
4141 try {
4142 initResults();
4143 dres_ %= ( olhs_ + rhs_ ) / scalar;
4144 odres_ %= ( olhs_ + rhs_ ) / scalar;
4145 sres_ %= ( olhs_ + rhs_ ) / scalar;
4146 osres_ %= ( olhs_ + rhs_ ) / scalar;
4147 refres_ %= ( reflhs_ + refrhs_ ) / scalar;
4148 }
4149 catch( std::exception& ex ) {
4150 convertException<OMT1,MT2>( ex );
4151 }
4152
4153 checkResults<OMT1,MT2>();
4154
4155 try {
4156 initResults();
4157 dres_ %= ( olhs_ + orhs_ ) / scalar;
4158 odres_ %= ( olhs_ + orhs_ ) / scalar;
4159 sres_ %= ( olhs_ + orhs_ ) / scalar;
4160 osres_ %= ( olhs_ + orhs_ ) / scalar;
4161 refres_ %= ( reflhs_ + refrhs_ ) / scalar;
4162 }
4163 catch( std::exception& ex ) {
4164 convertException<OMT1,OMT2>( ex );
4165 }
4166
4167 checkResults<OMT1,OMT2>();
4168 }
4169
4170 // Scaled addition with Schur product assignment with evaluated matrices
4171 {
4172 test_ = "Scaled addition with Schur product assignment with evaluated matrices (OP/s)";
4173 error_ = "Failed Schur product assignment operation";
4174
4175 try {
4176 initResults();
4177 dres_ %= ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
4178 odres_ %= ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
4179 sres_ %= ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
4180 osres_ %= ( eval( lhs_ ) + eval( rhs_ ) ) / scalar;
4181 refres_ %= ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
4182 }
4183 catch( std::exception& ex ) {
4184 convertException<MT1,MT2>( ex );
4185 }
4186
4187 checkResults<MT1,MT2>();
4188
4189 try {
4190 initResults();
4191 dres_ %= ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
4192 odres_ %= ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
4193 sres_ %= ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
4194 osres_ %= ( eval( lhs_ ) + eval( orhs_ ) ) / scalar;
4195 refres_ %= ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
4196 }
4197 catch( std::exception& ex ) {
4198 convertException<MT1,OMT2>( ex );
4199 }
4200
4201 checkResults<MT1,OMT2>();
4202
4203 try {
4204 initResults();
4205 dres_ %= ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
4206 odres_ %= ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
4207 sres_ %= ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
4208 osres_ %= ( eval( olhs_ ) + eval( rhs_ ) ) / scalar;
4209 refres_ %= ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
4210 }
4211 catch( std::exception& ex ) {
4212 convertException<OMT1,MT2>( ex );
4213 }
4214
4215 checkResults<OMT1,MT2>();
4216
4217 try {
4218 initResults();
4219 dres_ %= ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
4220 odres_ %= ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
4221 sres_ %= ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
4222 osres_ %= ( eval( olhs_ ) + eval( orhs_ ) ) / scalar;
4223 refres_ %= ( eval( reflhs_ ) + eval( refrhs_ ) ) / scalar;
4224 }
4225 catch( std::exception& ex ) {
4226 convertException<OMT1,OMT2>( ex );
4227 }
4228
4229 checkResults<OMT1,OMT2>();
4230 }
4231 }
4232 #endif
4233 }
4234 //*************************************************************************************************
4235
4236
4237 //*************************************************************************************************
4238 /*!\brief Testing the transpose dense matrix/sparse matrix addition.
4239 //
4240 // \return void
4241 // \exception std::runtime_error Addition error detected.
4242 //
4243 // This function tests the transpose matrix addition with plain assignment. In case any error
4244 // resulting from the addition or the subsequent assignment is detected, a \a std::runtime_error
4245 // exception is thrown.
4246 */
4247 template< typename MT1 // Type of the left-hand side dense matrix
4248 , typename MT2 > // Type of the right-hand side sparse matrix
testTransOperation()4249 void OperationTest<MT1,MT2>::testTransOperation()
4250 {
4251 #if BLAZETEST_MATHTEST_TEST_TRANS_OPERATION
4252 if( BLAZETEST_MATHTEST_TEST_TRANS_OPERATION > 1 )
4253 {
4254 //=====================================================================================
4255 // Transpose addition
4256 //=====================================================================================
4257
4258 // Transpose addition with the given matrices
4259 {
4260 test_ = "Transpose addition with the given matrices";
4261 error_ = "Failed addition operation";
4262
4263 try {
4264 initTransposeResults();
4265 tdres_ = trans( lhs_ + rhs_ );
4266 todres_ = trans( lhs_ + rhs_ );
4267 tsres_ = trans( lhs_ + rhs_ );
4268 tosres_ = trans( lhs_ + rhs_ );
4269 refres_ = trans( reflhs_ + refrhs_ );
4270 }
4271 catch( std::exception& ex ) {
4272 convertException<MT1,MT2>( ex );
4273 }
4274
4275 checkTransposeResults<MT1,MT2>();
4276
4277 try {
4278 initTransposeResults();
4279 tdres_ = trans( lhs_ + orhs_ );
4280 todres_ = trans( lhs_ + orhs_ );
4281 tsres_ = trans( lhs_ + orhs_ );
4282 tosres_ = trans( lhs_ + orhs_ );
4283 refres_ = trans( reflhs_ + refrhs_ );
4284 }
4285 catch( std::exception& ex ) {
4286 convertException<MT1,OMT2>( ex );
4287 }
4288
4289 checkTransposeResults<MT1,OMT2>();
4290
4291 try {
4292 initTransposeResults();
4293 tdres_ = trans( olhs_ + rhs_ );
4294 todres_ = trans( olhs_ + rhs_ );
4295 tsres_ = trans( olhs_ + rhs_ );
4296 tosres_ = trans( olhs_ + rhs_ );
4297 refres_ = trans( reflhs_ + refrhs_ );
4298 }
4299 catch( std::exception& ex ) {
4300 convertException<OMT1,MT2>( ex );
4301 }
4302
4303 checkTransposeResults<OMT1,MT2>();
4304
4305 try {
4306 initTransposeResults();
4307 tdres_ = trans( olhs_ + orhs_ );
4308 todres_ = trans( olhs_ + orhs_ );
4309 tsres_ = trans( olhs_ + orhs_ );
4310 tosres_ = trans( olhs_ + orhs_ );
4311 refres_ = trans( reflhs_ + refrhs_ );
4312 }
4313 catch( std::exception& ex ) {
4314 convertException<OMT1,OMT2>( ex );
4315 }
4316
4317 checkTransposeResults<OMT1,OMT2>();
4318 }
4319
4320 // Transpose addition with evaluated matrices
4321 {
4322 test_ = "Transpose addition with evaluated matrices";
4323 error_ = "Failed addition operation";
4324
4325 try {
4326 initTransposeResults();
4327 tdres_ = trans( eval( lhs_ ) + eval( rhs_ ) );
4328 todres_ = trans( eval( lhs_ ) + eval( rhs_ ) );
4329 tsres_ = trans( eval( lhs_ ) + eval( rhs_ ) );
4330 tosres_ = trans( eval( lhs_ ) + eval( rhs_ ) );
4331 refres_ = trans( eval( reflhs_ ) + eval( refrhs_ ) );
4332 }
4333 catch( std::exception& ex ) {
4334 convertException<MT1,MT2>( ex );
4335 }
4336
4337 checkTransposeResults<MT1,MT2>();
4338
4339 try {
4340 initTransposeResults();
4341 tdres_ = trans( eval( lhs_ ) + eval( orhs_ ) );
4342 todres_ = trans( eval( lhs_ ) + eval( orhs_ ) );
4343 tsres_ = trans( eval( lhs_ ) + eval( orhs_ ) );
4344 tosres_ = trans( eval( lhs_ ) + eval( orhs_ ) );
4345 refres_ = trans( eval( reflhs_ ) + eval( refrhs_ ) );
4346 }
4347 catch( std::exception& ex ) {
4348 convertException<MT1,OMT2>( ex );
4349 }
4350
4351 checkTransposeResults<MT1,OMT2>();
4352
4353 try {
4354 initTransposeResults();
4355 tdres_ = trans( eval( olhs_ ) + eval( rhs_ ) );
4356 todres_ = trans( eval( olhs_ ) + eval( rhs_ ) );
4357 tsres_ = trans( eval( olhs_ ) + eval( rhs_ ) );
4358 tosres_ = trans( eval( olhs_ ) + eval( rhs_ ) );
4359 refres_ = trans( eval( reflhs_ ) + eval( refrhs_ ) );
4360 }
4361 catch( std::exception& ex ) {
4362 convertException<OMT1,MT2>( ex );
4363 }
4364
4365 checkTransposeResults<OMT1,MT2>();
4366
4367 try {
4368 initTransposeResults();
4369 tdres_ = trans( eval( olhs_ ) + eval( orhs_ ) );
4370 todres_ = trans( eval( olhs_ ) + eval( orhs_ ) );
4371 tsres_ = trans( eval( olhs_ ) + eval( orhs_ ) );
4372 tosres_ = trans( eval( olhs_ ) + eval( orhs_ ) );
4373 refres_ = trans( eval( reflhs_ ) + eval( refrhs_ ) );
4374 }
4375 catch( std::exception& ex ) {
4376 convertException<OMT1,OMT2>( ex );
4377 }
4378
4379 checkTransposeResults<OMT1,OMT2>();
4380 }
4381 }
4382 #endif
4383 }
4384 //*************************************************************************************************
4385
4386
4387 //*************************************************************************************************
4388 /*!\brief Testing the conjugate transpose dense matrix/sparse matrix addition.
4389 //
4390 // \return void
4391 // \exception std::runtime_error Addition error detected.
4392 //
4393 // This function tests the conjugate transpose matrix addition with plain assignment. In
4394 // case any error resulting from the addition or the subsequent assignment is detected,
4395 // a \a std::runtime_error exception is thrown.
4396 */
4397 template< typename MT1 // Type of the left-hand side dense matrix
4398 , typename MT2 > // Type of the right-hand side sparse matrix
testCTransOperation()4399 void OperationTest<MT1,MT2>::testCTransOperation()
4400 {
4401 #if BLAZETEST_MATHTEST_TEST_CTRANS_OPERATION
4402 if( BLAZETEST_MATHTEST_TEST_CTRANS_OPERATION > 1 )
4403 {
4404 //=====================================================================================
4405 // Conjugate transpose addition
4406 //=====================================================================================
4407
4408 // Conjugate transpose addition with the given matrices
4409 {
4410 test_ = "Conjugate transpose addition with the given matrices";
4411 error_ = "Failed addition operation";
4412
4413 try {
4414 initTransposeResults();
4415 tdres_ = ctrans( lhs_ + rhs_ );
4416 todres_ = ctrans( lhs_ + rhs_ );
4417 tsres_ = ctrans( lhs_ + rhs_ );
4418 tosres_ = ctrans( lhs_ + rhs_ );
4419 refres_ = ctrans( reflhs_ + refrhs_ );
4420 }
4421 catch( std::exception& ex ) {
4422 convertException<MT1,MT2>( ex );
4423 }
4424
4425 checkTransposeResults<MT1,MT2>();
4426
4427 try {
4428 initTransposeResults();
4429 tdres_ = ctrans( lhs_ + orhs_ );
4430 todres_ = ctrans( lhs_ + orhs_ );
4431 tsres_ = ctrans( lhs_ + orhs_ );
4432 tosres_ = ctrans( lhs_ + orhs_ );
4433 refres_ = ctrans( reflhs_ + refrhs_ );
4434 }
4435 catch( std::exception& ex ) {
4436 convertException<MT1,OMT2>( ex );
4437 }
4438
4439 checkTransposeResults<MT1,OMT2>();
4440
4441 try {
4442 initTransposeResults();
4443 tdres_ = ctrans( olhs_ + rhs_ );
4444 todres_ = ctrans( olhs_ + rhs_ );
4445 tsres_ = ctrans( olhs_ + rhs_ );
4446 tosres_ = ctrans( olhs_ + rhs_ );
4447 refres_ = ctrans( reflhs_ + refrhs_ );
4448 }
4449 catch( std::exception& ex ) {
4450 convertException<OMT1,MT2>( ex );
4451 }
4452
4453 checkTransposeResults<OMT1,MT2>();
4454
4455 try {
4456 initTransposeResults();
4457 tdres_ = ctrans( olhs_ + orhs_ );
4458 todres_ = ctrans( olhs_ + orhs_ );
4459 tsres_ = ctrans( olhs_ + orhs_ );
4460 tosres_ = ctrans( olhs_ + orhs_ );
4461 refres_ = ctrans( reflhs_ + refrhs_ );
4462 }
4463 catch( std::exception& ex ) {
4464 convertException<OMT1,OMT2>( ex );
4465 }
4466
4467 checkTransposeResults<OMT1,OMT2>();
4468 }
4469
4470 // Conjugate transpose addition with evaluated matrices
4471 {
4472 test_ = "Conjugate transpose addition with evaluated matrices";
4473 error_ = "Failed addition operation";
4474
4475 try {
4476 initTransposeResults();
4477 tdres_ = ctrans( eval( lhs_ ) + eval( rhs_ ) );
4478 todres_ = ctrans( eval( lhs_ ) + eval( rhs_ ) );
4479 tsres_ = ctrans( eval( lhs_ ) + eval( rhs_ ) );
4480 tosres_ = ctrans( eval( lhs_ ) + eval( rhs_ ) );
4481 refres_ = ctrans( eval( reflhs_ ) + eval( refrhs_ ) );
4482 }
4483 catch( std::exception& ex ) {
4484 convertException<MT1,MT2>( ex );
4485 }
4486
4487 checkTransposeResults<MT1,MT2>();
4488
4489 try {
4490 initTransposeResults();
4491 tdres_ = ctrans( eval( lhs_ ) + eval( orhs_ ) );
4492 todres_ = ctrans( eval( lhs_ ) + eval( orhs_ ) );
4493 tsres_ = ctrans( eval( lhs_ ) + eval( orhs_ ) );
4494 tosres_ = ctrans( eval( lhs_ ) + eval( orhs_ ) );
4495 refres_ = ctrans( eval( reflhs_ ) + eval( refrhs_ ) );
4496 }
4497 catch( std::exception& ex ) {
4498 convertException<MT1,OMT2>( ex );
4499 }
4500
4501 checkTransposeResults<MT1,OMT2>();
4502
4503 try {
4504 initTransposeResults();
4505 tdres_ = ctrans( eval( olhs_ ) + eval( rhs_ ) );
4506 todres_ = ctrans( eval( olhs_ ) + eval( rhs_ ) );
4507 tsres_ = ctrans( eval( olhs_ ) + eval( rhs_ ) );
4508 tosres_ = ctrans( eval( olhs_ ) + eval( rhs_ ) );
4509 refres_ = ctrans( eval( reflhs_ ) + eval( refrhs_ ) );
4510 }
4511 catch( std::exception& ex ) {
4512 convertException<OMT1,MT2>( ex );
4513 }
4514
4515 checkTransposeResults<OMT1,MT2>();
4516
4517 try {
4518 initTransposeResults();
4519 tdres_ = ctrans( eval( olhs_ ) + eval( orhs_ ) );
4520 todres_ = ctrans( eval( olhs_ ) + eval( orhs_ ) );
4521 tsres_ = ctrans( eval( olhs_ ) + eval( orhs_ ) );
4522 tosres_ = ctrans( eval( olhs_ ) + eval( orhs_ ) );
4523 refres_ = ctrans( eval( reflhs_ ) + eval( refrhs_ ) );
4524 }
4525 catch( std::exception& ex ) {
4526 convertException<OMT1,OMT2>( ex );
4527 }
4528
4529 checkTransposeResults<OMT1,OMT2>();
4530 }
4531 }
4532 #endif
4533 }
4534 //*************************************************************************************************
4535
4536
4537 //*************************************************************************************************
4538 /*!\brief Testing the abs dense matrix/sparse matrix addition.
4539 //
4540 // \return void
4541 // \exception std::runtime_error Addition error detected.
4542 //
4543 // This function tests the abs matrix addition with plain assignment, addition assignment,
4544 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4545 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
4546 // thrown.
4547 */
4548 template< typename MT1 // Type of the left-hand side dense matrix
4549 , typename MT2 > // Type of the right-hand side sparse matrix
testAbsOperation()4550 void OperationTest<MT1,MT2>::testAbsOperation()
4551 {
4552 #if BLAZETEST_MATHTEST_TEST_ABS_OPERATION
4553 if( BLAZETEST_MATHTEST_TEST_ABS_OPERATION > 1 )
4554 {
4555 testCustomOperation( blaze::Abs(), "abs" );
4556 }
4557 #endif
4558 }
4559 //*************************************************************************************************
4560
4561
4562 //*************************************************************************************************
4563 /*!\brief Testing the conjugate dense matrix/sparse matrix addition.
4564 //
4565 // \return void
4566 // \exception std::runtime_error Addition error detected.
4567 //
4568 // This function tests the conjugate matrix addition with plain assignment, addition assignment,
4569 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4570 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
4571 // thrown.
4572 */
4573 template< typename MT1 // Type of the left-hand side dense matrix
4574 , typename MT2 > // Type of the right-hand side sparse matrix
testConjOperation()4575 void OperationTest<MT1,MT2>::testConjOperation()
4576 {
4577 #if BLAZETEST_MATHTEST_TEST_CONJ_OPERATION
4578 if( BLAZETEST_MATHTEST_TEST_CONJ_OPERATION > 1 )
4579 {
4580 testCustomOperation( blaze::Conj(), "conj" );
4581 }
4582 #endif
4583 }
4584 //*************************************************************************************************
4585
4586
4587 //*************************************************************************************************
4588 /*!\brief Testing the \a real dense matrix/sparse matrix addition.
4589 //
4590 // \return void
4591 // \exception std::runtime_error Addition error detected.
4592 //
4593 // This function tests the \a real matrix addition with plain assignment, addition assignment,
4594 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4595 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
4596 // thrown.
4597 */
4598 template< typename MT1 // Type of the left-hand side dense matrix
4599 , typename MT2 > // Type of the right-hand side sparse matrix
testRealOperation()4600 void OperationTest<MT1,MT2>::testRealOperation()
4601 {
4602 #if BLAZETEST_MATHTEST_TEST_REAL_OPERATION
4603 if( BLAZETEST_MATHTEST_TEST_REAL_OPERATION > 1 )
4604 {
4605 testCustomOperation( blaze::Real(), "real" );
4606 }
4607 #endif
4608 }
4609 //*************************************************************************************************
4610
4611
4612 //*************************************************************************************************
4613 /*!\brief Testing the \a imag dense matrix/sparse matrix addition.
4614 //
4615 // \return void
4616 // \exception std::runtime_error Addition error detected.
4617 //
4618 // This function tests the \a imag matrix addition with plain assignment, addition assignment,
4619 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4620 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
4621 // thrown.
4622 */
4623 template< typename MT1 // Type of the left-hand side dense matrix
4624 , typename MT2 > // Type of the right-hand side sparse matrix
testImagOperation()4625 void OperationTest<MT1,MT2>::testImagOperation()
4626 {
4627 #if BLAZETEST_MATHTEST_TEST_IMAG_OPERATION
4628 if( BLAZETEST_MATHTEST_TEST_IMAG_OPERATION > 1 &&
4629 ( !blaze::IsHermitian<DRE>::value || blaze::isSymmetric( imag( lhs_ + rhs_ ) ) ) )
4630 {
4631 testCustomOperation( blaze::Imag(), "imag" );
4632 }
4633 #endif
4634 }
4635 //*************************************************************************************************
4636
4637
4638 //*************************************************************************************************
4639 /*!\brief Testing the \a inv dense matrix/sparse matrix addition.
4640 //
4641 // \return void
4642 // \exception std::runtime_error Addition error detected.
4643 //
4644 // This function tests the \a inv matrix addition with plain assignment, addition assignment,
4645 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4646 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
4647 // thrown.
4648 */
4649 template< typename MT1 // Type of the left-hand side dense matrix
4650 , typename MT2 > // Type of the right-hand side sparse matrix
testInvOperation(blaze::TrueType)4651 void OperationTest<MT1,MT2>::testInvOperation( blaze::TrueType )
4652 {
4653 #if BLAZETEST_MATHTEST_TEST_INV_OPERATION && BLAZETEST_MATHTEST_LAPACK_MODE
4654 if( BLAZETEST_MATHTEST_TEST_INV_OPERATION > 1 )
4655 {
4656 if( !isSquare( lhs_ + rhs_ ) || blaze::isDefault( det( lhs_ + rhs_ ) ) )
4657 return;
4658
4659 testCustomOperation( blaze::Inv(), "inv" );
4660 }
4661 #endif
4662 }
4663 //*************************************************************************************************
4664
4665
4666 //*************************************************************************************************
4667 /*!\brief Skipping the \a inv dense matrix/sparse matrix addition.
4668 //
4669 // \return void
4670 //
4671 // This function is called in case the \a inv matrix/matrix addition operation is not available
4672 // for the given matrix types \a MT1 and \a MT2.
4673 */
4674 template< typename MT1 // Type of the left-hand side dense matrix
4675 , typename MT2 > // Type of the right-hand side sparse matrix
testInvOperation(blaze::FalseType)4676 void OperationTest<MT1,MT2>::testInvOperation( blaze::FalseType )
4677 {}
4678 //*************************************************************************************************
4679
4680
4681 //*************************************************************************************************
4682 /*!\brief Testing the evaluated dense matrix/sparse matrix addition.
4683 //
4684 // \return void
4685 // \exception std::runtime_error Addition error detected.
4686 //
4687 // This function tests the evaluated matrix addition with plain assignment, addition assignment,
4688 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4689 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
4690 // thrown.
4691 */
4692 template< typename MT1 // Type of the left-hand side dense matrix
4693 , typename MT2 > // Type of the right-hand side sparse matrix
testEvalOperation()4694 void OperationTest<MT1,MT2>::testEvalOperation()
4695 {
4696 #if BLAZETEST_MATHTEST_TEST_EVAL_OPERATION
4697 if( BLAZETEST_MATHTEST_TEST_EVAL_OPERATION > 1 )
4698 {
4699 testCustomOperation( blaze::Eval(), "eval" );
4700 }
4701 #endif
4702 }
4703 //*************************************************************************************************
4704
4705
4706 //*************************************************************************************************
4707 /*!\brief Testing the serialized dense matrix/sparse matrix addition.
4708 //
4709 // \return void
4710 // \exception std::runtime_error Addition error detected.
4711 //
4712 // This function tests the serialized matrix addition with plain assignment, addition assignment,
4713 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4714 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
4715 // thrown.
4716 */
4717 template< typename MT1 // Type of the left-hand side dense matrix
4718 , typename MT2 > // Type of the right-hand side sparse matrix
testSerialOperation()4719 void OperationTest<MT1,MT2>::testSerialOperation()
4720 {
4721 #if BLAZETEST_MATHTEST_TEST_SERIAL_OPERATION
4722 if( BLAZETEST_MATHTEST_TEST_SERIAL_OPERATION > 1 )
4723 {
4724 testCustomOperation( blaze::Serial(), "serial" );
4725 }
4726 #endif
4727 }
4728 //*************************************************************************************************
4729
4730
4731 //*************************************************************************************************
4732 /*!\brief Testing the non-aliased dense matrix/sparse matrix addition.
4733 //
4734 // \return void
4735 // \exception std::runtime_error Addition error detected.
4736 //
4737 // This function tests the non-aliased matrix addition with plain assignment, addition assignment,
4738 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4739 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
4740 // thrown.
4741 */
4742 template< typename MT1 // Type of the left-hand side dense matrix
4743 , typename MT2 > // Type of the right-hand side sparse matrix
testNoAliasOperation()4744 void OperationTest<MT1,MT2>::testNoAliasOperation()
4745 {
4746 #if BLAZETEST_MATHTEST_TEST_NOALIAS_OPERATION
4747 if( BLAZETEST_MATHTEST_TEST_NOALIAS_OPERATION > 1 )
4748 {
4749 testCustomOperation( blaze::NoAlias(), "noalias" );
4750 }
4751 #endif
4752 }
4753 //*************************************************************************************************
4754
4755
4756 //*************************************************************************************************
4757 /*!\brief Testing the non-SIMD dense matrix/sparse matrix addition.
4758 //
4759 // \return void
4760 // \exception std::runtime_error Addition error detected.
4761 //
4762 // This function tests the non-SIMD matrix addition with plain assignment, addition assignment,
4763 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4764 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
4765 // thrown.
4766 */
4767 template< typename MT1 // Type of the left-hand side dense matrix
4768 , typename MT2 > // Type of the right-hand side sparse matrix
testNoSIMDOperation()4769 void OperationTest<MT1,MT2>::testNoSIMDOperation()
4770 {
4771 #if BLAZETEST_MATHTEST_TEST_NOSIMD_OPERATION
4772 if( BLAZETEST_MATHTEST_TEST_NOSIMD_OPERATION > 1 )
4773 {
4774 testCustomOperation( blaze::NoSIMD(), "nosimd" );
4775 }
4776 #endif
4777 }
4778 //*************************************************************************************************
4779
4780
4781 //*************************************************************************************************
4782 /*!\brief Testing the symmetric dense matrix/sparse matrix addition.
4783 //
4784 // \return void
4785 // \exception std::runtime_error Addition error detected.
4786 //
4787 // This function tests the symmetric matrix addition with plain assignment, addition assignment,
4788 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4789 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
4790 // thrown.
4791 */
4792 template< typename MT1 // Type of the left-hand side dense matrix
4793 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclSymOperation(blaze::TrueType)4794 void OperationTest<MT1,MT2>::testDeclSymOperation( blaze::TrueType )
4795 {
4796 #if BLAZETEST_MATHTEST_TEST_DECLSYM_OPERATION
4797 if( BLAZETEST_MATHTEST_TEST_DECLSYM_OPERATION > 1 )
4798 {
4799 if( ( !blaze::IsDiagonal<MT1>::value && blaze::IsTriangular<MT1>::value ) ||
4800 ( !blaze::IsDiagonal<MT2>::value && blaze::IsTriangular<MT2>::value ) ||
4801 ( !blaze::IsDiagonal<MT1>::value && blaze::IsHermitian<MT1>::value && blaze::IsComplex<ET1>::value ) ||
4802 ( !blaze::IsDiagonal<MT2>::value && blaze::IsHermitian<MT2>::value && blaze::IsComplex<ET2>::value ) ||
4803 ( lhs_.rows() != lhs_.columns() ) )
4804 return;
4805
4806
4807 //=====================================================================================
4808 // Test-specific setup of the left-hand side operand
4809 //=====================================================================================
4810
4811 MT1 lhs ( lhs_ * trans( lhs_ ) );
4812 OMT1 olhs ( lhs );
4813 RT1 reflhs( lhs );
4814
4815
4816 //=====================================================================================
4817 // Test-specific setup of the right-hand side operand
4818 //=====================================================================================
4819
4820 MT2 rhs ( rhs_ * trans( rhs_ ) );
4821 OMT2 orhs ( rhs );
4822 RT2 refrhs( rhs );
4823
4824
4825 //=====================================================================================
4826 // Declsym addition
4827 //=====================================================================================
4828
4829 // Declsym addition with the given matrices
4830 {
4831 test_ = "Declsym addition with the given matrices";
4832 error_ = "Failed addition operation";
4833
4834 try {
4835 initResults();
4836 dres_ = declsym( lhs + rhs );
4837 odres_ = declsym( lhs + rhs );
4838 sres_ = declsym( lhs + rhs );
4839 osres_ = declsym( lhs + rhs );
4840 refres_ = declsym( reflhs + refrhs );
4841 }
4842 catch( std::exception& ex ) {
4843 convertException<MT1,MT2>( ex );
4844 }
4845
4846 checkResults<MT1,MT2>();
4847
4848 try {
4849 initResults();
4850 dres_ = declsym( lhs + orhs );
4851 odres_ = declsym( lhs + orhs );
4852 sres_ = declsym( lhs + orhs );
4853 osres_ = declsym( lhs + orhs );
4854 refres_ = declsym( reflhs + refrhs );
4855 }
4856 catch( std::exception& ex ) {
4857 convertException<MT1,OMT2>( ex );
4858 }
4859
4860 checkResults<MT1,OMT2>();
4861
4862 try {
4863 initResults();
4864 dres_ = declsym( olhs + rhs );
4865 odres_ = declsym( olhs + rhs );
4866 sres_ = declsym( olhs + rhs );
4867 osres_ = declsym( olhs + rhs );
4868 refres_ = declsym( reflhs + refrhs );
4869 }
4870 catch( std::exception& ex ) {
4871 convertException<OMT1,MT2>( ex );
4872 }
4873
4874 checkResults<OMT1,MT2>();
4875
4876 try {
4877 initResults();
4878 dres_ = declsym( olhs + orhs );
4879 odres_ = declsym( olhs + orhs );
4880 sres_ = declsym( olhs + orhs );
4881 osres_ = declsym( olhs + orhs );
4882 refres_ = declsym( reflhs + refrhs );
4883 }
4884 catch( std::exception& ex ) {
4885 convertException<OMT1,OMT2>( ex );
4886 }
4887
4888 checkResults<OMT1,OMT2>();
4889 }
4890
4891 // Declsym addition with evaluated matrices
4892 {
4893 test_ = "Declsym addition with evaluated left-hand side matrix";
4894 error_ = "Failed addition operation";
4895
4896 try {
4897 initResults();
4898 dres_ = declsym( eval( lhs ) + eval( rhs ) );
4899 odres_ = declsym( eval( lhs ) + eval( rhs ) );
4900 sres_ = declsym( eval( lhs ) + eval( rhs ) );
4901 osres_ = declsym( eval( lhs ) + eval( rhs ) );
4902 refres_ = declsym( eval( reflhs ) + eval( refrhs ) );
4903 }
4904 catch( std::exception& ex ) {
4905 convertException<MT1,MT2>( ex );
4906 }
4907
4908 checkResults<MT1,MT2>();
4909
4910 try {
4911 initResults();
4912 dres_ = declsym( eval( lhs ) + eval( orhs ) );
4913 odres_ = declsym( eval( lhs ) + eval( orhs ) );
4914 sres_ = declsym( eval( lhs ) + eval( orhs ) );
4915 osres_ = declsym( eval( lhs ) + eval( orhs ) );
4916 refres_ = declsym( eval( reflhs ) + eval( refrhs ) );
4917 }
4918 catch( std::exception& ex ) {
4919 convertException<MT1,OMT2>( ex );
4920 }
4921
4922 checkResults<MT1,OMT2>();
4923
4924 try {
4925 initResults();
4926 dres_ = declsym( eval( olhs ) + eval( rhs ) );
4927 odres_ = declsym( eval( olhs ) + eval( rhs ) );
4928 sres_ = declsym( eval( olhs ) + eval( rhs ) );
4929 osres_ = declsym( eval( olhs ) + eval( rhs ) );
4930 refres_ = declsym( eval( reflhs ) + eval( refrhs ) );
4931 }
4932 catch( std::exception& ex ) {
4933 convertException<OMT1,MT2>( ex );
4934 }
4935
4936 checkResults<OMT1,MT2>();
4937
4938 try {
4939 initResults();
4940 dres_ = declsym( eval( olhs ) + eval( orhs ) );
4941 odres_ = declsym( eval( olhs ) + eval( orhs ) );
4942 sres_ = declsym( eval( olhs ) + eval( orhs ) );
4943 osres_ = declsym( eval( olhs ) + eval( orhs ) );
4944 refres_ = declsym( eval( reflhs ) + eval( refrhs ) );
4945 }
4946 catch( std::exception& ex ) {
4947 convertException<OMT1,OMT2>( ex );
4948 }
4949
4950 checkResults<OMT1,OMT2>();
4951 }
4952
4953
4954 //=====================================================================================
4955 // Declsym addition with addition assignment
4956 //=====================================================================================
4957
4958 // Declsym addition with addition assignment with the given matrices
4959 {
4960 test_ = "Declsym addition with addition assignment with the given matrices";
4961 error_ = "Failed addition assignment operation";
4962
4963 try {
4964 initResults();
4965 dres_ += declsym( lhs + rhs );
4966 odres_ += declsym( lhs + rhs );
4967 sres_ += declsym( lhs + rhs );
4968 osres_ += declsym( lhs + rhs );
4969 refres_ += declsym( reflhs + refrhs );
4970 }
4971 catch( std::exception& ex ) {
4972 convertException<MT1,MT2>( ex );
4973 }
4974
4975 checkResults<MT1,MT2>();
4976
4977 try {
4978 initResults();
4979 dres_ += declsym( lhs + orhs );
4980 odres_ += declsym( lhs + orhs );
4981 sres_ += declsym( lhs + orhs );
4982 osres_ += declsym( lhs + orhs );
4983 refres_ += declsym( reflhs + refrhs );
4984 }
4985 catch( std::exception& ex ) {
4986 convertException<MT1,OMT2>( ex );
4987 }
4988
4989 checkResults<MT1,OMT2>();
4990
4991 try {
4992 initResults();
4993 dres_ += declsym( olhs + rhs );
4994 odres_ += declsym( olhs + rhs );
4995 sres_ += declsym( olhs + rhs );
4996 osres_ += declsym( olhs + rhs );
4997 refres_ += declsym( reflhs + refrhs );
4998 }
4999 catch( std::exception& ex ) {
5000 convertException<OMT1,MT2>( ex );
5001 }
5002
5003 checkResults<OMT1,MT2>();
5004
5005 try {
5006 initResults();
5007 dres_ += declsym( olhs + orhs );
5008 odres_ += declsym( olhs + orhs );
5009 sres_ += declsym( olhs + orhs );
5010 osres_ += declsym( olhs + orhs );
5011 refres_ += declsym( reflhs + refrhs );
5012 }
5013 catch( std::exception& ex ) {
5014 convertException<OMT1,OMT2>( ex );
5015 }
5016
5017 checkResults<OMT1,OMT2>();
5018 }
5019
5020 // Declsym addition with addition assignment with evaluated matrices
5021 {
5022 test_ = "Declsym addition with addition assignment with evaluated matrices";
5023 error_ = "Failed addition assignment operation";
5024
5025 try {
5026 initResults();
5027 dres_ += declsym( eval( lhs ) + eval( rhs ) );
5028 odres_ += declsym( eval( lhs ) + eval( rhs ) );
5029 sres_ += declsym( eval( lhs ) + eval( rhs ) );
5030 osres_ += declsym( eval( lhs ) + eval( rhs ) );
5031 refres_ += declsym( eval( reflhs ) + eval( refrhs ) );
5032 }
5033 catch( std::exception& ex ) {
5034 convertException<MT1,MT2>( ex );
5035 }
5036
5037 checkResults<MT1,MT2>();
5038
5039 try {
5040 initResults();
5041 dres_ += declsym( eval( lhs ) + eval( orhs ) );
5042 odres_ += declsym( eval( lhs ) + eval( orhs ) );
5043 sres_ += declsym( eval( lhs ) + eval( orhs ) );
5044 osres_ += declsym( eval( lhs ) + eval( orhs ) );
5045 refres_ += declsym( eval( reflhs ) + eval( refrhs ) );
5046 }
5047 catch( std::exception& ex ) {
5048 convertException<MT1,OMT2>( ex );
5049 }
5050
5051 checkResults<MT1,OMT2>();
5052
5053 try {
5054 initResults();
5055 dres_ += declsym( eval( olhs ) + eval( rhs ) );
5056 odres_ += declsym( eval( olhs ) + eval( rhs ) );
5057 sres_ += declsym( eval( olhs ) + eval( rhs ) );
5058 osres_ += declsym( eval( olhs ) + eval( rhs ) );
5059 refres_ += declsym( eval( reflhs ) + eval( refrhs ) );
5060 }
5061 catch( std::exception& ex ) {
5062 convertException<OMT1,MT2>( ex );
5063 }
5064
5065 checkResults<OMT1,MT2>();
5066
5067 try {
5068 initResults();
5069 dres_ += declsym( eval( olhs ) + eval( orhs ) );
5070 odres_ += declsym( eval( olhs ) + eval( orhs ) );
5071 sres_ += declsym( eval( olhs ) + eval( orhs ) );
5072 osres_ += declsym( eval( olhs ) + eval( orhs ) );
5073 refres_ += declsym( eval( reflhs ) + eval( refrhs ) );
5074 }
5075 catch( std::exception& ex ) {
5076 convertException<OMT1,OMT2>( ex );
5077 }
5078
5079 checkResults<OMT1,OMT2>();
5080 }
5081
5082
5083 //=====================================================================================
5084 // Declsym addition with subtraction assignment
5085 //=====================================================================================
5086
5087 // Declsym addition with subtraction assignment with the given matrices
5088 {
5089 test_ = "Declsym addition with subtraction assignment with the given matrices";
5090 error_ = "Failed subtraction assignment operation";
5091
5092 try {
5093 initResults();
5094 dres_ -= declsym( lhs + rhs );
5095 odres_ -= declsym( lhs + rhs );
5096 sres_ -= declsym( lhs + rhs );
5097 osres_ -= declsym( lhs + rhs );
5098 refres_ -= declsym( reflhs + refrhs );
5099 }
5100 catch( std::exception& ex ) {
5101 convertException<MT1,MT2>( ex );
5102 }
5103
5104 checkResults<MT1,MT2>();
5105
5106 try {
5107 initResults();
5108 dres_ -= declsym( lhs + orhs );
5109 odres_ -= declsym( lhs + orhs );
5110 sres_ -= declsym( lhs + orhs );
5111 osres_ -= declsym( lhs + orhs );
5112 refres_ -= declsym( reflhs + refrhs );
5113 }
5114 catch( std::exception& ex ) {
5115 convertException<MT1,OMT2>( ex );
5116 }
5117
5118 checkResults<MT1,OMT2>();
5119
5120 try {
5121 initResults();
5122 dres_ -= declsym( olhs + rhs );
5123 odres_ -= declsym( olhs + rhs );
5124 sres_ -= declsym( olhs + rhs );
5125 osres_ -= declsym( olhs + rhs );
5126 refres_ -= declsym( reflhs + refrhs );
5127 }
5128 catch( std::exception& ex ) {
5129 convertException<OMT1,MT2>( ex );
5130 }
5131
5132 checkResults<OMT1,MT2>();
5133
5134 try {
5135 initResults();
5136 dres_ -= declsym( olhs + orhs );
5137 odres_ -= declsym( olhs + orhs );
5138 sres_ -= declsym( olhs + orhs );
5139 osres_ -= declsym( olhs + orhs );
5140 refres_ -= declsym( reflhs + refrhs );
5141 }
5142 catch( std::exception& ex ) {
5143 convertException<OMT1,OMT2>( ex );
5144 }
5145
5146 checkResults<OMT1,OMT2>();
5147 }
5148
5149 // Declsym addition with subtraction assignment with evaluated matrices
5150 {
5151 test_ = "Declsym addition with subtraction assignment with evaluated matrices";
5152 error_ = "Failed subtraction assignment operation";
5153
5154 try {
5155 initResults();
5156 dres_ -= declsym( eval( lhs ) + eval( rhs ) );
5157 odres_ -= declsym( eval( lhs ) + eval( rhs ) );
5158 sres_ -= declsym( eval( lhs ) + eval( rhs ) );
5159 osres_ -= declsym( eval( lhs ) + eval( rhs ) );
5160 refres_ -= declsym( eval( reflhs ) + eval( refrhs ) );
5161 }
5162 catch( std::exception& ex ) {
5163 convertException<MT1,MT2>( ex );
5164 }
5165
5166 checkResults<MT1,MT2>();
5167
5168 try {
5169 initResults();
5170 dres_ -= declsym( eval( lhs ) + eval( orhs ) );
5171 odres_ -= declsym( eval( lhs ) + eval( orhs ) );
5172 sres_ -= declsym( eval( lhs ) + eval( orhs ) );
5173 osres_ -= declsym( eval( lhs ) + eval( orhs ) );
5174 refres_ -= declsym( eval( reflhs ) + eval( refrhs ) );
5175 }
5176 catch( std::exception& ex ) {
5177 convertException<MT1,OMT2>( ex );
5178 }
5179
5180 checkResults<MT1,OMT2>();
5181
5182 try {
5183 initResults();
5184 dres_ -= declsym( eval( olhs ) + eval( rhs ) );
5185 odres_ -= declsym( eval( olhs ) + eval( rhs ) );
5186 sres_ -= declsym( eval( olhs ) + eval( rhs ) );
5187 osres_ -= declsym( eval( olhs ) + eval( rhs ) );
5188 refres_ -= declsym( eval( reflhs ) + eval( refrhs ) );
5189 }
5190 catch( std::exception& ex ) {
5191 convertException<OMT1,MT2>( ex );
5192 }
5193
5194 checkResults<OMT1,MT2>();
5195
5196 try {
5197 initResults();
5198 dres_ -= declsym( eval( olhs ) + eval( orhs ) );
5199 odres_ -= declsym( eval( olhs ) + eval( orhs ) );
5200 sres_ -= declsym( eval( olhs ) + eval( orhs ) );
5201 osres_ -= declsym( eval( olhs ) + eval( orhs ) );
5202 refres_ -= declsym( eval( reflhs ) + eval( refrhs ) );
5203 }
5204 catch( std::exception& ex ) {
5205 convertException<OMT1,OMT2>( ex );
5206 }
5207
5208 checkResults<OMT1,OMT2>();
5209 }
5210
5211
5212 //=====================================================================================
5213 // Declsym addition with Schur product assignment
5214 //=====================================================================================
5215
5216 // Declsym addition with Schur product assignment with the given matrices
5217 {
5218 test_ = "Declsym addition with Schur product assignment with the given matrices";
5219 error_ = "Failed Schur product assignment operation";
5220
5221 try {
5222 initResults();
5223 dres_ %= declsym( lhs + rhs );
5224 odres_ %= declsym( lhs + rhs );
5225 sres_ %= declsym( lhs + rhs );
5226 osres_ %= declsym( lhs + rhs );
5227 refres_ %= declsym( reflhs + refrhs );
5228 }
5229 catch( std::exception& ex ) {
5230 convertException<MT1,MT2>( ex );
5231 }
5232
5233 checkResults<MT1,MT2>();
5234
5235 try {
5236 initResults();
5237 dres_ %= declsym( lhs + orhs );
5238 odres_ %= declsym( lhs + orhs );
5239 sres_ %= declsym( lhs + orhs );
5240 osres_ %= declsym( lhs + orhs );
5241 refres_ %= declsym( reflhs + refrhs );
5242 }
5243 catch( std::exception& ex ) {
5244 convertException<MT1,OMT2>( ex );
5245 }
5246
5247 checkResults<MT1,OMT2>();
5248
5249 try {
5250 initResults();
5251 dres_ %= declsym( olhs + rhs );
5252 odres_ %= declsym( olhs + rhs );
5253 sres_ %= declsym( olhs + rhs );
5254 osres_ %= declsym( olhs + rhs );
5255 refres_ %= declsym( reflhs + refrhs );
5256 }
5257 catch( std::exception& ex ) {
5258 convertException<OMT1,MT2>( ex );
5259 }
5260
5261 checkResults<OMT1,MT2>();
5262
5263 try {
5264 initResults();
5265 dres_ %= declsym( olhs + orhs );
5266 odres_ %= declsym( olhs + orhs );
5267 sres_ %= declsym( olhs + orhs );
5268 osres_ %= declsym( olhs + orhs );
5269 refres_ %= declsym( reflhs + refrhs );
5270 }
5271 catch( std::exception& ex ) {
5272 convertException<OMT1,OMT2>( ex );
5273 }
5274
5275 checkResults<OMT1,OMT2>();
5276 }
5277
5278 // Declsym addition with Schur product assignment with evaluated matrices
5279 {
5280 test_ = "Declsym addition with Schur product assignment with evaluated matrices";
5281 error_ = "Failed Schur product assignment operation";
5282
5283 try {
5284 initResults();
5285 dres_ %= declsym( eval( lhs ) + eval( rhs ) );
5286 odres_ %= declsym( eval( lhs ) + eval( rhs ) );
5287 sres_ %= declsym( eval( lhs ) + eval( rhs ) );
5288 osres_ %= declsym( eval( lhs ) + eval( rhs ) );
5289 refres_ %= declsym( eval( reflhs ) + eval( refrhs ) );
5290 }
5291 catch( std::exception& ex ) {
5292 convertException<MT1,MT2>( ex );
5293 }
5294
5295 checkResults<MT1,MT2>();
5296
5297 try {
5298 initResults();
5299 dres_ %= declsym( eval( lhs ) + eval( orhs ) );
5300 odres_ %= declsym( eval( lhs ) + eval( orhs ) );
5301 sres_ %= declsym( eval( lhs ) + eval( orhs ) );
5302 osres_ %= declsym( eval( lhs ) + eval( orhs ) );
5303 refres_ %= declsym( eval( reflhs ) + eval( refrhs ) );
5304 }
5305 catch( std::exception& ex ) {
5306 convertException<MT1,OMT2>( ex );
5307 }
5308
5309 checkResults<MT1,OMT2>();
5310
5311 try {
5312 initResults();
5313 dres_ %= declsym( eval( olhs ) + eval( rhs ) );
5314 odres_ %= declsym( eval( olhs ) + eval( rhs ) );
5315 sres_ %= declsym( eval( olhs ) + eval( rhs ) );
5316 osres_ %= declsym( eval( olhs ) + eval( rhs ) );
5317 refres_ %= declsym( eval( reflhs ) + eval( refrhs ) );
5318 }
5319 catch( std::exception& ex ) {
5320 convertException<OMT1,MT2>( ex );
5321 }
5322
5323 checkResults<OMT1,MT2>();
5324
5325 try {
5326 initResults();
5327 dres_ %= declsym( eval( olhs ) + eval( orhs ) );
5328 odres_ %= declsym( eval( olhs ) + eval( orhs ) );
5329 sres_ %= declsym( eval( olhs ) + eval( orhs ) );
5330 osres_ %= declsym( eval( olhs ) + eval( orhs ) );
5331 refres_ %= declsym( eval( reflhs ) + eval( refrhs ) );
5332 }
5333 catch( std::exception& ex ) {
5334 convertException<OMT1,OMT2>( ex );
5335 }
5336
5337 checkResults<OMT1,OMT2>();
5338 }
5339 }
5340 #endif
5341 }
5342 //*************************************************************************************************
5343
5344
5345 //*************************************************************************************************
5346 /*!\brief Skipping the symmetric dense matrix/sparse matrix addition.
5347 //
5348 // \return void
5349 //
5350 // This function is called in case the symmetric matrix/matrix addition operation is not
5351 // available for the given matrix types \a MT1 and \a MT2.
5352 */
5353 template< typename MT1 // Type of the left-hand side dense matrix
5354 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclSymOperation(blaze::FalseType)5355 void OperationTest<MT1,MT2>::testDeclSymOperation( blaze::FalseType )
5356 {}
5357 //*************************************************************************************************
5358
5359
5360 //*************************************************************************************************
5361 /*!\brief Testing the Hermitian dense matrix/sparse matrix addition.
5362 //
5363 // \return void
5364 // \exception std::runtime_error Addition error detected.
5365 //
5366 // This function tests the Hermitian matrix addition with plain assignment, addition assignment,
5367 // subtraction assignment, and Schur product assignment. In case any error resulting from the
5368 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
5369 // thrown.
5370 */
5371 template< typename MT1 // Type of the left-hand side dense matrix
5372 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclHermOperation(blaze::TrueType)5373 void OperationTest<MT1,MT2>::testDeclHermOperation( blaze::TrueType )
5374 {
5375 #if BLAZETEST_MATHTEST_TEST_DECLHERM_OPERATION
5376 if( BLAZETEST_MATHTEST_TEST_DECLHERM_OPERATION > 1 )
5377 {
5378 if( ( !blaze::IsDiagonal<MT1>::value && blaze::IsTriangular<MT1>::value ) ||
5379 ( !blaze::IsDiagonal<MT2>::value && blaze::IsTriangular<MT2>::value ) ||
5380 ( !blaze::IsDiagonal<MT1>::value && blaze::IsSymmetric<MT1>::value && blaze::IsComplex<ET1>::value ) ||
5381 ( !blaze::IsDiagonal<MT2>::value && blaze::IsSymmetric<MT2>::value && blaze::IsComplex<ET2>::value ) ||
5382 ( lhs_.rows() != lhs_.columns() ) )
5383 return;
5384
5385
5386 //=====================================================================================
5387 // Test-specific setup of the left-hand side operand
5388 //=====================================================================================
5389
5390 MT1 lhs ( lhs_ * ctrans( lhs_ ) );
5391 OMT1 olhs ( lhs );
5392 RT1 reflhs( lhs );
5393
5394
5395 //=====================================================================================
5396 // Test-specific setup of the right-hand side operand
5397 //=====================================================================================
5398
5399 MT2 rhs ( rhs_ * ctrans( rhs_ ) );
5400 OMT2 orhs ( rhs );
5401 RT2 refrhs( rhs );
5402
5403
5404 //=====================================================================================
5405 // Declherm addition
5406 //=====================================================================================
5407
5408 // Declherm addition with the given matrices
5409 {
5410 test_ = "Declherm addition with the given matrices";
5411 error_ = "Failed addition operation";
5412
5413 try {
5414 initResults();
5415 dres_ = declherm( lhs + rhs );
5416 odres_ = declherm( lhs + rhs );
5417 sres_ = declherm( lhs + rhs );
5418 osres_ = declherm( lhs + rhs );
5419 refres_ = declherm( reflhs + refrhs );
5420 }
5421 catch( std::exception& ex ) {
5422 convertException<MT1,MT2>( ex );
5423 }
5424
5425 checkResults<MT1,MT2>();
5426
5427 try {
5428 initResults();
5429 dres_ = declherm( lhs + orhs );
5430 odres_ = declherm( lhs + orhs );
5431 sres_ = declherm( lhs + orhs );
5432 osres_ = declherm( lhs + orhs );
5433 refres_ = declherm( reflhs + refrhs );
5434 }
5435 catch( std::exception& ex ) {
5436 convertException<MT1,OMT2>( ex );
5437 }
5438
5439 checkResults<MT1,OMT2>();
5440
5441 try {
5442 initResults();
5443 dres_ = declherm( olhs + rhs );
5444 odres_ = declherm( olhs + rhs );
5445 sres_ = declherm( olhs + rhs );
5446 osres_ = declherm( olhs + rhs );
5447 refres_ = declherm( reflhs + refrhs );
5448 }
5449 catch( std::exception& ex ) {
5450 convertException<OMT1,MT2>( ex );
5451 }
5452
5453 checkResults<OMT1,MT2>();
5454
5455 try {
5456 initResults();
5457 dres_ = declherm( olhs + orhs );
5458 odres_ = declherm( olhs + orhs );
5459 sres_ = declherm( olhs + orhs );
5460 osres_ = declherm( olhs + orhs );
5461 refres_ = declherm( reflhs + refrhs );
5462 }
5463 catch( std::exception& ex ) {
5464 convertException<OMT1,OMT2>( ex );
5465 }
5466
5467 checkResults<OMT1,OMT2>();
5468 }
5469
5470 // Declherm addition with evaluated matrices
5471 {
5472 test_ = "Declherm addition with evaluated left-hand side matrix";
5473 error_ = "Failed addition operation";
5474
5475 try {
5476 initResults();
5477 dres_ = declherm( eval( lhs ) + eval( rhs ) );
5478 odres_ = declherm( eval( lhs ) + eval( rhs ) );
5479 sres_ = declherm( eval( lhs ) + eval( rhs ) );
5480 osres_ = declherm( eval( lhs ) + eval( rhs ) );
5481 refres_ = declherm( eval( reflhs ) + eval( refrhs ) );
5482 }
5483 catch( std::exception& ex ) {
5484 convertException<MT1,MT2>( ex );
5485 }
5486
5487 checkResults<MT1,MT2>();
5488
5489 try {
5490 initResults();
5491 dres_ = declherm( eval( lhs ) + eval( orhs ) );
5492 odres_ = declherm( eval( lhs ) + eval( orhs ) );
5493 sres_ = declherm( eval( lhs ) + eval( orhs ) );
5494 osres_ = declherm( eval( lhs ) + eval( orhs ) );
5495 refres_ = declherm( eval( reflhs ) + eval( refrhs ) );
5496 }
5497 catch( std::exception& ex ) {
5498 convertException<MT1,OMT2>( ex );
5499 }
5500
5501 checkResults<MT1,OMT2>();
5502
5503 try {
5504 initResults();
5505 dres_ = declherm( eval( olhs ) + eval( rhs ) );
5506 odres_ = declherm( eval( olhs ) + eval( rhs ) );
5507 sres_ = declherm( eval( olhs ) + eval( rhs ) );
5508 osres_ = declherm( eval( olhs ) + eval( rhs ) );
5509 refres_ = declherm( eval( reflhs ) + eval( refrhs ) );
5510 }
5511 catch( std::exception& ex ) {
5512 convertException<OMT1,MT2>( ex );
5513 }
5514
5515 checkResults<OMT1,MT2>();
5516
5517 try {
5518 initResults();
5519 dres_ = declherm( eval( olhs ) + eval( orhs ) );
5520 odres_ = declherm( eval( olhs ) + eval( orhs ) );
5521 sres_ = declherm( eval( olhs ) + eval( orhs ) );
5522 osres_ = declherm( eval( olhs ) + eval( orhs ) );
5523 refres_ = declherm( eval( reflhs ) + eval( refrhs ) );
5524 }
5525 catch( std::exception& ex ) {
5526 convertException<OMT1,OMT2>( ex );
5527 }
5528
5529 checkResults<OMT1,OMT2>();
5530 }
5531
5532
5533 //=====================================================================================
5534 // Declherm addition with addition assignment
5535 //=====================================================================================
5536
5537 // Declherm addition with addition assignment with the given matrices
5538 {
5539 test_ = "Declherm addition with addition assignment with the given matrices";
5540 error_ = "Failed addition assignment operation";
5541
5542 try {
5543 initResults();
5544 dres_ += declherm( lhs + rhs );
5545 odres_ += declherm( lhs + rhs );
5546 sres_ += declherm( lhs + rhs );
5547 osres_ += declherm( lhs + rhs );
5548 refres_ += declherm( reflhs + refrhs );
5549 }
5550 catch( std::exception& ex ) {
5551 convertException<MT1,MT2>( ex );
5552 }
5553
5554 checkResults<MT1,MT2>();
5555
5556 try {
5557 initResults();
5558 dres_ += declherm( lhs + orhs );
5559 odres_ += declherm( lhs + orhs );
5560 sres_ += declherm( lhs + orhs );
5561 osres_ += declherm( lhs + orhs );
5562 refres_ += declherm( reflhs + refrhs );
5563 }
5564 catch( std::exception& ex ) {
5565 convertException<MT1,OMT2>( ex );
5566 }
5567
5568 checkResults<MT1,OMT2>();
5569
5570 try {
5571 initResults();
5572 dres_ += declherm( olhs + rhs );
5573 odres_ += declherm( olhs + rhs );
5574 sres_ += declherm( olhs + rhs );
5575 osres_ += declherm( olhs + rhs );
5576 refres_ += declherm( reflhs + refrhs );
5577 }
5578 catch( std::exception& ex ) {
5579 convertException<OMT1,MT2>( ex );
5580 }
5581
5582 checkResults<OMT1,MT2>();
5583
5584 try {
5585 initResults();
5586 dres_ += declherm( olhs + orhs );
5587 odres_ += declherm( olhs + orhs );
5588 sres_ += declherm( olhs + orhs );
5589 osres_ += declherm( olhs + orhs );
5590 refres_ += declherm( reflhs + refrhs );
5591 }
5592 catch( std::exception& ex ) {
5593 convertException<OMT1,OMT2>( ex );
5594 }
5595
5596 checkResults<OMT1,OMT2>();
5597 }
5598
5599 // Declherm addition with addition assignment with evaluated matrices
5600 {
5601 test_ = "Declherm addition with addition assignment with evaluated matrices";
5602 error_ = "Failed addition assignment operation";
5603
5604 try {
5605 initResults();
5606 dres_ += declherm( eval( lhs ) + eval( rhs ) );
5607 odres_ += declherm( eval( lhs ) + eval( rhs ) );
5608 sres_ += declherm( eval( lhs ) + eval( rhs ) );
5609 osres_ += declherm( eval( lhs ) + eval( rhs ) );
5610 refres_ += declherm( eval( reflhs ) + eval( refrhs ) );
5611 }
5612 catch( std::exception& ex ) {
5613 convertException<MT1,MT2>( ex );
5614 }
5615
5616 checkResults<MT1,MT2>();
5617
5618 try {
5619 initResults();
5620 dres_ += declherm( eval( lhs ) + eval( orhs ) );
5621 odres_ += declherm( eval( lhs ) + eval( orhs ) );
5622 sres_ += declherm( eval( lhs ) + eval( orhs ) );
5623 osres_ += declherm( eval( lhs ) + eval( orhs ) );
5624 refres_ += declherm( eval( reflhs ) + eval( refrhs ) );
5625 }
5626 catch( std::exception& ex ) {
5627 convertException<MT1,OMT2>( ex );
5628 }
5629
5630 checkResults<MT1,OMT2>();
5631
5632 try {
5633 initResults();
5634 dres_ += declherm( eval( olhs ) + eval( rhs ) );
5635 odres_ += declherm( eval( olhs ) + eval( rhs ) );
5636 sres_ += declherm( eval( olhs ) + eval( rhs ) );
5637 osres_ += declherm( eval( olhs ) + eval( rhs ) );
5638 refres_ += declherm( eval( reflhs ) + eval( refrhs ) );
5639 }
5640 catch( std::exception& ex ) {
5641 convertException<OMT1,MT2>( ex );
5642 }
5643
5644 checkResults<OMT1,MT2>();
5645
5646 try {
5647 initResults();
5648 dres_ += declherm( eval( olhs ) + eval( orhs ) );
5649 odres_ += declherm( eval( olhs ) + eval( orhs ) );
5650 sres_ += declherm( eval( olhs ) + eval( orhs ) );
5651 osres_ += declherm( eval( olhs ) + eval( orhs ) );
5652 refres_ += declherm( eval( reflhs ) + eval( refrhs ) );
5653 }
5654 catch( std::exception& ex ) {
5655 convertException<OMT1,OMT2>( ex );
5656 }
5657
5658 checkResults<OMT1,OMT2>();
5659 }
5660
5661
5662 //=====================================================================================
5663 // Declherm addition with subtraction assignment
5664 //=====================================================================================
5665
5666 // Declherm addition with subtraction assignment with the given matrices
5667 {
5668 test_ = "Declherm addition with subtraction assignment with the given matrices";
5669 error_ = "Failed subtraction assignment operation";
5670
5671 try {
5672 initResults();
5673 dres_ -= declherm( lhs + rhs );
5674 odres_ -= declherm( lhs + rhs );
5675 sres_ -= declherm( lhs + rhs );
5676 osres_ -= declherm( lhs + rhs );
5677 refres_ -= declherm( reflhs + refrhs );
5678 }
5679 catch( std::exception& ex ) {
5680 convertException<MT1,MT2>( ex );
5681 }
5682
5683 checkResults<MT1,MT2>();
5684
5685 try {
5686 initResults();
5687 dres_ -= declherm( lhs + orhs );
5688 odres_ -= declherm( lhs + orhs );
5689 sres_ -= declherm( lhs + orhs );
5690 osres_ -= declherm( lhs + orhs );
5691 refres_ -= declherm( reflhs + refrhs );
5692 }
5693 catch( std::exception& ex ) {
5694 convertException<MT1,OMT2>( ex );
5695 }
5696
5697 checkResults<MT1,OMT2>();
5698
5699 try {
5700 initResults();
5701 dres_ -= declherm( olhs + rhs );
5702 odres_ -= declherm( olhs + rhs );
5703 sres_ -= declherm( olhs + rhs );
5704 osres_ -= declherm( olhs + rhs );
5705 refres_ -= declherm( reflhs + refrhs );
5706 }
5707 catch( std::exception& ex ) {
5708 convertException<OMT1,MT2>( ex );
5709 }
5710
5711 checkResults<OMT1,MT2>();
5712
5713 try {
5714 initResults();
5715 dres_ -= declherm( olhs + orhs );
5716 odres_ -= declherm( olhs + orhs );
5717 sres_ -= declherm( olhs + orhs );
5718 osres_ -= declherm( olhs + orhs );
5719 refres_ -= declherm( reflhs + refrhs );
5720 }
5721 catch( std::exception& ex ) {
5722 convertException<OMT1,OMT2>( ex );
5723 }
5724
5725 checkResults<OMT1,OMT2>();
5726 }
5727
5728 // Declherm addition with subtraction assignment with evaluated matrices
5729 {
5730 test_ = "Declherm addition with subtraction assignment with evaluated matrices";
5731 error_ = "Failed subtraction assignment operation";
5732
5733 try {
5734 initResults();
5735 dres_ -= declherm( eval( lhs ) + eval( rhs ) );
5736 odres_ -= declherm( eval( lhs ) + eval( rhs ) );
5737 sres_ -= declherm( eval( lhs ) + eval( rhs ) );
5738 osres_ -= declherm( eval( lhs ) + eval( rhs ) );
5739 refres_ -= declherm( eval( reflhs ) + eval( refrhs ) );
5740 }
5741 catch( std::exception& ex ) {
5742 convertException<MT1,MT2>( ex );
5743 }
5744
5745 checkResults<MT1,MT2>();
5746
5747 try {
5748 initResults();
5749 dres_ -= declherm( eval( lhs ) + eval( orhs ) );
5750 odres_ -= declherm( eval( lhs ) + eval( orhs ) );
5751 sres_ -= declherm( eval( lhs ) + eval( orhs ) );
5752 osres_ -= declherm( eval( lhs ) + eval( orhs ) );
5753 refres_ -= declherm( eval( reflhs ) + eval( refrhs ) );
5754 }
5755 catch( std::exception& ex ) {
5756 convertException<MT1,OMT2>( ex );
5757 }
5758
5759 checkResults<MT1,OMT2>();
5760
5761 try {
5762 initResults();
5763 dres_ -= declherm( eval( olhs ) + eval( rhs ) );
5764 odres_ -= declherm( eval( olhs ) + eval( rhs ) );
5765 sres_ -= declherm( eval( olhs ) + eval( rhs ) );
5766 osres_ -= declherm( eval( olhs ) + eval( rhs ) );
5767 refres_ -= declherm( eval( reflhs ) + eval( refrhs ) );
5768 }
5769 catch( std::exception& ex ) {
5770 convertException<OMT1,MT2>( ex );
5771 }
5772
5773 checkResults<OMT1,MT2>();
5774
5775 try {
5776 initResults();
5777 dres_ -= declherm( eval( olhs ) + eval( orhs ) );
5778 odres_ -= declherm( eval( olhs ) + eval( orhs ) );
5779 sres_ -= declherm( eval( olhs ) + eval( orhs ) );
5780 osres_ -= declherm( eval( olhs ) + eval( orhs ) );
5781 refres_ -= declherm( eval( reflhs ) + eval( refrhs ) );
5782 }
5783 catch( std::exception& ex ) {
5784 convertException<OMT1,OMT2>( ex );
5785 }
5786
5787 checkResults<OMT1,OMT2>();
5788 }
5789
5790
5791 //=====================================================================================
5792 // Declherm addition with Schur product assignment
5793 //=====================================================================================
5794
5795 // Declherm addition with Schur product assignment with the given matrices
5796 {
5797 test_ = "Declherm addition with Schur product assignment with the given matrices";
5798 error_ = "Failed Schur product assignment operation";
5799
5800 try {
5801 initResults();
5802 dres_ %= declherm( lhs + rhs );
5803 odres_ %= declherm( lhs + rhs );
5804 sres_ %= declherm( lhs + rhs );
5805 osres_ %= declherm( lhs + rhs );
5806 refres_ %= declherm( reflhs + refrhs );
5807 }
5808 catch( std::exception& ex ) {
5809 convertException<MT1,MT2>( ex );
5810 }
5811
5812 checkResults<MT1,MT2>();
5813
5814 try {
5815 initResults();
5816 dres_ %= declherm( lhs + orhs );
5817 odres_ %= declherm( lhs + orhs );
5818 sres_ %= declherm( lhs + orhs );
5819 osres_ %= declherm( lhs + orhs );
5820 refres_ %= declherm( reflhs + refrhs );
5821 }
5822 catch( std::exception& ex ) {
5823 convertException<MT1,OMT2>( ex );
5824 }
5825
5826 checkResults<MT1,OMT2>();
5827
5828 try {
5829 initResults();
5830 dres_ %= declherm( olhs + rhs );
5831 odres_ %= declherm( olhs + rhs );
5832 sres_ %= declherm( olhs + rhs );
5833 osres_ %= declherm( olhs + rhs );
5834 refres_ %= declherm( reflhs + refrhs );
5835 }
5836 catch( std::exception& ex ) {
5837 convertException<OMT1,MT2>( ex );
5838 }
5839
5840 checkResults<OMT1,MT2>();
5841
5842 try {
5843 initResults();
5844 dres_ %= declherm( olhs + orhs );
5845 odres_ %= declherm( olhs + orhs );
5846 sres_ %= declherm( olhs + orhs );
5847 osres_ %= declherm( olhs + orhs );
5848 refres_ %= declherm( reflhs + refrhs );
5849 }
5850 catch( std::exception& ex ) {
5851 convertException<OMT1,OMT2>( ex );
5852 }
5853
5854 checkResults<OMT1,OMT2>();
5855 }
5856
5857 // Declherm addition with Schur product assignment with evaluated matrices
5858 {
5859 test_ = "Declherm addition with Schur product assignment with evaluated matrices";
5860 error_ = "Failed Schur product assignment operation";
5861
5862 try {
5863 initResults();
5864 dres_ %= declherm( eval( lhs ) + eval( rhs ) );
5865 odres_ %= declherm( eval( lhs ) + eval( rhs ) );
5866 sres_ %= declherm( eval( lhs ) + eval( rhs ) );
5867 osres_ %= declherm( eval( lhs ) + eval( rhs ) );
5868 refres_ %= declherm( eval( reflhs ) + eval( refrhs ) );
5869 }
5870 catch( std::exception& ex ) {
5871 convertException<MT1,MT2>( ex );
5872 }
5873
5874 checkResults<MT1,MT2>();
5875
5876 try {
5877 initResults();
5878 dres_ %= declherm( eval( lhs ) + eval( orhs ) );
5879 odres_ %= declherm( eval( lhs ) + eval( orhs ) );
5880 sres_ %= declherm( eval( lhs ) + eval( orhs ) );
5881 osres_ %= declherm( eval( lhs ) + eval( orhs ) );
5882 refres_ %= declherm( eval( reflhs ) + eval( refrhs ) );
5883 }
5884 catch( std::exception& ex ) {
5885 convertException<MT1,OMT2>( ex );
5886 }
5887
5888 checkResults<MT1,OMT2>();
5889
5890 try {
5891 initResults();
5892 dres_ %= declherm( eval( olhs ) + eval( rhs ) );
5893 odres_ %= declherm( eval( olhs ) + eval( rhs ) );
5894 sres_ %= declherm( eval( olhs ) + eval( rhs ) );
5895 osres_ %= declherm( eval( olhs ) + eval( rhs ) );
5896 refres_ %= declherm( eval( reflhs ) + eval( refrhs ) );
5897 }
5898 catch( std::exception& ex ) {
5899 convertException<OMT1,MT2>( ex );
5900 }
5901
5902 checkResults<OMT1,MT2>();
5903
5904 try {
5905 initResults();
5906 dres_ %= declherm( eval( olhs ) + eval( orhs ) );
5907 odres_ %= declherm( eval( olhs ) + eval( orhs ) );
5908 sres_ %= declherm( eval( olhs ) + eval( orhs ) );
5909 osres_ %= declherm( eval( olhs ) + eval( orhs ) );
5910 refres_ %= declherm( eval( reflhs ) + eval( refrhs ) );
5911 }
5912 catch( std::exception& ex ) {
5913 convertException<OMT1,OMT2>( ex );
5914 }
5915
5916 checkResults<OMT1,OMT2>();
5917 }
5918 }
5919 #endif
5920 }
5921 //*************************************************************************************************
5922
5923
5924 //*************************************************************************************************
5925 /*!\brief Skipping the Hermitian dense matrix/sparse matrix addition.
5926 //
5927 // \return void
5928 //
5929 // This function is called in case the Hermitian matrix/matrix addition operation is not
5930 // available for the given matrix types \a MT1 and \a MT2.
5931 */
5932 template< typename MT1 // Type of the left-hand side dense matrix
5933 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclHermOperation(blaze::FalseType)5934 void OperationTest<MT1,MT2>::testDeclHermOperation( blaze::FalseType )
5935 {}
5936 //*************************************************************************************************
5937
5938
5939 //*************************************************************************************************
5940 /*!\brief Testing the lower dense matrix/sparse matrix addition.
5941 //
5942 // \return void
5943 // \exception std::runtime_error Addition error detected.
5944 //
5945 // This function tests the lower matrix addition with plain assignment, addition assignment,
5946 // subtraction assignment, and Schur product assignment. In case any error resulting from the
5947 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
5948 // thrown.
5949 */
5950 template< typename MT1 // Type of the left-hand side dense matrix
5951 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclLowOperation(blaze::TrueType)5952 void OperationTest<MT1,MT2>::testDeclLowOperation( blaze::TrueType )
5953 {
5954 #if BLAZETEST_MATHTEST_TEST_DECLLOW_OPERATION
5955 if( BLAZETEST_MATHTEST_TEST_DECLLOW_OPERATION > 1 )
5956 {
5957 if( lhs_.rows() != lhs_.columns() )
5958 return;
5959
5960
5961 //=====================================================================================
5962 // Test-specific setup of the left-hand side operand
5963 //=====================================================================================
5964
5965 MT1 lhs( lhs_ );
5966
5967 blaze::resetUpper( lhs );
5968
5969 OMT1 olhs ( lhs );
5970 RT1 reflhs( lhs );
5971
5972
5973 //=====================================================================================
5974 // Test-specific setup of the right-hand side operand
5975 //=====================================================================================
5976
5977 MT2 rhs( rhs_ );
5978
5979 blaze::resetUpper( rhs );
5980
5981 OMT2 orhs ( rhs );
5982 RT2 refrhs( rhs );
5983
5984
5985 //=====================================================================================
5986 // Decllow addition
5987 //=====================================================================================
5988
5989 // Decllow addition with the given matrices
5990 {
5991 test_ = "Decllow addition with the given matrices";
5992 error_ = "Failed addition operation";
5993
5994 try {
5995 initResults();
5996 dres_ = decllow( lhs + rhs );
5997 odres_ = decllow( lhs + rhs );
5998 sres_ = decllow( lhs + rhs );
5999 osres_ = decllow( lhs + rhs );
6000 refres_ = decllow( reflhs + refrhs );
6001 }
6002 catch( std::exception& ex ) {
6003 convertException<MT1,MT2>( ex );
6004 }
6005
6006 checkResults<MT1,MT2>();
6007
6008 try {
6009 initResults();
6010 dres_ = decllow( lhs + orhs );
6011 odres_ = decllow( lhs + orhs );
6012 sres_ = decllow( lhs + orhs );
6013 osres_ = decllow( lhs + orhs );
6014 refres_ = decllow( reflhs + refrhs );
6015 }
6016 catch( std::exception& ex ) {
6017 convertException<MT1,OMT2>( ex );
6018 }
6019
6020 checkResults<MT1,OMT2>();
6021
6022 try {
6023 initResults();
6024 dres_ = decllow( olhs + rhs );
6025 odres_ = decllow( olhs + rhs );
6026 sres_ = decllow( olhs + rhs );
6027 osres_ = decllow( olhs + rhs );
6028 refres_ = decllow( reflhs + refrhs );
6029 }
6030 catch( std::exception& ex ) {
6031 convertException<OMT1,MT2>( ex );
6032 }
6033
6034 checkResults<OMT1,MT2>();
6035
6036 try {
6037 initResults();
6038 dres_ = decllow( olhs + orhs );
6039 odres_ = decllow( olhs + orhs );
6040 sres_ = decllow( olhs + orhs );
6041 osres_ = decllow( olhs + orhs );
6042 refres_ = decllow( reflhs + refrhs );
6043 }
6044 catch( std::exception& ex ) {
6045 convertException<OMT1,OMT2>( ex );
6046 }
6047
6048 checkResults<OMT1,OMT2>();
6049 }
6050
6051 // Decllow addition with evaluated matrices
6052 {
6053 test_ = "Decllow addition with evaluated left-hand side matrix";
6054 error_ = "Failed addition operation";
6055
6056 try {
6057 initResults();
6058 dres_ = decllow( eval( lhs ) + eval( rhs ) );
6059 odres_ = decllow( eval( lhs ) + eval( rhs ) );
6060 sres_ = decllow( eval( lhs ) + eval( rhs ) );
6061 osres_ = decllow( eval( lhs ) + eval( rhs ) );
6062 refres_ = decllow( eval( reflhs ) + eval( refrhs ) );
6063 }
6064 catch( std::exception& ex ) {
6065 convertException<MT1,MT2>( ex );
6066 }
6067
6068 checkResults<MT1,MT2>();
6069
6070 try {
6071 initResults();
6072 dres_ = decllow( eval( lhs ) + eval( orhs ) );
6073 odres_ = decllow( eval( lhs ) + eval( orhs ) );
6074 sres_ = decllow( eval( lhs ) + eval( orhs ) );
6075 osres_ = decllow( eval( lhs ) + eval( orhs ) );
6076 refres_ = decllow( eval( reflhs ) + eval( refrhs ) );
6077 }
6078 catch( std::exception& ex ) {
6079 convertException<MT1,OMT2>( ex );
6080 }
6081
6082 checkResults<MT1,OMT2>();
6083
6084 try {
6085 initResults();
6086 dres_ = decllow( eval( olhs ) + eval( rhs ) );
6087 odres_ = decllow( eval( olhs ) + eval( rhs ) );
6088 sres_ = decllow( eval( olhs ) + eval( rhs ) );
6089 osres_ = decllow( eval( olhs ) + eval( rhs ) );
6090 refres_ = decllow( eval( reflhs ) + eval( refrhs ) );
6091 }
6092 catch( std::exception& ex ) {
6093 convertException<OMT1,MT2>( ex );
6094 }
6095
6096 checkResults<OMT1,MT2>();
6097
6098 try {
6099 initResults();
6100 dres_ = decllow( eval( olhs ) + eval( orhs ) );
6101 odres_ = decllow( eval( olhs ) + eval( orhs ) );
6102 sres_ = decllow( eval( olhs ) + eval( orhs ) );
6103 osres_ = decllow( eval( olhs ) + eval( orhs ) );
6104 refres_ = decllow( eval( reflhs ) + eval( refrhs ) );
6105 }
6106 catch( std::exception& ex ) {
6107 convertException<OMT1,OMT2>( ex );
6108 }
6109
6110 checkResults<OMT1,OMT2>();
6111 }
6112
6113
6114 //=====================================================================================
6115 // Decllow addition with addition assignment
6116 //=====================================================================================
6117
6118 // Decllow addition with addition assignment with the given matrices
6119 {
6120 test_ = "Decllow addition with addition assignment with the given matrices";
6121 error_ = "Failed addition assignment operation";
6122
6123 try {
6124 initResults();
6125 dres_ += decllow( lhs + rhs );
6126 odres_ += decllow( lhs + rhs );
6127 sres_ += decllow( lhs + rhs );
6128 osres_ += decllow( lhs + rhs );
6129 refres_ += decllow( reflhs + refrhs );
6130 }
6131 catch( std::exception& ex ) {
6132 convertException<MT1,MT2>( ex );
6133 }
6134
6135 checkResults<MT1,MT2>();
6136
6137 try {
6138 initResults();
6139 dres_ += decllow( lhs + orhs );
6140 odres_ += decllow( lhs + orhs );
6141 sres_ += decllow( lhs + orhs );
6142 osres_ += decllow( lhs + orhs );
6143 refres_ += decllow( reflhs + refrhs );
6144 }
6145 catch( std::exception& ex ) {
6146 convertException<MT1,OMT2>( ex );
6147 }
6148
6149 checkResults<MT1,OMT2>();
6150
6151 try {
6152 initResults();
6153 dres_ += decllow( olhs + rhs );
6154 odres_ += decllow( olhs + rhs );
6155 sres_ += decllow( olhs + rhs );
6156 osres_ += decllow( olhs + rhs );
6157 refres_ += decllow( reflhs + refrhs );
6158 }
6159 catch( std::exception& ex ) {
6160 convertException<OMT1,MT2>( ex );
6161 }
6162
6163 checkResults<OMT1,MT2>();
6164
6165 try {
6166 initResults();
6167 dres_ += decllow( olhs + orhs );
6168 odres_ += decllow( olhs + orhs );
6169 sres_ += decllow( olhs + orhs );
6170 osres_ += decllow( olhs + orhs );
6171 refres_ += decllow( reflhs + refrhs );
6172 }
6173 catch( std::exception& ex ) {
6174 convertException<OMT1,OMT2>( ex );
6175 }
6176
6177 checkResults<OMT1,OMT2>();
6178 }
6179
6180 // Decllow addition with addition assignment with evaluated matrices
6181 {
6182 test_ = "Decllow addition with addition assignment with evaluated matrices";
6183 error_ = "Failed addition assignment operation";
6184
6185 try {
6186 initResults();
6187 dres_ += decllow( eval( lhs ) + eval( rhs ) );
6188 odres_ += decllow( eval( lhs ) + eval( rhs ) );
6189 sres_ += decllow( eval( lhs ) + eval( rhs ) );
6190 osres_ += decllow( eval( lhs ) + eval( rhs ) );
6191 refres_ += decllow( eval( reflhs ) + eval( refrhs ) );
6192 }
6193 catch( std::exception& ex ) {
6194 convertException<MT1,MT2>( ex );
6195 }
6196
6197 checkResults<MT1,MT2>();
6198
6199 try {
6200 initResults();
6201 dres_ += decllow( eval( lhs ) + eval( orhs ) );
6202 odres_ += decllow( eval( lhs ) + eval( orhs ) );
6203 sres_ += decllow( eval( lhs ) + eval( orhs ) );
6204 osres_ += decllow( eval( lhs ) + eval( orhs ) );
6205 refres_ += decllow( eval( reflhs ) + eval( refrhs ) );
6206 }
6207 catch( std::exception& ex ) {
6208 convertException<MT1,OMT2>( ex );
6209 }
6210
6211 checkResults<MT1,OMT2>();
6212
6213 try {
6214 initResults();
6215 dres_ += decllow( eval( olhs ) + eval( rhs ) );
6216 odres_ += decllow( eval( olhs ) + eval( rhs ) );
6217 sres_ += decllow( eval( olhs ) + eval( rhs ) );
6218 osres_ += decllow( eval( olhs ) + eval( rhs ) );
6219 refres_ += decllow( eval( reflhs ) + eval( refrhs ) );
6220 }
6221 catch( std::exception& ex ) {
6222 convertException<OMT1,MT2>( ex );
6223 }
6224
6225 checkResults<OMT1,MT2>();
6226
6227 try {
6228 initResults();
6229 dres_ += decllow( eval( olhs ) + eval( orhs ) );
6230 odres_ += decllow( eval( olhs ) + eval( orhs ) );
6231 sres_ += decllow( eval( olhs ) + eval( orhs ) );
6232 osres_ += decllow( eval( olhs ) + eval( orhs ) );
6233 refres_ += decllow( eval( reflhs ) + eval( refrhs ) );
6234 }
6235 catch( std::exception& ex ) {
6236 convertException<OMT1,OMT2>( ex );
6237 }
6238
6239 checkResults<OMT1,OMT2>();
6240 }
6241
6242
6243 //=====================================================================================
6244 // Decllow addition with subtraction assignment
6245 //=====================================================================================
6246
6247 // Decllow addition with subtraction assignment with the given matrices
6248 {
6249 test_ = "Decllow addition with subtraction assignment with the given matrices";
6250 error_ = "Failed subtraction assignment operation";
6251
6252 try {
6253 initResults();
6254 dres_ -= decllow( lhs + rhs );
6255 odres_ -= decllow( lhs + rhs );
6256 sres_ -= decllow( lhs + rhs );
6257 osres_ -= decllow( lhs + rhs );
6258 refres_ -= decllow( reflhs + refrhs );
6259 }
6260 catch( std::exception& ex ) {
6261 convertException<MT1,MT2>( ex );
6262 }
6263
6264 checkResults<MT1,MT2>();
6265
6266 try {
6267 initResults();
6268 dres_ -= decllow( lhs + orhs );
6269 odres_ -= decllow( lhs + orhs );
6270 sres_ -= decllow( lhs + orhs );
6271 osres_ -= decllow( lhs + orhs );
6272 refres_ -= decllow( reflhs + refrhs );
6273 }
6274 catch( std::exception& ex ) {
6275 convertException<MT1,OMT2>( ex );
6276 }
6277
6278 checkResults<MT1,OMT2>();
6279
6280 try {
6281 initResults();
6282 dres_ -= decllow( olhs + rhs );
6283 odres_ -= decllow( olhs + rhs );
6284 sres_ -= decllow( olhs + rhs );
6285 osres_ -= decllow( olhs + rhs );
6286 refres_ -= decllow( reflhs + refrhs );
6287 }
6288 catch( std::exception& ex ) {
6289 convertException<OMT1,MT2>( ex );
6290 }
6291
6292 checkResults<OMT1,MT2>();
6293
6294 try {
6295 initResults();
6296 dres_ -= decllow( olhs + orhs );
6297 odres_ -= decllow( olhs + orhs );
6298 sres_ -= decllow( olhs + orhs );
6299 osres_ -= decllow( olhs + orhs );
6300 refres_ -= decllow( reflhs + refrhs );
6301 }
6302 catch( std::exception& ex ) {
6303 convertException<OMT1,OMT2>( ex );
6304 }
6305
6306 checkResults<OMT1,OMT2>();
6307 }
6308
6309 // Decllow addition with subtraction assignment with evaluated matrices
6310 {
6311 test_ = "Decllow addition with subtraction assignment with evaluated matrices";
6312 error_ = "Failed subtraction assignment operation";
6313
6314 try {
6315 initResults();
6316 dres_ -= decllow( eval( lhs ) + eval( rhs ) );
6317 odres_ -= decllow( eval( lhs ) + eval( rhs ) );
6318 sres_ -= decllow( eval( lhs ) + eval( rhs ) );
6319 osres_ -= decllow( eval( lhs ) + eval( rhs ) );
6320 refres_ -= decllow( eval( reflhs ) + eval( refrhs ) );
6321 }
6322 catch( std::exception& ex ) {
6323 convertException<MT1,MT2>( ex );
6324 }
6325
6326 checkResults<MT1,MT2>();
6327
6328 try {
6329 initResults();
6330 dres_ -= decllow( eval( lhs ) + eval( orhs ) );
6331 odres_ -= decllow( eval( lhs ) + eval( orhs ) );
6332 sres_ -= decllow( eval( lhs ) + eval( orhs ) );
6333 osres_ -= decllow( eval( lhs ) + eval( orhs ) );
6334 refres_ -= decllow( eval( reflhs ) + eval( refrhs ) );
6335 }
6336 catch( std::exception& ex ) {
6337 convertException<MT1,OMT2>( ex );
6338 }
6339
6340 checkResults<MT1,OMT2>();
6341
6342 try {
6343 initResults();
6344 dres_ -= decllow( eval( olhs ) + eval( rhs ) );
6345 odres_ -= decllow( eval( olhs ) + eval( rhs ) );
6346 sres_ -= decllow( eval( olhs ) + eval( rhs ) );
6347 osres_ -= decllow( eval( olhs ) + eval( rhs ) );
6348 refres_ -= decllow( eval( reflhs ) + eval( refrhs ) );
6349 }
6350 catch( std::exception& ex ) {
6351 convertException<OMT1,MT2>( ex );
6352 }
6353
6354 checkResults<OMT1,MT2>();
6355
6356 try {
6357 initResults();
6358 dres_ -= decllow( eval( olhs ) + eval( orhs ) );
6359 odres_ -= decllow( eval( olhs ) + eval( orhs ) );
6360 sres_ -= decllow( eval( olhs ) + eval( orhs ) );
6361 osres_ -= decllow( eval( olhs ) + eval( orhs ) );
6362 refres_ -= decllow( eval( reflhs ) + eval( refrhs ) );
6363 }
6364 catch( std::exception& ex ) {
6365 convertException<OMT1,OMT2>( ex );
6366 }
6367
6368 checkResults<OMT1,OMT2>();
6369 }
6370
6371
6372 //=====================================================================================
6373 // Decllow addition with Schur product assignment
6374 //=====================================================================================
6375
6376 // Decllow addition with Schur product assignment with the given matrices
6377 {
6378 test_ = "Decllow addition with Schur product assignment with the given matrices";
6379 error_ = "Failed Schur product assignment operation";
6380
6381 try {
6382 initResults();
6383 dres_ %= decllow( lhs + rhs );
6384 odres_ %= decllow( lhs + rhs );
6385 sres_ %= decllow( lhs + rhs );
6386 osres_ %= decllow( lhs + rhs );
6387 refres_ %= decllow( reflhs + refrhs );
6388 }
6389 catch( std::exception& ex ) {
6390 convertException<MT1,MT2>( ex );
6391 }
6392
6393 checkResults<MT1,MT2>();
6394
6395 try {
6396 initResults();
6397 dres_ %= decllow( lhs + orhs );
6398 odres_ %= decllow( lhs + orhs );
6399 sres_ %= decllow( lhs + orhs );
6400 osres_ %= decllow( lhs + orhs );
6401 refres_ %= decllow( reflhs + refrhs );
6402 }
6403 catch( std::exception& ex ) {
6404 convertException<MT1,OMT2>( ex );
6405 }
6406
6407 checkResults<MT1,OMT2>();
6408
6409 try {
6410 initResults();
6411 dres_ %= decllow( olhs + rhs );
6412 odres_ %= decllow( olhs + rhs );
6413 sres_ %= decllow( olhs + rhs );
6414 osres_ %= decllow( olhs + rhs );
6415 refres_ %= decllow( reflhs + refrhs );
6416 }
6417 catch( std::exception& ex ) {
6418 convertException<OMT1,MT2>( ex );
6419 }
6420
6421 checkResults<OMT1,MT2>();
6422
6423 try {
6424 initResults();
6425 dres_ %= decllow( olhs + orhs );
6426 odres_ %= decllow( olhs + orhs );
6427 sres_ %= decllow( olhs + orhs );
6428 osres_ %= decllow( olhs + orhs );
6429 refres_ %= decllow( reflhs + refrhs );
6430 }
6431 catch( std::exception& ex ) {
6432 convertException<OMT1,OMT2>( ex );
6433 }
6434
6435 checkResults<OMT1,OMT2>();
6436 }
6437
6438 // Decllow addition with Schur product assignment with evaluated matrices
6439 {
6440 test_ = "Decllow addition with Schur product assignment with evaluated matrices";
6441 error_ = "Failed Schur product assignment operation";
6442
6443 try {
6444 initResults();
6445 dres_ %= decllow( eval( lhs ) + eval( rhs ) );
6446 odres_ %= decllow( eval( lhs ) + eval( rhs ) );
6447 sres_ %= decllow( eval( lhs ) + eval( rhs ) );
6448 osres_ %= decllow( eval( lhs ) + eval( rhs ) );
6449 refres_ %= decllow( eval( reflhs ) + eval( refrhs ) );
6450 }
6451 catch( std::exception& ex ) {
6452 convertException<MT1,MT2>( ex );
6453 }
6454
6455 checkResults<MT1,MT2>();
6456
6457 try {
6458 initResults();
6459 dres_ %= decllow( eval( lhs ) + eval( orhs ) );
6460 odres_ %= decllow( eval( lhs ) + eval( orhs ) );
6461 sres_ %= decllow( eval( lhs ) + eval( orhs ) );
6462 osres_ %= decllow( eval( lhs ) + eval( orhs ) );
6463 refres_ %= decllow( eval( reflhs ) + eval( refrhs ) );
6464 }
6465 catch( std::exception& ex ) {
6466 convertException<MT1,OMT2>( ex );
6467 }
6468
6469 checkResults<MT1,OMT2>();
6470
6471 try {
6472 initResults();
6473 dres_ %= decllow( eval( olhs ) + eval( rhs ) );
6474 odres_ %= decllow( eval( olhs ) + eval( rhs ) );
6475 sres_ %= decllow( eval( olhs ) + eval( rhs ) );
6476 osres_ %= decllow( eval( olhs ) + eval( rhs ) );
6477 refres_ %= decllow( eval( reflhs ) + eval( refrhs ) );
6478 }
6479 catch( std::exception& ex ) {
6480 convertException<OMT1,MT2>( ex );
6481 }
6482
6483 checkResults<OMT1,MT2>();
6484
6485 try {
6486 initResults();
6487 dres_ %= decllow( eval( olhs ) + eval( orhs ) );
6488 odres_ %= decllow( eval( olhs ) + eval( orhs ) );
6489 sres_ %= decllow( eval( olhs ) + eval( orhs ) );
6490 osres_ %= decllow( eval( olhs ) + eval( orhs ) );
6491 refres_ %= decllow( eval( reflhs ) + eval( refrhs ) );
6492 }
6493 catch( std::exception& ex ) {
6494 convertException<OMT1,OMT2>( ex );
6495 }
6496
6497 checkResults<OMT1,OMT2>();
6498 }
6499 }
6500 #endif
6501 }
6502 //*************************************************************************************************
6503
6504
6505 //*************************************************************************************************
6506 /*!\brief Skipping the lower dense matrix/sparse matrix addition.
6507 //
6508 // \return void
6509 //
6510 // This function is called in case the lower matrix/matrix addition operation is not
6511 // available for the given matrix types \a MT1 and \a MT2.
6512 */
6513 template< typename MT1 // Type of the left-hand side dense matrix
6514 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclLowOperation(blaze::FalseType)6515 void OperationTest<MT1,MT2>::testDeclLowOperation( blaze::FalseType )
6516 {}
6517 //*************************************************************************************************
6518
6519
6520 //*************************************************************************************************
6521 /*!\brief Testing the upper dense matrix/sparse matrix addition.
6522 //
6523 // \return void
6524 // \exception std::runtime_error Addition error detected.
6525 //
6526 // This function tests the upper matrix addition with plain assignment, addition assignment,
6527 // subtraction assignment, and Schur product assignment. In case any error resulting from the
6528 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
6529 // thrown.
6530 */
6531 template< typename MT1 // Type of the left-hand side dense matrix
6532 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclUppOperation(blaze::TrueType)6533 void OperationTest<MT1,MT2>::testDeclUppOperation( blaze::TrueType )
6534 {
6535 #if BLAZETEST_MATHTEST_TEST_DECLUPP_OPERATION
6536 if( BLAZETEST_MATHTEST_TEST_DECLUPP_OPERATION > 1 )
6537 {
6538 if( lhs_.rows() != lhs_.columns() )
6539 return;
6540
6541
6542 //=====================================================================================
6543 // Test-specific setup of the left-hand side operand
6544 //=====================================================================================
6545
6546 MT1 lhs( lhs_ );
6547
6548 blaze::resetLower( lhs );
6549
6550 OMT1 olhs ( lhs );
6551 RT1 reflhs( lhs );
6552
6553
6554 //=====================================================================================
6555 // Test-specific setup of the right-hand side operand
6556 //=====================================================================================
6557
6558 MT2 rhs( rhs_ );
6559
6560 blaze::resetLower( rhs );
6561
6562 OMT2 orhs ( rhs );
6563 RT2 refrhs( rhs );
6564
6565
6566 //=====================================================================================
6567 // Declupp addition
6568 //=====================================================================================
6569
6570 // Declupp addition with the given matrices
6571 {
6572 test_ = "Declupp addition with the given matrices";
6573 error_ = "Failed addition operation";
6574
6575 try {
6576 initResults();
6577 dres_ = declupp( lhs + rhs );
6578 odres_ = declupp( lhs + rhs );
6579 sres_ = declupp( lhs + rhs );
6580 osres_ = declupp( lhs + rhs );
6581 refres_ = declupp( reflhs + refrhs );
6582 }
6583 catch( std::exception& ex ) {
6584 convertException<MT1,MT2>( ex );
6585 }
6586
6587 checkResults<MT1,MT2>();
6588
6589 try {
6590 initResults();
6591 dres_ = declupp( lhs + orhs );
6592 odres_ = declupp( lhs + orhs );
6593 sres_ = declupp( lhs + orhs );
6594 osres_ = declupp( lhs + orhs );
6595 refres_ = declupp( reflhs + refrhs );
6596 }
6597 catch( std::exception& ex ) {
6598 convertException<MT1,OMT2>( ex );
6599 }
6600
6601 checkResults<MT1,OMT2>();
6602
6603 try {
6604 initResults();
6605 dres_ = declupp( olhs + rhs );
6606 odres_ = declupp( olhs + rhs );
6607 sres_ = declupp( olhs + rhs );
6608 osres_ = declupp( olhs + rhs );
6609 refres_ = declupp( reflhs + refrhs );
6610 }
6611 catch( std::exception& ex ) {
6612 convertException<OMT1,MT2>( ex );
6613 }
6614
6615 checkResults<OMT1,MT2>();
6616
6617 try {
6618 initResults();
6619 dres_ = declupp( olhs + orhs );
6620 odres_ = declupp( olhs + orhs );
6621 sres_ = declupp( olhs + orhs );
6622 osres_ = declupp( olhs + orhs );
6623 refres_ = declupp( reflhs + refrhs );
6624 }
6625 catch( std::exception& ex ) {
6626 convertException<OMT1,OMT2>( ex );
6627 }
6628
6629 checkResults<OMT1,OMT2>();
6630 }
6631
6632 // Declupp addition with evaluated matrices
6633 {
6634 test_ = "Declupp addition with evaluated left-hand side matrix";
6635 error_ = "Failed addition operation";
6636
6637 try {
6638 initResults();
6639 dres_ = declupp( eval( lhs ) + eval( rhs ) );
6640 odres_ = declupp( eval( lhs ) + eval( rhs ) );
6641 sres_ = declupp( eval( lhs ) + eval( rhs ) );
6642 osres_ = declupp( eval( lhs ) + eval( rhs ) );
6643 refres_ = declupp( eval( reflhs ) + eval( refrhs ) );
6644 }
6645 catch( std::exception& ex ) {
6646 convertException<MT1,MT2>( ex );
6647 }
6648
6649 checkResults<MT1,MT2>();
6650
6651 try {
6652 initResults();
6653 dres_ = declupp( eval( lhs ) + eval( orhs ) );
6654 odres_ = declupp( eval( lhs ) + eval( orhs ) );
6655 sres_ = declupp( eval( lhs ) + eval( orhs ) );
6656 osres_ = declupp( eval( lhs ) + eval( orhs ) );
6657 refres_ = declupp( eval( reflhs ) + eval( refrhs ) );
6658 }
6659 catch( std::exception& ex ) {
6660 convertException<MT1,OMT2>( ex );
6661 }
6662
6663 checkResults<MT1,OMT2>();
6664
6665 try {
6666 initResults();
6667 dres_ = declupp( eval( olhs ) + eval( rhs ) );
6668 odres_ = declupp( eval( olhs ) + eval( rhs ) );
6669 sres_ = declupp( eval( olhs ) + eval( rhs ) );
6670 osres_ = declupp( eval( olhs ) + eval( rhs ) );
6671 refres_ = declupp( eval( reflhs ) + eval( refrhs ) );
6672 }
6673 catch( std::exception& ex ) {
6674 convertException<OMT1,MT2>( ex );
6675 }
6676
6677 checkResults<OMT1,MT2>();
6678
6679 try {
6680 initResults();
6681 dres_ = declupp( eval( olhs ) + eval( orhs ) );
6682 odres_ = declupp( eval( olhs ) + eval( orhs ) );
6683 sres_ = declupp( eval( olhs ) + eval( orhs ) );
6684 osres_ = declupp( eval( olhs ) + eval( orhs ) );
6685 refres_ = declupp( eval( reflhs ) + eval( refrhs ) );
6686 }
6687 catch( std::exception& ex ) {
6688 convertException<OMT1,OMT2>( ex );
6689 }
6690
6691 checkResults<OMT1,OMT2>();
6692 }
6693
6694
6695 //=====================================================================================
6696 // Declupp addition with addition assignment
6697 //=====================================================================================
6698
6699 // Declupp addition with addition assignment with the given matrices
6700 {
6701 test_ = "Declupp addition with addition assignment with the given matrices";
6702 error_ = "Failed addition assignment operation";
6703
6704 try {
6705 initResults();
6706 dres_ += declupp( lhs + rhs );
6707 odres_ += declupp( lhs + rhs );
6708 sres_ += declupp( lhs + rhs );
6709 osres_ += declupp( lhs + rhs );
6710 refres_ += declupp( reflhs + refrhs );
6711 }
6712 catch( std::exception& ex ) {
6713 convertException<MT1,MT2>( ex );
6714 }
6715
6716 checkResults<MT1,MT2>();
6717
6718 try {
6719 initResults();
6720 dres_ += declupp( lhs + orhs );
6721 odres_ += declupp( lhs + orhs );
6722 sres_ += declupp( lhs + orhs );
6723 osres_ += declupp( lhs + orhs );
6724 refres_ += declupp( reflhs + refrhs );
6725 }
6726 catch( std::exception& ex ) {
6727 convertException<MT1,OMT2>( ex );
6728 }
6729
6730 checkResults<MT1,OMT2>();
6731
6732 try {
6733 initResults();
6734 dres_ += declupp( olhs + rhs );
6735 odres_ += declupp( olhs + rhs );
6736 sres_ += declupp( olhs + rhs );
6737 osres_ += declupp( olhs + rhs );
6738 refres_ += declupp( reflhs + refrhs );
6739 }
6740 catch( std::exception& ex ) {
6741 convertException<OMT1,MT2>( ex );
6742 }
6743
6744 checkResults<OMT1,MT2>();
6745
6746 try {
6747 initResults();
6748 dres_ += declupp( olhs + orhs );
6749 odres_ += declupp( olhs + orhs );
6750 sres_ += declupp( olhs + orhs );
6751 osres_ += declupp( olhs + orhs );
6752 refres_ += declupp( reflhs + refrhs );
6753 }
6754 catch( std::exception& ex ) {
6755 convertException<OMT1,OMT2>( ex );
6756 }
6757
6758 checkResults<OMT1,OMT2>();
6759 }
6760
6761 // Declupp addition with addition assignment with evaluated matrices
6762 {
6763 test_ = "Declupp addition with addition assignment with evaluated matrices";
6764 error_ = "Failed addition assignment operation";
6765
6766 try {
6767 initResults();
6768 dres_ += declupp( eval( lhs ) + eval( rhs ) );
6769 odres_ += declupp( eval( lhs ) + eval( rhs ) );
6770 sres_ += declupp( eval( lhs ) + eval( rhs ) );
6771 osres_ += declupp( eval( lhs ) + eval( rhs ) );
6772 refres_ += declupp( eval( reflhs ) + eval( refrhs ) );
6773 }
6774 catch( std::exception& ex ) {
6775 convertException<MT1,MT2>( ex );
6776 }
6777
6778 checkResults<MT1,MT2>();
6779
6780 try {
6781 initResults();
6782 dres_ += declupp( eval( lhs ) + eval( orhs ) );
6783 odres_ += declupp( eval( lhs ) + eval( orhs ) );
6784 sres_ += declupp( eval( lhs ) + eval( orhs ) );
6785 osres_ += declupp( eval( lhs ) + eval( orhs ) );
6786 refres_ += declupp( eval( reflhs ) + eval( refrhs ) );
6787 }
6788 catch( std::exception& ex ) {
6789 convertException<MT1,OMT2>( ex );
6790 }
6791
6792 checkResults<MT1,OMT2>();
6793
6794 try {
6795 initResults();
6796 dres_ += declupp( eval( olhs ) + eval( rhs ) );
6797 odres_ += declupp( eval( olhs ) + eval( rhs ) );
6798 sres_ += declupp( eval( olhs ) + eval( rhs ) );
6799 osres_ += declupp( eval( olhs ) + eval( rhs ) );
6800 refres_ += declupp( eval( reflhs ) + eval( refrhs ) );
6801 }
6802 catch( std::exception& ex ) {
6803 convertException<OMT1,MT2>( ex );
6804 }
6805
6806 checkResults<OMT1,MT2>();
6807
6808 try {
6809 initResults();
6810 dres_ += declupp( eval( olhs ) + eval( orhs ) );
6811 odres_ += declupp( eval( olhs ) + eval( orhs ) );
6812 sres_ += declupp( eval( olhs ) + eval( orhs ) );
6813 osres_ += declupp( eval( olhs ) + eval( orhs ) );
6814 refres_ += declupp( eval( reflhs ) + eval( refrhs ) );
6815 }
6816 catch( std::exception& ex ) {
6817 convertException<OMT1,OMT2>( ex );
6818 }
6819
6820 checkResults<OMT1,OMT2>();
6821 }
6822
6823
6824 //=====================================================================================
6825 // Declupp addition with subtraction assignment
6826 //=====================================================================================
6827
6828 // Declupp addition with subtraction assignment with the given matrices
6829 {
6830 test_ = "Declupp addition with subtraction assignment with the given matrices";
6831 error_ = "Failed subtraction assignment operation";
6832
6833 try {
6834 initResults();
6835 dres_ -= declupp( lhs + rhs );
6836 odres_ -= declupp( lhs + rhs );
6837 sres_ -= declupp( lhs + rhs );
6838 osres_ -= declupp( lhs + rhs );
6839 refres_ -= declupp( reflhs + refrhs );
6840 }
6841 catch( std::exception& ex ) {
6842 convertException<MT1,MT2>( ex );
6843 }
6844
6845 checkResults<MT1,MT2>();
6846
6847 try {
6848 initResults();
6849 dres_ -= declupp( lhs + orhs );
6850 odres_ -= declupp( lhs + orhs );
6851 sres_ -= declupp( lhs + orhs );
6852 osres_ -= declupp( lhs + orhs );
6853 refres_ -= declupp( reflhs + refrhs );
6854 }
6855 catch( std::exception& ex ) {
6856 convertException<MT1,OMT2>( ex );
6857 }
6858
6859 checkResults<MT1,OMT2>();
6860
6861 try {
6862 initResults();
6863 dres_ -= declupp( olhs + rhs );
6864 odres_ -= declupp( olhs + rhs );
6865 sres_ -= declupp( olhs + rhs );
6866 osres_ -= declupp( olhs + rhs );
6867 refres_ -= declupp( reflhs + refrhs );
6868 }
6869 catch( std::exception& ex ) {
6870 convertException<OMT1,MT2>( ex );
6871 }
6872
6873 checkResults<OMT1,MT2>();
6874
6875 try {
6876 initResults();
6877 dres_ -= declupp( olhs + orhs );
6878 odres_ -= declupp( olhs + orhs );
6879 sres_ -= declupp( olhs + orhs );
6880 osres_ -= declupp( olhs + orhs );
6881 refres_ -= declupp( reflhs + refrhs );
6882 }
6883 catch( std::exception& ex ) {
6884 convertException<OMT1,OMT2>( ex );
6885 }
6886
6887 checkResults<OMT1,OMT2>();
6888 }
6889
6890 // Declupp addition with subtraction assignment with evaluated matrices
6891 {
6892 test_ = "Declupp addition with subtraction assignment with evaluated matrices";
6893 error_ = "Failed subtraction assignment operation";
6894
6895 try {
6896 initResults();
6897 dres_ -= declupp( eval( lhs ) + eval( rhs ) );
6898 odres_ -= declupp( eval( lhs ) + eval( rhs ) );
6899 sres_ -= declupp( eval( lhs ) + eval( rhs ) );
6900 osres_ -= declupp( eval( lhs ) + eval( rhs ) );
6901 refres_ -= declupp( eval( reflhs ) + eval( refrhs ) );
6902 }
6903 catch( std::exception& ex ) {
6904 convertException<MT1,MT2>( ex );
6905 }
6906
6907 checkResults<MT1,MT2>();
6908
6909 try {
6910 initResults();
6911 dres_ -= declupp( eval( lhs ) + eval( orhs ) );
6912 odres_ -= declupp( eval( lhs ) + eval( orhs ) );
6913 sres_ -= declupp( eval( lhs ) + eval( orhs ) );
6914 osres_ -= declupp( eval( lhs ) + eval( orhs ) );
6915 refres_ -= declupp( eval( reflhs ) + eval( refrhs ) );
6916 }
6917 catch( std::exception& ex ) {
6918 convertException<MT1,OMT2>( ex );
6919 }
6920
6921 checkResults<MT1,OMT2>();
6922
6923 try {
6924 initResults();
6925 dres_ -= declupp( eval( olhs ) + eval( rhs ) );
6926 odres_ -= declupp( eval( olhs ) + eval( rhs ) );
6927 sres_ -= declupp( eval( olhs ) + eval( rhs ) );
6928 osres_ -= declupp( eval( olhs ) + eval( rhs ) );
6929 refres_ -= declupp( eval( reflhs ) + eval( refrhs ) );
6930 }
6931 catch( std::exception& ex ) {
6932 convertException<OMT1,MT2>( ex );
6933 }
6934
6935 checkResults<OMT1,MT2>();
6936
6937 try {
6938 initResults();
6939 dres_ -= declupp( eval( olhs ) + eval( orhs ) );
6940 odres_ -= declupp( eval( olhs ) + eval( orhs ) );
6941 sres_ -= declupp( eval( olhs ) + eval( orhs ) );
6942 osres_ -= declupp( eval( olhs ) + eval( orhs ) );
6943 refres_ -= declupp( eval( reflhs ) + eval( refrhs ) );
6944 }
6945 catch( std::exception& ex ) {
6946 convertException<OMT1,OMT2>( ex );
6947 }
6948
6949 checkResults<OMT1,OMT2>();
6950 }
6951
6952
6953 //=====================================================================================
6954 // Declupp addition with Schur product assignment
6955 //=====================================================================================
6956
6957 // Declupp addition with Schur product assignment with the given matrices
6958 {
6959 test_ = "Declupp addition with Schur product assignment with the given matrices";
6960 error_ = "Failed Schur product assignment operation";
6961
6962 try {
6963 initResults();
6964 dres_ %= declupp( lhs + rhs );
6965 odres_ %= declupp( lhs + rhs );
6966 sres_ %= declupp( lhs + rhs );
6967 osres_ %= declupp( lhs + rhs );
6968 refres_ %= declupp( reflhs + refrhs );
6969 }
6970 catch( std::exception& ex ) {
6971 convertException<MT1,MT2>( ex );
6972 }
6973
6974 checkResults<MT1,MT2>();
6975
6976 try {
6977 initResults();
6978 dres_ %= declupp( lhs + orhs );
6979 odres_ %= declupp( lhs + orhs );
6980 sres_ %= declupp( lhs + orhs );
6981 osres_ %= declupp( lhs + orhs );
6982 refres_ %= declupp( reflhs + refrhs );
6983 }
6984 catch( std::exception& ex ) {
6985 convertException<MT1,OMT2>( ex );
6986 }
6987
6988 checkResults<MT1,OMT2>();
6989
6990 try {
6991 initResults();
6992 dres_ %= declupp( olhs + rhs );
6993 odres_ %= declupp( olhs + rhs );
6994 sres_ %= declupp( olhs + rhs );
6995 osres_ %= declupp( olhs + rhs );
6996 refres_ %= declupp( reflhs + refrhs );
6997 }
6998 catch( std::exception& ex ) {
6999 convertException<OMT1,MT2>( ex );
7000 }
7001
7002 checkResults<OMT1,MT2>();
7003
7004 try {
7005 initResults();
7006 dres_ %= declupp( olhs + orhs );
7007 odres_ %= declupp( olhs + orhs );
7008 sres_ %= declupp( olhs + orhs );
7009 osres_ %= declupp( olhs + orhs );
7010 refres_ %= declupp( reflhs + refrhs );
7011 }
7012 catch( std::exception& ex ) {
7013 convertException<OMT1,OMT2>( ex );
7014 }
7015
7016 checkResults<OMT1,OMT2>();
7017 }
7018
7019 // Declupp addition with Schur product assignment with evaluated matrices
7020 {
7021 test_ = "Declupp addition with Schur product assignment with evaluated matrices";
7022 error_ = "Failed Schur product assignment operation";
7023
7024 try {
7025 initResults();
7026 dres_ %= declupp( eval( lhs ) + eval( rhs ) );
7027 odres_ %= declupp( eval( lhs ) + eval( rhs ) );
7028 sres_ %= declupp( eval( lhs ) + eval( rhs ) );
7029 osres_ %= declupp( eval( lhs ) + eval( rhs ) );
7030 refres_ %= declupp( eval( reflhs ) + eval( refrhs ) );
7031 }
7032 catch( std::exception& ex ) {
7033 convertException<MT1,MT2>( ex );
7034 }
7035
7036 checkResults<MT1,MT2>();
7037
7038 try {
7039 initResults();
7040 dres_ %= declupp( eval( lhs ) + eval( orhs ) );
7041 odres_ %= declupp( eval( lhs ) + eval( orhs ) );
7042 sres_ %= declupp( eval( lhs ) + eval( orhs ) );
7043 osres_ %= declupp( eval( lhs ) + eval( orhs ) );
7044 refres_ %= declupp( eval( reflhs ) + eval( refrhs ) );
7045 }
7046 catch( std::exception& ex ) {
7047 convertException<MT1,OMT2>( ex );
7048 }
7049
7050 checkResults<MT1,OMT2>();
7051
7052 try {
7053 initResults();
7054 dres_ %= declupp( eval( olhs ) + eval( rhs ) );
7055 odres_ %= declupp( eval( olhs ) + eval( rhs ) );
7056 sres_ %= declupp( eval( olhs ) + eval( rhs ) );
7057 osres_ %= declupp( eval( olhs ) + eval( rhs ) );
7058 refres_ %= declupp( eval( reflhs ) + eval( refrhs ) );
7059 }
7060 catch( std::exception& ex ) {
7061 convertException<OMT1,MT2>( ex );
7062 }
7063
7064 checkResults<OMT1,MT2>();
7065
7066 try {
7067 initResults();
7068 dres_ %= declupp( eval( olhs ) + eval( orhs ) );
7069 odres_ %= declupp( eval( olhs ) + eval( orhs ) );
7070 sres_ %= declupp( eval( olhs ) + eval( orhs ) );
7071 osres_ %= declupp( eval( olhs ) + eval( orhs ) );
7072 refres_ %= declupp( eval( reflhs ) + eval( refrhs ) );
7073 }
7074 catch( std::exception& ex ) {
7075 convertException<OMT1,OMT2>( ex );
7076 }
7077
7078 checkResults<OMT1,OMT2>();
7079 }
7080 }
7081 #endif
7082 }
7083 //*************************************************************************************************
7084
7085
7086 //*************************************************************************************************
7087 /*!\brief Skipping the upper dense matrix/sparse matrix addition.
7088 //
7089 // \return void
7090 //
7091 // This function is called in case the upper matrix/matrix addition operation is not
7092 // available for the given matrix types \a MT1 and \a MT2.
7093 */
7094 template< typename MT1 // Type of the left-hand side dense matrix
7095 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclUppOperation(blaze::FalseType)7096 void OperationTest<MT1,MT2>::testDeclUppOperation( blaze::FalseType )
7097 {}
7098 //*************************************************************************************************
7099
7100
7101 //*************************************************************************************************
7102 /*!\brief Testing the diagonal dense matrix/sparse matrix addition.
7103 //
7104 // \return void
7105 // \exception std::runtime_error Addition error detected.
7106 //
7107 // This function tests the diagonal matrix addition with plain assignment, addition assignment,
7108 // subtraction assignment, and Schur product assignment. In case any error resulting from the
7109 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is
7110 // thrown.
7111 */
7112 template< typename MT1 // Type of the left-hand side dense matrix
7113 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclDiagOperation(blaze::TrueType)7114 void OperationTest<MT1,MT2>::testDeclDiagOperation( blaze::TrueType )
7115 {
7116 #if BLAZETEST_MATHTEST_TEST_DECLDIAG_OPERATION
7117 if( BLAZETEST_MATHTEST_TEST_DECLDIAG_OPERATION > 1 )
7118 {
7119 if( lhs_.rows() != lhs_.columns() )
7120 return;
7121
7122
7123 //=====================================================================================
7124 // Test-specific setup of the left-hand side operand
7125 //=====================================================================================
7126
7127 MT1 lhs( lhs_ );
7128
7129 blaze::resetLower( lhs );
7130 blaze::resetUpper( lhs );
7131
7132 OMT1 olhs ( lhs );
7133 RT1 reflhs( lhs );
7134
7135
7136 //=====================================================================================
7137 // Test-specific setup of the right-hand side operand
7138 //=====================================================================================
7139
7140 MT2 rhs( rhs_ );
7141
7142 blaze::resetLower( rhs );
7143 blaze::resetUpper( rhs );
7144
7145 OMT2 orhs ( rhs );
7146 RT2 refrhs( rhs );
7147
7148
7149 //=====================================================================================
7150 // Decldiag addition
7151 //=====================================================================================
7152
7153 // Decldiag addition with the given matrices
7154 {
7155 test_ = "Decldiag addition with the given matrices";
7156 error_ = "Failed addition operation";
7157
7158 try {
7159 initResults();
7160 dres_ = decldiag( lhs + rhs );
7161 odres_ = decldiag( lhs + rhs );
7162 sres_ = decldiag( lhs + rhs );
7163 osres_ = decldiag( lhs + rhs );
7164 refres_ = decldiag( reflhs + refrhs );
7165 }
7166 catch( std::exception& ex ) {
7167 convertException<MT1,MT2>( ex );
7168 }
7169
7170 checkResults<MT1,MT2>();
7171
7172 try {
7173 initResults();
7174 dres_ = decldiag( lhs + orhs );
7175 odres_ = decldiag( lhs + orhs );
7176 sres_ = decldiag( lhs + orhs );
7177 osres_ = decldiag( lhs + orhs );
7178 refres_ = decldiag( reflhs + refrhs );
7179 }
7180 catch( std::exception& ex ) {
7181 convertException<MT1,OMT2>( ex );
7182 }
7183
7184 checkResults<MT1,OMT2>();
7185
7186 try {
7187 initResults();
7188 dres_ = decldiag( olhs + rhs );
7189 odres_ = decldiag( olhs + rhs );
7190 sres_ = decldiag( olhs + rhs );
7191 osres_ = decldiag( olhs + rhs );
7192 refres_ = decldiag( reflhs + refrhs );
7193 }
7194 catch( std::exception& ex ) {
7195 convertException<OMT1,MT2>( ex );
7196 }
7197
7198 checkResults<OMT1,MT2>();
7199
7200 try {
7201 initResults();
7202 dres_ = decldiag( olhs + orhs );
7203 odres_ = decldiag( olhs + orhs );
7204 sres_ = decldiag( olhs + orhs );
7205 osres_ = decldiag( olhs + orhs );
7206 refres_ = decldiag( reflhs + refrhs );
7207 }
7208 catch( std::exception& ex ) {
7209 convertException<OMT1,OMT2>( ex );
7210 }
7211
7212 checkResults<OMT1,OMT2>();
7213 }
7214
7215 // Decldiag addition with evaluated matrices
7216 {
7217 test_ = "Decldiag addition with evaluated left-hand side matrix";
7218 error_ = "Failed addition operation";
7219
7220 try {
7221 initResults();
7222 dres_ = decldiag( eval( lhs ) + eval( rhs ) );
7223 odres_ = decldiag( eval( lhs ) + eval( rhs ) );
7224 sres_ = decldiag( eval( lhs ) + eval( rhs ) );
7225 osres_ = decldiag( eval( lhs ) + eval( rhs ) );
7226 refres_ = decldiag( eval( reflhs ) + eval( refrhs ) );
7227 }
7228 catch( std::exception& ex ) {
7229 convertException<MT1,MT2>( ex );
7230 }
7231
7232 checkResults<MT1,MT2>();
7233
7234 try {
7235 initResults();
7236 dres_ = decldiag( eval( lhs ) + eval( orhs ) );
7237 odres_ = decldiag( eval( lhs ) + eval( orhs ) );
7238 sres_ = decldiag( eval( lhs ) + eval( orhs ) );
7239 osres_ = decldiag( eval( lhs ) + eval( orhs ) );
7240 refres_ = decldiag( eval( reflhs ) + eval( refrhs ) );
7241 }
7242 catch( std::exception& ex ) {
7243 convertException<MT1,OMT2>( ex );
7244 }
7245
7246 checkResults<MT1,OMT2>();
7247
7248 try {
7249 initResults();
7250 dres_ = decldiag( eval( olhs ) + eval( rhs ) );
7251 odres_ = decldiag( eval( olhs ) + eval( rhs ) );
7252 sres_ = decldiag( eval( olhs ) + eval( rhs ) );
7253 osres_ = decldiag( eval( olhs ) + eval( rhs ) );
7254 refres_ = decldiag( eval( reflhs ) + eval( refrhs ) );
7255 }
7256 catch( std::exception& ex ) {
7257 convertException<OMT1,MT2>( ex );
7258 }
7259
7260 checkResults<OMT1,MT2>();
7261
7262 try {
7263 initResults();
7264 dres_ = decldiag( eval( olhs ) + eval( orhs ) );
7265 odres_ = decldiag( eval( olhs ) + eval( orhs ) );
7266 sres_ = decldiag( eval( olhs ) + eval( orhs ) );
7267 osres_ = decldiag( eval( olhs ) + eval( orhs ) );
7268 refres_ = decldiag( eval( reflhs ) + eval( refrhs ) );
7269 }
7270 catch( std::exception& ex ) {
7271 convertException<OMT1,OMT2>( ex );
7272 }
7273
7274 checkResults<OMT1,OMT2>();
7275 }
7276
7277
7278 //=====================================================================================
7279 // Decldiag addition with addition assignment
7280 //=====================================================================================
7281
7282 // Decldiag addition with addition assignment with the given matrices
7283 {
7284 test_ = "Decldiag addition with addition assignment with the given matrices";
7285 error_ = "Failed addition assignment operation";
7286
7287 try {
7288 initResults();
7289 dres_ += decldiag( lhs + rhs );
7290 odres_ += decldiag( lhs + rhs );
7291 sres_ += decldiag( lhs + rhs );
7292 osres_ += decldiag( lhs + rhs );
7293 refres_ += decldiag( reflhs + refrhs );
7294 }
7295 catch( std::exception& ex ) {
7296 convertException<MT1,MT2>( ex );
7297 }
7298
7299 checkResults<MT1,MT2>();
7300
7301 try {
7302 initResults();
7303 dres_ += decldiag( lhs + orhs );
7304 odres_ += decldiag( lhs + orhs );
7305 sres_ += decldiag( lhs + orhs );
7306 osres_ += decldiag( lhs + orhs );
7307 refres_ += decldiag( reflhs + refrhs );
7308 }
7309 catch( std::exception& ex ) {
7310 convertException<MT1,OMT2>( ex );
7311 }
7312
7313 checkResults<MT1,OMT2>();
7314
7315 try {
7316 initResults();
7317 dres_ += decldiag( olhs + rhs );
7318 odres_ += decldiag( olhs + rhs );
7319 sres_ += decldiag( olhs + rhs );
7320 osres_ += decldiag( olhs + rhs );
7321 refres_ += decldiag( reflhs + refrhs );
7322 }
7323 catch( std::exception& ex ) {
7324 convertException<OMT1,MT2>( ex );
7325 }
7326
7327 checkResults<OMT1,MT2>();
7328
7329 try {
7330 initResults();
7331 dres_ += decldiag( olhs + orhs );
7332 odres_ += decldiag( olhs + orhs );
7333 sres_ += decldiag( olhs + orhs );
7334 osres_ += decldiag( olhs + orhs );
7335 refres_ += decldiag( reflhs + refrhs );
7336 }
7337 catch( std::exception& ex ) {
7338 convertException<OMT1,OMT2>( ex );
7339 }
7340
7341 checkResults<OMT1,OMT2>();
7342 }
7343
7344 // Decldiag addition with addition assignment with evaluated matrices
7345 {
7346 test_ = "Decldiag addition with addition assignment with evaluated matrices";
7347 error_ = "Failed addition assignment operation";
7348
7349 try {
7350 initResults();
7351 dres_ += decldiag( eval( lhs ) + eval( rhs ) );
7352 odres_ += decldiag( eval( lhs ) + eval( rhs ) );
7353 sres_ += decldiag( eval( lhs ) + eval( rhs ) );
7354 osres_ += decldiag( eval( lhs ) + eval( rhs ) );
7355 refres_ += decldiag( eval( reflhs ) + eval( refrhs ) );
7356 }
7357 catch( std::exception& ex ) {
7358 convertException<MT1,MT2>( ex );
7359 }
7360
7361 checkResults<MT1,MT2>();
7362
7363 try {
7364 initResults();
7365 dres_ += decldiag( eval( lhs ) + eval( orhs ) );
7366 odres_ += decldiag( eval( lhs ) + eval( orhs ) );
7367 sres_ += decldiag( eval( lhs ) + eval( orhs ) );
7368 osres_ += decldiag( eval( lhs ) + eval( orhs ) );
7369 refres_ += decldiag( eval( reflhs ) + eval( refrhs ) );
7370 }
7371 catch( std::exception& ex ) {
7372 convertException<MT1,OMT2>( ex );
7373 }
7374
7375 checkResults<MT1,OMT2>();
7376
7377 try {
7378 initResults();
7379 dres_ += decldiag( eval( olhs ) + eval( rhs ) );
7380 odres_ += decldiag( eval( olhs ) + eval( rhs ) );
7381 sres_ += decldiag( eval( olhs ) + eval( rhs ) );
7382 osres_ += decldiag( eval( olhs ) + eval( rhs ) );
7383 refres_ += decldiag( eval( reflhs ) + eval( refrhs ) );
7384 }
7385 catch( std::exception& ex ) {
7386 convertException<OMT1,MT2>( ex );
7387 }
7388
7389 checkResults<OMT1,MT2>();
7390
7391 try {
7392 initResults();
7393 dres_ += decldiag( eval( olhs ) + eval( orhs ) );
7394 odres_ += decldiag( eval( olhs ) + eval( orhs ) );
7395 sres_ += decldiag( eval( olhs ) + eval( orhs ) );
7396 osres_ += decldiag( eval( olhs ) + eval( orhs ) );
7397 refres_ += decldiag( eval( reflhs ) + eval( refrhs ) );
7398 }
7399 catch( std::exception& ex ) {
7400 convertException<OMT1,OMT2>( ex );
7401 }
7402
7403 checkResults<OMT1,OMT2>();
7404 }
7405
7406
7407 //=====================================================================================
7408 // Decldiag addition with subtraction assignment
7409 //=====================================================================================
7410
7411 // Decldiag addition with subtraction assignment with the given matrices
7412 {
7413 test_ = "Decldiag addition with subtraction assignment with the given matrices";
7414 error_ = "Failed subtraction assignment operation";
7415
7416 try {
7417 initResults();
7418 dres_ -= decldiag( lhs + rhs );
7419 odres_ -= decldiag( lhs + rhs );
7420 sres_ -= decldiag( lhs + rhs );
7421 osres_ -= decldiag( lhs + rhs );
7422 refres_ -= decldiag( reflhs + refrhs );
7423 }
7424 catch( std::exception& ex ) {
7425 convertException<MT1,MT2>( ex );
7426 }
7427
7428 checkResults<MT1,MT2>();
7429
7430 try {
7431 initResults();
7432 dres_ -= decldiag( lhs + orhs );
7433 odres_ -= decldiag( lhs + orhs );
7434 sres_ -= decldiag( lhs + orhs );
7435 osres_ -= decldiag( lhs + orhs );
7436 refres_ -= decldiag( reflhs + refrhs );
7437 }
7438 catch( std::exception& ex ) {
7439 convertException<MT1,OMT2>( ex );
7440 }
7441
7442 checkResults<MT1,OMT2>();
7443
7444 try {
7445 initResults();
7446 dres_ -= decldiag( olhs + rhs );
7447 odres_ -= decldiag( olhs + rhs );
7448 sres_ -= decldiag( olhs + rhs );
7449 osres_ -= decldiag( olhs + rhs );
7450 refres_ -= decldiag( reflhs + refrhs );
7451 }
7452 catch( std::exception& ex ) {
7453 convertException<OMT1,MT2>( ex );
7454 }
7455
7456 checkResults<OMT1,MT2>();
7457
7458 try {
7459 initResults();
7460 dres_ -= decldiag( olhs + orhs );
7461 odres_ -= decldiag( olhs + orhs );
7462 sres_ -= decldiag( olhs + orhs );
7463 osres_ -= decldiag( olhs + orhs );
7464 refres_ -= decldiag( reflhs + refrhs );
7465 }
7466 catch( std::exception& ex ) {
7467 convertException<OMT1,OMT2>( ex );
7468 }
7469
7470 checkResults<OMT1,OMT2>();
7471 }
7472
7473 // Decldiag addition with subtraction assignment with evaluated matrices
7474 {
7475 test_ = "Decldiag addition with subtraction assignment with evaluated matrices";
7476 error_ = "Failed subtraction assignment operation";
7477
7478 try {
7479 initResults();
7480 dres_ -= decldiag( eval( lhs ) + eval( rhs ) );
7481 odres_ -= decldiag( eval( lhs ) + eval( rhs ) );
7482 sres_ -= decldiag( eval( lhs ) + eval( rhs ) );
7483 osres_ -= decldiag( eval( lhs ) + eval( rhs ) );
7484 refres_ -= decldiag( eval( reflhs ) + eval( refrhs ) );
7485 }
7486 catch( std::exception& ex ) {
7487 convertException<MT1,MT2>( ex );
7488 }
7489
7490 checkResults<MT1,MT2>();
7491
7492 try {
7493 initResults();
7494 dres_ -= decldiag( eval( lhs ) + eval( orhs ) );
7495 odres_ -= decldiag( eval( lhs ) + eval( orhs ) );
7496 sres_ -= decldiag( eval( lhs ) + eval( orhs ) );
7497 osres_ -= decldiag( eval( lhs ) + eval( orhs ) );
7498 refres_ -= decldiag( eval( reflhs ) + eval( refrhs ) );
7499 }
7500 catch( std::exception& ex ) {
7501 convertException<MT1,OMT2>( ex );
7502 }
7503
7504 checkResults<MT1,OMT2>();
7505
7506 try {
7507 initResults();
7508 dres_ -= decldiag( eval( olhs ) + eval( rhs ) );
7509 odres_ -= decldiag( eval( olhs ) + eval( rhs ) );
7510 sres_ -= decldiag( eval( olhs ) + eval( rhs ) );
7511 osres_ -= decldiag( eval( olhs ) + eval( rhs ) );
7512 refres_ -= decldiag( eval( reflhs ) + eval( refrhs ) );
7513 }
7514 catch( std::exception& ex ) {
7515 convertException<OMT1,MT2>( ex );
7516 }
7517
7518 checkResults<OMT1,MT2>();
7519
7520 try {
7521 initResults();
7522 dres_ -= decldiag( eval( olhs ) + eval( orhs ) );
7523 odres_ -= decldiag( eval( olhs ) + eval( orhs ) );
7524 sres_ -= decldiag( eval( olhs ) + eval( orhs ) );
7525 osres_ -= decldiag( eval( olhs ) + eval( orhs ) );
7526 refres_ -= decldiag( eval( reflhs ) + eval( refrhs ) );
7527 }
7528 catch( std::exception& ex ) {
7529 convertException<OMT1,OMT2>( ex );
7530 }
7531
7532 checkResults<OMT1,OMT2>();
7533 }
7534
7535
7536 //=====================================================================================
7537 // Decldiag addition with Schur product assignment
7538 //=====================================================================================
7539
7540 // Decldiag addition with Schur product assignment with the given matrices
7541 {
7542 test_ = "Decldiag addition with Schur product assignment with the given matrices";
7543 error_ = "Failed Schur product assignment operation";
7544
7545 try {
7546 initResults();
7547 dres_ %= decldiag( lhs + rhs );
7548 odres_ %= decldiag( lhs + rhs );
7549 sres_ %= decldiag( lhs + rhs );
7550 osres_ %= decldiag( lhs + rhs );
7551 refres_ %= decldiag( reflhs + refrhs );
7552 }
7553 catch( std::exception& ex ) {
7554 convertException<MT1,MT2>( ex );
7555 }
7556
7557 checkResults<MT1,MT2>();
7558
7559 try {
7560 initResults();
7561 dres_ %= decldiag( lhs + orhs );
7562 odres_ %= decldiag( lhs + orhs );
7563 sres_ %= decldiag( lhs + orhs );
7564 osres_ %= decldiag( lhs + orhs );
7565 refres_ %= decldiag( reflhs + refrhs );
7566 }
7567 catch( std::exception& ex ) {
7568 convertException<MT1,OMT2>( ex );
7569 }
7570
7571 checkResults<MT1,OMT2>();
7572
7573 try {
7574 initResults();
7575 dres_ %= decldiag( olhs + rhs );
7576 odres_ %= decldiag( olhs + rhs );
7577 sres_ %= decldiag( olhs + rhs );
7578 osres_ %= decldiag( olhs + rhs );
7579 refres_ %= decldiag( reflhs + refrhs );
7580 }
7581 catch( std::exception& ex ) {
7582 convertException<OMT1,MT2>( ex );
7583 }
7584
7585 checkResults<OMT1,MT2>();
7586
7587 try {
7588 initResults();
7589 dres_ %= decldiag( olhs + orhs );
7590 odres_ %= decldiag( olhs + orhs );
7591 sres_ %= decldiag( olhs + orhs );
7592 osres_ %= decldiag( olhs + orhs );
7593 refres_ %= decldiag( reflhs + refrhs );
7594 }
7595 catch( std::exception& ex ) {
7596 convertException<OMT1,OMT2>( ex );
7597 }
7598
7599 checkResults<OMT1,OMT2>();
7600 }
7601
7602 // Decldiag addition with Schur product assignment with evaluated matrices
7603 {
7604 test_ = "Decldiag addition with Schur product assignment with evaluated matrices";
7605 error_ = "Failed Schur product assignment operation";
7606
7607 try {
7608 initResults();
7609 dres_ %= decldiag( eval( lhs ) + eval( rhs ) );
7610 odres_ %= decldiag( eval( lhs ) + eval( rhs ) );
7611 sres_ %= decldiag( eval( lhs ) + eval( rhs ) );
7612 osres_ %= decldiag( eval( lhs ) + eval( rhs ) );
7613 refres_ %= decldiag( eval( reflhs ) + eval( refrhs ) );
7614 }
7615 catch( std::exception& ex ) {
7616 convertException<MT1,MT2>( ex );
7617 }
7618
7619 checkResults<MT1,MT2>();
7620
7621 try {
7622 initResults();
7623 dres_ %= decldiag( eval( lhs ) + eval( orhs ) );
7624 odres_ %= decldiag( eval( lhs ) + eval( orhs ) );
7625 sres_ %= decldiag( eval( lhs ) + eval( orhs ) );
7626 osres_ %= decldiag( eval( lhs ) + eval( orhs ) );
7627 refres_ %= decldiag( eval( reflhs ) + eval( refrhs ) );
7628 }
7629 catch( std::exception& ex ) {
7630 convertException<MT1,OMT2>( ex );
7631 }
7632
7633 checkResults<MT1,OMT2>();
7634
7635 try {
7636 initResults();
7637 dres_ %= decldiag( eval( olhs ) + eval( rhs ) );
7638 odres_ %= decldiag( eval( olhs ) + eval( rhs ) );
7639 sres_ %= decldiag( eval( olhs ) + eval( rhs ) );
7640 osres_ %= decldiag( eval( olhs ) + eval( rhs ) );
7641 refres_ %= decldiag( eval( reflhs ) + eval( refrhs ) );
7642 }
7643 catch( std::exception& ex ) {
7644 convertException<OMT1,MT2>( ex );
7645 }
7646
7647 checkResults<OMT1,MT2>();
7648
7649 try {
7650 initResults();
7651 dres_ %= decldiag( eval( olhs ) + eval( orhs ) );
7652 odres_ %= decldiag( eval( olhs ) + eval( orhs ) );
7653 sres_ %= decldiag( eval( olhs ) + eval( orhs ) );
7654 osres_ %= decldiag( eval( olhs ) + eval( orhs ) );
7655 refres_ %= decldiag( eval( reflhs ) + eval( refrhs ) );
7656 }
7657 catch( std::exception& ex ) {
7658 convertException<OMT1,OMT2>( ex );
7659 }
7660
7661 checkResults<OMT1,OMT2>();
7662 }
7663 }
7664 #endif
7665 }
7666 //*************************************************************************************************
7667
7668
7669 //*************************************************************************************************
7670 /*!\brief Skipping the diagonal dense matrix/sparse matrix addition.
7671 //
7672 // \return void
7673 //
7674 // This function is called in case the diagonal matrix/matrix addition operation is not
7675 // available for the given matrix types \a MT1 and \a MT2.
7676 */
7677 template< typename MT1 // Type of the left-hand side dense matrix
7678 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclDiagOperation(blaze::FalseType)7679 void OperationTest<MT1,MT2>::testDeclDiagOperation( blaze::FalseType )
7680 {}
7681 //*************************************************************************************************
7682
7683
7684 //*************************************************************************************************
7685 /*!\brief Testing the submatrix-wise dense matrix/sparse matrix addition.
7686 //
7687 // \return void
7688 // \exception std::runtime_error Addition error detected.
7689 //
7690 // This function tests the submatrix-wise matrix addition with plain assignment, addition
7691 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
7692 // from the addition or the subsequent assignment is detected, a \a std::runtime_error exception
7693 // is thrown.
7694 */
7695 template< typename MT1 // Type of the left-hand side dense matrix
7696 , typename MT2 > // Type of the right-hand side sparse matrix
testSubmatrixOperation(blaze::TrueType)7697 void OperationTest<MT1,MT2>::testSubmatrixOperation( blaze::TrueType )
7698 {
7699 #if BLAZETEST_MATHTEST_TEST_SUBMATRIX_OPERATION
7700 if( BLAZETEST_MATHTEST_TEST_SUBMATRIX_OPERATION > 1 )
7701 {
7702 if( lhs_.rows() == 0UL || lhs_.columns() == 0UL )
7703 return;
7704
7705
7706 //=====================================================================================
7707 // Submatrix-wise addition
7708 //=====================================================================================
7709
7710 // Submatrix-wise addition with the given matrices
7711 {
7712 test_ = "Submatrix-wise addition with the given matrices";
7713 error_ = "Failed addition operation";
7714
7715 try {
7716 initResults();
7717 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7718 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7719 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7720 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7721 submatrix( dres_ , row, column, m, n ) = submatrix( lhs_ + rhs_ , row, column, m, n );
7722 submatrix( odres_ , row, column, m, n ) = submatrix( lhs_ + rhs_ , row, column, m, n );
7723 submatrix( sres_ , row, column, m, n ) = submatrix( lhs_ + rhs_ , row, column, m, n );
7724 submatrix( osres_ , row, column, m, n ) = submatrix( lhs_ + rhs_ , row, column, m, n );
7725 submatrix( refres_, row, column, m, n ) = submatrix( reflhs_ + refrhs_, row, column, m, n );
7726 }
7727 }
7728 }
7729 catch( std::exception& ex ) {
7730 convertException<MT1,MT2>( ex );
7731 }
7732
7733 checkResults<MT1,MT2>();
7734
7735 try {
7736 initResults();
7737 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7738 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7739 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7740 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7741 submatrix( dres_ , row, column, m, n ) = submatrix( lhs_ + orhs_ , row, column, m, n );
7742 submatrix( odres_ , row, column, m, n ) = submatrix( lhs_ + orhs_ , row, column, m, n );
7743 submatrix( sres_ , row, column, m, n ) = submatrix( lhs_ + orhs_ , row, column, m, n );
7744 submatrix( osres_ , row, column, m, n ) = submatrix( lhs_ + orhs_ , row, column, m, n );
7745 submatrix( refres_, row, column, m, n ) = submatrix( reflhs_ + refrhs_, row, column, m, n );
7746 }
7747 }
7748 }
7749 catch( std::exception& ex ) {
7750 convertException<MT1,OMT2>( ex );
7751 }
7752
7753 checkResults<MT1,OMT2>();
7754
7755 try {
7756 initResults();
7757 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7758 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7759 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7760 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7761 submatrix( dres_ , row, column, m, n ) = submatrix( olhs_ + rhs_ , row, column, m, n );
7762 submatrix( odres_ , row, column, m, n ) = submatrix( olhs_ + rhs_ , row, column, m, n );
7763 submatrix( sres_ , row, column, m, n ) = submatrix( olhs_ + rhs_ , row, column, m, n );
7764 submatrix( osres_ , row, column, m, n ) = submatrix( olhs_ + rhs_ , row, column, m, n );
7765 submatrix( refres_, row, column, m, n ) = submatrix( reflhs_ + refrhs_, row, column, m, n );
7766 }
7767 }
7768 }
7769 catch( std::exception& ex ) {
7770 convertException<OMT1,MT2>( ex );
7771 }
7772
7773 checkResults<OMT1,MT2>();
7774
7775 try {
7776 initResults();
7777 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7778 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7779 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7780 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7781 submatrix( dres_ , row, column, m, n ) = submatrix( olhs_ + orhs_ , row, column, m, n );
7782 submatrix( odres_ , row, column, m, n ) = submatrix( olhs_ + orhs_ , row, column, m, n );
7783 submatrix( sres_ , row, column, m, n ) = submatrix( olhs_ + orhs_ , row, column, m, n );
7784 submatrix( osres_ , row, column, m, n ) = submatrix( olhs_ + orhs_ , row, column, m, n );
7785 submatrix( refres_, row, column, m, n ) = submatrix( reflhs_ + refrhs_, row, column, m, n );
7786 }
7787 }
7788 }
7789 catch( std::exception& ex ) {
7790 convertException<OMT1,OMT2>( ex );
7791 }
7792
7793 checkResults<OMT1,OMT2>();
7794 }
7795
7796 // Submatrix-wise addition with evaluated matrices
7797 {
7798 test_ = "Submatrix-wise addition with evaluated matrices";
7799 error_ = "Failed addition operation";
7800
7801 try {
7802 initResults();
7803 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7804 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7805 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7806 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7807 submatrix( dres_ , row, column, m, n ) = submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
7808 submatrix( odres_ , row, column, m, n ) = submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
7809 submatrix( sres_ , row, column, m, n ) = submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
7810 submatrix( osres_ , row, column, m, n ) = submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
7811 submatrix( refres_, row, column, m, n ) = submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
7812 }
7813 }
7814 }
7815 catch( std::exception& ex ) {
7816 convertException<MT1,MT2>( ex );
7817 }
7818
7819 checkResults<MT1,MT2>();
7820
7821 try {
7822 initResults();
7823 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7824 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7825 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7826 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7827 submatrix( dres_ , row, column, m, n ) = submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
7828 submatrix( odres_ , row, column, m, n ) = submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
7829 submatrix( sres_ , row, column, m, n ) = submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
7830 submatrix( osres_ , row, column, m, n ) = submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
7831 submatrix( refres_, row, column, m, n ) = submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
7832 }
7833 }
7834 }
7835 catch( std::exception& ex ) {
7836 convertException<MT1,OMT2>( ex );
7837 }
7838
7839 checkResults<MT1,OMT2>();
7840
7841 try {
7842 initResults();
7843 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7844 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7845 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7846 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7847 submatrix( dres_ , row, column, m, n ) = submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
7848 submatrix( odres_ , row, column, m, n ) = submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
7849 submatrix( sres_ , row, column, m, n ) = submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
7850 submatrix( osres_ , row, column, m, n ) = submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
7851 submatrix( refres_, row, column, m, n ) = submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
7852 }
7853 }
7854 }
7855 catch( std::exception& ex ) {
7856 convertException<OMT1,MT2>( ex );
7857 }
7858
7859 checkResults<OMT1,MT2>();
7860
7861 try {
7862 initResults();
7863 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7864 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7865 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7866 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7867 submatrix( dres_ , row, column, m, n ) = submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
7868 submatrix( odres_ , row, column, m, n ) = submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
7869 submatrix( sres_ , row, column, m, n ) = submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
7870 submatrix( osres_ , row, column, m, n ) = submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
7871 submatrix( refres_, row, column, m, n ) = submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
7872 }
7873 }
7874 }
7875 catch( std::exception& ex ) {
7876 convertException<OMT1,OMT2>( ex );
7877 }
7878
7879 checkResults<OMT1,OMT2>();
7880 }
7881
7882
7883 //=====================================================================================
7884 // Submatrix-wise addition with addition assignment
7885 //=====================================================================================
7886
7887 // Submatrix-wise addition with addition assignment with the given matrices
7888 {
7889 test_ = "Submatrix-wise addition with addition assignment with the given matrices";
7890 error_ = "Failed addition assignment operation";
7891
7892 try {
7893 initResults();
7894 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7895 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7896 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7897 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7898 submatrix( dres_ , row, column, m, n ) += submatrix( lhs_ + rhs_ , row, column, m, n );
7899 submatrix( odres_ , row, column, m, n ) += submatrix( lhs_ + rhs_ , row, column, m, n );
7900 submatrix( sres_ , row, column, m, n ) += submatrix( lhs_ + rhs_ , row, column, m, n );
7901 submatrix( osres_ , row, column, m, n ) += submatrix( lhs_ + rhs_ , row, column, m, n );
7902 submatrix( refres_, row, column, m, n ) += submatrix( reflhs_ + refrhs_, row, column, m, n );
7903 }
7904 }
7905 }
7906 catch( std::exception& ex ) {
7907 convertException<MT1,MT2>( ex );
7908 }
7909
7910 checkResults<MT1,MT2>();
7911
7912 try {
7913 initResults();
7914 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7915 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7916 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7917 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7918 submatrix( dres_ , row, column, m, n ) += submatrix( lhs_ + orhs_ , row, column, m, n );
7919 submatrix( odres_ , row, column, m, n ) += submatrix( lhs_ + orhs_ , row, column, m, n );
7920 submatrix( sres_ , row, column, m, n ) += submatrix( lhs_ + orhs_ , row, column, m, n );
7921 submatrix( osres_ , row, column, m, n ) += submatrix( lhs_ + orhs_ , row, column, m, n );
7922 submatrix( refres_, row, column, m, n ) += submatrix( reflhs_ + refrhs_, row, column, m, n );
7923 }
7924 }
7925 }
7926 catch( std::exception& ex ) {
7927 convertException<MT1,OMT2>( ex );
7928 }
7929
7930 checkResults<MT1,OMT2>();
7931
7932 try {
7933 initResults();
7934 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7935 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7936 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7937 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7938 submatrix( dres_ , row, column, m, n ) += submatrix( olhs_ + rhs_ , row, column, m, n );
7939 submatrix( odres_ , row, column, m, n ) += submatrix( olhs_ + rhs_ , row, column, m, n );
7940 submatrix( sres_ , row, column, m, n ) += submatrix( olhs_ + rhs_ , row, column, m, n );
7941 submatrix( osres_ , row, column, m, n ) += submatrix( olhs_ + rhs_ , row, column, m, n );
7942 submatrix( refres_, row, column, m, n ) += submatrix( reflhs_ + refrhs_, row, column, m, n );
7943 }
7944 }
7945 }
7946 catch( std::exception& ex ) {
7947 convertException<OMT1,MT2>( ex );
7948 }
7949
7950 checkResults<OMT1,MT2>();
7951
7952 try {
7953 initResults();
7954 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7955 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7956 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7957 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7958 submatrix( dres_ , row, column, m, n ) += submatrix( olhs_ + orhs_ , row, column, m, n );
7959 submatrix( odres_ , row, column, m, n ) += submatrix( olhs_ + orhs_ , row, column, m, n );
7960 submatrix( sres_ , row, column, m, n ) += submatrix( olhs_ + orhs_ , row, column, m, n );
7961 submatrix( osres_ , row, column, m, n ) += submatrix( olhs_ + orhs_ , row, column, m, n );
7962 submatrix( refres_, row, column, m, n ) += submatrix( reflhs_ + refrhs_, row, column, m, n );
7963 }
7964 }
7965 }
7966 catch( std::exception& ex ) {
7967 convertException<OMT1,OMT2>( ex );
7968 }
7969
7970 checkResults<OMT1,OMT2>();
7971 }
7972
7973 // Submatrix-wise addition with addition assignment with evaluated matrices
7974 {
7975 test_ = "Submatrix-wise addition with addition assignment with evaluated matrices";
7976 error_ = "Failed addition assignment operation";
7977
7978 try {
7979 initResults();
7980 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7981 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7982 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7983 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7984 submatrix( dres_ , row, column, m, n ) += submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
7985 submatrix( odres_ , row, column, m, n ) += submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
7986 submatrix( sres_ , row, column, m, n ) += submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
7987 submatrix( osres_ , row, column, m, n ) += submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
7988 submatrix( refres_, row, column, m, n ) += submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
7989 }
7990 }
7991 }
7992 catch( std::exception& ex ) {
7993 convertException<MT1,MT2>( ex );
7994 }
7995
7996 checkResults<MT1,MT2>();
7997
7998 try {
7999 initResults();
8000 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8001 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8002 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8003 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8004 submatrix( dres_ , row, column, m, n ) += submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8005 submatrix( odres_ , row, column, m, n ) += submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8006 submatrix( sres_ , row, column, m, n ) += submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8007 submatrix( osres_ , row, column, m, n ) += submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8008 submatrix( refres_, row, column, m, n ) += submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8009 }
8010 }
8011 }
8012 catch( std::exception& ex ) {
8013 convertException<MT1,OMT2>( ex );
8014 }
8015
8016 checkResults<MT1,OMT2>();
8017
8018 try {
8019 initResults();
8020 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8021 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8022 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8023 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8024 submatrix( dres_ , row, column, m, n ) += submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8025 submatrix( odres_ , row, column, m, n ) += submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8026 submatrix( sres_ , row, column, m, n ) += submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8027 submatrix( osres_ , row, column, m, n ) += submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8028 submatrix( refres_, row, column, m, n ) += submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8029 }
8030 }
8031 }
8032 catch( std::exception& ex ) {
8033 convertException<OMT1,MT2>( ex );
8034 }
8035
8036 checkResults<OMT1,MT2>();
8037
8038 try {
8039 initResults();
8040 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8041 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8042 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8043 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8044 submatrix( dres_ , row, column, m, n ) += submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8045 submatrix( odres_ , row, column, m, n ) += submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8046 submatrix( sres_ , row, column, m, n ) += submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8047 submatrix( osres_ , row, column, m, n ) += submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8048 submatrix( refres_, row, column, m, n ) += submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8049 }
8050 }
8051 }
8052 catch( std::exception& ex ) {
8053 convertException<OMT1,OMT2>( ex );
8054 }
8055
8056 checkResults<OMT1,OMT2>();
8057 }
8058
8059
8060 //=====================================================================================
8061 // Submatrix-wise addition with subtraction assignment
8062 //=====================================================================================
8063
8064 // Submatrix-wise addition with subtraction assignment with the given matrices
8065 {
8066 test_ = "Submatrix-wise addition with subtraction assignment with the given matrices";
8067 error_ = "Failed subtraction assignment operation";
8068
8069 try {
8070 initResults();
8071 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8072 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8073 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8074 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8075 submatrix( dres_ , row, column, m, n ) -= submatrix( lhs_ + rhs_ , row, column, m, n );
8076 submatrix( odres_ , row, column, m, n ) -= submatrix( lhs_ + rhs_ , row, column, m, n );
8077 submatrix( sres_ , row, column, m, n ) -= submatrix( lhs_ + rhs_ , row, column, m, n );
8078 submatrix( osres_ , row, column, m, n ) -= submatrix( lhs_ + rhs_ , row, column, m, n );
8079 submatrix( refres_, row, column, m, n ) -= submatrix( reflhs_ + refrhs_, row, column, m, n );
8080 }
8081 }
8082 }
8083 catch( std::exception& ex ) {
8084 convertException<MT1,MT2>( ex );
8085 }
8086
8087 checkResults<MT1,MT2>();
8088
8089 try {
8090 initResults();
8091 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8092 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8093 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8094 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8095 submatrix( dres_ , row, column, m, n ) -= submatrix( lhs_ + orhs_ , row, column, m, n );
8096 submatrix( odres_ , row, column, m, n ) -= submatrix( lhs_ + orhs_ , row, column, m, n );
8097 submatrix( sres_ , row, column, m, n ) -= submatrix( lhs_ + orhs_ , row, column, m, n );
8098 submatrix( osres_ , row, column, m, n ) -= submatrix( lhs_ + orhs_ , row, column, m, n );
8099 submatrix( refres_, row, column, m, n ) -= submatrix( reflhs_ + refrhs_, row, column, m, n );
8100 }
8101 }
8102 }
8103 catch( std::exception& ex ) {
8104 convertException<MT1,OMT2>( ex );
8105 }
8106
8107 checkResults<MT1,OMT2>();
8108
8109 try {
8110 initResults();
8111 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8112 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8113 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8114 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8115 submatrix( dres_ , row, column, m, n ) -= submatrix( olhs_ + rhs_ , row, column, m, n );
8116 submatrix( odres_ , row, column, m, n ) -= submatrix( olhs_ + rhs_ , row, column, m, n );
8117 submatrix( sres_ , row, column, m, n ) -= submatrix( olhs_ + rhs_ , row, column, m, n );
8118 submatrix( osres_ , row, column, m, n ) -= submatrix( olhs_ + rhs_ , row, column, m, n );
8119 submatrix( refres_, row, column, m, n ) -= submatrix( reflhs_ + refrhs_, row, column, m, n );
8120 }
8121 }
8122 }
8123 catch( std::exception& ex ) {
8124 convertException<OMT1,MT2>( ex );
8125 }
8126
8127 checkResults<OMT1,MT2>();
8128
8129 try {
8130 initResults();
8131 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8132 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8133 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8134 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8135 submatrix( dres_ , row, column, m, n ) -= submatrix( olhs_ + orhs_ , row, column, m, n );
8136 submatrix( odres_ , row, column, m, n ) -= submatrix( olhs_ + orhs_ , row, column, m, n );
8137 submatrix( sres_ , row, column, m, n ) -= submatrix( olhs_ + orhs_ , row, column, m, n );
8138 submatrix( osres_ , row, column, m, n ) -= submatrix( olhs_ + orhs_ , row, column, m, n );
8139 submatrix( refres_, row, column, m, n ) -= submatrix( reflhs_ + refrhs_, row, column, m, n );
8140 }
8141 }
8142 }
8143 catch( std::exception& ex ) {
8144 convertException<OMT1,OMT2>( ex );
8145 }
8146
8147 checkResults<OMT1,OMT2>();
8148 }
8149
8150 // Submatrix-wise addition with subtraction assignment with evaluated matrices
8151 {
8152 test_ = "Submatrix-wise addition with subtraction assignment with evaluated matrices";
8153 error_ = "Failed subtraction assignment operation";
8154
8155 try {
8156 initResults();
8157 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8158 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8159 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8160 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8161 submatrix( dres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
8162 submatrix( odres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
8163 submatrix( sres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
8164 submatrix( osres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
8165 submatrix( refres_, row, column, m, n ) -= submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8166 }
8167 }
8168 }
8169 catch( std::exception& ex ) {
8170 convertException<MT1,MT2>( ex );
8171 }
8172
8173 checkResults<MT1,MT2>();
8174
8175 try {
8176 initResults();
8177 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8178 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8179 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8180 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8181 submatrix( dres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8182 submatrix( odres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8183 submatrix( sres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8184 submatrix( osres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8185 submatrix( refres_, row, column, m, n ) -= submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8186 }
8187 }
8188 }
8189 catch( std::exception& ex ) {
8190 convertException<MT1,OMT2>( ex );
8191 }
8192
8193 checkResults<MT1,OMT2>();
8194
8195 try {
8196 initResults();
8197 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8198 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8199 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8200 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8201 submatrix( dres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8202 submatrix( odres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8203 submatrix( sres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8204 submatrix( osres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8205 submatrix( refres_, row, column, m, n ) -= submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8206 }
8207 }
8208 }
8209 catch( std::exception& ex ) {
8210 convertException<OMT1,MT2>( ex );
8211 }
8212
8213 checkResults<OMT1,MT2>();
8214
8215 try {
8216 initResults();
8217 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8218 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8219 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8220 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8221 submatrix( dres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8222 submatrix( odres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8223 submatrix( sres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8224 submatrix( osres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8225 submatrix( refres_, row, column, m, n ) -= submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8226 }
8227 }
8228 }
8229 catch( std::exception& ex ) {
8230 convertException<OMT1,OMT2>( ex );
8231 }
8232
8233 checkResults<OMT1,OMT2>();
8234 }
8235
8236
8237 //=====================================================================================
8238 // Submatrix-wise addition with Schur product assignment
8239 //=====================================================================================
8240
8241 // Submatrix-wise addition with Schur product assignment with the given matrices
8242 {
8243 test_ = "Submatrix-wise addition with Schur product assignment with the given matrices";
8244 error_ = "Failed Schur product assignment operation";
8245
8246 try {
8247 initResults();
8248 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8249 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8250 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8251 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8252 submatrix( dres_ , row, column, m, n ) %= submatrix( lhs_ + rhs_ , row, column, m, n );
8253 submatrix( odres_ , row, column, m, n ) %= submatrix( lhs_ + rhs_ , row, column, m, n );
8254 submatrix( sres_ , row, column, m, n ) %= submatrix( lhs_ + rhs_ , row, column, m, n );
8255 submatrix( osres_ , row, column, m, n ) %= submatrix( lhs_ + rhs_ , row, column, m, n );
8256 submatrix( refres_, row, column, m, n ) %= submatrix( reflhs_ + refrhs_, row, column, m, n );
8257 }
8258 }
8259 }
8260 catch( std::exception& ex ) {
8261 convertException<MT1,MT2>( ex );
8262 }
8263
8264 checkResults<MT1,MT2>();
8265
8266 try {
8267 initResults();
8268 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8269 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8270 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8271 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8272 submatrix( dres_ , row, column, m, n ) %= submatrix( lhs_ + orhs_ , row, column, m, n );
8273 submatrix( odres_ , row, column, m, n ) %= submatrix( lhs_ + orhs_ , row, column, m, n );
8274 submatrix( sres_ , row, column, m, n ) %= submatrix( lhs_ + orhs_ , row, column, m, n );
8275 submatrix( osres_ , row, column, m, n ) %= submatrix( lhs_ + orhs_ , row, column, m, n );
8276 submatrix( refres_, row, column, m, n ) %= submatrix( reflhs_ + refrhs_, row, column, m, n );
8277 }
8278 }
8279 }
8280 catch( std::exception& ex ) {
8281 convertException<MT1,OMT2>( ex );
8282 }
8283
8284 checkResults<MT1,OMT2>();
8285
8286 try {
8287 initResults();
8288 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8289 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8290 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8291 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8292 submatrix( dres_ , row, column, m, n ) %= submatrix( olhs_ + rhs_ , row, column, m, n );
8293 submatrix( odres_ , row, column, m, n ) %= submatrix( olhs_ + rhs_ , row, column, m, n );
8294 submatrix( sres_ , row, column, m, n ) %= submatrix( olhs_ + rhs_ , row, column, m, n );
8295 submatrix( osres_ , row, column, m, n ) %= submatrix( olhs_ + rhs_ , row, column, m, n );
8296 submatrix( refres_, row, column, m, n ) %= submatrix( reflhs_ + refrhs_, row, column, m, n );
8297 }
8298 }
8299 }
8300 catch( std::exception& ex ) {
8301 convertException<OMT1,MT2>( ex );
8302 }
8303
8304 checkResults<OMT1,MT2>();
8305
8306 try {
8307 initResults();
8308 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8309 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8310 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8311 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8312 submatrix( dres_ , row, column, m, n ) %= submatrix( olhs_ + orhs_ , row, column, m, n );
8313 submatrix( odres_ , row, column, m, n ) %= submatrix( olhs_ + orhs_ , row, column, m, n );
8314 submatrix( sres_ , row, column, m, n ) %= submatrix( olhs_ + orhs_ , row, column, m, n );
8315 submatrix( osres_ , row, column, m, n ) %= submatrix( olhs_ + orhs_ , row, column, m, n );
8316 submatrix( refres_, row, column, m, n ) %= submatrix( reflhs_ + refrhs_, row, column, m, n );
8317 }
8318 }
8319 }
8320 catch( std::exception& ex ) {
8321 convertException<OMT1,OMT2>( ex );
8322 }
8323
8324 checkResults<OMT1,OMT2>();
8325 }
8326
8327 // Submatrix-wise addition with Schur product assignment with evaluated matrices
8328 {
8329 test_ = "Submatrix-wise addition with Schur product assignment with evaluated matrices";
8330 error_ = "Failed Schur product assignment operation";
8331
8332 try {
8333 initResults();
8334 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8335 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8336 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8337 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8338 submatrix( dres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
8339 submatrix( odres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
8340 submatrix( sres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
8341 submatrix( osres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) + eval( rhs_ ) , row, column, m, n );
8342 submatrix( refres_, row, column, m, n ) %= submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8343 }
8344 }
8345 }
8346 catch( std::exception& ex ) {
8347 convertException<MT1,MT2>( ex );
8348 }
8349
8350 checkResults<MT1,MT2>();
8351
8352 try {
8353 initResults();
8354 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8355 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8356 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8357 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8358 submatrix( dres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8359 submatrix( odres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8360 submatrix( sres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8361 submatrix( osres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) + eval( orhs_ ) , row, column, m, n );
8362 submatrix( refres_, row, column, m, n ) %= submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8363 }
8364 }
8365 }
8366 catch( std::exception& ex ) {
8367 convertException<MT1,OMT2>( ex );
8368 }
8369
8370 checkResults<MT1,OMT2>();
8371
8372 try {
8373 initResults();
8374 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8375 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8376 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8377 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8378 submatrix( dres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8379 submatrix( odres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8380 submatrix( sres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8381 submatrix( osres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) + eval( rhs_ ) , row, column, m, n );
8382 submatrix( refres_, row, column, m, n ) %= submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8383 }
8384 }
8385 }
8386 catch( std::exception& ex ) {
8387 convertException<OMT1,MT2>( ex );
8388 }
8389
8390 checkResults<OMT1,MT2>();
8391
8392 try {
8393 initResults();
8394 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8395 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8396 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8397 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8398 submatrix( dres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8399 submatrix( odres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8400 submatrix( sres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8401 submatrix( osres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) + eval( orhs_ ) , row, column, m, n );
8402 submatrix( refres_, row, column, m, n ) %= submatrix( eval( reflhs_ ) + eval( refrhs_ ), row, column, m, n );
8403 }
8404 }
8405 }
8406 catch( std::exception& ex ) {
8407 convertException<OMT1,OMT2>( ex );
8408 }
8409
8410 checkResults<OMT1,OMT2>();
8411 }
8412
8413
8414 //=====================================================================================
8415 // Failure cases
8416 //=====================================================================================
8417
8418 // Out-of-bounds submatrix construction (invalid number of rows)
8419 {
8420 test_ = "Out-of-bounds submatrix construction (invalid number of rows)";
8421 error_ = "Setup of out-of-bounds submatrix succeeded";
8422
8423 try {
8424 auto sm = submatrix( lhs_ + rhs_, 1UL, 0UL, lhs_.rows(), lhs_.columns() );
8425
8426 std::ostringstream oss;
8427 oss << " Test: " << test_ << "\n"
8428 << " Error: " << error_ << "\n"
8429 << " Details:\n"
8430 << " Random seed = " << blaze::getSeed() << "\n"
8431 << " Left-hand side dense matrix type:\n"
8432 << " " << typeid( MT1 ).name() << "\n"
8433 << " Right-hand side sparse matrix type:\n"
8434 << " " << typeid( MT2 ).name() << "\n"
8435 << " Result:\n" << sm << "\n";
8436 throw std::runtime_error( oss.str() );
8437 }
8438 catch( std::invalid_argument& ex ) {
8439 checkExceptionMessage( ex, "Invalid submatrix specification" );
8440 }
8441
8442 try {
8443 auto sm = submatrix( lhs_ + orhs_, 1UL, 0UL, lhs_.rows(), lhs_.columns() );
8444
8445 std::ostringstream oss;
8446 oss << " Test: " << test_ << "\n"
8447 << " Error: " << error_ << "\n"
8448 << " Details:\n"
8449 << " Random seed = " << blaze::getSeed() << "\n"
8450 << " Left-hand side dense matrix type:\n"
8451 << " " << typeid( MT1 ).name() << "\n"
8452 << " Right-hand side sparse matrix type:\n"
8453 << " " << typeid( OMT2 ).name() << "\n"
8454 << " Result:\n" << sm << "\n";
8455 throw std::runtime_error( oss.str() );
8456 }
8457 catch( std::invalid_argument& ex ) {
8458 checkExceptionMessage( ex, "Invalid submatrix specification" );
8459 }
8460
8461 try {
8462 auto sm = submatrix( olhs_ + rhs_, 1UL, 0UL, olhs_.rows(), olhs_.columns() );
8463
8464 std::ostringstream oss;
8465 oss << " Test: " << test_ << "\n"
8466 << " Error: " << error_ << "\n"
8467 << " Details:\n"
8468 << " Random seed = " << blaze::getSeed() << "\n"
8469 << " Left-hand side dense matrix type:\n"
8470 << " " << typeid( OMT1 ).name() << "\n"
8471 << " Right-hand side sparse matrix type:\n"
8472 << " " << typeid( MT2 ).name() << "\n"
8473 << " Result:\n" << sm << "\n";
8474 throw std::runtime_error( oss.str() );
8475 }
8476 catch( std::invalid_argument& ex ) {
8477 checkExceptionMessage( ex, "Invalid submatrix specification" );
8478 }
8479
8480 try {
8481 auto sm = submatrix( olhs_ + orhs_, 1UL, 0UL, olhs_.rows(), olhs_.columns() );
8482
8483 std::ostringstream oss;
8484 oss << " Test: " << test_ << "\n"
8485 << " Error: " << error_ << "\n"
8486 << " Details:\n"
8487 << " Random seed = " << blaze::getSeed() << "\n"
8488 << " Left-hand side dense matrix type:\n"
8489 << " " << typeid( OMT1 ).name() << "\n"
8490 << " Right-hand side sparse matrix type:\n"
8491 << " " << typeid( OMT2 ).name() << "\n"
8492 << " Result:\n" << sm << "\n";
8493 throw std::runtime_error( oss.str() );
8494 }
8495 catch( std::invalid_argument& ex ) {
8496 checkExceptionMessage( ex, "Invalid submatrix specification" );
8497 }
8498 }
8499
8500 // Out-of-bounds access (invalid number of columns)
8501 {
8502 test_ = "Out-of-bounds submatrix construction (invalid number of columns)";
8503 error_ = "Setup of out-of-bounds submatrix succeeded";
8504
8505 try {
8506 auto sm = submatrix( lhs_ + rhs_, 0UL, 1UL, lhs_.rows(), lhs_.columns() );
8507
8508 std::ostringstream oss;
8509 oss << " Test: " << test_ << "\n"
8510 << " Error: " << error_ << "\n"
8511 << " Details:\n"
8512 << " Random seed = " << blaze::getSeed() << "\n"
8513 << " Left-hand side dense matrix type:\n"
8514 << " " << typeid( MT1 ).name() << "\n"
8515 << " Right-hand side sparse matrix type:\n"
8516 << " " << typeid( MT2 ).name() << "\n"
8517 << " Result:\n" << sm << "\n";
8518 throw std::runtime_error( oss.str() );
8519 }
8520 catch( std::invalid_argument& ex ) {
8521 checkExceptionMessage( ex, "Invalid submatrix specification" );
8522 }
8523
8524 try {
8525 auto sm = submatrix( lhs_ + orhs_, 0UL, 1UL, lhs_.rows(), lhs_.columns() );
8526
8527 std::ostringstream oss;
8528 oss << " Test: " << test_ << "\n"
8529 << " Error: " << error_ << "\n"
8530 << " Details:\n"
8531 << " Random seed = " << blaze::getSeed() << "\n"
8532 << " Left-hand side dense matrix type:\n"
8533 << " " << typeid( MT1 ).name() << "\n"
8534 << " Right-hand side sparse matrix type:\n"
8535 << " " << typeid( OMT2 ).name() << "\n"
8536 << " Result:\n" << sm << "\n";
8537 throw std::runtime_error( oss.str() );
8538 }
8539 catch( std::invalid_argument& ex ) {
8540 checkExceptionMessage( ex, "Invalid submatrix specification" );
8541 }
8542
8543 try {
8544 auto sm = submatrix( olhs_ + rhs_, 0UL, 1UL, olhs_.rows(), olhs_.columns() );
8545
8546 std::ostringstream oss;
8547 oss << " Test: " << test_ << "\n"
8548 << " Error: " << error_ << "\n"
8549 << " Details:\n"
8550 << " Random seed = " << blaze::getSeed() << "\n"
8551 << " Left-hand side dense matrix type:\n"
8552 << " " << typeid( OMT1 ).name() << "\n"
8553 << " Right-hand side sparse matrix type:\n"
8554 << " " << typeid( MT2 ).name() << "\n"
8555 << " Result:\n" << sm << "\n";
8556 throw std::runtime_error( oss.str() );
8557 }
8558 catch( std::invalid_argument& ex ) {
8559 checkExceptionMessage( ex, "Invalid submatrix specification" );
8560 }
8561
8562 try {
8563 auto sm = submatrix( olhs_ + orhs_, 0UL, 1UL, olhs_.rows(), olhs_.columns() );
8564
8565 std::ostringstream oss;
8566 oss << " Test: " << test_ << "\n"
8567 << " Error: " << error_ << "\n"
8568 << " Details:\n"
8569 << " Random seed = " << blaze::getSeed() << "\n"
8570 << " Left-hand side dense matrix type:\n"
8571 << " " << typeid( OMT1 ).name() << "\n"
8572 << " Right-hand side sparse matrix type:\n"
8573 << " " << typeid( OMT2 ).name() << "\n"
8574 << " Result:\n" << sm << "\n";
8575 throw std::runtime_error( oss.str() );
8576 }
8577 catch( std::invalid_argument& ex ) {
8578 checkExceptionMessage( ex, "Invalid submatrix specification" );
8579 }
8580 }
8581
8582 // Out-of-bounds access (invalid row index)
8583 {
8584 test_ = "Out-of-bounds submatrix construction (invalid row index)";
8585 error_ = "Setup of out-of-bounds submatrix succeeded";
8586
8587 try {
8588 auto sm = submatrix( lhs_ + rhs_, lhs_.rows(), 0UL, 1UL, lhs_.columns() );
8589
8590 std::ostringstream oss;
8591 oss << " Test: " << test_ << "\n"
8592 << " Error: " << error_ << "\n"
8593 << " Details:\n"
8594 << " Random seed = " << blaze::getSeed() << "\n"
8595 << " Left-hand side dense matrix type:\n"
8596 << " " << typeid( MT1 ).name() << "\n"
8597 << " Right-hand side sparse matrix type:\n"
8598 << " " << typeid( MT2 ).name() << "\n"
8599 << " Result:\n" << sm << "\n";
8600 throw std::runtime_error( oss.str() );
8601 }
8602 catch( std::invalid_argument& ex ) {
8603 checkExceptionMessage( ex, "Invalid submatrix specification" );
8604 }
8605
8606 try {
8607 auto sm = submatrix( lhs_ + orhs_, lhs_.rows(), 0UL, 1UL, lhs_.columns() );
8608
8609 std::ostringstream oss;
8610 oss << " Test: " << test_ << "\n"
8611 << " Error: " << error_ << "\n"
8612 << " Details:\n"
8613 << " Random seed = " << blaze::getSeed() << "\n"
8614 << " Left-hand side dense matrix type:\n"
8615 << " " << typeid( MT1 ).name() << "\n"
8616 << " Right-hand side sparse matrix type:\n"
8617 << " " << typeid( OMT2 ).name() << "\n"
8618 << " Result:\n" << sm << "\n";
8619 throw std::runtime_error( oss.str() );
8620 }
8621 catch( std::invalid_argument& ex ) {
8622 checkExceptionMessage( ex, "Invalid submatrix specification" );
8623 }
8624
8625 try {
8626 auto sm = submatrix( olhs_ + rhs_, olhs_.rows(), 0UL, 1UL, olhs_.columns() );
8627
8628 std::ostringstream oss;
8629 oss << " Test: " << test_ << "\n"
8630 << " Error: " << error_ << "\n"
8631 << " Details:\n"
8632 << " Random seed = " << blaze::getSeed() << "\n"
8633 << " Left-hand side dense matrix type:\n"
8634 << " " << typeid( OMT1 ).name() << "\n"
8635 << " Right-hand side sparse matrix type:\n"
8636 << " " << typeid( MT2 ).name() << "\n"
8637 << " Result:\n" << sm << "\n";
8638 throw std::runtime_error( oss.str() );
8639 }
8640 catch( std::invalid_argument& ex ) {
8641 checkExceptionMessage( ex, "Invalid submatrix specification" );
8642 }
8643
8644 try {
8645 auto sm = submatrix( olhs_ + orhs_, olhs_.rows(), 0UL, 1UL, olhs_.columns() );
8646
8647 std::ostringstream oss;
8648 oss << " Test: " << test_ << "\n"
8649 << " Error: " << error_ << "\n"
8650 << " Details:\n"
8651 << " Random seed = " << blaze::getSeed() << "\n"
8652 << " Left-hand side dense matrix type:\n"
8653 << " " << typeid( OMT1 ).name() << "\n"
8654 << " Right-hand side sparse matrix type:\n"
8655 << " " << typeid( OMT2 ).name() << "\n"
8656 << " Result:\n" << sm << "\n";
8657 throw std::runtime_error( oss.str() );
8658 }
8659 catch( std::invalid_argument& ex ) {
8660 checkExceptionMessage( ex, "Invalid submatrix specification" );
8661 }
8662 }
8663
8664 // Out-of-bounds access (invalid column index)
8665 {
8666 test_ = "Out-of-bounds submatrix construction (invalid column index)";
8667 error_ = "Setup of out-of-bounds submatrix succeeded";
8668
8669 try {
8670 auto sm = submatrix( lhs_ + rhs_, 0UL, lhs_.columns(), lhs_.rows(), 1UL );
8671
8672 std::ostringstream oss;
8673 oss << " Test: " << test_ << "\n"
8674 << " Error: " << error_ << "\n"
8675 << " Details:\n"
8676 << " Random seed = " << blaze::getSeed() << "\n"
8677 << " Left-hand side dense matrix type:\n"
8678 << " " << typeid( MT1 ).name() << "\n"
8679 << " Right-hand side sparse matrix type:\n"
8680 << " " << typeid( MT2 ).name() << "\n"
8681 << " Result:\n" << sm << "\n";
8682 throw std::runtime_error( oss.str() );
8683 }
8684 catch( std::invalid_argument& ex ) {
8685 checkExceptionMessage( ex, "Invalid submatrix specification" );
8686 }
8687
8688 try {
8689 auto sm = submatrix( lhs_ + orhs_, 0UL, lhs_.columns(), lhs_.rows(), 1UL );
8690
8691 std::ostringstream oss;
8692 oss << " Test: " << test_ << "\n"
8693 << " Error: " << error_ << "\n"
8694 << " Details:\n"
8695 << " Random seed = " << blaze::getSeed() << "\n"
8696 << " Left-hand side dense matrix type:\n"
8697 << " " << typeid( MT1 ).name() << "\n"
8698 << " Right-hand side sparse matrix type:\n"
8699 << " " << typeid( OMT2 ).name() << "\n"
8700 << " Result:\n" << sm << "\n";
8701 throw std::runtime_error( oss.str() );
8702 }
8703 catch( std::invalid_argument& ex ) {
8704 checkExceptionMessage( ex, "Invalid submatrix specification" );
8705 }
8706
8707 try {
8708 auto sm = submatrix( olhs_ + rhs_, 0UL, olhs_.columns(), olhs_.rows(), 1UL );
8709
8710 std::ostringstream oss;
8711 oss << " Test: " << test_ << "\n"
8712 << " Error: " << error_ << "\n"
8713 << " Details:\n"
8714 << " Random seed = " << blaze::getSeed() << "\n"
8715 << " Left-hand side dense matrix type:\n"
8716 << " " << typeid( OMT1 ).name() << "\n"
8717 << " Right-hand side sparse matrix type:\n"
8718 << " " << typeid( MT2 ).name() << "\n"
8719 << " Result:\n" << sm << "\n";
8720 throw std::runtime_error( oss.str() );
8721 }
8722 catch( std::invalid_argument& ex ) {
8723 checkExceptionMessage( ex, "Invalid submatrix specification" );
8724 }
8725
8726 try {
8727 auto sm = submatrix( olhs_ + orhs_, 0UL, olhs_.columns(), olhs_.rows(), 1UL );
8728
8729 std::ostringstream oss;
8730 oss << " Test: " << test_ << "\n"
8731 << " Error: " << error_ << "\n"
8732 << " Details:\n"
8733 << " Random seed = " << blaze::getSeed() << "\n"
8734 << " Left-hand side dense matrix type:\n"
8735 << " " << typeid( OMT1 ).name() << "\n"
8736 << " Right-hand side sparse matrix type:\n"
8737 << " " << typeid( OMT2 ).name() << "\n"
8738 << " Result:\n" << sm << "\n";
8739 throw std::runtime_error( oss.str() );
8740 }
8741 catch( std::invalid_argument& ex ) {
8742 checkExceptionMessage( ex, "Invalid submatrix specification" );
8743 }
8744 }
8745 }
8746 #endif
8747 }
8748 //*************************************************************************************************
8749
8750
8751 //*************************************************************************************************
8752 /*!\brief Skipping the submatrix-wise dense matrix/sparse matrix addition.
8753 //
8754 // \return void
8755 //
8756 // This function is called in case the submatrix-wise matrix/matrix addition operation is not
8757 // available for the given matrix types \a MT1 and \a MT2.
8758 */
8759 template< typename MT1 // Type of the left-hand side dense matrix
8760 , typename MT2 > // Type of the right-hand side sparse matrix
testSubmatrixOperation(blaze::FalseType)8761 void OperationTest<MT1,MT2>::testSubmatrixOperation( blaze::FalseType )
8762 {}
8763 //*************************************************************************************************
8764
8765
8766 //*************************************************************************************************
8767 /*!\brief Testing the row-wise dense matrix/sparse matrix addition.
8768 //
8769 // \return void
8770 // \exception std::runtime_error Addition error detected.
8771 //
8772 // This function tests the row-wise matrix addition with plain assignment, addition assignment,
8773 // subtraction assignment, and multiplication assignment. In case any error resulting from the
8774 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is thrown.
8775 */
8776 template< typename MT1 // Type of the left-hand side dense matrix
8777 , typename MT2 > // Type of the right-hand side sparse matrix
testRowOperation(blaze::TrueType)8778 void OperationTest<MT1,MT2>::testRowOperation( blaze::TrueType )
8779 {
8780 #if BLAZETEST_MATHTEST_TEST_ROW_OPERATION
8781 if( BLAZETEST_MATHTEST_TEST_ROW_OPERATION > 1 )
8782 {
8783 if( lhs_.rows() == 0UL )
8784 return;
8785
8786
8787 //=====================================================================================
8788 // Row-wise addition
8789 //=====================================================================================
8790
8791 // Row-wise addition with the given matrices
8792 {
8793 test_ = "Row-wise addition with the given matrices";
8794 error_ = "Failed addition operation";
8795
8796 try {
8797 initResults();
8798 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8799 row( dres_ , i ) = row( lhs_ + rhs_, i );
8800 row( odres_ , i ) = row( lhs_ + rhs_, i );
8801 row( sres_ , i ) = row( lhs_ + rhs_, i );
8802 row( osres_ , i ) = row( lhs_ + rhs_, i );
8803 row( refres_, i ) = row( reflhs_ + refrhs_, i );
8804 }
8805 }
8806 catch( std::exception& ex ) {
8807 convertException<MT1,MT2>( ex );
8808 }
8809
8810 checkResults<MT1,MT2>();
8811
8812 try {
8813 initResults();
8814 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8815 row( dres_ , i ) = row( lhs_ + orhs_, i );
8816 row( odres_ , i ) = row( lhs_ + orhs_, i );
8817 row( sres_ , i ) = row( lhs_ + orhs_, i );
8818 row( osres_ , i ) = row( lhs_ + orhs_, i );
8819 row( refres_, i ) = row( reflhs_ + refrhs_, i );
8820 }
8821 }
8822 catch( std::exception& ex ) {
8823 convertException<MT1,OMT2>( ex );
8824 }
8825
8826 checkResults<MT1,OMT2>();
8827
8828 try {
8829 initResults();
8830 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8831 row( dres_ , i ) = row( olhs_ + rhs_, i );
8832 row( odres_ , i ) = row( olhs_ + rhs_, i );
8833 row( sres_ , i ) = row( olhs_ + rhs_, i );
8834 row( osres_ , i ) = row( olhs_ + rhs_, i );
8835 row( refres_, i ) = row( reflhs_ + refrhs_, i );
8836 }
8837 }
8838 catch( std::exception& ex ) {
8839 convertException<OMT1,MT2>( ex );
8840 }
8841
8842 checkResults<OMT1,MT2>();
8843
8844 try {
8845 initResults();
8846 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8847 row( dres_ , i ) = row( olhs_ + orhs_, i );
8848 row( odres_ , i ) = row( olhs_ + orhs_, i );
8849 row( sres_ , i ) = row( olhs_ + orhs_, i );
8850 row( osres_ , i ) = row( olhs_ + orhs_, i );
8851 row( refres_, i ) = row( reflhs_ + refrhs_, i );
8852 }
8853 }
8854 catch( std::exception& ex ) {
8855 convertException<OMT1,OMT2>( ex );
8856 }
8857
8858 checkResults<OMT1,OMT2>();
8859 }
8860
8861 // Row-wise addition with evaluated matrices
8862 {
8863 test_ = "Row-wise addition with evaluated matrices";
8864 error_ = "Failed addition operation";
8865
8866 try {
8867 initResults();
8868 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8869 row( dres_ , i ) = row( eval( lhs_ ) + eval( rhs_ ), i );
8870 row( odres_ , i ) = row( eval( lhs_ ) + eval( rhs_ ), i );
8871 row( sres_ , i ) = row( eval( lhs_ ) + eval( rhs_ ), i );
8872 row( osres_ , i ) = row( eval( lhs_ ) + eval( rhs_ ), i );
8873 row( refres_, i ) = row( eval( reflhs_ ) + eval( refrhs_ ), i );
8874 }
8875 }
8876 catch( std::exception& ex ) {
8877 convertException<MT1,MT2>( ex );
8878 }
8879
8880 checkResults<MT1,MT2>();
8881
8882 try {
8883 initResults();
8884 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8885 row( dres_ , i ) = row( eval( lhs_ ) + eval( orhs_ ), i );
8886 row( odres_ , i ) = row( eval( lhs_ ) + eval( orhs_ ), i );
8887 row( sres_ , i ) = row( eval( lhs_ ) + eval( orhs_ ), i );
8888 row( osres_ , i ) = row( eval( lhs_ ) + eval( orhs_ ), i );
8889 row( refres_, i ) = row( eval( reflhs_ ) + eval( refrhs_ ), i );
8890 }
8891 }
8892 catch( std::exception& ex ) {
8893 convertException<MT1,OMT2>( ex );
8894 }
8895
8896 checkResults<MT1,OMT2>();
8897
8898 try {
8899 initResults();
8900 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8901 row( dres_ , i ) = row( eval( olhs_ ) + eval( rhs_ ), i );
8902 row( odres_ , i ) = row( eval( olhs_ ) + eval( rhs_ ), i );
8903 row( sres_ , i ) = row( eval( olhs_ ) + eval( rhs_ ), i );
8904 row( osres_ , i ) = row( eval( olhs_ ) + eval( rhs_ ), i );
8905 row( refres_, i ) = row( eval( reflhs_ ) + eval( refrhs_ ), i );
8906 }
8907 }
8908 catch( std::exception& ex ) {
8909 convertException<OMT1,MT2>( ex );
8910 }
8911
8912 checkResults<OMT1,MT2>();
8913
8914 try {
8915 initResults();
8916 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8917 row( dres_ , i ) = row( eval( olhs_ ) + eval( orhs_ ), i );
8918 row( odres_ , i ) = row( eval( olhs_ ) + eval( orhs_ ), i );
8919 row( sres_ , i ) = row( eval( olhs_ ) + eval( orhs_ ), i );
8920 row( osres_ , i ) = row( eval( olhs_ ) + eval( orhs_ ), i );
8921 row( refres_, i ) = row( eval( reflhs_ ) + eval( refrhs_ ), i );
8922 }
8923 }
8924 catch( std::exception& ex ) {
8925 convertException<OMT1,OMT2>( ex );
8926 }
8927
8928 checkResults<OMT1,OMT2>();
8929 }
8930
8931
8932 //=====================================================================================
8933 // Row-wise addition with addition assignment
8934 //=====================================================================================
8935
8936 // Row-wise addition with addition assignment with the given matrices
8937 {
8938 test_ = "Row-wise addition with addition assignment with the given matrices";
8939 error_ = "Failed addition assignment operation";
8940
8941 try {
8942 initResults();
8943 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8944 row( dres_ , i ) += row( lhs_ + rhs_, i );
8945 row( odres_ , i ) += row( lhs_ + rhs_, i );
8946 row( sres_ , i ) += row( lhs_ + rhs_, i );
8947 row( osres_ , i ) += row( lhs_ + rhs_, i );
8948 row( refres_, i ) += row( reflhs_ + refrhs_, i );
8949 }
8950 }
8951 catch( std::exception& ex ) {
8952 convertException<MT1,MT2>( ex );
8953 }
8954
8955 checkResults<MT1,MT2>();
8956
8957 try {
8958 initResults();
8959 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8960 row( dres_ , i ) += row( lhs_ + orhs_, i );
8961 row( odres_ , i ) += row( lhs_ + orhs_, i );
8962 row( sres_ , i ) += row( lhs_ + orhs_, i );
8963 row( osres_ , i ) += row( lhs_ + orhs_, i );
8964 row( refres_, i ) += row( reflhs_ + refrhs_, i );
8965 }
8966 }
8967 catch( std::exception& ex ) {
8968 convertException<MT1,OMT2>( ex );
8969 }
8970
8971 checkResults<MT1,OMT2>();
8972
8973 try {
8974 initResults();
8975 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8976 row( dres_ , i ) += row( olhs_ + rhs_, i );
8977 row( odres_ , i ) += row( olhs_ + rhs_, i );
8978 row( sres_ , i ) += row( olhs_ + rhs_, i );
8979 row( osres_ , i ) += row( olhs_ + rhs_, i );
8980 row( refres_, i ) += row( reflhs_ + refrhs_, i );
8981 }
8982 }
8983 catch( std::exception& ex ) {
8984 convertException<OMT1,MT2>( ex );
8985 }
8986
8987 checkResults<OMT1,MT2>();
8988
8989 try {
8990 initResults();
8991 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8992 row( dres_ , i ) += row( olhs_ + orhs_, i );
8993 row( odres_ , i ) += row( olhs_ + orhs_, i );
8994 row( sres_ , i ) += row( olhs_ + orhs_, i );
8995 row( osres_ , i ) += row( olhs_ + orhs_, i );
8996 row( refres_, i ) += row( reflhs_ + refrhs_, i );
8997 }
8998 }
8999 catch( std::exception& ex ) {
9000 convertException<OMT1,OMT2>( ex );
9001 }
9002
9003 checkResults<OMT1,OMT2>();
9004 }
9005
9006 // Row-wise addition with addition assignment with evaluated matrices
9007 {
9008 test_ = "Row-wise addition with addition assignment with evaluated matrices";
9009 error_ = "Failed addition assignment operation";
9010
9011 try {
9012 initResults();
9013 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9014 row( dres_ , i ) += row( eval( lhs_ ) + eval( rhs_ ), i );
9015 row( odres_ , i ) += row( eval( lhs_ ) + eval( rhs_ ), i );
9016 row( sres_ , i ) += row( eval( lhs_ ) + eval( rhs_ ), i );
9017 row( osres_ , i ) += row( eval( lhs_ ) + eval( rhs_ ), i );
9018 row( refres_, i ) += row( eval( reflhs_ ) + eval( refrhs_ ), i );
9019 }
9020 }
9021 catch( std::exception& ex ) {
9022 convertException<MT1,MT2>( ex );
9023 }
9024
9025 checkResults<MT1,MT2>();
9026
9027 try {
9028 initResults();
9029 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9030 row( dres_ , i ) += row( eval( lhs_ ) + eval( orhs_ ), i );
9031 row( odres_ , i ) += row( eval( lhs_ ) + eval( orhs_ ), i );
9032 row( sres_ , i ) += row( eval( lhs_ ) + eval( orhs_ ), i );
9033 row( osres_ , i ) += row( eval( lhs_ ) + eval( orhs_ ), i );
9034 row( refres_, i ) += row( eval( reflhs_ ) + eval( refrhs_ ), i );
9035 }
9036 }
9037 catch( std::exception& ex ) {
9038 convertException<MT1,OMT2>( ex );
9039 }
9040
9041 checkResults<MT1,OMT2>();
9042
9043 try {
9044 initResults();
9045 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9046 row( dres_ , i ) += row( eval( olhs_ ) + eval( rhs_ ), i );
9047 row( odres_ , i ) += row( eval( olhs_ ) + eval( rhs_ ), i );
9048 row( sres_ , i ) += row( eval( olhs_ ) + eval( rhs_ ), i );
9049 row( osres_ , i ) += row( eval( olhs_ ) + eval( rhs_ ), i );
9050 row( refres_, i ) += row( eval( reflhs_ ) + eval( refrhs_ ), i );
9051 }
9052 }
9053 catch( std::exception& ex ) {
9054 convertException<OMT1,MT2>( ex );
9055 }
9056
9057 checkResults<OMT1,MT2>();
9058
9059 try {
9060 initResults();
9061 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9062 row( dres_ , i ) += row( eval( olhs_ ) + eval( orhs_ ), i );
9063 row( odres_ , i ) += row( eval( olhs_ ) + eval( orhs_ ), i );
9064 row( sres_ , i ) += row( eval( olhs_ ) + eval( orhs_ ), i );
9065 row( osres_ , i ) += row( eval( olhs_ ) + eval( orhs_ ), i );
9066 row( refres_, i ) += row( eval( reflhs_ ) + eval( refrhs_ ), i );
9067 }
9068 }
9069 catch( std::exception& ex ) {
9070 convertException<OMT1,OMT2>( ex );
9071 }
9072
9073 checkResults<OMT1,OMT2>();
9074 }
9075
9076
9077 //=====================================================================================
9078 // Row-wise addition with subtraction assignment
9079 //=====================================================================================
9080
9081 // Row-wise addition with subtraction assignment with the given matrices
9082 {
9083 test_ = "Row-wise addition with subtraction assignment with the given matrices";
9084 error_ = "Failed subtraction assignment operation";
9085
9086 try {
9087 initResults();
9088 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9089 row( dres_ , i ) -= row( lhs_ + rhs_, i );
9090 row( odres_ , i ) -= row( lhs_ + rhs_, i );
9091 row( sres_ , i ) -= row( lhs_ + rhs_, i );
9092 row( osres_ , i ) -= row( lhs_ + rhs_, i );
9093 row( refres_, i ) -= row( reflhs_ + refrhs_, i );
9094 }
9095 }
9096 catch( std::exception& ex ) {
9097 convertException<MT1,MT2>( ex );
9098 }
9099
9100 checkResults<MT1,MT2>();
9101
9102 try {
9103 initResults();
9104 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9105 row( dres_ , i ) -= row( lhs_ + orhs_, i );
9106 row( odres_ , i ) -= row( lhs_ + orhs_, i );
9107 row( sres_ , i ) -= row( lhs_ + orhs_, i );
9108 row( osres_ , i ) -= row( lhs_ + orhs_, i );
9109 row( refres_, i ) -= row( reflhs_ + refrhs_, i );
9110 }
9111 }
9112 catch( std::exception& ex ) {
9113 convertException<MT1,OMT2>( ex );
9114 }
9115
9116 checkResults<MT1,OMT2>();
9117
9118 try {
9119 initResults();
9120 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9121 row( dres_ , i ) -= row( olhs_ + rhs_, i );
9122 row( odres_ , i ) -= row( olhs_ + rhs_, i );
9123 row( sres_ , i ) -= row( olhs_ + rhs_, i );
9124 row( osres_ , i ) -= row( olhs_ + rhs_, i );
9125 row( refres_, i ) -= row( reflhs_ + refrhs_, i );
9126 }
9127 }
9128 catch( std::exception& ex ) {
9129 convertException<OMT1,MT2>( ex );
9130 }
9131
9132 checkResults<OMT1,MT2>();
9133
9134 try {
9135 initResults();
9136 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9137 row( dres_ , i ) -= row( olhs_ + orhs_, i );
9138 row( odres_ , i ) -= row( olhs_ + orhs_, i );
9139 row( sres_ , i ) -= row( olhs_ + orhs_, i );
9140 row( osres_ , i ) -= row( olhs_ + orhs_, i );
9141 row( refres_, i ) -= row( reflhs_ + refrhs_, i );
9142 }
9143 }
9144 catch( std::exception& ex ) {
9145 convertException<OMT1,OMT2>( ex );
9146 }
9147
9148 checkResults<OMT1,OMT2>();
9149 }
9150
9151 // Row-wise addition with subtraction assignment with evaluated matrices
9152 {
9153 test_ = "Row-wise addition with subtraction assignment with evaluated matrices";
9154 error_ = "Failed subtraction assignment operation";
9155
9156 try {
9157 initResults();
9158 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9159 row( dres_ , i ) -= row( eval( lhs_ ) + eval( rhs_ ), i );
9160 row( odres_ , i ) -= row( eval( lhs_ ) + eval( rhs_ ), i );
9161 row( sres_ , i ) -= row( eval( lhs_ ) + eval( rhs_ ), i );
9162 row( osres_ , i ) -= row( eval( lhs_ ) + eval( rhs_ ), i );
9163 row( refres_, i ) -= row( eval( reflhs_ ) + eval( refrhs_ ), i );
9164 }
9165 }
9166 catch( std::exception& ex ) {
9167 convertException<MT1,MT2>( ex );
9168 }
9169
9170 checkResults<MT1,MT2>();
9171
9172 try {
9173 initResults();
9174 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9175 row( dres_ , i ) -= row( eval( lhs_ ) + eval( orhs_ ), i );
9176 row( odres_ , i ) -= row( eval( lhs_ ) + eval( orhs_ ), i );
9177 row( sres_ , i ) -= row( eval( lhs_ ) + eval( orhs_ ), i );
9178 row( osres_ , i ) -= row( eval( lhs_ ) + eval( orhs_ ), i );
9179 row( refres_, i ) -= row( eval( reflhs_ ) + eval( refrhs_ ), i );
9180 }
9181 }
9182 catch( std::exception& ex ) {
9183 convertException<MT1,OMT2>( ex );
9184 }
9185
9186 checkResults<MT1,OMT2>();
9187
9188 try {
9189 initResults();
9190 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9191 row( dres_ , i ) -= row( eval( olhs_ ) + eval( rhs_ ), i );
9192 row( odres_ , i ) -= row( eval( olhs_ ) + eval( rhs_ ), i );
9193 row( sres_ , i ) -= row( eval( olhs_ ) + eval( rhs_ ), i );
9194 row( osres_ , i ) -= row( eval( olhs_ ) + eval( rhs_ ), i );
9195 row( refres_, i ) -= row( eval( reflhs_ ) + eval( refrhs_ ), i );
9196 }
9197 }
9198 catch( std::exception& ex ) {
9199 convertException<OMT1,MT2>( ex );
9200 }
9201
9202 checkResults<OMT1,MT2>();
9203
9204 try {
9205 initResults();
9206 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9207 row( dres_ , i ) -= row( eval( olhs_ ) + eval( orhs_ ), i );
9208 row( odres_ , i ) -= row( eval( olhs_ ) + eval( orhs_ ), i );
9209 row( sres_ , i ) -= row( eval( olhs_ ) + eval( orhs_ ), i );
9210 row( osres_ , i ) -= row( eval( olhs_ ) + eval( orhs_ ), i );
9211 row( refres_, i ) -= row( eval( reflhs_ ) + eval( refrhs_ ), i );
9212 }
9213 }
9214 catch( std::exception& ex ) {
9215 convertException<OMT1,OMT2>( ex );
9216 }
9217
9218 checkResults<OMT1,OMT2>();
9219 }
9220
9221
9222 //=====================================================================================
9223 // Row-wise addition with multiplication assignment
9224 //=====================================================================================
9225
9226 // Row-wise addition with multiplication assignment with the given matrices
9227 {
9228 test_ = "Row-wise addition with multiplication assignment with the given matrices";
9229 error_ = "Failed multiplication assignment operation";
9230
9231 try {
9232 initResults();
9233 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9234 row( dres_ , i ) *= row( lhs_ + rhs_, i );
9235 row( odres_ , i ) *= row( lhs_ + rhs_, i );
9236 row( sres_ , i ) *= row( lhs_ + rhs_, i );
9237 row( osres_ , i ) *= row( lhs_ + rhs_, i );
9238 row( refres_, i ) *= row( reflhs_ + refrhs_, i );
9239 }
9240 }
9241 catch( std::exception& ex ) {
9242 convertException<MT1,MT2>( ex );
9243 }
9244
9245 checkResults<MT1,MT2>();
9246
9247 try {
9248 initResults();
9249 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9250 row( dres_ , i ) *= row( lhs_ + orhs_, i );
9251 row( odres_ , i ) *= row( lhs_ + orhs_, i );
9252 row( sres_ , i ) *= row( lhs_ + orhs_, i );
9253 row( osres_ , i ) *= row( lhs_ + orhs_, i );
9254 row( refres_, i ) *= row( reflhs_ + refrhs_, i );
9255 }
9256 }
9257 catch( std::exception& ex ) {
9258 convertException<MT1,OMT2>( ex );
9259 }
9260
9261 checkResults<MT1,OMT2>();
9262
9263 try {
9264 initResults();
9265 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9266 row( dres_ , i ) *= row( olhs_ + rhs_, i );
9267 row( odres_ , i ) *= row( olhs_ + rhs_, i );
9268 row( sres_ , i ) *= row( olhs_ + rhs_, i );
9269 row( osres_ , i ) *= row( olhs_ + rhs_, i );
9270 row( refres_, i ) *= row( reflhs_ + refrhs_, i );
9271 }
9272 }
9273 catch( std::exception& ex ) {
9274 convertException<OMT1,MT2>( ex );
9275 }
9276
9277 checkResults<OMT1,MT2>();
9278
9279 try {
9280 initResults();
9281 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9282 row( dres_ , i ) *= row( olhs_ + orhs_, i );
9283 row( odres_ , i ) *= row( olhs_ + orhs_, i );
9284 row( sres_ , i ) *= row( olhs_ + orhs_, i );
9285 row( osres_ , i ) *= row( olhs_ + orhs_, i );
9286 row( refres_, i ) *= row( reflhs_ + refrhs_, i );
9287 }
9288 }
9289 catch( std::exception& ex ) {
9290 convertException<OMT1,OMT2>( ex );
9291 }
9292
9293 checkResults<OMT1,OMT2>();
9294 }
9295
9296 // Row-wise addition with multiplication assignment with evaluated matrices
9297 {
9298 test_ = "Row-wise addition with multiplication assignment with evaluated matrices";
9299 error_ = "Failed multiplication assignment operation";
9300
9301 try {
9302 initResults();
9303 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9304 row( dres_ , i ) *= row( eval( lhs_ ) + eval( rhs_ ), i );
9305 row( odres_ , i ) *= row( eval( lhs_ ) + eval( rhs_ ), i );
9306 row( sres_ , i ) *= row( eval( lhs_ ) + eval( rhs_ ), i );
9307 row( osres_ , i ) *= row( eval( lhs_ ) + eval( rhs_ ), i );
9308 row( refres_, i ) *= row( eval( reflhs_ ) + eval( refrhs_ ), i );
9309 }
9310 }
9311 catch( std::exception& ex ) {
9312 convertException<MT1,MT2>( ex );
9313 }
9314
9315 checkResults<MT1,MT2>();
9316
9317 try {
9318 initResults();
9319 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9320 row( dres_ , i ) *= row( eval( lhs_ ) + eval( orhs_ ), i );
9321 row( odres_ , i ) *= row( eval( lhs_ ) + eval( orhs_ ), i );
9322 row( sres_ , i ) *= row( eval( lhs_ ) + eval( orhs_ ), i );
9323 row( osres_ , i ) *= row( eval( lhs_ ) + eval( orhs_ ), i );
9324 row( refres_, i ) *= row( eval( reflhs_ ) + eval( refrhs_ ), i );
9325 }
9326 }
9327 catch( std::exception& ex ) {
9328 convertException<MT1,OMT2>( ex );
9329 }
9330
9331 checkResults<MT1,OMT2>();
9332
9333 try {
9334 initResults();
9335 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9336 row( dres_ , i ) *= row( eval( olhs_ ) + eval( rhs_ ), i );
9337 row( odres_ , i ) *= row( eval( olhs_ ) + eval( rhs_ ), i );
9338 row( sres_ , i ) *= row( eval( olhs_ ) + eval( rhs_ ), i );
9339 row( osres_ , i ) *= row( eval( olhs_ ) + eval( rhs_ ), i );
9340 row( refres_, i ) *= row( eval( reflhs_ ) + eval( refrhs_ ), i );
9341 }
9342 }
9343 catch( std::exception& ex ) {
9344 convertException<OMT1,MT2>( ex );
9345 }
9346
9347 checkResults<OMT1,MT2>();
9348
9349 try {
9350 initResults();
9351 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9352 row( dres_ , i ) *= row( eval( olhs_ ) + eval( orhs_ ), i );
9353 row( odres_ , i ) *= row( eval( olhs_ ) + eval( orhs_ ), i );
9354 row( sres_ , i ) *= row( eval( olhs_ ) + eval( orhs_ ), i );
9355 row( osres_ , i ) *= row( eval( olhs_ ) + eval( orhs_ ), i );
9356 row( refres_, i ) *= row( eval( reflhs_ ) + eval( refrhs_ ), i );
9357 }
9358 }
9359 catch( std::exception& ex ) {
9360 convertException<OMT1,OMT2>( ex );
9361 }
9362
9363 checkResults<OMT1,OMT2>();
9364 }
9365
9366
9367 //=====================================================================================
9368 // Failure cases
9369 //=====================================================================================
9370
9371 // Out-of-bounds access (invalid row index)
9372 {
9373 test_ = "Out-of-bounds row construction (invalid row index)";
9374 error_ = "Setup of out-of-bounds row succeeded";
9375
9376 try {
9377 auto r = row( lhs_ + rhs_, lhs_.rows() );
9378
9379 std::ostringstream oss;
9380 oss << " Test: " << test_ << "\n"
9381 << " Error: " << error_ << "\n"
9382 << " Details:\n"
9383 << " Random seed = " << blaze::getSeed() << "\n"
9384 << " Left-hand side dense matrix type:\n"
9385 << " " << typeid( MT1 ).name() << "\n"
9386 << " Right-hand side sparse matrix type:\n"
9387 << " " << typeid( MT2 ).name() << "\n"
9388 << " Result:\n" << r << "\n";
9389 throw std::runtime_error( oss.str() );
9390 }
9391 catch( std::invalid_argument& ex ) {
9392 checkExceptionMessage( ex, "Invalid row access index" );
9393 }
9394
9395 try {
9396 auto r = row( lhs_ + orhs_, lhs_.rows() );
9397
9398 std::ostringstream oss;
9399 oss << " Test: " << test_ << "\n"
9400 << " Error: " << error_ << "\n"
9401 << " Details:\n"
9402 << " Random seed = " << blaze::getSeed() << "\n"
9403 << " Left-hand side dense matrix type:\n"
9404 << " " << typeid( MT1 ).name() << "\n"
9405 << " Right-hand side sparse matrix type:\n"
9406 << " " << typeid( OMT2 ).name() << "\n"
9407 << " Result:\n" << r << "\n";
9408 throw std::runtime_error( oss.str() );
9409 }
9410 catch( std::invalid_argument& ex ) {
9411 checkExceptionMessage( ex, "Invalid row access index" );
9412 }
9413
9414 try {
9415 auto r = row( olhs_ + rhs_, olhs_.rows() );
9416
9417 std::ostringstream oss;
9418 oss << " Test: " << test_ << "\n"
9419 << " Error: " << error_ << "\n"
9420 << " Details:\n"
9421 << " Random seed = " << blaze::getSeed() << "\n"
9422 << " Left-hand side dense matrix type:\n"
9423 << " " << typeid( OMT1 ).name() << "\n"
9424 << " Right-hand side sparse matrix type:\n"
9425 << " " << typeid( MT2 ).name() << "\n"
9426 << " Result:\n" << r << "\n";
9427 throw std::runtime_error( oss.str() );
9428 }
9429 catch( std::invalid_argument& ex ) {
9430 checkExceptionMessage( ex, "Invalid row access index" );
9431 }
9432
9433 try {
9434 auto r = row( olhs_ + orhs_, olhs_.rows() );
9435
9436 std::ostringstream oss;
9437 oss << " Test: " << test_ << "\n"
9438 << " Error: " << error_ << "\n"
9439 << " Details:\n"
9440 << " Random seed = " << blaze::getSeed() << "\n"
9441 << " Left-hand side dense matrix type:\n"
9442 << " " << typeid( OMT1 ).name() << "\n"
9443 << " Right-hand side sparse matrix type:\n"
9444 << " " << typeid( OMT2 ).name() << "\n"
9445 << " Result:\n" << r << "\n";
9446 throw std::runtime_error( oss.str() );
9447 }
9448 catch( std::invalid_argument& ex ) {
9449 checkExceptionMessage( ex, "Invalid row access index" );
9450 }
9451 }
9452 }
9453 #endif
9454 }
9455 //*************************************************************************************************
9456
9457
9458 //*************************************************************************************************
9459 /*!\brief Skipping the row-wise dense matrix/sparse matrix addition.
9460 //
9461 // \return void
9462 //
9463 // This function is called in case the row-wise matrix/matrix addition operation is not
9464 // available for the given matrix types \a MT1 and \a MT2.
9465 */
9466 template< typename MT1 // Type of the left-hand side dense matrix
9467 , typename MT2 > // Type of the right-hand side sparse matrix
testRowOperation(blaze::FalseType)9468 void OperationTest<MT1,MT2>::testRowOperation( blaze::FalseType )
9469 {}
9470 //*************************************************************************************************
9471
9472
9473 //*************************************************************************************************
9474 /*!\brief Testing the rows-wise dense matrix/sparse matrix addition.
9475 //
9476 // \return void
9477 // \exception std::runtime_error Addition error detected.
9478 //
9479 // This function tests the rows-wise matrix addition with plain assignment, addition assignment,
9480 // subtraction assignment, and Schur product assignment. In case any error resulting from the
9481 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is thrown.
9482 */
9483 template< typename MT1 // Type of the left-hand side dense matrix
9484 , typename MT2 > // Type of the right-hand side sparse matrix
testRowsOperation(blaze::TrueType)9485 void OperationTest<MT1,MT2>::testRowsOperation( blaze::TrueType )
9486 {
9487 #if BLAZETEST_MATHTEST_TEST_ROWS_OPERATION
9488 if( BLAZETEST_MATHTEST_TEST_ROWS_OPERATION > 1 )
9489 {
9490 if( lhs_.rows() == 0UL )
9491 return;
9492
9493
9494 std::vector<size_t> indices( lhs_.rows() );
9495 std::iota( indices.begin(), indices.end(), 0UL );
9496 std::random_shuffle( indices.begin(), indices.end() );
9497
9498
9499 //=====================================================================================
9500 // Rows-wise addition
9501 //=====================================================================================
9502
9503 // Rows-wise addition with the given matrices
9504 {
9505 test_ = "Rows-wise addition with the given matrices";
9506 error_ = "Failed addition operation";
9507
9508 try {
9509 initResults();
9510 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9511 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9512 rows( dres_ , &indices[index], n ) = rows( lhs_ + rhs_, &indices[index], n );
9513 rows( odres_ , &indices[index], n ) = rows( lhs_ + rhs_, &indices[index], n );
9514 rows( sres_ , &indices[index], n ) = rows( lhs_ + rhs_, &indices[index], n );
9515 rows( osres_ , &indices[index], n ) = rows( lhs_ + rhs_, &indices[index], n );
9516 rows( refres_, &indices[index], n ) = rows( reflhs_ + refrhs_, &indices[index], n );
9517 }
9518 }
9519 catch( std::exception& ex ) {
9520 convertException<MT1,MT2>( ex );
9521 }
9522
9523 checkResults<MT1,MT2>();
9524
9525 try {
9526 initResults();
9527 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9528 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9529 rows( dres_ , &indices[index], n ) = rows( lhs_ + orhs_, &indices[index], n );
9530 rows( odres_ , &indices[index], n ) = rows( lhs_ + orhs_, &indices[index], n );
9531 rows( sres_ , &indices[index], n ) = rows( lhs_ + orhs_, &indices[index], n );
9532 rows( osres_ , &indices[index], n ) = rows( lhs_ + orhs_, &indices[index], n );
9533 rows( refres_, &indices[index], n ) = rows( reflhs_ + refrhs_, &indices[index], n );
9534 }
9535 }
9536 catch( std::exception& ex ) {
9537 convertException<MT1,OMT2>( ex );
9538 }
9539
9540 checkResults<MT1,OMT2>();
9541
9542 try {
9543 initResults();
9544 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9545 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9546 rows( dres_ , &indices[index], n ) = rows( olhs_ + rhs_, &indices[index], n );
9547 rows( odres_ , &indices[index], n ) = rows( olhs_ + rhs_, &indices[index], n );
9548 rows( sres_ , &indices[index], n ) = rows( olhs_ + rhs_, &indices[index], n );
9549 rows( osres_ , &indices[index], n ) = rows( olhs_ + rhs_, &indices[index], n );
9550 rows( refres_, &indices[index], n ) = rows( reflhs_ + refrhs_, &indices[index], n );
9551 }
9552 }
9553 catch( std::exception& ex ) {
9554 convertException<OMT1,MT2>( ex );
9555 }
9556
9557 checkResults<OMT1,MT2>();
9558
9559 try {
9560 initResults();
9561 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9562 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9563 rows( dres_ , &indices[index], n ) = rows( olhs_ + orhs_, &indices[index], n );
9564 rows( odres_ , &indices[index], n ) = rows( olhs_ + orhs_, &indices[index], n );
9565 rows( sres_ , &indices[index], n ) = rows( olhs_ + orhs_, &indices[index], n );
9566 rows( osres_ , &indices[index], n ) = rows( olhs_ + orhs_, &indices[index], n );
9567 rows( refres_, &indices[index], n ) = rows( reflhs_ + refrhs_, &indices[index], n );
9568 }
9569 }
9570 catch( std::exception& ex ) {
9571 convertException<OMT1,OMT2>( ex );
9572 }
9573
9574 checkResults<OMT1,OMT2>();
9575 }
9576
9577 // Rows-wise addition with evaluated matrices
9578 {
9579 test_ = "Rows-wise addition with evaluated matrices";
9580 error_ = "Failed addition operation";
9581
9582 try {
9583 initResults();
9584 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9585 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9586 rows( dres_ , &indices[index], n ) = rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9587 rows( odres_ , &indices[index], n ) = rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9588 rows( sres_ , &indices[index], n ) = rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9589 rows( osres_ , &indices[index], n ) = rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9590 rows( refres_, &indices[index], n ) = rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9591 }
9592 }
9593 catch( std::exception& ex ) {
9594 convertException<MT1,MT2>( ex );
9595 }
9596
9597 checkResults<MT1,MT2>();
9598
9599 try {
9600 initResults();
9601 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9602 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9603 rows( dres_ , &indices[index], n ) = rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9604 rows( odres_ , &indices[index], n ) = rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9605 rows( sres_ , &indices[index], n ) = rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9606 rows( osres_ , &indices[index], n ) = rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9607 rows( refres_, &indices[index], n ) = rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9608 }
9609 }
9610 catch( std::exception& ex ) {
9611 convertException<MT1,OMT2>( ex );
9612 }
9613
9614 checkResults<MT1,OMT2>();
9615
9616 try {
9617 initResults();
9618 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9619 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9620 rows( dres_ , &indices[index], n ) = rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9621 rows( odres_ , &indices[index], n ) = rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9622 rows( sres_ , &indices[index], n ) = rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9623 rows( osres_ , &indices[index], n ) = rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9624 rows( refres_, &indices[index], n ) = rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9625 }
9626 }
9627 catch( std::exception& ex ) {
9628 convertException<OMT1,MT2>( ex );
9629 }
9630
9631 checkResults<OMT1,MT2>();
9632
9633 try {
9634 initResults();
9635 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9636 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9637 rows( dres_ , &indices[index], n ) = rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9638 rows( odres_ , &indices[index], n ) = rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9639 rows( sres_ , &indices[index], n ) = rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9640 rows( osres_ , &indices[index], n ) = rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9641 rows( refres_, &indices[index], n ) = rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9642 }
9643 }
9644 catch( std::exception& ex ) {
9645 convertException<OMT1,OMT2>( ex );
9646 }
9647
9648 checkResults<OMT1,OMT2>();
9649 }
9650
9651
9652 //=====================================================================================
9653 // Rows-wise addition with addition assignment
9654 //=====================================================================================
9655
9656 // Rows-wise addition with addition assignment with the given matrices
9657 {
9658 test_ = "Rows-wise addition with addition assignment with the given matrices";
9659 error_ = "Failed addition assignment operation";
9660
9661 try {
9662 initResults();
9663 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9664 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9665 rows( dres_ , &indices[index], n ) += rows( lhs_ + rhs_, &indices[index], n );
9666 rows( odres_ , &indices[index], n ) += rows( lhs_ + rhs_, &indices[index], n );
9667 rows( sres_ , &indices[index], n ) += rows( lhs_ + rhs_, &indices[index], n );
9668 rows( osres_ , &indices[index], n ) += rows( lhs_ + rhs_, &indices[index], n );
9669 rows( refres_, &indices[index], n ) += rows( reflhs_ + refrhs_, &indices[index], n );
9670 }
9671 }
9672 catch( std::exception& ex ) {
9673 convertException<MT1,MT2>( ex );
9674 }
9675
9676 checkResults<MT1,MT2>();
9677
9678 try {
9679 initResults();
9680 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9681 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9682 rows( dres_ , &indices[index], n ) += rows( lhs_ + orhs_, &indices[index], n );
9683 rows( odres_ , &indices[index], n ) += rows( lhs_ + orhs_, &indices[index], n );
9684 rows( sres_ , &indices[index], n ) += rows( lhs_ + orhs_, &indices[index], n );
9685 rows( osres_ , &indices[index], n ) += rows( lhs_ + orhs_, &indices[index], n );
9686 rows( refres_, &indices[index], n ) += rows( reflhs_ + refrhs_, &indices[index], n );
9687 }
9688 }
9689 catch( std::exception& ex ) {
9690 convertException<MT1,OMT2>( ex );
9691 }
9692
9693 checkResults<MT1,OMT2>();
9694
9695 try {
9696 initResults();
9697 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9698 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9699 rows( dres_ , &indices[index], n ) += rows( olhs_ + rhs_, &indices[index], n );
9700 rows( odres_ , &indices[index], n ) += rows( olhs_ + rhs_, &indices[index], n );
9701 rows( sres_ , &indices[index], n ) += rows( olhs_ + rhs_, &indices[index], n );
9702 rows( osres_ , &indices[index], n ) += rows( olhs_ + rhs_, &indices[index], n );
9703 rows( refres_, &indices[index], n ) += rows( reflhs_ + refrhs_, &indices[index], n );
9704 }
9705 }
9706 catch( std::exception& ex ) {
9707 convertException<OMT1,MT2>( ex );
9708 }
9709
9710 checkResults<OMT1,MT2>();
9711
9712 try {
9713 initResults();
9714 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9715 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9716 rows( dres_ , &indices[index], n ) += rows( olhs_ + orhs_, &indices[index], n );
9717 rows( odres_ , &indices[index], n ) += rows( olhs_ + orhs_, &indices[index], n );
9718 rows( sres_ , &indices[index], n ) += rows( olhs_ + orhs_, &indices[index], n );
9719 rows( osres_ , &indices[index], n ) += rows( olhs_ + orhs_, &indices[index], n );
9720 rows( refres_, &indices[index], n ) += rows( reflhs_ + refrhs_, &indices[index], n );
9721 }
9722 }
9723 catch( std::exception& ex ) {
9724 convertException<OMT1,OMT2>( ex );
9725 }
9726
9727 checkResults<OMT1,OMT2>();
9728 }
9729
9730 // Rows-wise addition with addition assignment with evaluated matrices
9731 {
9732 test_ = "Rows-wise addition with addition assignment with evaluated matrices";
9733 error_ = "Failed addition assignment operation";
9734
9735 try {
9736 initResults();
9737 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9738 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9739 rows( dres_ , &indices[index], n ) += rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9740 rows( odres_ , &indices[index], n ) += rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9741 rows( sres_ , &indices[index], n ) += rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9742 rows( osres_ , &indices[index], n ) += rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9743 rows( refres_, &indices[index], n ) += rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9744 }
9745 }
9746 catch( std::exception& ex ) {
9747 convertException<MT1,MT2>( ex );
9748 }
9749
9750 checkResults<MT1,MT2>();
9751
9752 try {
9753 initResults();
9754 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9755 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9756 rows( dres_ , &indices[index], n ) += rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9757 rows( odres_ , &indices[index], n ) += rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9758 rows( sres_ , &indices[index], n ) += rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9759 rows( osres_ , &indices[index], n ) += rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9760 rows( refres_, &indices[index], n ) += rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9761 }
9762 }
9763 catch( std::exception& ex ) {
9764 convertException<MT1,OMT2>( ex );
9765 }
9766
9767 checkResults<MT1,OMT2>();
9768
9769 try {
9770 initResults();
9771 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9772 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9773 rows( dres_ , &indices[index], n ) += rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9774 rows( odres_ , &indices[index], n ) += rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9775 rows( sres_ , &indices[index], n ) += rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9776 rows( osres_ , &indices[index], n ) += rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9777 rows( refres_, &indices[index], n ) += rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9778 }
9779 }
9780 catch( std::exception& ex ) {
9781 convertException<OMT1,MT2>( ex );
9782 }
9783
9784 checkResults<OMT1,MT2>();
9785
9786 try {
9787 initResults();
9788 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9789 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9790 rows( dres_ , &indices[index], n ) += rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9791 rows( odres_ , &indices[index], n ) += rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9792 rows( sres_ , &indices[index], n ) += rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9793 rows( osres_ , &indices[index], n ) += rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9794 rows( refres_, &indices[index], n ) += rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9795 }
9796 }
9797 catch( std::exception& ex ) {
9798 convertException<OMT1,OMT2>( ex );
9799 }
9800
9801 checkResults<OMT1,OMT2>();
9802 }
9803
9804
9805 //=====================================================================================
9806 // Rows-wise addition with subtraction assignment
9807 //=====================================================================================
9808
9809 // Rows-wise addition with subtraction assignment with the given matrices
9810 {
9811 test_ = "Rows-wise addition with subtraction assignment with the given matrices";
9812 error_ = "Failed subtraction assignment operation";
9813
9814 try {
9815 initResults();
9816 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9817 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9818 rows( dres_ , &indices[index], n ) -= rows( lhs_ + rhs_, &indices[index], n );
9819 rows( odres_ , &indices[index], n ) -= rows( lhs_ + rhs_, &indices[index], n );
9820 rows( sres_ , &indices[index], n ) -= rows( lhs_ + rhs_, &indices[index], n );
9821 rows( osres_ , &indices[index], n ) -= rows( lhs_ + rhs_, &indices[index], n );
9822 rows( refres_, &indices[index], n ) -= rows( reflhs_ + refrhs_, &indices[index], n );
9823 }
9824 }
9825 catch( std::exception& ex ) {
9826 convertException<MT1,MT2>( ex );
9827 }
9828
9829 checkResults<MT1,MT2>();
9830
9831 try {
9832 initResults();
9833 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9834 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9835 rows( dres_ , &indices[index], n ) -= rows( lhs_ + orhs_, &indices[index], n );
9836 rows( odres_ , &indices[index], n ) -= rows( lhs_ + orhs_, &indices[index], n );
9837 rows( sres_ , &indices[index], n ) -= rows( lhs_ + orhs_, &indices[index], n );
9838 rows( osres_ , &indices[index], n ) -= rows( lhs_ + orhs_, &indices[index], n );
9839 rows( refres_, &indices[index], n ) -= rows( reflhs_ + refrhs_, &indices[index], n );
9840 }
9841 }
9842 catch( std::exception& ex ) {
9843 convertException<MT1,OMT2>( ex );
9844 }
9845
9846 checkResults<MT1,OMT2>();
9847
9848 try {
9849 initResults();
9850 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9851 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9852 rows( dres_ , &indices[index], n ) -= rows( olhs_ + rhs_, &indices[index], n );
9853 rows( odres_ , &indices[index], n ) -= rows( olhs_ + rhs_, &indices[index], n );
9854 rows( sres_ , &indices[index], n ) -= rows( olhs_ + rhs_, &indices[index], n );
9855 rows( osres_ , &indices[index], n ) -= rows( olhs_ + rhs_, &indices[index], n );
9856 rows( refres_, &indices[index], n ) -= rows( reflhs_ + refrhs_, &indices[index], n );
9857 }
9858 }
9859 catch( std::exception& ex ) {
9860 convertException<OMT1,MT2>( ex );
9861 }
9862
9863 checkResults<OMT1,MT2>();
9864
9865 try {
9866 initResults();
9867 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9868 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9869 rows( dres_ , &indices[index], n ) -= rows( olhs_ + orhs_, &indices[index], n );
9870 rows( odres_ , &indices[index], n ) -= rows( olhs_ + orhs_, &indices[index], n );
9871 rows( sres_ , &indices[index], n ) -= rows( olhs_ + orhs_, &indices[index], n );
9872 rows( osres_ , &indices[index], n ) -= rows( olhs_ + orhs_, &indices[index], n );
9873 rows( refres_, &indices[index], n ) -= rows( reflhs_ + refrhs_, &indices[index], n );
9874 }
9875 }
9876 catch( std::exception& ex ) {
9877 convertException<OMT1,OMT2>( ex );
9878 }
9879
9880 checkResults<OMT1,OMT2>();
9881 }
9882
9883 // Rows-wise addition with subtraction assignment with evaluated matrices
9884 {
9885 test_ = "Rows-wise addition with subtraction assignment with evaluated matrices";
9886 error_ = "Failed subtraction assignment operation";
9887
9888 try {
9889 initResults();
9890 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9891 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9892 rows( dres_ , &indices[index], n ) -= rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9893 rows( odres_ , &indices[index], n ) -= rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9894 rows( sres_ , &indices[index], n ) -= rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9895 rows( osres_ , &indices[index], n ) -= rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
9896 rows( refres_, &indices[index], n ) -= rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9897 }
9898 }
9899 catch( std::exception& ex ) {
9900 convertException<MT1,MT2>( ex );
9901 }
9902
9903 checkResults<MT1,MT2>();
9904
9905 try {
9906 initResults();
9907 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9908 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9909 rows( dres_ , &indices[index], n ) -= rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9910 rows( odres_ , &indices[index], n ) -= rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9911 rows( sres_ , &indices[index], n ) -= rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9912 rows( osres_ , &indices[index], n ) -= rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
9913 rows( refres_, &indices[index], n ) -= rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9914 }
9915 }
9916 catch( std::exception& ex ) {
9917 convertException<MT1,OMT2>( ex );
9918 }
9919
9920 checkResults<MT1,OMT2>();
9921
9922 try {
9923 initResults();
9924 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9925 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9926 rows( dres_ , &indices[index], n ) -= rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9927 rows( odres_ , &indices[index], n ) -= rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9928 rows( sres_ , &indices[index], n ) -= rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9929 rows( osres_ , &indices[index], n ) -= rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
9930 rows( refres_, &indices[index], n ) -= rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9931 }
9932 }
9933 catch( std::exception& ex ) {
9934 convertException<OMT1,MT2>( ex );
9935 }
9936
9937 checkResults<OMT1,MT2>();
9938
9939 try {
9940 initResults();
9941 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9942 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9943 rows( dres_ , &indices[index], n ) -= rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9944 rows( odres_ , &indices[index], n ) -= rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9945 rows( sres_ , &indices[index], n ) -= rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9946 rows( osres_ , &indices[index], n ) -= rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
9947 rows( refres_, &indices[index], n ) -= rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
9948 }
9949 }
9950 catch( std::exception& ex ) {
9951 convertException<OMT1,OMT2>( ex );
9952 }
9953
9954 checkResults<OMT1,OMT2>();
9955 }
9956
9957
9958 //=====================================================================================
9959 // Rows-wise addition with Schur product assignment
9960 //=====================================================================================
9961
9962 // Rows-wise addition with Schur product assignment with the given matrices
9963 {
9964 test_ = "Rows-wise addition with Schur product assignment with the given matrices";
9965 error_ = "Failed Schur product assignment operation";
9966
9967 try {
9968 initResults();
9969 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9970 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9971 rows( dres_ , &indices[index], n ) %= rows( lhs_ + rhs_, &indices[index], n );
9972 rows( odres_ , &indices[index], n ) %= rows( lhs_ + rhs_, &indices[index], n );
9973 rows( sres_ , &indices[index], n ) %= rows( lhs_ + rhs_, &indices[index], n );
9974 rows( osres_ , &indices[index], n ) %= rows( lhs_ + rhs_, &indices[index], n );
9975 rows( refres_, &indices[index], n ) %= rows( reflhs_ + refrhs_, &indices[index], n );
9976 }
9977 }
9978 catch( std::exception& ex ) {
9979 convertException<MT1,MT2>( ex );
9980 }
9981
9982 checkResults<MT1,MT2>();
9983
9984 try {
9985 initResults();
9986 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9987 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9988 rows( dres_ , &indices[index], n ) %= rows( lhs_ + orhs_, &indices[index], n );
9989 rows( odres_ , &indices[index], n ) %= rows( lhs_ + orhs_, &indices[index], n );
9990 rows( sres_ , &indices[index], n ) %= rows( lhs_ + orhs_, &indices[index], n );
9991 rows( osres_ , &indices[index], n ) %= rows( lhs_ + orhs_, &indices[index], n );
9992 rows( refres_, &indices[index], n ) %= rows( reflhs_ + refrhs_, &indices[index], n );
9993 }
9994 }
9995 catch( std::exception& ex ) {
9996 convertException<MT1,OMT2>( ex );
9997 }
9998
9999 checkResults<MT1,OMT2>();
10000
10001 try {
10002 initResults();
10003 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10004 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10005 rows( dres_ , &indices[index], n ) %= rows( olhs_ + rhs_, &indices[index], n );
10006 rows( odres_ , &indices[index], n ) %= rows( olhs_ + rhs_, &indices[index], n );
10007 rows( sres_ , &indices[index], n ) %= rows( olhs_ + rhs_, &indices[index], n );
10008 rows( osres_ , &indices[index], n ) %= rows( olhs_ + rhs_, &indices[index], n );
10009 rows( refres_, &indices[index], n ) %= rows( reflhs_ + refrhs_, &indices[index], n );
10010 }
10011 }
10012 catch( std::exception& ex ) {
10013 convertException<OMT1,MT2>( ex );
10014 }
10015
10016 checkResults<OMT1,MT2>();
10017
10018 try {
10019 initResults();
10020 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10021 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10022 rows( dres_ , &indices[index], n ) %= rows( olhs_ + orhs_, &indices[index], n );
10023 rows( odres_ , &indices[index], n ) %= rows( olhs_ + orhs_, &indices[index], n );
10024 rows( sres_ , &indices[index], n ) %= rows( olhs_ + orhs_, &indices[index], n );
10025 rows( osres_ , &indices[index], n ) %= rows( olhs_ + orhs_, &indices[index], n );
10026 rows( refres_, &indices[index], n ) %= rows( reflhs_ + refrhs_, &indices[index], n );
10027 }
10028 }
10029 catch( std::exception& ex ) {
10030 convertException<OMT1,OMT2>( ex );
10031 }
10032
10033 checkResults<OMT1,OMT2>();
10034 }
10035
10036 // Rows-wise addition with Schur product assignment with evaluated matrices
10037 {
10038 test_ = "Rows-wise addition with Schur product assignment with evaluated matrices";
10039 error_ = "Failed Schur product assignment operation";
10040
10041 try {
10042 initResults();
10043 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10044 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10045 rows( dres_ , &indices[index], n ) %= rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
10046 rows( odres_ , &indices[index], n ) %= rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
10047 rows( sres_ , &indices[index], n ) %= rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
10048 rows( osres_ , &indices[index], n ) %= rows( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
10049 rows( refres_, &indices[index], n ) %= rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
10050 }
10051 }
10052 catch( std::exception& ex ) {
10053 convertException<MT1,MT2>( ex );
10054 }
10055
10056 checkResults<MT1,MT2>();
10057
10058 try {
10059 initResults();
10060 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10061 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10062 rows( dres_ , &indices[index], n ) %= rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
10063 rows( odres_ , &indices[index], n ) %= rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
10064 rows( sres_ , &indices[index], n ) %= rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
10065 rows( osres_ , &indices[index], n ) %= rows( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
10066 rows( refres_, &indices[index], n ) %= rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
10067 }
10068 }
10069 catch( std::exception& ex ) {
10070 convertException<MT1,OMT2>( ex );
10071 }
10072
10073 checkResults<MT1,OMT2>();
10074
10075 try {
10076 initResults();
10077 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10078 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10079 rows( dres_ , &indices[index], n ) %= rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
10080 rows( odres_ , &indices[index], n ) %= rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
10081 rows( sres_ , &indices[index], n ) %= rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
10082 rows( osres_ , &indices[index], n ) %= rows( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
10083 rows( refres_, &indices[index], n ) %= rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
10084 }
10085 }
10086 catch( std::exception& ex ) {
10087 convertException<OMT1,MT2>( ex );
10088 }
10089
10090 checkResults<OMT1,MT2>();
10091
10092 try {
10093 initResults();
10094 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10095 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10096 rows( dres_ , &indices[index], n ) %= rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
10097 rows( odres_ , &indices[index], n ) %= rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
10098 rows( sres_ , &indices[index], n ) %= rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
10099 rows( osres_ , &indices[index], n ) %= rows( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
10100 rows( refres_, &indices[index], n ) %= rows( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
10101 }
10102 }
10103 catch( std::exception& ex ) {
10104 convertException<OMT1,OMT2>( ex );
10105 }
10106
10107 checkResults<OMT1,OMT2>();
10108 }
10109
10110
10111 //=====================================================================================
10112 // Failure cases
10113 //=====================================================================================
10114
10115 // Out-of-bounds access (invalid row index; initializer_list)
10116 {
10117 test_ = "Out-of-bounds row selection construction (invalid row index; initializer_list)";
10118 error_ = "Setup of out-of-bounds row selection succeeded";
10119
10120 try {
10121 auto r = rows( lhs_ + rhs_, { lhs_.rows() } );
10122
10123 std::ostringstream oss;
10124 oss << " Test: " << test_ << "\n"
10125 << " Error: " << error_ << "\n"
10126 << " Details:\n"
10127 << " Random seed = " << blaze::getSeed() << "\n"
10128 << " Left-hand side dense matrix type:\n"
10129 << " " << typeid( MT1 ).name() << "\n"
10130 << " Right-hand side sparse matrix type:\n"
10131 << " " << typeid( MT2 ).name() << "\n"
10132 << " Result:\n" << r << "\n";
10133 throw std::runtime_error( oss.str() );
10134 }
10135 catch( std::invalid_argument& ex ) {
10136 checkExceptionMessage( ex, "Invalid row access index" );
10137 }
10138
10139 try {
10140 auto r = rows( lhs_ + orhs_, { lhs_.rows() } );
10141
10142 std::ostringstream oss;
10143 oss << " Test: " << test_ << "\n"
10144 << " Error: " << error_ << "\n"
10145 << " Details:\n"
10146 << " Random seed = " << blaze::getSeed() << "\n"
10147 << " Left-hand side dense matrix type:\n"
10148 << " " << typeid( MT1 ).name() << "\n"
10149 << " Right-hand side sparse matrix type:\n"
10150 << " " << typeid( OMT2 ).name() << "\n"
10151 << " Result:\n" << r << "\n";
10152 throw std::runtime_error( oss.str() );
10153 }
10154 catch( std::invalid_argument& ex ) {
10155 checkExceptionMessage( ex, "Invalid row access index" );
10156 }
10157
10158 try {
10159 auto r = rows( olhs_ + rhs_, { olhs_.rows() } );
10160
10161 std::ostringstream oss;
10162 oss << " Test: " << test_ << "\n"
10163 << " Error: " << error_ << "\n"
10164 << " Details:\n"
10165 << " Random seed = " << blaze::getSeed() << "\n"
10166 << " Left-hand side dense matrix type:\n"
10167 << " " << typeid( OMT1 ).name() << "\n"
10168 << " Right-hand side sparse matrix type:\n"
10169 << " " << typeid( MT2 ).name() << "\n"
10170 << " Result:\n" << r << "\n";
10171 throw std::runtime_error( oss.str() );
10172 }
10173 catch( std::invalid_argument& ex ) {
10174 checkExceptionMessage( ex, "Invalid row access index" );
10175 }
10176
10177 try {
10178 auto r = rows( olhs_ + orhs_, { olhs_.rows() } );
10179
10180 std::ostringstream oss;
10181 oss << " Test: " << test_ << "\n"
10182 << " Error: " << error_ << "\n"
10183 << " Details:\n"
10184 << " Random seed = " << blaze::getSeed() << "\n"
10185 << " Left-hand side dense matrix type:\n"
10186 << " " << typeid( OMT1 ).name() << "\n"
10187 << " Right-hand side sparse matrix type:\n"
10188 << " " << typeid( OMT2 ).name() << "\n"
10189 << " Result:\n" << r << "\n";
10190 throw std::runtime_error( oss.str() );
10191 }
10192 catch( std::invalid_argument& ex ) {
10193 checkExceptionMessage( ex, "Invalid row access index" );
10194 }
10195 }
10196
10197 // Out-of-bounds access (invalid row index; lambda)
10198 {
10199 test_ = "Out-of-bounds row selection construction (invalid row index; lambda)";
10200 error_ = "Setup of out-of-bounds row selection succeeded";
10201
10202 try {
10203 auto r = rows( lhs_ + rhs_, [index=lhs_.rows()]( size_t ){ return index; }, 1UL );
10204
10205 std::ostringstream oss;
10206 oss << " Test: " << test_ << "\n"
10207 << " Error: " << error_ << "\n"
10208 << " Details:\n"
10209 << " Random seed = " << blaze::getSeed() << "\n"
10210 << " Left-hand side dense matrix type:\n"
10211 << " " << typeid( MT1 ).name() << "\n"
10212 << " Right-hand side sparse matrix type:\n"
10213 << " " << typeid( MT2 ).name() << "\n"
10214 << " Result:\n" << r << "\n";
10215 throw std::runtime_error( oss.str() );
10216 }
10217 catch( std::invalid_argument& ex ) {
10218 checkExceptionMessage( ex, "Invalid row access index" );
10219 }
10220
10221 try {
10222 auto r = rows( lhs_ + orhs_, [index=lhs_.rows()]( size_t ){ return index; }, 1UL );
10223
10224 std::ostringstream oss;
10225 oss << " Test: " << test_ << "\n"
10226 << " Error: " << error_ << "\n"
10227 << " Details:\n"
10228 << " Random seed = " << blaze::getSeed() << "\n"
10229 << " Left-hand side dense matrix type:\n"
10230 << " " << typeid( MT1 ).name() << "\n"
10231 << " Right-hand side sparse matrix type:\n"
10232 << " " << typeid( OMT2 ).name() << "\n"
10233 << " Result:\n" << r << "\n";
10234 throw std::runtime_error( oss.str() );
10235 }
10236 catch( std::invalid_argument& ex ) {
10237 checkExceptionMessage( ex, "Invalid row access index" );
10238 }
10239
10240 try {
10241 auto r = rows( olhs_ + rhs_, [index=olhs_.rows()]( size_t ){ return index; }, 1UL );
10242
10243 std::ostringstream oss;
10244 oss << " Test: " << test_ << "\n"
10245 << " Error: " << error_ << "\n"
10246 << " Details:\n"
10247 << " Random seed = " << blaze::getSeed() << "\n"
10248 << " Left-hand side dense matrix type:\n"
10249 << " " << typeid( OMT1 ).name() << "\n"
10250 << " Right-hand side sparse matrix type:\n"
10251 << " " << typeid( MT2 ).name() << "\n"
10252 << " Result:\n" << r << "\n";
10253 throw std::runtime_error( oss.str() );
10254 }
10255 catch( std::invalid_argument& ex ) {
10256 checkExceptionMessage( ex, "Invalid row access index" );
10257 }
10258
10259 try {
10260 auto r = rows( olhs_ + orhs_, [index=olhs_.rows()]( size_t ){ return index; }, 1UL );
10261
10262 std::ostringstream oss;
10263 oss << " Test: " << test_ << "\n"
10264 << " Error: " << error_ << "\n"
10265 << " Details:\n"
10266 << " Random seed = " << blaze::getSeed() << "\n"
10267 << " Left-hand side dense matrix type:\n"
10268 << " " << typeid( OMT1 ).name() << "\n"
10269 << " Right-hand side sparse matrix type:\n"
10270 << " " << typeid( OMT2 ).name() << "\n"
10271 << " Result:\n" << r << "\n";
10272 throw std::runtime_error( oss.str() );
10273 }
10274 catch( std::invalid_argument& ex ) {
10275 checkExceptionMessage( ex, "Invalid row access index" );
10276 }
10277 }
10278 }
10279 #endif
10280 }
10281 //*************************************************************************************************
10282
10283
10284 //*************************************************************************************************
10285 /*!\brief Skipping the rows-wise dense matrix/sparse matrix addition.
10286 //
10287 // \return void
10288 //
10289 // This function is called in case the rows-wise matrix/matrix addition operation is not
10290 // available for the given matrix types \a MT1 and \a MT2.
10291 */
10292 template< typename MT1 // Type of the left-hand side dense matrix
10293 , typename MT2 > // Type of the right-hand side sparse matrix
testRowsOperation(blaze::FalseType)10294 void OperationTest<MT1,MT2>::testRowsOperation( blaze::FalseType )
10295 {}
10296 //*************************************************************************************************
10297
10298
10299 //*************************************************************************************************
10300 /*!\brief Testing the column-wise dense matrix/sparse matrix addition.
10301 //
10302 // \return void
10303 // \exception std::runtime_error Addition error detected.
10304 //
10305 // This function tests the column-wise matrix addition with plain assignment, addition assignment,
10306 // subtraction assignment, and multiplication assignment. In case any error resulting from the
10307 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is thrown.
10308 */
10309 template< typename MT1 // Type of the left-hand side dense matrix
10310 , typename MT2 > // Type of the right-hand side sparse matrix
testColumnOperation(blaze::TrueType)10311 void OperationTest<MT1,MT2>::testColumnOperation( blaze::TrueType )
10312 {
10313 #if BLAZETEST_MATHTEST_TEST_COLUMN_OPERATION
10314 if( BLAZETEST_MATHTEST_TEST_COLUMN_OPERATION > 1 )
10315 {
10316 if( lhs_.columns() == 0UL )
10317 return;
10318
10319
10320 //=====================================================================================
10321 // Column-wise addition
10322 //=====================================================================================
10323
10324 // Column-wise addition with the given matrices
10325 {
10326 test_ = "Column-wise addition with the given matrices";
10327 error_ = "Failed addition operation";
10328
10329 try {
10330 initResults();
10331 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10332 column( dres_ , j ) = column( lhs_ + rhs_, j );
10333 column( odres_ , j ) = column( lhs_ + rhs_, j );
10334 column( sres_ , j ) = column( lhs_ + rhs_, j );
10335 column( osres_ , j ) = column( lhs_ + rhs_, j );
10336 column( refres_, j ) = column( reflhs_ + refrhs_, j );
10337 }
10338 }
10339 catch( std::exception& ex ) {
10340 convertException<MT1,MT2>( ex );
10341 }
10342
10343 checkResults<MT1,MT2>();
10344
10345 try {
10346 initResults();
10347 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10348 column( dres_ , j ) = column( lhs_ + orhs_, j );
10349 column( odres_ , j ) = column( lhs_ + orhs_, j );
10350 column( sres_ , j ) = column( lhs_ + orhs_, j );
10351 column( osres_ , j ) = column( lhs_ + orhs_, j );
10352 column( refres_, j ) = column( reflhs_ + refrhs_, j );
10353 }
10354 }
10355 catch( std::exception& ex ) {
10356 convertException<MT1,OMT2>( ex );
10357 }
10358
10359 checkResults<MT1,OMT2>();
10360
10361 try {
10362 initResults();
10363 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10364 column( dres_ , j ) = column( olhs_ + rhs_, j );
10365 column( odres_ , j ) = column( olhs_ + rhs_, j );
10366 column( sres_ , j ) = column( olhs_ + rhs_, j );
10367 column( osres_ , j ) = column( olhs_ + rhs_, j );
10368 column( refres_, j ) = column( reflhs_ + refrhs_, j );
10369 }
10370 }
10371 catch( std::exception& ex ) {
10372 convertException<OMT1,MT2>( ex );
10373 }
10374
10375 checkResults<OMT1,MT2>();
10376
10377 try {
10378 initResults();
10379 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10380 column( dres_ , j ) = column( olhs_ + orhs_, j );
10381 column( odres_ , j ) = column( olhs_ + orhs_, j );
10382 column( sres_ , j ) = column( olhs_ + orhs_, j );
10383 column( osres_ , j ) = column( olhs_ + orhs_, j );
10384 column( refres_, j ) = column( reflhs_ + refrhs_, j );
10385 }
10386 }
10387 catch( std::exception& ex ) {
10388 convertException<OMT1,OMT2>( ex );
10389 }
10390
10391 checkResults<OMT1,OMT2>();
10392 }
10393
10394 // Column-wise addition with evaluated matrices
10395 {
10396 test_ = "Column-wise addition with evaluated matrices";
10397 error_ = "Failed addition operation";
10398
10399 try {
10400 initResults();
10401 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10402 column( dres_ , j ) = column( eval( lhs_ ) + eval( rhs_ ), j );
10403 column( odres_ , j ) = column( eval( lhs_ ) + eval( rhs_ ), j );
10404 column( sres_ , j ) = column( eval( lhs_ ) + eval( rhs_ ), j );
10405 column( osres_ , j ) = column( eval( lhs_ ) + eval( rhs_ ), j );
10406 column( refres_, j ) = column( eval( reflhs_ ) + eval( refrhs_ ), j );
10407 }
10408 }
10409 catch( std::exception& ex ) {
10410 convertException<MT1,MT2>( ex );
10411 }
10412
10413 checkResults<MT1,MT2>();
10414
10415 try {
10416 initResults();
10417 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10418 column( dres_ , j ) = column( eval( lhs_ ) + eval( orhs_ ), j );
10419 column( odres_ , j ) = column( eval( lhs_ ) + eval( orhs_ ), j );
10420 column( sres_ , j ) = column( eval( lhs_ ) + eval( orhs_ ), j );
10421 column( osres_ , j ) = column( eval( lhs_ ) + eval( orhs_ ), j );
10422 column( refres_, j ) = column( eval( reflhs_ ) + eval( refrhs_ ), j );
10423 }
10424 }
10425 catch( std::exception& ex ) {
10426 convertException<MT1,OMT2>( ex );
10427 }
10428
10429 checkResults<MT1,OMT2>();
10430
10431 try {
10432 initResults();
10433 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10434 column( dres_ , j ) = column( eval( olhs_ ) + eval( rhs_ ), j );
10435 column( odres_ , j ) = column( eval( olhs_ ) + eval( rhs_ ), j );
10436 column( sres_ , j ) = column( eval( olhs_ ) + eval( rhs_ ), j );
10437 column( osres_ , j ) = column( eval( olhs_ ) + eval( rhs_ ), j );
10438 column( refres_, j ) = column( eval( reflhs_ ) + eval( refrhs_ ), j );
10439 }
10440 }
10441 catch( std::exception& ex ) {
10442 convertException<OMT1,MT2>( ex );
10443 }
10444
10445 checkResults<OMT1,MT2>();
10446
10447 try {
10448 initResults();
10449 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10450 column( dres_ , j ) = column( eval( olhs_ ) + eval( orhs_ ), j );
10451 column( odres_ , j ) = column( eval( olhs_ ) + eval( orhs_ ), j );
10452 column( sres_ , j ) = column( eval( olhs_ ) + eval( orhs_ ), j );
10453 column( osres_ , j ) = column( eval( olhs_ ) + eval( orhs_ ), j );
10454 column( refres_, j ) = column( eval( reflhs_ ) + eval( refrhs_ ), j );
10455 }
10456 }
10457 catch( std::exception& ex ) {
10458 convertException<OMT1,OMT2>( ex );
10459 }
10460
10461 checkResults<OMT1,OMT2>();
10462 }
10463
10464
10465 //=====================================================================================
10466 // Column-wise addition with addition assignment
10467 //=====================================================================================
10468
10469 // Column-wise addition with addition assignment with the given matrices
10470 {
10471 test_ = "Column-wise addition with addition assignment with the given matrices";
10472 error_ = "Failed addition assignment operation";
10473
10474 try {
10475 initResults();
10476 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10477 column( dres_ , j ) += column( lhs_ + rhs_, j );
10478 column( odres_ , j ) += column( lhs_ + rhs_, j );
10479 column( sres_ , j ) += column( lhs_ + rhs_, j );
10480 column( osres_ , j ) += column( lhs_ + rhs_, j );
10481 column( refres_, j ) += column( reflhs_ + refrhs_, j );
10482 }
10483 }
10484 catch( std::exception& ex ) {
10485 convertException<MT1,MT2>( ex );
10486 }
10487
10488 checkResults<MT1,MT2>();
10489
10490 try {
10491 initResults();
10492 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10493 column( dres_ , j ) += column( lhs_ + orhs_, j );
10494 column( odres_ , j ) += column( lhs_ + orhs_, j );
10495 column( sres_ , j ) += column( lhs_ + orhs_, j );
10496 column( osres_ , j ) += column( lhs_ + orhs_, j );
10497 column( refres_, j ) += column( reflhs_ + refrhs_, j );
10498 }
10499 }
10500 catch( std::exception& ex ) {
10501 convertException<MT1,OMT2>( ex );
10502 }
10503
10504 checkResults<MT1,OMT2>();
10505
10506 try {
10507 initResults();
10508 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10509 column( dres_ , j ) += column( olhs_ + rhs_, j );
10510 column( odres_ , j ) += column( olhs_ + rhs_, j );
10511 column( sres_ , j ) += column( olhs_ + rhs_, j );
10512 column( osres_ , j ) += column( olhs_ + rhs_, j );
10513 column( refres_, j ) += column( reflhs_ + refrhs_, j );
10514 }
10515 }
10516 catch( std::exception& ex ) {
10517 convertException<OMT1,MT2>( ex );
10518 }
10519
10520 checkResults<OMT1,MT2>();
10521
10522 try {
10523 initResults();
10524 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10525 column( dres_ , j ) += column( olhs_ + orhs_, j );
10526 column( odres_ , j ) += column( olhs_ + orhs_, j );
10527 column( sres_ , j ) += column( olhs_ + orhs_, j );
10528 column( osres_ , j ) += column( olhs_ + orhs_, j );
10529 column( refres_, j ) += column( reflhs_ + refrhs_, j );
10530 }
10531 }
10532 catch( std::exception& ex ) {
10533 convertException<OMT1,OMT2>( ex );
10534 }
10535
10536 checkResults<OMT1,OMT2>();
10537 }
10538
10539 // Column-wise addition with addition assignment with evaluated matrices
10540 {
10541 test_ = "Column-wise addition with addition assignment with evaluated matrices";
10542 error_ = "Failed addition assignment operation";
10543
10544 try {
10545 initResults();
10546 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10547 column( dres_ , j ) += column( eval( lhs_ ) + eval( rhs_ ), j );
10548 column( odres_ , j ) += column( eval( lhs_ ) + eval( rhs_ ), j );
10549 column( sres_ , j ) += column( eval( lhs_ ) + eval( rhs_ ), j );
10550 column( osres_ , j ) += column( eval( lhs_ ) + eval( rhs_ ), j );
10551 column( refres_, j ) += column( eval( reflhs_ ) + eval( refrhs_ ), j );
10552 }
10553 }
10554 catch( std::exception& ex ) {
10555 convertException<MT1,MT2>( ex );
10556 }
10557
10558 checkResults<MT1,MT2>();
10559
10560 try {
10561 initResults();
10562 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10563 column( dres_ , j ) += column( eval( lhs_ ) + eval( orhs_ ), j );
10564 column( odres_ , j ) += column( eval( lhs_ ) + eval( orhs_ ), j );
10565 column( sres_ , j ) += column( eval( lhs_ ) + eval( orhs_ ), j );
10566 column( osres_ , j ) += column( eval( lhs_ ) + eval( orhs_ ), j );
10567 column( refres_, j ) += column( eval( reflhs_ ) + eval( refrhs_ ), j );
10568 }
10569 }
10570 catch( std::exception& ex ) {
10571 convertException<MT1,OMT2>( ex );
10572 }
10573
10574 checkResults<MT1,OMT2>();
10575
10576 try {
10577 initResults();
10578 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10579 column( dres_ , j ) += column( eval( olhs_ ) + eval( rhs_ ), j );
10580 column( odres_ , j ) += column( eval( olhs_ ) + eval( rhs_ ), j );
10581 column( sres_ , j ) += column( eval( olhs_ ) + eval( rhs_ ), j );
10582 column( osres_ , j ) += column( eval( olhs_ ) + eval( rhs_ ), j );
10583 column( refres_, j ) += column( eval( reflhs_ ) + eval( refrhs_ ), j );
10584 }
10585 }
10586 catch( std::exception& ex ) {
10587 convertException<OMT1,MT2>( ex );
10588 }
10589
10590 checkResults<OMT1,MT2>();
10591
10592 try {
10593 initResults();
10594 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10595 column( dres_ , j ) += column( eval( olhs_ ) + eval( orhs_ ), j );
10596 column( odres_ , j ) += column( eval( olhs_ ) + eval( orhs_ ), j );
10597 column( sres_ , j ) += column( eval( olhs_ ) + eval( orhs_ ), j );
10598 column( osres_ , j ) += column( eval( olhs_ ) + eval( orhs_ ), j );
10599 column( refres_, j ) += column( eval( reflhs_ ) + eval( refrhs_ ), j );
10600 }
10601 }
10602 catch( std::exception& ex ) {
10603 convertException<OMT1,OMT2>( ex );
10604 }
10605
10606 checkResults<OMT1,OMT2>();
10607 }
10608
10609
10610 //=====================================================================================
10611 // Column-wise addition with subtraction assignment
10612 //=====================================================================================
10613
10614 // Column-wise addition with subtraction assignment with the given matrices
10615 {
10616 test_ = "Column-wise addition with subtraction assignment with the given matrices";
10617 error_ = "Failed subtraction assignment operation";
10618
10619 try {
10620 initResults();
10621 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10622 column( dres_ , j ) -= column( lhs_ + rhs_, j );
10623 column( odres_ , j ) -= column( lhs_ + rhs_, j );
10624 column( sres_ , j ) -= column( lhs_ + rhs_, j );
10625 column( osres_ , j ) -= column( lhs_ + rhs_, j );
10626 column( refres_, j ) -= column( reflhs_ + refrhs_, j );
10627 }
10628 }
10629 catch( std::exception& ex ) {
10630 convertException<MT1,MT2>( ex );
10631 }
10632
10633 checkResults<MT1,MT2>();
10634
10635 try {
10636 initResults();
10637 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10638 column( dres_ , j ) -= column( lhs_ + orhs_, j );
10639 column( odres_ , j ) -= column( lhs_ + orhs_, j );
10640 column( sres_ , j ) -= column( lhs_ + orhs_, j );
10641 column( osres_ , j ) -= column( lhs_ + orhs_, j );
10642 column( refres_, j ) -= column( reflhs_ + refrhs_, j );
10643 }
10644 }
10645 catch( std::exception& ex ) {
10646 convertException<MT1,OMT2>( ex );
10647 }
10648
10649 checkResults<MT1,OMT2>();
10650
10651 try {
10652 initResults();
10653 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10654 column( dres_ , j ) -= column( olhs_ + rhs_, j );
10655 column( odres_ , j ) -= column( olhs_ + rhs_, j );
10656 column( sres_ , j ) -= column( olhs_ + rhs_, j );
10657 column( osres_ , j ) -= column( olhs_ + rhs_, j );
10658 column( refres_, j ) -= column( reflhs_ + refrhs_, j );
10659 }
10660 }
10661 catch( std::exception& ex ) {
10662 convertException<OMT1,MT2>( ex );
10663 }
10664
10665 checkResults<OMT1,MT2>();
10666
10667 try {
10668 initResults();
10669 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10670 column( dres_ , j ) -= column( olhs_ + orhs_, j );
10671 column( odres_ , j ) -= column( olhs_ + orhs_, j );
10672 column( sres_ , j ) -= column( olhs_ + orhs_, j );
10673 column( osres_ , j ) -= column( olhs_ + orhs_, j );
10674 column( refres_, j ) -= column( reflhs_ + refrhs_, j );
10675 }
10676 }
10677 catch( std::exception& ex ) {
10678 convertException<OMT1,OMT2>( ex );
10679 }
10680
10681 checkResults<OMT1,OMT2>();
10682 }
10683
10684 // Column-wise addition with subtraction assignment with evaluated matrices
10685 {
10686 test_ = "Column-wise addition with subtraction assignment with evaluated matrices";
10687 error_ = "Failed subtraction assignment operation";
10688
10689 try {
10690 initResults();
10691 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10692 column( dres_ , j ) -= column( eval( lhs_ ) + eval( rhs_ ), j );
10693 column( odres_ , j ) -= column( eval( lhs_ ) + eval( rhs_ ), j );
10694 column( sres_ , j ) -= column( eval( lhs_ ) + eval( rhs_ ), j );
10695 column( osres_ , j ) -= column( eval( lhs_ ) + eval( rhs_ ), j );
10696 column( refres_, j ) -= column( eval( reflhs_ ) + eval( refrhs_ ), j );
10697 }
10698 }
10699 catch( std::exception& ex ) {
10700 convertException<MT1,MT2>( ex );
10701 }
10702
10703 checkResults<MT1,MT2>();
10704
10705 try {
10706 initResults();
10707 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10708 column( dres_ , j ) -= column( eval( lhs_ ) + eval( orhs_ ), j );
10709 column( odres_ , j ) -= column( eval( lhs_ ) + eval( orhs_ ), j );
10710 column( sres_ , j ) -= column( eval( lhs_ ) + eval( orhs_ ), j );
10711 column( osres_ , j ) -= column( eval( lhs_ ) + eval( orhs_ ), j );
10712 column( refres_, j ) -= column( eval( reflhs_ ) + eval( refrhs_ ), j );
10713 }
10714 }
10715 catch( std::exception& ex ) {
10716 convertException<MT1,OMT2>( ex );
10717 }
10718
10719 checkResults<MT1,OMT2>();
10720
10721 try {
10722 initResults();
10723 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10724 column( dres_ , j ) -= column( eval( olhs_ ) + eval( rhs_ ), j );
10725 column( odres_ , j ) -= column( eval( olhs_ ) + eval( rhs_ ), j );
10726 column( sres_ , j ) -= column( eval( olhs_ ) + eval( rhs_ ), j );
10727 column( osres_ , j ) -= column( eval( olhs_ ) + eval( rhs_ ), j );
10728 column( refres_, j ) -= column( eval( reflhs_ ) + eval( refrhs_ ), j );
10729 }
10730 }
10731 catch( std::exception& ex ) {
10732 convertException<OMT1,MT2>( ex );
10733 }
10734
10735 checkResults<OMT1,MT2>();
10736
10737 try {
10738 initResults();
10739 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10740 column( dres_ , j ) -= column( eval( olhs_ ) + eval( orhs_ ), j );
10741 column( odres_ , j ) -= column( eval( olhs_ ) + eval( orhs_ ), j );
10742 column( sres_ , j ) -= column( eval( olhs_ ) + eval( orhs_ ), j );
10743 column( osres_ , j ) -= column( eval( olhs_ ) + eval( orhs_ ), j );
10744 column( refres_, j ) -= column( eval( reflhs_ ) + eval( refrhs_ ), j );
10745 }
10746 }
10747 catch( std::exception& ex ) {
10748 convertException<OMT1,OMT2>( ex );
10749 }
10750
10751 checkResults<OMT1,OMT2>();
10752 }
10753
10754
10755 //=====================================================================================
10756 // Column-wise addition with multiplication assignment
10757 //=====================================================================================
10758
10759 // Column-wise addition with multiplication assignment with the given matrices
10760 {
10761 test_ = "Column-wise addition with multiplication assignment with the given matrices";
10762 error_ = "Failed multiplication assignment operation";
10763
10764 try {
10765 initResults();
10766 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10767 column( dres_ , j ) *= column( lhs_ + rhs_, j );
10768 column( odres_ , j ) *= column( lhs_ + rhs_, j );
10769 column( sres_ , j ) *= column( lhs_ + rhs_, j );
10770 column( osres_ , j ) *= column( lhs_ + rhs_, j );
10771 column( refres_, j ) *= column( reflhs_ + refrhs_, j );
10772 }
10773 }
10774 catch( std::exception& ex ) {
10775 convertException<MT1,MT2>( ex );
10776 }
10777
10778 checkResults<MT1,MT2>();
10779
10780 try {
10781 initResults();
10782 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10783 column( dres_ , j ) *= column( lhs_ + orhs_, j );
10784 column( odres_ , j ) *= column( lhs_ + orhs_, j );
10785 column( sres_ , j ) *= column( lhs_ + orhs_, j );
10786 column( osres_ , j ) *= column( lhs_ + orhs_, j );
10787 column( refres_, j ) *= column( reflhs_ + refrhs_, j );
10788 }
10789 }
10790 catch( std::exception& ex ) {
10791 convertException<MT1,OMT2>( ex );
10792 }
10793
10794 checkResults<MT1,OMT2>();
10795
10796 try {
10797 initResults();
10798 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10799 column( dres_ , j ) *= column( olhs_ + rhs_, j );
10800 column( odres_ , j ) *= column( olhs_ + rhs_, j );
10801 column( sres_ , j ) *= column( olhs_ + rhs_, j );
10802 column( osres_ , j ) *= column( olhs_ + rhs_, j );
10803 column( refres_, j ) *= column( reflhs_ + refrhs_, j );
10804 }
10805 }
10806 catch( std::exception& ex ) {
10807 convertException<OMT1,MT2>( ex );
10808 }
10809
10810 checkResults<OMT1,MT2>();
10811
10812 try {
10813 initResults();
10814 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10815 column( dres_ , j ) *= column( olhs_ + orhs_, j );
10816 column( odres_ , j ) *= column( olhs_ + orhs_, j );
10817 column( sres_ , j ) *= column( olhs_ + orhs_, j );
10818 column( osres_ , j ) *= column( olhs_ + orhs_, j );
10819 column( refres_, j ) *= column( reflhs_ + refrhs_, j );
10820 }
10821 }
10822 catch( std::exception& ex ) {
10823 convertException<OMT1,OMT2>( ex );
10824 }
10825
10826 checkResults<OMT1,OMT2>();
10827 }
10828
10829 // Column-wise addition with multiplication assignment with evaluated matrices
10830 {
10831 test_ = "Column-wise addition with multiplication assignment with evaluated matrices";
10832 error_ = "Failed multiplication assignment operation";
10833
10834 try {
10835 initResults();
10836 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10837 column( dres_ , j ) *= column( eval( lhs_ ) + eval( rhs_ ), j );
10838 column( odres_ , j ) *= column( eval( lhs_ ) + eval( rhs_ ), j );
10839 column( sres_ , j ) *= column( eval( lhs_ ) + eval( rhs_ ), j );
10840 column( osres_ , j ) *= column( eval( lhs_ ) + eval( rhs_ ), j );
10841 column( refres_, j ) *= column( eval( reflhs_ ) + eval( refrhs_ ), j );
10842 }
10843 }
10844 catch( std::exception& ex ) {
10845 convertException<MT1,MT2>( ex );
10846 }
10847
10848 checkResults<MT1,MT2>();
10849
10850 try {
10851 initResults();
10852 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10853 column( dres_ , j ) *= column( eval( lhs_ ) + eval( orhs_ ), j );
10854 column( odres_ , j ) *= column( eval( lhs_ ) + eval( orhs_ ), j );
10855 column( sres_ , j ) *= column( eval( lhs_ ) + eval( orhs_ ), j );
10856 column( osres_ , j ) *= column( eval( lhs_ ) + eval( orhs_ ), j );
10857 column( refres_, j ) *= column( eval( reflhs_ ) + eval( refrhs_ ), j );
10858 }
10859 }
10860 catch( std::exception& ex ) {
10861 convertException<MT1,OMT2>( ex );
10862 }
10863
10864 checkResults<MT1,OMT2>();
10865
10866 try {
10867 initResults();
10868 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10869 column( dres_ , j ) *= column( eval( olhs_ ) + eval( rhs_ ), j );
10870 column( odres_ , j ) *= column( eval( olhs_ ) + eval( rhs_ ), j );
10871 column( sres_ , j ) *= column( eval( olhs_ ) + eval( rhs_ ), j );
10872 column( osres_ , j ) *= column( eval( olhs_ ) + eval( rhs_ ), j );
10873 column( refres_, j ) *= column( eval( reflhs_ ) + eval( refrhs_ ), j );
10874 }
10875 }
10876 catch( std::exception& ex ) {
10877 convertException<OMT1,MT2>( ex );
10878 }
10879
10880 checkResults<OMT1,MT2>();
10881
10882 try {
10883 initResults();
10884 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10885 column( dres_ , j ) *= column( eval( olhs_ ) + eval( orhs_ ), j );
10886 column( odres_ , j ) *= column( eval( olhs_ ) + eval( orhs_ ), j );
10887 column( sres_ , j ) *= column( eval( olhs_ ) + eval( orhs_ ), j );
10888 column( osres_ , j ) *= column( eval( olhs_ ) + eval( orhs_ ), j );
10889 column( refres_, j ) *= column( eval( reflhs_ ) + eval( refrhs_ ), j );
10890 }
10891 }
10892 catch( std::exception& ex ) {
10893 convertException<OMT1,OMT2>( ex );
10894 }
10895
10896 checkResults<OMT1,OMT2>();
10897 }
10898
10899
10900 //=====================================================================================
10901 // Failure cases
10902 //=====================================================================================
10903
10904 // Out-of-bounds access (invalid column index)
10905 {
10906 test_ = "Out-of-bounds column construction (invalid column index)";
10907 error_ = "Setup of out-of-bounds column succeeded";
10908
10909 try {
10910 auto c = column( lhs_ + rhs_, lhs_.columns() );
10911
10912 std::ostringstream oss;
10913 oss << " Test: " << test_ << "\n"
10914 << " Error: " << error_ << "\n"
10915 << " Details:\n"
10916 << " Random seed = " << blaze::getSeed() << "\n"
10917 << " Left-hand side dense matrix type:\n"
10918 << " " << typeid( MT1 ).name() << "\n"
10919 << " Right-hand side sparse matrix type:\n"
10920 << " " << typeid( MT2 ).name() << "\n"
10921 << " Result:\n" << c << "\n";
10922 throw std::runtime_error( oss.str() );
10923 }
10924 catch( std::invalid_argument& ex ) {
10925 checkExceptionMessage( ex, "Invalid column access index" );
10926 }
10927
10928 try {
10929 auto c = column( lhs_ + orhs_, lhs_.columns() );
10930
10931 std::ostringstream oss;
10932 oss << " Test: " << test_ << "\n"
10933 << " Error: " << error_ << "\n"
10934 << " Details:\n"
10935 << " Random seed = " << blaze::getSeed() << "\n"
10936 << " Left-hand side dense matrix type:\n"
10937 << " " << typeid( MT1 ).name() << "\n"
10938 << " Right-hand side sparse matrix type:\n"
10939 << " " << typeid( OMT2 ).name() << "\n"
10940 << " Result:\n" << c << "\n";
10941 throw std::runtime_error( oss.str() );
10942 }
10943 catch( std::invalid_argument& ex ) {
10944 checkExceptionMessage( ex, "Invalid column access index" );
10945 }
10946
10947 try {
10948 auto c = column( olhs_ + rhs_, olhs_.columns() );
10949
10950 std::ostringstream oss;
10951 oss << " Test: " << test_ << "\n"
10952 << " Error: " << error_ << "\n"
10953 << " Details:\n"
10954 << " Random seed = " << blaze::getSeed() << "\n"
10955 << " Left-hand side dense matrix type:\n"
10956 << " " << typeid( OMT1 ).name() << "\n"
10957 << " Right-hand side sparse matrix type:\n"
10958 << " " << typeid( MT2 ).name() << "\n"
10959 << " Result:\n" << c << "\n";
10960 throw std::runtime_error( oss.str() );
10961 }
10962 catch( std::invalid_argument& ex ) {
10963 checkExceptionMessage( ex, "Invalid column access index" );
10964 }
10965
10966 try {
10967 auto c = column( olhs_ + orhs_, olhs_.columns() );
10968
10969 std::ostringstream oss;
10970 oss << " Test: " << test_ << "\n"
10971 << " Error: " << error_ << "\n"
10972 << " Details:\n"
10973 << " Random seed = " << blaze::getSeed() << "\n"
10974 << " Left-hand side dense matrix type:\n"
10975 << " " << typeid( OMT1 ).name() << "\n"
10976 << " Right-hand side sparse matrix type:\n"
10977 << " " << typeid( OMT2 ).name() << "\n"
10978 << " Result:\n" << c << "\n";
10979 throw std::runtime_error( oss.str() );
10980 }
10981 catch( std::invalid_argument& ex ) {
10982 checkExceptionMessage( ex, "Invalid column access index" );
10983 }
10984 }
10985 }
10986 #endif
10987 }
10988 //*************************************************************************************************
10989
10990
10991 //*************************************************************************************************
10992 /*!\brief Skipping the column-wise dense matrix/sparse matrix addition.
10993 //
10994 // \return void
10995 //
10996 // This function is called in case the column-wise matrix/matrix addition operation is not
10997 // available for the given matrix types \a MT1 and \a MT2.
10998 */
10999 template< typename MT1 // Type of the left-hand side dense matrix
11000 , typename MT2 > // Type of the right-hand side sparse matrix
testColumnOperation(blaze::FalseType)11001 void OperationTest<MT1,MT2>::testColumnOperation( blaze::FalseType )
11002 {}
11003 //*************************************************************************************************
11004
11005
11006 //*************************************************************************************************
11007 /*!\brief Testing the columns-wise dense matrix/sparse matrix addition.
11008 //
11009 // \return void
11010 // \exception std::runtime_error Addition error detected.
11011 //
11012 // This function tests the columns-wise matrix addition with plain assignment, addition assignment,
11013 // subtraction assignment, and Schur product assignment. In case any error resulting from the
11014 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is thrown.
11015 */
11016 template< typename MT1 // Type of the left-hand side dense matrix
11017 , typename MT2 > // Type of the right-hand side sparse matrix
testColumnsOperation(blaze::TrueType)11018 void OperationTest<MT1,MT2>::testColumnsOperation( blaze::TrueType )
11019 {
11020 #if BLAZETEST_MATHTEST_TEST_COLUMNS_OPERATION
11021 if( BLAZETEST_MATHTEST_TEST_COLUMNS_OPERATION > 1 )
11022 {
11023 if( lhs_.columns() == 0UL )
11024 return;
11025
11026
11027 std::vector<size_t> indices( lhs_.columns() );
11028 std::iota( indices.begin(), indices.end(), 0UL );
11029 std::random_shuffle( indices.begin(), indices.end() );
11030
11031
11032 //=====================================================================================
11033 // Columns-wise addition
11034 //=====================================================================================
11035
11036 // Columns-wise addition with the given matrices
11037 {
11038 test_ = "Columns-wise addition with the given matrices";
11039 error_ = "Failed addition operation";
11040
11041 try {
11042 initResults();
11043 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11044 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11045 columns( dres_ , &indices[index], n ) = columns( lhs_ + rhs_, &indices[index], n );
11046 columns( odres_ , &indices[index], n ) = columns( lhs_ + rhs_, &indices[index], n );
11047 columns( sres_ , &indices[index], n ) = columns( lhs_ + rhs_, &indices[index], n );
11048 columns( osres_ , &indices[index], n ) = columns( lhs_ + rhs_, &indices[index], n );
11049 columns( refres_, &indices[index], n ) = columns( reflhs_ + refrhs_, &indices[index], n );
11050 }
11051 }
11052 catch( std::exception& ex ) {
11053 convertException<MT1,MT2>( ex );
11054 }
11055
11056 checkResults<MT1,MT2>();
11057
11058 try {
11059 initResults();
11060 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11061 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11062 columns( dres_ , &indices[index], n ) = columns( lhs_ + orhs_, &indices[index], n );
11063 columns( odres_ , &indices[index], n ) = columns( lhs_ + orhs_, &indices[index], n );
11064 columns( sres_ , &indices[index], n ) = columns( lhs_ + orhs_, &indices[index], n );
11065 columns( osres_ , &indices[index], n ) = columns( lhs_ + orhs_, &indices[index], n );
11066 columns( refres_, &indices[index], n ) = columns( reflhs_ + refrhs_, &indices[index], n );
11067 }
11068 }
11069 catch( std::exception& ex ) {
11070 convertException<MT1,OMT2>( ex );
11071 }
11072
11073 checkResults<MT1,OMT2>();
11074
11075 try {
11076 initResults();
11077 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11078 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11079 columns( dres_ , &indices[index], n ) = columns( olhs_ + rhs_, &indices[index], n );
11080 columns( odres_ , &indices[index], n ) = columns( olhs_ + rhs_, &indices[index], n );
11081 columns( sres_ , &indices[index], n ) = columns( olhs_ + rhs_, &indices[index], n );
11082 columns( osres_ , &indices[index], n ) = columns( olhs_ + rhs_, &indices[index], n );
11083 columns( refres_, &indices[index], n ) = columns( reflhs_ + refrhs_, &indices[index], n );
11084 }
11085 }
11086 catch( std::exception& ex ) {
11087 convertException<OMT1,MT2>( ex );
11088 }
11089
11090 checkResults<OMT1,MT2>();
11091
11092 try {
11093 initResults();
11094 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11095 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11096 columns( dres_ , &indices[index], n ) = columns( olhs_ + orhs_, &indices[index], n );
11097 columns( odres_ , &indices[index], n ) = columns( olhs_ + orhs_, &indices[index], n );
11098 columns( sres_ , &indices[index], n ) = columns( olhs_ + orhs_, &indices[index], n );
11099 columns( osres_ , &indices[index], n ) = columns( olhs_ + orhs_, &indices[index], n );
11100 columns( refres_, &indices[index], n ) = columns( reflhs_ + refrhs_, &indices[index], n );
11101 }
11102 }
11103 catch( std::exception& ex ) {
11104 convertException<OMT1,OMT2>( ex );
11105 }
11106
11107 checkResults<OMT1,OMT2>();
11108 }
11109
11110 // Columns-wise addition with evaluated matrices
11111 {
11112 test_ = "Columns-wise addition with evaluated matrices";
11113 error_ = "Failed addition operation";
11114
11115 try {
11116 initResults();
11117 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11118 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11119 columns( dres_ , &indices[index], n ) = columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11120 columns( odres_ , &indices[index], n ) = columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11121 columns( sres_ , &indices[index], n ) = columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11122 columns( osres_ , &indices[index], n ) = columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11123 columns( refres_, &indices[index], n ) = columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11124 }
11125 }
11126 catch( std::exception& ex ) {
11127 convertException<MT1,MT2>( ex );
11128 }
11129
11130 checkResults<MT1,MT2>();
11131
11132 try {
11133 initResults();
11134 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11135 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11136 columns( dres_ , &indices[index], n ) = columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11137 columns( odres_ , &indices[index], n ) = columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11138 columns( sres_ , &indices[index], n ) = columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11139 columns( osres_ , &indices[index], n ) = columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11140 columns( refres_, &indices[index], n ) = columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11141 }
11142 }
11143 catch( std::exception& ex ) {
11144 convertException<MT1,OMT2>( ex );
11145 }
11146
11147 checkResults<MT1,OMT2>();
11148
11149 try {
11150 initResults();
11151 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11152 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11153 columns( dres_ , &indices[index], n ) = columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11154 columns( odres_ , &indices[index], n ) = columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11155 columns( sres_ , &indices[index], n ) = columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11156 columns( osres_ , &indices[index], n ) = columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11157 columns( refres_, &indices[index], n ) = columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11158 }
11159 }
11160 catch( std::exception& ex ) {
11161 convertException<OMT1,MT2>( ex );
11162 }
11163
11164 checkResults<OMT1,MT2>();
11165
11166 try {
11167 initResults();
11168 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11169 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11170 columns( dres_ , &indices[index], n ) = columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11171 columns( odres_ , &indices[index], n ) = columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11172 columns( sres_ , &indices[index], n ) = columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11173 columns( osres_ , &indices[index], n ) = columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11174 columns( refres_, &indices[index], n ) = columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11175 }
11176 }
11177 catch( std::exception& ex ) {
11178 convertException<OMT1,OMT2>( ex );
11179 }
11180
11181 checkResults<OMT1,OMT2>();
11182 }
11183
11184
11185 //=====================================================================================
11186 // Columns-wise addition with addition assignment
11187 //=====================================================================================
11188
11189 // Columns-wise addition with addition assignment with the given matrices
11190 {
11191 test_ = "Columns-wise addition with addition assignment with the given matrices";
11192 error_ = "Failed addition assignment operation";
11193
11194 try {
11195 initResults();
11196 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11197 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11198 columns( dres_ , &indices[index], n ) += columns( lhs_ + rhs_, &indices[index], n );
11199 columns( odres_ , &indices[index], n ) += columns( lhs_ + rhs_, &indices[index], n );
11200 columns( sres_ , &indices[index], n ) += columns( lhs_ + rhs_, &indices[index], n );
11201 columns( osres_ , &indices[index], n ) += columns( lhs_ + rhs_, &indices[index], n );
11202 columns( refres_, &indices[index], n ) += columns( reflhs_ + refrhs_, &indices[index], n );
11203 }
11204 }
11205 catch( std::exception& ex ) {
11206 convertException<MT1,MT2>( ex );
11207 }
11208
11209 checkResults<MT1,MT2>();
11210
11211 try {
11212 initResults();
11213 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11214 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11215 columns( dres_ , &indices[index], n ) += columns( lhs_ + orhs_, &indices[index], n );
11216 columns( odres_ , &indices[index], n ) += columns( lhs_ + orhs_, &indices[index], n );
11217 columns( sres_ , &indices[index], n ) += columns( lhs_ + orhs_, &indices[index], n );
11218 columns( osres_ , &indices[index], n ) += columns( lhs_ + orhs_, &indices[index], n );
11219 columns( refres_, &indices[index], n ) += columns( reflhs_ + refrhs_, &indices[index], n );
11220 }
11221 }
11222 catch( std::exception& ex ) {
11223 convertException<MT1,OMT2>( ex );
11224 }
11225
11226 checkResults<MT1,OMT2>();
11227
11228 try {
11229 initResults();
11230 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11231 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11232 columns( dres_ , &indices[index], n ) += columns( olhs_ + rhs_, &indices[index], n );
11233 columns( odres_ , &indices[index], n ) += columns( olhs_ + rhs_, &indices[index], n );
11234 columns( sres_ , &indices[index], n ) += columns( olhs_ + rhs_, &indices[index], n );
11235 columns( osres_ , &indices[index], n ) += columns( olhs_ + rhs_, &indices[index], n );
11236 columns( refres_, &indices[index], n ) += columns( reflhs_ + refrhs_, &indices[index], n );
11237 }
11238 }
11239 catch( std::exception& ex ) {
11240 convertException<OMT1,MT2>( ex );
11241 }
11242
11243 checkResults<OMT1,MT2>();
11244
11245 try {
11246 initResults();
11247 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11248 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11249 columns( dres_ , &indices[index], n ) += columns( olhs_ + orhs_, &indices[index], n );
11250 columns( odres_ , &indices[index], n ) += columns( olhs_ + orhs_, &indices[index], n );
11251 columns( sres_ , &indices[index], n ) += columns( olhs_ + orhs_, &indices[index], n );
11252 columns( osres_ , &indices[index], n ) += columns( olhs_ + orhs_, &indices[index], n );
11253 columns( refres_, &indices[index], n ) += columns( reflhs_ + refrhs_, &indices[index], n );
11254 }
11255 }
11256 catch( std::exception& ex ) {
11257 convertException<OMT1,OMT2>( ex );
11258 }
11259
11260 checkResults<OMT1,OMT2>();
11261 }
11262
11263 // Columns-wise addition with addition assignment with evaluated matrices
11264 {
11265 test_ = "Columns-wise addition with addition assignment with evaluated matrices";
11266 error_ = "Failed addition assignment operation";
11267
11268 try {
11269 initResults();
11270 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11271 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11272 columns( dres_ , &indices[index], n ) += columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11273 columns( odres_ , &indices[index], n ) += columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11274 columns( sres_ , &indices[index], n ) += columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11275 columns( osres_ , &indices[index], n ) += columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11276 columns( refres_, &indices[index], n ) += columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11277 }
11278 }
11279 catch( std::exception& ex ) {
11280 convertException<MT1,MT2>( ex );
11281 }
11282
11283 checkResults<MT1,MT2>();
11284
11285 try {
11286 initResults();
11287 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11288 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11289 columns( dres_ , &indices[index], n ) += columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11290 columns( odres_ , &indices[index], n ) += columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11291 columns( sres_ , &indices[index], n ) += columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11292 columns( osres_ , &indices[index], n ) += columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11293 columns( refres_, &indices[index], n ) += columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11294 }
11295 }
11296 catch( std::exception& ex ) {
11297 convertException<MT1,OMT2>( ex );
11298 }
11299
11300 checkResults<MT1,OMT2>();
11301
11302 try {
11303 initResults();
11304 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11305 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11306 columns( dres_ , &indices[index], n ) += columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11307 columns( odres_ , &indices[index], n ) += columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11308 columns( sres_ , &indices[index], n ) += columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11309 columns( osres_ , &indices[index], n ) += columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11310 columns( refres_, &indices[index], n ) += columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11311 }
11312 }
11313 catch( std::exception& ex ) {
11314 convertException<OMT1,MT2>( ex );
11315 }
11316
11317 checkResults<OMT1,MT2>();
11318
11319 try {
11320 initResults();
11321 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11322 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11323 columns( dres_ , &indices[index], n ) += columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11324 columns( odres_ , &indices[index], n ) += columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11325 columns( sres_ , &indices[index], n ) += columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11326 columns( osres_ , &indices[index], n ) += columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11327 columns( refres_, &indices[index], n ) += columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11328 }
11329 }
11330 catch( std::exception& ex ) {
11331 convertException<OMT1,OMT2>( ex );
11332 }
11333
11334 checkResults<OMT1,OMT2>();
11335 }
11336
11337
11338 //=====================================================================================
11339 // Columns-wise addition with subtraction assignment
11340 //=====================================================================================
11341
11342 // Columns-wise addition with subtraction assignment with the given matrices
11343 {
11344 test_ = "Columns-wise addition with subtraction assignment with the given matrices";
11345 error_ = "Failed subtraction assignment operation";
11346
11347 try {
11348 initResults();
11349 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11350 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11351 columns( dres_ , &indices[index], n ) -= columns( lhs_ + rhs_, &indices[index], n );
11352 columns( odres_ , &indices[index], n ) -= columns( lhs_ + rhs_, &indices[index], n );
11353 columns( sres_ , &indices[index], n ) -= columns( lhs_ + rhs_, &indices[index], n );
11354 columns( osres_ , &indices[index], n ) -= columns( lhs_ + rhs_, &indices[index], n );
11355 columns( refres_, &indices[index], n ) -= columns( reflhs_ + refrhs_, &indices[index], n );
11356 }
11357 }
11358 catch( std::exception& ex ) {
11359 convertException<MT1,MT2>( ex );
11360 }
11361
11362 checkResults<MT1,MT2>();
11363
11364 try {
11365 initResults();
11366 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11367 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11368 columns( dres_ , &indices[index], n ) -= columns( lhs_ + orhs_, &indices[index], n );
11369 columns( odres_ , &indices[index], n ) -= columns( lhs_ + orhs_, &indices[index], n );
11370 columns( sres_ , &indices[index], n ) -= columns( lhs_ + orhs_, &indices[index], n );
11371 columns( osres_ , &indices[index], n ) -= columns( lhs_ + orhs_, &indices[index], n );
11372 columns( refres_, &indices[index], n ) -= columns( reflhs_ + refrhs_, &indices[index], n );
11373 }
11374 }
11375 catch( std::exception& ex ) {
11376 convertException<MT1,OMT2>( ex );
11377 }
11378
11379 checkResults<MT1,OMT2>();
11380
11381 try {
11382 initResults();
11383 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11384 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11385 columns( dres_ , &indices[index], n ) -= columns( olhs_ + rhs_, &indices[index], n );
11386 columns( odres_ , &indices[index], n ) -= columns( olhs_ + rhs_, &indices[index], n );
11387 columns( sres_ , &indices[index], n ) -= columns( olhs_ + rhs_, &indices[index], n );
11388 columns( osres_ , &indices[index], n ) -= columns( olhs_ + rhs_, &indices[index], n );
11389 columns( refres_, &indices[index], n ) -= columns( reflhs_ + refrhs_, &indices[index], n );
11390 }
11391 }
11392 catch( std::exception& ex ) {
11393 convertException<OMT1,MT2>( ex );
11394 }
11395
11396 checkResults<OMT1,MT2>();
11397
11398 try {
11399 initResults();
11400 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11401 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11402 columns( dres_ , &indices[index], n ) -= columns( olhs_ + orhs_, &indices[index], n );
11403 columns( odres_ , &indices[index], n ) -= columns( olhs_ + orhs_, &indices[index], n );
11404 columns( sres_ , &indices[index], n ) -= columns( olhs_ + orhs_, &indices[index], n );
11405 columns( osres_ , &indices[index], n ) -= columns( olhs_ + orhs_, &indices[index], n );
11406 columns( refres_, &indices[index], n ) -= columns( reflhs_ + refrhs_, &indices[index], n );
11407 }
11408 }
11409 catch( std::exception& ex ) {
11410 convertException<OMT1,OMT2>( ex );
11411 }
11412
11413 checkResults<OMT1,OMT2>();
11414 }
11415
11416 // Columns-wise addition with subtraction assignment with evaluated matrices
11417 {
11418 test_ = "Columns-wise addition with subtraction assignment with evaluated matrices";
11419 error_ = "Failed subtraction assignment operation";
11420
11421 try {
11422 initResults();
11423 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11424 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11425 columns( dres_ , &indices[index], n ) -= columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11426 columns( odres_ , &indices[index], n ) -= columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11427 columns( sres_ , &indices[index], n ) -= columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11428 columns( osres_ , &indices[index], n ) -= columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11429 columns( refres_, &indices[index], n ) -= columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11430 }
11431 }
11432 catch( std::exception& ex ) {
11433 convertException<MT1,MT2>( ex );
11434 }
11435
11436 checkResults<MT1,MT2>();
11437
11438 try {
11439 initResults();
11440 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11441 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11442 columns( dres_ , &indices[index], n ) -= columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11443 columns( odres_ , &indices[index], n ) -= columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11444 columns( sres_ , &indices[index], n ) -= columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11445 columns( osres_ , &indices[index], n ) -= columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11446 columns( refres_, &indices[index], n ) -= columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11447 }
11448 }
11449 catch( std::exception& ex ) {
11450 convertException<MT1,OMT2>( ex );
11451 }
11452
11453 checkResults<MT1,OMT2>();
11454
11455 try {
11456 initResults();
11457 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11458 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11459 columns( dres_ , &indices[index], n ) -= columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11460 columns( odres_ , &indices[index], n ) -= columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11461 columns( sres_ , &indices[index], n ) -= columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11462 columns( osres_ , &indices[index], n ) -= columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11463 columns( refres_, &indices[index], n ) -= columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11464 }
11465 }
11466 catch( std::exception& ex ) {
11467 convertException<OMT1,MT2>( ex );
11468 }
11469
11470 checkResults<OMT1,MT2>();
11471
11472 try {
11473 initResults();
11474 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11475 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11476 columns( dres_ , &indices[index], n ) -= columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11477 columns( odres_ , &indices[index], n ) -= columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11478 columns( sres_ , &indices[index], n ) -= columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11479 columns( osres_ , &indices[index], n ) -= columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11480 columns( refres_, &indices[index], n ) -= columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11481 }
11482 }
11483 catch( std::exception& ex ) {
11484 convertException<OMT1,OMT2>( ex );
11485 }
11486
11487 checkResults<OMT1,OMT2>();
11488 }
11489
11490
11491 //=====================================================================================
11492 // Columns-wise addition with Schur product assignment
11493 //=====================================================================================
11494
11495 // Columns-wise addition with Schur product assignment with the given matrices
11496 {
11497 test_ = "Columns-wise addition with Schur product assignment with the given matrices";
11498 error_ = "Failed Schur product assignment operation";
11499
11500 try {
11501 initResults();
11502 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11503 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11504 columns( dres_ , &indices[index], n ) %= columns( lhs_ + rhs_, &indices[index], n );
11505 columns( odres_ , &indices[index], n ) %= columns( lhs_ + rhs_, &indices[index], n );
11506 columns( sres_ , &indices[index], n ) %= columns( lhs_ + rhs_, &indices[index], n );
11507 columns( osres_ , &indices[index], n ) %= columns( lhs_ + rhs_, &indices[index], n );
11508 columns( refres_, &indices[index], n ) %= columns( reflhs_ + refrhs_, &indices[index], n );
11509 }
11510 }
11511 catch( std::exception& ex ) {
11512 convertException<MT1,MT2>( ex );
11513 }
11514
11515 checkResults<MT1,MT2>();
11516
11517 try {
11518 initResults();
11519 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11520 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11521 columns( dres_ , &indices[index], n ) %= columns( lhs_ + orhs_, &indices[index], n );
11522 columns( odres_ , &indices[index], n ) %= columns( lhs_ + orhs_, &indices[index], n );
11523 columns( sres_ , &indices[index], n ) %= columns( lhs_ + orhs_, &indices[index], n );
11524 columns( osres_ , &indices[index], n ) %= columns( lhs_ + orhs_, &indices[index], n );
11525 columns( refres_, &indices[index], n ) %= columns( reflhs_ + refrhs_, &indices[index], n );
11526 }
11527 }
11528 catch( std::exception& ex ) {
11529 convertException<MT1,OMT2>( ex );
11530 }
11531
11532 checkResults<MT1,OMT2>();
11533
11534 try {
11535 initResults();
11536 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11537 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11538 columns( dres_ , &indices[index], n ) %= columns( olhs_ + rhs_, &indices[index], n );
11539 columns( odres_ , &indices[index], n ) %= columns( olhs_ + rhs_, &indices[index], n );
11540 columns( sres_ , &indices[index], n ) %= columns( olhs_ + rhs_, &indices[index], n );
11541 columns( osres_ , &indices[index], n ) %= columns( olhs_ + rhs_, &indices[index], n );
11542 columns( refres_, &indices[index], n ) %= columns( reflhs_ + refrhs_, &indices[index], n );
11543 }
11544 }
11545 catch( std::exception& ex ) {
11546 convertException<OMT1,MT2>( ex );
11547 }
11548
11549 checkResults<OMT1,MT2>();
11550
11551 try {
11552 initResults();
11553 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11554 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11555 columns( dres_ , &indices[index], n ) %= columns( olhs_ + orhs_, &indices[index], n );
11556 columns( odres_ , &indices[index], n ) %= columns( olhs_ + orhs_, &indices[index], n );
11557 columns( sres_ , &indices[index], n ) %= columns( olhs_ + orhs_, &indices[index], n );
11558 columns( osres_ , &indices[index], n ) %= columns( olhs_ + orhs_, &indices[index], n );
11559 columns( refres_, &indices[index], n ) %= columns( reflhs_ + refrhs_, &indices[index], n );
11560 }
11561 }
11562 catch( std::exception& ex ) {
11563 convertException<OMT1,OMT2>( ex );
11564 }
11565
11566 checkResults<OMT1,OMT2>();
11567 }
11568
11569 // Columns-wise addition with Schur product assignment with evaluated matrices
11570 {
11571 test_ = "Columns-wise addition with Schur product assignment with evaluated matrices";
11572 error_ = "Failed Schur product assignment operation";
11573
11574 try {
11575 initResults();
11576 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11577 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11578 columns( dres_ , &indices[index], n ) %= columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11579 columns( odres_ , &indices[index], n ) %= columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11580 columns( sres_ , &indices[index], n ) %= columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11581 columns( osres_ , &indices[index], n ) %= columns( eval( lhs_ ) + eval( rhs_ ), &indices[index], n );
11582 columns( refres_, &indices[index], n ) %= columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11583 }
11584 }
11585 catch( std::exception& ex ) {
11586 convertException<MT1,MT2>( ex );
11587 }
11588
11589 checkResults<MT1,MT2>();
11590
11591 try {
11592 initResults();
11593 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11594 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11595 columns( dres_ , &indices[index], n ) %= columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11596 columns( odres_ , &indices[index], n ) %= columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11597 columns( sres_ , &indices[index], n ) %= columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11598 columns( osres_ , &indices[index], n ) %= columns( eval( lhs_ ) + eval( orhs_ ), &indices[index], n );
11599 columns( refres_, &indices[index], n ) %= columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11600 }
11601 }
11602 catch( std::exception& ex ) {
11603 convertException<MT1,OMT2>( ex );
11604 }
11605
11606 checkResults<MT1,OMT2>();
11607
11608 try {
11609 initResults();
11610 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11611 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11612 columns( dres_ , &indices[index], n ) %= columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11613 columns( odres_ , &indices[index], n ) %= columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11614 columns( sres_ , &indices[index], n ) %= columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11615 columns( osres_ , &indices[index], n ) %= columns( eval( olhs_ ) + eval( rhs_ ), &indices[index], n );
11616 columns( refres_, &indices[index], n ) %= columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11617 }
11618 }
11619 catch( std::exception& ex ) {
11620 convertException<OMT1,MT2>( ex );
11621 }
11622
11623 checkResults<OMT1,MT2>();
11624
11625 try {
11626 initResults();
11627 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11628 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11629 columns( dres_ , &indices[index], n ) %= columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11630 columns( odres_ , &indices[index], n ) %= columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11631 columns( sres_ , &indices[index], n ) %= columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11632 columns( osres_ , &indices[index], n ) %= columns( eval( olhs_ ) + eval( orhs_ ), &indices[index], n );
11633 columns( refres_, &indices[index], n ) %= columns( eval( reflhs_ ) + eval( refrhs_ ), &indices[index], n );
11634 }
11635 }
11636 catch( std::exception& ex ) {
11637 convertException<OMT1,OMT2>( ex );
11638 }
11639
11640 checkResults<OMT1,OMT2>();
11641 }
11642
11643
11644 //=====================================================================================
11645 // Failure cases
11646 //=====================================================================================
11647
11648 // Out-of-bounds access (invalid column index; initializer_list)
11649 {
11650 test_ = "Out-of-bounds column selection construction (invalid column index; initializer_list)";
11651 error_ = "Setup of out-of-bounds column selection succeeded";
11652
11653 try {
11654 auto c = columns( lhs_ + rhs_, { lhs_.columns() } );
11655
11656 std::ostringstream oss;
11657 oss << " Test: " << test_ << "\n"
11658 << " Error: " << error_ << "\n"
11659 << " Details:\n"
11660 << " Random seed = " << blaze::getSeed() << "\n"
11661 << " Left-hand side dense matrix type:\n"
11662 << " " << typeid( MT1 ).name() << "\n"
11663 << " Right-hand side sparse matrix type:\n"
11664 << " " << typeid( MT2 ).name() << "\n"
11665 << " Result:\n" << c << "\n";
11666 throw std::runtime_error( oss.str() );
11667 }
11668 catch( std::invalid_argument& ex ) {
11669 checkExceptionMessage( ex, "Invalid column access index" );
11670 }
11671
11672 try {
11673 auto c = columns( lhs_ + orhs_, { lhs_.columns() } );
11674
11675 std::ostringstream oss;
11676 oss << " Test: " << test_ << "\n"
11677 << " Error: " << error_ << "\n"
11678 << " Details:\n"
11679 << " Random seed = " << blaze::getSeed() << "\n"
11680 << " Left-hand side dense matrix type:\n"
11681 << " " << typeid( MT1 ).name() << "\n"
11682 << " Right-hand side sparse matrix type:\n"
11683 << " " << typeid( OMT2 ).name() << "\n"
11684 << " Result:\n" << c << "\n";
11685 throw std::runtime_error( oss.str() );
11686 }
11687 catch( std::invalid_argument& ex ) {
11688 checkExceptionMessage( ex, "Invalid column access index" );
11689 }
11690
11691 try {
11692 auto c = columns( olhs_ + rhs_, { olhs_.columns() } );
11693
11694 std::ostringstream oss;
11695 oss << " Test: " << test_ << "\n"
11696 << " Error: " << error_ << "\n"
11697 << " Details:\n"
11698 << " Random seed = " << blaze::getSeed() << "\n"
11699 << " Left-hand side dense matrix type:\n"
11700 << " " << typeid( OMT1 ).name() << "\n"
11701 << " Right-hand side sparse matrix type:\n"
11702 << " " << typeid( MT2 ).name() << "\n"
11703 << " Result:\n" << c << "\n";
11704 throw std::runtime_error( oss.str() );
11705 }
11706 catch( std::invalid_argument& ex ) {
11707 checkExceptionMessage( ex, "Invalid column access index" );
11708 }
11709
11710 try {
11711 auto c = columns( olhs_ + orhs_, { olhs_.columns() } );
11712
11713 std::ostringstream oss;
11714 oss << " Test: " << test_ << "\n"
11715 << " Error: " << error_ << "\n"
11716 << " Details:\n"
11717 << " Random seed = " << blaze::getSeed() << "\n"
11718 << " Left-hand side dense matrix type:\n"
11719 << " " << typeid( OMT1 ).name() << "\n"
11720 << " Right-hand side sparse matrix type:\n"
11721 << " " << typeid( OMT2 ).name() << "\n"
11722 << " Result:\n" << c << "\n";
11723 throw std::runtime_error( oss.str() );
11724 }
11725 catch( std::invalid_argument& ex ) {
11726 checkExceptionMessage( ex, "Invalid column access index" );
11727 }
11728 }
11729
11730 // Out-of-bounds access (invalid column index; lambda)
11731 {
11732 test_ = "Out-of-bounds column selection construction (invalid column index; lambda)";
11733 error_ = "Setup of out-of-bounds column selection succeeded";
11734
11735 try {
11736 auto c = columns( lhs_ + rhs_, [index=lhs_.columns()]( size_t ){ return index; }, 1UL );
11737
11738 std::ostringstream oss;
11739 oss << " Test: " << test_ << "\n"
11740 << " Error: " << error_ << "\n"
11741 << " Details:\n"
11742 << " Random seed = " << blaze::getSeed() << "\n"
11743 << " Left-hand side dense matrix type:\n"
11744 << " " << typeid( MT1 ).name() << "\n"
11745 << " Right-hand side sparse matrix type:\n"
11746 << " " << typeid( MT2 ).name() << "\n"
11747 << " Result:\n" << c << "\n";
11748 throw std::runtime_error( oss.str() );
11749 }
11750 catch( std::invalid_argument& ex ) {
11751 checkExceptionMessage( ex, "Invalid column access index" );
11752 }
11753
11754 try {
11755 auto c = columns( lhs_ + orhs_, [index=lhs_.columns()]( size_t ){ return index; }, 1UL );
11756
11757 std::ostringstream oss;
11758 oss << " Test: " << test_ << "\n"
11759 << " Error: " << error_ << "\n"
11760 << " Details:\n"
11761 << " Random seed = " << blaze::getSeed() << "\n"
11762 << " Left-hand side dense matrix type:\n"
11763 << " " << typeid( MT1 ).name() << "\n"
11764 << " Right-hand side sparse matrix type:\n"
11765 << " " << typeid( OMT2 ).name() << "\n"
11766 << " Result:\n" << c << "\n";
11767 throw std::runtime_error( oss.str() );
11768 }
11769 catch( std::invalid_argument& ex ) {
11770 checkExceptionMessage( ex, "Invalid column access index" );
11771 }
11772
11773 try {
11774 auto c = columns( olhs_ + rhs_, [index=olhs_.columns()]( size_t ){ return index; }, 1UL );
11775
11776 std::ostringstream oss;
11777 oss << " Test: " << test_ << "\n"
11778 << " Error: " << error_ << "\n"
11779 << " Details:\n"
11780 << " Random seed = " << blaze::getSeed() << "\n"
11781 << " Left-hand side dense matrix type:\n"
11782 << " " << typeid( OMT1 ).name() << "\n"
11783 << " Right-hand side sparse matrix type:\n"
11784 << " " << typeid( MT2 ).name() << "\n"
11785 << " Result:\n" << c << "\n";
11786 throw std::runtime_error( oss.str() );
11787 }
11788 catch( std::invalid_argument& ex ) {
11789 checkExceptionMessage( ex, "Invalid column access index" );
11790 }
11791
11792 try {
11793 auto c = columns( olhs_ + orhs_, [index=olhs_.columns()]( size_t ){ return index; }, 1UL );
11794
11795 std::ostringstream oss;
11796 oss << " Test: " << test_ << "\n"
11797 << " Error: " << error_ << "\n"
11798 << " Details:\n"
11799 << " Random seed = " << blaze::getSeed() << "\n"
11800 << " Left-hand side dense matrix type:\n"
11801 << " " << typeid( OMT1 ).name() << "\n"
11802 << " Right-hand side sparse matrix type:\n"
11803 << " " << typeid( OMT2 ).name() << "\n"
11804 << " Result:\n" << c << "\n";
11805 throw std::runtime_error( oss.str() );
11806 }
11807 catch( std::invalid_argument& ex ) {
11808 checkExceptionMessage( ex, "Invalid column access index" );
11809 }
11810 }
11811 }
11812 #endif
11813 }
11814 //*************************************************************************************************
11815
11816
11817 //*************************************************************************************************
11818 /*!\brief Skipping the columns-wise dense matrix/sparse matrix addition.
11819 //
11820 // \return void
11821 //
11822 // This function is called in case the columns-wise matrix/matrix addition operation is not
11823 // available for the given matrix types \a MT1 and \a MT2.
11824 */
11825 template< typename MT1 // Type of the left-hand side dense matrix
11826 , typename MT2 > // Type of the right-hand side sparse matrix
testColumnsOperation(blaze::FalseType)11827 void OperationTest<MT1,MT2>::testColumnsOperation( blaze::FalseType )
11828 {}
11829 //*************************************************************************************************
11830
11831
11832 //*************************************************************************************************
11833 /*!\brief Testing the band-wise dense matrix/sparse matrix addition.
11834 //
11835 // \return void
11836 // \exception std::runtime_error Addition error detected.
11837 //
11838 // This function tests the band-wise matrix addition with plain assignment, addition assignment,
11839 // subtraction assignment, and multiplication assignment. In case any error resulting from the
11840 // addition or the subsequent assignment is detected, a \a std::runtime_error exception is thrown.
11841 */
11842 template< typename MT1 // Type of the left-hand side dense matrix
11843 , typename MT2 > // Type of the right-hand side sparse matrix
testBandOperation(blaze::TrueType)11844 void OperationTest<MT1,MT2>::testBandOperation( blaze::TrueType )
11845 {
11846 #if BLAZETEST_MATHTEST_TEST_BAND_OPERATION
11847 if( BLAZETEST_MATHTEST_TEST_BAND_OPERATION > 1 )
11848 {
11849 if( lhs_.rows() == 0UL || lhs_.columns() == 0UL )
11850 return;
11851
11852
11853 const ptrdiff_t ibegin( 1UL - lhs_.rows() );
11854 const ptrdiff_t iend ( lhs_.columns() );
11855
11856
11857 //=====================================================================================
11858 // Band-wise addition
11859 //=====================================================================================
11860
11861 // Band-wise addition with the given matrices
11862 {
11863 test_ = "Band-wise addition with the given matrices";
11864 error_ = "Failed addition operation";
11865
11866 try {
11867 initResults();
11868 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11869 band( dres_ , i ) = band( lhs_ + rhs_, i );
11870 band( odres_ , i ) = band( lhs_ + rhs_, i );
11871 band( sres_ , i ) = band( lhs_ + rhs_, i );
11872 band( osres_ , i ) = band( lhs_ + rhs_, i );
11873 band( refres_, i ) = band( reflhs_ + refrhs_, i );
11874 }
11875 }
11876 catch( std::exception& ex ) {
11877 convertException<MT1,MT2>( ex );
11878 }
11879
11880 checkResults<MT1,MT2>();
11881
11882 try {
11883 initResults();
11884 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11885 band( dres_ , i ) = band( lhs_ + orhs_, i );
11886 band( odres_ , i ) = band( lhs_ + orhs_, i );
11887 band( sres_ , i ) = band( lhs_ + orhs_, i );
11888 band( osres_ , i ) = band( lhs_ + orhs_, i );
11889 band( refres_, i ) = band( reflhs_ + refrhs_, i );
11890 }
11891 }
11892 catch( std::exception& ex ) {
11893 convertException<MT1,OMT2>( ex );
11894 }
11895
11896 checkResults<MT1,OMT2>();
11897
11898 try {
11899 initResults();
11900 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11901 band( dres_ , i ) = band( olhs_ + rhs_, i );
11902 band( odres_ , i ) = band( olhs_ + rhs_, i );
11903 band( sres_ , i ) = band( olhs_ + rhs_, i );
11904 band( osres_ , i ) = band( olhs_ + rhs_, i );
11905 band( refres_, i ) = band( reflhs_ + refrhs_, i );
11906 }
11907 }
11908 catch( std::exception& ex ) {
11909 convertException<OMT1,MT2>( ex );
11910 }
11911
11912 checkResults<OMT1,MT2>();
11913
11914 try {
11915 initResults();
11916 for( size_t i=ibegin; i<iend; ++i ) {
11917 band( dres_ , i ) = band( olhs_ + orhs_, i );
11918 band( odres_ , i ) = band( olhs_ + orhs_, i );
11919 band( sres_ , i ) = band( olhs_ + orhs_, i );
11920 band( osres_ , i ) = band( olhs_ + orhs_, i );
11921 band( refres_, i ) = band( reflhs_ + refrhs_, i );
11922 }
11923 }
11924 catch( std::exception& ex ) {
11925 convertException<OMT1,OMT2>( ex );
11926 }
11927
11928 checkResults<OMT1,OMT2>();
11929 }
11930
11931 // Band-wise addition with evaluated matrices
11932 {
11933 test_ = "Band-wise addition with evaluated matrices";
11934 error_ = "Failed addition operation";
11935
11936 try {
11937 initResults();
11938 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11939 band( dres_ , i ) = band( eval( lhs_ ) + eval( rhs_ ), i );
11940 band( odres_ , i ) = band( eval( lhs_ ) + eval( rhs_ ), i );
11941 band( sres_ , i ) = band( eval( lhs_ ) + eval( rhs_ ), i );
11942 band( osres_ , i ) = band( eval( lhs_ ) + eval( rhs_ ), i );
11943 band( refres_, i ) = band( eval( reflhs_ ) + eval( refrhs_ ), i );
11944 }
11945 }
11946 catch( std::exception& ex ) {
11947 convertException<MT1,MT2>( ex );
11948 }
11949
11950 checkResults<MT1,MT2>();
11951
11952 try {
11953 initResults();
11954 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11955 band( dres_ , i ) = band( eval( lhs_ ) + eval( orhs_ ), i );
11956 band( odres_ , i ) = band( eval( lhs_ ) + eval( orhs_ ), i );
11957 band( sres_ , i ) = band( eval( lhs_ ) + eval( orhs_ ), i );
11958 band( osres_ , i ) = band( eval( lhs_ ) + eval( orhs_ ), i );
11959 band( refres_, i ) = band( eval( reflhs_ ) + eval( refrhs_ ), i );
11960 }
11961 }
11962 catch( std::exception& ex ) {
11963 convertException<MT1,OMT2>( ex );
11964 }
11965
11966 checkResults<MT1,OMT2>();
11967
11968 try {
11969 initResults();
11970 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11971 band( dres_ , i ) = band( eval( olhs_ ) + eval( rhs_ ), i );
11972 band( odres_ , i ) = band( eval( olhs_ ) + eval( rhs_ ), i );
11973 band( sres_ , i ) = band( eval( olhs_ ) + eval( rhs_ ), i );
11974 band( osres_ , i ) = band( eval( olhs_ ) + eval( rhs_ ), i );
11975 band( refres_, i ) = band( eval( reflhs_ ) + eval( refrhs_ ), i );
11976 }
11977 }
11978 catch( std::exception& ex ) {
11979 convertException<OMT1,MT2>( ex );
11980 }
11981
11982 checkResults<OMT1,MT2>();
11983
11984 try {
11985 initResults();
11986 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11987 band( dres_ , i ) = band( eval( olhs_ ) + eval( orhs_ ), i );
11988 band( odres_ , i ) = band( eval( olhs_ ) + eval( orhs_ ), i );
11989 band( sres_ , i ) = band( eval( olhs_ ) + eval( orhs_ ), i );
11990 band( osres_ , i ) = band( eval( olhs_ ) + eval( orhs_ ), i );
11991 band( refres_, i ) = band( eval( reflhs_ ) + eval( refrhs_ ), i );
11992 }
11993 }
11994 catch( std::exception& ex ) {
11995 convertException<OMT1,OMT2>( ex );
11996 }
11997
11998 checkResults<OMT1,OMT2>();
11999 }
12000
12001
12002 //=====================================================================================
12003 // Band-wise addition with addition assignment
12004 //=====================================================================================
12005
12006 // Band-wise addition with addition assignment with the given matrices
12007 {
12008 test_ = "Band-wise addition with addition assignment with the given matrices";
12009 error_ = "Failed addition assignment operation";
12010
12011 try {
12012 initResults();
12013 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12014 band( dres_ , i ) += band( lhs_ + rhs_, i );
12015 band( odres_ , i ) += band( lhs_ + rhs_, i );
12016 band( sres_ , i ) += band( lhs_ + rhs_, i );
12017 band( osres_ , i ) += band( lhs_ + rhs_, i );
12018 band( refres_, i ) += band( reflhs_ + refrhs_, i );
12019 }
12020 }
12021 catch( std::exception& ex ) {
12022 convertException<MT1,MT2>( ex );
12023 }
12024
12025 checkResults<MT1,MT2>();
12026
12027 try {
12028 initResults();
12029 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12030 band( dres_ , i ) += band( lhs_ + orhs_, i );
12031 band( odres_ , i ) += band( lhs_ + orhs_, i );
12032 band( sres_ , i ) += band( lhs_ + orhs_, i );
12033 band( osres_ , i ) += band( lhs_ + orhs_, i );
12034 band( refres_, i ) += band( reflhs_ + refrhs_, i );
12035 }
12036 }
12037 catch( std::exception& ex ) {
12038 convertException<MT1,OMT2>( ex );
12039 }
12040
12041 checkResults<MT1,OMT2>();
12042
12043 try {
12044 initResults();
12045 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12046 band( dres_ , i ) += band( olhs_ + rhs_, i );
12047 band( odres_ , i ) += band( olhs_ + rhs_, i );
12048 band( sres_ , i ) += band( olhs_ + rhs_, i );
12049 band( osres_ , i ) += band( olhs_ + rhs_, i );
12050 band( refres_, i ) += band( reflhs_ + refrhs_, i );
12051 }
12052 }
12053 catch( std::exception& ex ) {
12054 convertException<OMT1,MT2>( ex );
12055 }
12056
12057 checkResults<OMT1,MT2>();
12058
12059 try {
12060 initResults();
12061 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12062 band( dres_ , i ) += band( olhs_ + orhs_, i );
12063 band( odres_ , i ) += band( olhs_ + orhs_, i );
12064 band( sres_ , i ) += band( olhs_ + orhs_, i );
12065 band( osres_ , i ) += band( olhs_ + orhs_, i );
12066 band( refres_, i ) += band( reflhs_ + refrhs_, i );
12067 }
12068 }
12069 catch( std::exception& ex ) {
12070 convertException<OMT1,OMT2>( ex );
12071 }
12072
12073 checkResults<OMT1,OMT2>();
12074 }
12075
12076 // Band-wise addition with addition assignment with evaluated matrices
12077 {
12078 test_ = "Band-wise addition with addition assignment with evaluated matrices";
12079 error_ = "Failed addition assignment operation";
12080
12081 try {
12082 initResults();
12083 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12084 band( dres_ , i ) += band( eval( lhs_ ) + eval( rhs_ ), i );
12085 band( odres_ , i ) += band( eval( lhs_ ) + eval( rhs_ ), i );
12086 band( sres_ , i ) += band( eval( lhs_ ) + eval( rhs_ ), i );
12087 band( osres_ , i ) += band( eval( lhs_ ) + eval( rhs_ ), i );
12088 band( refres_, i ) += band( eval( reflhs_ ) + eval( refrhs_ ), i );
12089 }
12090 }
12091 catch( std::exception& ex ) {
12092 convertException<MT1,MT2>( ex );
12093 }
12094
12095 checkResults<MT1,MT2>();
12096
12097 try {
12098 initResults();
12099 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12100 band( dres_ , i ) += band( eval( lhs_ ) + eval( orhs_ ), i );
12101 band( odres_ , i ) += band( eval( lhs_ ) + eval( orhs_ ), i );
12102 band( sres_ , i ) += band( eval( lhs_ ) + eval( orhs_ ), i );
12103 band( osres_ , i ) += band( eval( lhs_ ) + eval( orhs_ ), i );
12104 band( refres_, i ) += band( eval( reflhs_ ) + eval( refrhs_ ), i );
12105 }
12106 }
12107 catch( std::exception& ex ) {
12108 convertException<MT1,OMT2>( ex );
12109 }
12110
12111 checkResults<MT1,OMT2>();
12112
12113 try {
12114 initResults();
12115 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12116 band( dres_ , i ) += band( eval( olhs_ ) + eval( rhs_ ), i );
12117 band( odres_ , i ) += band( eval( olhs_ ) + eval( rhs_ ), i );
12118 band( sres_ , i ) += band( eval( olhs_ ) + eval( rhs_ ), i );
12119 band( osres_ , i ) += band( eval( olhs_ ) + eval( rhs_ ), i );
12120 band( refres_, i ) += band( eval( reflhs_ ) + eval( refrhs_ ), i );
12121 }
12122 }
12123 catch( std::exception& ex ) {
12124 convertException<OMT1,MT2>( ex );
12125 }
12126
12127 checkResults<OMT1,MT2>();
12128
12129 try {
12130 initResults();
12131 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12132 band( dres_ , i ) += band( eval( olhs_ ) + eval( orhs_ ), i );
12133 band( odres_ , i ) += band( eval( olhs_ ) + eval( orhs_ ), i );
12134 band( sres_ , i ) += band( eval( olhs_ ) + eval( orhs_ ), i );
12135 band( osres_ , i ) += band( eval( olhs_ ) + eval( orhs_ ), i );
12136 band( refres_, i ) += band( eval( reflhs_ ) + eval( refrhs_ ), i );
12137 }
12138 }
12139 catch( std::exception& ex ) {
12140 convertException<OMT1,OMT2>( ex );
12141 }
12142
12143 checkResults<OMT1,OMT2>();
12144 }
12145
12146
12147 //=====================================================================================
12148 // Band-wise addition with subtraction assignment
12149 //=====================================================================================
12150
12151 // Band-wise addition with subtraction assignment with the given matrices
12152 {
12153 test_ = "Band-wise addition with subtraction assignment with the given matrices";
12154 error_ = "Failed subtraction assignment operation";
12155
12156 try {
12157 initResults();
12158 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12159 band( dres_ , i ) -= band( lhs_ + rhs_, i );
12160 band( odres_ , i ) -= band( lhs_ + rhs_, i );
12161 band( sres_ , i ) -= band( lhs_ + rhs_, i );
12162 band( osres_ , i ) -= band( lhs_ + rhs_, i );
12163 band( refres_, i ) -= band( reflhs_ + refrhs_, i );
12164 }
12165 }
12166 catch( std::exception& ex ) {
12167 convertException<MT1,MT2>( ex );
12168 }
12169
12170 checkResults<MT1,MT2>();
12171
12172 try {
12173 initResults();
12174 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12175 band( dres_ , i ) -= band( lhs_ + orhs_, i );
12176 band( odres_ , i ) -= band( lhs_ + orhs_, i );
12177 band( sres_ , i ) -= band( lhs_ + orhs_, i );
12178 band( osres_ , i ) -= band( lhs_ + orhs_, i );
12179 band( refres_, i ) -= band( reflhs_ + refrhs_, i );
12180 }
12181 }
12182 catch( std::exception& ex ) {
12183 convertException<MT1,OMT2>( ex );
12184 }
12185
12186 checkResults<MT1,OMT2>();
12187
12188 try {
12189 initResults();
12190 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12191 band( dres_ , i ) -= band( olhs_ + rhs_, i );
12192 band( odres_ , i ) -= band( olhs_ + rhs_, i );
12193 band( sres_ , i ) -= band( olhs_ + rhs_, i );
12194 band( osres_ , i ) -= band( olhs_ + rhs_, i );
12195 band( refres_, i ) -= band( reflhs_ + refrhs_, i );
12196 }
12197 }
12198 catch( std::exception& ex ) {
12199 convertException<OMT1,MT2>( ex );
12200 }
12201
12202 checkResults<OMT1,MT2>();
12203
12204 try {
12205 initResults();
12206 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12207 band( dres_ , i ) -= band( olhs_ + orhs_, i );
12208 band( odres_ , i ) -= band( olhs_ + orhs_, i );
12209 band( sres_ , i ) -= band( olhs_ + orhs_, i );
12210 band( osres_ , i ) -= band( olhs_ + orhs_, i );
12211 band( refres_, i ) -= band( reflhs_ + refrhs_, i );
12212 }
12213 }
12214 catch( std::exception& ex ) {
12215 convertException<OMT1,OMT2>( ex );
12216 }
12217
12218 checkResults<OMT1,OMT2>();
12219 }
12220
12221 // Band-wise addition with subtraction assignment with evaluated matrices
12222 {
12223 test_ = "Band-wise addition with subtraction assignment with evaluated matrices";
12224 error_ = "Failed subtraction assignment operation";
12225
12226 try {
12227 initResults();
12228 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12229 band( dres_ , i ) -= band( eval( lhs_ ) + eval( rhs_ ), i );
12230 band( odres_ , i ) -= band( eval( lhs_ ) + eval( rhs_ ), i );
12231 band( sres_ , i ) -= band( eval( lhs_ ) + eval( rhs_ ), i );
12232 band( osres_ , i ) -= band( eval( lhs_ ) + eval( rhs_ ), i );
12233 band( refres_, i ) -= band( eval( reflhs_ ) + eval( refrhs_ ), i );
12234 }
12235 }
12236 catch( std::exception& ex ) {
12237 convertException<MT1,MT2>( ex );
12238 }
12239
12240 checkResults<MT1,MT2>();
12241
12242 try {
12243 initResults();
12244 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12245 band( dres_ , i ) -= band( eval( lhs_ ) + eval( orhs_ ), i );
12246 band( odres_ , i ) -= band( eval( lhs_ ) + eval( orhs_ ), i );
12247 band( sres_ , i ) -= band( eval( lhs_ ) + eval( orhs_ ), i );
12248 band( osres_ , i ) -= band( eval( lhs_ ) + eval( orhs_ ), i );
12249 band( refres_, i ) -= band( eval( reflhs_ ) + eval( refrhs_ ), i );
12250 }
12251 }
12252 catch( std::exception& ex ) {
12253 convertException<MT1,OMT2>( ex );
12254 }
12255
12256 checkResults<MT1,OMT2>();
12257
12258 try {
12259 initResults();
12260 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12261 band( dres_ , i ) -= band( eval( olhs_ ) + eval( rhs_ ), i );
12262 band( odres_ , i ) -= band( eval( olhs_ ) + eval( rhs_ ), i );
12263 band( sres_ , i ) -= band( eval( olhs_ ) + eval( rhs_ ), i );
12264 band( osres_ , i ) -= band( eval( olhs_ ) + eval( rhs_ ), i );
12265 band( refres_, i ) -= band( eval( reflhs_ ) + eval( refrhs_ ), i );
12266 }
12267 }
12268 catch( std::exception& ex ) {
12269 convertException<OMT1,MT2>( ex );
12270 }
12271
12272 checkResults<OMT1,MT2>();
12273
12274 try {
12275 initResults();
12276 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12277 band( dres_ , i ) -= band( eval( olhs_ ) + eval( orhs_ ), i );
12278 band( odres_ , i ) -= band( eval( olhs_ ) + eval( orhs_ ), i );
12279 band( sres_ , i ) -= band( eval( olhs_ ) + eval( orhs_ ), i );
12280 band( osres_ , i ) -= band( eval( olhs_ ) + eval( orhs_ ), i );
12281 band( refres_, i ) -= band( eval( reflhs_ ) + eval( refrhs_ ), i );
12282 }
12283 }
12284 catch( std::exception& ex ) {
12285 convertException<OMT1,OMT2>( ex );
12286 }
12287
12288 checkResults<OMT1,OMT2>();
12289 }
12290
12291
12292 //=====================================================================================
12293 // Band-wise addition with multiplication assignment
12294 //=====================================================================================
12295
12296 // Band-wise addition with multiplication assignment with the given matrices
12297 {
12298 test_ = "Band-wise addition with multiplication assignment with the given matrices";
12299 error_ = "Failed multiplication assignment operation";
12300
12301 try {
12302 initResults();
12303 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12304 band( dres_ , i ) *= band( lhs_ + rhs_, i );
12305 band( odres_ , i ) *= band( lhs_ + rhs_, i );
12306 band( sres_ , i ) *= band( lhs_ + rhs_, i );
12307 band( osres_ , i ) *= band( lhs_ + rhs_, i );
12308 band( refres_, i ) *= band( reflhs_ + refrhs_, i );
12309 }
12310 }
12311 catch( std::exception& ex ) {
12312 convertException<MT1,MT2>( ex );
12313 }
12314
12315 checkResults<MT1,MT2>();
12316
12317 try {
12318 initResults();
12319 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12320 band( dres_ , i ) *= band( lhs_ + orhs_, i );
12321 band( odres_ , i ) *= band( lhs_ + orhs_, i );
12322 band( sres_ , i ) *= band( lhs_ + orhs_, i );
12323 band( osres_ , i ) *= band( lhs_ + orhs_, i );
12324 band( refres_, i ) *= band( reflhs_ + refrhs_, i );
12325 }
12326 }
12327 catch( std::exception& ex ) {
12328 convertException<MT1,OMT2>( ex );
12329 }
12330
12331 checkResults<MT1,OMT2>();
12332
12333 try {
12334 initResults();
12335 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12336 band( dres_ , i ) *= band( olhs_ + rhs_, i );
12337 band( odres_ , i ) *= band( olhs_ + rhs_, i );
12338 band( sres_ , i ) *= band( olhs_ + rhs_, i );
12339 band( osres_ , i ) *= band( olhs_ + rhs_, i );
12340 band( refres_, i ) *= band( reflhs_ + refrhs_, i );
12341 }
12342 }
12343 catch( std::exception& ex ) {
12344 convertException<OMT1,MT2>( ex );
12345 }
12346
12347 checkResults<OMT1,MT2>();
12348
12349 try {
12350 initResults();
12351 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12352 band( dres_ , i ) *= band( olhs_ + orhs_, i );
12353 band( odres_ , i ) *= band( olhs_ + orhs_, i );
12354 band( sres_ , i ) *= band( olhs_ + orhs_, i );
12355 band( osres_ , i ) *= band( olhs_ + orhs_, i );
12356 band( refres_, i ) *= band( reflhs_ + refrhs_, i );
12357 }
12358 }
12359 catch( std::exception& ex ) {
12360 convertException<OMT1,OMT2>( ex );
12361 }
12362
12363 checkResults<OMT1,OMT2>();
12364 }
12365
12366 // Band-wise addition with multiplication assignment with evaluated matrices
12367 {
12368 test_ = "Band-wise addition with multiplication assignment with evaluated matrices";
12369 error_ = "Failed multiplication assignment operation";
12370
12371 try {
12372 initResults();
12373 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12374 band( dres_ , i ) *= band( eval( lhs_ ) + eval( rhs_ ), i );
12375 band( odres_ , i ) *= band( eval( lhs_ ) + eval( rhs_ ), i );
12376 band( sres_ , i ) *= band( eval( lhs_ ) + eval( rhs_ ), i );
12377 band( osres_ , i ) *= band( eval( lhs_ ) + eval( rhs_ ), i );
12378 band( refres_, i ) *= band( eval( reflhs_ ) + eval( refrhs_ ), i );
12379 }
12380 }
12381 catch( std::exception& ex ) {
12382 convertException<MT1,MT2>( ex );
12383 }
12384
12385 checkResults<MT1,MT2>();
12386
12387 try {
12388 initResults();
12389 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12390 band( dres_ , i ) *= band( eval( lhs_ ) + eval( orhs_ ), i );
12391 band( odres_ , i ) *= band( eval( lhs_ ) + eval( orhs_ ), i );
12392 band( sres_ , i ) *= band( eval( lhs_ ) + eval( orhs_ ), i );
12393 band( osres_ , i ) *= band( eval( lhs_ ) + eval( orhs_ ), i );
12394 band( refres_, i ) *= band( eval( reflhs_ ) + eval( refrhs_ ), i );
12395 }
12396 }
12397 catch( std::exception& ex ) {
12398 convertException<MT1,OMT2>( ex );
12399 }
12400
12401 checkResults<MT1,OMT2>();
12402
12403 try {
12404 initResults();
12405 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12406 band( dres_ , i ) *= band( eval( olhs_ ) + eval( rhs_ ), i );
12407 band( odres_ , i ) *= band( eval( olhs_ ) + eval( rhs_ ), i );
12408 band( sres_ , i ) *= band( eval( olhs_ ) + eval( rhs_ ), i );
12409 band( osres_ , i ) *= band( eval( olhs_ ) + eval( rhs_ ), i );
12410 band( refres_, i ) *= band( eval( reflhs_ ) + eval( refrhs_ ), i );
12411 }
12412 }
12413 catch( std::exception& ex ) {
12414 convertException<OMT1,MT2>( ex );
12415 }
12416
12417 checkResults<OMT1,MT2>();
12418
12419 try {
12420 initResults();
12421 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12422 band( dres_ , i ) *= band( eval( olhs_ ) + eval( orhs_ ), i );
12423 band( odres_ , i ) *= band( eval( olhs_ ) + eval( orhs_ ), i );
12424 band( sres_ , i ) *= band( eval( olhs_ ) + eval( orhs_ ), i );
12425 band( osres_ , i ) *= band( eval( olhs_ ) + eval( orhs_ ), i );
12426 band( refres_, i ) *= band( eval( reflhs_ ) + eval( refrhs_ ), i );
12427 }
12428 }
12429 catch( std::exception& ex ) {
12430 convertException<OMT1,OMT2>( ex );
12431 }
12432
12433 checkResults<OMT1,OMT2>();
12434 }
12435
12436
12437 //=====================================================================================
12438 // Failure cases
12439 //=====================================================================================
12440
12441 // Out-of-bounds access (invalid lower band index)
12442 {
12443 test_ = "Out-of-bounds band construction (invalid lower band index)";
12444 error_ = "Setup of out-of-bounds band succeeded";
12445
12446 try {
12447 auto b = band( lhs_ + rhs_, -lhs_.rows() );
12448
12449 std::ostringstream oss;
12450 oss << " Test: " << test_ << "\n"
12451 << " Error: " << error_ << "\n"
12452 << " Details:\n"
12453 << " Random seed = " << blaze::getSeed() << "\n"
12454 << " Left-hand side dense matrix type:\n"
12455 << " " << typeid( MT1 ).name() << "\n"
12456 << " Right-hand side sparse matrix type:\n"
12457 << " " << typeid( MT2 ).name() << "\n"
12458 << " Result:\n" << b << "\n";
12459 throw std::runtime_error( oss.str() );
12460 }
12461 catch( std::invalid_argument& ex ) {
12462 checkExceptionMessage( ex, "Invalid band access index" );
12463 }
12464
12465 try {
12466 auto b = band( lhs_ + orhs_, -lhs_.rows() );
12467
12468 std::ostringstream oss;
12469 oss << " Test: " << test_ << "\n"
12470 << " Error: " << error_ << "\n"
12471 << " Details:\n"
12472 << " Random seed = " << blaze::getSeed() << "\n"
12473 << " Left-hand side dense matrix type:\n"
12474 << " " << typeid( MT1 ).name() << "\n"
12475 << " Right-hand side sparse matrix type:\n"
12476 << " " << typeid( OMT2 ).name() << "\n"
12477 << " Result:\n" << b << "\n";
12478 throw std::runtime_error( oss.str() );
12479 }
12480 catch( std::invalid_argument& ex ) {
12481 checkExceptionMessage( ex, "Invalid band access index" );
12482 }
12483
12484 try {
12485 auto b = band( olhs_ + rhs_, -olhs_.rows() );
12486
12487 std::ostringstream oss;
12488 oss << " Test: " << test_ << "\n"
12489 << " Error: " << error_ << "\n"
12490 << " Details:\n"
12491 << " Random seed = " << blaze::getSeed() << "\n"
12492 << " Left-hand side dense matrix type:\n"
12493 << " " << typeid( OMT1 ).name() << "\n"
12494 << " Right-hand side sparse matrix type:\n"
12495 << " " << typeid( MT2 ).name() << "\n"
12496 << " Result:\n" << b << "\n";
12497 throw std::runtime_error( oss.str() );
12498 }
12499 catch( std::invalid_argument& ex ) {
12500 checkExceptionMessage( ex, "Invalid band access index" );
12501 }
12502
12503 try {
12504 auto b = band( olhs_ + orhs_, -olhs_.rows() );
12505
12506 std::ostringstream oss;
12507 oss << " Test: " << test_ << "\n"
12508 << " Error: " << error_ << "\n"
12509 << " Details:\n"
12510 << " Random seed = " << blaze::getSeed() << "\n"
12511 << " Left-hand side dense matrix type:\n"
12512 << " " << typeid( OMT1 ).name() << "\n"
12513 << " Right-hand side sparse matrix type:\n"
12514 << " " << typeid( OMT2 ).name() << "\n"
12515 << " Result:\n" << b << "\n";
12516 throw std::runtime_error( oss.str() );
12517 }
12518 catch( std::invalid_argument& ex ) {
12519 checkExceptionMessage( ex, "Invalid band access index" );
12520 }
12521 }
12522
12523 // Out-of-bounds access (invalid upper band index)
12524 {
12525 test_ = "Out-of-bounds band construction (invalid upper band index)";
12526 error_ = "Setup of out-of-bounds band succeeded";
12527
12528 try {
12529 auto b = band( lhs_ + rhs_, lhs_.columns() );
12530
12531 std::ostringstream oss;
12532 oss << " Test: " << test_ << "\n"
12533 << " Error: " << error_ << "\n"
12534 << " Details:\n"
12535 << " Random seed = " << blaze::getSeed() << "\n"
12536 << " Left-hand side dense matrix type:\n"
12537 << " " << typeid( MT1 ).name() << "\n"
12538 << " Right-hand side sparse matrix type:\n"
12539 << " " << typeid( MT2 ).name() << "\n"
12540 << " Result:\n" << b << "\n";
12541 throw std::runtime_error( oss.str() );
12542 }
12543 catch( std::invalid_argument& ex ) {
12544 checkExceptionMessage( ex, "Invalid band access index" );
12545 }
12546
12547 try {
12548 auto b = band( lhs_ + orhs_, lhs_.columns() );
12549
12550 std::ostringstream oss;
12551 oss << " Test: " << test_ << "\n"
12552 << " Error: " << error_ << "\n"
12553 << " Details:\n"
12554 << " Random seed = " << blaze::getSeed() << "\n"
12555 << " Left-hand side dense matrix type:\n"
12556 << " " << typeid( MT1 ).name() << "\n"
12557 << " Right-hand side sparse matrix type:\n"
12558 << " " << typeid( OMT2 ).name() << "\n"
12559 << " Result:\n" << b << "\n";
12560 throw std::runtime_error( oss.str() );
12561 }
12562 catch( std::invalid_argument& ex ) {
12563 checkExceptionMessage( ex, "Invalid band access index" );
12564 }
12565
12566 try {
12567 auto b = band( olhs_ + rhs_, olhs_.columns() );
12568
12569 std::ostringstream oss;
12570 oss << " Test: " << test_ << "\n"
12571 << " Error: " << error_ << "\n"
12572 << " Details:\n"
12573 << " Random seed = " << blaze::getSeed() << "\n"
12574 << " Left-hand side dense matrix type:\n"
12575 << " " << typeid( OMT1 ).name() << "\n"
12576 << " Right-hand side sparse matrix type:\n"
12577 << " " << typeid( MT2 ).name() << "\n"
12578 << " Result:\n" << b << "\n";
12579 throw std::runtime_error( oss.str() );
12580 }
12581 catch( std::invalid_argument& ex ) {
12582 checkExceptionMessage( ex, "Invalid band access index" );
12583 }
12584
12585 try {
12586 auto b = band( olhs_ + orhs_, olhs_.columns() );
12587
12588 std::ostringstream oss;
12589 oss << " Test: " << test_ << "\n"
12590 << " Error: " << error_ << "\n"
12591 << " Details:\n"
12592 << " Random seed = " << blaze::getSeed() << "\n"
12593 << " Left-hand side dense matrix type:\n"
12594 << " " << typeid( OMT1 ).name() << "\n"
12595 << " Right-hand side sparse matrix type:\n"
12596 << " " << typeid( OMT2 ).name() << "\n"
12597 << " Result:\n" << b << "\n";
12598 throw std::runtime_error( oss.str() );
12599 }
12600 catch( std::invalid_argument& ex ) {
12601 checkExceptionMessage( ex, "Invalid band access index" );
12602 }
12603 }
12604 }
12605 #endif
12606 }
12607 //*************************************************************************************************
12608
12609
12610 //*************************************************************************************************
12611 /*!\brief Skipping the band-wise dense matrix/sparse matrix addition.
12612 //
12613 // \return void
12614 //
12615 // This function is called in case the band-wise matrix/matrix addition operation is not
12616 // available for the given matrix types \a MT1 and \a MT2.
12617 */
12618 template< typename MT1 // Type of the left-hand side dense matrix
12619 , typename MT2 > // Type of the right-hand side sparse matrix
testBandOperation(blaze::FalseType)12620 void OperationTest<MT1,MT2>::testBandOperation( blaze::FalseType )
12621 {}
12622 //*************************************************************************************************
12623
12624
12625 //*************************************************************************************************
12626 /*!\brief Testing the customized dense matrix/sparse matrix addition.
12627 //
12628 // \param op The custom operation to be tested.
12629 // \param name The human-readable name of the operation.
12630 // \return void
12631 // \exception std::runtime_error Addition error detected.
12632 //
12633 // This function tests the matrix addition with plain assignment, addition assignment,
12634 // subtraction assignment, and Schur product assignment in combination with a custom operation.
12635 // In case any error resulting from the addition or the subsequent assignment is detected, a
12636 // \a std::runtime_error exception is thrown.
12637 */
12638 template< typename MT1 // Type of the left-hand side dense matrix
12639 , typename MT2 > // Type of the right-hand side sparse matrix
12640 template< typename OP > // Type of the custom operation
testCustomOperation(OP op,const std::string & name)12641 void OperationTest<MT1,MT2>::testCustomOperation( OP op, const std::string& name )
12642 {
12643 //=====================================================================================
12644 // Customized addition
12645 //=====================================================================================
12646
12647 // Customized addition with the given matrices
12648 {
12649 test_ = "Customized addition with the given matrices (" + name + ")";
12650 error_ = "Failed addition operation";
12651
12652 try {
12653 initResults();
12654 dres_ = op( lhs_ + rhs_ );
12655 odres_ = op( lhs_ + rhs_ );
12656 sres_ = op( lhs_ + rhs_ );
12657 osres_ = op( lhs_ + rhs_ );
12658 refres_ = op( reflhs_ + refrhs_ );
12659 }
12660 catch( std::exception& ex ) {
12661 convertException<MT1,MT2>( ex );
12662 }
12663
12664 checkResults<MT1,MT2>();
12665
12666 try {
12667 initResults();
12668 dres_ = op( lhs_ + orhs_ );
12669 odres_ = op( lhs_ + orhs_ );
12670 sres_ = op( lhs_ + orhs_ );
12671 osres_ = op( lhs_ + orhs_ );
12672 refres_ = op( reflhs_ + refrhs_ );
12673 }
12674 catch( std::exception& ex ) {
12675 convertException<MT1,OMT2>( ex );
12676 }
12677
12678 checkResults<MT1,OMT2>();
12679
12680 try {
12681 initResults();
12682 dres_ = op( olhs_ + rhs_ );
12683 odres_ = op( olhs_ + rhs_ );
12684 sres_ = op( olhs_ + rhs_ );
12685 osres_ = op( olhs_ + rhs_ );
12686 refres_ = op( reflhs_ + refrhs_ );
12687 }
12688 catch( std::exception& ex ) {
12689 convertException<OMT1,MT2>( ex );
12690 }
12691
12692 checkResults<OMT1,MT2>();
12693
12694 try {
12695 initResults();
12696 dres_ = op( olhs_ + orhs_ );
12697 odres_ = op( olhs_ + orhs_ );
12698 sres_ = op( olhs_ + orhs_ );
12699 osres_ = op( olhs_ + orhs_ );
12700 refres_ = op( reflhs_ + refrhs_ );
12701 }
12702 catch( std::exception& ex ) {
12703 convertException<OMT1,OMT2>( ex );
12704 }
12705
12706 checkResults<OMT1,OMT2>();
12707 }
12708
12709 // Customized addition with evaluated matrices
12710 {
12711 test_ = "Customized addition with evaluated matrices (" + name + ")";
12712 error_ = "Failed addition operation";
12713
12714 try {
12715 initResults();
12716 dres_ = op( eval( lhs_ ) + eval( rhs_ ) );
12717 odres_ = op( eval( lhs_ ) + eval( rhs_ ) );
12718 sres_ = op( eval( lhs_ ) + eval( rhs_ ) );
12719 osres_ = op( eval( lhs_ ) + eval( rhs_ ) );
12720 refres_ = op( eval( reflhs_ ) + eval( refrhs_ ) );
12721 }
12722 catch( std::exception& ex ) {
12723 convertException<MT1,MT2>( ex );
12724 }
12725
12726 checkResults<MT1,MT2>();
12727
12728 try {
12729 initResults();
12730 dres_ = op( eval( lhs_ ) + eval( orhs_ ) );
12731 odres_ = op( eval( lhs_ ) + eval( orhs_ ) );
12732 sres_ = op( eval( lhs_ ) + eval( orhs_ ) );
12733 osres_ = op( eval( lhs_ ) + eval( orhs_ ) );
12734 refres_ = op( eval( reflhs_ ) + eval( refrhs_ ) );
12735 }
12736 catch( std::exception& ex ) {
12737 convertException<MT1,OMT2>( ex );
12738 }
12739
12740 checkResults<MT1,OMT2>();
12741
12742 try {
12743 initResults();
12744 dres_ = op( eval( olhs_ ) + eval( rhs_ ) );
12745 odres_ = op( eval( olhs_ ) + eval( rhs_ ) );
12746 sres_ = op( eval( olhs_ ) + eval( rhs_ ) );
12747 osres_ = op( eval( olhs_ ) + eval( rhs_ ) );
12748 refres_ = op( eval( reflhs_ ) + eval( refrhs_ ) );
12749 }
12750 catch( std::exception& ex ) {
12751 convertException<OMT1,MT2>( ex );
12752 }
12753
12754 checkResults<OMT1,MT2>();
12755
12756 try {
12757 initResults();
12758 dres_ = op( eval( olhs_ ) + eval( orhs_ ) );
12759 odres_ = op( eval( olhs_ ) + eval( orhs_ ) );
12760 sres_ = op( eval( olhs_ ) + eval( orhs_ ) );
12761 osres_ = op( eval( olhs_ ) + eval( orhs_ ) );
12762 refres_ = op( eval( reflhs_ ) + eval( refrhs_ ) );
12763 }
12764 catch( std::exception& ex ) {
12765 convertException<OMT1,OMT2>( ex );
12766 }
12767
12768 checkResults<OMT1,OMT2>();
12769 }
12770
12771
12772 //=====================================================================================
12773 // Customized addition with addition assignment
12774 //=====================================================================================
12775
12776 // Customized addition with addition assignment with the given matrices
12777 {
12778 test_ = "Customized addition with addition assignment with the given matrices (" + name + ")";
12779 error_ = "Failed addition assignment operation";
12780
12781 try {
12782 initResults();
12783 dres_ += op( lhs_ + rhs_ );
12784 odres_ += op( lhs_ + rhs_ );
12785 sres_ += op( lhs_ + rhs_ );
12786 osres_ += op( lhs_ + rhs_ );
12787 refres_ += op( reflhs_ + refrhs_ );
12788 }
12789 catch( std::exception& ex ) {
12790 convertException<MT1,MT2>( ex );
12791 }
12792
12793 checkResults<MT1,MT2>();
12794
12795 try {
12796 initResults();
12797 dres_ += op( lhs_ + orhs_ );
12798 odres_ += op( lhs_ + orhs_ );
12799 sres_ += op( lhs_ + orhs_ );
12800 osres_ += op( lhs_ + orhs_ );
12801 refres_ += op( reflhs_ + refrhs_ );
12802 }
12803 catch( std::exception& ex ) {
12804 convertException<MT1,OMT2>( ex );
12805 }
12806
12807 checkResults<MT1,OMT2>();
12808
12809 try {
12810 initResults();
12811 dres_ += op( olhs_ + rhs_ );
12812 odres_ += op( olhs_ + rhs_ );
12813 sres_ += op( olhs_ + rhs_ );
12814 osres_ += op( olhs_ + rhs_ );
12815 refres_ += op( reflhs_ + refrhs_ );
12816 }
12817 catch( std::exception& ex ) {
12818 convertException<OMT1,MT2>( ex );
12819 }
12820
12821 checkResults<OMT1,MT2>();
12822
12823 try {
12824 initResults();
12825 dres_ += op( olhs_ + orhs_ );
12826 odres_ += op( olhs_ + orhs_ );
12827 sres_ += op( olhs_ + orhs_ );
12828 osres_ += op( olhs_ + orhs_ );
12829 refres_ += op( reflhs_ + refrhs_ );
12830 }
12831 catch( std::exception& ex ) {
12832 convertException<OMT1,OMT2>( ex );
12833 }
12834
12835 checkResults<OMT1,OMT2>();
12836 }
12837
12838 // Customized addition with addition assignment with evaluated matrices
12839 {
12840 test_ = "Customized addition with addition assignment with evaluated matrices (" + name + ")";
12841 error_ = "Failed addition assignment operation";
12842
12843 try {
12844 initResults();
12845 dres_ += op( eval( lhs_ ) + eval( rhs_ ) );
12846 odres_ += op( eval( lhs_ ) + eval( rhs_ ) );
12847 sres_ += op( eval( lhs_ ) + eval( rhs_ ) );
12848 osres_ += op( eval( lhs_ ) + eval( rhs_ ) );
12849 refres_ += op( eval( reflhs_ ) + eval( refrhs_ ) );
12850 }
12851 catch( std::exception& ex ) {
12852 convertException<MT1,MT2>( ex );
12853 }
12854
12855 checkResults<MT1,MT2>();
12856
12857 try {
12858 initResults();
12859 dres_ += op( eval( lhs_ ) + eval( orhs_ ) );
12860 odres_ += op( eval( lhs_ ) + eval( orhs_ ) );
12861 sres_ += op( eval( lhs_ ) + eval( orhs_ ) );
12862 osres_ += op( eval( lhs_ ) + eval( orhs_ ) );
12863 refres_ += op( eval( reflhs_ ) + eval( refrhs_ ) );
12864 }
12865 catch( std::exception& ex ) {
12866 convertException<MT1,OMT2>( ex );
12867 }
12868
12869 checkResults<MT1,OMT2>();
12870
12871 try {
12872 initResults();
12873 dres_ += op( eval( olhs_ ) + eval( rhs_ ) );
12874 odres_ += op( eval( olhs_ ) + eval( rhs_ ) );
12875 sres_ += op( eval( olhs_ ) + eval( rhs_ ) );
12876 osres_ += op( eval( olhs_ ) + eval( rhs_ ) );
12877 refres_ += op( eval( reflhs_ ) + eval( refrhs_ ) );
12878 }
12879 catch( std::exception& ex ) {
12880 convertException<OMT1,MT2>( ex );
12881 }
12882
12883 checkResults<OMT1,MT2>();
12884
12885 try {
12886 initResults();
12887 dres_ += op( eval( olhs_ ) + eval( orhs_ ) );
12888 odres_ += op( eval( olhs_ ) + eval( orhs_ ) );
12889 sres_ += op( eval( olhs_ ) + eval( orhs_ ) );
12890 osres_ += op( eval( olhs_ ) + eval( orhs_ ) );
12891 refres_ += op( eval( reflhs_ ) + eval( refrhs_ ) );
12892 }
12893 catch( std::exception& ex ) {
12894 convertException<OMT1,OMT2>( ex );
12895 }
12896
12897 checkResults<OMT1,OMT2>();
12898 }
12899
12900
12901 //=====================================================================================
12902 // Customized addition with subtraction assignment
12903 //=====================================================================================
12904
12905 // Customized addition with subtraction assignment with the given matrices
12906 {
12907 test_ = "Customized addition with subtraction assignment with the given matrices (" + name + ")";
12908 error_ = "Failed subtraction assignment operation";
12909
12910 try {
12911 initResults();
12912 dres_ -= op( lhs_ + rhs_ );
12913 odres_ -= op( lhs_ + rhs_ );
12914 sres_ -= op( lhs_ + rhs_ );
12915 osres_ -= op( lhs_ + rhs_ );
12916 refres_ -= op( reflhs_ + refrhs_ );
12917 }
12918 catch( std::exception& ex ) {
12919 convertException<MT1,MT2>( ex );
12920 }
12921
12922 checkResults<MT1,MT2>();
12923
12924 try {
12925 initResults();
12926 dres_ -= op( lhs_ + orhs_ );
12927 odres_ -= op( lhs_ + orhs_ );
12928 sres_ -= op( lhs_ + orhs_ );
12929 osres_ -= op( lhs_ + orhs_ );
12930 refres_ -= op( reflhs_ + refrhs_ );
12931 }
12932 catch( std::exception& ex ) {
12933 convertException<MT1,OMT2>( ex );
12934 }
12935
12936 checkResults<MT1,OMT2>();
12937
12938 try {
12939 initResults();
12940 dres_ -= op( olhs_ + rhs_ );
12941 odres_ -= op( olhs_ + rhs_ );
12942 sres_ -= op( olhs_ + rhs_ );
12943 osres_ -= op( olhs_ + rhs_ );
12944 refres_ -= op( reflhs_ + refrhs_ );
12945 }
12946 catch( std::exception& ex ) {
12947 convertException<OMT1,MT2>( ex );
12948 }
12949
12950 checkResults<OMT1,MT2>();
12951
12952 try {
12953 initResults();
12954 dres_ -= op( olhs_ + orhs_ );
12955 odres_ -= op( olhs_ + orhs_ );
12956 sres_ -= op( olhs_ + orhs_ );
12957 osres_ -= op( olhs_ + orhs_ );
12958 refres_ -= op( reflhs_ + refrhs_ );
12959 }
12960 catch( std::exception& ex ) {
12961 convertException<OMT1,OMT2>( ex );
12962 }
12963
12964 checkResults<OMT1,OMT2>();
12965 }
12966
12967 // Customized addition with subtraction assignment with evaluated matrices
12968 {
12969 test_ = "Customized addition with subtraction assignment with evaluated matrices (" + name + ")";
12970 error_ = "Failed subtraction assignment operation";
12971
12972 try {
12973 initResults();
12974 dres_ -= op( eval( lhs_ ) + eval( rhs_ ) );
12975 odres_ -= op( eval( lhs_ ) + eval( rhs_ ) );
12976 sres_ -= op( eval( lhs_ ) + eval( rhs_ ) );
12977 osres_ -= op( eval( lhs_ ) + eval( rhs_ ) );
12978 refres_ -= op( eval( reflhs_ ) + eval( refrhs_ ) );
12979 }
12980 catch( std::exception& ex ) {
12981 convertException<MT1,MT2>( ex );
12982 }
12983
12984 checkResults<MT1,MT2>();
12985
12986 try {
12987 initResults();
12988 dres_ -= op( eval( lhs_ ) + eval( orhs_ ) );
12989 odres_ -= op( eval( lhs_ ) + eval( orhs_ ) );
12990 sres_ -= op( eval( lhs_ ) + eval( orhs_ ) );
12991 osres_ -= op( eval( lhs_ ) + eval( orhs_ ) );
12992 refres_ -= op( eval( reflhs_ ) + eval( refrhs_ ) );
12993 }
12994 catch( std::exception& ex ) {
12995 convertException<MT1,OMT2>( ex );
12996 }
12997
12998 checkResults<MT1,OMT2>();
12999
13000 try {
13001 initResults();
13002 dres_ -= op( eval( olhs_ ) + eval( rhs_ ) );
13003 odres_ -= op( eval( olhs_ ) + eval( rhs_ ) );
13004 sres_ -= op( eval( olhs_ ) + eval( rhs_ ) );
13005 osres_ -= op( eval( olhs_ ) + eval( rhs_ ) );
13006 refres_ -= op( eval( reflhs_ ) + eval( refrhs_ ) );
13007 }
13008 catch( std::exception& ex ) {
13009 convertException<OMT1,MT2>( ex );
13010 }
13011
13012 checkResults<OMT1,MT2>();
13013
13014 try {
13015 initResults();
13016 dres_ -= op( eval( olhs_ ) + eval( orhs_ ) );
13017 odres_ -= op( eval( olhs_ ) + eval( orhs_ ) );
13018 sres_ -= op( eval( olhs_ ) + eval( orhs_ ) );
13019 osres_ -= op( eval( olhs_ ) + eval( orhs_ ) );
13020 refres_ -= op( eval( reflhs_ ) + eval( refrhs_ ) );
13021 }
13022 catch( std::exception& ex ) {
13023 convertException<OMT1,OMT2>( ex );
13024 }
13025
13026 checkResults<OMT1,OMT2>();
13027 }
13028
13029
13030 //=====================================================================================
13031 // Customized addition with Schur product assignment
13032 //=====================================================================================
13033
13034 // Customized addition with Schur product assignment with the given matrices
13035 {
13036 test_ = "Customized addition with Schur product assignment with the given matrices (" + name + ")";
13037 error_ = "Failed Schur product assignment operation";
13038
13039 try {
13040 initResults();
13041 dres_ %= op( lhs_ + rhs_ );
13042 odres_ %= op( lhs_ + rhs_ );
13043 sres_ %= op( lhs_ + rhs_ );
13044 osres_ %= op( lhs_ + rhs_ );
13045 refres_ %= op( reflhs_ + refrhs_ );
13046 }
13047 catch( std::exception& ex ) {
13048 convertException<MT1,MT2>( ex );
13049 }
13050
13051 checkResults<MT1,MT2>();
13052
13053 try {
13054 initResults();
13055 dres_ %= op( lhs_ + orhs_ );
13056 odres_ %= op( lhs_ + orhs_ );
13057 sres_ %= op( lhs_ + orhs_ );
13058 osres_ %= op( lhs_ + orhs_ );
13059 refres_ %= op( reflhs_ + refrhs_ );
13060 }
13061 catch( std::exception& ex ) {
13062 convertException<MT1,OMT2>( ex );
13063 }
13064
13065 checkResults<MT1,OMT2>();
13066
13067 try {
13068 initResults();
13069 dres_ %= op( olhs_ + rhs_ );
13070 odres_ %= op( olhs_ + rhs_ );
13071 sres_ %= op( olhs_ + rhs_ );
13072 osres_ %= op( olhs_ + rhs_ );
13073 refres_ %= op( reflhs_ + refrhs_ );
13074 }
13075 catch( std::exception& ex ) {
13076 convertException<OMT1,MT2>( ex );
13077 }
13078
13079 checkResults<OMT1,MT2>();
13080
13081 try {
13082 initResults();
13083 dres_ %= op( olhs_ + orhs_ );
13084 odres_ %= op( olhs_ + orhs_ );
13085 sres_ %= op( olhs_ + orhs_ );
13086 osres_ %= op( olhs_ + orhs_ );
13087 refres_ %= op( reflhs_ + refrhs_ );
13088 }
13089 catch( std::exception& ex ) {
13090 convertException<OMT1,OMT2>( ex );
13091 }
13092
13093 checkResults<OMT1,OMT2>();
13094 }
13095
13096 // Customized addition with Schur product assignment with evaluated matrices
13097 {
13098 test_ = "Customized addition with Schur product assignment with evaluated matrices (" + name + ")";
13099 error_ = "Failed Schur product assignment operation";
13100
13101 try {
13102 initResults();
13103 dres_ %= op( eval( lhs_ ) + eval( rhs_ ) );
13104 odres_ %= op( eval( lhs_ ) + eval( rhs_ ) );
13105 sres_ %= op( eval( lhs_ ) + eval( rhs_ ) );
13106 osres_ %= op( eval( lhs_ ) + eval( rhs_ ) );
13107 refres_ %= op( eval( reflhs_ ) + eval( refrhs_ ) );
13108 }
13109 catch( std::exception& ex ) {
13110 convertException<MT1,MT2>( ex );
13111 }
13112
13113 checkResults<MT1,MT2>();
13114
13115 try {
13116 initResults();
13117 dres_ %= op( eval( lhs_ ) + eval( orhs_ ) );
13118 odres_ %= op( eval( lhs_ ) + eval( orhs_ ) );
13119 sres_ %= op( eval( lhs_ ) + eval( orhs_ ) );
13120 osres_ %= op( eval( lhs_ ) + eval( orhs_ ) );
13121 refres_ %= op( eval( reflhs_ ) + eval( refrhs_ ) );
13122 }
13123 catch( std::exception& ex ) {
13124 convertException<MT1,OMT2>( ex );
13125 }
13126
13127 checkResults<MT1,OMT2>();
13128
13129 try {
13130 initResults();
13131 dres_ %= op( eval( olhs_ ) + eval( rhs_ ) );
13132 odres_ %= op( eval( olhs_ ) + eval( rhs_ ) );
13133 sres_ %= op( eval( olhs_ ) + eval( rhs_ ) );
13134 osres_ %= op( eval( olhs_ ) + eval( rhs_ ) );
13135 refres_ %= op( eval( reflhs_ ) + eval( refrhs_ ) );
13136 }
13137 catch( std::exception& ex ) {
13138 convertException<OMT1,MT2>( ex );
13139 }
13140
13141 checkResults<OMT1,MT2>();
13142
13143 try {
13144 initResults();
13145 dres_ %= op( eval( olhs_ ) + eval( orhs_ ) );
13146 odres_ %= op( eval( olhs_ ) + eval( orhs_ ) );
13147 sres_ %= op( eval( olhs_ ) + eval( orhs_ ) );
13148 osres_ %= op( eval( olhs_ ) + eval( orhs_ ) );
13149 refres_ %= op( eval( reflhs_ ) + eval( refrhs_ ) );
13150 }
13151 catch( std::exception& ex ) {
13152 convertException<OMT1,OMT2>( ex );
13153 }
13154
13155 checkResults<OMT1,OMT2>();
13156 }
13157 }
13158 //*************************************************************************************************
13159
13160
13161
13162
13163 //=================================================================================================
13164 //
13165 // ERROR DETECTION FUNCTIONS
13166 //
13167 //=================================================================================================
13168
13169 //*************************************************************************************************
13170 /*!\brief Checking and comparing the computed results.
13171 //
13172 // \return void
13173 // \exception std::runtime_error Incorrect dense result detected.
13174 // \exception std::runtime_error Incorrect sparse result detected.
13175 //
13176 // This function is called after each test case to check and compare the computed results. The
13177 // two template arguments \a LT and \a RT indicate the types of the left-hand side and right-hand
13178 // side operands used for the computations.
13179 */
13180 template< typename MT1 // Type of the left-hand side dense matrix
13181 , typename MT2 > // Type of the right-hand side sparse matrix
13182 template< typename LT // Type of the left-hand side operand
13183 , typename RT > // Type of the right-hand side operand
checkResults()13184 void OperationTest<MT1,MT2>::checkResults()
13185 {
13186 using blaze::IsRowMajorMatrix;
13187
13188 if( !isEqual( dres_, refres_ ) || !isEqual( odres_, refres_ ) ) {
13189 std::ostringstream oss;
13190 oss.precision( 20 );
13191 oss << " Test : " << test_ << "\n"
13192 << " Error: Incorrect dense result detected\n"
13193 << " Details:\n"
13194 << " Random seed = " << blaze::getSeed() << "\n"
13195 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
13196 << " " << typeid( LT ).name() << "\n"
13197 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13198 << " " << typeid( RT ).name() << "\n"
13199 << " Result:\n" << dres_ << "\n"
13200 << " Result with opposite storage order:\n" << odres_ << "\n"
13201 << " Expected result:\n" << refres_ << "\n";
13202 throw std::runtime_error( oss.str() );
13203 }
13204
13205 if( !isEqual( sres_, refres_ ) || !isEqual( osres_, refres_ ) ) {
13206 std::ostringstream oss;
13207 oss.precision( 20 );
13208 oss << " Test : " << test_ << "\n"
13209 << " Error: Incorrect sparse result detected\n"
13210 << " Details:\n"
13211 << " Random seed = " << blaze::getSeed() << "\n"
13212 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
13213 << " " << typeid( LT ).name() << "\n"
13214 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13215 << " " << typeid( RT ).name() << "\n"
13216 << " Result:\n" << sres_ << "\n"
13217 << " Result with opposite storage order:\n" << osres_ << "\n"
13218 << " Expected result:\n" << refres_ << "\n";
13219 throw std::runtime_error( oss.str() );
13220 }
13221 }
13222 //*************************************************************************************************
13223
13224
13225 //*************************************************************************************************
13226 /*!\brief Checking and comparing the computed transpose results.
13227 //
13228 // \return void
13229 // \exception std::runtime_error Incorrect dense result detected.
13230 // \exception std::runtime_error Incorrect sparse result detected.
13231 //
13232 // This function is called after each test case to check and compare the computed transpose
13233 // results. The two template arguments \a LT and \a RT indicate the types of the left-hand
13234 // side and right-hand side operands used for the computations.
13235 */
13236 template< typename MT1 // Type of the left-hand side dense matrix
13237 , typename MT2 > // Type of the right-hand side sparse matrix
13238 template< typename LT // Type of the left-hand side operand
13239 , typename RT > // Type of the right-hand side operand
checkTransposeResults()13240 void OperationTest<MT1,MT2>::checkTransposeResults()
13241 {
13242 using blaze::IsRowMajorMatrix;
13243
13244 if( !isEqual( tdres_, refres_ ) || !isEqual( todres_, refres_ ) ) {
13245 std::ostringstream oss;
13246 oss.precision( 20 );
13247 oss << " Test : " << test_ << "\n"
13248 << " Error: Incorrect dense result detected\n"
13249 << " Details:\n"
13250 << " Random seed = " << blaze::getSeed() << "\n"
13251 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
13252 << " " << typeid( LT ).name() << "\n"
13253 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13254 << " " << typeid( RT ).name() << "\n"
13255 << " Transpose result:\n" << tdres_ << "\n"
13256 << " Transpose result with opposite storage order:\n" << todres_ << "\n"
13257 << " Expected result:\n" << refres_ << "\n";
13258 throw std::runtime_error( oss.str() );
13259 }
13260
13261 if( !isEqual( tsres_, refres_ ) || !isEqual( tosres_, refres_ ) ) {
13262 std::ostringstream oss;
13263 oss.precision( 20 );
13264 oss << " Test : " << test_ << "\n"
13265 << " Error: Incorrect sparse result detected\n"
13266 << " Details:\n"
13267 << " Random seed = " << blaze::getSeed() << "\n"
13268 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
13269 << " " << typeid( LT ).name() << "\n"
13270 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13271 << " " << typeid( RT ).name() << "\n"
13272 << " Transpose result:\n" << tsres_ << "\n"
13273 << " Transpose result with opposite storage order:\n" << tosres_ << "\n"
13274 << " Expected result:\n" << refres_ << "\n";
13275 throw std::runtime_error( oss.str() );
13276 }
13277 }
13278 //*************************************************************************************************
13279
13280
13281 //*************************************************************************************************
13282 /*!\brief Checking and comparing the error message of the given exception.
13283 //
13284 // \param ex The exception to be checked.
13285 // \param message The expected error message.
13286 // \return void
13287 // \exception std::runtime_error Wrong error message.
13288 //
13289 // This function is called to check the error message of the given exception. In case the error
13290 // message does not correspond to the expected message, a \a std::runtime_error exception is
13291 // thrown.
13292 */
13293 template< typename MT1 // Type of the left-hand side dense matrix
13294 , typename MT2 > // Type of the right-hand side sparse matrix
checkExceptionMessage(const std::exception & ex,const std::string & message)13295 void OperationTest<MT1,MT2>::checkExceptionMessage( const std::exception& ex, const std::string& message )
13296 {
13297 if( ex.what() != message ) {
13298 std::ostringstream oss;
13299 oss << " Test: " << test_ << "\n"
13300 << " Error: Wrong error message\n"
13301 << " Details:\n"
13302 << " Error message: \"" << ex.what() << "\"\n"
13303 << " Expected error message: \"" << message << "\"\n";
13304 throw std::runtime_error( oss.str() );
13305 }
13306 }
13307 //*************************************************************************************************
13308
13309
13310
13311
13312 //=================================================================================================
13313 //
13314 // UTILITY FUNCTIONS
13315 //
13316 //=================================================================================================
13317
13318 //*************************************************************************************************
13319 /*!\brief Initializing the non-transpose result matrices.
13320 //
13321 // \return void
13322 //
13323 // This function is called before each non-transpose test case to initialize the according result
13324 // matrices to random values.
13325 */
13326 template< typename MT1 // Type of the left-hand side dense matrix
13327 , typename MT2 > // Type of the right-hand side sparse matrix
initResults()13328 void OperationTest<MT1,MT2>::initResults()
13329 {
13330 const blaze::UnderlyingBuiltin_t<DRE> min( randmin );
13331 const blaze::UnderlyingBuiltin_t<DRE> max( randmax );
13332
13333 resize( dres_, rows( lhs_ ), columns( lhs_ ) );
13334 randomize( dres_, min, max );
13335
13336 odres_ = dres_;
13337 sres_ = dres_;
13338 osres_ = dres_;
13339 refres_ = dres_;
13340 }
13341 //*************************************************************************************************
13342
13343
13344 //*************************************************************************************************
13345 /*!\brief Initializing the transpose result matrices.
13346 //
13347 // \return void
13348 //
13349 // This function is called before each transpose test case to initialize the according result
13350 // matrices to random values.
13351 */
13352 template< typename MT1 // Type of the left-hand side dense matrix
13353 , typename MT2 > // Type of the right-hand side sparse matrix
initTransposeResults()13354 void OperationTest<MT1,MT2>::initTransposeResults()
13355 {
13356 const blaze::UnderlyingBuiltin_t<TDRE> min( randmin );
13357 const blaze::UnderlyingBuiltin_t<TDRE> max( randmax );
13358
13359 resize( tdres_, columns( lhs_ ), rows( lhs_ ) );
13360 randomize( tdres_, min, max );
13361
13362 todres_ = tdres_;
13363 tsres_ = tdres_;
13364 tosres_ = tdres_;
13365 refres_ = tdres_;
13366 }
13367 //*************************************************************************************************
13368
13369
13370 //*************************************************************************************************
13371 /*!\brief Convert the given exception into a \a std::runtime_error exception.
13372 //
13373 // \param ex The \a std::exception to be extended.
13374 // \return void
13375 // \exception std::runtime_error The converted exception.
13376 //
13377 // This function converts the given exception to a \a std::runtime_error exception. Additionally,
13378 // the function extends the given exception message by all available information for the failed
13379 // test. The two template arguments \a LT and \a RT indicate the types of the left-hand side and
13380 // right-hand side operands used for the computations.
13381 */
13382 template< typename MT1 // Type of the left-hand side dense matrix
13383 , typename MT2 > // Type of the right-hand side sparse matrix
13384 template< typename LT // Type of the left-hand side operand
13385 , typename RT > // Type of the right-hand side operand
convertException(const std::exception & ex)13386 void OperationTest<MT1,MT2>::convertException( const std::exception& ex )
13387 {
13388 using blaze::IsRowMajorMatrix;
13389
13390 std::ostringstream oss;
13391 oss << " Test : " << test_ << "\n"
13392 << " Error: " << error_ << "\n"
13393 << " Details:\n"
13394 << " Random seed = " << blaze::getSeed() << "\n"
13395 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
13396 << " " << typeid( LT ).name() << "\n"
13397 << " Right-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13398 << " " << typeid( RT ).name() << "\n"
13399 << " Error message: " << ex.what() << "\n";
13400 throw std::runtime_error( oss.str() );
13401 }
13402 //*************************************************************************************************
13403
13404
13405
13406
13407 //=================================================================================================
13408 //
13409 // GLOBAL TEST FUNCTIONS
13410 //
13411 //=================================================================================================
13412
13413 //*************************************************************************************************
13414 /*!\brief Testing the matrix addition between two specific matrix types.
13415 //
13416 // \param creator1 The creator for the left-hand side matrix.
13417 // \param creator2 The creator for the right-hand side matrix.
13418 // \return void
13419 */
13420 template< typename MT1 // Type of the left-hand side dense matrix
13421 , typename MT2 > // Type of the right-hand side sparse matrix
runTest(const Creator<MT1> & creator1,const Creator<MT2> & creator2)13422 void runTest( const Creator<MT1>& creator1, const Creator<MT2>& creator2 )
13423 {
13424 #if BLAZETEST_MATHTEST_TEST_ADDITION
13425 if( BLAZETEST_MATHTEST_TEST_ADDITION > 1 )
13426 {
13427 for( size_t rep=0UL; rep<BLAZETEST_REPETITIONS; ++rep ) {
13428 OperationTest<MT1,MT2>( creator1, creator2 );
13429 }
13430 }
13431 #endif
13432 }
13433 //*************************************************************************************************
13434
13435
13436
13437
13438 //=================================================================================================
13439 //
13440 // MACROS
13441 //
13442 //=================================================================================================
13443
13444 //*************************************************************************************************
13445 /*! \cond BLAZE_INTERNAL */
13446 /*!\brief Macro for the definition of a dense matrix/sparse matrix addition test case.
13447 */
13448 #define DEFINE_DMATSMATADD_OPERATION_TEST( MT1, MT2 ) \
13449 extern template class blazetest::mathtest::operations::dmatsmatadd::OperationTest<MT1,MT2>
13450 /*! \endcond */
13451 //*************************************************************************************************
13452
13453
13454 //*************************************************************************************************
13455 /*! \cond BLAZE_INTERNAL */
13456 /*!\brief Macro for the execution of a dense matrix/sparse matrix addition test case.
13457 */
13458 #define RUN_DMATSMATADD_OPERATION_TEST( C1, C2 ) \
13459 blazetest::mathtest::operations::dmatsmatadd::runTest( C1, C2 )
13460 /*! \endcond */
13461 //*************************************************************************************************
13462
13463 } // namespace dmatsmatadd
13464
13465 } // namespace operations
13466
13467 } // namespace mathtest
13468
13469 } // namespace blazetest
13470
13471 #endif
13472