1 //=================================================================================================
2 /*!
3 // \file blazetest/mathtest/operations/smatsmatsub/OperationTest.h
4 // \brief Header file for the sparse matrix/sparse matrix subtraction 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_SMATSMATSUB_OPERATIONTEST_H_
36 #define _BLAZETEST_MATHTEST_OPERATIONS_SMATSMATSUB_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/constraints/ColumnMajorMatrix.h>
52 #include <blaze/math/constraints/DenseMatrix.h>
53 #include <blaze/math/constraints/RowMajorMatrix.h>
54 #include <blaze/math/constraints/Scalar.h>
55 #include <blaze/math/constraints/SparseMatrix.h>
56 #include <blaze/math/constraints/StorageOrder.h>
57 #include <blaze/math/DynamicMatrix.h>
58 #include <blaze/math/Functors.h>
59 #include <blaze/math/shims/Equal.h>
60 #include <blaze/math/traits/SubTrait.h>
61 #include <blaze/math/typetraits/IsDiagonal.h>
62 #include <blaze/math/typetraits/IsHermitian.h>
63 #include <blaze/math/typetraits/IsResizable.h>
64 #include <blaze/math/typetraits/IsRowMajorMatrix.h>
65 #include <blaze/math/typetraits/IsSquare.h>
66 #include <blaze/math/typetraits/IsSymmetric.h>
67 #include <blaze/math/typetraits/IsTriangular.h>
68 #include <blaze/math/typetraits/UnderlyingBuiltin.h>
69 #include <blaze/math/typetraits/UnderlyingScalar.h>
70 #include <blaze/math/Views.h>
71 #include <blaze/util/algorithms/Min.h>
72 #include <blaze/util/constraints/DerivedFrom.h>
73 #include <blaze/util/constraints/SameType.h>
74 #include <blaze/util/IntegralConstant.h>
75 #include <blaze/util/mpl/If.h>
76 #include <blaze/util/mpl/Nor.h>
77 #include <blaze/util/mpl/Or.h>
78 #include <blaze/util/Random.h>
79 #include <blaze/util/typetraits/IsComplex.h>
80 #include <blaze/util/typetraits/RemoveCVRef.h>
81 #include <blazetest/system/MathTest.h>
82 #include <blazetest/mathtest/Creator.h>
83 #include <blazetest/mathtest/IsEqual.h>
84 #include <blazetest/mathtest/MatchAdaptor.h>
85 #include <blazetest/mathtest/MatchSymmetry.h>
86 #include <blazetest/mathtest/RandomMaximum.h>
87 #include <blazetest/mathtest/RandomMinimum.h>
88
89
90 namespace blazetest {
91
92 namespace mathtest {
93
94 namespace operations {
95
96 namespace smatsmatsub {
97
98 //=================================================================================================
99 //
100 // CLASS DEFINITION
101 //
102 //=================================================================================================
103
104 //*************************************************************************************************
105 /*!\brief Auxiliary class template for the sparse matrix/sparse matrix subtraction operation test.
106 //
107 // This class template represents one particular matrix subtraction test between two matrices of
108 // a particular type. The two template arguments \a MT1 and \a MT2 represent the types of the
109 // left-hand side and right-hand side matrix, respectively.
110 */
111 template< typename MT1 // Type of the left-hand side sparse matrix
112 , typename MT2 > // Type of the right-hand side sparse matrix
113 class OperationTest
114 {
115 private:
116 //**Type definitions****************************************************************************
117 using ET1 = blaze::ElementType_t<MT1>; //!< Element type 1
118 using ET2 = blaze::ElementType_t<MT2>; //!< Element type 2
119
120 using OMT1 = blaze::OppositeType_t<MT1>; //!< Matrix type 1 with opposite storage order
121 using OMT2 = blaze::OppositeType_t<MT2>; //!< Matrix type 2 with opposite storage order
122 using TMT1 = blaze::TransposeType_t<MT1>; //!< Transpose matrix type 1
123 using TMT2 = blaze::TransposeType_t<MT2>; //!< Transpose matrix type 2
124 using TOMT1 = blaze::TransposeType_t<OMT1>; //!< Transpose matrix type 1 with opposite storage order
125 using TOMT2 = blaze::TransposeType_t<OMT2>; //!< Transpose matrix type 2 with opposite storage order
126
127 //! Sparse result type
128 using SRE = blaze::SubTrait_t<MT1,MT2>;
129
130 using SET = blaze::ElementType_t<SRE>; //!< Element type of the sparse result
131 using OSRE = blaze::OppositeType_t<SRE>; //!< Sparse result type with opposite storage order
132 using TSRE = blaze::TransposeType_t<SRE>; //!< Transpose sparse result type
133 using TOSRE = blaze::TransposeType_t<OSRE>; //!< Transpose sparse result type with opposite storage order
134
135 //! Dense result type
136 using DRE = MatchAdaptor_t< SRE, blaze::DynamicMatrix<SET,false> >;
137
138 using DET = blaze::ElementType_t<DRE>; //!< Element type of the dense result
139 using ODRE = blaze::OppositeType_t<DRE>; //!< Dense result type with opposite storage order
140 using TDRE = blaze::TransposeType_t<DRE>; //!< Transpose dense result type
141 using TODRE = blaze::TransposeType_t<ODRE>; //!< Transpose dense result type with opposite storage order
142
143 using RT1 = blaze::DynamicMatrix<ET1,false>; //!< Reference type 1
144 using RT2 = blaze::DynamicMatrix<ET2,false>; //!< Reference type 2
145
146 //! Reference result type
147 using RRE = MatchSymmetry_t< DRE, blaze::SubTrait_t<RT1,RT2> >;
148
149 //! Type of the matrix/matrix subtraction expression
150 using MatMatSubExprType =
151 blaze::RemoveCVRef_t< decltype( std::declval<MT1>() - std::declval<MT2>() ) >;
152
153 //! Type of the matrix/transpose matrix subtraction expression
154 using MatTMatSubExprType =
155 blaze::RemoveCVRef_t< decltype( std::declval<MT1>() - std::declval<OMT2>() ) >;
156
157 //! Type of the transpose matrix/matrix subtraction expression
158 using TMatMatSubExprType =
159 blaze::RemoveCVRef_t< decltype( std::declval<OMT1>() - std::declval<MT2>() ) >;
160
161 //! Type of the transpose matrix/transpose matrix subtraction expression
162 using TMatTMatSubExprType =
163 blaze::RemoveCVRef_t< decltype( std::declval<OMT1>() - std::declval<OMT2>() ) >;
164 //**********************************************************************************************
165
166 public:
167 //**Constructors********************************************************************************
168 /*!\name Constructors */
169 //@{
170 explicit OperationTest( const Creator<MT1>& creator1, const Creator<MT2>& creator2 );
171 // No explicitly declared copy constructor.
172 //@}
173 //**********************************************************************************************
174
175 //**Destructor**********************************************************************************
176 // No explicitly declared destructor.
177 //**********************************************************************************************
178
179 private:
180 //**Test functions******************************************************************************
181 /*!\name Test functions */
182 //@{
183 void testInitialStatus ();
184 void testAssignment ();
185 void testEvaluation ();
186 void testElementAccess ();
187 void testBasicOperation ();
188 void testNegatedOperation ();
189 template< typename T > void testScaledOperation ( T scalar );
190 void testTransOperation ();
191 void testCTransOperation ();
192 void testAbsOperation ();
193 void testConjOperation ();
194 void testRealOperation ();
195 void testImagOperation ();
196 void testEvalOperation ();
197 void testSerialOperation ();
198 void testNoAliasOperation ();
199 void testNoSIMDOperation ();
200 void testDeclSymOperation ( blaze::TrueType );
201 void testDeclSymOperation ( blaze::FalseType );
202 void testDeclHermOperation ( blaze::TrueType );
203 void testDeclHermOperation ( blaze::FalseType );
204 void testDeclLowOperation ( blaze::TrueType );
205 void testDeclLowOperation ( blaze::FalseType );
206 void testDeclUppOperation ( blaze::TrueType );
207 void testDeclUppOperation ( blaze::FalseType );
208 void testDeclDiagOperation ( blaze::TrueType );
209 void testDeclDiagOperation ( blaze::FalseType );
210 void testSubmatrixOperation();
211 void testRowOperation ();
212 void testRowsOperation ( blaze::TrueType );
213 void testRowsOperation ( blaze::FalseType );
214 void testColumnOperation ();
215 void testColumnsOperation ( blaze::TrueType );
216 void testColumnsOperation ( blaze::FalseType );
217 void testBandOperation ();
218
219 template< typename OP > void testCustomOperation( OP op, const std::string& name );
220 //@}
221 //**********************************************************************************************
222
223 //**Error detection functions*******************************************************************
224 /*!\name Error detection functions */
225 //@{
226 template< typename LT, typename RT > void checkResults();
227 template< typename LT, typename RT > void checkTransposeResults();
228 void checkExceptionMessage( const std::exception& ex, const std::string& message );
229 //@}
230 //**********************************************************************************************
231
232 //**Utility functions***************************************************************************
233 /*!\name Utility functions */
234 //@{
235 void initResults();
236 void initTransposeResults();
237 template< typename LT, typename RT > void convertException( const std::exception& ex );
238 //@}
239 //**********************************************************************************************
240
241 //**Member variables****************************************************************************
242 /*!\name Member variables */
243 //@{
244 MT1 lhs_; //!< The left-hand side sparse matrix.
245 MT2 rhs_; //!< The right-hand side sparse matrix.
246 OMT1 olhs_; //!< The left-hand side sparse matrix with opposite storage order.
247 OMT2 orhs_; //!< The right-hand side sparse matrix with opposite storage order.
248 DRE dres_; //!< The dense result matrix.
249 SRE sres_; //!< The sparse result matrix.
250 ODRE odres_; //!< The dense result matrix with opposite storage order.
251 OSRE osres_; //!< The sparse result matrix with opposite storage order.
252 TDRE tdres_; //!< The transpose dense result matrix.
253 TSRE tsres_; //!< The transpose sparse result matrix.
254 TODRE todres_; //!< The transpose dense result matrix with opposite storage order.
255 TOSRE tosres_; //!< The transpose sparse result matrix with opposite storage order.
256 RT1 reflhs_; //!< The reference left-hand side matrix.
257 RT2 refrhs_; //!< The reference right-hand side matrix.
258 RRE refres_; //!< The reference result.
259
260 std::string test_; //!< Label of the currently performed test.
261 std::string error_; //!< Description of the current error type.
262 //@}
263 //**********************************************************************************************
264
265 //**Compile time checks*************************************************************************
266 /*! \cond BLAZE_INTERNAL */
267 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( MT1 );
268 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( MT2 );
269 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( OMT1 );
270 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( OMT2 );
271 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TMT1 );
272 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TMT2 );
273 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TOMT1 );
274 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TOMT2 );
275 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( RT1 );
276 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( RT2 );
277 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( RRE );
278 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( DRE );
279 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( SRE );
280 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( ODRE );
281 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( OSRE );
282 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( TDRE );
283 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TSRE );
284 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( TODRE );
285 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TOSRE );
286
287 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( MT1 );
288 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( MT2 );
289 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OMT1 );
290 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OMT2 );
291 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TMT1 );
292 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TMT2 );
293 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TOMT1 );
294 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TOMT2 );
295 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( RT1 );
296 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( RT2 );
297 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( DRE );
298 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( SRE );
299 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( ODRE );
300 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OSRE );
301 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TDRE );
302 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TSRE );
303 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TODRE );
304 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TOSRE );
305
306 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET1, blaze::ElementType_t<OMT1> );
307 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET2, blaze::ElementType_t<OMT2> );
308 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET1, blaze::ElementType_t<TMT1> );
309 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET2, blaze::ElementType_t<TMT2> );
310 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET1, blaze::ElementType_t<TOMT1> );
311 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET2, blaze::ElementType_t<TOMT2> );
312 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<DRE> );
313 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<ODRE> );
314 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<TDRE> );
315 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<TODRE> );
316 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<SRE> );
317 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<SRE> );
318 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<OSRE> );
319 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<TSRE> );
320 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<TOSRE> );
321 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<DRE> );
322 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT1, blaze::OppositeType_t<OMT1> );
323 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT2, blaze::OppositeType_t<OMT2> );
324 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT1, blaze::TransposeType_t<TMT1> );
325 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT2, blaze::TransposeType_t<TMT2> );
326 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DRE, blaze::OppositeType_t<ODRE> );
327 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DRE, blaze::TransposeType_t<TDRE> );
328 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SRE, blaze::OppositeType_t<OSRE> );
329 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SRE, blaze::TransposeType_t<TSRE> );
330
331 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( MatMatSubExprType, blaze::ResultType_t<MatMatSubExprType> );
332 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatMatSubExprType, blaze::OppositeType_t<MatMatSubExprType> );
333 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatMatSubExprType, blaze::TransposeType_t<MatMatSubExprType> );
334
335 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( MatTMatSubExprType, blaze::ResultType_t<MatTMatSubExprType> );
336 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatTMatSubExprType, blaze::OppositeType_t<MatTMatSubExprType> );
337 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatTMatSubExprType, blaze::TransposeType_t<MatTMatSubExprType> );
338
339 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( TMatMatSubExprType, blaze::ResultType_t<TMatMatSubExprType> );
340 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatMatSubExprType, blaze::OppositeType_t<TMatMatSubExprType> );
341 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatMatSubExprType, blaze::TransposeType_t<TMatMatSubExprType> );
342
343 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( TMatTMatSubExprType, blaze::ResultType_t<TMatTMatSubExprType> );
344 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatTMatSubExprType, blaze::OppositeType_t<TMatTMatSubExprType> );
345 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatTMatSubExprType, blaze::TransposeType_t<TMatTMatSubExprType> );
346
347 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( MatMatSubExprType , blaze::BaseType_t<MatMatSubExprType > );
348 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( MatTMatSubExprType , blaze::BaseType_t<MatTMatSubExprType > );
349 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( TMatMatSubExprType , blaze::BaseType_t<TMatMatSubExprType > );
350 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( TMatTMatSubExprType, blaze::BaseType_t<TMatTMatSubExprType> );
351 /*! \endcond */
352 //**********************************************************************************************
353 };
354 //*************************************************************************************************
355
356
357
358
359 //=================================================================================================
360 //
361 // CONSTRUCTORS
362 //
363 //=================================================================================================
364
365 //*************************************************************************************************
366 /*!\brief Constructor for the sparse matrix/sparse matrix subtraction operation test.
367 //
368 // \param creator1 The creator for the left-hand side sparse matrix of the matrix subtraction.
369 // \param creator2 The creator for the right-hand side sparse matrix of the matrix subtraction.
370 // \exception std::runtime_error Operation error detected.
371 */
372 template< typename MT1 // Type of the left-hand side sparse matrix
373 , typename MT2 > // Type of the right-hand side sparse matrix
OperationTest(const Creator<MT1> & creator1,const Creator<MT2> & creator2)374 OperationTest<MT1,MT2>::OperationTest( const Creator<MT1>& creator1, const Creator<MT2>& creator2 )
375 : lhs_( creator1() ) // The left-hand side sparse matrix
376 , rhs_( creator2() ) // The right-hand side sparse matrix
377 , olhs_( lhs_ ) // The left-hand side sparse matrix with opposite storage order
378 , orhs_( rhs_ ) // The right-hand side sparse matrix with opposite storage order
379 , dres_() // The dense result matrix
380 , sres_() // The sparse result matrix
381 , odres_() // The dense result matrix with opposite storage order
382 , osres_() // The sparse result matrix with opposite storage order
383 , tdres_() // The transpose dense result matrix
384 , tsres_() // The transpose sparse result matrix
385 , todres_() // The transpose dense result matrix with opposite storage order
386 , tosres_() // The transpose sparse result matrix with opposite storage order
387 , reflhs_( lhs_ ) // The reference left-hand side matrix
388 , refrhs_( rhs_ ) // The reference right-hand side matrix
389 , refres_() // The reference result
390 , test_() // Label of the currently performed test
391 , error_() // Description of the current error type
392 {
393 using namespace blaze;
394
395 using Scalar = UnderlyingScalar_t<SET>;
396
397 testInitialStatus();
398 testAssignment();
399 testEvaluation();
400 testElementAccess();
401 testBasicOperation();
402 testNegatedOperation();
403 testScaledOperation( 2 );
404 testScaledOperation( 2UL );
405 testScaledOperation( 2.0F );
406 testScaledOperation( 2.0 );
407 testScaledOperation( Scalar( 2 ) );
408 testTransOperation();
409 testCTransOperation();
410 testAbsOperation();
411 testConjOperation();
412 testRealOperation();
413 testImagOperation();
414 testEvalOperation();
415 testSerialOperation();
416 testNoAliasOperation();
417 testNoSIMDOperation();
418 testDeclSymOperation( Or_t< IsSquare<SRE>, IsResizable<SRE> >() );
419 testDeclHermOperation( Or_t< IsSquare<SRE>, IsResizable<SRE> >() );
420 testDeclLowOperation( Or_t< IsSquare<SRE>, IsResizable<SRE> >() );
421 testDeclUppOperation( Or_t< IsSquare<SRE>, IsResizable<SRE> >() );
422 testDeclDiagOperation( Or_t< IsSquare<SRE>, IsResizable<SRE> >() );
423 testSubmatrixOperation();
424 testRowOperation();
425 testRowsOperation( Nor_t< IsSymmetric<DRE>, IsHermitian<DRE> >() );
426 testColumnOperation();
427 testColumnsOperation( Nor_t< IsSymmetric<DRE>, IsHermitian<DRE> >() );
428 testBandOperation();
429 }
430 //*************************************************************************************************
431
432
433
434
435 //=================================================================================================
436 //
437 // TEST FUNCTIONS
438 //
439 //=================================================================================================
440
441 //*************************************************************************************************
442 /*!\brief Tests on the initial status of the matrices.
443 //
444 // \return void
445 // \exception std::runtime_error Initialization error detected.
446 //
447 // This function runs tests on the initial status of the matrices. In case any initialization
448 // error is detected, a \a std::runtime_error exception is thrown.
449 */
450 template< typename MT1 // Type of the left-hand side sparse matrix
451 , typename MT2 > // Type of the right-hand side sparse matrix
testInitialStatus()452 void OperationTest<MT1,MT2>::testInitialStatus()
453 {
454 //=====================================================================================
455 // Performing initial tests with the row-major types
456 //=====================================================================================
457
458 // Checking the number of rows of the left-hand side operand
459 if( lhs_.rows() != reflhs_.rows() ) {
460 std::ostringstream oss;
461 oss << " Test: Initial size comparison of left-hand side row-major sparse operand\n"
462 << " Error: Invalid number of rows\n"
463 << " Details:\n"
464 << " Random seed = " << blaze::getSeed() << "\n"
465 << " Row-major sparse matrix type:\n"
466 << " " << typeid( MT1 ).name() << "\n"
467 << " Detected number of rows = " << lhs_.rows() << "\n"
468 << " Expected number of rows = " << reflhs_.rows() << "\n";
469 throw std::runtime_error( oss.str() );
470 }
471
472 // Checking the number of columns of the left-hand side operand
473 if( lhs_.columns() != reflhs_.columns() ) {
474 std::ostringstream oss;
475 oss << " Test: Initial size comparison of left-hand side row-major sparse operand\n"
476 << " Error: Invalid number of columns\n"
477 << " Details:\n"
478 << " Random seed = " << blaze::getSeed() << "\n"
479 << " Row-major sparse matrix type:\n"
480 << " " << typeid( MT1 ).name() << "\n"
481 << " Detected number of columns = " << lhs_.columns() << "\n"
482 << " Expected number of columns = " << reflhs_.columns() << "\n";
483 throw std::runtime_error( oss.str() );
484 }
485
486 // Checking the number of rows of the right-hand side operand
487 if( rhs_.rows() != refrhs_.rows() ) {
488 std::ostringstream oss;
489 oss << " Test: Initial size comparison of right-hand side row-major sparse operand\n"
490 << " Error: Invalid number of rows\n"
491 << " Details:\n"
492 << " Random seed = " << blaze::getSeed() << "\n"
493 << " Row-major sparse matrix type:\n"
494 << " " << typeid( MT2 ).name() << "\n"
495 << " Detected number of rows = " << rhs_.rows() << "\n"
496 << " Expected number of rows = " << refrhs_.rows() << "\n";
497 throw std::runtime_error( oss.str() );
498 }
499
500 // Checking the number of columns of the right-hand side operand
501 if( rhs_.columns() != refrhs_.columns() ) {
502 std::ostringstream oss;
503 oss << " Test: Initial size comparison of right-hand side row-major sparse operand\n"
504 << " Error: Invalid number of columns\n"
505 << " Details:\n"
506 << " Random seed = " << blaze::getSeed() << "\n"
507 << " Row-major sparse matrix type:\n"
508 << " " << typeid( MT2 ).name() << "\n"
509 << " Detected number of columns = " << rhs_.columns() << "\n"
510 << " Expected number of columns = " << refrhs_.columns() << "\n";
511 throw std::runtime_error( oss.str() );
512 }
513
514 // Checking the initialization of the left-hand side operand
515 if( !isEqual( lhs_, reflhs_ ) ) {
516 std::ostringstream oss;
517 oss << " Test: Initial test of initialization of left-hand side row-major sparse operand\n"
518 << " Error: Invalid matrix initialization\n"
519 << " Details:\n"
520 << " Random seed = " << blaze::getSeed() << "\n"
521 << " Row-major sparse matrix type:\n"
522 << " " << typeid( MT1 ).name() << "\n"
523 << " Current initialization:\n" << lhs_ << "\n"
524 << " Expected initialization:\n" << reflhs_ << "\n";
525 throw std::runtime_error( oss.str() );
526 }
527
528 // Checking the initialization of the right-hand side operand
529 if( !isEqual( rhs_, refrhs_ ) ) {
530 std::ostringstream oss;
531 oss << " Test: Initial test of initialization of right-hand side row-major sparse operand\n"
532 << " Error: Invalid matrix initialization\n"
533 << " Details:\n"
534 << " Random seed = " << blaze::getSeed() << "\n"
535 << " Row-major sparse matrix type:\n"
536 << " " << typeid( MT2 ).name() << "\n"
537 << " Current initialization:\n" << rhs_ << "\n"
538 << " Expected initialization:\n" << refrhs_ << "\n";
539 throw std::runtime_error( oss.str() );
540 }
541
542
543 //=====================================================================================
544 // Performing initial tests with the column-major types
545 //=====================================================================================
546
547 // Checking the number of rows of the left-hand side operand
548 if( olhs_.rows() != reflhs_.rows() ) {
549 std::ostringstream oss;
550 oss << " Test: Initial size comparison of left-hand side column-major sparse operand\n"
551 << " Error: Invalid number of rows\n"
552 << " Details:\n"
553 << " Random seed = " << blaze::getSeed() << "\n"
554 << " Column-major sparse matrix type:\n"
555 << " " << typeid( OMT1 ).name() << "\n"
556 << " Detected number of rows = " << olhs_.rows() << "\n"
557 << " Expected number of rows = " << reflhs_.rows() << "\n";
558 throw std::runtime_error( oss.str() );
559 }
560
561 // Checking the number of columns of the left-hand side operand
562 if( olhs_.columns() != reflhs_.columns() ) {
563 std::ostringstream oss;
564 oss << " Test: Initial size comparison of left-hand side column-major sparse operand\n"
565 << " Error: Invalid number of columns\n"
566 << " Details:\n"
567 << " Random seed = " << blaze::getSeed() << "\n"
568 << " Column-major sparse matrix type:\n"
569 << " " << typeid( OMT1 ).name() << "\n"
570 << " Detected number of columns = " << olhs_.columns() << "\n"
571 << " Expected number of columns = " << reflhs_.columns() << "\n";
572 throw std::runtime_error( oss.str() );
573 }
574
575 // Checking the number of rows of the right-hand side operand
576 if( orhs_.rows() != refrhs_.rows() ) {
577 std::ostringstream oss;
578 oss << " Test: Initial size comparison of right-hand side column-major sparse operand\n"
579 << " Error: Invalid number of rows\n"
580 << " Details:\n"
581 << " Random seed = " << blaze::getSeed() << "\n"
582 << " Column-major sparse matrix type:\n"
583 << " " << typeid( OMT2 ).name() << "\n"
584 << " Detected number of rows = " << orhs_.rows() << "\n"
585 << " Expected number of rows = " << refrhs_.rows() << "\n";
586 throw std::runtime_error( oss.str() );
587 }
588
589 // Checking the number of columns of the right-hand side operand
590 if( orhs_.columns() != refrhs_.columns() ) {
591 std::ostringstream oss;
592 oss << " Test: Initial size comparison of right-hand side column-major sparse operand\n"
593 << " Error: Invalid number of columns\n"
594 << " Details:\n"
595 << " Random seed = " << blaze::getSeed() << "\n"
596 << " Column-major sparse matrix type:\n"
597 << " " << typeid( OMT2 ).name() << "\n"
598 << " Detected number of columns = " << orhs_.columns() << "\n"
599 << " Expected number of columns = " << refrhs_.columns() << "\n";
600 throw std::runtime_error( oss.str() );
601 }
602
603 // Checking the initialization of the left-hand side operand
604 if( !isEqual( olhs_, reflhs_ ) ) {
605 std::ostringstream oss;
606 oss << " Test: Initial test of initialization of left-hand side column-major sparse operand\n"
607 << " Error: Invalid matrix initialization\n"
608 << " Details:\n"
609 << " Random seed = " << blaze::getSeed() << "\n"
610 << " Column-major sparse matrix type:\n"
611 << " " << typeid( OMT1 ).name() << "\n"
612 << " Current initialization:\n" << olhs_ << "\n"
613 << " Expected initialization:\n" << reflhs_ << "\n";
614 throw std::runtime_error( oss.str() );
615 }
616
617 // Checking the initialization of the right-hand side operand
618 if( !isEqual( orhs_, refrhs_ ) ) {
619 std::ostringstream oss;
620 oss << " Test: Initial test of initialization of right-hand side column-major sparse operand\n"
621 << " Error: Invalid matrix initialization\n"
622 << " Details:\n"
623 << " Random seed = " << blaze::getSeed() << "\n"
624 << " Column-major sparse matrix type:\n"
625 << " " << typeid( OMT2 ).name() << "\n"
626 << " Current initialization:\n" << orhs_ << "\n"
627 << " Expected initialization:\n" << refrhs_ << "\n";
628 throw std::runtime_error( oss.str() );
629 }
630 }
631 //*************************************************************************************************
632
633
634 //*************************************************************************************************
635 /*!\brief Testing the matrix assignment.
636 //
637 // \return void
638 // \exception std::runtime_error Assignment error detected.
639 //
640 // This function tests the matrix assignment. In case any error is detected, a
641 // \a std::runtime_error exception is thrown.
642 */
643 template< typename MT1 // Type of the left-hand side sparse matrix
644 , typename MT2 > // Type of the right-hand side sparse matrix
testAssignment()645 void OperationTest<MT1,MT2>::testAssignment()
646 {
647 //=====================================================================================
648 // // Performing an assignment with the row-major types
649 //=====================================================================================
650
651 try {
652 lhs_ = reflhs_;
653 rhs_ = refrhs_;
654 }
655 catch( std::exception& ex ) {
656 std::ostringstream oss;
657 oss << " Test: Assignment with the row-major types\n"
658 << " Error: Failed assignment\n"
659 << " Details:\n"
660 << " Random seed = " << blaze::getSeed() << "\n"
661 << " Left-hand side row-major sparse matrix type:\n"
662 << " " << typeid( MT1 ).name() << "\n"
663 << " Right-hand side row-major sparse matrix type:\n"
664 << " " << typeid( MT2 ).name() << "\n"
665 << " Error message: " << ex.what() << "\n";
666 throw std::runtime_error( oss.str() );
667 }
668
669 if( !isEqual( lhs_, reflhs_ ) ) {
670 std::ostringstream oss;
671 oss << " Test: Checking the assignment result of left-hand side row-major sparse operand\n"
672 << " Error: Invalid matrix initialization\n"
673 << " Details:\n"
674 << " Random seed = " << blaze::getSeed() << "\n"
675 << " Row-major sparse matrix type:\n"
676 << " " << typeid( MT1 ).name() << "\n"
677 << " Current initialization:\n" << lhs_ << "\n"
678 << " Expected initialization:\n" << reflhs_ << "\n";
679 throw std::runtime_error( oss.str() );
680 }
681
682 if( !isEqual( rhs_, refrhs_ ) ) {
683 std::ostringstream oss;
684 oss << " Test: Checking the assignment result of right-hand side row-major sparse operand\n"
685 << " Error: Invalid matrix initialization\n"
686 << " Details:\n"
687 << " Random seed = " << blaze::getSeed() << "\n"
688 << " Row-major sparse matrix type:\n"
689 << " " << typeid( MT2 ).name() << "\n"
690 << " Current initialization:\n" << rhs_ << "\n"
691 << " Expected initialization:\n" << refrhs_ << "\n";
692 throw std::runtime_error( oss.str() );
693 }
694
695
696 //=====================================================================================
697 // Performing an assignment with the column-major types
698 //=====================================================================================
699
700 try {
701 olhs_ = reflhs_;
702 orhs_ = refrhs_;
703 }
704 catch( std::exception& ex ) {
705 std::ostringstream oss;
706 oss << " Test: Assignment with the column-major types\n"
707 << " Error: Failed assignment\n"
708 << " Details:\n"
709 << " Random seed = " << blaze::getSeed() << "\n"
710 << " Left-hand side column-major sparse matrix type:\n"
711 << " " << typeid( OMT1 ).name() << "\n"
712 << " Right-hand side column-major sparse matrix type:\n"
713 << " " << typeid( OMT2 ).name() << "\n"
714 << " Error message: " << ex.what() << "\n";
715 throw std::runtime_error( oss.str() );
716 }
717
718 if( !isEqual( olhs_, reflhs_ ) ) {
719 std::ostringstream oss;
720 oss << " Test: Checking the assignment result of left-hand side column-major sparse operand\n"
721 << " Error: Invalid matrix initialization\n"
722 << " Details:\n"
723 << " Random seed = " << blaze::getSeed() << "\n"
724 << " Column-major sparse matrix type:\n"
725 << " " << typeid( OMT1 ).name() << "\n"
726 << " Current initialization:\n" << olhs_ << "\n"
727 << " Expected initialization:\n" << reflhs_ << "\n";
728 throw std::runtime_error( oss.str() );
729 }
730
731 if( !isEqual( orhs_, refrhs_ ) ) {
732 std::ostringstream oss;
733 oss << " Test: Checking the assignment result of right-hand side column-major sparse operand\n"
734 << " Error: Invalid matrix initialization\n"
735 << " Details:\n"
736 << " Random seed = " << blaze::getSeed() << "\n"
737 << " Column-major sparse matrix type:\n"
738 << " " << typeid( OMT2 ).name() << "\n"
739 << " Current initialization:\n" << orhs_ << "\n"
740 << " Expected initialization:\n" << refrhs_ << "\n";
741 throw std::runtime_error( oss.str() );
742 }
743 }
744 //*************************************************************************************************
745
746
747 //*************************************************************************************************
748 /*!\brief Testing the explicit evaluation.
749 //
750 // \return void
751 // \exception std::runtime_error Evaluation error detected.
752 //
753 // This function tests the explicit evaluation. In case any error is detected, a
754 // \a std::runtime_error exception is thrown.
755 */
756 template< typename MT1 // Type of the left-hand side sparse matrix
757 , typename MT2 > // Type of the right-hand side sparse matrix
testEvaluation()758 void OperationTest<MT1,MT2>::testEvaluation()
759 {
760 using blaze::IsRowMajorMatrix;
761
762
763 //=====================================================================================
764 // Testing the evaluation with two row-major matrices
765 //=====================================================================================
766
767 {
768 const auto res ( evaluate( lhs_ - rhs_ ) );
769 const auto refres( evaluate( reflhs_ - refrhs_ ) );
770
771 if( !isEqual( res, refres ) ) {
772 std::ostringstream oss;
773 oss << " Test: Evaluation with the given matrices\n"
774 << " Error: Failed evaluation\n"
775 << " Details:\n"
776 << " Random seed = " << blaze::getSeed() << "\n"
777 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
778 << " " << typeid( lhs_ ).name() << "\n"
779 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
780 << " " << typeid( rhs_ ).name() << "\n"
781 << " Deduced result type:\n"
782 << " " << typeid( res ).name() << "\n"
783 << " Deduced reference result type:\n"
784 << " " << typeid( refres ).name() << "\n"
785 << " Result:\n" << res << "\n"
786 << " Expected result:\n" << refres << "\n";
787 throw std::runtime_error( oss.str() );
788 }
789 }
790
791 {
792 const auto res ( evaluate( eval( lhs_ ) - eval( rhs_ ) ) );
793 const auto refres( evaluate( eval( reflhs_ ) - eval( refrhs_ ) ) );
794
795 if( !isEqual( res, refres ) ) {
796 std::ostringstream oss;
797 oss << " Test: Evaluation with evaluated matrices\n"
798 << " Error: Failed evaluation\n"
799 << " Details:\n"
800 << " Random seed = " << blaze::getSeed() << "\n"
801 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
802 << " " << typeid( lhs_ ).name() << "\n"
803 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
804 << " " << typeid( rhs_ ).name() << "\n"
805 << " Deduced result type:\n"
806 << " " << typeid( res ).name() << "\n"
807 << " Deduced reference result type:\n"
808 << " " << typeid( refres ).name() << "\n"
809 << " Result:\n" << res << "\n"
810 << " Expected result:\n" << refres << "\n";
811 throw std::runtime_error( oss.str() );
812 }
813 }
814
815
816 //=====================================================================================
817 // Testing the evaluation with a row-major matrix and a column-major matrix
818 //=====================================================================================
819
820 {
821 const auto res ( evaluate( lhs_ - orhs_ ) );
822 const auto refres( evaluate( reflhs_ - refrhs_ ) );
823
824 if( !isEqual( res, refres ) ) {
825 std::ostringstream oss;
826 oss << " Test: Evaluation with the given matrices\n"
827 << " Error: Failed evaluation\n"
828 << " Details:\n"
829 << " Random seed = " << blaze::getSeed() << "\n"
830 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
831 << " " << typeid( lhs_ ).name() << "\n"
832 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
833 << " " << typeid( orhs_ ).name() << "\n"
834 << " Deduced result type:\n"
835 << " " << typeid( res ).name() << "\n"
836 << " Deduced reference result type:\n"
837 << " " << typeid( refres ).name() << "\n"
838 << " Result:\n" << res << "\n"
839 << " Expected result:\n" << refres << "\n";
840 throw std::runtime_error( oss.str() );
841 }
842 }
843
844 {
845 const auto res ( evaluate( eval( lhs_ ) - eval( orhs_ ) ) );
846 const auto refres( evaluate( eval( reflhs_ ) - eval( refrhs_ ) ) );
847
848 if( !isEqual( res, refres ) ) {
849 std::ostringstream oss;
850 oss << " Test: Evaluation with the given matrices\n"
851 << " Error: Failed evaluation\n"
852 << " Details:\n"
853 << " Random seed = " << blaze::getSeed() << "\n"
854 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
855 << " " << typeid( lhs_ ).name() << "\n"
856 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
857 << " " << typeid( orhs_ ).name() << "\n"
858 << " Deduced result type:\n"
859 << " " << typeid( res ).name() << "\n"
860 << " Deduced reference result type:\n"
861 << " " << typeid( refres ).name() << "\n"
862 << " Result:\n" << res << "\n"
863 << " Expected result:\n" << refres << "\n";
864 throw std::runtime_error( oss.str() );
865 }
866 }
867
868
869 //=====================================================================================
870 // Testing the evaluation with a column-major matrix and a row-major matrix
871 //=====================================================================================
872
873 {
874 const auto res ( evaluate( olhs_ - rhs_ ) );
875 const auto refres( evaluate( reflhs_ - refrhs_ ) );
876
877 if( !isEqual( res, refres ) ) {
878 std::ostringstream oss;
879 oss << " Test: Evaluation with the given matrices\n"
880 << " Error: Failed evaluation\n"
881 << " Details:\n"
882 << " Random seed = " << blaze::getSeed() << "\n"
883 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
884 << " " << typeid( olhs_ ).name() << "\n"
885 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
886 << " " << typeid( rhs_ ).name() << "\n"
887 << " Deduced result type:\n"
888 << " " << typeid( res ).name() << "\n"
889 << " Deduced reference result type:\n"
890 << " " << typeid( refres ).name() << "\n"
891 << " Result:\n" << res << "\n"
892 << " Expected result:\n" << refres << "\n";
893 throw std::runtime_error( oss.str() );
894 }
895 }
896
897 {
898 const auto res ( evaluate( eval( olhs_ ) - eval( rhs_ ) ) );
899 const auto refres( evaluate( eval( reflhs_ ) - eval( refrhs_ ) ) );
900
901 if( !isEqual( res, refres ) ) {
902 std::ostringstream oss;
903 oss << " Test: Evaluation with the given matrices\n"
904 << " Error: Failed evaluation\n"
905 << " Details:\n"
906 << " Random seed = " << blaze::getSeed() << "\n"
907 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
908 << " " << typeid( olhs_ ).name() << "\n"
909 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
910 << " " << typeid( rhs_ ).name() << "\n"
911 << " Deduced result type:\n"
912 << " " << typeid( res ).name() << "\n"
913 << " Deduced reference result type:\n"
914 << " " << typeid( refres ).name() << "\n"
915 << " Result:\n" << res << "\n"
916 << " Expected result:\n" << refres << "\n";
917 throw std::runtime_error( oss.str() );
918 }
919 }
920
921
922 //=====================================================================================
923 // Testing the evaluation with two column-major matrices
924 //=====================================================================================
925
926 {
927 const auto res ( evaluate( olhs_ - orhs_ ) );
928 const auto refres( evaluate( reflhs_ - refrhs_ ) );
929
930 if( !isEqual( res, refres ) ) {
931 std::ostringstream oss;
932 oss << " Test: Evaluation with the given matrices\n"
933 << " Error: Failed evaluation\n"
934 << " Details:\n"
935 << " Random seed = " << blaze::getSeed() << "\n"
936 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
937 << " " << typeid( olhs_ ).name() << "\n"
938 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
939 << " " << typeid( orhs_ ).name() << "\n"
940 << " Deduced result type:\n"
941 << " " << typeid( res ).name() << "\n"
942 << " Deduced reference result type:\n"
943 << " " << typeid( refres ).name() << "\n"
944 << " Result:\n" << res << "\n"
945 << " Expected result:\n" << refres << "\n";
946 throw std::runtime_error( oss.str() );
947 }
948 }
949
950 {
951 const auto res ( evaluate( eval( olhs_ ) - eval( orhs_ ) ) );
952 const auto refres( evaluate( eval( reflhs_ ) - eval( refrhs_ ) ) );
953
954 if( !isEqual( res, refres ) ) {
955 std::ostringstream oss;
956 oss << " Test: Evaluation with the given matrices\n"
957 << " Error: Failed evaluation\n"
958 << " Details:\n"
959 << " Random seed = " << blaze::getSeed() << "\n"
960 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
961 << " " << typeid( olhs_ ).name() << "\n"
962 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
963 << " " << typeid( orhs_ ).name() << "\n"
964 << " Deduced result type:\n"
965 << " " << typeid( res ).name() << "\n"
966 << " Deduced reference result type:\n"
967 << " " << typeid( refres ).name() << "\n"
968 << " Result:\n" << res << "\n"
969 << " Expected result:\n" << refres << "\n";
970 throw std::runtime_error( oss.str() );
971 }
972 }
973 }
974 //*************************************************************************************************
975
976
977 //*************************************************************************************************
978 /*!\brief Testing the matrix element access.
979 //
980 // \return void
981 // \exception std::runtime_error Element access error detected.
982 //
983 // This function tests the element access via the subscript operator. In case any
984 // error is detected, a \a std::runtime_error exception is thrown.
985 */
986 template< typename MT1 // Type of the left-hand side sparse matrix
987 , typename MT2 > // Type of the right-hand side sparse matrix
testElementAccess()988 void OperationTest<MT1,MT2>::testElementAccess()
989 {
990 using blaze::equal;
991
992
993 //=====================================================================================
994 // Testing the element access with two row-major matrices
995 //=====================================================================================
996
997 if( lhs_.rows() > 0UL && lhs_.columns() > 0UL )
998 {
999 const size_t m( lhs_.rows() - 1UL );
1000 const size_t n( lhs_.columns() - 1UL );
1001
1002 if( !equal( ( lhs_ - rhs_ )(m,n), ( reflhs_ - refrhs_ )(m,n) ) ||
1003 !equal( ( lhs_ - rhs_ ).at(m,n), ( reflhs_ - refrhs_ ).at(m,n) ) ) {
1004 std::ostringstream oss;
1005 oss << " Test : Element access of subtraction expression\n"
1006 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1007 << " Details:\n"
1008 << " Random seed = " << blaze::getSeed() << "\n"
1009 << " Left-hand side row-major sparse matrix type:\n"
1010 << " " << typeid( MT1 ).name() << "\n"
1011 << " Right-hand side row-major sparse matrix type:\n"
1012 << " " << typeid( MT2 ).name() << "\n";
1013 throw std::runtime_error( oss.str() );
1014 }
1015
1016 if( !equal( ( lhs_ - eval( rhs_ ) )(m,n), ( reflhs_ - eval( refrhs_ ) )(m,n) ) ||
1017 !equal( ( lhs_ - eval( rhs_ ) ).at(m,n), ( reflhs_ - eval( refrhs_ ) ).at(m,n) ) ) {
1018 std::ostringstream oss;
1019 oss << " Test : Element access of right evaluated subtraction expression\n"
1020 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1021 << " Details:\n"
1022 << " Random seed = " << blaze::getSeed() << "\n"
1023 << " Left-hand side row-major sparse matrix type:\n"
1024 << " " << typeid( MT1 ).name() << "\n"
1025 << " Right-hand side row-major sparse matrix type:\n"
1026 << " " << typeid( MT2 ).name() << "\n";
1027 throw std::runtime_error( oss.str() );
1028 }
1029
1030 if( !equal( ( eval( lhs_ ) - rhs_ )(m,n), ( eval( reflhs_ ) - refrhs_ )(m,n) ) ||
1031 !equal( ( eval( lhs_ ) - rhs_ ).at(m,n), ( eval( reflhs_ ) - refrhs_ ).at(m,n) ) ) {
1032 std::ostringstream oss;
1033 oss << " Test : Element access of left evaluated subtraction expression\n"
1034 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1035 << " Details:\n"
1036 << " Random seed = " << blaze::getSeed() << "\n"
1037 << " Left-hand side row-major sparse matrix type:\n"
1038 << " " << typeid( MT1 ).name() << "\n"
1039 << " Right-hand side row-major sparse matrix type:\n"
1040 << " " << typeid( MT2 ).name() << "\n";
1041 throw std::runtime_error( oss.str() );
1042 }
1043
1044 if( !equal( ( eval( lhs_ ) - eval( rhs_ ) )(m,n), ( eval( reflhs_ ) - eval( refrhs_ ) )(m,n) ) ||
1045 !equal( ( eval( lhs_ ) - eval( rhs_ ) ).at(m,n), ( eval( reflhs_ ) - eval( refrhs_ ) ).at(m,n) ) ) {
1046 std::ostringstream oss;
1047 oss << " Test : Element access of fully evaluated subtraction expression\n"
1048 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1049 << " Details:\n"
1050 << " Random seed = " << blaze::getSeed() << "\n"
1051 << " Left-hand side row-major sparse matrix type:\n"
1052 << " " << typeid( MT1 ).name() << "\n"
1053 << " Right-hand side row-major sparse matrix type:\n"
1054 << " " << typeid( MT2 ).name() << "\n";
1055 throw std::runtime_error( oss.str() );
1056 }
1057 }
1058
1059 try {
1060 ( lhs_ - rhs_ ).at( 0UL, lhs_.columns() );
1061
1062 std::ostringstream oss;
1063 oss << " Test : Checked element access of subtraction expression\n"
1064 << " Error: Out-of-bound access succeeded\n"
1065 << " Details:\n"
1066 << " Random seed = " << blaze::getSeed() << "\n"
1067 << " Left-hand side row-major sparse matrix type:\n"
1068 << " " << typeid( MT1 ).name() << "\n"
1069 << " Right-hand side row-major sparse matrix type:\n"
1070 << " " << typeid( MT2 ).name() << "\n";
1071 throw std::runtime_error( oss.str() );
1072 }
1073 catch( std::out_of_range& ) {}
1074
1075 try {
1076 ( lhs_ - rhs_ ).at( lhs_.rows(), 0UL );
1077
1078 std::ostringstream oss;
1079 oss << " Test : Checked element access of subtraction expression\n"
1080 << " Error: Out-of-bound access succeeded\n"
1081 << " Details:\n"
1082 << " Random seed = " << blaze::getSeed() << "\n"
1083 << " Left-hand side row-major sparse matrix type:\n"
1084 << " " << typeid( MT1 ).name() << "\n"
1085 << " Right-hand side row-major sparse matrix type:\n"
1086 << " " << typeid( MT2 ).name() << "\n";
1087 throw std::runtime_error( oss.str() );
1088 }
1089 catch( std::out_of_range& ) {}
1090
1091
1092 //=====================================================================================
1093 // Testing the element access with a row-major matrix and a column-major matrix
1094 //=====================================================================================
1095
1096 if( lhs_.rows() > 0UL && lhs_.columns() > 0UL )
1097 {
1098 const size_t m( lhs_.rows() - 1UL );
1099 const size_t n( lhs_.columns() - 1UL );
1100
1101 if( !equal( ( lhs_ - orhs_ )(m,n), ( reflhs_ - refrhs_ )(m,n) ) ||
1102 !equal( ( lhs_ - orhs_ ).at(m,n), ( reflhs_ - refrhs_ ).at(m,n) ) ) {
1103 std::ostringstream oss;
1104 oss << " Test : Element access of subtraction expression\n"
1105 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1106 << " Details:\n"
1107 << " Random seed = " << blaze::getSeed() << "\n"
1108 << " Left-hand side row-major sparse matrix type:\n"
1109 << " " << typeid( MT1 ).name() << "\n"
1110 << " Right-hand side column-major sparse matrix type:\n"
1111 << " " << typeid( OMT2 ).name() << "\n";
1112 throw std::runtime_error( oss.str() );
1113 }
1114
1115 if( !equal( ( lhs_ - eval( orhs_ ) )(m,n), ( reflhs_ - eval( refrhs_ ) )(m,n) ) ||
1116 !equal( ( lhs_ - eval( orhs_ ) ).at(m,n), ( reflhs_ - eval( refrhs_ ) ).at(m,n) ) ) {
1117 std::ostringstream oss;
1118 oss << " Test : Element access of right evaluated subtraction expression\n"
1119 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1120 << " Details:\n"
1121 << " Random seed = " << blaze::getSeed() << "\n"
1122 << " Left-hand side row-major sparse matrix type:\n"
1123 << " " << typeid( MT1 ).name() << "\n"
1124 << " Right-hand side column-major sparse matrix type:\n"
1125 << " " << typeid( OMT2 ).name() << "\n";
1126 throw std::runtime_error( oss.str() );
1127 }
1128
1129 if( !equal( ( eval( lhs_ ) - orhs_ )(m,n), ( eval( reflhs_ ) - refrhs_ )(m,n) ) ||
1130 !equal( ( eval( lhs_ ) - orhs_ ).at(m,n), ( eval( reflhs_ ) - refrhs_ ).at(m,n) ) ) {
1131 std::ostringstream oss;
1132 oss << " Test : Element access of left evaluated subtraction expression\n"
1133 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1134 << " Details:\n"
1135 << " Random seed = " << blaze::getSeed() << "\n"
1136 << " Left-hand side row-major sparse matrix type:\n"
1137 << " " << typeid( MT1 ).name() << "\n"
1138 << " Right-hand side column-major sparse matrix type:\n"
1139 << " " << typeid( OMT2 ).name() << "\n";
1140 throw std::runtime_error( oss.str() );
1141 }
1142
1143 if( !equal( ( eval( lhs_ ) - eval( orhs_ ) )(m,n), ( eval( reflhs_ ) - eval( refrhs_ ) )(m,n) ) ||
1144 !equal( ( eval( lhs_ ) - eval( orhs_ ) ).at(m,n), ( eval( reflhs_ ) - eval( refrhs_ ) ).at(m,n) ) ) {
1145 std::ostringstream oss;
1146 oss << " Test : Element access of fully evaluated subtraction expression\n"
1147 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1148 << " Details:\n"
1149 << " Random seed = " << blaze::getSeed() << "\n"
1150 << " Left-hand side row-major sparse matrix type:\n"
1151 << " " << typeid( MT1 ).name() << "\n"
1152 << " Right-hand side column-major sparse matrix type:\n"
1153 << " " << typeid( OMT2 ).name() << "\n";
1154 throw std::runtime_error( oss.str() );
1155 }
1156 }
1157
1158 try {
1159 ( lhs_ - orhs_ ).at( 0UL, lhs_.columns() );
1160
1161 std::ostringstream oss;
1162 oss << " Test : Checked element access of subtraction expression\n"
1163 << " Error: Out-of-bound access succeeded\n"
1164 << " Details:\n"
1165 << " Random seed = " << blaze::getSeed() << "\n"
1166 << " Left-hand side row-major sparse matrix type:\n"
1167 << " " << typeid( MT1 ).name() << "\n"
1168 << " Right-hand side column-major sparse matrix type:\n"
1169 << " " << typeid( OMT2 ).name() << "\n";
1170 throw std::runtime_error( oss.str() );
1171 }
1172 catch( std::out_of_range& ) {}
1173
1174 try {
1175 ( lhs_ - orhs_ ).at( lhs_.rows(), 0UL );
1176
1177 std::ostringstream oss;
1178 oss << " Test : Checked element access of subtraction expression\n"
1179 << " Error: Out-of-bound access succeeded\n"
1180 << " Details:\n"
1181 << " Random seed = " << blaze::getSeed() << "\n"
1182 << " Left-hand side row-major sparse matrix type:\n"
1183 << " " << typeid( MT1 ).name() << "\n"
1184 << " Right-hand side column-major sparse matrix type:\n"
1185 << " " << typeid( OMT2 ).name() << "\n";
1186 throw std::runtime_error( oss.str() );
1187 }
1188 catch( std::out_of_range& ) {}
1189
1190
1191 //=====================================================================================
1192 // Testing the element access with a column-major matrix and a row-major matrix
1193 //=====================================================================================
1194
1195 if( olhs_.rows() > 0UL && olhs_.columns() > 0UL )
1196 {
1197 const size_t m( olhs_.rows() - 1UL );
1198 const size_t n( olhs_.columns() - 1UL );
1199
1200 if( !equal( ( olhs_ - rhs_ )(m,n), ( reflhs_ - refrhs_ )(m,n) ) ||
1201 !equal( ( olhs_ - rhs_ ).at(m,n), ( reflhs_ - refrhs_ ).at(m,n) ) ) {
1202 std::ostringstream oss;
1203 oss << " Test : Element access of subtraction expression\n"
1204 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1205 << " Details:\n"
1206 << " Random seed = " << blaze::getSeed() << "\n"
1207 << " Left-hand side column-major sparse matrix type:\n"
1208 << " " << typeid( OMT1 ).name() << "\n"
1209 << " Right-hand side row-major sparse matrix type:\n"
1210 << " " << typeid( MT2 ).name() << "\n";
1211 throw std::runtime_error( oss.str() );
1212 }
1213
1214 if( !equal( ( olhs_ - eval( rhs_ ) )(m,n), ( reflhs_ - eval( refrhs_ ) )(m,n) ) ||
1215 !equal( ( olhs_ - eval( rhs_ ) ).at(m,n), ( reflhs_ - eval( refrhs_ ) ).at(m,n) ) ) {
1216 std::ostringstream oss;
1217 oss << " Test : Element access of right evaluated subtraction expression\n"
1218 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1219 << " Details:\n"
1220 << " Random seed = " << blaze::getSeed() << "\n"
1221 << " Left-hand side column-major sparse matrix type:\n"
1222 << " " << typeid( OMT1 ).name() << "\n"
1223 << " Right-hand side row-major sparse matrix type:\n"
1224 << " " << typeid( MT2 ).name() << "\n";
1225 throw std::runtime_error( oss.str() );
1226 }
1227
1228 if( !equal( ( eval( olhs_ ) - rhs_ )(m,n), ( eval( reflhs_ ) - refrhs_ )(m,n) ) ||
1229 !equal( ( eval( olhs_ ) - rhs_ ).at(m,n), ( eval( reflhs_ ) - refrhs_ ).at(m,n) ) ) {
1230 std::ostringstream oss;
1231 oss << " Test : Element access of left evaluated subtraction expression\n"
1232 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1233 << " Details:\n"
1234 << " Random seed = " << blaze::getSeed() << "\n"
1235 << " Left-hand side column-major sparse matrix type:\n"
1236 << " " << typeid( OMT1 ).name() << "\n"
1237 << " Right-hand side row-major sparse matrix type:\n"
1238 << " " << typeid( MT2 ).name() << "\n";
1239 throw std::runtime_error( oss.str() );
1240 }
1241
1242 if( !equal( ( eval( olhs_ ) - eval( rhs_ ) )(m,n), ( eval( reflhs_ ) - eval( refrhs_ ) )(m,n) ) ||
1243 !equal( ( eval( olhs_ ) - eval( rhs_ ) ).at(m,n), ( eval( reflhs_ ) - eval( refrhs_ ) ).at(m,n) ) ) {
1244 std::ostringstream oss;
1245 oss << " Test : Element access of fully evaluated subtraction expression\n"
1246 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1247 << " Details:\n"
1248 << " Random seed = " << blaze::getSeed() << "\n"
1249 << " Left-hand side column-major sparse matrix type:\n"
1250 << " " << typeid( OMT1 ).name() << "\n"
1251 << " Right-hand side row-major sparse matrix type:\n"
1252 << " " << typeid( MT2 ).name() << "\n";
1253 throw std::runtime_error( oss.str() );
1254 }
1255 }
1256
1257 try {
1258 ( olhs_ - rhs_ ).at( 0UL, lhs_.columns() );
1259
1260 std::ostringstream oss;
1261 oss << " Test : Checked element access of subtraction expression\n"
1262 << " Error: Out-of-bound access succeeded\n"
1263 << " Details:\n"
1264 << " Random seed = " << blaze::getSeed() << "\n"
1265 << " Left-hand side column-major sparse matrix type:\n"
1266 << " " << typeid( OMT1 ).name() << "\n"
1267 << " Right-hand side row-major sparse matrix type:\n"
1268 << " " << typeid( MT2 ).name() << "\n";
1269 throw std::runtime_error( oss.str() );
1270 }
1271 catch( std::out_of_range& ) {}
1272
1273 try {
1274 ( olhs_ - rhs_ ).at( lhs_.rows(), 0UL );
1275
1276 std::ostringstream oss;
1277 oss << " Test : Checked element access of subtraction expression\n"
1278 << " Error: Out-of-bound access succeeded\n"
1279 << " Details:\n"
1280 << " Random seed = " << blaze::getSeed() << "\n"
1281 << " Left-hand side column-major sparse matrix type:\n"
1282 << " " << typeid( OMT1 ).name() << "\n"
1283 << " Right-hand side row-major sparse matrix type:\n"
1284 << " " << typeid( MT2 ).name() << "\n";
1285 throw std::runtime_error( oss.str() );
1286 }
1287 catch( std::out_of_range& ) {}
1288
1289
1290 //=====================================================================================
1291 // Testing the element access with two column-major matrices
1292 //=====================================================================================
1293
1294 if( olhs_.rows() > 0UL && olhs_.columns() > 0UL )
1295 {
1296 const size_t m( olhs_.rows() - 1UL );
1297 const size_t n( olhs_.columns() - 1UL );
1298
1299 if( !equal( ( olhs_ - orhs_ )(m,n), ( reflhs_ - refrhs_ )(m,n) ) ||
1300 !equal( ( olhs_ - orhs_ ).at(m,n), ( reflhs_ - refrhs_ ).at(m,n) ) ) {
1301 std::ostringstream oss;
1302 oss << " Test : Element access of subtraction expression\n"
1303 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1304 << " Details:\n"
1305 << " Random seed = " << blaze::getSeed() << "\n"
1306 << " Left-hand side column-major sparse matrix type:\n"
1307 << " " << typeid( OMT1 ).name() << "\n"
1308 << " Right-hand side column-major sparse matrix type:\n"
1309 << " " << typeid( OMT2 ).name() << "\n";
1310 throw std::runtime_error( oss.str() );
1311 }
1312
1313 if( !equal( ( olhs_ - eval( orhs_ ) )(m,n), ( reflhs_ - eval( refrhs_ ) )(m,n) ) ||
1314 !equal( ( olhs_ - eval( orhs_ ) ).at(m,n), ( reflhs_ - eval( refrhs_ ) ).at(m,n) ) ) {
1315 std::ostringstream oss;
1316 oss << " Test : Element access of right evaluated subtraction expression\n"
1317 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1318 << " Details:\n"
1319 << " Random seed = " << blaze::getSeed() << "\n"
1320 << " Left-hand side column-major sparse matrix type:\n"
1321 << " " << typeid( OMT1 ).name() << "\n"
1322 << " Right-hand side column-major sparse matrix type:\n"
1323 << " " << typeid( OMT2 ).name() << "\n";
1324 throw std::runtime_error( oss.str() );
1325 }
1326
1327 if( !equal( ( eval( olhs_ ) - orhs_ )(m,n), ( eval( reflhs_ ) - refrhs_ )(m,n) ) ||
1328 !equal( ( eval( olhs_ ) - orhs_ ).at(m,n), ( eval( reflhs_ ) - refrhs_ ).at(m,n) ) ) {
1329 std::ostringstream oss;
1330 oss << " Test : Element access of left evaluated subtraction expression\n"
1331 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1332 << " Details:\n"
1333 << " Random seed = " << blaze::getSeed() << "\n"
1334 << " Left-hand side column-major sparse matrix type:\n"
1335 << " " << typeid( OMT1 ).name() << "\n"
1336 << " Right-hand side column-major sparse matrix type:\n"
1337 << " " << typeid( OMT2 ).name() << "\n";
1338 throw std::runtime_error( oss.str() );
1339 }
1340
1341 if( !equal( ( eval( olhs_ ) - eval( orhs_ ) )(m,n), ( eval( reflhs_ ) - eval( refrhs_ ) )(m,n) ) ||
1342 !equal( ( eval( olhs_ ) - eval( orhs_ ) ).at(m,n), ( eval( reflhs_ ) - eval( refrhs_ ) ).at(m,n) ) ) {
1343 std::ostringstream oss;
1344 oss << " Test : Element access of fully evaluated subtraction expression\n"
1345 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1346 << " Details:\n"
1347 << " Random seed = " << blaze::getSeed() << "\n"
1348 << " Left-hand side column-major sparse matrix type:\n"
1349 << " " << typeid( OMT1 ).name() << "\n"
1350 << " Right-hand side column-major sparse matrix type:\n"
1351 << " " << typeid( OMT2 ).name() << "\n";
1352 throw std::runtime_error( oss.str() );
1353 }
1354 }
1355
1356 try {
1357 ( olhs_ - orhs_ ).at( 0UL, lhs_.columns() );
1358
1359 std::ostringstream oss;
1360 oss << " Test : Checked element access of subtraction expression\n"
1361 << " Error: Out-of-bound access succeeded\n"
1362 << " Details:\n"
1363 << " Random seed = " << blaze::getSeed() << "\n"
1364 << " Left-hand side column-major sparse matrix type:\n"
1365 << " " << typeid( OMT1 ).name() << "\n"
1366 << " Right-hand side column-major sparse matrix type:\n"
1367 << " " << typeid( OMT2 ).name() << "\n";
1368 throw std::runtime_error( oss.str() );
1369 }
1370 catch( std::out_of_range& ) {}
1371
1372 try {
1373 ( olhs_ - orhs_ ).at( lhs_.rows(), 0UL );
1374
1375 std::ostringstream oss;
1376 oss << " Test : Checked element access of subtraction expression\n"
1377 << " Error: Out-of-bound access succeeded\n"
1378 << " Details:\n"
1379 << " Random seed = " << blaze::getSeed() << "\n"
1380 << " Left-hand side column-major sparse matrix type:\n"
1381 << " " << typeid( OMT1 ).name() << "\n"
1382 << " Right-hand side column-major sparse matrix type:\n"
1383 << " " << typeid( OMT2 ).name() << "\n";
1384 throw std::runtime_error( oss.str() );
1385 }
1386 catch( std::out_of_range& ) {}
1387 }
1388 //*************************************************************************************************
1389
1390
1391 //*************************************************************************************************
1392 /*!\brief Testing the plain sparse matrix/sparse matrix subtraction.
1393 //
1394 // \return void
1395 // \exception std::runtime_error Subtraction error detected.
1396 //
1397 // This function tests the plain matrix subtraction with plain assignment, addition assignment,
1398 // subtraction assignment, and Schur product assignment. In case any error resulting from the
1399 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
1400 // thrown.
1401 */
1402 template< typename MT1 // Type of the left-hand side sparse matrix
1403 , typename MT2 > // Type of the right-hand side sparse matrix
testBasicOperation()1404 void OperationTest<MT1,MT2>::testBasicOperation()
1405 {
1406 #if BLAZETEST_MATHTEST_TEST_BASIC_OPERATION
1407 if( BLAZETEST_MATHTEST_TEST_BASIC_OPERATION > 1 )
1408 {
1409 //=====================================================================================
1410 // Subtraction
1411 //=====================================================================================
1412
1413 // Subtraction with the given matrices
1414 {
1415 test_ = "Subtraction with the given matrices";
1416 error_ = "Failed subtraction operation";
1417
1418 try {
1419 initResults();
1420 dres_ = lhs_ - rhs_;
1421 odres_ = lhs_ - rhs_;
1422 sres_ = lhs_ - rhs_;
1423 osres_ = lhs_ - rhs_;
1424 refres_ = reflhs_ - refrhs_;
1425 }
1426 catch( std::exception& ex ) {
1427 convertException<MT1,MT2>( ex );
1428 }
1429
1430 checkResults<MT1,MT2>();
1431
1432 try {
1433 initResults();
1434 dres_ = lhs_ - orhs_;
1435 odres_ = lhs_ - orhs_;
1436 sres_ = lhs_ - orhs_;
1437 osres_ = lhs_ - orhs_;
1438 refres_ = reflhs_ - refrhs_;
1439 }
1440 catch( std::exception& ex ) {
1441 convertException<MT1,OMT2>( ex );
1442 }
1443
1444 checkResults<MT1,OMT2>();
1445
1446 try {
1447 initResults();
1448 dres_ = olhs_ - rhs_;
1449 odres_ = olhs_ - rhs_;
1450 sres_ = olhs_ - rhs_;
1451 osres_ = olhs_ - rhs_;
1452 refres_ = reflhs_ - refrhs_;
1453 }
1454 catch( std::exception& ex ) {
1455 convertException<OMT1,MT2>( ex );
1456 }
1457
1458 checkResults<OMT1,MT2>();
1459
1460 try {
1461 initResults();
1462 dres_ = olhs_ - orhs_;
1463 odres_ = olhs_ - orhs_;
1464 sres_ = olhs_ - orhs_;
1465 osres_ = olhs_ - orhs_;
1466 refres_ = reflhs_ - refrhs_;
1467 }
1468 catch( std::exception& ex ) {
1469 convertException<OMT1,OMT2>( ex );
1470 }
1471
1472 checkResults<OMT1,OMT2>();
1473 }
1474
1475 // Subtraction with evaluated matrices
1476 {
1477 test_ = "Subtraction with evaluated matrices";
1478 error_ = "Failed subtraction operation";
1479
1480 try {
1481 initResults();
1482 dres_ = eval( lhs_ ) - eval( rhs_ );
1483 odres_ = eval( lhs_ ) - eval( rhs_ );
1484 sres_ = eval( lhs_ ) - eval( rhs_ );
1485 osres_ = eval( lhs_ ) - eval( rhs_ );
1486 refres_ = eval( reflhs_ ) - eval( refrhs_ );
1487 }
1488 catch( std::exception& ex ) {
1489 convertException<MT1,MT2>( ex );
1490 }
1491
1492 checkResults<MT1,MT2>();
1493
1494 try {
1495 initResults();
1496 dres_ = eval( lhs_ ) - eval( orhs_ );
1497 odres_ = eval( lhs_ ) - eval( orhs_ );
1498 sres_ = eval( lhs_ ) - eval( orhs_ );
1499 osres_ = eval( lhs_ ) - eval( orhs_ );
1500 refres_ = eval( reflhs_ ) - eval( refrhs_ );
1501 }
1502 catch( std::exception& ex ) {
1503 convertException<MT1,OMT2>( ex );
1504 }
1505
1506 checkResults<MT1,OMT2>();
1507
1508 try {
1509 initResults();
1510 dres_ = eval( olhs_ ) - eval( rhs_ );
1511 odres_ = eval( olhs_ ) - eval( rhs_ );
1512 sres_ = eval( olhs_ ) - eval( rhs_ );
1513 osres_ = eval( olhs_ ) - eval( rhs_ );
1514 refres_ = eval( reflhs_ ) - eval( refrhs_ );
1515 }
1516 catch( std::exception& ex ) {
1517 convertException<OMT1,MT2>( ex );
1518 }
1519
1520 checkResults<OMT1,MT2>();
1521
1522 try {
1523 initResults();
1524 dres_ = eval( olhs_ ) - eval( orhs_ );
1525 odres_ = eval( olhs_ ) - eval( orhs_ );
1526 sres_ = eval( olhs_ ) - eval( orhs_ );
1527 osres_ = eval( olhs_ ) - eval( orhs_ );
1528 refres_ = eval( reflhs_ ) - eval( refrhs_ );
1529 }
1530 catch( std::exception& ex ) {
1531 convertException<OMT1,OMT2>( ex );
1532 }
1533
1534 checkResults<OMT1,OMT2>();
1535 }
1536
1537
1538 //=====================================================================================
1539 // Subtraction with addition assignment
1540 //=====================================================================================
1541
1542 // Subtraction with addition assignment with the given matrices
1543 {
1544 test_ = "Subtraction with addition assignment with the given matrices";
1545 error_ = "Failed addition assignment operation";
1546
1547 try {
1548 initResults();
1549 dres_ += lhs_ - rhs_;
1550 odres_ += lhs_ - rhs_;
1551 sres_ += lhs_ - rhs_;
1552 osres_ += lhs_ - rhs_;
1553 refres_ += reflhs_ - refrhs_;
1554 }
1555 catch( std::exception& ex ) {
1556 convertException<MT1,MT2>( ex );
1557 }
1558
1559 checkResults<MT1,MT2>();
1560
1561 try {
1562 initResults();
1563 dres_ += lhs_ - orhs_;
1564 odres_ += lhs_ - orhs_;
1565 sres_ += lhs_ - orhs_;
1566 osres_ += lhs_ - orhs_;
1567 refres_ += reflhs_ - refrhs_;
1568 }
1569 catch( std::exception& ex ) {
1570 convertException<MT1,OMT2>( ex );
1571 }
1572
1573 checkResults<MT1,OMT2>();
1574
1575 try {
1576 initResults();
1577 dres_ += olhs_ - rhs_;
1578 odres_ += olhs_ - rhs_;
1579 sres_ += olhs_ - rhs_;
1580 osres_ += olhs_ - rhs_;
1581 refres_ += reflhs_ - refrhs_;
1582 }
1583 catch( std::exception& ex ) {
1584 convertException<OMT1,MT2>( ex );
1585 }
1586
1587 checkResults<OMT1,MT2>();
1588
1589 try {
1590 initResults();
1591 dres_ += olhs_ - orhs_;
1592 odres_ += olhs_ - orhs_;
1593 sres_ += olhs_ - orhs_;
1594 osres_ += olhs_ - orhs_;
1595 refres_ += reflhs_ - refrhs_;
1596 }
1597 catch( std::exception& ex ) {
1598 convertException<OMT1,OMT2>( ex );
1599 }
1600
1601 checkResults<OMT1,OMT2>();
1602 }
1603
1604 // Subtraction with addition assignment with evaluated matrices
1605 {
1606 test_ = "Subtraction with addition assignment with evaluated matrices";
1607 error_ = "Failed addition assignment operation";
1608
1609 try {
1610 initResults();
1611 dres_ += eval( lhs_ ) - eval( rhs_ );
1612 odres_ += eval( lhs_ ) - eval( rhs_ );
1613 sres_ += eval( lhs_ ) - eval( rhs_ );
1614 osres_ += eval( lhs_ ) - eval( rhs_ );
1615 refres_ += eval( reflhs_ ) - eval( refrhs_ );
1616 }
1617 catch( std::exception& ex ) {
1618 convertException<MT1,MT2>( ex );
1619 }
1620
1621 checkResults<MT1,MT2>();
1622
1623 try {
1624 initResults();
1625 dres_ += eval( lhs_ ) - eval( orhs_ );
1626 odres_ += eval( lhs_ ) - eval( orhs_ );
1627 sres_ += eval( lhs_ ) - eval( orhs_ );
1628 osres_ += eval( lhs_ ) - eval( orhs_ );
1629 refres_ += eval( reflhs_ ) - eval( refrhs_ );
1630 }
1631 catch( std::exception& ex ) {
1632 convertException<MT1,OMT2>( ex );
1633 }
1634
1635 checkResults<MT1,OMT2>();
1636
1637 try {
1638 initResults();
1639 dres_ += eval( olhs_ ) - eval( rhs_ );
1640 odres_ += eval( olhs_ ) - eval( rhs_ );
1641 sres_ += eval( olhs_ ) - eval( rhs_ );
1642 osres_ += eval( olhs_ ) - eval( rhs_ );
1643 refres_ += eval( reflhs_ ) - eval( refrhs_ );
1644 }
1645 catch( std::exception& ex ) {
1646 convertException<OMT1,MT2>( ex );
1647 }
1648
1649 checkResults<OMT1,MT2>();
1650
1651 try {
1652 initResults();
1653 dres_ += eval( olhs_ ) - eval( orhs_ );
1654 odres_ += eval( olhs_ ) - eval( orhs_ );
1655 sres_ += eval( olhs_ ) - eval( orhs_ );
1656 osres_ += eval( olhs_ ) - eval( orhs_ );
1657 refres_ += eval( reflhs_ ) - eval( refrhs_ );
1658 }
1659 catch( std::exception& ex ) {
1660 convertException<OMT1,OMT2>( ex );
1661 }
1662
1663 checkResults<OMT1,OMT2>();
1664 }
1665
1666
1667 //=====================================================================================
1668 // Subtraction with subtraction assignment with the given matrices
1669 //=====================================================================================
1670
1671 // Subtraction with subtraction assignment with the given matrices
1672 {
1673 test_ = "Subtraction with subtraction assignment with the given matrices";
1674 error_ = "Failed subtraction assignment operation";
1675
1676 try {
1677 initResults();
1678 dres_ -= lhs_ - rhs_;
1679 odres_ -= lhs_ - rhs_;
1680 sres_ -= lhs_ - rhs_;
1681 osres_ -= lhs_ - rhs_;
1682 refres_ -= reflhs_ - refrhs_;
1683 }
1684 catch( std::exception& ex ) {
1685 convertException<MT1,MT2>( ex );
1686 }
1687
1688 checkResults<MT1,MT2>();
1689
1690 try {
1691 initResults();
1692 dres_ -= lhs_ - orhs_;
1693 odres_ -= lhs_ - orhs_;
1694 sres_ -= lhs_ - orhs_;
1695 osres_ -= lhs_ - orhs_;
1696 refres_ -= reflhs_ - refrhs_;
1697 }
1698 catch( std::exception& ex ) {
1699 convertException<MT1,OMT2>( ex );
1700 }
1701
1702 checkResults<MT1,OMT2>();
1703
1704 try {
1705 initResults();
1706 dres_ -= olhs_ - rhs_;
1707 odres_ -= olhs_ - rhs_;
1708 sres_ -= olhs_ - rhs_;
1709 osres_ -= olhs_ - rhs_;
1710 refres_ -= reflhs_ - refrhs_;
1711 }
1712 catch( std::exception& ex ) {
1713 convertException<OMT1,MT2>( ex );
1714 }
1715
1716 checkResults<OMT1,MT2>();
1717
1718 try {
1719 initResults();
1720 dres_ -= olhs_ - orhs_;
1721 odres_ -= olhs_ - orhs_;
1722 sres_ -= olhs_ - orhs_;
1723 osres_ -= olhs_ - orhs_;
1724 refres_ -= reflhs_ - refrhs_;
1725 }
1726 catch( std::exception& ex ) {
1727 convertException<OMT1,OMT2>( ex );
1728 }
1729
1730 checkResults<OMT1,OMT2>();
1731 }
1732
1733 // Subtraction with subtraction assignment with evaluated matrices
1734 {
1735 test_ = "Subtraction with subtraction assignment with evaluated matrices";
1736 error_ = "Failed subtraction assignment operation";
1737
1738 try {
1739 initResults();
1740 dres_ -= eval( lhs_ ) - eval( rhs_ );
1741 odres_ -= eval( lhs_ ) - eval( rhs_ );
1742 sres_ -= eval( lhs_ ) - eval( rhs_ );
1743 osres_ -= eval( lhs_ ) - eval( rhs_ );
1744 refres_ -= eval( reflhs_ ) - eval( refrhs_ );
1745 }
1746 catch( std::exception& ex ) {
1747 convertException<MT1,MT2>( ex );
1748 }
1749
1750 checkResults<MT1,MT2>();
1751
1752 try {
1753 initResults();
1754 dres_ -= eval( lhs_ ) - eval( orhs_ );
1755 odres_ -= eval( lhs_ ) - eval( orhs_ );
1756 sres_ -= eval( lhs_ ) - eval( orhs_ );
1757 osres_ -= eval( lhs_ ) - eval( orhs_ );
1758 refres_ -= eval( reflhs_ ) - eval( refrhs_ );
1759 }
1760 catch( std::exception& ex ) {
1761 convertException<MT1,OMT2>( ex );
1762 }
1763
1764 checkResults<MT1,OMT2>();
1765
1766 try {
1767 initResults();
1768 dres_ -= eval( olhs_ ) - eval( rhs_ );
1769 odres_ -= eval( olhs_ ) - eval( rhs_ );
1770 sres_ -= eval( olhs_ ) - eval( rhs_ );
1771 osres_ -= eval( olhs_ ) - eval( rhs_ );
1772 refres_ -= eval( reflhs_ ) - eval( refrhs_ );
1773 }
1774 catch( std::exception& ex ) {
1775 convertException<OMT1,MT2>( ex );
1776 }
1777
1778 checkResults<OMT1,MT2>();
1779
1780 try {
1781 initResults();
1782 dres_ -= eval( olhs_ ) - eval( orhs_ );
1783 odres_ -= eval( olhs_ ) - eval( orhs_ );
1784 sres_ -= eval( olhs_ ) - eval( orhs_ );
1785 osres_ -= eval( olhs_ ) - eval( orhs_ );
1786 refres_ -= eval( reflhs_ ) - eval( refrhs_ );
1787 }
1788 catch( std::exception& ex ) {
1789 convertException<OMT1,OMT2>( ex );
1790 }
1791
1792 checkResults<OMT1,OMT2>();
1793 }
1794
1795
1796 //=====================================================================================
1797 // Subtraction with Schur product assignment
1798 //=====================================================================================
1799
1800 // Subtraction with Schur product assignment with the given matrices
1801 {
1802 test_ = "Subtraction with Schur product assignment with the given matrices";
1803 error_ = "Failed Schur product assignment operation";
1804
1805 try {
1806 initResults();
1807 dres_ %= lhs_ - rhs_;
1808 odres_ %= lhs_ - rhs_;
1809 sres_ %= lhs_ - rhs_;
1810 osres_ %= lhs_ - rhs_;
1811 refres_ %= reflhs_ - refrhs_;
1812 }
1813 catch( std::exception& ex ) {
1814 convertException<MT1,MT2>( ex );
1815 }
1816
1817 checkResults<MT1,MT2>();
1818
1819 try {
1820 initResults();
1821 dres_ %= lhs_ - orhs_;
1822 odres_ %= lhs_ - orhs_;
1823 sres_ %= lhs_ - orhs_;
1824 osres_ %= lhs_ - orhs_;
1825 refres_ %= reflhs_ - refrhs_;
1826 }
1827 catch( std::exception& ex ) {
1828 convertException<MT1,OMT2>( ex );
1829 }
1830
1831 checkResults<MT1,OMT2>();
1832
1833 try {
1834 initResults();
1835 dres_ %= olhs_ - rhs_;
1836 odres_ %= olhs_ - rhs_;
1837 sres_ %= olhs_ - rhs_;
1838 osres_ %= olhs_ - rhs_;
1839 refres_ %= reflhs_ - refrhs_;
1840 }
1841 catch( std::exception& ex ) {
1842 convertException<OMT1,MT2>( ex );
1843 }
1844
1845 checkResults<OMT1,MT2>();
1846
1847 try {
1848 initResults();
1849 dres_ %= olhs_ - orhs_;
1850 odres_ %= olhs_ - orhs_;
1851 sres_ %= olhs_ - orhs_;
1852 osres_ %= olhs_ - orhs_;
1853 refres_ %= reflhs_ - refrhs_;
1854 }
1855 catch( std::exception& ex ) {
1856 convertException<OMT1,OMT2>( ex );
1857 }
1858
1859 checkResults<OMT1,OMT2>();
1860 }
1861
1862 // Subtraction with Schur product assignment with evaluated matrices
1863 {
1864 test_ = "Subtraction with Schur product assignment with evaluated matrices";
1865 error_ = "Failed Schur product assignment operation";
1866
1867 try {
1868 initResults();
1869 dres_ %= eval( lhs_ ) - eval( rhs_ );
1870 odres_ %= eval( lhs_ ) - eval( rhs_ );
1871 sres_ %= eval( lhs_ ) - eval( rhs_ );
1872 osres_ %= eval( lhs_ ) - eval( rhs_ );
1873 refres_ %= eval( reflhs_ ) - eval( refrhs_ );
1874 }
1875 catch( std::exception& ex ) {
1876 convertException<MT1,MT2>( ex );
1877 }
1878
1879 checkResults<MT1,MT2>();
1880
1881 try {
1882 initResults();
1883 dres_ %= eval( lhs_ ) - eval( orhs_ );
1884 odres_ %= eval( lhs_ ) - eval( orhs_ );
1885 sres_ %= eval( lhs_ ) - eval( orhs_ );
1886 osres_ %= eval( lhs_ ) - eval( orhs_ );
1887 refres_ %= eval( reflhs_ ) - eval( refrhs_ );
1888 }
1889 catch( std::exception& ex ) {
1890 convertException<MT1,OMT2>( ex );
1891 }
1892
1893 checkResults<MT1,OMT2>();
1894
1895 try {
1896 initResults();
1897 dres_ %= eval( olhs_ ) - eval( rhs_ );
1898 odres_ %= eval( olhs_ ) - eval( rhs_ );
1899 sres_ %= eval( olhs_ ) - eval( rhs_ );
1900 osres_ %= eval( olhs_ ) - eval( rhs_ );
1901 refres_ %= eval( reflhs_ ) - eval( refrhs_ );
1902 }
1903 catch( std::exception& ex ) {
1904 convertException<OMT1,MT2>( ex );
1905 }
1906
1907 checkResults<OMT1,MT2>();
1908
1909 try {
1910 initResults();
1911 dres_ %= eval( olhs_ ) - eval( orhs_ );
1912 odres_ %= eval( olhs_ ) - eval( orhs_ );
1913 sres_ %= eval( olhs_ ) - eval( orhs_ );
1914 osres_ %= eval( olhs_ ) - eval( orhs_ );
1915 refres_ %= eval( reflhs_ ) - eval( refrhs_ );
1916 }
1917 catch( std::exception& ex ) {
1918 convertException<OMT1,OMT2>( ex );
1919 }
1920
1921 checkResults<OMT1,OMT2>();
1922 }
1923 }
1924 #endif
1925 }
1926 //*************************************************************************************************
1927
1928
1929 //*************************************************************************************************
1930 /*!\brief Testing the negated sparse matrix/sparse matrix subtraction.
1931 //
1932 // \return void
1933 // \exception std::runtime_error Subtraction error detected.
1934 //
1935 // This function tests the negated matrix subtraction with plain assignment, addition assignment,
1936 // subtraction assignment, and Schur product assignment. In case any error resulting from the
1937 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
1938 // thrown.
1939 */
1940 template< typename MT1 // Type of the left-hand side sparse matrix
1941 , typename MT2 > // Type of the right-hand side sparse matrix
testNegatedOperation()1942 void OperationTest<MT1,MT2>::testNegatedOperation()
1943 {
1944 #if BLAZETEST_MATHTEST_TEST_NEGATED_OPERATION
1945 if( BLAZETEST_MATHTEST_TEST_NEGATED_OPERATION > 1 )
1946 {
1947 //=====================================================================================
1948 // Negated subtraction
1949 //=====================================================================================
1950
1951 // Negated subtraction with the given matrices
1952 {
1953 test_ = "Negated subtraction with the given matrices";
1954 error_ = "Failed subtraction operation";
1955
1956 try {
1957 initResults();
1958 dres_ = -( lhs_ - rhs_ );
1959 odres_ = -( lhs_ - rhs_ );
1960 sres_ = -( lhs_ - rhs_ );
1961 osres_ = -( lhs_ - rhs_ );
1962 refres_ = -( reflhs_ - refrhs_ );
1963 }
1964 catch( std::exception& ex ) {
1965 convertException<MT1,MT2>( ex );
1966 }
1967
1968 checkResults<MT1,MT2>();
1969
1970 try {
1971 initResults();
1972 dres_ = -( lhs_ - orhs_ );
1973 odres_ = -( lhs_ - orhs_ );
1974 sres_ = -( lhs_ - orhs_ );
1975 osres_ = -( lhs_ - orhs_ );
1976 refres_ = -( reflhs_ - refrhs_ );
1977 }
1978 catch( std::exception& ex ) {
1979 convertException<MT1,OMT2>( ex );
1980 }
1981
1982 checkResults<MT1,OMT2>();
1983
1984 try {
1985 initResults();
1986 dres_ = -( olhs_ - rhs_ );
1987 odres_ = -( olhs_ - rhs_ );
1988 sres_ = -( olhs_ - rhs_ );
1989 osres_ = -( olhs_ - rhs_ );
1990 refres_ = -( reflhs_ - refrhs_ );
1991 }
1992 catch( std::exception& ex ) {
1993 convertException<OMT1,MT2>( ex );
1994 }
1995
1996 checkResults<OMT1,MT2>();
1997
1998 try {
1999 initResults();
2000 dres_ = -( olhs_ - orhs_ );
2001 odres_ = -( olhs_ - orhs_ );
2002 sres_ = -( olhs_ - orhs_ );
2003 osres_ = -( olhs_ - orhs_ );
2004 refres_ = -( reflhs_ - refrhs_ );
2005 }
2006 catch( std::exception& ex ) {
2007 convertException<OMT1,OMT2>( ex );
2008 }
2009
2010 checkResults<OMT1,OMT2>();
2011 }
2012
2013 // Negated subtraction with evaluated matrices
2014 {
2015 test_ = "Negated subtraction with evaluated matrices";
2016 error_ = "Failed subtraction operation";
2017
2018 try {
2019 initResults();
2020 dres_ = -( eval( lhs_ ) - eval( rhs_ ) );
2021 odres_ = -( eval( lhs_ ) - eval( rhs_ ) );
2022 sres_ = -( eval( lhs_ ) - eval( rhs_ ) );
2023 osres_ = -( eval( lhs_ ) - eval( rhs_ ) );
2024 refres_ = -( eval( reflhs_ ) - eval( refrhs_ ) );
2025 }
2026 catch( std::exception& ex ) {
2027 convertException<MT1,MT2>( ex );
2028 }
2029
2030 checkResults<MT1,MT2>();
2031
2032 try {
2033 initResults();
2034 dres_ = -( eval( lhs_ ) - eval( orhs_ ) );
2035 odres_ = -( eval( lhs_ ) - eval( orhs_ ) );
2036 sres_ = -( eval( lhs_ ) - eval( orhs_ ) );
2037 osres_ = -( eval( lhs_ ) - eval( orhs_ ) );
2038 refres_ = -( eval( reflhs_ ) - eval( refrhs_ ) );
2039 }
2040 catch( std::exception& ex ) {
2041 convertException<MT1,OMT2>( ex );
2042 }
2043
2044 checkResults<MT1,OMT2>();
2045
2046 try {
2047 initResults();
2048 dres_ = -( eval( olhs_ ) - eval( rhs_ ) );
2049 odres_ = -( eval( olhs_ ) - eval( rhs_ ) );
2050 sres_ = -( eval( olhs_ ) - eval( rhs_ ) );
2051 osres_ = -( eval( olhs_ ) - eval( rhs_ ) );
2052 refres_ = -( eval( reflhs_ ) - eval( refrhs_ ) );
2053 }
2054 catch( std::exception& ex ) {
2055 convertException<OMT1,MT2>( ex );
2056 }
2057
2058 checkResults<OMT1,MT2>();
2059
2060 try {
2061 initResults();
2062 dres_ = -( eval( olhs_ ) - eval( orhs_ ) );
2063 odres_ = -( eval( olhs_ ) - eval( orhs_ ) );
2064 sres_ = -( eval( olhs_ ) - eval( orhs_ ) );
2065 osres_ = -( eval( olhs_ ) - eval( orhs_ ) );
2066 refres_ = -( eval( reflhs_ ) - eval( refrhs_ ) );
2067 }
2068 catch( std::exception& ex ) {
2069 convertException<OMT1,OMT2>( ex );
2070 }
2071
2072 checkResults<OMT1,OMT2>();
2073 }
2074
2075
2076 //=====================================================================================
2077 // Negated subtraction with addition assignment
2078 //=====================================================================================
2079
2080 // Negated subtraction with addition assignment with the given matrices
2081 {
2082 test_ = "Negated subtraction with addition assignment with the given matrices";
2083 error_ = "Failed addition assignment operation";
2084
2085 try {
2086 initResults();
2087 dres_ += -( lhs_ - rhs_ );
2088 odres_ += -( lhs_ - rhs_ );
2089 sres_ += -( lhs_ - rhs_ );
2090 osres_ += -( lhs_ - rhs_ );
2091 refres_ += -( reflhs_ - refrhs_ );
2092 }
2093 catch( std::exception& ex ) {
2094 convertException<MT1,MT2>( ex );
2095 }
2096
2097 checkResults<MT1,MT2>();
2098
2099 try {
2100 initResults();
2101 dres_ += -( lhs_ - orhs_ );
2102 odres_ += -( lhs_ - orhs_ );
2103 sres_ += -( lhs_ - orhs_ );
2104 osres_ += -( lhs_ - orhs_ );
2105 refres_ += -( reflhs_ - refrhs_ );
2106 }
2107 catch( std::exception& ex ) {
2108 convertException<MT1,OMT2>( ex );
2109 }
2110
2111 checkResults<MT1,OMT2>();
2112
2113 try {
2114 initResults();
2115 dres_ += -( olhs_ - rhs_ );
2116 odres_ += -( olhs_ - rhs_ );
2117 sres_ += -( olhs_ - rhs_ );
2118 osres_ += -( olhs_ - rhs_ );
2119 refres_ += -( reflhs_ - refrhs_ );
2120 }
2121 catch( std::exception& ex ) {
2122 convertException<OMT1,MT2>( ex );
2123 }
2124
2125 checkResults<OMT1,MT2>();
2126
2127 try {
2128 initResults();
2129 dres_ += -( olhs_ - orhs_ );
2130 odres_ += -( olhs_ - orhs_ );
2131 sres_ += -( olhs_ - orhs_ );
2132 osres_ += -( olhs_ - orhs_ );
2133 refres_ += -( reflhs_ - refrhs_ );
2134 }
2135 catch( std::exception& ex ) {
2136 convertException<OMT1,OMT2>( ex );
2137 }
2138
2139 checkResults<OMT1,OMT2>();
2140 }
2141
2142 // Negated subtraction with addition assignment with the given matrices
2143 {
2144 test_ = "Negated subtraction with addition assignment with evaluated matrices";
2145 error_ = "Failed addition assignment operation";
2146
2147 try {
2148 initResults();
2149 dres_ += -( eval( lhs_ ) - eval( rhs_ ) );
2150 odres_ += -( eval( lhs_ ) - eval( rhs_ ) );
2151 sres_ += -( eval( lhs_ ) - eval( rhs_ ) );
2152 osres_ += -( eval( lhs_ ) - eval( rhs_ ) );
2153 refres_ += -( eval( reflhs_ ) - eval( refrhs_ ) );
2154 }
2155 catch( std::exception& ex ) {
2156 convertException<MT1,MT2>( ex );
2157 }
2158
2159 checkResults<MT1,MT2>();
2160
2161 try {
2162 initResults();
2163 dres_ += -( eval( lhs_ ) - eval( orhs_ ) );
2164 odres_ += -( eval( lhs_ ) - eval( orhs_ ) );
2165 sres_ += -( eval( lhs_ ) - eval( orhs_ ) );
2166 osres_ += -( eval( lhs_ ) - eval( orhs_ ) );
2167 refres_ += -( eval( reflhs_ ) - eval( refrhs_ ) );
2168 }
2169 catch( std::exception& ex ) {
2170 convertException<MT1,OMT2>( ex );
2171 }
2172
2173 checkResults<MT1,OMT2>();
2174
2175 try {
2176 initResults();
2177 dres_ += -( eval( olhs_ ) - eval( rhs_ ) );
2178 odres_ += -( eval( olhs_ ) - eval( rhs_ ) );
2179 sres_ += -( eval( olhs_ ) - eval( rhs_ ) );
2180 osres_ += -( eval( olhs_ ) - eval( rhs_ ) );
2181 refres_ += -( eval( reflhs_ ) - eval( refrhs_ ) );
2182 }
2183 catch( std::exception& ex ) {
2184 convertException<OMT1,MT2>( ex );
2185 }
2186
2187 checkResults<OMT1,MT2>();
2188
2189 try {
2190 initResults();
2191 dres_ += -( eval( olhs_ ) - eval( orhs_ ) );
2192 odres_ += -( eval( olhs_ ) - eval( orhs_ ) );
2193 sres_ += -( eval( olhs_ ) - eval( orhs_ ) );
2194 osres_ += -( eval( olhs_ ) - eval( orhs_ ) );
2195 refres_ += -( eval( reflhs_ ) - eval( refrhs_ ) );
2196 }
2197 catch( std::exception& ex ) {
2198 convertException<OMT1,OMT2>( ex );
2199 }
2200
2201 checkResults<OMT1,OMT2>();
2202 }
2203
2204
2205 //=====================================================================================
2206 // Negated subtraction with subtraction assignment
2207 //=====================================================================================
2208
2209 // Negated subtraction with subtraction assignment with the given matrices
2210 {
2211 test_ = "Negated subtraction with subtraction assignment with the given matrices";
2212 error_ = "Failed subtraction assignment operation";
2213
2214 try {
2215 initResults();
2216 dres_ -= -( lhs_ - rhs_ );
2217 odres_ -= -( lhs_ - rhs_ );
2218 sres_ -= -( lhs_ - rhs_ );
2219 osres_ -= -( lhs_ - rhs_ );
2220 refres_ -= -( reflhs_ - refrhs_ );
2221 }
2222 catch( std::exception& ex ) {
2223 convertException<MT1,MT2>( ex );
2224 }
2225
2226 checkResults<MT1,MT2>();
2227
2228 try {
2229 initResults();
2230 dres_ -= -( lhs_ - orhs_ );
2231 odres_ -= -( lhs_ - orhs_ );
2232 sres_ -= -( lhs_ - orhs_ );
2233 osres_ -= -( lhs_ - orhs_ );
2234 refres_ -= -( reflhs_ - refrhs_ );
2235 }
2236 catch( std::exception& ex ) {
2237 convertException<MT1,OMT2>( ex );
2238 }
2239
2240 checkResults<MT1,OMT2>();
2241
2242 try {
2243 initResults();
2244 dres_ -= -( olhs_ - rhs_ );
2245 odres_ -= -( olhs_ - rhs_ );
2246 sres_ -= -( olhs_ - rhs_ );
2247 osres_ -= -( olhs_ - rhs_ );
2248 refres_ -= -( reflhs_ - refrhs_ );
2249 }
2250 catch( std::exception& ex ) {
2251 convertException<OMT1,MT2>( ex );
2252 }
2253
2254 checkResults<OMT1,MT2>();
2255
2256 try {
2257 initResults();
2258 dres_ -= -( olhs_ - orhs_ );
2259 odres_ -= -( olhs_ - orhs_ );
2260 sres_ -= -( olhs_ - orhs_ );
2261 osres_ -= -( olhs_ - orhs_ );
2262 refres_ -= -( reflhs_ - refrhs_ );
2263 }
2264 catch( std::exception& ex ) {
2265 convertException<OMT1,OMT2>( ex );
2266 }
2267
2268 checkResults<OMT1,OMT2>();
2269 }
2270
2271 // Negated subtraction with subtraction assignment with evaluated matrices
2272 {
2273 test_ = "Negated subtraction with subtraction assignment with evaluated matrices";
2274 error_ = "Failed subtraction assignment operation";
2275
2276 try {
2277 initResults();
2278 dres_ -= -( eval( lhs_ ) - eval( rhs_ ) );
2279 odres_ -= -( eval( lhs_ ) - eval( rhs_ ) );
2280 sres_ -= -( eval( lhs_ ) - eval( rhs_ ) );
2281 osres_ -= -( eval( lhs_ ) - eval( rhs_ ) );
2282 refres_ -= -( eval( reflhs_ ) - eval( refrhs_ ) );
2283 }
2284 catch( std::exception& ex ) {
2285 convertException<MT1,MT2>( ex );
2286 }
2287
2288 checkResults<MT1,MT2>();
2289
2290 try {
2291 initResults();
2292 dres_ -= -( eval( lhs_ ) - eval( orhs_ ) );
2293 odres_ -= -( eval( lhs_ ) - eval( orhs_ ) );
2294 sres_ -= -( eval( lhs_ ) - eval( orhs_ ) );
2295 osres_ -= -( eval( lhs_ ) - eval( orhs_ ) );
2296 refres_ -= -( eval( reflhs_ ) - eval( refrhs_ ) );
2297 }
2298 catch( std::exception& ex ) {
2299 convertException<MT1,OMT2>( ex );
2300 }
2301
2302 checkResults<MT1,OMT2>();
2303
2304 try {
2305 initResults();
2306 dres_ -= -( eval( olhs_ ) - eval( rhs_ ) );
2307 odres_ -= -( eval( olhs_ ) - eval( rhs_ ) );
2308 sres_ -= -( eval( olhs_ ) - eval( rhs_ ) );
2309 osres_ -= -( eval( olhs_ ) - eval( rhs_ ) );
2310 refres_ -= -( eval( reflhs_ ) - eval( refrhs_ ) );
2311 }
2312 catch( std::exception& ex ) {
2313 convertException<OMT1,MT2>( ex );
2314 }
2315
2316 checkResults<OMT1,MT2>();
2317
2318 try {
2319 initResults();
2320 dres_ -= -( eval( olhs_ ) - eval( orhs_ ) );
2321 odres_ -= -( eval( olhs_ ) - eval( orhs_ ) );
2322 sres_ -= -( eval( olhs_ ) - eval( orhs_ ) );
2323 osres_ -= -( eval( olhs_ ) - eval( orhs_ ) );
2324 refres_ -= -( eval( reflhs_ ) - eval( refrhs_ ) );
2325 }
2326 catch( std::exception& ex ) {
2327 convertException<OMT1,OMT2>( ex );
2328 }
2329
2330 checkResults<OMT1,OMT2>();
2331 }
2332
2333
2334 //=====================================================================================
2335 // Negated subtraction with Schur product assignment
2336 //=====================================================================================
2337
2338 // Negated subtraction with Schur product assignment with the given matrices
2339 {
2340 test_ = "Negated subtraction with Schur product assignment with the given matrices";
2341 error_ = "Failed Schur product assignment operation";
2342
2343 try {
2344 initResults();
2345 dres_ %= -( lhs_ - rhs_ );
2346 odres_ %= -( lhs_ - rhs_ );
2347 sres_ %= -( lhs_ - rhs_ );
2348 osres_ %= -( lhs_ - rhs_ );
2349 refres_ %= -( reflhs_ - refrhs_ );
2350 }
2351 catch( std::exception& ex ) {
2352 convertException<MT1,MT2>( ex );
2353 }
2354
2355 checkResults<MT1,MT2>();
2356
2357 try {
2358 initResults();
2359 dres_ %= -( lhs_ - orhs_ );
2360 odres_ %= -( lhs_ - orhs_ );
2361 sres_ %= -( lhs_ - orhs_ );
2362 osres_ %= -( lhs_ - orhs_ );
2363 refres_ %= -( reflhs_ - refrhs_ );
2364 }
2365 catch( std::exception& ex ) {
2366 convertException<MT1,OMT2>( ex );
2367 }
2368
2369 checkResults<MT1,OMT2>();
2370
2371 try {
2372 initResults();
2373 dres_ %= -( olhs_ - rhs_ );
2374 odres_ %= -( olhs_ - rhs_ );
2375 sres_ %= -( olhs_ - rhs_ );
2376 osres_ %= -( olhs_ - rhs_ );
2377 refres_ %= -( reflhs_ - refrhs_ );
2378 }
2379 catch( std::exception& ex ) {
2380 convertException<OMT1,MT2>( ex );
2381 }
2382
2383 checkResults<OMT1,MT2>();
2384
2385 try {
2386 initResults();
2387 dres_ %= -( olhs_ - orhs_ );
2388 odres_ %= -( olhs_ - orhs_ );
2389 sres_ %= -( olhs_ - orhs_ );
2390 osres_ %= -( olhs_ - orhs_ );
2391 refres_ %= -( reflhs_ - refrhs_ );
2392 }
2393 catch( std::exception& ex ) {
2394 convertException<OMT1,OMT2>( ex );
2395 }
2396
2397 checkResults<OMT1,OMT2>();
2398 }
2399
2400 // Negated subtraction with Schur product assignment with the given matrices
2401 {
2402 test_ = "Negated subtraction with Schur product assignment with evaluated matrices";
2403 error_ = "Failed Schur product assignment operation";
2404
2405 try {
2406 initResults();
2407 dres_ %= -( eval( lhs_ ) - eval( rhs_ ) );
2408 odres_ %= -( eval( lhs_ ) - eval( rhs_ ) );
2409 sres_ %= -( eval( lhs_ ) - eval( rhs_ ) );
2410 osres_ %= -( eval( lhs_ ) - eval( rhs_ ) );
2411 refres_ %= -( eval( reflhs_ ) - eval( refrhs_ ) );
2412 }
2413 catch( std::exception& ex ) {
2414 convertException<MT1,MT2>( ex );
2415 }
2416
2417 checkResults<MT1,MT2>();
2418
2419 try {
2420 initResults();
2421 dres_ %= -( eval( lhs_ ) - eval( orhs_ ) );
2422 odres_ %= -( eval( lhs_ ) - eval( orhs_ ) );
2423 sres_ %= -( eval( lhs_ ) - eval( orhs_ ) );
2424 osres_ %= -( eval( lhs_ ) - eval( orhs_ ) );
2425 refres_ %= -( eval( reflhs_ ) - eval( refrhs_ ) );
2426 }
2427 catch( std::exception& ex ) {
2428 convertException<MT1,OMT2>( ex );
2429 }
2430
2431 checkResults<MT1,OMT2>();
2432
2433 try {
2434 initResults();
2435 dres_ %= -( eval( olhs_ ) - eval( rhs_ ) );
2436 odres_ %= -( eval( olhs_ ) - eval( rhs_ ) );
2437 sres_ %= -( eval( olhs_ ) - eval( rhs_ ) );
2438 osres_ %= -( eval( olhs_ ) - eval( rhs_ ) );
2439 refres_ %= -( eval( reflhs_ ) - eval( refrhs_ ) );
2440 }
2441 catch( std::exception& ex ) {
2442 convertException<OMT1,MT2>( ex );
2443 }
2444
2445 checkResults<OMT1,MT2>();
2446
2447 try {
2448 initResults();
2449 dres_ %= -( eval( olhs_ ) - eval( orhs_ ) );
2450 odres_ %= -( eval( olhs_ ) - eval( orhs_ ) );
2451 sres_ %= -( eval( olhs_ ) - eval( orhs_ ) );
2452 osres_ %= -( eval( olhs_ ) - eval( orhs_ ) );
2453 refres_ %= -( eval( reflhs_ ) - eval( refrhs_ ) );
2454 }
2455 catch( std::exception& ex ) {
2456 convertException<OMT1,OMT2>( ex );
2457 }
2458
2459 checkResults<OMT1,OMT2>();
2460 }
2461 }
2462 #endif
2463 }
2464 //*************************************************************************************************
2465
2466
2467 //*************************************************************************************************
2468 /*!\brief Testing the scaled sparse matrix/sparse matrix subtraction.
2469 //
2470 // \param scalar The scalar value.
2471 // \return void
2472 // \exception std::runtime_error Subtraction error detected.
2473 //
2474 // This function tests the scaled matrix subtraction with plain assignment, addition assignment,
2475 // subtraction assignment, and Schur product assignment. In case any error resulting from the
2476 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
2477 // thrown.
2478 */
2479 template< typename MT1 // Type of the left-hand side sparse matrix
2480 , typename MT2 > // Type of the right-hand side sparse matrix
2481 template< typename T > // Type of the scalar
testScaledOperation(T scalar)2482 void OperationTest<MT1,MT2>::testScaledOperation( T scalar )
2483 {
2484 BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE( T );
2485
2486 if( scalar == T(0) )
2487 throw std::invalid_argument( "Invalid scalar parameter" );
2488
2489
2490 #if BLAZETEST_MATHTEST_TEST_SCALED_OPERATION
2491 if( BLAZETEST_MATHTEST_TEST_SCALED_OPERATION > 1 )
2492 {
2493 //=====================================================================================
2494 // Self-scaling (M*=s)
2495 //=====================================================================================
2496
2497 // Self-scaling (M*=s)
2498 {
2499 test_ = "Self-scaling (M*=s)";
2500
2501 try {
2502 dres_ = lhs_ - rhs_;
2503 odres_ = dres_;
2504 sres_ = dres_;
2505 osres_ = dres_;
2506 refres_ = dres_;
2507
2508 dres_ *= scalar;
2509 odres_ *= scalar;
2510 sres_ *= scalar;
2511 osres_ *= scalar;
2512 refres_ *= scalar;
2513 }
2514 catch( std::exception& ex ) {
2515 std::ostringstream oss;
2516 oss << " Test : " << test_ << "\n"
2517 << " Error: Failed self-scaling operation\n"
2518 << " Details:\n"
2519 << " Random seed = " << blaze::getSeed() << "\n"
2520 << " Scalar = " << scalar << "\n"
2521 << " Error message: " << ex.what() << "\n";
2522 throw std::runtime_error( oss.str() );
2523 }
2524
2525 checkResults<MT1,MT2>();
2526 }
2527
2528
2529 //=====================================================================================
2530 // Self-scaling (M=M*s)
2531 //=====================================================================================
2532
2533 // Self-scaling (M=M*s)
2534 {
2535 test_ = "Self-scaling (M=M*s)";
2536
2537 try {
2538 dres_ = lhs_ - rhs_;
2539 odres_ = dres_;
2540 sres_ = dres_;
2541 osres_ = dres_;
2542 refres_ = dres_;
2543
2544 dres_ = dres_ * scalar;
2545 odres_ = odres_ * scalar;
2546 sres_ = sres_ * scalar;
2547 osres_ = osres_ * scalar;
2548 refres_ = refres_ * scalar;
2549 }
2550 catch( std::exception& ex ) {
2551 std::ostringstream oss;
2552 oss << " Test : " << test_ << "\n"
2553 << " Error: Failed self-scaling operation\n"
2554 << " Details:\n"
2555 << " Random seed = " << blaze::getSeed() << "\n"
2556 << " Scalar = " << scalar << "\n"
2557 << " Error message: " << ex.what() << "\n";
2558 throw std::runtime_error( oss.str() );
2559 }
2560
2561 checkResults<MT1,MT2>();
2562 }
2563
2564
2565 //=====================================================================================
2566 // Self-scaling (M=s*M)
2567 //=====================================================================================
2568
2569 // Self-scaling (M=s*M)
2570 {
2571 test_ = "Self-scaling (M=s*M)";
2572
2573 try {
2574 dres_ = lhs_ - rhs_;
2575 odres_ = dres_;
2576 sres_ = dres_;
2577 osres_ = dres_;
2578 refres_ = dres_;
2579
2580 dres_ = scalar * dres_;
2581 odres_ = scalar * odres_;
2582 sres_ = scalar * sres_;
2583 osres_ = scalar * osres_;
2584 refres_ = scalar * refres_;
2585 }
2586 catch( std::exception& ex ) {
2587 std::ostringstream oss;
2588 oss << " Test : " << test_ << "\n"
2589 << " Error: Failed self-scaling operation\n"
2590 << " Details:\n"
2591 << " Random seed = " << blaze::getSeed() << "\n"
2592 << " Scalar = " << scalar << "\n"
2593 << " Error message: " << ex.what() << "\n";
2594 throw std::runtime_error( oss.str() );
2595 }
2596
2597 checkResults<MT1,MT2>();
2598 }
2599
2600
2601 //=====================================================================================
2602 // Self-scaling (M/=s)
2603 //=====================================================================================
2604
2605 // Self-scaling (M/=s)
2606 {
2607 test_ = "Self-scaling (M/=s)";
2608
2609 try {
2610 dres_ = lhs_ - rhs_;
2611 odres_ = dres_;
2612 sres_ = dres_;
2613 osres_ = dres_;
2614 refres_ = dres_;
2615
2616 dres_ /= scalar;
2617 odres_ /= scalar;
2618 sres_ /= scalar;
2619 osres_ /= scalar;
2620 refres_ /= scalar;
2621 }
2622 catch( std::exception& ex ) {
2623 std::ostringstream oss;
2624 oss << " Test : " << test_ << "\n"
2625 << " Error: Failed self-scaling operation\n"
2626 << " Details:\n"
2627 << " Random seed = " << blaze::getSeed() << "\n"
2628 << " Scalar = " << scalar << "\n"
2629 << " Error message: " << ex.what() << "\n";
2630 throw std::runtime_error( oss.str() );
2631 }
2632
2633 checkResults<MT1,MT2>();
2634 }
2635
2636
2637 //=====================================================================================
2638 // Self-scaling (M=M/s)
2639 //=====================================================================================
2640
2641 // Self-scaling (M=M/s)
2642 {
2643 test_ = "Self-scaling (M=M/s)";
2644
2645 try {
2646 dres_ = lhs_ - rhs_;
2647 odres_ = dres_;
2648 sres_ = dres_;
2649 osres_ = dres_;
2650 refres_ = dres_;
2651
2652 dres_ = dres_ / scalar;
2653 odres_ = odres_ / scalar;
2654 sres_ = sres_ / scalar;
2655 osres_ = osres_ / scalar;
2656 refres_ = refres_ / scalar;
2657 }
2658 catch( std::exception& ex ) {
2659 std::ostringstream oss;
2660 oss << " Test : " << test_ << "\n"
2661 << " Error: Failed self-scaling operation\n"
2662 << " Details:\n"
2663 << " Random seed = " << blaze::getSeed() << "\n"
2664 << " Scalar = " << scalar << "\n"
2665 << " Error message: " << ex.what() << "\n";
2666 throw std::runtime_error( oss.str() );
2667 }
2668
2669 checkResults<MT1,MT2>();
2670 }
2671
2672
2673 //=====================================================================================
2674 // Scaled subtraction (s*OP)
2675 //=====================================================================================
2676
2677 // Scaled subtraction with the given matrices
2678 {
2679 test_ = "Scaled subtraction with the given matrices (s*OP)";
2680 error_ = "Failed subtraction operation";
2681
2682 try {
2683 initResults();
2684 dres_ = scalar * ( lhs_ - rhs_ );
2685 odres_ = scalar * ( lhs_ - rhs_ );
2686 sres_ = scalar * ( lhs_ - rhs_ );
2687 osres_ = scalar * ( lhs_ - rhs_ );
2688 refres_ = scalar * ( reflhs_ - refrhs_ );
2689 }
2690 catch( std::exception& ex ) {
2691 convertException<MT1,MT2>( ex );
2692 }
2693
2694 checkResults<MT1,MT2>();
2695
2696 try {
2697 initResults();
2698 dres_ = scalar * ( lhs_ - orhs_ );
2699 odres_ = scalar * ( lhs_ - orhs_ );
2700 sres_ = scalar * ( lhs_ - orhs_ );
2701 osres_ = scalar * ( lhs_ - orhs_ );
2702 refres_ = scalar * ( reflhs_ - refrhs_ );
2703 }
2704 catch( std::exception& ex ) {
2705 convertException<MT1,OMT2>( ex );
2706 }
2707
2708 checkResults<MT1,OMT2>();
2709
2710 try {
2711 initResults();
2712 dres_ = scalar * ( olhs_ - rhs_ );
2713 odres_ = scalar * ( olhs_ - rhs_ );
2714 sres_ = scalar * ( olhs_ - rhs_ );
2715 osres_ = scalar * ( olhs_ - rhs_ );
2716 refres_ = scalar * ( reflhs_ - refrhs_ );
2717 }
2718 catch( std::exception& ex ) {
2719 convertException<OMT1,MT2>( ex );
2720 }
2721
2722 checkResults<OMT1,MT2>();
2723
2724 try {
2725 initResults();
2726 dres_ = scalar * ( olhs_ - orhs_ );
2727 odres_ = scalar * ( olhs_ - orhs_ );
2728 sres_ = scalar * ( olhs_ - orhs_ );
2729 osres_ = scalar * ( olhs_ - orhs_ );
2730 refres_ = scalar * ( reflhs_ - refrhs_ );
2731 }
2732 catch( std::exception& ex ) {
2733 convertException<OMT1,OMT2>( ex );
2734 }
2735
2736 checkResults<OMT1,OMT2>();
2737 }
2738
2739 // Scaled subtraction with evaluated matrices
2740 {
2741 test_ = "Scaled subtraction with evaluated matrices (s*OP)";
2742 error_ = "Failed subtraction operation";
2743
2744 try {
2745 initResults();
2746 dres_ = scalar * ( eval( lhs_ ) - eval( rhs_ ) );
2747 odres_ = scalar * ( eval( lhs_ ) - eval( rhs_ ) );
2748 sres_ = scalar * ( eval( lhs_ ) - eval( rhs_ ) );
2749 osres_ = scalar * ( eval( lhs_ ) - eval( rhs_ ) );
2750 refres_ = scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
2751 }
2752 catch( std::exception& ex ) {
2753 convertException<MT1,MT2>( ex );
2754 }
2755
2756 checkResults<MT1,MT2>();
2757
2758 try {
2759 initResults();
2760 dres_ = scalar * ( eval( lhs_ ) - eval( orhs_ ) );
2761 odres_ = scalar * ( eval( lhs_ ) - eval( orhs_ ) );
2762 sres_ = scalar * ( eval( lhs_ ) - eval( orhs_ ) );
2763 osres_ = scalar * ( eval( lhs_ ) - eval( orhs_ ) );
2764 refres_ = scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
2765 }
2766 catch( std::exception& ex ) {
2767 convertException<MT1,OMT2>( ex );
2768 }
2769
2770 checkResults<MT1,OMT2>();
2771
2772 try {
2773 initResults();
2774 dres_ = scalar * ( eval( olhs_ ) - eval( rhs_ ) );
2775 odres_ = scalar * ( eval( olhs_ ) - eval( rhs_ ) );
2776 sres_ = scalar * ( eval( olhs_ ) - eval( rhs_ ) );
2777 osres_ = scalar * ( eval( olhs_ ) - eval( rhs_ ) );
2778 refres_ = scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
2779 }
2780 catch( std::exception& ex ) {
2781 convertException<OMT1,MT2>( ex );
2782 }
2783
2784 checkResults<OMT1,MT2>();
2785
2786 try {
2787 initResults();
2788 dres_ = scalar * ( eval( olhs_ ) - eval( orhs_ ) );
2789 odres_ = scalar * ( eval( olhs_ ) - eval( orhs_ ) );
2790 sres_ = scalar * ( eval( olhs_ ) - eval( orhs_ ) );
2791 osres_ = scalar * ( eval( olhs_ ) - eval( orhs_ ) );
2792 refres_ = scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
2793 }
2794 catch( std::exception& ex ) {
2795 convertException<OMT1,OMT2>( ex );
2796 }
2797
2798 checkResults<OMT1,OMT2>();
2799 }
2800
2801
2802 //=====================================================================================
2803 // Scaled subtraction (OP*s)
2804 //=====================================================================================
2805
2806 // Scaled subtraction with the given matrices
2807 {
2808 test_ = "Scaled subtraction with the given matrices (OP*s)";
2809 error_ = "Failed subtraction operation";
2810
2811 try {
2812 initResults();
2813 dres_ = ( lhs_ - rhs_ ) * scalar;
2814 odres_ = ( lhs_ - rhs_ ) * scalar;
2815 sres_ = ( lhs_ - rhs_ ) * scalar;
2816 osres_ = ( lhs_ - rhs_ ) * scalar;
2817 refres_ = ( reflhs_ - refrhs_ ) * scalar;
2818 }
2819 catch( std::exception& ex ) {
2820 convertException<MT1,MT2>( ex );
2821 }
2822
2823 checkResults<MT1,MT2>();
2824
2825 try {
2826 initResults();
2827 dres_ = ( lhs_ - orhs_ ) * scalar;
2828 odres_ = ( lhs_ - orhs_ ) * scalar;
2829 sres_ = ( lhs_ - orhs_ ) * scalar;
2830 osres_ = ( lhs_ - orhs_ ) * scalar;
2831 refres_ = ( reflhs_ - refrhs_ ) * scalar;
2832 }
2833 catch( std::exception& ex ) {
2834 convertException<MT1,OMT2>( ex );
2835 }
2836
2837 checkResults<MT1,OMT2>();
2838
2839 try {
2840 initResults();
2841 dres_ = ( olhs_ - rhs_ ) * scalar;
2842 odres_ = ( olhs_ - rhs_ ) * scalar;
2843 sres_ = ( olhs_ - rhs_ ) * scalar;
2844 osres_ = ( olhs_ - rhs_ ) * scalar;
2845 refres_ = ( reflhs_ - refrhs_ ) * scalar;
2846 }
2847 catch( std::exception& ex ) {
2848 convertException<OMT1,MT2>( ex );
2849 }
2850
2851 checkResults<OMT1,MT2>();
2852
2853 try {
2854 initResults();
2855 dres_ = ( olhs_ - orhs_ ) * scalar;
2856 odres_ = ( olhs_ - orhs_ ) * scalar;
2857 sres_ = ( olhs_ - orhs_ ) * scalar;
2858 osres_ = ( olhs_ - orhs_ ) * scalar;
2859 refres_ = ( reflhs_ - refrhs_ ) * scalar;
2860 }
2861 catch( std::exception& ex ) {
2862 convertException<OMT1,OMT2>( ex );
2863 }
2864
2865 checkResults<OMT1,OMT2>();
2866 }
2867
2868 // Scaled subtraction with evaluated matrices
2869 {
2870 test_ = "Scaled subtraction with evaluated matrices (OP*s)";
2871 error_ = "Failed subtraction operation";
2872
2873 try {
2874 initResults();
2875 dres_ = ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
2876 odres_ = ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
2877 sres_ = ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
2878 osres_ = ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
2879 refres_ = ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
2880 }
2881 catch( std::exception& ex ) {
2882 convertException<MT1,MT2>( ex );
2883 }
2884
2885 checkResults<MT1,MT2>();
2886
2887 try {
2888 initResults();
2889 dres_ = ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
2890 odres_ = ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
2891 sres_ = ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
2892 osres_ = ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
2893 refres_ = ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
2894 }
2895 catch( std::exception& ex ) {
2896 convertException<MT1,OMT2>( ex );
2897 }
2898
2899 checkResults<MT1,OMT2>();
2900
2901 try {
2902 initResults();
2903 dres_ = ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
2904 odres_ = ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
2905 sres_ = ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
2906 osres_ = ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
2907 refres_ = ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
2908 }
2909 catch( std::exception& ex ) {
2910 convertException<OMT1,MT2>( ex );
2911 }
2912
2913 checkResults<OMT1,MT2>();
2914
2915 try {
2916 initResults();
2917 dres_ = ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
2918 odres_ = ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
2919 sres_ = ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
2920 osres_ = ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
2921 refres_ = ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
2922 }
2923 catch( std::exception& ex ) {
2924 convertException<OMT1,OMT2>( ex );
2925 }
2926
2927 checkResults<OMT1,OMT2>();
2928 }
2929
2930
2931 //=====================================================================================
2932 // Scaled subtraction (OP/s)
2933 //=====================================================================================
2934
2935 // Scaled subtraction with the given matrices
2936 {
2937 test_ = "Scaled subtraction with the given matrices (OP/s)";
2938 error_ = "Failed subtraction operation";
2939
2940 try {
2941 initResults();
2942 dres_ = ( lhs_ - rhs_ ) / scalar;
2943 odres_ = ( lhs_ - rhs_ ) / scalar;
2944 sres_ = ( lhs_ - rhs_ ) / scalar;
2945 osres_ = ( lhs_ - rhs_ ) / scalar;
2946 refres_ = ( reflhs_ - refrhs_ ) / scalar;
2947 }
2948 catch( std::exception& ex ) {
2949 convertException<MT1,MT2>( ex );
2950 }
2951
2952 checkResults<MT1,MT2>();
2953
2954 try {
2955 initResults();
2956 dres_ = ( lhs_ - orhs_ ) / scalar;
2957 odres_ = ( lhs_ - orhs_ ) / scalar;
2958 sres_ = ( lhs_ - orhs_ ) / scalar;
2959 osres_ = ( lhs_ - orhs_ ) / scalar;
2960 refres_ = ( reflhs_ - refrhs_ ) / scalar;
2961 }
2962 catch( std::exception& ex ) {
2963 convertException<MT1,OMT2>( ex );
2964 }
2965
2966 checkResults<MT1,OMT2>();
2967
2968 try {
2969 initResults();
2970 dres_ = ( olhs_ - rhs_ ) / scalar;
2971 odres_ = ( olhs_ - rhs_ ) / scalar;
2972 sres_ = ( olhs_ - rhs_ ) / scalar;
2973 osres_ = ( olhs_ - rhs_ ) / scalar;
2974 refres_ = ( reflhs_ - refrhs_ ) / scalar;
2975 }
2976 catch( std::exception& ex ) {
2977 convertException<OMT1,MT2>( ex );
2978 }
2979
2980 checkResults<OMT1,MT2>();
2981
2982 try {
2983 initResults();
2984 dres_ = ( olhs_ - orhs_ ) / scalar;
2985 odres_ = ( olhs_ - orhs_ ) / scalar;
2986 sres_ = ( olhs_ - orhs_ ) / scalar;
2987 osres_ = ( olhs_ - orhs_ ) / scalar;
2988 refres_ = ( reflhs_ - refrhs_ ) / scalar;
2989 }
2990 catch( std::exception& ex ) {
2991 convertException<OMT1,OMT2>( ex );
2992 }
2993
2994 checkResults<OMT1,OMT2>();
2995 }
2996
2997 // Scaled subtraction with evaluated matrices
2998 {
2999 test_ = "Scaled subtraction with evaluated matrices (OP/s)";
3000 error_ = "Failed subtraction operation";
3001
3002 try {
3003 initResults();
3004 dres_ = ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3005 odres_ = ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3006 sres_ = ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3007 osres_ = ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3008 refres_ = ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3009 }
3010 catch( std::exception& ex ) {
3011 convertException<MT1,MT2>( ex );
3012 }
3013
3014 checkResults<MT1,MT2>();
3015
3016 try {
3017 initResults();
3018 dres_ = ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3019 odres_ = ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3020 sres_ = ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3021 osres_ = ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3022 refres_ = ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3023 }
3024 catch( std::exception& ex ) {
3025 convertException<MT1,OMT2>( ex );
3026 }
3027
3028 checkResults<MT1,OMT2>();
3029
3030 try {
3031 initResults();
3032 dres_ = ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3033 odres_ = ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3034 sres_ = ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3035 osres_ = ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3036 refres_ = ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3037 }
3038 catch( std::exception& ex ) {
3039 convertException<OMT1,MT2>( ex );
3040 }
3041
3042 checkResults<OMT1,MT2>();
3043
3044 try {
3045 initResults();
3046 dres_ = ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3047 odres_ = ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3048 sres_ = ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3049 osres_ = ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3050 refres_ = ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3051 }
3052 catch( std::exception& ex ) {
3053 convertException<OMT1,OMT2>( ex );
3054 }
3055
3056 checkResults<OMT1,OMT2>();
3057 }
3058
3059
3060 //=====================================================================================
3061 // Scaled subtraction with addition assignment (s*OP)
3062 //=====================================================================================
3063
3064 // Scaled subtraction with addition assignment with the given matrices
3065 {
3066 test_ = "Scaled subtraction with addition assignment with the given matrices (s*OP)";
3067 error_ = "Failed addition assignment operation";
3068
3069 try {
3070 initResults();
3071 dres_ += scalar * ( lhs_ - rhs_ );
3072 odres_ += scalar * ( lhs_ - rhs_ );
3073 sres_ += scalar * ( lhs_ - rhs_ );
3074 osres_ += scalar * ( lhs_ - rhs_ );
3075 refres_ += scalar * ( reflhs_ - refrhs_ );
3076 }
3077 catch( std::exception& ex ) {
3078 convertException<MT1,MT2>( ex );
3079 }
3080
3081 checkResults<MT1,MT2>();
3082
3083 try {
3084 initResults();
3085 dres_ += scalar * ( lhs_ - orhs_ );
3086 odres_ += scalar * ( lhs_ - orhs_ );
3087 sres_ += scalar * ( lhs_ - orhs_ );
3088 osres_ += scalar * ( lhs_ - orhs_ );
3089 refres_ += scalar * ( reflhs_ - refrhs_ );
3090 }
3091 catch( std::exception& ex ) {
3092 convertException<MT1,OMT2>( ex );
3093 }
3094
3095 checkResults<MT1,OMT2>();
3096
3097 try {
3098 initResults();
3099 dres_ += scalar * ( olhs_ - rhs_ );
3100 odres_ += scalar * ( olhs_ - rhs_ );
3101 sres_ += scalar * ( olhs_ - rhs_ );
3102 osres_ += scalar * ( olhs_ - rhs_ );
3103 refres_ += scalar * ( reflhs_ - refrhs_ );
3104 }
3105 catch( std::exception& ex ) {
3106 convertException<OMT1,MT2>( ex );
3107 }
3108
3109 checkResults<OMT1,MT2>();
3110
3111 try {
3112 initResults();
3113 dres_ += scalar * ( olhs_ - orhs_ );
3114 odres_ += scalar * ( olhs_ - orhs_ );
3115 sres_ += scalar * ( olhs_ - orhs_ );
3116 osres_ += scalar * ( olhs_ - orhs_ );
3117 refres_ += scalar * ( reflhs_ - refrhs_ );
3118 }
3119 catch( std::exception& ex ) {
3120 convertException<OMT1,OMT2>( ex );
3121 }
3122
3123 checkResults<OMT1,OMT2>();
3124 }
3125
3126 // Scaled subtraction with addition assignment with evaluated matrices
3127 {
3128 test_ = "Scaled subtraction with addition assignment with evaluated matrices (s*OP)";
3129 error_ = "Failed addition assignment operation";
3130
3131 try {
3132 initResults();
3133 dres_ += scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3134 odres_ += scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3135 sres_ += scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3136 osres_ += scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3137 refres_ += scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3138 }
3139 catch( std::exception& ex ) {
3140 convertException<MT1,MT2>( ex );
3141 }
3142
3143 checkResults<MT1,MT2>();
3144
3145 try {
3146 initResults();
3147 dres_ += scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3148 odres_ += scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3149 sres_ += scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3150 osres_ += scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3151 refres_ += scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3152 }
3153 catch( std::exception& ex ) {
3154 convertException<MT1,OMT2>( ex );
3155 }
3156
3157 checkResults<MT1,OMT2>();
3158
3159 try {
3160 initResults();
3161 dres_ += scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3162 odres_ += scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3163 sres_ += scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3164 osres_ += scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3165 refres_ += scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3166 }
3167 catch( std::exception& ex ) {
3168 convertException<OMT1,MT2>( ex );
3169 }
3170
3171 checkResults<OMT1,MT2>();
3172
3173 try {
3174 initResults();
3175 dres_ += scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3176 odres_ += scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3177 sres_ += scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3178 osres_ += scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3179 refres_ += scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3180 }
3181 catch( std::exception& ex ) {
3182 convertException<OMT1,OMT2>( ex );
3183 }
3184
3185 checkResults<OMT1,OMT2>();
3186 }
3187
3188
3189 //=====================================================================================
3190 // Scaled subtraction with addition assignment (OP*s)
3191 //=====================================================================================
3192
3193 // Scaled subtraction with addition assignment with the given matrices
3194 {
3195 test_ = "Scaled subtraction with addition assignment with the given matrices (OP*s)";
3196 error_ = "Failed addition assignment operation";
3197
3198 try {
3199 initResults();
3200 dres_ += ( lhs_ - rhs_ ) * scalar;
3201 odres_ += ( lhs_ - rhs_ ) * scalar;
3202 sres_ += ( lhs_ - rhs_ ) * scalar;
3203 osres_ += ( lhs_ - rhs_ ) * scalar;
3204 refres_ += ( reflhs_ - refrhs_ ) * scalar;
3205 }
3206 catch( std::exception& ex ) {
3207 convertException<MT1,MT2>( ex );
3208 }
3209
3210 checkResults<MT1,MT2>();
3211
3212 try {
3213 initResults();
3214 dres_ += ( lhs_ - orhs_ ) * scalar;
3215 odres_ += ( lhs_ - orhs_ ) * scalar;
3216 sres_ += ( lhs_ - orhs_ ) * scalar;
3217 osres_ += ( lhs_ - orhs_ ) * scalar;
3218 refres_ += ( reflhs_ - refrhs_ ) * scalar;
3219 }
3220 catch( std::exception& ex ) {
3221 convertException<MT1,OMT2>( ex );
3222 }
3223
3224 checkResults<MT1,OMT2>();
3225
3226 try {
3227 initResults();
3228 dres_ += ( olhs_ - rhs_ ) * scalar;
3229 odres_ += ( olhs_ - rhs_ ) * scalar;
3230 sres_ += ( olhs_ - rhs_ ) * scalar;
3231 osres_ += ( olhs_ - rhs_ ) * scalar;
3232 refres_ += ( reflhs_ - refrhs_ ) * scalar;
3233 }
3234 catch( std::exception& ex ) {
3235 convertException<OMT1,MT2>( ex );
3236 }
3237
3238 checkResults<OMT1,MT2>();
3239
3240 try {
3241 initResults();
3242 dres_ += ( olhs_ - orhs_ ) * scalar;
3243 odres_ += ( olhs_ - orhs_ ) * scalar;
3244 sres_ += ( olhs_ - orhs_ ) * scalar;
3245 osres_ += ( olhs_ - orhs_ ) * scalar;
3246 refres_ += ( reflhs_ - refrhs_ ) * scalar;
3247 }
3248 catch( std::exception& ex ) {
3249 convertException<OMT1,OMT2>( ex );
3250 }
3251
3252 checkResults<OMT1,OMT2>();
3253 }
3254
3255 // Scaled subtraction with addition assignment with evaluated matrices
3256 {
3257 test_ = "Scaled subtraction with addition assignment with evaluated matrices (OP*s)";
3258 error_ = "Failed addition assignment operation";
3259
3260 try {
3261 initResults();
3262 dres_ += ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
3263 odres_ += ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
3264 sres_ += ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
3265 osres_ += ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
3266 refres_ += ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
3267 }
3268 catch( std::exception& ex ) {
3269 convertException<MT1,MT2>( ex );
3270 }
3271
3272 checkResults<MT1,MT2>();
3273
3274 try {
3275 initResults();
3276 dres_ += ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
3277 odres_ += ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
3278 sres_ += ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
3279 osres_ += ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
3280 refres_ += ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
3281 }
3282 catch( std::exception& ex ) {
3283 convertException<MT1,OMT2>( ex );
3284 }
3285
3286 checkResults<MT1,OMT2>();
3287
3288 try {
3289 initResults();
3290 dres_ += ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
3291 odres_ += ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
3292 sres_ += ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
3293 osres_ += ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
3294 refres_ += ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
3295 }
3296 catch( std::exception& ex ) {
3297 convertException<OMT1,MT2>( ex );
3298 }
3299
3300 checkResults<OMT1,MT2>();
3301
3302 try {
3303 initResults();
3304 dres_ += ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
3305 odres_ += ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
3306 sres_ += ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
3307 osres_ += ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
3308 refres_ += ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
3309 }
3310 catch( std::exception& ex ) {
3311 convertException<OMT1,OMT2>( ex );
3312 }
3313
3314 checkResults<OMT1,OMT2>();
3315 }
3316
3317
3318 //=====================================================================================
3319 // Scaled subtraction with addition assignment (OP/s)
3320 //=====================================================================================
3321
3322 // Scaled subtraction with addition assignment with the given matrices
3323 {
3324 test_ = "Scaled subtraction with addition assignment with the given matrices (OP/s)";
3325 error_ = "Failed addition assignment operation";
3326
3327 try {
3328 initResults();
3329 dres_ += ( lhs_ - rhs_ ) / scalar;
3330 odres_ += ( lhs_ - rhs_ ) / scalar;
3331 sres_ += ( lhs_ - rhs_ ) / scalar;
3332 osres_ += ( lhs_ - rhs_ ) / scalar;
3333 refres_ += ( reflhs_ - refrhs_ ) / scalar;
3334 }
3335 catch( std::exception& ex ) {
3336 convertException<MT1,MT2>( ex );
3337 }
3338
3339 checkResults<MT1,MT2>();
3340
3341 try {
3342 initResults();
3343 dres_ += ( lhs_ - orhs_ ) / scalar;
3344 odres_ += ( lhs_ - orhs_ ) / scalar;
3345 sres_ += ( lhs_ - orhs_ ) / scalar;
3346 osres_ += ( lhs_ - orhs_ ) / scalar;
3347 refres_ += ( reflhs_ - refrhs_ ) / scalar;
3348 }
3349 catch( std::exception& ex ) {
3350 convertException<MT1,OMT2>( ex );
3351 }
3352
3353 checkResults<MT1,OMT2>();
3354
3355 try {
3356 initResults();
3357 dres_ += ( olhs_ - rhs_ ) / scalar;
3358 odres_ += ( olhs_ - rhs_ ) / scalar;
3359 sres_ += ( olhs_ - rhs_ ) / scalar;
3360 osres_ += ( olhs_ - rhs_ ) / scalar;
3361 refres_ += ( reflhs_ - refrhs_ ) / scalar;
3362 }
3363 catch( std::exception& ex ) {
3364 convertException<OMT1,MT2>( ex );
3365 }
3366
3367 checkResults<OMT1,MT2>();
3368
3369 try {
3370 initResults();
3371 dres_ += ( olhs_ - orhs_ ) / scalar;
3372 odres_ += ( olhs_ - orhs_ ) / scalar;
3373 sres_ += ( olhs_ - orhs_ ) / scalar;
3374 osres_ += ( olhs_ - orhs_ ) / scalar;
3375 refres_ += ( reflhs_ - refrhs_ ) / scalar;
3376 }
3377 catch( std::exception& ex ) {
3378 convertException<OMT1,OMT2>( ex );
3379 }
3380
3381 checkResults<OMT1,OMT2>();
3382 }
3383
3384 // Scaled subtraction with addition assignment with evaluated matrices
3385 {
3386 test_ = "Scaled subtraction with addition assignment with evaluated matrices (OP/s)";
3387 error_ = "Failed addition assignment operation";
3388
3389 try {
3390 initResults();
3391 dres_ += ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3392 odres_ += ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3393 sres_ += ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3394 osres_ += ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3395 refres_ += ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3396 }
3397 catch( std::exception& ex ) {
3398 convertException<MT1,MT2>( ex );
3399 }
3400
3401 checkResults<MT1,MT2>();
3402
3403 try {
3404 initResults();
3405 dres_ += ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3406 odres_ += ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3407 sres_ += ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3408 osres_ += ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3409 refres_ += ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3410 }
3411 catch( std::exception& ex ) {
3412 convertException<MT1,OMT2>( ex );
3413 }
3414
3415 checkResults<MT1,OMT2>();
3416
3417 try {
3418 initResults();
3419 dres_ += ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3420 odres_ += ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3421 sres_ += ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3422 osres_ += ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3423 refres_ += ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3424 }
3425 catch( std::exception& ex ) {
3426 convertException<OMT1,MT2>( ex );
3427 }
3428
3429 checkResults<OMT1,MT2>();
3430
3431 try {
3432 initResults();
3433 dres_ += ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3434 odres_ += ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3435 sres_ += ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3436 osres_ += ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3437 refres_ += ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3438 }
3439 catch( std::exception& ex ) {
3440 convertException<OMT1,OMT2>( ex );
3441 }
3442
3443 checkResults<OMT1,OMT2>();
3444 }
3445
3446
3447 //=====================================================================================
3448 // Scaled subtraction with subtraction assignment (s*OP)
3449 //=====================================================================================
3450
3451 // Scaled subtraction with subtraction assignment with the given matrices
3452 {
3453 test_ = "Scaled subtraction with subtraction assignment with the given matrices (s*OP)";
3454 error_ = "Failed subtraction assignment operation";
3455
3456 try {
3457 initResults();
3458 dres_ -= scalar * ( lhs_ - rhs_ );
3459 odres_ -= scalar * ( lhs_ - rhs_ );
3460 sres_ -= scalar * ( lhs_ - rhs_ );
3461 osres_ -= scalar * ( lhs_ - rhs_ );
3462 refres_ -= scalar * ( reflhs_ - refrhs_ );
3463 }
3464 catch( std::exception& ex ) {
3465 convertException<MT1,MT2>( ex );
3466 }
3467
3468 checkResults<MT1,MT2>();
3469
3470 try {
3471 initResults();
3472 dres_ -= scalar * ( lhs_ - orhs_ );
3473 odres_ -= scalar * ( lhs_ - orhs_ );
3474 sres_ -= scalar * ( lhs_ - orhs_ );
3475 osres_ -= scalar * ( lhs_ - orhs_ );
3476 refres_ -= scalar * ( reflhs_ - refrhs_ );
3477 }
3478 catch( std::exception& ex ) {
3479 convertException<MT1,OMT2>( ex );
3480 }
3481
3482 checkResults<MT1,OMT2>();
3483
3484 try {
3485 initResults();
3486 dres_ -= scalar * ( olhs_ - rhs_ );
3487 odres_ -= scalar * ( olhs_ - rhs_ );
3488 sres_ -= scalar * ( olhs_ - rhs_ );
3489 osres_ -= scalar * ( olhs_ - rhs_ );
3490 refres_ -= scalar * ( reflhs_ - refrhs_ );
3491 }
3492 catch( std::exception& ex ) {
3493 convertException<OMT1,MT2>( ex );
3494 }
3495
3496 checkResults<OMT1,MT2>();
3497
3498 try {
3499 initResults();
3500 dres_ -= scalar * ( olhs_ - orhs_ );
3501 odres_ -= scalar * ( olhs_ - orhs_ );
3502 sres_ -= scalar * ( olhs_ - orhs_ );
3503 osres_ -= scalar * ( olhs_ - orhs_ );
3504 refres_ -= scalar * ( reflhs_ - refrhs_ );
3505 }
3506 catch( std::exception& ex ) {
3507 convertException<OMT1,OMT2>( ex );
3508 }
3509
3510 checkResults<OMT1,OMT2>();
3511 }
3512
3513 // Scaled subtraction with subtraction assignment with evaluated matrices
3514 {
3515 test_ = "Scaled subtraction with subtraction assignment with evaluated matrices (s*OP)";
3516 error_ = "Failed subtraction assignment operation";
3517
3518 try {
3519 initResults();
3520 dres_ -= scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3521 odres_ -= scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3522 sres_ -= scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3523 osres_ -= scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3524 refres_ -= scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3525 }
3526 catch( std::exception& ex ) {
3527 convertException<MT1,MT2>( ex );
3528 }
3529
3530 checkResults<MT1,MT2>();
3531
3532 try {
3533 initResults();
3534 dres_ -= scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3535 odres_ -= scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3536 sres_ -= scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3537 osres_ -= scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3538 refres_ -= scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3539 }
3540 catch( std::exception& ex ) {
3541 convertException<MT1,OMT2>( ex );
3542 }
3543
3544 checkResults<MT1,OMT2>();
3545
3546 try {
3547 initResults();
3548 dres_ -= scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3549 odres_ -= scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3550 sres_ -= scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3551 osres_ -= scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3552 refres_ -= scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3553 }
3554 catch( std::exception& ex ) {
3555 convertException<OMT1,MT2>( ex );
3556 }
3557
3558 checkResults<OMT1,MT2>();
3559
3560 try {
3561 initResults();
3562 dres_ -= scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3563 odres_ -= scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3564 sres_ -= scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3565 osres_ -= scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3566 refres_ -= scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3567 }
3568 catch( std::exception& ex ) {
3569 convertException<OMT1,OMT2>( ex );
3570 }
3571
3572 checkResults<OMT1,OMT2>();
3573 }
3574
3575
3576 //=====================================================================================
3577 // Scaled subtraction with subtraction assignment (OP*s)
3578 //=====================================================================================
3579
3580 // Scaled subtraction with subtraction assignment with the given matrices
3581 {
3582 test_ = "Scaled subtraction with subtraction assignment with the given matrices (OP*s)";
3583 error_ = "Failed subtraction assignment operation";
3584
3585 try {
3586 initResults();
3587 dres_ -= ( lhs_ - rhs_ ) * scalar;
3588 odres_ -= ( lhs_ - rhs_ ) * scalar;
3589 sres_ -= ( lhs_ - rhs_ ) * scalar;
3590 osres_ -= ( lhs_ - rhs_ ) * scalar;
3591 refres_ -= ( reflhs_ - refrhs_ ) * scalar;
3592 }
3593 catch( std::exception& ex ) {
3594 convertException<MT1,MT2>( ex );
3595 }
3596
3597 checkResults<MT1,MT2>();
3598
3599 try {
3600 initResults();
3601 dres_ -= ( lhs_ - orhs_ ) * scalar;
3602 odres_ -= ( lhs_ - orhs_ ) * scalar;
3603 sres_ -= ( lhs_ - orhs_ ) * scalar;
3604 osres_ -= ( lhs_ - orhs_ ) * scalar;
3605 refres_ -= ( reflhs_ - refrhs_ ) * scalar;
3606 }
3607 catch( std::exception& ex ) {
3608 convertException<MT1,OMT2>( ex );
3609 }
3610
3611 checkResults<MT1,OMT2>();
3612
3613 try {
3614 initResults();
3615 dres_ -= ( olhs_ - rhs_ ) * scalar;
3616 odres_ -= ( olhs_ - rhs_ ) * scalar;
3617 sres_ -= ( olhs_ - rhs_ ) * scalar;
3618 osres_ -= ( olhs_ - rhs_ ) * scalar;
3619 refres_ -= ( reflhs_ - refrhs_ ) * scalar;
3620 }
3621 catch( std::exception& ex ) {
3622 convertException<OMT1,MT2>( ex );
3623 }
3624
3625 checkResults<OMT1,MT2>();
3626
3627 try {
3628 initResults();
3629 dres_ -= ( olhs_ - orhs_ ) * scalar;
3630 odres_ -= ( olhs_ - orhs_ ) * scalar;
3631 sres_ -= ( olhs_ - orhs_ ) * scalar;
3632 osres_ -= ( olhs_ - orhs_ ) * scalar;
3633 refres_ -= ( reflhs_ - refrhs_ ) * scalar;
3634 }
3635 catch( std::exception& ex ) {
3636 convertException<OMT1,OMT2>( ex );
3637 }
3638
3639 checkResults<OMT1,OMT2>();
3640 }
3641
3642 // Scaled subtraction with subtraction assignment with evaluated matrices
3643 {
3644 test_ = "Scaled subtraction with subtraction assignment with evaluated matrices (OP*s)";
3645 error_ = "Failed subtraction assignment operation";
3646
3647 try {
3648 initResults();
3649 dres_ -= ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
3650 odres_ -= ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
3651 sres_ -= ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
3652 osres_ -= ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
3653 refres_ -= ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
3654 }
3655 catch( std::exception& ex ) {
3656 convertException<MT1,MT2>( ex );
3657 }
3658
3659 checkResults<MT1,MT2>();
3660
3661 try {
3662 initResults();
3663 dres_ -= ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
3664 odres_ -= ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
3665 sres_ -= ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
3666 osres_ -= ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
3667 refres_ -= ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
3668 }
3669 catch( std::exception& ex ) {
3670 convertException<MT1,OMT2>( ex );
3671 }
3672
3673 checkResults<MT1,OMT2>();
3674
3675 try {
3676 initResults();
3677 dres_ -= ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
3678 odres_ -= ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
3679 sres_ -= ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
3680 osres_ -= ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
3681 refres_ -= ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
3682 }
3683 catch( std::exception& ex ) {
3684 convertException<OMT1,MT2>( ex );
3685 }
3686
3687 checkResults<OMT1,MT2>();
3688
3689 try {
3690 initResults();
3691 dres_ -= ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
3692 odres_ -= ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
3693 sres_ -= ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
3694 osres_ -= ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
3695 refres_ -= ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
3696 }
3697 catch( std::exception& ex ) {
3698 convertException<OMT1,OMT2>( ex );
3699 }
3700
3701 checkResults<OMT1,OMT2>();
3702 }
3703
3704
3705 //=====================================================================================
3706 // Scaled subtraction with subtraction assignment (OP/s)
3707 //=====================================================================================
3708
3709 // Scaled subtraction with subtraction assignment with the given matrices
3710 {
3711 test_ = "Scaled subtraction with subtraction assignment with the given matrices (OP/s)";
3712 error_ = "Failed subtraction assignment operation";
3713
3714 try {
3715 initResults();
3716 dres_ -= ( lhs_ - rhs_ ) / scalar;
3717 odres_ -= ( lhs_ - rhs_ ) / scalar;
3718 sres_ -= ( lhs_ - rhs_ ) / scalar;
3719 osres_ -= ( lhs_ - rhs_ ) / scalar;
3720 refres_ -= ( reflhs_ - refrhs_ ) / scalar;
3721 }
3722 catch( std::exception& ex ) {
3723 convertException<MT1,MT2>( ex );
3724 }
3725
3726 checkResults<MT1,MT2>();
3727
3728 try {
3729 initResults();
3730 dres_ -= ( lhs_ - orhs_ ) / scalar;
3731 odres_ -= ( lhs_ - orhs_ ) / scalar;
3732 sres_ -= ( lhs_ - orhs_ ) / scalar;
3733 osres_ -= ( lhs_ - orhs_ ) / scalar;
3734 refres_ -= ( reflhs_ - refrhs_ ) / scalar;
3735 }
3736 catch( std::exception& ex ) {
3737 convertException<MT1,OMT2>( ex );
3738 }
3739
3740 checkResults<MT1,OMT2>();
3741
3742 try {
3743 initResults();
3744 dres_ -= ( olhs_ - rhs_ ) / scalar;
3745 odres_ -= ( olhs_ - rhs_ ) / scalar;
3746 sres_ -= ( olhs_ - rhs_ ) / scalar;
3747 osres_ -= ( olhs_ - rhs_ ) / scalar;
3748 refres_ -= ( reflhs_ - refrhs_ ) / scalar;
3749 }
3750 catch( std::exception& ex ) {
3751 convertException<OMT1,MT2>( ex );
3752 }
3753
3754 checkResults<OMT1,MT2>();
3755
3756 try {
3757 initResults();
3758 dres_ -= ( olhs_ - orhs_ ) / scalar;
3759 odres_ -= ( olhs_ - orhs_ ) / scalar;
3760 sres_ -= ( olhs_ - orhs_ ) / scalar;
3761 osres_ -= ( olhs_ - orhs_ ) / scalar;
3762 refres_ -= ( reflhs_ - refrhs_ ) / scalar;
3763 }
3764 catch( std::exception& ex ) {
3765 convertException<OMT1,OMT2>( ex );
3766 }
3767
3768 checkResults<OMT1,OMT2>();
3769 }
3770
3771 // Scaled subtraction with subtraction assignment with evaluated matrices
3772 {
3773 test_ = "Scaled subtraction with subtraction assignment with evaluated matrices (OP/s)";
3774 error_ = "Failed subtraction assignment operation";
3775
3776 try {
3777 initResults();
3778 dres_ -= ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3779 odres_ -= ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3780 sres_ -= ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3781 osres_ -= ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
3782 refres_ -= ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3783 }
3784 catch( std::exception& ex ) {
3785 convertException<MT1,MT2>( ex );
3786 }
3787
3788 checkResults<MT1,MT2>();
3789
3790 try {
3791 initResults();
3792 dres_ -= ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3793 odres_ -= ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3794 sres_ -= ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3795 osres_ -= ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
3796 refres_ -= ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3797 }
3798 catch( std::exception& ex ) {
3799 convertException<MT1,OMT2>( ex );
3800 }
3801
3802 checkResults<MT1,OMT2>();
3803
3804 try {
3805 initResults();
3806 dres_ -= ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3807 odres_ -= ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3808 sres_ -= ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3809 osres_ -= ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
3810 refres_ -= ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3811 }
3812 catch( std::exception& ex ) {
3813 convertException<OMT1,MT2>( ex );
3814 }
3815
3816 checkResults<OMT1,MT2>();
3817
3818 try {
3819 initResults();
3820 dres_ -= ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3821 odres_ -= ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3822 sres_ -= ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3823 osres_ -= ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
3824 refres_ -= ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
3825 }
3826 catch( std::exception& ex ) {
3827 convertException<OMT1,OMT2>( ex );
3828 }
3829
3830 checkResults<OMT1,OMT2>();
3831 }
3832
3833
3834 //=====================================================================================
3835 // Scaled subtraction with Schur product assignment (s*OP)
3836 //=====================================================================================
3837
3838 // Scaled subtraction with Schur product assignment with the given matrices
3839 {
3840 test_ = "Scaled subtraction with Schur product assignment with the given matrices (s*OP)";
3841 error_ = "Failed Schur product assignment operation";
3842
3843 try {
3844 initResults();
3845 dres_ %= scalar * ( lhs_ - rhs_ );
3846 odres_ %= scalar * ( lhs_ - rhs_ );
3847 sres_ %= scalar * ( lhs_ - rhs_ );
3848 osres_ %= scalar * ( lhs_ - rhs_ );
3849 refres_ %= scalar * ( reflhs_ - refrhs_ );
3850 }
3851 catch( std::exception& ex ) {
3852 convertException<MT1,MT2>( ex );
3853 }
3854
3855 checkResults<MT1,MT2>();
3856
3857 try {
3858 initResults();
3859 dres_ %= scalar * ( lhs_ - orhs_ );
3860 odres_ %= scalar * ( lhs_ - orhs_ );
3861 sres_ %= scalar * ( lhs_ - orhs_ );
3862 osres_ %= scalar * ( lhs_ - orhs_ );
3863 refres_ %= scalar * ( reflhs_ - refrhs_ );
3864 }
3865 catch( std::exception& ex ) {
3866 convertException<MT1,OMT2>( ex );
3867 }
3868
3869 checkResults<MT1,OMT2>();
3870
3871 try {
3872 initResults();
3873 dres_ %= scalar * ( olhs_ - rhs_ );
3874 odres_ %= scalar * ( olhs_ - rhs_ );
3875 sres_ %= scalar * ( olhs_ - rhs_ );
3876 osres_ %= scalar * ( olhs_ - rhs_ );
3877 refres_ %= scalar * ( reflhs_ - refrhs_ );
3878 }
3879 catch( std::exception& ex ) {
3880 convertException<OMT1,MT2>( ex );
3881 }
3882
3883 checkResults<OMT1,MT2>();
3884
3885 try {
3886 initResults();
3887 dres_ %= scalar * ( olhs_ - orhs_ );
3888 odres_ %= scalar * ( olhs_ - orhs_ );
3889 sres_ %= scalar * ( olhs_ - orhs_ );
3890 osres_ %= scalar * ( olhs_ - orhs_ );
3891 refres_ %= scalar * ( reflhs_ - refrhs_ );
3892 }
3893 catch( std::exception& ex ) {
3894 convertException<OMT1,OMT2>( ex );
3895 }
3896
3897 checkResults<OMT1,OMT2>();
3898 }
3899
3900 // Scaled subtraction with Schur product assignment with evaluated matrices
3901 {
3902 test_ = "Scaled subtraction with Schur product assignment with evaluated matrices (s*OP)";
3903 error_ = "Failed Schur product assignment operation";
3904
3905 try {
3906 initResults();
3907 dres_ %= scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3908 odres_ %= scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3909 sres_ %= scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3910 osres_ %= scalar * ( eval( lhs_ ) - eval( rhs_ ) );
3911 refres_ %= scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3912 }
3913 catch( std::exception& ex ) {
3914 convertException<MT1,MT2>( ex );
3915 }
3916
3917 checkResults<MT1,MT2>();
3918
3919 try {
3920 initResults();
3921 dres_ %= scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3922 odres_ %= scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3923 sres_ %= scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3924 osres_ %= scalar * ( eval( lhs_ ) - eval( orhs_ ) );
3925 refres_ %= scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3926 }
3927 catch( std::exception& ex ) {
3928 convertException<MT1,OMT2>( ex );
3929 }
3930
3931 checkResults<MT1,OMT2>();
3932
3933 try {
3934 initResults();
3935 dres_ %= scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3936 odres_ %= scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3937 sres_ %= scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3938 osres_ %= scalar * ( eval( olhs_ ) - eval( rhs_ ) );
3939 refres_ %= scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3940 }
3941 catch( std::exception& ex ) {
3942 convertException<OMT1,MT2>( ex );
3943 }
3944
3945 checkResults<OMT1,MT2>();
3946
3947 try {
3948 initResults();
3949 dres_ %= scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3950 odres_ %= scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3951 sres_ %= scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3952 osres_ %= scalar * ( eval( olhs_ ) - eval( orhs_ ) );
3953 refres_ %= scalar * ( eval( reflhs_ ) - eval( refrhs_ ) );
3954 }
3955 catch( std::exception& ex ) {
3956 convertException<OMT1,OMT2>( ex );
3957 }
3958
3959 checkResults<OMT1,OMT2>();
3960 }
3961
3962
3963 //=====================================================================================
3964 // Scaled subtraction with Schur product assignment (OP*s)
3965 //=====================================================================================
3966
3967 // Scaled subtraction with Schur product assignment with the given matrices
3968 {
3969 test_ = "Scaled subtraction with Schur product assignment with the given matrices (OP*s)";
3970 error_ = "Failed Schur product assignment operation";
3971
3972 try {
3973 initResults();
3974 dres_ %= ( lhs_ - rhs_ ) * scalar;
3975 odres_ %= ( lhs_ - rhs_ ) * scalar;
3976 sres_ %= ( lhs_ - rhs_ ) * scalar;
3977 osres_ %= ( lhs_ - rhs_ ) * scalar;
3978 refres_ %= ( reflhs_ - refrhs_ ) * scalar;
3979 }
3980 catch( std::exception& ex ) {
3981 convertException<MT1,MT2>( ex );
3982 }
3983
3984 checkResults<MT1,MT2>();
3985
3986 try {
3987 initResults();
3988 dres_ %= ( lhs_ - orhs_ ) * scalar;
3989 odres_ %= ( lhs_ - orhs_ ) * scalar;
3990 sres_ %= ( lhs_ - orhs_ ) * scalar;
3991 osres_ %= ( lhs_ - orhs_ ) * scalar;
3992 refres_ %= ( reflhs_ - refrhs_ ) * scalar;
3993 }
3994 catch( std::exception& ex ) {
3995 convertException<MT1,OMT2>( ex );
3996 }
3997
3998 checkResults<MT1,OMT2>();
3999
4000 try {
4001 initResults();
4002 dres_ %= ( olhs_ - rhs_ ) * scalar;
4003 odres_ %= ( olhs_ - rhs_ ) * scalar;
4004 sres_ %= ( olhs_ - rhs_ ) * scalar;
4005 osres_ %= ( olhs_ - rhs_ ) * scalar;
4006 refres_ %= ( reflhs_ - refrhs_ ) * scalar;
4007 }
4008 catch( std::exception& ex ) {
4009 convertException<OMT1,MT2>( ex );
4010 }
4011
4012 checkResults<OMT1,MT2>();
4013
4014 try {
4015 initResults();
4016 dres_ %= ( olhs_ - orhs_ ) * scalar;
4017 odres_ %= ( olhs_ - orhs_ ) * scalar;
4018 sres_ %= ( olhs_ - orhs_ ) * scalar;
4019 osres_ %= ( olhs_ - orhs_ ) * scalar;
4020 refres_ %= ( reflhs_ - refrhs_ ) * scalar;
4021 }
4022 catch( std::exception& ex ) {
4023 convertException<OMT1,OMT2>( ex );
4024 }
4025
4026 checkResults<OMT1,OMT2>();
4027 }
4028
4029 // Scaled subtraction with Schur product assignment with evaluated matrices
4030 {
4031 test_ = "Scaled subtraction with Schur product assignment with evaluated matrices (OP*s)";
4032 error_ = "Failed Schur product assignment operation";
4033
4034 try {
4035 initResults();
4036 dres_ %= ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
4037 odres_ %= ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
4038 sres_ %= ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
4039 osres_ %= ( eval( lhs_ ) - eval( rhs_ ) ) * scalar;
4040 refres_ %= ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
4041 }
4042 catch( std::exception& ex ) {
4043 convertException<MT1,MT2>( ex );
4044 }
4045
4046 checkResults<MT1,MT2>();
4047
4048 try {
4049 initResults();
4050 dres_ %= ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
4051 odres_ %= ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
4052 sres_ %= ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
4053 osres_ %= ( eval( lhs_ ) - eval( orhs_ ) ) * scalar;
4054 refres_ %= ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
4055 }
4056 catch( std::exception& ex ) {
4057 convertException<MT1,OMT2>( ex );
4058 }
4059
4060 checkResults<MT1,OMT2>();
4061
4062 try {
4063 initResults();
4064 dres_ %= ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
4065 odres_ %= ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
4066 sres_ %= ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
4067 osres_ %= ( eval( olhs_ ) - eval( rhs_ ) ) * scalar;
4068 refres_ %= ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
4069 }
4070 catch( std::exception& ex ) {
4071 convertException<OMT1,MT2>( ex );
4072 }
4073
4074 checkResults<OMT1,MT2>();
4075
4076 try {
4077 initResults();
4078 dres_ %= ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
4079 odres_ %= ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
4080 sres_ %= ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
4081 osres_ %= ( eval( olhs_ ) - eval( orhs_ ) ) * scalar;
4082 refres_ %= ( eval( reflhs_ ) - eval( refrhs_ ) ) * scalar;
4083 }
4084 catch( std::exception& ex ) {
4085 convertException<OMT1,OMT2>( ex );
4086 }
4087
4088 checkResults<OMT1,OMT2>();
4089 }
4090
4091
4092 //=====================================================================================
4093 // Scaled subtraction with Schur product assignment (OP/s)
4094 //=====================================================================================
4095
4096 // Scaled subtraction with Schur product assignment with the given matrices
4097 {
4098 test_ = "Scaled subtraction with Schur product assignment with the given matrices (OP/s)";
4099 error_ = "Failed Schur product assignment operation";
4100
4101 try {
4102 initResults();
4103 dres_ %= ( lhs_ - rhs_ ) / scalar;
4104 odres_ %= ( lhs_ - rhs_ ) / scalar;
4105 sres_ %= ( lhs_ - rhs_ ) / scalar;
4106 osres_ %= ( lhs_ - rhs_ ) / scalar;
4107 refres_ %= ( reflhs_ - refrhs_ ) / scalar;
4108 }
4109 catch( std::exception& ex ) {
4110 convertException<MT1,MT2>( ex );
4111 }
4112
4113 checkResults<MT1,MT2>();
4114
4115 try {
4116 initResults();
4117 dres_ %= ( lhs_ - orhs_ ) / scalar;
4118 odres_ %= ( lhs_ - orhs_ ) / scalar;
4119 sres_ %= ( lhs_ - orhs_ ) / scalar;
4120 osres_ %= ( lhs_ - orhs_ ) / scalar;
4121 refres_ %= ( reflhs_ - refrhs_ ) / scalar;
4122 }
4123 catch( std::exception& ex ) {
4124 convertException<MT1,OMT2>( ex );
4125 }
4126
4127 checkResults<MT1,OMT2>();
4128
4129 try {
4130 initResults();
4131 dres_ %= ( olhs_ - rhs_ ) / scalar;
4132 odres_ %= ( olhs_ - rhs_ ) / scalar;
4133 sres_ %= ( olhs_ - rhs_ ) / scalar;
4134 osres_ %= ( olhs_ - rhs_ ) / scalar;
4135 refres_ %= ( reflhs_ - refrhs_ ) / scalar;
4136 }
4137 catch( std::exception& ex ) {
4138 convertException<OMT1,MT2>( ex );
4139 }
4140
4141 checkResults<OMT1,MT2>();
4142
4143 try {
4144 initResults();
4145 dres_ %= ( olhs_ - orhs_ ) / scalar;
4146 odres_ %= ( olhs_ - orhs_ ) / scalar;
4147 sres_ %= ( olhs_ - orhs_ ) / scalar;
4148 osres_ %= ( olhs_ - orhs_ ) / scalar;
4149 refres_ %= ( reflhs_ - refrhs_ ) / scalar;
4150 }
4151 catch( std::exception& ex ) {
4152 convertException<OMT1,OMT2>( ex );
4153 }
4154
4155 checkResults<OMT1,OMT2>();
4156 }
4157
4158 // Scaled subtraction with Schur product assignment with evaluated matrices
4159 {
4160 test_ = "Scaled subtraction with Schur product assignment with evaluated matrices (OP/s)";
4161 error_ = "Failed Schur product assignment operation";
4162
4163 try {
4164 initResults();
4165 dres_ %= ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
4166 odres_ %= ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
4167 sres_ %= ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
4168 osres_ %= ( eval( lhs_ ) - eval( rhs_ ) ) / scalar;
4169 refres_ %= ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
4170 }
4171 catch( std::exception& ex ) {
4172 convertException<MT1,MT2>( ex );
4173 }
4174
4175 checkResults<MT1,MT2>();
4176
4177 try {
4178 initResults();
4179 dres_ %= ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
4180 odres_ %= ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
4181 sres_ %= ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
4182 osres_ %= ( eval( lhs_ ) - eval( orhs_ ) ) / scalar;
4183 refres_ %= ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
4184 }
4185 catch( std::exception& ex ) {
4186 convertException<MT1,OMT2>( ex );
4187 }
4188
4189 checkResults<MT1,OMT2>();
4190
4191 try {
4192 initResults();
4193 dres_ %= ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
4194 odres_ %= ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
4195 sres_ %= ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
4196 osres_ %= ( eval( olhs_ ) - eval( rhs_ ) ) / scalar;
4197 refres_ %= ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
4198 }
4199 catch( std::exception& ex ) {
4200 convertException<OMT1,MT2>( ex );
4201 }
4202
4203 checkResults<OMT1,MT2>();
4204
4205 try {
4206 initResults();
4207 dres_ %= ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
4208 odres_ %= ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
4209 sres_ %= ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
4210 osres_ %= ( eval( olhs_ ) - eval( orhs_ ) ) / scalar;
4211 refres_ %= ( eval( reflhs_ ) - eval( refrhs_ ) ) / scalar;
4212 }
4213 catch( std::exception& ex ) {
4214 convertException<OMT1,OMT2>( ex );
4215 }
4216
4217 checkResults<OMT1,OMT2>();
4218 }
4219 }
4220 #endif
4221 }
4222 //*************************************************************************************************
4223
4224
4225 //*************************************************************************************************
4226 /*!\brief Testing the transpose sparse matrix/sparse matrix subtraction.
4227 //
4228 // \return void
4229 // \exception std::runtime_error Subtraction error detected.
4230 //
4231 // This function tests the transpose matrix subtraction with plain assignment. In case any error
4232 // resulting from the subtraction or the subsequent assignment is detected, a \a std::runtime_error
4233 // exception is thrown.
4234 */
4235 template< typename MT1 // Type of the left-hand side sparse matrix
4236 , typename MT2 > // Type of the right-hand side sparse matrix
testTransOperation()4237 void OperationTest<MT1,MT2>::testTransOperation()
4238 {
4239 #if BLAZETEST_MATHTEST_TEST_TRANS_OPERATION
4240 if( BLAZETEST_MATHTEST_TEST_TRANS_OPERATION > 1 )
4241 {
4242 //=====================================================================================
4243 // Transpose subtraction
4244 //=====================================================================================
4245
4246 // Transpose subtraction with the given matrices
4247 {
4248 test_ = "Transpose subtraction with the given matrices";
4249 error_ = "Failed subtraction operation";
4250
4251 try {
4252 initTransposeResults();
4253 tdres_ = trans( lhs_ - rhs_ );
4254 todres_ = trans( lhs_ - rhs_ );
4255 tsres_ = trans( lhs_ - rhs_ );
4256 tosres_ = trans( lhs_ - rhs_ );
4257 refres_ = trans( reflhs_ - refrhs_ );
4258 }
4259 catch( std::exception& ex ) {
4260 convertException<MT1,MT2>( ex );
4261 }
4262
4263 checkTransposeResults<MT1,MT2>();
4264
4265 try {
4266 initTransposeResults();
4267 tdres_ = trans( lhs_ - orhs_ );
4268 todres_ = trans( lhs_ - orhs_ );
4269 tsres_ = trans( lhs_ - orhs_ );
4270 tosres_ = trans( lhs_ - orhs_ );
4271 refres_ = trans( reflhs_ - refrhs_ );
4272 }
4273 catch( std::exception& ex ) {
4274 convertException<MT1,OMT2>( ex );
4275 }
4276
4277 checkTransposeResults<MT1,OMT2>();
4278
4279 try {
4280 initTransposeResults();
4281 tdres_ = trans( olhs_ - rhs_ );
4282 todres_ = trans( olhs_ - rhs_ );
4283 tsres_ = trans( olhs_ - rhs_ );
4284 tosres_ = trans( olhs_ - rhs_ );
4285 refres_ = trans( reflhs_ - refrhs_ );
4286 }
4287 catch( std::exception& ex ) {
4288 convertException<OMT1,MT2>( ex );
4289 }
4290
4291 checkTransposeResults<OMT1,MT2>();
4292
4293 try {
4294 initTransposeResults();
4295 tdres_ = trans( olhs_ - orhs_ );
4296 todres_ = trans( olhs_ - orhs_ );
4297 tsres_ = trans( olhs_ - orhs_ );
4298 tosres_ = trans( olhs_ - orhs_ );
4299 refres_ = trans( reflhs_ - refrhs_ );
4300 }
4301 catch( std::exception& ex ) {
4302 convertException<OMT1,OMT2>( ex );
4303 }
4304
4305 checkTransposeResults<OMT1,OMT2>();
4306 }
4307
4308 // Transpose subtraction with evaluated matrices
4309 {
4310 test_ = "Transpose subtraction with evaluated matrices";
4311 error_ = "Failed subtraction operation";
4312
4313 try {
4314 initTransposeResults();
4315 tdres_ = trans( eval( lhs_ ) - eval( rhs_ ) );
4316 todres_ = trans( eval( lhs_ ) - eval( rhs_ ) );
4317 tsres_ = trans( eval( lhs_ ) - eval( rhs_ ) );
4318 tosres_ = trans( eval( lhs_ ) - eval( rhs_ ) );
4319 refres_ = trans( eval( reflhs_ ) - eval( refrhs_ ) );
4320 }
4321 catch( std::exception& ex ) {
4322 convertException<MT1,MT2>( ex );
4323 }
4324
4325 checkTransposeResults<MT1,MT2>();
4326
4327 try {
4328 initTransposeResults();
4329 tdres_ = trans( eval( lhs_ ) - eval( orhs_ ) );
4330 todres_ = trans( eval( lhs_ ) - eval( orhs_ ) );
4331 tsres_ = trans( eval( lhs_ ) - eval( orhs_ ) );
4332 tosres_ = trans( eval( lhs_ ) - eval( orhs_ ) );
4333 refres_ = trans( eval( reflhs_ ) - eval( refrhs_ ) );
4334 }
4335 catch( std::exception& ex ) {
4336 convertException<MT1,OMT2>( ex );
4337 }
4338
4339 checkTransposeResults<MT1,OMT2>();
4340
4341 try {
4342 initTransposeResults();
4343 tdres_ = trans( eval( olhs_ ) - eval( rhs_ ) );
4344 todres_ = trans( eval( olhs_ ) - eval( rhs_ ) );
4345 tsres_ = trans( eval( olhs_ ) - eval( rhs_ ) );
4346 tosres_ = trans( eval( olhs_ ) - eval( rhs_ ) );
4347 refres_ = trans( eval( reflhs_ ) - eval( refrhs_ ) );
4348 }
4349 catch( std::exception& ex ) {
4350 convertException<OMT1,MT2>( ex );
4351 }
4352
4353 checkTransposeResults<OMT1,MT2>();
4354
4355 try {
4356 initTransposeResults();
4357 tdres_ = trans( eval( olhs_ ) - eval( orhs_ ) );
4358 todres_ = trans( eval( olhs_ ) - eval( orhs_ ) );
4359 tsres_ = trans( eval( olhs_ ) - eval( orhs_ ) );
4360 tosres_ = trans( eval( olhs_ ) - eval( orhs_ ) );
4361 refres_ = trans( eval( reflhs_ ) - eval( refrhs_ ) );
4362 }
4363 catch( std::exception& ex ) {
4364 convertException<OMT1,OMT2>( ex );
4365 }
4366
4367 checkTransposeResults<OMT1,OMT2>();
4368 }
4369 }
4370 #endif
4371 }
4372 //*************************************************************************************************
4373
4374
4375 //*************************************************************************************************
4376 /*!\brief Testing the conjugate transpose sparse matrix/sparse matrix subtraction.
4377 //
4378 // \return void
4379 // \exception std::runtime_error Subtraction error detected.
4380 //
4381 // This function tests the conjugate transpose matrix subtraction with plain assignment. In
4382 // case any error resulting from the subtraction or the subsequent assignment is detected,
4383 // a \a std::runtime_error exception is thrown.
4384 */
4385 template< typename MT1 // Type of the left-hand side sparse matrix
4386 , typename MT2 > // Type of the right-hand side sparse matrix
testCTransOperation()4387 void OperationTest<MT1,MT2>::testCTransOperation()
4388 {
4389 #if BLAZETEST_MATHTEST_TEST_CTRANS_OPERATION
4390 if( BLAZETEST_MATHTEST_TEST_CTRANS_OPERATION > 1 )
4391 {
4392 //=====================================================================================
4393 // Conjugate transpose subtraction
4394 //=====================================================================================
4395
4396 // Conjugate transpose subtraction with the given matrices
4397 {
4398 test_ = "Conjugate transpose subtraction with the given matrices";
4399 error_ = "Failed subtraction operation";
4400
4401 try {
4402 initTransposeResults();
4403 tdres_ = ctrans( lhs_ - rhs_ );
4404 todres_ = ctrans( lhs_ - rhs_ );
4405 tsres_ = ctrans( lhs_ - rhs_ );
4406 tosres_ = ctrans( lhs_ - rhs_ );
4407 refres_ = ctrans( reflhs_ - refrhs_ );
4408 }
4409 catch( std::exception& ex ) {
4410 convertException<MT1,MT2>( ex );
4411 }
4412
4413 checkTransposeResults<MT1,MT2>();
4414
4415 try {
4416 initTransposeResults();
4417 tdres_ = ctrans( lhs_ - orhs_ );
4418 todres_ = ctrans( lhs_ - orhs_ );
4419 tsres_ = ctrans( lhs_ - orhs_ );
4420 tosres_ = ctrans( lhs_ - orhs_ );
4421 refres_ = ctrans( reflhs_ - refrhs_ );
4422 }
4423 catch( std::exception& ex ) {
4424 convertException<MT1,OMT2>( ex );
4425 }
4426
4427 checkTransposeResults<MT1,OMT2>();
4428
4429 try {
4430 initTransposeResults();
4431 tdres_ = ctrans( olhs_ - rhs_ );
4432 todres_ = ctrans( olhs_ - rhs_ );
4433 tsres_ = ctrans( olhs_ - rhs_ );
4434 tosres_ = ctrans( olhs_ - rhs_ );
4435 refres_ = ctrans( reflhs_ - refrhs_ );
4436 }
4437 catch( std::exception& ex ) {
4438 convertException<OMT1,MT2>( ex );
4439 }
4440
4441 checkTransposeResults<OMT1,MT2>();
4442
4443 try {
4444 initTransposeResults();
4445 tdres_ = ctrans( olhs_ - orhs_ );
4446 todres_ = ctrans( olhs_ - orhs_ );
4447 tsres_ = ctrans( olhs_ - orhs_ );
4448 tosres_ = ctrans( olhs_ - orhs_ );
4449 refres_ = ctrans( reflhs_ - refrhs_ );
4450 }
4451 catch( std::exception& ex ) {
4452 convertException<OMT1,OMT2>( ex );
4453 }
4454
4455 checkTransposeResults<OMT1,OMT2>();
4456 }
4457
4458 // Conjugate transpose subtraction with evaluated matrices
4459 {
4460 test_ = "Conjugate transpose subtraction with evaluated matrices";
4461 error_ = "Failed subtraction operation";
4462
4463 try {
4464 initTransposeResults();
4465 tdres_ = ctrans( eval( lhs_ ) - eval( rhs_ ) );
4466 todres_ = ctrans( eval( lhs_ ) - eval( rhs_ ) );
4467 tsres_ = ctrans( eval( lhs_ ) - eval( rhs_ ) );
4468 tosres_ = ctrans( eval( lhs_ ) - eval( rhs_ ) );
4469 refres_ = ctrans( eval( reflhs_ ) - eval( refrhs_ ) );
4470 }
4471 catch( std::exception& ex ) {
4472 convertException<MT1,MT2>( ex );
4473 }
4474
4475 checkTransposeResults<MT1,MT2>();
4476
4477 try {
4478 initTransposeResults();
4479 tdres_ = ctrans( eval( lhs_ ) - eval( orhs_ ) );
4480 todres_ = ctrans( eval( lhs_ ) - eval( orhs_ ) );
4481 tsres_ = ctrans( eval( lhs_ ) - eval( orhs_ ) );
4482 tosres_ = ctrans( eval( lhs_ ) - eval( orhs_ ) );
4483 refres_ = ctrans( eval( reflhs_ ) - eval( refrhs_ ) );
4484 }
4485 catch( std::exception& ex ) {
4486 convertException<MT1,OMT2>( ex );
4487 }
4488
4489 checkTransposeResults<MT1,OMT2>();
4490
4491 try {
4492 initTransposeResults();
4493 tdres_ = ctrans( eval( olhs_ ) - eval( rhs_ ) );
4494 todres_ = ctrans( eval( olhs_ ) - eval( rhs_ ) );
4495 tsres_ = ctrans( eval( olhs_ ) - eval( rhs_ ) );
4496 tosres_ = ctrans( eval( olhs_ ) - eval( rhs_ ) );
4497 refres_ = ctrans( eval( reflhs_ ) - eval( refrhs_ ) );
4498 }
4499 catch( std::exception& ex ) {
4500 convertException<OMT1,MT2>( ex );
4501 }
4502
4503 checkTransposeResults<OMT1,MT2>();
4504
4505 try {
4506 initTransposeResults();
4507 tdres_ = ctrans( eval( olhs_ ) - eval( orhs_ ) );
4508 todres_ = ctrans( eval( olhs_ ) - eval( orhs_ ) );
4509 tsres_ = ctrans( eval( olhs_ ) - eval( orhs_ ) );
4510 tosres_ = ctrans( eval( olhs_ ) - eval( orhs_ ) );
4511 refres_ = ctrans( eval( reflhs_ ) - eval( refrhs_ ) );
4512 }
4513 catch( std::exception& ex ) {
4514 convertException<OMT1,OMT2>( ex );
4515 }
4516
4517 checkTransposeResults<OMT1,OMT2>();
4518 }
4519 }
4520 #endif
4521 }
4522 //*************************************************************************************************
4523
4524
4525 //*************************************************************************************************
4526 /*!\brief Testing the abs sparse matrix/sparse matrix subtraction.
4527 //
4528 // \return void
4529 // \exception std::runtime_error Subtraction error detected.
4530 //
4531 // This function tests the abs matrix subtraction with plain assignment, addition assignment,
4532 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4533 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
4534 // thrown.
4535 */
4536 template< typename MT1 // Type of the left-hand side sparse matrix
4537 , typename MT2 > // Type of the right-hand side sparse matrix
testAbsOperation()4538 void OperationTest<MT1,MT2>::testAbsOperation()
4539 {
4540 #if BLAZETEST_MATHTEST_TEST_ABS_OPERATION
4541 if( BLAZETEST_MATHTEST_TEST_ABS_OPERATION > 1 )
4542 {
4543 testCustomOperation( blaze::Abs(), "abs" );
4544 }
4545 #endif
4546 }
4547 //*************************************************************************************************
4548
4549
4550 //*************************************************************************************************
4551 /*!\brief Testing the conjugate sparse matrix/sparse matrix subtraction.
4552 //
4553 // \return void
4554 // \exception std::runtime_error Subtraction error detected.
4555 //
4556 // This function tests the conjugate matrix subtraction with plain assignment, addition assignment,
4557 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4558 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
4559 // thrown.
4560 */
4561 template< typename MT1 // Type of the left-hand side sparse matrix
4562 , typename MT2 > // Type of the right-hand side sparse matrix
testConjOperation()4563 void OperationTest<MT1,MT2>::testConjOperation()
4564 {
4565 #if BLAZETEST_MATHTEST_TEST_CONJ_OPERATION
4566 if( BLAZETEST_MATHTEST_TEST_CONJ_OPERATION > 1 )
4567 {
4568 testCustomOperation( blaze::Conj(), "conj" );
4569 }
4570 #endif
4571 }
4572 //*************************************************************************************************
4573
4574
4575 //*************************************************************************************************
4576 /*!\brief Testing the \a real sparse matrix/sparse matrix subtraction.
4577 //
4578 // \return void
4579 // \exception std::runtime_error Subtraction error detected.
4580 //
4581 // This function tests the \a real matrix subtraction with plain assignment, addition assignment,
4582 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4583 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
4584 // thrown.
4585 */
4586 template< typename MT1 // Type of the left-hand side sparse matrix
4587 , typename MT2 > // Type of the right-hand side sparse matrix
testRealOperation()4588 void OperationTest<MT1,MT2>::testRealOperation()
4589 {
4590 #if BLAZETEST_MATHTEST_TEST_REAL_OPERATION
4591 if( BLAZETEST_MATHTEST_TEST_REAL_OPERATION > 1 )
4592 {
4593 testCustomOperation( blaze::Real(), "real" );
4594 }
4595 #endif
4596 }
4597 //*************************************************************************************************
4598
4599
4600 //*************************************************************************************************
4601 /*!\brief Testing the \a imag sparse matrix/sparse matrix subtraction.
4602 //
4603 // \return void
4604 // \exception std::runtime_error Subtraction error detected.
4605 //
4606 // This function tests the \a imag matrix subtraction with plain assignment, addition assignment,
4607 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4608 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
4609 // thrown.
4610 */
4611 template< typename MT1 // Type of the left-hand side sparse matrix
4612 , typename MT2 > // Type of the right-hand side sparse matrix
testImagOperation()4613 void OperationTest<MT1,MT2>::testImagOperation()
4614 {
4615 #if BLAZETEST_MATHTEST_TEST_IMAG_OPERATION
4616 if( BLAZETEST_MATHTEST_TEST_IMAG_OPERATION > 1 &&
4617 ( !blaze::IsHermitian<SRE>::value || blaze::isSymmetric( imag( lhs_ - rhs_ ) ) ) )
4618 {
4619 testCustomOperation( blaze::Imag(), "imag" );
4620 }
4621 #endif
4622 }
4623 //*************************************************************************************************
4624
4625
4626 //*************************************************************************************************
4627 /*!\brief Testing the evaluated sparse matrix/sparse matrix subtraction.
4628 //
4629 // \return void
4630 // \exception std::runtime_error Subtraction error detected.
4631 //
4632 // This function tests the evaluated matrix subtraction with plain assignment, addition assignment,
4633 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4634 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
4635 // thrown.
4636 */
4637 template< typename MT1 // Type of the left-hand side sparse matrix
4638 , typename MT2 > // Type of the right-hand side sparse matrix
testEvalOperation()4639 void OperationTest<MT1,MT2>::testEvalOperation()
4640 {
4641 #if BLAZETEST_MATHTEST_TEST_EVAL_OPERATION
4642 if( BLAZETEST_MATHTEST_TEST_EVAL_OPERATION > 1 )
4643 {
4644 testCustomOperation( blaze::Eval(), "eval" );
4645 }
4646 #endif
4647 }
4648 //*************************************************************************************************
4649
4650
4651 //*************************************************************************************************
4652 /*!\brief Testing the serialized sparse matrix/sparse matrix subtraction.
4653 //
4654 // \return void
4655 // \exception std::runtime_error Subtraction error detected.
4656 //
4657 // This function tests the serialized matrix subtraction with plain assignment, addition assignment,
4658 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4659 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
4660 // thrown.
4661 */
4662 template< typename MT1 // Type of the left-hand side sparse matrix
4663 , typename MT2 > // Type of the right-hand side sparse matrix
testSerialOperation()4664 void OperationTest<MT1,MT2>::testSerialOperation()
4665 {
4666 #if BLAZETEST_MATHTEST_TEST_SERIAL_OPERATION
4667 if( BLAZETEST_MATHTEST_TEST_SERIAL_OPERATION > 1 )
4668 {
4669 testCustomOperation( blaze::Serial(), "serial" );
4670 }
4671 #endif
4672 }
4673 //*************************************************************************************************
4674
4675
4676 //*************************************************************************************************
4677 /*!\brief Testing the non-aliased sparse matrix/sparse matrix subtraction.
4678 //
4679 // \return void
4680 // \exception std::runtime_error Subtraction error detected.
4681 //
4682 // This function tests the non-aliased matrix subtraction with plain assignment, addition
4683 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4684 // from the subtraction or the subsequent assignment is detected, a \a std::runtime_error
4685 // exception is thrown.
4686 */
4687 template< typename MT1 // Type of the left-hand side sparse matrix
4688 , typename MT2 > // Type of the right-hand side sparse matrix
testNoAliasOperation()4689 void OperationTest<MT1,MT2>::testNoAliasOperation()
4690 {
4691 #if BLAZETEST_MATHTEST_TEST_NOALIAS_OPERATION
4692 if( BLAZETEST_MATHTEST_TEST_NOALIAS_OPERATION > 1 )
4693 {
4694 testCustomOperation( blaze::NoAlias(), "noalias" );
4695 }
4696 #endif
4697 }
4698 //*************************************************************************************************
4699
4700
4701 //*************************************************************************************************
4702 /*!\brief Testing the non-SIMD sparse matrix/sparse matrix subtraction.
4703 //
4704 // \return void
4705 // \exception std::runtime_error Subtraction error detected.
4706 //
4707 // This function tests the non-SIMD matrix subtraction with plain assignment, addition
4708 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4709 // from the subtraction or the subsequent assignment is detected, a \a std::runtime_error
4710 // exception is thrown.
4711 */
4712 template< typename MT1 // Type of the left-hand side sparse matrix
4713 , typename MT2 > // Type of the right-hand side sparse matrix
testNoSIMDOperation()4714 void OperationTest<MT1,MT2>::testNoSIMDOperation()
4715 {
4716 #if BLAZETEST_MATHTEST_TEST_NOSIMD_OPERATION
4717 if( BLAZETEST_MATHTEST_TEST_NOSIMD_OPERATION > 1 )
4718 {
4719 testCustomOperation( blaze::NoSIMD(), "nosimd" );
4720 }
4721 #endif
4722 }
4723 //*************************************************************************************************
4724
4725
4726 //*************************************************************************************************
4727 /*!\brief Testing the symmetric sparse matrix/sparse matrix subtraction.
4728 //
4729 // \return void
4730 // \exception std::runtime_error Subtraction error detected.
4731 //
4732 // This function tests the symmetric matrix subtraction with plain assignment, addition assignment,
4733 // subtraction assignment, and Schur product assignment. In case any error resulting from the
4734 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
4735 // thrown.
4736 */
4737 template< typename MT1 // Type of the left-hand side sparse matrix
4738 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclSymOperation(blaze::TrueType)4739 void OperationTest<MT1,MT2>::testDeclSymOperation( blaze::TrueType )
4740 {
4741 #if BLAZETEST_MATHTEST_TEST_DECLSYM_OPERATION
4742 if( BLAZETEST_MATHTEST_TEST_DECLSYM_OPERATION > 1 )
4743 {
4744 if( ( !blaze::IsDiagonal<MT1>::value && blaze::IsTriangular<MT1>::value ) ||
4745 ( !blaze::IsDiagonal<MT2>::value && blaze::IsTriangular<MT2>::value ) ||
4746 ( !blaze::IsDiagonal<MT1>::value && blaze::IsHermitian<MT1>::value && blaze::IsComplex<ET1>::value ) ||
4747 ( !blaze::IsDiagonal<MT2>::value && blaze::IsHermitian<MT2>::value && blaze::IsComplex<ET2>::value ) ||
4748 ( lhs_.rows() != lhs_.columns() ) )
4749 return;
4750
4751
4752 //=====================================================================================
4753 // Test-specific setup of the left-hand side operand
4754 //=====================================================================================
4755
4756 MT1 lhs ( lhs_ * trans( lhs_ ) );
4757 OMT1 olhs ( lhs );
4758 RT1 reflhs( lhs );
4759
4760
4761 //=====================================================================================
4762 // Test-specific setup of the right-hand side operand
4763 //=====================================================================================
4764
4765 MT2 rhs ( rhs_ * trans( rhs_ ) );
4766 OMT2 orhs ( rhs );
4767 RT2 refrhs( rhs );
4768
4769
4770 //=====================================================================================
4771 // Declsym subtraction
4772 //=====================================================================================
4773
4774 // Declsym subtraction with the given matrices
4775 {
4776 test_ = "Declsym subtraction with the given matrices";
4777 error_ = "Failed subtraction operation";
4778
4779 try {
4780 initResults();
4781 dres_ = declsym( lhs - rhs );
4782 odres_ = declsym( lhs - rhs );
4783 sres_ = declsym( lhs - rhs );
4784 osres_ = declsym( lhs - rhs );
4785 refres_ = declsym( reflhs - refrhs );
4786 }
4787 catch( std::exception& ex ) {
4788 convertException<MT1,MT2>( ex );
4789 }
4790
4791 checkResults<MT1,MT2>();
4792
4793 try {
4794 initResults();
4795 dres_ = declsym( lhs - orhs );
4796 odres_ = declsym( lhs - orhs );
4797 sres_ = declsym( lhs - orhs );
4798 osres_ = declsym( lhs - orhs );
4799 refres_ = declsym( reflhs - refrhs );
4800 }
4801 catch( std::exception& ex ) {
4802 convertException<MT1,OMT2>( ex );
4803 }
4804
4805 checkResults<MT1,OMT2>();
4806
4807 try {
4808 initResults();
4809 dres_ = declsym( olhs - rhs );
4810 odres_ = declsym( olhs - rhs );
4811 sres_ = declsym( olhs - rhs );
4812 osres_ = declsym( olhs - rhs );
4813 refres_ = declsym( reflhs - refrhs );
4814 }
4815 catch( std::exception& ex ) {
4816 convertException<OMT1,MT2>( ex );
4817 }
4818
4819 checkResults<OMT1,MT2>();
4820
4821 try {
4822 initResults();
4823 dres_ = declsym( olhs - orhs );
4824 odres_ = declsym( olhs - orhs );
4825 sres_ = declsym( olhs - orhs );
4826 osres_ = declsym( olhs - orhs );
4827 refres_ = declsym( reflhs - refrhs );
4828 }
4829 catch( std::exception& ex ) {
4830 convertException<OMT1,OMT2>( ex );
4831 }
4832
4833 checkResults<OMT1,OMT2>();
4834 }
4835
4836 // Declsym subtraction with evaluated matrices
4837 {
4838 test_ = "Declsym subtraction with evaluated left-hand side matrix";
4839 error_ = "Failed subtraction operation";
4840
4841 try {
4842 initResults();
4843 dres_ = declsym( eval( lhs ) - eval( rhs ) );
4844 odres_ = declsym( eval( lhs ) - eval( rhs ) );
4845 sres_ = declsym( eval( lhs ) - eval( rhs ) );
4846 osres_ = declsym( eval( lhs ) - eval( rhs ) );
4847 refres_ = declsym( eval( reflhs ) - eval( refrhs ) );
4848 }
4849 catch( std::exception& ex ) {
4850 convertException<MT1,MT2>( ex );
4851 }
4852
4853 checkResults<MT1,MT2>();
4854
4855 try {
4856 initResults();
4857 dres_ = declsym( eval( lhs ) - eval( orhs ) );
4858 odres_ = declsym( eval( lhs ) - eval( orhs ) );
4859 sres_ = declsym( eval( lhs ) - eval( orhs ) );
4860 osres_ = declsym( eval( lhs ) - eval( orhs ) );
4861 refres_ = declsym( eval( reflhs ) - eval( refrhs ) );
4862 }
4863 catch( std::exception& ex ) {
4864 convertException<MT1,OMT2>( ex );
4865 }
4866
4867 checkResults<MT1,OMT2>();
4868
4869 try {
4870 initResults();
4871 dres_ = declsym( eval( olhs ) - eval( rhs ) );
4872 odres_ = declsym( eval( olhs ) - eval( rhs ) );
4873 sres_ = declsym( eval( olhs ) - eval( rhs ) );
4874 osres_ = declsym( eval( olhs ) - eval( rhs ) );
4875 refres_ = declsym( eval( reflhs ) - eval( refrhs ) );
4876 }
4877 catch( std::exception& ex ) {
4878 convertException<OMT1,MT2>( ex );
4879 }
4880
4881 checkResults<OMT1,MT2>();
4882
4883 try {
4884 initResults();
4885 dres_ = declsym( eval( olhs ) - eval( orhs ) );
4886 odres_ = declsym( eval( olhs ) - eval( orhs ) );
4887 sres_ = declsym( eval( olhs ) - eval( orhs ) );
4888 osres_ = declsym( eval( olhs ) - eval( orhs ) );
4889 refres_ = declsym( eval( reflhs ) - eval( refrhs ) );
4890 }
4891 catch( std::exception& ex ) {
4892 convertException<OMT1,OMT2>( ex );
4893 }
4894
4895 checkResults<OMT1,OMT2>();
4896 }
4897
4898
4899 //=====================================================================================
4900 // Declsym subtraction with addition assignment
4901 //=====================================================================================
4902
4903 // Declsym subtraction with addition assignment with the given matrices
4904 {
4905 test_ = "Declsym subtraction with addition assignment with the given matrices";
4906 error_ = "Failed addition assignment operation";
4907
4908 try {
4909 initResults();
4910 dres_ += declsym( lhs - rhs );
4911 odres_ += declsym( lhs - rhs );
4912 sres_ += declsym( lhs - rhs );
4913 osres_ += declsym( lhs - rhs );
4914 refres_ += declsym( reflhs - refrhs );
4915 }
4916 catch( std::exception& ex ) {
4917 convertException<MT1,MT2>( ex );
4918 }
4919
4920 checkResults<MT1,MT2>();
4921
4922 try {
4923 initResults();
4924 dres_ += declsym( lhs - orhs );
4925 odres_ += declsym( lhs - orhs );
4926 sres_ += declsym( lhs - orhs );
4927 osres_ += declsym( lhs - orhs );
4928 refres_ += declsym( reflhs - refrhs );
4929 }
4930 catch( std::exception& ex ) {
4931 convertException<MT1,OMT2>( ex );
4932 }
4933
4934 checkResults<MT1,OMT2>();
4935
4936 try {
4937 initResults();
4938 dres_ += declsym( olhs - rhs );
4939 odres_ += declsym( olhs - rhs );
4940 sres_ += declsym( olhs - rhs );
4941 osres_ += declsym( olhs - rhs );
4942 refres_ += declsym( reflhs - refrhs );
4943 }
4944 catch( std::exception& ex ) {
4945 convertException<OMT1,MT2>( ex );
4946 }
4947
4948 checkResults<OMT1,MT2>();
4949
4950 try {
4951 initResults();
4952 dres_ += declsym( olhs - orhs );
4953 odres_ += declsym( olhs - orhs );
4954 sres_ += declsym( olhs - orhs );
4955 osres_ += declsym( olhs - orhs );
4956 refres_ += declsym( reflhs - refrhs );
4957 }
4958 catch( std::exception& ex ) {
4959 convertException<OMT1,OMT2>( ex );
4960 }
4961
4962 checkResults<OMT1,OMT2>();
4963 }
4964
4965 // Declsym subtraction with addition assignment with evaluated matrices
4966 {
4967 test_ = "Declsym subtraction with addition assignment with evaluated matrices";
4968 error_ = "Failed addition assignment operation";
4969
4970 try {
4971 initResults();
4972 dres_ += declsym( eval( lhs ) - eval( rhs ) );
4973 odres_ += declsym( eval( lhs ) - eval( rhs ) );
4974 sres_ += declsym( eval( lhs ) - eval( rhs ) );
4975 osres_ += declsym( eval( lhs ) - eval( rhs ) );
4976 refres_ += declsym( eval( reflhs ) - eval( refrhs ) );
4977 }
4978 catch( std::exception& ex ) {
4979 convertException<MT1,MT2>( ex );
4980 }
4981
4982 checkResults<MT1,MT2>();
4983
4984 try {
4985 initResults();
4986 dres_ += declsym( eval( lhs ) - eval( orhs ) );
4987 odres_ += declsym( eval( lhs ) - eval( orhs ) );
4988 sres_ += declsym( eval( lhs ) - eval( orhs ) );
4989 osres_ += declsym( eval( lhs ) - eval( orhs ) );
4990 refres_ += declsym( eval( reflhs ) - eval( refrhs ) );
4991 }
4992 catch( std::exception& ex ) {
4993 convertException<MT1,OMT2>( ex );
4994 }
4995
4996 checkResults<MT1,OMT2>();
4997
4998 try {
4999 initResults();
5000 dres_ += declsym( eval( olhs ) - eval( rhs ) );
5001 odres_ += declsym( eval( olhs ) - eval( rhs ) );
5002 sres_ += declsym( eval( olhs ) - eval( rhs ) );
5003 osres_ += declsym( eval( olhs ) - eval( rhs ) );
5004 refres_ += declsym( eval( reflhs ) - eval( refrhs ) );
5005 }
5006 catch( std::exception& ex ) {
5007 convertException<OMT1,MT2>( ex );
5008 }
5009
5010 checkResults<OMT1,MT2>();
5011
5012 try {
5013 initResults();
5014 dres_ += declsym( eval( olhs ) - eval( orhs ) );
5015 odres_ += declsym( eval( olhs ) - eval( orhs ) );
5016 sres_ += declsym( eval( olhs ) - eval( orhs ) );
5017 osres_ += declsym( eval( olhs ) - eval( orhs ) );
5018 refres_ += declsym( eval( reflhs ) - eval( refrhs ) );
5019 }
5020 catch( std::exception& ex ) {
5021 convertException<OMT1,OMT2>( ex );
5022 }
5023
5024 checkResults<OMT1,OMT2>();
5025 }
5026
5027
5028 //=====================================================================================
5029 // Declsym subtraction with subtraction assignment
5030 //=====================================================================================
5031
5032 // Declsym subtraction with subtraction assignment with the given matrices
5033 {
5034 test_ = "Declsym subtraction with subtraction assignment with the given matrices";
5035 error_ = "Failed subtraction assignment operation";
5036
5037 try {
5038 initResults();
5039 dres_ -= declsym( lhs - rhs );
5040 odres_ -= declsym( lhs - rhs );
5041 sres_ -= declsym( lhs - rhs );
5042 osres_ -= declsym( lhs - rhs );
5043 refres_ -= declsym( reflhs - refrhs );
5044 }
5045 catch( std::exception& ex ) {
5046 convertException<MT1,MT2>( ex );
5047 }
5048
5049 checkResults<MT1,MT2>();
5050
5051 try {
5052 initResults();
5053 dres_ -= declsym( lhs - orhs );
5054 odres_ -= declsym( lhs - orhs );
5055 sres_ -= declsym( lhs - orhs );
5056 osres_ -= declsym( lhs - orhs );
5057 refres_ -= declsym( reflhs - refrhs );
5058 }
5059 catch( std::exception& ex ) {
5060 convertException<MT1,OMT2>( ex );
5061 }
5062
5063 checkResults<MT1,OMT2>();
5064
5065 try {
5066 initResults();
5067 dres_ -= declsym( olhs - rhs );
5068 odres_ -= declsym( olhs - rhs );
5069 sres_ -= declsym( olhs - rhs );
5070 osres_ -= declsym( olhs - rhs );
5071 refres_ -= declsym( reflhs - refrhs );
5072 }
5073 catch( std::exception& ex ) {
5074 convertException<OMT1,MT2>( ex );
5075 }
5076
5077 checkResults<OMT1,MT2>();
5078
5079 try {
5080 initResults();
5081 dres_ -= declsym( olhs - orhs );
5082 odres_ -= declsym( olhs - orhs );
5083 sres_ -= declsym( olhs - orhs );
5084 osres_ -= declsym( olhs - orhs );
5085 refres_ -= declsym( reflhs - refrhs );
5086 }
5087 catch( std::exception& ex ) {
5088 convertException<OMT1,OMT2>( ex );
5089 }
5090
5091 checkResults<OMT1,OMT2>();
5092 }
5093
5094 // Declsym subtraction with subtraction assignment with evaluated matrices
5095 {
5096 test_ = "Declsym subtraction with subtraction assignment with evaluated matrices";
5097 error_ = "Failed subtraction assignment operation";
5098
5099 try {
5100 initResults();
5101 dres_ -= declsym( eval( lhs ) - eval( rhs ) );
5102 odres_ -= declsym( eval( lhs ) - eval( rhs ) );
5103 sres_ -= declsym( eval( lhs ) - eval( rhs ) );
5104 osres_ -= declsym( eval( lhs ) - eval( rhs ) );
5105 refres_ -= declsym( eval( reflhs ) - eval( refrhs ) );
5106 }
5107 catch( std::exception& ex ) {
5108 convertException<MT1,MT2>( ex );
5109 }
5110
5111 checkResults<MT1,MT2>();
5112
5113 try {
5114 initResults();
5115 dres_ -= declsym( eval( lhs ) - eval( orhs ) );
5116 odres_ -= declsym( eval( lhs ) - eval( orhs ) );
5117 sres_ -= declsym( eval( lhs ) - eval( orhs ) );
5118 osres_ -= declsym( eval( lhs ) - eval( orhs ) );
5119 refres_ -= declsym( eval( reflhs ) - eval( refrhs ) );
5120 }
5121 catch( std::exception& ex ) {
5122 convertException<MT1,OMT2>( ex );
5123 }
5124
5125 checkResults<MT1,OMT2>();
5126
5127 try {
5128 initResults();
5129 dres_ -= declsym( eval( olhs ) - eval( rhs ) );
5130 odres_ -= declsym( eval( olhs ) - eval( rhs ) );
5131 sres_ -= declsym( eval( olhs ) - eval( rhs ) );
5132 osres_ -= declsym( eval( olhs ) - eval( rhs ) );
5133 refres_ -= declsym( eval( reflhs ) - eval( refrhs ) );
5134 }
5135 catch( std::exception& ex ) {
5136 convertException<OMT1,MT2>( ex );
5137 }
5138
5139 checkResults<OMT1,MT2>();
5140
5141 try {
5142 initResults();
5143 dres_ -= declsym( eval( olhs ) - eval( orhs ) );
5144 odres_ -= declsym( eval( olhs ) - eval( orhs ) );
5145 sres_ -= declsym( eval( olhs ) - eval( orhs ) );
5146 osres_ -= declsym( eval( olhs ) - eval( orhs ) );
5147 refres_ -= declsym( eval( reflhs ) - eval( refrhs ) );
5148 }
5149 catch( std::exception& ex ) {
5150 convertException<OMT1,OMT2>( ex );
5151 }
5152
5153 checkResults<OMT1,OMT2>();
5154 }
5155
5156
5157 //=====================================================================================
5158 // Declsym subtraction with Schur product assignment
5159 //=====================================================================================
5160
5161 // Declsym subtraction with Schur product assignment with the given matrices
5162 {
5163 test_ = "Declsym subtraction with Schur product assignment with the given matrices";
5164 error_ = "Failed Schur product assignment operation";
5165
5166 try {
5167 initResults();
5168 dres_ %= declsym( lhs - rhs );
5169 odres_ %= declsym( lhs - rhs );
5170 sres_ %= declsym( lhs - rhs );
5171 osres_ %= declsym( lhs - rhs );
5172 refres_ %= declsym( reflhs - refrhs );
5173 }
5174 catch( std::exception& ex ) {
5175 convertException<MT1,MT2>( ex );
5176 }
5177
5178 checkResults<MT1,MT2>();
5179
5180 try {
5181 initResults();
5182 dres_ %= declsym( lhs - orhs );
5183 odres_ %= declsym( lhs - orhs );
5184 sres_ %= declsym( lhs - orhs );
5185 osres_ %= declsym( lhs - orhs );
5186 refres_ %= declsym( reflhs - refrhs );
5187 }
5188 catch( std::exception& ex ) {
5189 convertException<MT1,OMT2>( ex );
5190 }
5191
5192 checkResults<MT1,OMT2>();
5193
5194 try {
5195 initResults();
5196 dres_ %= declsym( olhs - rhs );
5197 odres_ %= declsym( olhs - rhs );
5198 sres_ %= declsym( olhs - rhs );
5199 osres_ %= declsym( olhs - rhs );
5200 refres_ %= declsym( reflhs - refrhs );
5201 }
5202 catch( std::exception& ex ) {
5203 convertException<OMT1,MT2>( ex );
5204 }
5205
5206 checkResults<OMT1,MT2>();
5207
5208 try {
5209 initResults();
5210 dres_ %= declsym( olhs - orhs );
5211 odres_ %= declsym( olhs - orhs );
5212 sres_ %= declsym( olhs - orhs );
5213 osres_ %= declsym( olhs - orhs );
5214 refres_ %= declsym( reflhs - refrhs );
5215 }
5216 catch( std::exception& ex ) {
5217 convertException<OMT1,OMT2>( ex );
5218 }
5219
5220 checkResults<OMT1,OMT2>();
5221 }
5222
5223 // Declsym subtraction with Schur product assignment with evaluated matrices
5224 {
5225 test_ = "Declsym subtraction with Schur product assignment with evaluated matrices";
5226 error_ = "Failed Schur product assignment operation";
5227
5228 try {
5229 initResults();
5230 dres_ %= declsym( eval( lhs ) - eval( rhs ) );
5231 odres_ %= declsym( eval( lhs ) - eval( rhs ) );
5232 sres_ %= declsym( eval( lhs ) - eval( rhs ) );
5233 osres_ %= declsym( eval( lhs ) - eval( rhs ) );
5234 refres_ %= declsym( eval( reflhs ) - eval( refrhs ) );
5235 }
5236 catch( std::exception& ex ) {
5237 convertException<MT1,MT2>( ex );
5238 }
5239
5240 checkResults<MT1,MT2>();
5241
5242 try {
5243 initResults();
5244 dres_ %= declsym( eval( lhs ) - eval( orhs ) );
5245 odres_ %= declsym( eval( lhs ) - eval( orhs ) );
5246 sres_ %= declsym( eval( lhs ) - eval( orhs ) );
5247 osres_ %= declsym( eval( lhs ) - eval( orhs ) );
5248 refres_ %= declsym( eval( reflhs ) - eval( refrhs ) );
5249 }
5250 catch( std::exception& ex ) {
5251 convertException<MT1,OMT2>( ex );
5252 }
5253
5254 checkResults<MT1,OMT2>();
5255
5256 try {
5257 initResults();
5258 dres_ %= declsym( eval( olhs ) - eval( rhs ) );
5259 odres_ %= declsym( eval( olhs ) - eval( rhs ) );
5260 sres_ %= declsym( eval( olhs ) - eval( rhs ) );
5261 osres_ %= declsym( eval( olhs ) - eval( rhs ) );
5262 refres_ %= declsym( eval( reflhs ) - eval( refrhs ) );
5263 }
5264 catch( std::exception& ex ) {
5265 convertException<OMT1,MT2>( ex );
5266 }
5267
5268 checkResults<OMT1,MT2>();
5269
5270 try {
5271 initResults();
5272 dres_ %= declsym( eval( olhs ) - eval( orhs ) );
5273 odres_ %= declsym( eval( olhs ) - eval( orhs ) );
5274 sres_ %= declsym( eval( olhs ) - eval( orhs ) );
5275 osres_ %= declsym( eval( olhs ) - eval( orhs ) );
5276 refres_ %= declsym( eval( reflhs ) - eval( refrhs ) );
5277 }
5278 catch( std::exception& ex ) {
5279 convertException<OMT1,OMT2>( ex );
5280 }
5281
5282 checkResults<OMT1,OMT2>();
5283 }
5284 }
5285 #endif
5286 }
5287 //*************************************************************************************************
5288
5289
5290 //*************************************************************************************************
5291 /*!\brief Skipping the symmetric sparse matrix/sparse matrix subtraction.
5292 //
5293 // \return void
5294 //
5295 // This function is called in case the symmetric matrix/matrix subtraction operation is not
5296 // available for the given matrix types \a MT1 and \a MT2.
5297 */
5298 template< typename MT1 // Type of the left-hand side sparse matrix
5299 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclSymOperation(blaze::FalseType)5300 void OperationTest<MT1,MT2>::testDeclSymOperation( blaze::FalseType )
5301 {}
5302 //*************************************************************************************************
5303
5304
5305 //*************************************************************************************************
5306 /*!\brief Testing the Hermitian sparse matrix/sparse matrix subtraction.
5307 //
5308 // \return void
5309 // \exception std::runtime_error Subtraction error detected.
5310 //
5311 // This function tests the Hermitian matrix subtraction with plain assignment, addition assignment,
5312 // subtraction assignment, and Schur product assignment. In case any error resulting from the
5313 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
5314 // thrown.
5315 */
5316 template< typename MT1 // Type of the left-hand side sparse matrix
5317 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclHermOperation(blaze::TrueType)5318 void OperationTest<MT1,MT2>::testDeclHermOperation( blaze::TrueType )
5319 {
5320 #if BLAZETEST_MATHTEST_TEST_DECLHERM_OPERATION
5321 if( BLAZETEST_MATHTEST_TEST_DECLHERM_OPERATION > 1 )
5322 {
5323 if( ( !blaze::IsDiagonal<MT1>::value && blaze::IsTriangular<MT1>::value ) ||
5324 ( !blaze::IsDiagonal<MT2>::value && blaze::IsTriangular<MT2>::value ) ||
5325 ( !blaze::IsDiagonal<MT1>::value && blaze::IsSymmetric<MT1>::value && blaze::IsComplex<ET1>::value ) ||
5326 ( !blaze::IsDiagonal<MT2>::value && blaze::IsSymmetric<MT2>::value && blaze::IsComplex<ET2>::value ) ||
5327 ( lhs_.rows() != lhs_.columns() ) )
5328 return;
5329
5330
5331 //=====================================================================================
5332 // Test-specific setup of the left-hand side operand
5333 //=====================================================================================
5334
5335 MT1 lhs ( lhs_ * ctrans( lhs_ ) );
5336 OMT1 olhs ( lhs );
5337 RT1 reflhs( lhs );
5338
5339
5340 //=====================================================================================
5341 // Test-specific setup of the right-hand side operand
5342 //=====================================================================================
5343
5344 MT2 rhs ( rhs_ * ctrans( rhs_ ) );
5345 OMT2 orhs ( rhs );
5346 RT2 refrhs( rhs );
5347
5348
5349 //=====================================================================================
5350 // Declherm subtraction
5351 //=====================================================================================
5352
5353 // Declherm subtraction with the given matrices
5354 {
5355 test_ = "Declherm subtraction with the given matrices";
5356 error_ = "Failed subtraction operation";
5357
5358 try {
5359 initResults();
5360 dres_ = declherm( lhs - rhs );
5361 odres_ = declherm( lhs - rhs );
5362 sres_ = declherm( lhs - rhs );
5363 osres_ = declherm( lhs - rhs );
5364 refres_ = declherm( reflhs - refrhs );
5365 }
5366 catch( std::exception& ex ) {
5367 convertException<MT1,MT2>( ex );
5368 }
5369
5370 checkResults<MT1,MT2>();
5371
5372 try {
5373 initResults();
5374 dres_ = declherm( lhs - orhs );
5375 odres_ = declherm( lhs - orhs );
5376 sres_ = declherm( lhs - orhs );
5377 osres_ = declherm( lhs - orhs );
5378 refres_ = declherm( reflhs - refrhs );
5379 }
5380 catch( std::exception& ex ) {
5381 convertException<MT1,OMT2>( ex );
5382 }
5383
5384 checkResults<MT1,OMT2>();
5385
5386 try {
5387 initResults();
5388 dres_ = declherm( olhs - rhs );
5389 odres_ = declherm( olhs - rhs );
5390 sres_ = declherm( olhs - rhs );
5391 osres_ = declherm( olhs - rhs );
5392 refres_ = declherm( reflhs - refrhs );
5393 }
5394 catch( std::exception& ex ) {
5395 convertException<OMT1,MT2>( ex );
5396 }
5397
5398 checkResults<OMT1,MT2>();
5399
5400 try {
5401 initResults();
5402 dres_ = declherm( olhs - orhs );
5403 odres_ = declherm( olhs - orhs );
5404 sres_ = declherm( olhs - orhs );
5405 osres_ = declherm( olhs - orhs );
5406 refres_ = declherm( reflhs - refrhs );
5407 }
5408 catch( std::exception& ex ) {
5409 convertException<OMT1,OMT2>( ex );
5410 }
5411
5412 checkResults<OMT1,OMT2>();
5413 }
5414
5415 // Declherm subtraction with evaluated matrices
5416 {
5417 test_ = "Declherm subtraction with evaluated left-hand side matrix";
5418 error_ = "Failed subtraction operation";
5419
5420 try {
5421 initResults();
5422 dres_ = declherm( eval( lhs ) - eval( rhs ) );
5423 odres_ = declherm( eval( lhs ) - eval( rhs ) );
5424 sres_ = declherm( eval( lhs ) - eval( rhs ) );
5425 osres_ = declherm( eval( lhs ) - eval( rhs ) );
5426 refres_ = declherm( eval( reflhs ) - eval( refrhs ) );
5427 }
5428 catch( std::exception& ex ) {
5429 convertException<MT1,MT2>( ex );
5430 }
5431
5432 checkResults<MT1,MT2>();
5433
5434 try {
5435 initResults();
5436 dres_ = declherm( eval( lhs ) - eval( orhs ) );
5437 odres_ = declherm( eval( lhs ) - eval( orhs ) );
5438 sres_ = declherm( eval( lhs ) - eval( orhs ) );
5439 osres_ = declherm( eval( lhs ) - eval( orhs ) );
5440 refres_ = declherm( eval( reflhs ) - eval( refrhs ) );
5441 }
5442 catch( std::exception& ex ) {
5443 convertException<MT1,OMT2>( ex );
5444 }
5445
5446 checkResults<MT1,OMT2>();
5447
5448 try {
5449 initResults();
5450 dres_ = declherm( eval( olhs ) - eval( rhs ) );
5451 odres_ = declherm( eval( olhs ) - eval( rhs ) );
5452 sres_ = declherm( eval( olhs ) - eval( rhs ) );
5453 osres_ = declherm( eval( olhs ) - eval( rhs ) );
5454 refres_ = declherm( eval( reflhs ) - eval( refrhs ) );
5455 }
5456 catch( std::exception& ex ) {
5457 convertException<OMT1,MT2>( ex );
5458 }
5459
5460 checkResults<OMT1,MT2>();
5461
5462 try {
5463 initResults();
5464 dres_ = declherm( eval( olhs ) - eval( orhs ) );
5465 odres_ = declherm( eval( olhs ) - eval( orhs ) );
5466 sres_ = declherm( eval( olhs ) - eval( orhs ) );
5467 osres_ = declherm( eval( olhs ) - eval( orhs ) );
5468 refres_ = declherm( eval( reflhs ) - eval( refrhs ) );
5469 }
5470 catch( std::exception& ex ) {
5471 convertException<OMT1,OMT2>( ex );
5472 }
5473
5474 checkResults<OMT1,OMT2>();
5475 }
5476
5477
5478 //=====================================================================================
5479 // Declherm subtraction with addition assignment
5480 //=====================================================================================
5481
5482 // Declherm subtraction with addition assignment with the given matrices
5483 {
5484 test_ = "Declherm subtraction with addition assignment with the given matrices";
5485 error_ = "Failed addition assignment operation";
5486
5487 try {
5488 initResults();
5489 dres_ += declherm( lhs - rhs );
5490 odres_ += declherm( lhs - rhs );
5491 sres_ += declherm( lhs - rhs );
5492 osres_ += declherm( lhs - rhs );
5493 refres_ += declherm( reflhs - refrhs );
5494 }
5495 catch( std::exception& ex ) {
5496 convertException<MT1,MT2>( ex );
5497 }
5498
5499 checkResults<MT1,MT2>();
5500
5501 try {
5502 initResults();
5503 dres_ += declherm( lhs - orhs );
5504 odres_ += declherm( lhs - orhs );
5505 sres_ += declherm( lhs - orhs );
5506 osres_ += declherm( lhs - orhs );
5507 refres_ += declherm( reflhs - refrhs );
5508 }
5509 catch( std::exception& ex ) {
5510 convertException<MT1,OMT2>( ex );
5511 }
5512
5513 checkResults<MT1,OMT2>();
5514
5515 try {
5516 initResults();
5517 dres_ += declherm( olhs - rhs );
5518 odres_ += declherm( olhs - rhs );
5519 sres_ += declherm( olhs - rhs );
5520 osres_ += declherm( olhs - rhs );
5521 refres_ += declherm( reflhs - refrhs );
5522 }
5523 catch( std::exception& ex ) {
5524 convertException<OMT1,MT2>( ex );
5525 }
5526
5527 checkResults<OMT1,MT2>();
5528
5529 try {
5530 initResults();
5531 dres_ += declherm( olhs - orhs );
5532 odres_ += declherm( olhs - orhs );
5533 sres_ += declherm( olhs - orhs );
5534 osres_ += declherm( olhs - orhs );
5535 refres_ += declherm( reflhs - refrhs );
5536 }
5537 catch( std::exception& ex ) {
5538 convertException<OMT1,OMT2>( ex );
5539 }
5540
5541 checkResults<OMT1,OMT2>();
5542 }
5543
5544 // Declherm subtraction with addition assignment with evaluated matrices
5545 {
5546 test_ = "Declherm subtraction with addition assignment with evaluated matrices";
5547 error_ = "Failed addition assignment operation";
5548
5549 try {
5550 initResults();
5551 dres_ += declherm( eval( lhs ) - eval( rhs ) );
5552 odres_ += declherm( eval( lhs ) - eval( rhs ) );
5553 sres_ += declherm( eval( lhs ) - eval( rhs ) );
5554 osres_ += declherm( eval( lhs ) - eval( rhs ) );
5555 refres_ += declherm( eval( reflhs ) - eval( refrhs ) );
5556 }
5557 catch( std::exception& ex ) {
5558 convertException<MT1,MT2>( ex );
5559 }
5560
5561 checkResults<MT1,MT2>();
5562
5563 try {
5564 initResults();
5565 dres_ += declherm( eval( lhs ) - eval( orhs ) );
5566 odres_ += declherm( eval( lhs ) - eval( orhs ) );
5567 sres_ += declherm( eval( lhs ) - eval( orhs ) );
5568 osres_ += declherm( eval( lhs ) - eval( orhs ) );
5569 refres_ += declherm( eval( reflhs ) - eval( refrhs ) );
5570 }
5571 catch( std::exception& ex ) {
5572 convertException<MT1,OMT2>( ex );
5573 }
5574
5575 checkResults<MT1,OMT2>();
5576
5577 try {
5578 initResults();
5579 dres_ += declherm( eval( olhs ) - eval( rhs ) );
5580 odres_ += declherm( eval( olhs ) - eval( rhs ) );
5581 sres_ += declherm( eval( olhs ) - eval( rhs ) );
5582 osres_ += declherm( eval( olhs ) - eval( rhs ) );
5583 refres_ += declherm( eval( reflhs ) - eval( refrhs ) );
5584 }
5585 catch( std::exception& ex ) {
5586 convertException<OMT1,MT2>( ex );
5587 }
5588
5589 checkResults<OMT1,MT2>();
5590
5591 try {
5592 initResults();
5593 dres_ += declherm( eval( olhs ) - eval( orhs ) );
5594 odres_ += declherm( eval( olhs ) - eval( orhs ) );
5595 sres_ += declherm( eval( olhs ) - eval( orhs ) );
5596 osres_ += declherm( eval( olhs ) - eval( orhs ) );
5597 refres_ += declherm( eval( reflhs ) - eval( refrhs ) );
5598 }
5599 catch( std::exception& ex ) {
5600 convertException<OMT1,OMT2>( ex );
5601 }
5602
5603 checkResults<OMT1,OMT2>();
5604 }
5605
5606
5607 //=====================================================================================
5608 // Declherm subtraction with subtraction assignment
5609 //=====================================================================================
5610
5611 // Declherm subtraction with subtraction assignment with the given matrices
5612 {
5613 test_ = "Declherm subtraction with subtraction assignment with the given matrices";
5614 error_ = "Failed subtraction assignment operation";
5615
5616 try {
5617 initResults();
5618 dres_ -= declherm( lhs - rhs );
5619 odres_ -= declherm( lhs - rhs );
5620 sres_ -= declherm( lhs - rhs );
5621 osres_ -= declherm( lhs - rhs );
5622 refres_ -= declherm( reflhs - refrhs );
5623 }
5624 catch( std::exception& ex ) {
5625 convertException<MT1,MT2>( ex );
5626 }
5627
5628 checkResults<MT1,MT2>();
5629
5630 try {
5631 initResults();
5632 dres_ -= declherm( lhs - orhs );
5633 odres_ -= declherm( lhs - orhs );
5634 sres_ -= declherm( lhs - orhs );
5635 osres_ -= declherm( lhs - orhs );
5636 refres_ -= declherm( reflhs - refrhs );
5637 }
5638 catch( std::exception& ex ) {
5639 convertException<MT1,OMT2>( ex );
5640 }
5641
5642 checkResults<MT1,OMT2>();
5643
5644 try {
5645 initResults();
5646 dres_ -= declherm( olhs - rhs );
5647 odres_ -= declherm( olhs - rhs );
5648 sres_ -= declherm( olhs - rhs );
5649 osres_ -= declherm( olhs - rhs );
5650 refres_ -= declherm( reflhs - refrhs );
5651 }
5652 catch( std::exception& ex ) {
5653 convertException<OMT1,MT2>( ex );
5654 }
5655
5656 checkResults<OMT1,MT2>();
5657
5658 try {
5659 initResults();
5660 dres_ -= declherm( olhs - orhs );
5661 odres_ -= declherm( olhs - orhs );
5662 sres_ -= declherm( olhs - orhs );
5663 osres_ -= declherm( olhs - orhs );
5664 refres_ -= declherm( reflhs - refrhs );
5665 }
5666 catch( std::exception& ex ) {
5667 convertException<OMT1,OMT2>( ex );
5668 }
5669
5670 checkResults<OMT1,OMT2>();
5671 }
5672
5673 // Declherm subtraction with subtraction assignment with evaluated matrices
5674 {
5675 test_ = "Declherm subtraction with subtraction assignment with evaluated matrices";
5676 error_ = "Failed subtraction assignment operation";
5677
5678 try {
5679 initResults();
5680 dres_ -= declherm( eval( lhs ) - eval( rhs ) );
5681 odres_ -= declherm( eval( lhs ) - eval( rhs ) );
5682 sres_ -= declherm( eval( lhs ) - eval( rhs ) );
5683 osres_ -= declherm( eval( lhs ) - eval( rhs ) );
5684 refres_ -= declherm( eval( reflhs ) - eval( refrhs ) );
5685 }
5686 catch( std::exception& ex ) {
5687 convertException<MT1,MT2>( ex );
5688 }
5689
5690 checkResults<MT1,MT2>();
5691
5692 try {
5693 initResults();
5694 dres_ -= declherm( eval( lhs ) - eval( orhs ) );
5695 odres_ -= declherm( eval( lhs ) - eval( orhs ) );
5696 sres_ -= declherm( eval( lhs ) - eval( orhs ) );
5697 osres_ -= declherm( eval( lhs ) - eval( orhs ) );
5698 refres_ -= declherm( eval( reflhs ) - eval( refrhs ) );
5699 }
5700 catch( std::exception& ex ) {
5701 convertException<MT1,OMT2>( ex );
5702 }
5703
5704 checkResults<MT1,OMT2>();
5705
5706 try {
5707 initResults();
5708 dres_ -= declherm( eval( olhs ) - eval( rhs ) );
5709 odres_ -= declherm( eval( olhs ) - eval( rhs ) );
5710 sres_ -= declherm( eval( olhs ) - eval( rhs ) );
5711 osres_ -= declherm( eval( olhs ) - eval( rhs ) );
5712 refres_ -= declherm( eval( reflhs ) - eval( refrhs ) );
5713 }
5714 catch( std::exception& ex ) {
5715 convertException<OMT1,MT2>( ex );
5716 }
5717
5718 checkResults<OMT1,MT2>();
5719
5720 try {
5721 initResults();
5722 dres_ -= declherm( eval( olhs ) - eval( orhs ) );
5723 odres_ -= declherm( eval( olhs ) - eval( orhs ) );
5724 sres_ -= declherm( eval( olhs ) - eval( orhs ) );
5725 osres_ -= declherm( eval( olhs ) - eval( orhs ) );
5726 refres_ -= declherm( eval( reflhs ) - eval( refrhs ) );
5727 }
5728 catch( std::exception& ex ) {
5729 convertException<OMT1,OMT2>( ex );
5730 }
5731
5732 checkResults<OMT1,OMT2>();
5733 }
5734
5735
5736 //=====================================================================================
5737 // Declherm subtraction with Schur product assignment
5738 //=====================================================================================
5739
5740 // Declherm subtraction with Schur product assignment with the given matrices
5741 {
5742 test_ = "Declherm subtraction with Schur product assignment with the given matrices";
5743 error_ = "Failed Schur product assignment operation";
5744
5745 try {
5746 initResults();
5747 dres_ %= declherm( lhs - rhs );
5748 odres_ %= declherm( lhs - rhs );
5749 sres_ %= declherm( lhs - rhs );
5750 osres_ %= declherm( lhs - rhs );
5751 refres_ %= declherm( reflhs - refrhs );
5752 }
5753 catch( std::exception& ex ) {
5754 convertException<MT1,MT2>( ex );
5755 }
5756
5757 checkResults<MT1,MT2>();
5758
5759 try {
5760 initResults();
5761 dres_ %= declherm( lhs - orhs );
5762 odres_ %= declherm( lhs - orhs );
5763 sres_ %= declherm( lhs - orhs );
5764 osres_ %= declherm( lhs - orhs );
5765 refres_ %= declherm( reflhs - refrhs );
5766 }
5767 catch( std::exception& ex ) {
5768 convertException<MT1,OMT2>( ex );
5769 }
5770
5771 checkResults<MT1,OMT2>();
5772
5773 try {
5774 initResults();
5775 dres_ %= declherm( olhs - rhs );
5776 odres_ %= declherm( olhs - rhs );
5777 sres_ %= declherm( olhs - rhs );
5778 osres_ %= declherm( olhs - rhs );
5779 refres_ %= declherm( reflhs - refrhs );
5780 }
5781 catch( std::exception& ex ) {
5782 convertException<OMT1,MT2>( ex );
5783 }
5784
5785 checkResults<OMT1,MT2>();
5786
5787 try {
5788 initResults();
5789 dres_ %= declherm( olhs - orhs );
5790 odres_ %= declherm( olhs - orhs );
5791 sres_ %= declherm( olhs - orhs );
5792 osres_ %= declherm( olhs - orhs );
5793 refres_ %= declherm( reflhs - refrhs );
5794 }
5795 catch( std::exception& ex ) {
5796 convertException<OMT1,OMT2>( ex );
5797 }
5798
5799 checkResults<OMT1,OMT2>();
5800 }
5801
5802 // Declherm subtraction with Schur product assignment with evaluated matrices
5803 {
5804 test_ = "Declherm subtraction with Schur product assignment with evaluated matrices";
5805 error_ = "Failed Schur product assignment operation";
5806
5807 try {
5808 initResults();
5809 dres_ %= declherm( eval( lhs ) - eval( rhs ) );
5810 odres_ %= declherm( eval( lhs ) - eval( rhs ) );
5811 sres_ %= declherm( eval( lhs ) - eval( rhs ) );
5812 osres_ %= declherm( eval( lhs ) - eval( rhs ) );
5813 refres_ %= declherm( eval( reflhs ) - eval( refrhs ) );
5814 }
5815 catch( std::exception& ex ) {
5816 convertException<MT1,MT2>( ex );
5817 }
5818
5819 checkResults<MT1,MT2>();
5820
5821 try {
5822 initResults();
5823 dres_ %= declherm( eval( lhs ) - eval( orhs ) );
5824 odres_ %= declherm( eval( lhs ) - eval( orhs ) );
5825 sres_ %= declherm( eval( lhs ) - eval( orhs ) );
5826 osres_ %= declherm( eval( lhs ) - eval( orhs ) );
5827 refres_ %= declherm( eval( reflhs ) - eval( refrhs ) );
5828 }
5829 catch( std::exception& ex ) {
5830 convertException<MT1,OMT2>( ex );
5831 }
5832
5833 checkResults<MT1,OMT2>();
5834
5835 try {
5836 initResults();
5837 dres_ %= declherm( eval( olhs ) - eval( rhs ) );
5838 odres_ %= declherm( eval( olhs ) - eval( rhs ) );
5839 sres_ %= declherm( eval( olhs ) - eval( rhs ) );
5840 osres_ %= declherm( eval( olhs ) - eval( rhs ) );
5841 refres_ %= declherm( eval( reflhs ) - eval( refrhs ) );
5842 }
5843 catch( std::exception& ex ) {
5844 convertException<OMT1,MT2>( ex );
5845 }
5846
5847 checkResults<OMT1,MT2>();
5848
5849 try {
5850 initResults();
5851 dres_ %= declherm( eval( olhs ) - eval( orhs ) );
5852 odres_ %= declherm( eval( olhs ) - eval( orhs ) );
5853 sres_ %= declherm( eval( olhs ) - eval( orhs ) );
5854 osres_ %= declherm( eval( olhs ) - eval( orhs ) );
5855 refres_ %= declherm( eval( reflhs ) - eval( refrhs ) );
5856 }
5857 catch( std::exception& ex ) {
5858 convertException<OMT1,OMT2>( ex );
5859 }
5860
5861 checkResults<OMT1,OMT2>();
5862 }
5863 }
5864 #endif
5865 }
5866 //*************************************************************************************************
5867
5868
5869 //*************************************************************************************************
5870 /*!\brief Skipping the Hermitian sparse matrix/sparse matrix subtraction.
5871 //
5872 // \return void
5873 //
5874 // This function is called in case the Hermitian matrix/matrix subtraction operation is not
5875 // available for the given matrix types \a MT1 and \a MT2.
5876 */
5877 template< typename MT1 // Type of the left-hand side sparse matrix
5878 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclHermOperation(blaze::FalseType)5879 void OperationTest<MT1,MT2>::testDeclHermOperation( blaze::FalseType )
5880 {}
5881 //*************************************************************************************************
5882
5883
5884 //*************************************************************************************************
5885 /*!\brief Testing the lower sparse matrix/sparse matrix subtraction.
5886 //
5887 // \return void
5888 // \exception std::runtime_error Subtraction error detected.
5889 //
5890 // This function tests the lower matrix subtraction with plain assignment, addition assignment,
5891 // subtraction assignment, and Schur product assignment. In case any error resulting from the
5892 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
5893 // thrown.
5894 */
5895 template< typename MT1 // Type of the left-hand side sparse matrix
5896 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclLowOperation(blaze::TrueType)5897 void OperationTest<MT1,MT2>::testDeclLowOperation( blaze::TrueType )
5898 {
5899 #if BLAZETEST_MATHTEST_TEST_DECLLOW_OPERATION
5900 if( BLAZETEST_MATHTEST_TEST_DECLLOW_OPERATION > 1 )
5901 {
5902 if( lhs_.rows() != lhs_.columns() )
5903 return;
5904
5905
5906 //=====================================================================================
5907 // Test-specific setup of the left-hand side operand
5908 //=====================================================================================
5909
5910 MT1 lhs( lhs_ );
5911
5912 blaze::resetUpper( lhs );
5913
5914 OMT1 olhs ( lhs );
5915 RT1 reflhs( lhs );
5916
5917
5918 //=====================================================================================
5919 // Test-specific setup of the right-hand side operand
5920 //=====================================================================================
5921
5922 MT2 rhs( rhs_ );
5923
5924 blaze::resetUpper( rhs );
5925
5926 OMT2 orhs ( rhs );
5927 RT2 refrhs( rhs );
5928
5929
5930 //=====================================================================================
5931 // Decllow subtraction
5932 //=====================================================================================
5933
5934 // Decllow subtraction with the given matrices
5935 {
5936 test_ = "Decllow subtraction with the given matrices";
5937 error_ = "Failed subtraction operation";
5938
5939 try {
5940 initResults();
5941 dres_ = decllow( lhs - rhs );
5942 odres_ = decllow( lhs - rhs );
5943 sres_ = decllow( lhs - rhs );
5944 osres_ = decllow( lhs - rhs );
5945 refres_ = decllow( reflhs - refrhs );
5946 }
5947 catch( std::exception& ex ) {
5948 convertException<MT1,MT2>( ex );
5949 }
5950
5951 checkResults<MT1,MT2>();
5952
5953 try {
5954 initResults();
5955 dres_ = decllow( lhs - orhs );
5956 odres_ = decllow( lhs - orhs );
5957 sres_ = decllow( lhs - orhs );
5958 osres_ = decllow( lhs - orhs );
5959 refres_ = decllow( reflhs - refrhs );
5960 }
5961 catch( std::exception& ex ) {
5962 convertException<MT1,OMT2>( ex );
5963 }
5964
5965 checkResults<MT1,OMT2>();
5966
5967 try {
5968 initResults();
5969 dres_ = decllow( olhs - rhs );
5970 odres_ = decllow( olhs - rhs );
5971 sres_ = decllow( olhs - rhs );
5972 osres_ = decllow( olhs - rhs );
5973 refres_ = decllow( reflhs - refrhs );
5974 }
5975 catch( std::exception& ex ) {
5976 convertException<OMT1,MT2>( ex );
5977 }
5978
5979 checkResults<OMT1,MT2>();
5980
5981 try {
5982 initResults();
5983 dres_ = decllow( olhs - orhs );
5984 odres_ = decllow( olhs - orhs );
5985 sres_ = decllow( olhs - orhs );
5986 osres_ = decllow( olhs - orhs );
5987 refres_ = decllow( reflhs - refrhs );
5988 }
5989 catch( std::exception& ex ) {
5990 convertException<OMT1,OMT2>( ex );
5991 }
5992
5993 checkResults<OMT1,OMT2>();
5994 }
5995
5996 // Decllow subtraction with evaluated matrices
5997 {
5998 test_ = "Decllow subtraction with evaluated left-hand side matrix";
5999 error_ = "Failed subtraction operation";
6000
6001 try {
6002 initResults();
6003 dres_ = decllow( eval( lhs ) - eval( rhs ) );
6004 odres_ = decllow( eval( lhs ) - eval( rhs ) );
6005 sres_ = decllow( eval( lhs ) - eval( rhs ) );
6006 osres_ = decllow( eval( lhs ) - eval( rhs ) );
6007 refres_ = decllow( eval( reflhs ) - eval( refrhs ) );
6008 }
6009 catch( std::exception& ex ) {
6010 convertException<MT1,MT2>( ex );
6011 }
6012
6013 checkResults<MT1,MT2>();
6014
6015 try {
6016 initResults();
6017 dres_ = decllow( eval( lhs ) - eval( orhs ) );
6018 odres_ = decllow( eval( lhs ) - eval( orhs ) );
6019 sres_ = decllow( eval( lhs ) - eval( orhs ) );
6020 osres_ = decllow( eval( lhs ) - eval( orhs ) );
6021 refres_ = decllow( eval( reflhs ) - eval( refrhs ) );
6022 }
6023 catch( std::exception& ex ) {
6024 convertException<MT1,OMT2>( ex );
6025 }
6026
6027 checkResults<MT1,OMT2>();
6028
6029 try {
6030 initResults();
6031 dres_ = decllow( eval( olhs ) - eval( rhs ) );
6032 odres_ = decllow( eval( olhs ) - eval( rhs ) );
6033 sres_ = decllow( eval( olhs ) - eval( rhs ) );
6034 osres_ = decllow( eval( olhs ) - eval( rhs ) );
6035 refres_ = decllow( eval( reflhs ) - eval( refrhs ) );
6036 }
6037 catch( std::exception& ex ) {
6038 convertException<OMT1,MT2>( ex );
6039 }
6040
6041 checkResults<OMT1,MT2>();
6042
6043 try {
6044 initResults();
6045 dres_ = decllow( eval( olhs ) - eval( orhs ) );
6046 odres_ = decllow( eval( olhs ) - eval( orhs ) );
6047 sres_ = decllow( eval( olhs ) - eval( orhs ) );
6048 osres_ = decllow( eval( olhs ) - eval( orhs ) );
6049 refres_ = decllow( eval( reflhs ) - eval( refrhs ) );
6050 }
6051 catch( std::exception& ex ) {
6052 convertException<OMT1,OMT2>( ex );
6053 }
6054
6055 checkResults<OMT1,OMT2>();
6056 }
6057
6058
6059 //=====================================================================================
6060 // Decllow subtraction with addition assignment
6061 //=====================================================================================
6062
6063 // Decllow subtraction with addition assignment with the given matrices
6064 {
6065 test_ = "Decllow subtraction with addition assignment with the given matrices";
6066 error_ = "Failed addition assignment operation";
6067
6068 try {
6069 initResults();
6070 dres_ += decllow( lhs - rhs );
6071 odres_ += decllow( lhs - rhs );
6072 sres_ += decllow( lhs - rhs );
6073 osres_ += decllow( lhs - rhs );
6074 refres_ += decllow( reflhs - refrhs );
6075 }
6076 catch( std::exception& ex ) {
6077 convertException<MT1,MT2>( ex );
6078 }
6079
6080 checkResults<MT1,MT2>();
6081
6082 try {
6083 initResults();
6084 dres_ += decllow( lhs - orhs );
6085 odres_ += decllow( lhs - orhs );
6086 sres_ += decllow( lhs - orhs );
6087 osres_ += decllow( lhs - orhs );
6088 refres_ += decllow( reflhs - refrhs );
6089 }
6090 catch( std::exception& ex ) {
6091 convertException<MT1,OMT2>( ex );
6092 }
6093
6094 checkResults<MT1,OMT2>();
6095
6096 try {
6097 initResults();
6098 dres_ += decllow( olhs - rhs );
6099 odres_ += decllow( olhs - rhs );
6100 sres_ += decllow( olhs - rhs );
6101 osres_ += decllow( olhs - rhs );
6102 refres_ += decllow( reflhs - refrhs );
6103 }
6104 catch( std::exception& ex ) {
6105 convertException<OMT1,MT2>( ex );
6106 }
6107
6108 checkResults<OMT1,MT2>();
6109
6110 try {
6111 initResults();
6112 dres_ += decllow( olhs - orhs );
6113 odres_ += decllow( olhs - orhs );
6114 sres_ += decllow( olhs - orhs );
6115 osres_ += decllow( olhs - orhs );
6116 refres_ += decllow( reflhs - refrhs );
6117 }
6118 catch( std::exception& ex ) {
6119 convertException<OMT1,OMT2>( ex );
6120 }
6121
6122 checkResults<OMT1,OMT2>();
6123 }
6124
6125 // Decllow subtraction with addition assignment with evaluated matrices
6126 {
6127 test_ = "Decllow subtraction with addition assignment with evaluated matrices";
6128 error_ = "Failed addition assignment operation";
6129
6130 try {
6131 initResults();
6132 dres_ += decllow( eval( lhs ) - eval( rhs ) );
6133 odres_ += decllow( eval( lhs ) - eval( rhs ) );
6134 sres_ += decllow( eval( lhs ) - eval( rhs ) );
6135 osres_ += decllow( eval( lhs ) - eval( rhs ) );
6136 refres_ += decllow( eval( reflhs ) - eval( refrhs ) );
6137 }
6138 catch( std::exception& ex ) {
6139 convertException<MT1,MT2>( ex );
6140 }
6141
6142 checkResults<MT1,MT2>();
6143
6144 try {
6145 initResults();
6146 dres_ += decllow( eval( lhs ) - eval( orhs ) );
6147 odres_ += decllow( eval( lhs ) - eval( orhs ) );
6148 sres_ += decllow( eval( lhs ) - eval( orhs ) );
6149 osres_ += decllow( eval( lhs ) - eval( orhs ) );
6150 refres_ += decllow( eval( reflhs ) - eval( refrhs ) );
6151 }
6152 catch( std::exception& ex ) {
6153 convertException<MT1,OMT2>( ex );
6154 }
6155
6156 checkResults<MT1,OMT2>();
6157
6158 try {
6159 initResults();
6160 dres_ += decllow( eval( olhs ) - eval( rhs ) );
6161 odres_ += decllow( eval( olhs ) - eval( rhs ) );
6162 sres_ += decllow( eval( olhs ) - eval( rhs ) );
6163 osres_ += decllow( eval( olhs ) - eval( rhs ) );
6164 refres_ += decllow( eval( reflhs ) - eval( refrhs ) );
6165 }
6166 catch( std::exception& ex ) {
6167 convertException<OMT1,MT2>( ex );
6168 }
6169
6170 checkResults<OMT1,MT2>();
6171
6172 try {
6173 initResults();
6174 dres_ += decllow( eval( olhs ) - eval( orhs ) );
6175 odres_ += decllow( eval( olhs ) - eval( orhs ) );
6176 sres_ += decllow( eval( olhs ) - eval( orhs ) );
6177 osres_ += decllow( eval( olhs ) - eval( orhs ) );
6178 refres_ += decllow( eval( reflhs ) - eval( refrhs ) );
6179 }
6180 catch( std::exception& ex ) {
6181 convertException<OMT1,OMT2>( ex );
6182 }
6183
6184 checkResults<OMT1,OMT2>();
6185 }
6186
6187
6188 //=====================================================================================
6189 // Decllow subtraction with subtraction assignment
6190 //=====================================================================================
6191
6192 // Decllow subtraction with subtraction assignment with the given matrices
6193 {
6194 test_ = "Decllow subtraction with subtraction assignment with the given matrices";
6195 error_ = "Failed subtraction assignment operation";
6196
6197 try {
6198 initResults();
6199 dres_ -= decllow( lhs - rhs );
6200 odres_ -= decllow( lhs - rhs );
6201 sres_ -= decllow( lhs - rhs );
6202 osres_ -= decllow( lhs - rhs );
6203 refres_ -= decllow( reflhs - refrhs );
6204 }
6205 catch( std::exception& ex ) {
6206 convertException<MT1,MT2>( ex );
6207 }
6208
6209 checkResults<MT1,MT2>();
6210
6211 try {
6212 initResults();
6213 dres_ -= decllow( lhs - orhs );
6214 odres_ -= decllow( lhs - orhs );
6215 sres_ -= decllow( lhs - orhs );
6216 osres_ -= decllow( lhs - orhs );
6217 refres_ -= decllow( reflhs - refrhs );
6218 }
6219 catch( std::exception& ex ) {
6220 convertException<MT1,OMT2>( ex );
6221 }
6222
6223 checkResults<MT1,OMT2>();
6224
6225 try {
6226 initResults();
6227 dres_ -= decllow( olhs - rhs );
6228 odres_ -= decllow( olhs - rhs );
6229 sres_ -= decllow( olhs - rhs );
6230 osres_ -= decllow( olhs - rhs );
6231 refres_ -= decllow( reflhs - refrhs );
6232 }
6233 catch( std::exception& ex ) {
6234 convertException<OMT1,MT2>( ex );
6235 }
6236
6237 checkResults<OMT1,MT2>();
6238
6239 try {
6240 initResults();
6241 dres_ -= decllow( olhs - orhs );
6242 odres_ -= decllow( olhs - orhs );
6243 sres_ -= decllow( olhs - orhs );
6244 osres_ -= decllow( olhs - orhs );
6245 refres_ -= decllow( reflhs - refrhs );
6246 }
6247 catch( std::exception& ex ) {
6248 convertException<OMT1,OMT2>( ex );
6249 }
6250
6251 checkResults<OMT1,OMT2>();
6252 }
6253
6254 // Decllow subtraction with subtraction assignment with evaluated matrices
6255 {
6256 test_ = "Decllow subtraction with subtraction assignment with evaluated matrices";
6257 error_ = "Failed subtraction assignment operation";
6258
6259 try {
6260 initResults();
6261 dres_ -= decllow( eval( lhs ) - eval( rhs ) );
6262 odres_ -= decllow( eval( lhs ) - eval( rhs ) );
6263 sres_ -= decllow( eval( lhs ) - eval( rhs ) );
6264 osres_ -= decllow( eval( lhs ) - eval( rhs ) );
6265 refres_ -= decllow( eval( reflhs ) - eval( refrhs ) );
6266 }
6267 catch( std::exception& ex ) {
6268 convertException<MT1,MT2>( ex );
6269 }
6270
6271 checkResults<MT1,MT2>();
6272
6273 try {
6274 initResults();
6275 dres_ -= decllow( eval( lhs ) - eval( orhs ) );
6276 odres_ -= decllow( eval( lhs ) - eval( orhs ) );
6277 sres_ -= decllow( eval( lhs ) - eval( orhs ) );
6278 osres_ -= decllow( eval( lhs ) - eval( orhs ) );
6279 refres_ -= decllow( eval( reflhs ) - eval( refrhs ) );
6280 }
6281 catch( std::exception& ex ) {
6282 convertException<MT1,OMT2>( ex );
6283 }
6284
6285 checkResults<MT1,OMT2>();
6286
6287 try {
6288 initResults();
6289 dres_ -= decllow( eval( olhs ) - eval( rhs ) );
6290 odres_ -= decllow( eval( olhs ) - eval( rhs ) );
6291 sres_ -= decllow( eval( olhs ) - eval( rhs ) );
6292 osres_ -= decllow( eval( olhs ) - eval( rhs ) );
6293 refres_ -= decllow( eval( reflhs ) - eval( refrhs ) );
6294 }
6295 catch( std::exception& ex ) {
6296 convertException<OMT1,MT2>( ex );
6297 }
6298
6299 checkResults<OMT1,MT2>();
6300
6301 try {
6302 initResults();
6303 dres_ -= decllow( eval( olhs ) - eval( orhs ) );
6304 odres_ -= decllow( eval( olhs ) - eval( orhs ) );
6305 sres_ -= decllow( eval( olhs ) - eval( orhs ) );
6306 osres_ -= decllow( eval( olhs ) - eval( orhs ) );
6307 refres_ -= decllow( eval( reflhs ) - eval( refrhs ) );
6308 }
6309 catch( std::exception& ex ) {
6310 convertException<OMT1,OMT2>( ex );
6311 }
6312
6313 checkResults<OMT1,OMT2>();
6314 }
6315
6316
6317 //=====================================================================================
6318 // Decllow subtraction with Schur product assignment
6319 //=====================================================================================
6320
6321 // Decllow subtraction with Schur product assignment with the given matrices
6322 {
6323 test_ = "Decllow subtraction with Schur product assignment with the given matrices";
6324 error_ = "Failed Schur product assignment operation";
6325
6326 try {
6327 initResults();
6328 dres_ %= decllow( lhs - rhs );
6329 odres_ %= decllow( lhs - rhs );
6330 sres_ %= decllow( lhs - rhs );
6331 osres_ %= decllow( lhs - rhs );
6332 refres_ %= decllow( reflhs - refrhs );
6333 }
6334 catch( std::exception& ex ) {
6335 convertException<MT1,MT2>( ex );
6336 }
6337
6338 checkResults<MT1,MT2>();
6339
6340 try {
6341 initResults();
6342 dres_ %= decllow( lhs - orhs );
6343 odres_ %= decllow( lhs - orhs );
6344 sres_ %= decllow( lhs - orhs );
6345 osres_ %= decllow( lhs - orhs );
6346 refres_ %= decllow( reflhs - refrhs );
6347 }
6348 catch( std::exception& ex ) {
6349 convertException<MT1,OMT2>( ex );
6350 }
6351
6352 checkResults<MT1,OMT2>();
6353
6354 try {
6355 initResults();
6356 dres_ %= decllow( olhs - rhs );
6357 odres_ %= decllow( olhs - rhs );
6358 sres_ %= decllow( olhs - rhs );
6359 osres_ %= decllow( olhs - rhs );
6360 refres_ %= decllow( reflhs - refrhs );
6361 }
6362 catch( std::exception& ex ) {
6363 convertException<OMT1,MT2>( ex );
6364 }
6365
6366 checkResults<OMT1,MT2>();
6367
6368 try {
6369 initResults();
6370 dres_ %= decllow( olhs - orhs );
6371 odres_ %= decllow( olhs - orhs );
6372 sres_ %= decllow( olhs - orhs );
6373 osres_ %= decllow( olhs - orhs );
6374 refres_ %= decllow( reflhs - refrhs );
6375 }
6376 catch( std::exception& ex ) {
6377 convertException<OMT1,OMT2>( ex );
6378 }
6379
6380 checkResults<OMT1,OMT2>();
6381 }
6382
6383 // Decllow subtraction with Schur product assignment with evaluated matrices
6384 {
6385 test_ = "Decllow subtraction with Schur product assignment with evaluated matrices";
6386 error_ = "Failed Schur product assignment operation";
6387
6388 try {
6389 initResults();
6390 dres_ %= decllow( eval( lhs ) - eval( rhs ) );
6391 odres_ %= decllow( eval( lhs ) - eval( rhs ) );
6392 sres_ %= decllow( eval( lhs ) - eval( rhs ) );
6393 osres_ %= decllow( eval( lhs ) - eval( rhs ) );
6394 refres_ %= decllow( eval( reflhs ) - eval( refrhs ) );
6395 }
6396 catch( std::exception& ex ) {
6397 convertException<MT1,MT2>( ex );
6398 }
6399
6400 checkResults<MT1,MT2>();
6401
6402 try {
6403 initResults();
6404 dres_ %= decllow( eval( lhs ) - eval( orhs ) );
6405 odres_ %= decllow( eval( lhs ) - eval( orhs ) );
6406 sres_ %= decllow( eval( lhs ) - eval( orhs ) );
6407 osres_ %= decllow( eval( lhs ) - eval( orhs ) );
6408 refres_ %= decllow( eval( reflhs ) - eval( refrhs ) );
6409 }
6410 catch( std::exception& ex ) {
6411 convertException<MT1,OMT2>( ex );
6412 }
6413
6414 checkResults<MT1,OMT2>();
6415
6416 try {
6417 initResults();
6418 dres_ %= decllow( eval( olhs ) - eval( rhs ) );
6419 odres_ %= decllow( eval( olhs ) - eval( rhs ) );
6420 sres_ %= decllow( eval( olhs ) - eval( rhs ) );
6421 osres_ %= decllow( eval( olhs ) - eval( rhs ) );
6422 refres_ %= decllow( eval( reflhs ) - eval( refrhs ) );
6423 }
6424 catch( std::exception& ex ) {
6425 convertException<OMT1,MT2>( ex );
6426 }
6427
6428 checkResults<OMT1,MT2>();
6429
6430 try {
6431 initResults();
6432 dres_ %= decllow( eval( olhs ) - eval( orhs ) );
6433 odres_ %= decllow( eval( olhs ) - eval( orhs ) );
6434 sres_ %= decllow( eval( olhs ) - eval( orhs ) );
6435 osres_ %= decllow( eval( olhs ) - eval( orhs ) );
6436 refres_ %= decllow( eval( reflhs ) - eval( refrhs ) );
6437 }
6438 catch( std::exception& ex ) {
6439 convertException<OMT1,OMT2>( ex );
6440 }
6441
6442 checkResults<OMT1,OMT2>();
6443 }
6444 }
6445 #endif
6446 }
6447 //*************************************************************************************************
6448
6449
6450 //*************************************************************************************************
6451 /*!\brief Skipping the lower sparse matrix/sparse matrix subtraction.
6452 //
6453 // \return void
6454 //
6455 // This function is called in case the lower matrix/matrix subtraction operation is not
6456 // available for the given matrix types \a MT1 and \a MT2.
6457 */
6458 template< typename MT1 // Type of the left-hand side sparse matrix
6459 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclLowOperation(blaze::FalseType)6460 void OperationTest<MT1,MT2>::testDeclLowOperation( blaze::FalseType )
6461 {}
6462 //*************************************************************************************************
6463
6464
6465 //*************************************************************************************************
6466 /*!\brief Testing the upper sparse matrix/sparse matrix subtraction.
6467 //
6468 // \return void
6469 // \exception std::runtime_error Subtraction error detected.
6470 //
6471 // This function tests the upper matrix subtraction with plain assignment, addition assignment,
6472 // subtraction assignment, and Schur product assignment. In case any error resulting from the
6473 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
6474 // thrown.
6475 */
6476 template< typename MT1 // Type of the left-hand side sparse matrix
6477 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclUppOperation(blaze::TrueType)6478 void OperationTest<MT1,MT2>::testDeclUppOperation( blaze::TrueType )
6479 {
6480 #if BLAZETEST_MATHTEST_TEST_DECLUPP_OPERATION
6481 if( BLAZETEST_MATHTEST_TEST_DECLUPP_OPERATION > 1 )
6482 {
6483 if( lhs_.rows() != lhs_.columns() )
6484 return;
6485
6486
6487 //=====================================================================================
6488 // Test-specific setup of the left-hand side operand
6489 //=====================================================================================
6490
6491 MT1 lhs( lhs_ );
6492
6493 blaze::resetLower( lhs );
6494
6495 OMT1 olhs ( lhs );
6496 RT1 reflhs( lhs );
6497
6498
6499 //=====================================================================================
6500 // Test-specific setup of the right-hand side operand
6501 //=====================================================================================
6502
6503 MT2 rhs( rhs_ );
6504
6505 blaze::resetLower( rhs );
6506
6507 OMT2 orhs ( rhs );
6508 RT2 refrhs( rhs );
6509
6510
6511 //=====================================================================================
6512 // Declupp subtraction
6513 //=====================================================================================
6514
6515 // Declupp subtraction with the given matrices
6516 {
6517 test_ = "Declupp subtraction with the given matrices";
6518 error_ = "Failed subtraction operation";
6519
6520 try {
6521 initResults();
6522 dres_ = declupp( lhs - rhs );
6523 odres_ = declupp( lhs - rhs );
6524 sres_ = declupp( lhs - rhs );
6525 osres_ = declupp( lhs - rhs );
6526 refres_ = declupp( reflhs - refrhs );
6527 }
6528 catch( std::exception& ex ) {
6529 convertException<MT1,MT2>( ex );
6530 }
6531
6532 checkResults<MT1,MT2>();
6533
6534 try {
6535 initResults();
6536 dres_ = declupp( lhs - orhs );
6537 odres_ = declupp( lhs - orhs );
6538 sres_ = declupp( lhs - orhs );
6539 osres_ = declupp( lhs - orhs );
6540 refres_ = declupp( reflhs - refrhs );
6541 }
6542 catch( std::exception& ex ) {
6543 convertException<MT1,OMT2>( ex );
6544 }
6545
6546 checkResults<MT1,OMT2>();
6547
6548 try {
6549 initResults();
6550 dres_ = declupp( olhs - rhs );
6551 odres_ = declupp( olhs - rhs );
6552 sres_ = declupp( olhs - rhs );
6553 osres_ = declupp( olhs - rhs );
6554 refres_ = declupp( reflhs - refrhs );
6555 }
6556 catch( std::exception& ex ) {
6557 convertException<OMT1,MT2>( ex );
6558 }
6559
6560 checkResults<OMT1,MT2>();
6561
6562 try {
6563 initResults();
6564 dres_ = declupp( olhs - orhs );
6565 odres_ = declupp( olhs - orhs );
6566 sres_ = declupp( olhs - orhs );
6567 osres_ = declupp( olhs - orhs );
6568 refres_ = declupp( reflhs - refrhs );
6569 }
6570 catch( std::exception& ex ) {
6571 convertException<OMT1,OMT2>( ex );
6572 }
6573
6574 checkResults<OMT1,OMT2>();
6575 }
6576
6577 // Declupp subtraction with evaluated matrices
6578 {
6579 test_ = "Declupp subtraction with evaluated left-hand side matrix";
6580 error_ = "Failed subtraction operation";
6581
6582 try {
6583 initResults();
6584 dres_ = declupp( eval( lhs ) - eval( rhs ) );
6585 odres_ = declupp( eval( lhs ) - eval( rhs ) );
6586 sres_ = declupp( eval( lhs ) - eval( rhs ) );
6587 osres_ = declupp( eval( lhs ) - eval( rhs ) );
6588 refres_ = declupp( eval( reflhs ) - eval( refrhs ) );
6589 }
6590 catch( std::exception& ex ) {
6591 convertException<MT1,MT2>( ex );
6592 }
6593
6594 checkResults<MT1,MT2>();
6595
6596 try {
6597 initResults();
6598 dres_ = declupp( eval( lhs ) - eval( orhs ) );
6599 odres_ = declupp( eval( lhs ) - eval( orhs ) );
6600 sres_ = declupp( eval( lhs ) - eval( orhs ) );
6601 osres_ = declupp( eval( lhs ) - eval( orhs ) );
6602 refres_ = declupp( eval( reflhs ) - eval( refrhs ) );
6603 }
6604 catch( std::exception& ex ) {
6605 convertException<MT1,OMT2>( ex );
6606 }
6607
6608 checkResults<MT1,OMT2>();
6609
6610 try {
6611 initResults();
6612 dres_ = declupp( eval( olhs ) - eval( rhs ) );
6613 odres_ = declupp( eval( olhs ) - eval( rhs ) );
6614 sres_ = declupp( eval( olhs ) - eval( rhs ) );
6615 osres_ = declupp( eval( olhs ) - eval( rhs ) );
6616 refres_ = declupp( eval( reflhs ) - eval( refrhs ) );
6617 }
6618 catch( std::exception& ex ) {
6619 convertException<OMT1,MT2>( ex );
6620 }
6621
6622 checkResults<OMT1,MT2>();
6623
6624 try {
6625 initResults();
6626 dres_ = declupp( eval( olhs ) - eval( orhs ) );
6627 odres_ = declupp( eval( olhs ) - eval( orhs ) );
6628 sres_ = declupp( eval( olhs ) - eval( orhs ) );
6629 osres_ = declupp( eval( olhs ) - eval( orhs ) );
6630 refres_ = declupp( eval( reflhs ) - eval( refrhs ) );
6631 }
6632 catch( std::exception& ex ) {
6633 convertException<OMT1,OMT2>( ex );
6634 }
6635
6636 checkResults<OMT1,OMT2>();
6637 }
6638
6639
6640 //=====================================================================================
6641 // Declupp subtraction with addition assignment
6642 //=====================================================================================
6643
6644 // Declupp subtraction with addition assignment with the given matrices
6645 {
6646 test_ = "Declupp subtraction with addition assignment with the given matrices";
6647 error_ = "Failed addition assignment operation";
6648
6649 try {
6650 initResults();
6651 dres_ += declupp( lhs - rhs );
6652 odres_ += declupp( lhs - rhs );
6653 sres_ += declupp( lhs - rhs );
6654 osres_ += declupp( lhs - rhs );
6655 refres_ += declupp( reflhs - refrhs );
6656 }
6657 catch( std::exception& ex ) {
6658 convertException<MT1,MT2>( ex );
6659 }
6660
6661 checkResults<MT1,MT2>();
6662
6663 try {
6664 initResults();
6665 dres_ += declupp( lhs - orhs );
6666 odres_ += declupp( lhs - orhs );
6667 sres_ += declupp( lhs - orhs );
6668 osres_ += declupp( lhs - orhs );
6669 refres_ += declupp( reflhs - refrhs );
6670 }
6671 catch( std::exception& ex ) {
6672 convertException<MT1,OMT2>( ex );
6673 }
6674
6675 checkResults<MT1,OMT2>();
6676
6677 try {
6678 initResults();
6679 dres_ += declupp( olhs - rhs );
6680 odres_ += declupp( olhs - rhs );
6681 sres_ += declupp( olhs - rhs );
6682 osres_ += declupp( olhs - rhs );
6683 refres_ += declupp( reflhs - refrhs );
6684 }
6685 catch( std::exception& ex ) {
6686 convertException<OMT1,MT2>( ex );
6687 }
6688
6689 checkResults<OMT1,MT2>();
6690
6691 try {
6692 initResults();
6693 dres_ += declupp( olhs - orhs );
6694 odres_ += declupp( olhs - orhs );
6695 sres_ += declupp( olhs - orhs );
6696 osres_ += declupp( olhs - orhs );
6697 refres_ += declupp( reflhs - refrhs );
6698 }
6699 catch( std::exception& ex ) {
6700 convertException<OMT1,OMT2>( ex );
6701 }
6702
6703 checkResults<OMT1,OMT2>();
6704 }
6705
6706 // Declupp subtraction with addition assignment with evaluated matrices
6707 {
6708 test_ = "Declupp subtraction with addition assignment with evaluated matrices";
6709 error_ = "Failed addition assignment operation";
6710
6711 try {
6712 initResults();
6713 dres_ += declupp( eval( lhs ) - eval( rhs ) );
6714 odres_ += declupp( eval( lhs ) - eval( rhs ) );
6715 sres_ += declupp( eval( lhs ) - eval( rhs ) );
6716 osres_ += declupp( eval( lhs ) - eval( rhs ) );
6717 refres_ += declupp( eval( reflhs ) - eval( refrhs ) );
6718 }
6719 catch( std::exception& ex ) {
6720 convertException<MT1,MT2>( ex );
6721 }
6722
6723 checkResults<MT1,MT2>();
6724
6725 try {
6726 initResults();
6727 dres_ += declupp( eval( lhs ) - eval( orhs ) );
6728 odres_ += declupp( eval( lhs ) - eval( orhs ) );
6729 sres_ += declupp( eval( lhs ) - eval( orhs ) );
6730 osres_ += declupp( eval( lhs ) - eval( orhs ) );
6731 refres_ += declupp( eval( reflhs ) - eval( refrhs ) );
6732 }
6733 catch( std::exception& ex ) {
6734 convertException<MT1,OMT2>( ex );
6735 }
6736
6737 checkResults<MT1,OMT2>();
6738
6739 try {
6740 initResults();
6741 dres_ += declupp( eval( olhs ) - eval( rhs ) );
6742 odres_ += declupp( eval( olhs ) - eval( rhs ) );
6743 sres_ += declupp( eval( olhs ) - eval( rhs ) );
6744 osres_ += declupp( eval( olhs ) - eval( rhs ) );
6745 refres_ += declupp( eval( reflhs ) - eval( refrhs ) );
6746 }
6747 catch( std::exception& ex ) {
6748 convertException<OMT1,MT2>( ex );
6749 }
6750
6751 checkResults<OMT1,MT2>();
6752
6753 try {
6754 initResults();
6755 dres_ += declupp( eval( olhs ) - eval( orhs ) );
6756 odres_ += declupp( eval( olhs ) - eval( orhs ) );
6757 sres_ += declupp( eval( olhs ) - eval( orhs ) );
6758 osres_ += declupp( eval( olhs ) - eval( orhs ) );
6759 refres_ += declupp( eval( reflhs ) - eval( refrhs ) );
6760 }
6761 catch( std::exception& ex ) {
6762 convertException<OMT1,OMT2>( ex );
6763 }
6764
6765 checkResults<OMT1,OMT2>();
6766 }
6767
6768
6769 //=====================================================================================
6770 // Declupp subtraction with subtraction assignment
6771 //=====================================================================================
6772
6773 // Declupp subtraction with subtraction assignment with the given matrices
6774 {
6775 test_ = "Declupp subtraction with subtraction assignment with the given matrices";
6776 error_ = "Failed subtraction assignment operation";
6777
6778 try {
6779 initResults();
6780 dres_ -= declupp( lhs - rhs );
6781 odres_ -= declupp( lhs - rhs );
6782 sres_ -= declupp( lhs - rhs );
6783 osres_ -= declupp( lhs - rhs );
6784 refres_ -= declupp( reflhs - refrhs );
6785 }
6786 catch( std::exception& ex ) {
6787 convertException<MT1,MT2>( ex );
6788 }
6789
6790 checkResults<MT1,MT2>();
6791
6792 try {
6793 initResults();
6794 dres_ -= declupp( lhs - orhs );
6795 odres_ -= declupp( lhs - orhs );
6796 sres_ -= declupp( lhs - orhs );
6797 osres_ -= declupp( lhs - orhs );
6798 refres_ -= declupp( reflhs - refrhs );
6799 }
6800 catch( std::exception& ex ) {
6801 convertException<MT1,OMT2>( ex );
6802 }
6803
6804 checkResults<MT1,OMT2>();
6805
6806 try {
6807 initResults();
6808 dres_ -= declupp( olhs - rhs );
6809 odres_ -= declupp( olhs - rhs );
6810 sres_ -= declupp( olhs - rhs );
6811 osres_ -= declupp( olhs - rhs );
6812 refres_ -= declupp( reflhs - refrhs );
6813 }
6814 catch( std::exception& ex ) {
6815 convertException<OMT1,MT2>( ex );
6816 }
6817
6818 checkResults<OMT1,MT2>();
6819
6820 try {
6821 initResults();
6822 dres_ -= declupp( olhs - orhs );
6823 odres_ -= declupp( olhs - orhs );
6824 sres_ -= declupp( olhs - orhs );
6825 osres_ -= declupp( olhs - orhs );
6826 refres_ -= declupp( reflhs - refrhs );
6827 }
6828 catch( std::exception& ex ) {
6829 convertException<OMT1,OMT2>( ex );
6830 }
6831
6832 checkResults<OMT1,OMT2>();
6833 }
6834
6835 // Declupp subtraction with subtraction assignment with evaluated matrices
6836 {
6837 test_ = "Declupp subtraction with subtraction assignment with evaluated matrices";
6838 error_ = "Failed subtraction assignment operation";
6839
6840 try {
6841 initResults();
6842 dres_ -= declupp( eval( lhs ) - eval( rhs ) );
6843 odres_ -= declupp( eval( lhs ) - eval( rhs ) );
6844 sres_ -= declupp( eval( lhs ) - eval( rhs ) );
6845 osres_ -= declupp( eval( lhs ) - eval( rhs ) );
6846 refres_ -= declupp( eval( reflhs ) - eval( refrhs ) );
6847 }
6848 catch( std::exception& ex ) {
6849 convertException<MT1,MT2>( ex );
6850 }
6851
6852 checkResults<MT1,MT2>();
6853
6854 try {
6855 initResults();
6856 dres_ -= declupp( eval( lhs ) - eval( orhs ) );
6857 odres_ -= declupp( eval( lhs ) - eval( orhs ) );
6858 sres_ -= declupp( eval( lhs ) - eval( orhs ) );
6859 osres_ -= declupp( eval( lhs ) - eval( orhs ) );
6860 refres_ -= declupp( eval( reflhs ) - eval( refrhs ) );
6861 }
6862 catch( std::exception& ex ) {
6863 convertException<MT1,OMT2>( ex );
6864 }
6865
6866 checkResults<MT1,OMT2>();
6867
6868 try {
6869 initResults();
6870 dres_ -= declupp( eval( olhs ) - eval( rhs ) );
6871 odres_ -= declupp( eval( olhs ) - eval( rhs ) );
6872 sres_ -= declupp( eval( olhs ) - eval( rhs ) );
6873 osres_ -= declupp( eval( olhs ) - eval( rhs ) );
6874 refres_ -= declupp( eval( reflhs ) - eval( refrhs ) );
6875 }
6876 catch( std::exception& ex ) {
6877 convertException<OMT1,MT2>( ex );
6878 }
6879
6880 checkResults<OMT1,MT2>();
6881
6882 try {
6883 initResults();
6884 dres_ -= declupp( eval( olhs ) - eval( orhs ) );
6885 odres_ -= declupp( eval( olhs ) - eval( orhs ) );
6886 sres_ -= declupp( eval( olhs ) - eval( orhs ) );
6887 osres_ -= declupp( eval( olhs ) - eval( orhs ) );
6888 refres_ -= declupp( eval( reflhs ) - eval( refrhs ) );
6889 }
6890 catch( std::exception& ex ) {
6891 convertException<OMT1,OMT2>( ex );
6892 }
6893
6894 checkResults<OMT1,OMT2>();
6895 }
6896
6897
6898 //=====================================================================================
6899 // Declupp subtraction with Schur product assignment
6900 //=====================================================================================
6901
6902 // Declupp subtraction with Schur product assignment with the given matrices
6903 {
6904 test_ = "Declupp subtraction with Schur product assignment with the given matrices";
6905 error_ = "Failed Schur product assignment operation";
6906
6907 try {
6908 initResults();
6909 dres_ %= declupp( lhs - rhs );
6910 odres_ %= declupp( lhs - rhs );
6911 sres_ %= declupp( lhs - rhs );
6912 osres_ %= declupp( lhs - rhs );
6913 refres_ %= declupp( reflhs - refrhs );
6914 }
6915 catch( std::exception& ex ) {
6916 convertException<MT1,MT2>( ex );
6917 }
6918
6919 checkResults<MT1,MT2>();
6920
6921 try {
6922 initResults();
6923 dres_ %= declupp( lhs - orhs );
6924 odres_ %= declupp( lhs - orhs );
6925 sres_ %= declupp( lhs - orhs );
6926 osres_ %= declupp( lhs - orhs );
6927 refres_ %= declupp( reflhs - refrhs );
6928 }
6929 catch( std::exception& ex ) {
6930 convertException<MT1,OMT2>( ex );
6931 }
6932
6933 checkResults<MT1,OMT2>();
6934
6935 try {
6936 initResults();
6937 dres_ %= declupp( olhs - rhs );
6938 odres_ %= declupp( olhs - rhs );
6939 sres_ %= declupp( olhs - rhs );
6940 osres_ %= declupp( olhs - rhs );
6941 refres_ %= declupp( reflhs - refrhs );
6942 }
6943 catch( std::exception& ex ) {
6944 convertException<OMT1,MT2>( ex );
6945 }
6946
6947 checkResults<OMT1,MT2>();
6948
6949 try {
6950 initResults();
6951 dres_ %= declupp( olhs - orhs );
6952 odres_ %= declupp( olhs - orhs );
6953 sres_ %= declupp( olhs - orhs );
6954 osres_ %= declupp( olhs - orhs );
6955 refres_ %= declupp( reflhs - refrhs );
6956 }
6957 catch( std::exception& ex ) {
6958 convertException<OMT1,OMT2>( ex );
6959 }
6960
6961 checkResults<OMT1,OMT2>();
6962 }
6963
6964 // Declupp subtraction with Schur product assignment with evaluated matrices
6965 {
6966 test_ = "Declupp subtraction with Schur product assignment with evaluated matrices";
6967 error_ = "Failed Schur product assignment operation";
6968
6969 try {
6970 initResults();
6971 dres_ %= declupp( eval( lhs ) - eval( rhs ) );
6972 odres_ %= declupp( eval( lhs ) - eval( rhs ) );
6973 sres_ %= declupp( eval( lhs ) - eval( rhs ) );
6974 osres_ %= declupp( eval( lhs ) - eval( rhs ) );
6975 refres_ %= declupp( eval( reflhs ) - eval( refrhs ) );
6976 }
6977 catch( std::exception& ex ) {
6978 convertException<MT1,MT2>( ex );
6979 }
6980
6981 checkResults<MT1,MT2>();
6982
6983 try {
6984 initResults();
6985 dres_ %= declupp( eval( lhs ) - eval( orhs ) );
6986 odres_ %= declupp( eval( lhs ) - eval( orhs ) );
6987 sres_ %= declupp( eval( lhs ) - eval( orhs ) );
6988 osres_ %= declupp( eval( lhs ) - eval( orhs ) );
6989 refres_ %= declupp( eval( reflhs ) - eval( refrhs ) );
6990 }
6991 catch( std::exception& ex ) {
6992 convertException<MT1,OMT2>( ex );
6993 }
6994
6995 checkResults<MT1,OMT2>();
6996
6997 try {
6998 initResults();
6999 dres_ %= declupp( eval( olhs ) - eval( rhs ) );
7000 odres_ %= declupp( eval( olhs ) - eval( rhs ) );
7001 sres_ %= declupp( eval( olhs ) - eval( rhs ) );
7002 osres_ %= declupp( eval( olhs ) - eval( rhs ) );
7003 refres_ %= declupp( eval( reflhs ) - eval( refrhs ) );
7004 }
7005 catch( std::exception& ex ) {
7006 convertException<OMT1,MT2>( ex );
7007 }
7008
7009 checkResults<OMT1,MT2>();
7010
7011 try {
7012 initResults();
7013 dres_ %= declupp( eval( olhs ) - eval( orhs ) );
7014 odres_ %= declupp( eval( olhs ) - eval( orhs ) );
7015 sres_ %= declupp( eval( olhs ) - eval( orhs ) );
7016 osres_ %= declupp( eval( olhs ) - eval( orhs ) );
7017 refres_ %= declupp( eval( reflhs ) - eval( refrhs ) );
7018 }
7019 catch( std::exception& ex ) {
7020 convertException<OMT1,OMT2>( ex );
7021 }
7022
7023 checkResults<OMT1,OMT2>();
7024 }
7025 }
7026 #endif
7027 }
7028 //*************************************************************************************************
7029
7030
7031 //*************************************************************************************************
7032 /*!\brief Skipping the upper sparse matrix/sparse matrix subtraction.
7033 //
7034 // \return void
7035 //
7036 // This function is called in case the upper matrix/matrix subtraction operation is not
7037 // available for the given matrix types \a MT1 and \a MT2.
7038 */
7039 template< typename MT1 // Type of the left-hand side sparse matrix
7040 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclUppOperation(blaze::FalseType)7041 void OperationTest<MT1,MT2>::testDeclUppOperation( blaze::FalseType )
7042 {}
7043 //*************************************************************************************************
7044
7045
7046 //*************************************************************************************************
7047 /*!\brief Testing the diagonal sparse matrix/sparse matrix subtraction.
7048 //
7049 // \return void
7050 // \exception std::runtime_error Subtraction error detected.
7051 //
7052 // This function tests the diagonal matrix subtraction with plain assignment, addition assignment,
7053 // subtraction assignment, and Schur product assignment. In case any error resulting from the
7054 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
7055 // thrown.
7056 */
7057 template< typename MT1 // Type of the left-hand side sparse matrix
7058 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclDiagOperation(blaze::TrueType)7059 void OperationTest<MT1,MT2>::testDeclDiagOperation( blaze::TrueType )
7060 {
7061 #if BLAZETEST_MATHTEST_TEST_DECLDIAG_OPERATION
7062 if( BLAZETEST_MATHTEST_TEST_DECLDIAG_OPERATION > 1 )
7063 {
7064 if( lhs_.rows() != lhs_.columns() )
7065 return;
7066
7067
7068 //=====================================================================================
7069 // Test-specific setup of the left-hand side operand
7070 //=====================================================================================
7071
7072 MT1 lhs( lhs_ );
7073
7074 blaze::resetLower( lhs );
7075 blaze::resetUpper( lhs );
7076
7077 OMT1 olhs ( lhs );
7078 RT1 reflhs( lhs );
7079
7080
7081 //=====================================================================================
7082 // Test-specific setup of the right-hand side operand
7083 //=====================================================================================
7084
7085 MT2 rhs( rhs_ );
7086
7087 blaze::resetLower( rhs );
7088 blaze::resetUpper( rhs );
7089
7090 OMT2 orhs ( rhs );
7091 RT2 refrhs( rhs );
7092
7093
7094 //=====================================================================================
7095 // Decldiag subtraction
7096 //=====================================================================================
7097
7098 // Decldiag subtraction with the given matrices
7099 {
7100 test_ = "Decldiag subtraction with the given matrices";
7101 error_ = "Failed subtraction operation";
7102
7103 try {
7104 initResults();
7105 dres_ = decldiag( lhs - rhs );
7106 odres_ = decldiag( lhs - rhs );
7107 sres_ = decldiag( lhs - rhs );
7108 osres_ = decldiag( lhs - rhs );
7109 refres_ = decldiag( reflhs - refrhs );
7110 }
7111 catch( std::exception& ex ) {
7112 convertException<MT1,MT2>( ex );
7113 }
7114
7115 checkResults<MT1,MT2>();
7116
7117 try {
7118 initResults();
7119 dres_ = decldiag( lhs - orhs );
7120 odres_ = decldiag( lhs - orhs );
7121 sres_ = decldiag( lhs - orhs );
7122 osres_ = decldiag( lhs - orhs );
7123 refres_ = decldiag( reflhs - refrhs );
7124 }
7125 catch( std::exception& ex ) {
7126 convertException<MT1,OMT2>( ex );
7127 }
7128
7129 checkResults<MT1,OMT2>();
7130
7131 try {
7132 initResults();
7133 dres_ = decldiag( olhs - rhs );
7134 odres_ = decldiag( olhs - rhs );
7135 sres_ = decldiag( olhs - rhs );
7136 osres_ = decldiag( olhs - rhs );
7137 refres_ = decldiag( reflhs - refrhs );
7138 }
7139 catch( std::exception& ex ) {
7140 convertException<OMT1,MT2>( ex );
7141 }
7142
7143 checkResults<OMT1,MT2>();
7144
7145 try {
7146 initResults();
7147 dres_ = decldiag( olhs - orhs );
7148 odres_ = decldiag( olhs - orhs );
7149 sres_ = decldiag( olhs - orhs );
7150 osres_ = decldiag( olhs - orhs );
7151 refres_ = decldiag( reflhs - refrhs );
7152 }
7153 catch( std::exception& ex ) {
7154 convertException<OMT1,OMT2>( ex );
7155 }
7156
7157 checkResults<OMT1,OMT2>();
7158 }
7159
7160 // Decldiag subtraction with evaluated matrices
7161 {
7162 test_ = "Decldiag subtraction with evaluated left-hand side matrix";
7163 error_ = "Failed subtraction operation";
7164
7165 try {
7166 initResults();
7167 dres_ = decldiag( eval( lhs ) - eval( rhs ) );
7168 odres_ = decldiag( eval( lhs ) - eval( rhs ) );
7169 sres_ = decldiag( eval( lhs ) - eval( rhs ) );
7170 osres_ = decldiag( eval( lhs ) - eval( rhs ) );
7171 refres_ = decldiag( eval( reflhs ) - eval( refrhs ) );
7172 }
7173 catch( std::exception& ex ) {
7174 convertException<MT1,MT2>( ex );
7175 }
7176
7177 checkResults<MT1,MT2>();
7178
7179 try {
7180 initResults();
7181 dres_ = decldiag( eval( lhs ) - eval( orhs ) );
7182 odres_ = decldiag( eval( lhs ) - eval( orhs ) );
7183 sres_ = decldiag( eval( lhs ) - eval( orhs ) );
7184 osres_ = decldiag( eval( lhs ) - eval( orhs ) );
7185 refres_ = decldiag( eval( reflhs ) - eval( refrhs ) );
7186 }
7187 catch( std::exception& ex ) {
7188 convertException<MT1,OMT2>( ex );
7189 }
7190
7191 checkResults<MT1,OMT2>();
7192
7193 try {
7194 initResults();
7195 dres_ = decldiag( eval( olhs ) - eval( rhs ) );
7196 odres_ = decldiag( eval( olhs ) - eval( rhs ) );
7197 sres_ = decldiag( eval( olhs ) - eval( rhs ) );
7198 osres_ = decldiag( eval( olhs ) - eval( rhs ) );
7199 refres_ = decldiag( eval( reflhs ) - eval( refrhs ) );
7200 }
7201 catch( std::exception& ex ) {
7202 convertException<OMT1,MT2>( ex );
7203 }
7204
7205 checkResults<OMT1,MT2>();
7206
7207 try {
7208 initResults();
7209 dres_ = decldiag( eval( olhs ) - eval( orhs ) );
7210 odres_ = decldiag( eval( olhs ) - eval( orhs ) );
7211 sres_ = decldiag( eval( olhs ) - eval( orhs ) );
7212 osres_ = decldiag( eval( olhs ) - eval( orhs ) );
7213 refres_ = decldiag( eval( reflhs ) - eval( refrhs ) );
7214 }
7215 catch( std::exception& ex ) {
7216 convertException<OMT1,OMT2>( ex );
7217 }
7218
7219 checkResults<OMT1,OMT2>();
7220 }
7221
7222
7223 //=====================================================================================
7224 // Decldiag subtraction with addition assignment
7225 //=====================================================================================
7226
7227 // Decldiag subtraction with addition assignment with the given matrices
7228 {
7229 test_ = "Decldiag subtraction with addition assignment with the given matrices";
7230 error_ = "Failed addition assignment operation";
7231
7232 try {
7233 initResults();
7234 dres_ += decldiag( lhs - rhs );
7235 odres_ += decldiag( lhs - rhs );
7236 sres_ += decldiag( lhs - rhs );
7237 osres_ += decldiag( lhs - rhs );
7238 refres_ += decldiag( reflhs - refrhs );
7239 }
7240 catch( std::exception& ex ) {
7241 convertException<MT1,MT2>( ex );
7242 }
7243
7244 checkResults<MT1,MT2>();
7245
7246 try {
7247 initResults();
7248 dres_ += decldiag( lhs - orhs );
7249 odres_ += decldiag( lhs - orhs );
7250 sres_ += decldiag( lhs - orhs );
7251 osres_ += decldiag( lhs - orhs );
7252 refres_ += decldiag( reflhs - refrhs );
7253 }
7254 catch( std::exception& ex ) {
7255 convertException<MT1,OMT2>( ex );
7256 }
7257
7258 checkResults<MT1,OMT2>();
7259
7260 try {
7261 initResults();
7262 dres_ += decldiag( olhs - rhs );
7263 odres_ += decldiag( olhs - rhs );
7264 sres_ += decldiag( olhs - rhs );
7265 osres_ += decldiag( olhs - rhs );
7266 refres_ += decldiag( reflhs - refrhs );
7267 }
7268 catch( std::exception& ex ) {
7269 convertException<OMT1,MT2>( ex );
7270 }
7271
7272 checkResults<OMT1,MT2>();
7273
7274 try {
7275 initResults();
7276 dres_ += decldiag( olhs - orhs );
7277 odres_ += decldiag( olhs - orhs );
7278 sres_ += decldiag( olhs - orhs );
7279 osres_ += decldiag( olhs - orhs );
7280 refres_ += decldiag( reflhs - refrhs );
7281 }
7282 catch( std::exception& ex ) {
7283 convertException<OMT1,OMT2>( ex );
7284 }
7285
7286 checkResults<OMT1,OMT2>();
7287 }
7288
7289 // Decldiag subtraction with addition assignment with evaluated matrices
7290 {
7291 test_ = "Decldiag subtraction with addition assignment with evaluated matrices";
7292 error_ = "Failed addition assignment operation";
7293
7294 try {
7295 initResults();
7296 dres_ += decldiag( eval( lhs ) - eval( rhs ) );
7297 odres_ += decldiag( eval( lhs ) - eval( rhs ) );
7298 sres_ += decldiag( eval( lhs ) - eval( rhs ) );
7299 osres_ += decldiag( eval( lhs ) - eval( rhs ) );
7300 refres_ += decldiag( eval( reflhs ) - eval( refrhs ) );
7301 }
7302 catch( std::exception& ex ) {
7303 convertException<MT1,MT2>( ex );
7304 }
7305
7306 checkResults<MT1,MT2>();
7307
7308 try {
7309 initResults();
7310 dres_ += decldiag( eval( lhs ) - eval( orhs ) );
7311 odres_ += decldiag( eval( lhs ) - eval( orhs ) );
7312 sres_ += decldiag( eval( lhs ) - eval( orhs ) );
7313 osres_ += decldiag( eval( lhs ) - eval( orhs ) );
7314 refres_ += decldiag( eval( reflhs ) - eval( refrhs ) );
7315 }
7316 catch( std::exception& ex ) {
7317 convertException<MT1,OMT2>( ex );
7318 }
7319
7320 checkResults<MT1,OMT2>();
7321
7322 try {
7323 initResults();
7324 dres_ += decldiag( eval( olhs ) - eval( rhs ) );
7325 odres_ += decldiag( eval( olhs ) - eval( rhs ) );
7326 sres_ += decldiag( eval( olhs ) - eval( rhs ) );
7327 osres_ += decldiag( eval( olhs ) - eval( rhs ) );
7328 refres_ += decldiag( eval( reflhs ) - eval( refrhs ) );
7329 }
7330 catch( std::exception& ex ) {
7331 convertException<OMT1,MT2>( ex );
7332 }
7333
7334 checkResults<OMT1,MT2>();
7335
7336 try {
7337 initResults();
7338 dres_ += decldiag( eval( olhs ) - eval( orhs ) );
7339 odres_ += decldiag( eval( olhs ) - eval( orhs ) );
7340 sres_ += decldiag( eval( olhs ) - eval( orhs ) );
7341 osres_ += decldiag( eval( olhs ) - eval( orhs ) );
7342 refres_ += decldiag( eval( reflhs ) - eval( refrhs ) );
7343 }
7344 catch( std::exception& ex ) {
7345 convertException<OMT1,OMT2>( ex );
7346 }
7347
7348 checkResults<OMT1,OMT2>();
7349 }
7350
7351
7352 //=====================================================================================
7353 // Decldiag subtraction with subtraction assignment
7354 //=====================================================================================
7355
7356 // Decldiag subtraction with subtraction assignment with the given matrices
7357 {
7358 test_ = "Decldiag subtraction with subtraction assignment with the given matrices";
7359 error_ = "Failed subtraction assignment operation";
7360
7361 try {
7362 initResults();
7363 dres_ -= decldiag( lhs - rhs );
7364 odres_ -= decldiag( lhs - rhs );
7365 sres_ -= decldiag( lhs - rhs );
7366 osres_ -= decldiag( lhs - rhs );
7367 refres_ -= decldiag( reflhs - refrhs );
7368 }
7369 catch( std::exception& ex ) {
7370 convertException<MT1,MT2>( ex );
7371 }
7372
7373 checkResults<MT1,MT2>();
7374
7375 try {
7376 initResults();
7377 dres_ -= decldiag( lhs - orhs );
7378 odres_ -= decldiag( lhs - orhs );
7379 sres_ -= decldiag( lhs - orhs );
7380 osres_ -= decldiag( lhs - orhs );
7381 refres_ -= decldiag( reflhs - refrhs );
7382 }
7383 catch( std::exception& ex ) {
7384 convertException<MT1,OMT2>( ex );
7385 }
7386
7387 checkResults<MT1,OMT2>();
7388
7389 try {
7390 initResults();
7391 dres_ -= decldiag( olhs - rhs );
7392 odres_ -= decldiag( olhs - rhs );
7393 sres_ -= decldiag( olhs - rhs );
7394 osres_ -= decldiag( olhs - rhs );
7395 refres_ -= decldiag( reflhs - refrhs );
7396 }
7397 catch( std::exception& ex ) {
7398 convertException<OMT1,MT2>( ex );
7399 }
7400
7401 checkResults<OMT1,MT2>();
7402
7403 try {
7404 initResults();
7405 dres_ -= decldiag( olhs - orhs );
7406 odres_ -= decldiag( olhs - orhs );
7407 sres_ -= decldiag( olhs - orhs );
7408 osres_ -= decldiag( olhs - orhs );
7409 refres_ -= decldiag( reflhs - refrhs );
7410 }
7411 catch( std::exception& ex ) {
7412 convertException<OMT1,OMT2>( ex );
7413 }
7414
7415 checkResults<OMT1,OMT2>();
7416 }
7417
7418 // Decldiag subtraction with subtraction assignment with evaluated matrices
7419 {
7420 test_ = "Decldiag subtraction with subtraction assignment with evaluated matrices";
7421 error_ = "Failed subtraction assignment operation";
7422
7423 try {
7424 initResults();
7425 dres_ -= decldiag( eval( lhs ) - eval( rhs ) );
7426 odres_ -= decldiag( eval( lhs ) - eval( rhs ) );
7427 sres_ -= decldiag( eval( lhs ) - eval( rhs ) );
7428 osres_ -= decldiag( eval( lhs ) - eval( rhs ) );
7429 refres_ -= decldiag( eval( reflhs ) - eval( refrhs ) );
7430 }
7431 catch( std::exception& ex ) {
7432 convertException<MT1,MT2>( ex );
7433 }
7434
7435 checkResults<MT1,MT2>();
7436
7437 try {
7438 initResults();
7439 dres_ -= decldiag( eval( lhs ) - eval( orhs ) );
7440 odres_ -= decldiag( eval( lhs ) - eval( orhs ) );
7441 sres_ -= decldiag( eval( lhs ) - eval( orhs ) );
7442 osres_ -= decldiag( eval( lhs ) - eval( orhs ) );
7443 refres_ -= decldiag( eval( reflhs ) - eval( refrhs ) );
7444 }
7445 catch( std::exception& ex ) {
7446 convertException<MT1,OMT2>( ex );
7447 }
7448
7449 checkResults<MT1,OMT2>();
7450
7451 try {
7452 initResults();
7453 dres_ -= decldiag( eval( olhs ) - eval( rhs ) );
7454 odres_ -= decldiag( eval( olhs ) - eval( rhs ) );
7455 sres_ -= decldiag( eval( olhs ) - eval( rhs ) );
7456 osres_ -= decldiag( eval( olhs ) - eval( rhs ) );
7457 refres_ -= decldiag( eval( reflhs ) - eval( refrhs ) );
7458 }
7459 catch( std::exception& ex ) {
7460 convertException<OMT1,MT2>( ex );
7461 }
7462
7463 checkResults<OMT1,MT2>();
7464
7465 try {
7466 initResults();
7467 dres_ -= decldiag( eval( olhs ) - eval( orhs ) );
7468 odres_ -= decldiag( eval( olhs ) - eval( orhs ) );
7469 sres_ -= decldiag( eval( olhs ) - eval( orhs ) );
7470 osres_ -= decldiag( eval( olhs ) - eval( orhs ) );
7471 refres_ -= decldiag( eval( reflhs ) - eval( refrhs ) );
7472 }
7473 catch( std::exception& ex ) {
7474 convertException<OMT1,OMT2>( ex );
7475 }
7476
7477 checkResults<OMT1,OMT2>();
7478 }
7479
7480
7481 //=====================================================================================
7482 // Decldiag subtraction with Schur product assignment
7483 //=====================================================================================
7484
7485 // Decldiag subtraction with Schur product assignment with the given matrices
7486 {
7487 test_ = "Decldiag subtraction with Schur product assignment with the given matrices";
7488 error_ = "Failed Schur product assignment operation";
7489
7490 try {
7491 initResults();
7492 dres_ %= decldiag( lhs - rhs );
7493 odres_ %= decldiag( lhs - rhs );
7494 sres_ %= decldiag( lhs - rhs );
7495 osres_ %= decldiag( lhs - rhs );
7496 refres_ %= decldiag( reflhs - refrhs );
7497 }
7498 catch( std::exception& ex ) {
7499 convertException<MT1,MT2>( ex );
7500 }
7501
7502 checkResults<MT1,MT2>();
7503
7504 try {
7505 initResults();
7506 dres_ %= decldiag( lhs - orhs );
7507 odres_ %= decldiag( lhs - orhs );
7508 sres_ %= decldiag( lhs - orhs );
7509 osres_ %= decldiag( lhs - orhs );
7510 refres_ %= decldiag( reflhs - refrhs );
7511 }
7512 catch( std::exception& ex ) {
7513 convertException<MT1,OMT2>( ex );
7514 }
7515
7516 checkResults<MT1,OMT2>();
7517
7518 try {
7519 initResults();
7520 dres_ %= decldiag( olhs - rhs );
7521 odres_ %= decldiag( olhs - rhs );
7522 sres_ %= decldiag( olhs - rhs );
7523 osres_ %= decldiag( olhs - rhs );
7524 refres_ %= decldiag( reflhs - refrhs );
7525 }
7526 catch( std::exception& ex ) {
7527 convertException<OMT1,MT2>( ex );
7528 }
7529
7530 checkResults<OMT1,MT2>();
7531
7532 try {
7533 initResults();
7534 dres_ %= decldiag( olhs - orhs );
7535 odres_ %= decldiag( olhs - orhs );
7536 sres_ %= decldiag( olhs - orhs );
7537 osres_ %= decldiag( olhs - orhs );
7538 refres_ %= decldiag( reflhs - refrhs );
7539 }
7540 catch( std::exception& ex ) {
7541 convertException<OMT1,OMT2>( ex );
7542 }
7543
7544 checkResults<OMT1,OMT2>();
7545 }
7546
7547 // Decldiag subtraction with Schur product assignment with evaluated matrices
7548 {
7549 test_ = "Decldiag subtraction with Schur product assignment with evaluated matrices";
7550 error_ = "Failed Schur product assignment operation";
7551
7552 try {
7553 initResults();
7554 dres_ %= decldiag( eval( lhs ) - eval( rhs ) );
7555 odres_ %= decldiag( eval( lhs ) - eval( rhs ) );
7556 sres_ %= decldiag( eval( lhs ) - eval( rhs ) );
7557 osres_ %= decldiag( eval( lhs ) - eval( rhs ) );
7558 refres_ %= decldiag( eval( reflhs ) - eval( refrhs ) );
7559 }
7560 catch( std::exception& ex ) {
7561 convertException<MT1,MT2>( ex );
7562 }
7563
7564 checkResults<MT1,MT2>();
7565
7566 try {
7567 initResults();
7568 dres_ %= decldiag( eval( lhs ) - eval( orhs ) );
7569 odres_ %= decldiag( eval( lhs ) - eval( orhs ) );
7570 sres_ %= decldiag( eval( lhs ) - eval( orhs ) );
7571 osres_ %= decldiag( eval( lhs ) - eval( orhs ) );
7572 refres_ %= decldiag( eval( reflhs ) - eval( refrhs ) );
7573 }
7574 catch( std::exception& ex ) {
7575 convertException<MT1,OMT2>( ex );
7576 }
7577
7578 checkResults<MT1,OMT2>();
7579
7580 try {
7581 initResults();
7582 dres_ %= decldiag( eval( olhs ) - eval( rhs ) );
7583 odres_ %= decldiag( eval( olhs ) - eval( rhs ) );
7584 sres_ %= decldiag( eval( olhs ) - eval( rhs ) );
7585 osres_ %= decldiag( eval( olhs ) - eval( rhs ) );
7586 refres_ %= decldiag( eval( reflhs ) - eval( refrhs ) );
7587 }
7588 catch( std::exception& ex ) {
7589 convertException<OMT1,MT2>( ex );
7590 }
7591
7592 checkResults<OMT1,MT2>();
7593
7594 try {
7595 initResults();
7596 dres_ %= decldiag( eval( olhs ) - eval( orhs ) );
7597 odres_ %= decldiag( eval( olhs ) - eval( orhs ) );
7598 sres_ %= decldiag( eval( olhs ) - eval( orhs ) );
7599 osres_ %= decldiag( eval( olhs ) - eval( orhs ) );
7600 refres_ %= decldiag( eval( reflhs ) - eval( refrhs ) );
7601 }
7602 catch( std::exception& ex ) {
7603 convertException<OMT1,OMT2>( ex );
7604 }
7605
7606 checkResults<OMT1,OMT2>();
7607 }
7608 }
7609 #endif
7610 }
7611 //*************************************************************************************************
7612
7613
7614 //*************************************************************************************************
7615 /*!\brief Skipping the diagonal sparse matrix/sparse matrix subtraction.
7616 //
7617 // \return void
7618 //
7619 // This function is called in case the diagonal matrix/matrix subtraction operation is not
7620 // available for the given matrix types \a MT1 and \a MT2.
7621 */
7622 template< typename MT1 // Type of the left-hand side sparse matrix
7623 , typename MT2 > // Type of the right-hand side sparse matrix
testDeclDiagOperation(blaze::FalseType)7624 void OperationTest<MT1,MT2>::testDeclDiagOperation( blaze::FalseType )
7625 {}
7626 //*************************************************************************************************
7627
7628
7629 //*************************************************************************************************
7630 /*!\brief Testing the submatrix-wise sparse matrix/sparse matrix subtraction.
7631 //
7632 // \return void
7633 // \exception std::runtime_error Subtraction error detected.
7634 //
7635 // This function tests the submatrix-wise matrix subtraction with plain assignment, addition
7636 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
7637 // from the subtraction or the subsequent assignment is detected, a \a std::runtime_error
7638 // exception is thrown.
7639 */
7640 template< typename MT1 // Type of the left-hand side sparse matrix
7641 , typename MT2 > // Type of the right-hand side sparse matrix
testSubmatrixOperation()7642 void OperationTest<MT1,MT2>::testSubmatrixOperation()
7643 {
7644 #if BLAZETEST_MATHTEST_TEST_SUBMATRIX_OPERATION
7645 if( BLAZETEST_MATHTEST_TEST_SUBMATRIX_OPERATION > 1 )
7646 {
7647 if( lhs_.rows() == 0UL || lhs_.columns() == 0UL )
7648 return;
7649
7650
7651 //=====================================================================================
7652 // Submatrix-wise subtraction
7653 //=====================================================================================
7654
7655 // Submatrix-wise subtraction with the given matrices
7656 {
7657 test_ = "Submatrix-wise subtraction with the given matrices";
7658 error_ = "Failed subtraction operation";
7659
7660 try {
7661 initResults();
7662 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7663 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7664 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7665 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7666 submatrix( dres_ , row, column, m, n ) = submatrix( lhs_ - rhs_ , row, column, m, n );
7667 submatrix( odres_ , row, column, m, n ) = submatrix( lhs_ - rhs_ , row, column, m, n );
7668 submatrix( sres_ , row, column, m, n ) = submatrix( lhs_ - rhs_ , row, column, m, n );
7669 submatrix( osres_ , row, column, m, n ) = submatrix( lhs_ - rhs_ , row, column, m, n );
7670 submatrix( refres_, row, column, m, n ) = submatrix( reflhs_ - refrhs_, row, column, m, n );
7671 }
7672 }
7673 }
7674 catch( std::exception& ex ) {
7675 convertException<MT1,MT2>( ex );
7676 }
7677
7678 checkResults<MT1,MT2>();
7679
7680 try {
7681 initResults();
7682 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7683 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7684 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7685 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7686 submatrix( dres_ , row, column, m, n ) = submatrix( lhs_ - orhs_ , row, column, m, n );
7687 submatrix( odres_ , row, column, m, n ) = submatrix( lhs_ - orhs_ , row, column, m, n );
7688 submatrix( sres_ , row, column, m, n ) = submatrix( lhs_ - orhs_ , row, column, m, n );
7689 submatrix( osres_ , row, column, m, n ) = submatrix( lhs_ - orhs_ , row, column, m, n );
7690 submatrix( refres_, row, column, m, n ) = submatrix( reflhs_ - refrhs_, row, column, m, n );
7691 }
7692 }
7693 }
7694 catch( std::exception& ex ) {
7695 convertException<MT1,OMT2>( ex );
7696 }
7697
7698 checkResults<MT1,OMT2>();
7699
7700 try {
7701 initResults();
7702 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7703 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7704 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7705 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7706 submatrix( dres_ , row, column, m, n ) = submatrix( olhs_ - rhs_ , row, column, m, n );
7707 submatrix( odres_ , row, column, m, n ) = submatrix( olhs_ - rhs_ , row, column, m, n );
7708 submatrix( sres_ , row, column, m, n ) = submatrix( olhs_ - rhs_ , row, column, m, n );
7709 submatrix( osres_ , row, column, m, n ) = submatrix( olhs_ - rhs_ , row, column, m, n );
7710 submatrix( refres_, row, column, m, n ) = submatrix( reflhs_ - refrhs_, row, column, m, n );
7711 }
7712 }
7713 }
7714 catch( std::exception& ex ) {
7715 convertException<OMT1,MT2>( ex );
7716 }
7717
7718 checkResults<OMT1,MT2>();
7719
7720 try {
7721 initResults();
7722 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7723 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7724 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7725 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7726 submatrix( dres_ , row, column, m, n ) = submatrix( olhs_ - orhs_ , row, column, m, n );
7727 submatrix( odres_ , row, column, m, n ) = submatrix( olhs_ - orhs_ , row, column, m, n );
7728 submatrix( sres_ , row, column, m, n ) = submatrix( olhs_ - orhs_ , row, column, m, n );
7729 submatrix( osres_ , row, column, m, n ) = submatrix( olhs_ - orhs_ , row, column, m, n );
7730 submatrix( refres_, row, column, m, n ) = submatrix( reflhs_ - refrhs_, row, column, m, n );
7731 }
7732 }
7733 }
7734 catch( std::exception& ex ) {
7735 convertException<OMT1,OMT2>( ex );
7736 }
7737
7738 checkResults<OMT1,OMT2>();
7739 }
7740
7741 // Submatrix-wise subtraction with evaluated matrices
7742 {
7743 test_ = "Submatrix-wise subtraction with evaluated matrices";
7744 error_ = "Failed subtraction operation";
7745
7746 try {
7747 initResults();
7748 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7749 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7750 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7751 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7752 submatrix( dres_ , row, column, m, n ) = submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
7753 submatrix( odres_ , row, column, m, n ) = submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
7754 submatrix( sres_ , row, column, m, n ) = submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
7755 submatrix( osres_ , row, column, m, n ) = submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
7756 submatrix( refres_, row, column, m, n ) = submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
7757 }
7758 }
7759 }
7760 catch( std::exception& ex ) {
7761 convertException<MT1,MT2>( ex );
7762 }
7763
7764 checkResults<MT1,MT2>();
7765
7766 try {
7767 initResults();
7768 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7769 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7770 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7771 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7772 submatrix( dres_ , row, column, m, n ) = submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
7773 submatrix( odres_ , row, column, m, n ) = submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
7774 submatrix( sres_ , row, column, m, n ) = submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
7775 submatrix( osres_ , row, column, m, n ) = submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
7776 submatrix( refres_, row, column, m, n ) = submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
7777 }
7778 }
7779 }
7780 catch( std::exception& ex ) {
7781 convertException<MT1,OMT2>( ex );
7782 }
7783
7784 checkResults<MT1,OMT2>();
7785
7786 try {
7787 initResults();
7788 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7789 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7790 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7791 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7792 submatrix( dres_ , row, column, m, n ) = submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
7793 submatrix( odres_ , row, column, m, n ) = submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
7794 submatrix( sres_ , row, column, m, n ) = submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
7795 submatrix( osres_ , row, column, m, n ) = submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
7796 submatrix( refres_, row, column, m, n ) = submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
7797 }
7798 }
7799 }
7800 catch( std::exception& ex ) {
7801 convertException<OMT1,MT2>( ex );
7802 }
7803
7804 checkResults<OMT1,MT2>();
7805
7806 try {
7807 initResults();
7808 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7809 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7810 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7811 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7812 submatrix( dres_ , row, column, m, n ) = submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
7813 submatrix( odres_ , row, column, m, n ) = submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
7814 submatrix( sres_ , row, column, m, n ) = submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
7815 submatrix( osres_ , row, column, m, n ) = submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
7816 submatrix( refres_, row, column, m, n ) = submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
7817 }
7818 }
7819 }
7820 catch( std::exception& ex ) {
7821 convertException<OMT1,OMT2>( ex );
7822 }
7823
7824 checkResults<OMT1,OMT2>();
7825 }
7826
7827
7828 //=====================================================================================
7829 // Submatrix-wise subtraction with addition assignment
7830 //=====================================================================================
7831
7832 // Submatrix-wise subtraction with addition assignment with the given matrices
7833 {
7834 test_ = "Submatrix-wise subtraction with addition assignment with the given matrices";
7835 error_ = "Failed addition assignment operation";
7836
7837 try {
7838 initResults();
7839 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7840 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7841 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7842 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7843 submatrix( dres_ , row, column, m, n ) += submatrix( lhs_ - rhs_ , row, column, m, n );
7844 submatrix( odres_ , row, column, m, n ) += submatrix( lhs_ - rhs_ , row, column, m, n );
7845 submatrix( sres_ , row, column, m, n ) += submatrix( lhs_ - rhs_ , row, column, m, n );
7846 submatrix( osres_ , row, column, m, n ) += submatrix( lhs_ - rhs_ , row, column, m, n );
7847 submatrix( refres_, row, column, m, n ) += submatrix( reflhs_ - refrhs_, row, column, m, n );
7848 }
7849 }
7850 }
7851 catch( std::exception& ex ) {
7852 convertException<MT1,MT2>( ex );
7853 }
7854
7855 checkResults<MT1,MT2>();
7856
7857 try {
7858 initResults();
7859 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7860 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7861 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7862 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7863 submatrix( dres_ , row, column, m, n ) += submatrix( lhs_ - orhs_ , row, column, m, n );
7864 submatrix( odres_ , row, column, m, n ) += submatrix( lhs_ - orhs_ , row, column, m, n );
7865 submatrix( sres_ , row, column, m, n ) += submatrix( lhs_ - orhs_ , row, column, m, n );
7866 submatrix( osres_ , row, column, m, n ) += submatrix( lhs_ - orhs_ , row, column, m, n );
7867 submatrix( refres_, row, column, m, n ) += submatrix( reflhs_ - refrhs_, row, column, m, n );
7868 }
7869 }
7870 }
7871 catch( std::exception& ex ) {
7872 convertException<MT1,OMT2>( ex );
7873 }
7874
7875 checkResults<MT1,OMT2>();
7876
7877 try {
7878 initResults();
7879 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7880 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7881 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7882 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7883 submatrix( dres_ , row, column, m, n ) += submatrix( olhs_ - rhs_ , row, column, m, n );
7884 submatrix( odres_ , row, column, m, n ) += submatrix( olhs_ - rhs_ , row, column, m, n );
7885 submatrix( sres_ , row, column, m, n ) += submatrix( olhs_ - rhs_ , row, column, m, n );
7886 submatrix( osres_ , row, column, m, n ) += submatrix( olhs_ - rhs_ , row, column, m, n );
7887 submatrix( refres_, row, column, m, n ) += submatrix( reflhs_ - refrhs_, row, column, m, n );
7888 }
7889 }
7890 }
7891 catch( std::exception& ex ) {
7892 convertException<OMT1,MT2>( ex );
7893 }
7894
7895 checkResults<OMT1,MT2>();
7896
7897 try {
7898 initResults();
7899 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7900 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7901 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7902 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7903 submatrix( dres_ , row, column, m, n ) += submatrix( olhs_ - orhs_ , row, column, m, n );
7904 submatrix( odres_ , row, column, m, n ) += submatrix( olhs_ - orhs_ , row, column, m, n );
7905 submatrix( sres_ , row, column, m, n ) += submatrix( olhs_ - orhs_ , row, column, m, n );
7906 submatrix( osres_ , row, column, m, n ) += submatrix( olhs_ - orhs_ , row, column, m, n );
7907 submatrix( refres_, row, column, m, n ) += submatrix( reflhs_ - refrhs_, row, column, m, n );
7908 }
7909 }
7910 }
7911 catch( std::exception& ex ) {
7912 convertException<OMT1,OMT2>( ex );
7913 }
7914
7915 checkResults<OMT1,OMT2>();
7916 }
7917
7918 // Submatrix-wise subtraction with addition assignment with evaluated matrices
7919 {
7920 test_ = "Submatrix-wise subtraction with addition assignment with evaluated matrices";
7921 error_ = "Failed addition assignment operation";
7922
7923 try {
7924 initResults();
7925 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7926 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7927 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7928 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7929 submatrix( dres_ , row, column, m, n ) += submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
7930 submatrix( odres_ , row, column, m, n ) += submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
7931 submatrix( sres_ , row, column, m, n ) += submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
7932 submatrix( osres_ , row, column, m, n ) += submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
7933 submatrix( refres_, row, column, m, n ) += submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
7934 }
7935 }
7936 }
7937 catch( std::exception& ex ) {
7938 convertException<MT1,MT2>( ex );
7939 }
7940
7941 checkResults<MT1,MT2>();
7942
7943 try {
7944 initResults();
7945 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7946 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7947 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7948 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7949 submatrix( dres_ , row, column, m, n ) += submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
7950 submatrix( odres_ , row, column, m, n ) += submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
7951 submatrix( sres_ , row, column, m, n ) += submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
7952 submatrix( osres_ , row, column, m, n ) += submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
7953 submatrix( refres_, row, column, m, n ) += submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
7954 }
7955 }
7956 }
7957 catch( std::exception& ex ) {
7958 convertException<MT1,OMT2>( ex );
7959 }
7960
7961 checkResults<MT1,OMT2>();
7962
7963 try {
7964 initResults();
7965 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7966 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7967 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
7968 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
7969 submatrix( dres_ , row, column, m, n ) += submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
7970 submatrix( odres_ , row, column, m, n ) += submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
7971 submatrix( sres_ , row, column, m, n ) += submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
7972 submatrix( osres_ , row, column, m, n ) += submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
7973 submatrix( refres_, row, column, m, n ) += submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
7974 }
7975 }
7976 }
7977 catch( std::exception& ex ) {
7978 convertException<OMT1,MT2>( ex );
7979 }
7980
7981 checkResults<OMT1,MT2>();
7982
7983 try {
7984 initResults();
7985 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
7986 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
7987 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
7988 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
7989 submatrix( dres_ , row, column, m, n ) += submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
7990 submatrix( odres_ , row, column, m, n ) += submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
7991 submatrix( sres_ , row, column, m, n ) += submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
7992 submatrix( osres_ , row, column, m, n ) += submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
7993 submatrix( refres_, row, column, m, n ) += submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
7994 }
7995 }
7996 }
7997 catch( std::exception& ex ) {
7998 convertException<OMT1,OMT2>( ex );
7999 }
8000
8001 checkResults<OMT1,OMT2>();
8002 }
8003
8004
8005 //=====================================================================================
8006 // Submatrix-wise subtraction with subtraction assignment
8007 //=====================================================================================
8008
8009 // Submatrix-wise subtraction with subtraction assignment with the given matrices
8010 {
8011 test_ = "Submatrix-wise subtraction with subtraction assignment with the given matrices";
8012 error_ = "Failed subtraction assignment operation";
8013
8014 try {
8015 initResults();
8016 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8017 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8018 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8019 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8020 submatrix( dres_ , row, column, m, n ) -= submatrix( lhs_ - rhs_ , row, column, m, n );
8021 submatrix( odres_ , row, column, m, n ) -= submatrix( lhs_ - rhs_ , row, column, m, n );
8022 submatrix( sres_ , row, column, m, n ) -= submatrix( lhs_ - rhs_ , row, column, m, n );
8023 submatrix( osres_ , row, column, m, n ) -= submatrix( lhs_ - rhs_ , row, column, m, n );
8024 submatrix( refres_, row, column, m, n ) -= submatrix( reflhs_ - refrhs_, row, column, m, n );
8025 }
8026 }
8027 }
8028 catch( std::exception& ex ) {
8029 convertException<MT1,MT2>( ex );
8030 }
8031
8032 checkResults<MT1,MT2>();
8033
8034 try {
8035 initResults();
8036 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8037 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8038 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8039 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8040 submatrix( dres_ , row, column, m, n ) -= submatrix( lhs_ - orhs_ , row, column, m, n );
8041 submatrix( odres_ , row, column, m, n ) -= submatrix( lhs_ - orhs_ , row, column, m, n );
8042 submatrix( sres_ , row, column, m, n ) -= submatrix( lhs_ - orhs_ , row, column, m, n );
8043 submatrix( osres_ , row, column, m, n ) -= submatrix( lhs_ - orhs_ , row, column, m, n );
8044 submatrix( refres_, row, column, m, n ) -= submatrix( reflhs_ - refrhs_, row, column, m, n );
8045 }
8046 }
8047 }
8048 catch( std::exception& ex ) {
8049 convertException<MT1,OMT2>( ex );
8050 }
8051
8052 checkResults<MT1,OMT2>();
8053
8054 try {
8055 initResults();
8056 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8057 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8058 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8059 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8060 submatrix( dres_ , row, column, m, n ) -= submatrix( olhs_ - rhs_ , row, column, m, n );
8061 submatrix( odres_ , row, column, m, n ) -= submatrix( olhs_ - rhs_ , row, column, m, n );
8062 submatrix( sres_ , row, column, m, n ) -= submatrix( olhs_ - rhs_ , row, column, m, n );
8063 submatrix( osres_ , row, column, m, n ) -= submatrix( olhs_ - rhs_ , row, column, m, n );
8064 submatrix( refres_, row, column, m, n ) -= submatrix( reflhs_ - refrhs_, row, column, m, n );
8065 }
8066 }
8067 }
8068 catch( std::exception& ex ) {
8069 convertException<OMT1,MT2>( ex );
8070 }
8071
8072 checkResults<OMT1,MT2>();
8073
8074 try {
8075 initResults();
8076 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8077 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8078 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8079 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8080 submatrix( dres_ , row, column, m, n ) -= submatrix( olhs_ - orhs_ , row, column, m, n );
8081 submatrix( odres_ , row, column, m, n ) -= submatrix( olhs_ - orhs_ , row, column, m, n );
8082 submatrix( sres_ , row, column, m, n ) -= submatrix( olhs_ - orhs_ , row, column, m, n );
8083 submatrix( osres_ , row, column, m, n ) -= submatrix( olhs_ - orhs_ , row, column, m, n );
8084 submatrix( refres_, row, column, m, n ) -= submatrix( reflhs_ - refrhs_, row, column, m, n );
8085 }
8086 }
8087 }
8088 catch( std::exception& ex ) {
8089 convertException<OMT1,OMT2>( ex );
8090 }
8091
8092 checkResults<OMT1,OMT2>();
8093 }
8094
8095 // Submatrix-wise subtraction with subtraction assignment with evaluated matrices
8096 {
8097 test_ = "Submatrix-wise subtraction with subtraction assignment with evaluated matrices";
8098 error_ = "Failed subtraction assignment operation";
8099
8100 try {
8101 initResults();
8102 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8103 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8104 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8105 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8106 submatrix( dres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
8107 submatrix( odres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
8108 submatrix( sres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
8109 submatrix( osres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
8110 submatrix( refres_, row, column, m, n ) -= submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
8111 }
8112 }
8113 }
8114 catch( std::exception& ex ) {
8115 convertException<MT1,MT2>( ex );
8116 }
8117
8118 checkResults<MT1,MT2>();
8119
8120 try {
8121 initResults();
8122 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8123 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8124 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8125 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8126 submatrix( dres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
8127 submatrix( odres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
8128 submatrix( sres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
8129 submatrix( osres_ , row, column, m, n ) -= submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
8130 submatrix( refres_, row, column, m, n ) -= submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
8131 }
8132 }
8133 }
8134 catch( std::exception& ex ) {
8135 convertException<MT1,OMT2>( ex );
8136 }
8137
8138 checkResults<MT1,OMT2>();
8139
8140 try {
8141 initResults();
8142 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8143 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8144 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8145 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8146 submatrix( dres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
8147 submatrix( odres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
8148 submatrix( sres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
8149 submatrix( osres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
8150 submatrix( refres_, row, column, m, n ) -= submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
8151 }
8152 }
8153 }
8154 catch( std::exception& ex ) {
8155 convertException<OMT1,MT2>( ex );
8156 }
8157
8158 checkResults<OMT1,MT2>();
8159
8160 try {
8161 initResults();
8162 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8163 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8164 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8165 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8166 submatrix( dres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
8167 submatrix( odres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
8168 submatrix( sres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
8169 submatrix( osres_ , row, column, m, n ) -= submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
8170 submatrix( refres_, row, column, m, n ) -= submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
8171 }
8172 }
8173 }
8174 catch( std::exception& ex ) {
8175 convertException<OMT1,OMT2>( ex );
8176 }
8177
8178 checkResults<OMT1,OMT2>();
8179 }
8180
8181
8182 //=====================================================================================
8183 // Submatrix-wise subtraction with Schur product assignment
8184 //=====================================================================================
8185
8186 // Submatrix-wise subtraction with Schur product assignment with the given matrices
8187 {
8188 test_ = "Submatrix-wise subtraction with Schur product assignment with the given matrices";
8189 error_ = "Failed Schur product assignment operation";
8190
8191 try {
8192 initResults();
8193 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8194 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8195 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8196 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8197 submatrix( dres_ , row, column, m, n ) %= submatrix( lhs_ - rhs_ , row, column, m, n );
8198 submatrix( odres_ , row, column, m, n ) %= submatrix( lhs_ - rhs_ , row, column, m, n );
8199 submatrix( sres_ , row, column, m, n ) %= submatrix( lhs_ - rhs_ , row, column, m, n );
8200 submatrix( osres_ , row, column, m, n ) %= submatrix( lhs_ - rhs_ , row, column, m, n );
8201 submatrix( refres_, row, column, m, n ) %= submatrix( reflhs_ - refrhs_, row, column, m, n );
8202 }
8203 }
8204 }
8205 catch( std::exception& ex ) {
8206 convertException<MT1,MT2>( ex );
8207 }
8208
8209 checkResults<MT1,MT2>();
8210
8211 try {
8212 initResults();
8213 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8214 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8215 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8216 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8217 submatrix( dres_ , row, column, m, n ) %= submatrix( lhs_ - orhs_ , row, column, m, n );
8218 submatrix( odres_ , row, column, m, n ) %= submatrix( lhs_ - orhs_ , row, column, m, n );
8219 submatrix( sres_ , row, column, m, n ) %= submatrix( lhs_ - orhs_ , row, column, m, n );
8220 submatrix( osres_ , row, column, m, n ) %= submatrix( lhs_ - orhs_ , row, column, m, n );
8221 submatrix( refres_, row, column, m, n ) %= submatrix( reflhs_ - refrhs_, row, column, m, n );
8222 }
8223 }
8224 }
8225 catch( std::exception& ex ) {
8226 convertException<MT1,OMT2>( ex );
8227 }
8228
8229 checkResults<MT1,OMT2>();
8230
8231 try {
8232 initResults();
8233 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8234 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8235 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8236 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8237 submatrix( dres_ , row, column, m, n ) %= submatrix( olhs_ - rhs_ , row, column, m, n );
8238 submatrix( odres_ , row, column, m, n ) %= submatrix( olhs_ - rhs_ , row, column, m, n );
8239 submatrix( sres_ , row, column, m, n ) %= submatrix( olhs_ - rhs_ , row, column, m, n );
8240 submatrix( osres_ , row, column, m, n ) %= submatrix( olhs_ - rhs_ , row, column, m, n );
8241 submatrix( refres_, row, column, m, n ) %= submatrix( reflhs_ - refrhs_, row, column, m, n );
8242 }
8243 }
8244 }
8245 catch( std::exception& ex ) {
8246 convertException<OMT1,MT2>( ex );
8247 }
8248
8249 checkResults<OMT1,MT2>();
8250
8251 try {
8252 initResults();
8253 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8254 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8255 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8256 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8257 submatrix( dres_ , row, column, m, n ) %= submatrix( olhs_ - orhs_ , row, column, m, n );
8258 submatrix( odres_ , row, column, m, n ) %= submatrix( olhs_ - orhs_ , row, column, m, n );
8259 submatrix( sres_ , row, column, m, n ) %= submatrix( olhs_ - orhs_ , row, column, m, n );
8260 submatrix( osres_ , row, column, m, n ) %= submatrix( olhs_ - orhs_ , row, column, m, n );
8261 submatrix( refres_, row, column, m, n ) %= submatrix( reflhs_ - refrhs_, row, column, m, n );
8262 }
8263 }
8264 }
8265 catch( std::exception& ex ) {
8266 convertException<OMT1,OMT2>( ex );
8267 }
8268
8269 checkResults<OMT1,OMT2>();
8270 }
8271
8272 // Submatrix-wise subtraction with Schur product assignment with evaluated matrices
8273 {
8274 test_ = "Submatrix-wise subtraction with Schur product assignment with evaluated matrices";
8275 error_ = "Failed Schur product assignment operation";
8276
8277 try {
8278 initResults();
8279 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8280 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8281 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8282 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8283 submatrix( dres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
8284 submatrix( odres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
8285 submatrix( sres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
8286 submatrix( osres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) - eval( rhs_ ) , row, column, m, n );
8287 submatrix( refres_, row, column, m, n ) %= submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
8288 }
8289 }
8290 }
8291 catch( std::exception& ex ) {
8292 convertException<MT1,MT2>( ex );
8293 }
8294
8295 checkResults<MT1,MT2>();
8296
8297 try {
8298 initResults();
8299 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8300 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8301 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8302 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8303 submatrix( dres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
8304 submatrix( odres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
8305 submatrix( sres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
8306 submatrix( osres_ , row, column, m, n ) %= submatrix( eval( lhs_ ) - eval( orhs_ ) , row, column, m, n );
8307 submatrix( refres_, row, column, m, n ) %= submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
8308 }
8309 }
8310 }
8311 catch( std::exception& ex ) {
8312 convertException<MT1,OMT2>( ex );
8313 }
8314
8315 checkResults<MT1,OMT2>();
8316
8317 try {
8318 initResults();
8319 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8320 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8321 for( size_t column=0UL, n=0UL; column<rhs_.columns(); column+=n ) {
8322 n = blaze::rand<size_t>( 1UL, rhs_.columns() - column );
8323 submatrix( dres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
8324 submatrix( odres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
8325 submatrix( sres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
8326 submatrix( osres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) - eval( rhs_ ) , row, column, m, n );
8327 submatrix( refres_, row, column, m, n ) %= submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
8328 }
8329 }
8330 }
8331 catch( std::exception& ex ) {
8332 convertException<OMT1,MT2>( ex );
8333 }
8334
8335 checkResults<OMT1,MT2>();
8336
8337 try {
8338 initResults();
8339 for( size_t row=0UL, m=0UL; row<lhs_.rows(); row+=m ) {
8340 m = blaze::rand<size_t>( 1UL, lhs_.rows() - row );
8341 for( size_t column=0UL, n=0UL; column<orhs_.columns(); column+=n ) {
8342 n = blaze::rand<size_t>( 1UL, orhs_.columns() - column );
8343 submatrix( dres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
8344 submatrix( odres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
8345 submatrix( sres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
8346 submatrix( osres_ , row, column, m, n ) %= submatrix( eval( olhs_ ) - eval( orhs_ ) , row, column, m, n );
8347 submatrix( refres_, row, column, m, n ) %= submatrix( eval( reflhs_ ) - eval( refrhs_ ), row, column, m, n );
8348 }
8349 }
8350 }
8351 catch( std::exception& ex ) {
8352 convertException<OMT1,OMT2>( ex );
8353 }
8354
8355 checkResults<OMT1,OMT2>();
8356 }
8357
8358
8359 //=====================================================================================
8360 // Failure cases
8361 //=====================================================================================
8362
8363 // Out-of-bounds submatrix construction (invalid number of rows)
8364 {
8365 test_ = "Out-of-bounds submatrix construction (invalid number of rows)";
8366 error_ = "Setup of out-of-bounds submatrix succeeded";
8367
8368 try {
8369 auto sm = submatrix( lhs_ - rhs_, 1UL, 0UL, lhs_.rows(), lhs_.columns() );
8370
8371 std::ostringstream oss;
8372 oss << " Test: " << test_ << "\n"
8373 << " Error: " << error_ << "\n"
8374 << " Details:\n"
8375 << " Random seed = " << blaze::getSeed() << "\n"
8376 << " Left-hand side sparse matrix type:\n"
8377 << " " << typeid( MT1 ).name() << "\n"
8378 << " Right-hand side sparse matrix type:\n"
8379 << " " << typeid( MT2 ).name() << "\n"
8380 << " Result:\n" << sm << "\n";
8381 throw std::runtime_error( oss.str() );
8382 }
8383 catch( std::invalid_argument& ex ) {
8384 checkExceptionMessage( ex, "Invalid submatrix specification" );
8385 }
8386
8387 try {
8388 auto sm = submatrix( lhs_ - orhs_, 1UL, 0UL, lhs_.rows(), lhs_.columns() );
8389
8390 std::ostringstream oss;
8391 oss << " Test: " << test_ << "\n"
8392 << " Error: " << error_ << "\n"
8393 << " Details:\n"
8394 << " Random seed = " << blaze::getSeed() << "\n"
8395 << " Left-hand side sparse matrix type:\n"
8396 << " " << typeid( MT1 ).name() << "\n"
8397 << " Right-hand side sparse matrix type:\n"
8398 << " " << typeid( OMT2 ).name() << "\n"
8399 << " Result:\n" << sm << "\n";
8400 throw std::runtime_error( oss.str() );
8401 }
8402 catch( std::invalid_argument& ex ) {
8403 checkExceptionMessage( ex, "Invalid submatrix specification" );
8404 }
8405
8406 try {
8407 auto sm = submatrix( olhs_ - rhs_, 1UL, 0UL, olhs_.rows(), olhs_.columns() );
8408
8409 std::ostringstream oss;
8410 oss << " Test: " << test_ << "\n"
8411 << " Error: " << error_ << "\n"
8412 << " Details:\n"
8413 << " Random seed = " << blaze::getSeed() << "\n"
8414 << " Left-hand side sparse matrix type:\n"
8415 << " " << typeid( OMT1 ).name() << "\n"
8416 << " Right-hand side sparse matrix type:\n"
8417 << " " << typeid( MT2 ).name() << "\n"
8418 << " Result:\n" << sm << "\n";
8419 throw std::runtime_error( oss.str() );
8420 }
8421 catch( std::invalid_argument& ex ) {
8422 checkExceptionMessage( ex, "Invalid submatrix specification" );
8423 }
8424
8425 try {
8426 auto sm = submatrix( olhs_ - orhs_, 1UL, 0UL, olhs_.rows(), olhs_.columns() );
8427
8428 std::ostringstream oss;
8429 oss << " Test: " << test_ << "\n"
8430 << " Error: " << error_ << "\n"
8431 << " Details:\n"
8432 << " Random seed = " << blaze::getSeed() << "\n"
8433 << " Left-hand side sparse matrix type:\n"
8434 << " " << typeid( OMT1 ).name() << "\n"
8435 << " Right-hand side sparse matrix type:\n"
8436 << " " << typeid( OMT2 ).name() << "\n"
8437 << " Result:\n" << sm << "\n";
8438 throw std::runtime_error( oss.str() );
8439 }
8440 catch( std::invalid_argument& ex ) {
8441 checkExceptionMessage( ex, "Invalid submatrix specification" );
8442 }
8443 }
8444
8445 // Out-of-bounds access (invalid number of columns)
8446 {
8447 test_ = "Out-of-bounds submatrix construction (invalid number of columns)";
8448 error_ = "Setup of out-of-bounds submatrix succeeded";
8449
8450 try {
8451 auto sm = submatrix( lhs_ - rhs_, 0UL, 1UL, lhs_.rows(), lhs_.columns() );
8452
8453 std::ostringstream oss;
8454 oss << " Test: " << test_ << "\n"
8455 << " Error: " << error_ << "\n"
8456 << " Details:\n"
8457 << " Random seed = " << blaze::getSeed() << "\n"
8458 << " Left-hand side sparse matrix type:\n"
8459 << " " << typeid( MT1 ).name() << "\n"
8460 << " Right-hand side sparse matrix type:\n"
8461 << " " << typeid( MT2 ).name() << "\n"
8462 << " Result:\n" << sm << "\n";
8463 throw std::runtime_error( oss.str() );
8464 }
8465 catch( std::invalid_argument& ex ) {
8466 checkExceptionMessage( ex, "Invalid submatrix specification" );
8467 }
8468
8469 try {
8470 auto sm = submatrix( lhs_ - orhs_, 0UL, 1UL, lhs_.rows(), lhs_.columns() );
8471
8472 std::ostringstream oss;
8473 oss << " Test: " << test_ << "\n"
8474 << " Error: " << error_ << "\n"
8475 << " Details:\n"
8476 << " Random seed = " << blaze::getSeed() << "\n"
8477 << " Left-hand side sparse matrix type:\n"
8478 << " " << typeid( MT1 ).name() << "\n"
8479 << " Right-hand side sparse matrix type:\n"
8480 << " " << typeid( OMT2 ).name() << "\n"
8481 << " Result:\n" << sm << "\n";
8482 throw std::runtime_error( oss.str() );
8483 }
8484 catch( std::invalid_argument& ex ) {
8485 checkExceptionMessage( ex, "Invalid submatrix specification" );
8486 }
8487
8488 try {
8489 auto sm = submatrix( olhs_ - rhs_, 0UL, 1UL, olhs_.rows(), olhs_.columns() );
8490
8491 std::ostringstream oss;
8492 oss << " Test: " << test_ << "\n"
8493 << " Error: " << error_ << "\n"
8494 << " Details:\n"
8495 << " Random seed = " << blaze::getSeed() << "\n"
8496 << " Left-hand side sparse matrix type:\n"
8497 << " " << typeid( OMT1 ).name() << "\n"
8498 << " Right-hand side sparse matrix type:\n"
8499 << " " << typeid( MT2 ).name() << "\n"
8500 << " Result:\n" << sm << "\n";
8501 throw std::runtime_error( oss.str() );
8502 }
8503 catch( std::invalid_argument& ex ) {
8504 checkExceptionMessage( ex, "Invalid submatrix specification" );
8505 }
8506
8507 try {
8508 auto sm = submatrix( olhs_ - orhs_, 0UL, 1UL, olhs_.rows(), olhs_.columns() );
8509
8510 std::ostringstream oss;
8511 oss << " Test: " << test_ << "\n"
8512 << " Error: " << error_ << "\n"
8513 << " Details:\n"
8514 << " Random seed = " << blaze::getSeed() << "\n"
8515 << " Left-hand side sparse matrix type:\n"
8516 << " " << typeid( OMT1 ).name() << "\n"
8517 << " Right-hand side sparse matrix type:\n"
8518 << " " << typeid( OMT2 ).name() << "\n"
8519 << " Result:\n" << sm << "\n";
8520 throw std::runtime_error( oss.str() );
8521 }
8522 catch( std::invalid_argument& ex ) {
8523 checkExceptionMessage( ex, "Invalid submatrix specification" );
8524 }
8525 }
8526
8527 // Out-of-bounds access (invalid row index)
8528 {
8529 test_ = "Out-of-bounds submatrix construction (invalid row index)";
8530 error_ = "Setup of out-of-bounds submatrix succeeded";
8531
8532 try {
8533 auto sm = submatrix( lhs_ - rhs_, lhs_.rows(), 0UL, 1UL, lhs_.columns() );
8534
8535 std::ostringstream oss;
8536 oss << " Test: " << test_ << "\n"
8537 << " Error: " << error_ << "\n"
8538 << " Details:\n"
8539 << " Random seed = " << blaze::getSeed() << "\n"
8540 << " Left-hand side sparse matrix type:\n"
8541 << " " << typeid( MT1 ).name() << "\n"
8542 << " Right-hand side sparse matrix type:\n"
8543 << " " << typeid( MT2 ).name() << "\n"
8544 << " Result:\n" << sm << "\n";
8545 throw std::runtime_error( oss.str() );
8546 }
8547 catch( std::invalid_argument& ex ) {
8548 checkExceptionMessage( ex, "Invalid submatrix specification" );
8549 }
8550
8551 try {
8552 auto sm = submatrix( lhs_ - orhs_, lhs_.rows(), 0UL, 1UL, lhs_.columns() );
8553
8554 std::ostringstream oss;
8555 oss << " Test: " << test_ << "\n"
8556 << " Error: " << error_ << "\n"
8557 << " Details:\n"
8558 << " Random seed = " << blaze::getSeed() << "\n"
8559 << " Left-hand side sparse matrix type:\n"
8560 << " " << typeid( MT1 ).name() << "\n"
8561 << " Right-hand side sparse matrix type:\n"
8562 << " " << typeid( OMT2 ).name() << "\n"
8563 << " Result:\n" << sm << "\n";
8564 throw std::runtime_error( oss.str() );
8565 }
8566 catch( std::invalid_argument& ex ) {
8567 checkExceptionMessage( ex, "Invalid submatrix specification" );
8568 }
8569
8570 try {
8571 auto sm = submatrix( olhs_ - rhs_, olhs_.rows(), 0UL, 1UL, olhs_.columns() );
8572
8573 std::ostringstream oss;
8574 oss << " Test: " << test_ << "\n"
8575 << " Error: " << error_ << "\n"
8576 << " Details:\n"
8577 << " Random seed = " << blaze::getSeed() << "\n"
8578 << " Left-hand side sparse matrix type:\n"
8579 << " " << typeid( OMT1 ).name() << "\n"
8580 << " Right-hand side sparse matrix type:\n"
8581 << " " << typeid( MT2 ).name() << "\n"
8582 << " Result:\n" << sm << "\n";
8583 throw std::runtime_error( oss.str() );
8584 }
8585 catch( std::invalid_argument& ex ) {
8586 checkExceptionMessage( ex, "Invalid submatrix specification" );
8587 }
8588
8589 try {
8590 auto sm = submatrix( olhs_ - orhs_, olhs_.rows(), 0UL, 1UL, olhs_.columns() );
8591
8592 std::ostringstream oss;
8593 oss << " Test: " << test_ << "\n"
8594 << " Error: " << error_ << "\n"
8595 << " Details:\n"
8596 << " Random seed = " << blaze::getSeed() << "\n"
8597 << " Left-hand side sparse matrix type:\n"
8598 << " " << typeid( OMT1 ).name() << "\n"
8599 << " Right-hand side sparse matrix type:\n"
8600 << " " << typeid( OMT2 ).name() << "\n"
8601 << " Result:\n" << sm << "\n";
8602 throw std::runtime_error( oss.str() );
8603 }
8604 catch( std::invalid_argument& ex ) {
8605 checkExceptionMessage( ex, "Invalid submatrix specification" );
8606 }
8607 }
8608
8609 // Out-of-bounds access (invalid column index)
8610 {
8611 test_ = "Out-of-bounds submatrix construction (invalid column index)";
8612 error_ = "Setup of out-of-bounds submatrix succeeded";
8613
8614 try {
8615 auto sm = submatrix( lhs_ - rhs_, 0UL, lhs_.columns(), lhs_.rows(), 1UL );
8616
8617 std::ostringstream oss;
8618 oss << " Test: " << test_ << "\n"
8619 << " Error: " << error_ << "\n"
8620 << " Details:\n"
8621 << " Random seed = " << blaze::getSeed() << "\n"
8622 << " Left-hand side sparse matrix type:\n"
8623 << " " << typeid( MT1 ).name() << "\n"
8624 << " Right-hand side sparse matrix type:\n"
8625 << " " << typeid( MT2 ).name() << "\n"
8626 << " Result:\n" << sm << "\n";
8627 throw std::runtime_error( oss.str() );
8628 }
8629 catch( std::invalid_argument& ex ) {
8630 checkExceptionMessage( ex, "Invalid submatrix specification" );
8631 }
8632
8633 try {
8634 auto sm = submatrix( lhs_ - orhs_, 0UL, lhs_.columns(), lhs_.rows(), 1UL );
8635
8636 std::ostringstream oss;
8637 oss << " Test: " << test_ << "\n"
8638 << " Error: " << error_ << "\n"
8639 << " Details:\n"
8640 << " Random seed = " << blaze::getSeed() << "\n"
8641 << " Left-hand side sparse matrix type:\n"
8642 << " " << typeid( MT1 ).name() << "\n"
8643 << " Right-hand side sparse matrix type:\n"
8644 << " " << typeid( OMT2 ).name() << "\n"
8645 << " Result:\n" << sm << "\n";
8646 throw std::runtime_error( oss.str() );
8647 }
8648 catch( std::invalid_argument& ex ) {
8649 checkExceptionMessage( ex, "Invalid submatrix specification" );
8650 }
8651
8652 try {
8653 auto sm = submatrix( olhs_ - rhs_, 0UL, olhs_.columns(), olhs_.rows(), 1UL );
8654
8655 std::ostringstream oss;
8656 oss << " Test: " << test_ << "\n"
8657 << " Error: " << error_ << "\n"
8658 << " Details:\n"
8659 << " Random seed = " << blaze::getSeed() << "\n"
8660 << " Left-hand side sparse matrix type:\n"
8661 << " " << typeid( OMT1 ).name() << "\n"
8662 << " Right-hand side sparse matrix type:\n"
8663 << " " << typeid( MT2 ).name() << "\n"
8664 << " Result:\n" << sm << "\n";
8665 throw std::runtime_error( oss.str() );
8666 }
8667 catch( std::invalid_argument& ex ) {
8668 checkExceptionMessage( ex, "Invalid submatrix specification" );
8669 }
8670
8671 try {
8672 auto sm = submatrix( olhs_ - orhs_, 0UL, olhs_.columns(), olhs_.rows(), 1UL );
8673
8674 std::ostringstream oss;
8675 oss << " Test: " << test_ << "\n"
8676 << " Error: " << error_ << "\n"
8677 << " Details:\n"
8678 << " Random seed = " << blaze::getSeed() << "\n"
8679 << " Left-hand side sparse matrix type:\n"
8680 << " " << typeid( OMT1 ).name() << "\n"
8681 << " Right-hand side sparse matrix type:\n"
8682 << " " << typeid( OMT2 ).name() << "\n"
8683 << " Result:\n" << sm << "\n";
8684 throw std::runtime_error( oss.str() );
8685 }
8686 catch( std::invalid_argument& ex ) {
8687 checkExceptionMessage( ex, "Invalid submatrix specification" );
8688 }
8689 }
8690 }
8691 #endif
8692 }
8693 //*************************************************************************************************
8694
8695
8696 //*************************************************************************************************
8697 /*!\brief Testing the row-wise sparse matrix/sparse matrix subtraction.
8698 //
8699 // \return void
8700 // \exception std::runtime_error Subtraction error detected.
8701 //
8702 // This function tests the row-wise matrix subtraction with plain assignment, addition assignment,
8703 // subtraction assignment, and multiplication assignment. In case any error resulting from the
8704 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
8705 // thrown.
8706 */
8707 template< typename MT1 // Type of the left-hand side sparse matrix
8708 , typename MT2 > // Type of the right-hand side sparse matrix
testRowOperation()8709 void OperationTest<MT1,MT2>::testRowOperation()
8710 {
8711 #if BLAZETEST_MATHTEST_TEST_ROW_OPERATION
8712 if( BLAZETEST_MATHTEST_TEST_ROW_OPERATION > 1 )
8713 {
8714 if( lhs_.rows() == 0UL )
8715 return;
8716
8717
8718 //=====================================================================================
8719 // Row-wise subtraction
8720 //=====================================================================================
8721
8722 // Row-wise subtraction with the given matrices
8723 {
8724 test_ = "Row-wise subtraction with the given matrices";
8725 error_ = "Failed subtraction operation";
8726
8727 try {
8728 initResults();
8729 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8730 row( dres_ , i ) = row( lhs_ - rhs_, i );
8731 row( odres_ , i ) = row( lhs_ - rhs_, i );
8732 row( sres_ , i ) = row( lhs_ - rhs_, i );
8733 row( osres_ , i ) = row( lhs_ - rhs_, i );
8734 row( refres_, i ) = row( reflhs_ - refrhs_, i );
8735 }
8736 }
8737 catch( std::exception& ex ) {
8738 convertException<MT1,MT2>( ex );
8739 }
8740
8741 checkResults<MT1,MT2>();
8742
8743 try {
8744 initResults();
8745 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8746 row( dres_ , i ) = row( lhs_ - orhs_, i );
8747 row( odres_ , i ) = row( lhs_ - orhs_, i );
8748 row( sres_ , i ) = row( lhs_ - orhs_, i );
8749 row( osres_ , i ) = row( lhs_ - orhs_, i );
8750 row( refres_, i ) = row( reflhs_ - refrhs_, i );
8751 }
8752 }
8753 catch( std::exception& ex ) {
8754 convertException<MT1,OMT2>( ex );
8755 }
8756
8757 checkResults<MT1,OMT2>();
8758
8759 try {
8760 initResults();
8761 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8762 row( dres_ , i ) = row( olhs_ - rhs_, i );
8763 row( odres_ , i ) = row( olhs_ - rhs_, i );
8764 row( sres_ , i ) = row( olhs_ - rhs_, i );
8765 row( osres_ , i ) = row( olhs_ - rhs_, i );
8766 row( refres_, i ) = row( reflhs_ - refrhs_, i );
8767 }
8768 }
8769 catch( std::exception& ex ) {
8770 convertException<OMT1,MT2>( ex );
8771 }
8772
8773 checkResults<OMT1,MT2>();
8774
8775 try {
8776 initResults();
8777 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8778 row( dres_ , i ) = row( olhs_ - orhs_, i );
8779 row( odres_ , i ) = row( olhs_ - orhs_, i );
8780 row( sres_ , i ) = row( olhs_ - orhs_, i );
8781 row( osres_ , i ) = row( olhs_ - orhs_, i );
8782 row( refres_, i ) = row( reflhs_ - refrhs_, i );
8783 }
8784 }
8785 catch( std::exception& ex ) {
8786 convertException<OMT1,OMT2>( ex );
8787 }
8788
8789 checkResults<OMT1,OMT2>();
8790 }
8791
8792 // Row-wise subtraction with evaluated matrices
8793 {
8794 test_ = "Row-wise subtraction with evaluated matrices";
8795 error_ = "Failed subtraction operation";
8796
8797 try {
8798 initResults();
8799 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8800 row( dres_ , i ) = row( eval( lhs_ ) - eval( rhs_ ), i );
8801 row( odres_ , i ) = row( eval( lhs_ ) - eval( rhs_ ), i );
8802 row( sres_ , i ) = row( eval( lhs_ ) - eval( rhs_ ), i );
8803 row( osres_ , i ) = row( eval( lhs_ ) - eval( rhs_ ), i );
8804 row( refres_, i ) = row( eval( reflhs_ ) - eval( refrhs_ ), i );
8805 }
8806 }
8807 catch( std::exception& ex ) {
8808 convertException<MT1,MT2>( ex );
8809 }
8810
8811 checkResults<MT1,MT2>();
8812
8813 try {
8814 initResults();
8815 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8816 row( dres_ , i ) = row( eval( lhs_ ) - eval( orhs_ ), i );
8817 row( odres_ , i ) = row( eval( lhs_ ) - eval( orhs_ ), i );
8818 row( sres_ , i ) = row( eval( lhs_ ) - eval( orhs_ ), i );
8819 row( osres_ , i ) = row( eval( lhs_ ) - eval( orhs_ ), i );
8820 row( refres_, i ) = row( eval( reflhs_ ) - eval( refrhs_ ), i );
8821 }
8822 }
8823 catch( std::exception& ex ) {
8824 convertException<MT1,OMT2>( ex );
8825 }
8826
8827 checkResults<MT1,OMT2>();
8828
8829 try {
8830 initResults();
8831 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8832 row( dres_ , i ) = row( eval( olhs_ ) - eval( rhs_ ), i );
8833 row( odres_ , i ) = row( eval( olhs_ ) - eval( rhs_ ), i );
8834 row( sres_ , i ) = row( eval( olhs_ ) - eval( rhs_ ), i );
8835 row( osres_ , i ) = row( eval( olhs_ ) - eval( rhs_ ), i );
8836 row( refres_, i ) = row( eval( reflhs_ ) - eval( refrhs_ ), i );
8837 }
8838 }
8839 catch( std::exception& ex ) {
8840 convertException<OMT1,MT2>( ex );
8841 }
8842
8843 checkResults<OMT1,MT2>();
8844
8845 try {
8846 initResults();
8847 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8848 row( dres_ , i ) = row( eval( olhs_ ) - eval( orhs_ ), i );
8849 row( odres_ , i ) = row( eval( olhs_ ) - eval( orhs_ ), i );
8850 row( sres_ , i ) = row( eval( olhs_ ) - eval( orhs_ ), i );
8851 row( osres_ , i ) = row( eval( olhs_ ) - eval( orhs_ ), i );
8852 row( refres_, i ) = row( eval( reflhs_ ) - eval( refrhs_ ), i );
8853 }
8854 }
8855 catch( std::exception& ex ) {
8856 convertException<OMT1,OMT2>( ex );
8857 }
8858
8859 checkResults<OMT1,OMT2>();
8860 }
8861
8862
8863 //=====================================================================================
8864 // Row-wise subtraction with addition assignment
8865 //=====================================================================================
8866
8867 // Row-wise subtraction with addition assignment with the given matrices
8868 {
8869 test_ = "Row-wise subtraction with addition assignment with the given matrices";
8870 error_ = "Failed addition assignment operation";
8871
8872 try {
8873 initResults();
8874 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8875 row( dres_ , i ) += row( lhs_ - rhs_, i );
8876 row( odres_ , i ) += row( lhs_ - rhs_, i );
8877 row( sres_ , i ) += row( lhs_ - rhs_, i );
8878 row( osres_ , i ) += row( lhs_ - rhs_, i );
8879 row( refres_, i ) += row( reflhs_ - refrhs_, i );
8880 }
8881 }
8882 catch( std::exception& ex ) {
8883 convertException<MT1,MT2>( ex );
8884 }
8885
8886 checkResults<MT1,MT2>();
8887
8888 try {
8889 initResults();
8890 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8891 row( dres_ , i ) += row( lhs_ - orhs_, i );
8892 row( odres_ , i ) += row( lhs_ - orhs_, i );
8893 row( sres_ , i ) += row( lhs_ - orhs_, i );
8894 row( osres_ , i ) += row( lhs_ - orhs_, i );
8895 row( refres_, i ) += row( reflhs_ - refrhs_, i );
8896 }
8897 }
8898 catch( std::exception& ex ) {
8899 convertException<MT1,OMT2>( ex );
8900 }
8901
8902 checkResults<MT1,OMT2>();
8903
8904 try {
8905 initResults();
8906 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8907 row( dres_ , i ) += row( olhs_ - rhs_, i );
8908 row( odres_ , i ) += row( olhs_ - rhs_, i );
8909 row( sres_ , i ) += row( olhs_ - rhs_, i );
8910 row( osres_ , i ) += row( olhs_ - rhs_, i );
8911 row( refres_, i ) += row( reflhs_ - refrhs_, i );
8912 }
8913 }
8914 catch( std::exception& ex ) {
8915 convertException<OMT1,MT2>( ex );
8916 }
8917
8918 checkResults<OMT1,MT2>();
8919
8920 try {
8921 initResults();
8922 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8923 row( dres_ , i ) += row( olhs_ - orhs_, i );
8924 row( odres_ , i ) += row( olhs_ - orhs_, i );
8925 row( sres_ , i ) += row( olhs_ - orhs_, i );
8926 row( osres_ , i ) += row( olhs_ - orhs_, i );
8927 row( refres_, i ) += row( reflhs_ - refrhs_, i );
8928 }
8929 }
8930 catch( std::exception& ex ) {
8931 convertException<OMT1,OMT2>( ex );
8932 }
8933
8934 checkResults<OMT1,OMT2>();
8935 }
8936
8937 // Row-wise subtraction with addition assignment with evaluated matrices
8938 {
8939 test_ = "Row-wise subtraction with addition assignment with evaluated matrices";
8940 error_ = "Failed addition assignment operation";
8941
8942 try {
8943 initResults();
8944 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8945 row( dres_ , i ) += row( eval( lhs_ ) - eval( rhs_ ), i );
8946 row( odres_ , i ) += row( eval( lhs_ ) - eval( rhs_ ), i );
8947 row( sres_ , i ) += row( eval( lhs_ ) - eval( rhs_ ), i );
8948 row( osres_ , i ) += row( eval( lhs_ ) - eval( rhs_ ), i );
8949 row( refres_, i ) += row( eval( reflhs_ ) - eval( refrhs_ ), i );
8950 }
8951 }
8952 catch( std::exception& ex ) {
8953 convertException<MT1,MT2>( ex );
8954 }
8955
8956 checkResults<MT1,MT2>();
8957
8958 try {
8959 initResults();
8960 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8961 row( dres_ , i ) += row( eval( lhs_ ) - eval( orhs_ ), i );
8962 row( odres_ , i ) += row( eval( lhs_ ) - eval( orhs_ ), i );
8963 row( sres_ , i ) += row( eval( lhs_ ) - eval( orhs_ ), i );
8964 row( osres_ , i ) += row( eval( lhs_ ) - eval( orhs_ ), i );
8965 row( refres_, i ) += row( eval( reflhs_ ) - eval( refrhs_ ), i );
8966 }
8967 }
8968 catch( std::exception& ex ) {
8969 convertException<MT1,OMT2>( ex );
8970 }
8971
8972 checkResults<MT1,OMT2>();
8973
8974 try {
8975 initResults();
8976 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8977 row( dres_ , i ) += row( eval( olhs_ ) - eval( rhs_ ), i );
8978 row( odres_ , i ) += row( eval( olhs_ ) - eval( rhs_ ), i );
8979 row( sres_ , i ) += row( eval( olhs_ ) - eval( rhs_ ), i );
8980 row( osres_ , i ) += row( eval( olhs_ ) - eval( rhs_ ), i );
8981 row( refres_, i ) += row( eval( reflhs_ ) - eval( refrhs_ ), i );
8982 }
8983 }
8984 catch( std::exception& ex ) {
8985 convertException<OMT1,MT2>( ex );
8986 }
8987
8988 checkResults<OMT1,MT2>();
8989
8990 try {
8991 initResults();
8992 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
8993 row( dres_ , i ) += row( eval( olhs_ ) - eval( orhs_ ), i );
8994 row( odres_ , i ) += row( eval( olhs_ ) - eval( orhs_ ), i );
8995 row( sres_ , i ) += row( eval( olhs_ ) - eval( orhs_ ), i );
8996 row( osres_ , i ) += row( eval( olhs_ ) - eval( orhs_ ), i );
8997 row( refres_, i ) += row( eval( reflhs_ ) - eval( refrhs_ ), i );
8998 }
8999 }
9000 catch( std::exception& ex ) {
9001 convertException<OMT1,OMT2>( ex );
9002 }
9003
9004 checkResults<OMT1,OMT2>();
9005 }
9006
9007
9008 //=====================================================================================
9009 // Row-wise subtraction with subtraction assignment
9010 //=====================================================================================
9011
9012 // Row-wise subtraction with subtraction assignment with the given matrices
9013 {
9014 test_ = "Row-wise subtraction with subtraction assignment with the given matrices";
9015 error_ = "Failed subtraction assignment operation";
9016
9017 try {
9018 initResults();
9019 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9020 row( dres_ , i ) -= row( lhs_ - rhs_, i );
9021 row( odres_ , i ) -= row( lhs_ - rhs_, i );
9022 row( sres_ , i ) -= row( lhs_ - rhs_, i );
9023 row( osres_ , i ) -= row( lhs_ - rhs_, i );
9024 row( refres_, i ) -= row( reflhs_ - refrhs_, i );
9025 }
9026 }
9027 catch( std::exception& ex ) {
9028 convertException<MT1,MT2>( ex );
9029 }
9030
9031 checkResults<MT1,MT2>();
9032
9033 try {
9034 initResults();
9035 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9036 row( dres_ , i ) -= row( lhs_ - orhs_, i );
9037 row( odres_ , i ) -= row( lhs_ - orhs_, i );
9038 row( sres_ , i ) -= row( lhs_ - orhs_, i );
9039 row( osres_ , i ) -= row( lhs_ - orhs_, i );
9040 row( refres_, i ) -= row( reflhs_ - refrhs_, i );
9041 }
9042 }
9043 catch( std::exception& ex ) {
9044 convertException<MT1,OMT2>( ex );
9045 }
9046
9047 checkResults<MT1,OMT2>();
9048
9049 try {
9050 initResults();
9051 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9052 row( dres_ , i ) -= row( olhs_ - rhs_, i );
9053 row( odres_ , i ) -= row( olhs_ - rhs_, i );
9054 row( sres_ , i ) -= row( olhs_ - rhs_, i );
9055 row( osres_ , i ) -= row( olhs_ - rhs_, i );
9056 row( refres_, i ) -= row( reflhs_ - refrhs_, i );
9057 }
9058 }
9059 catch( std::exception& ex ) {
9060 convertException<OMT1,MT2>( ex );
9061 }
9062
9063 checkResults<OMT1,MT2>();
9064
9065 try {
9066 initResults();
9067 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9068 row( dres_ , i ) -= row( olhs_ - orhs_, i );
9069 row( odres_ , i ) -= row( olhs_ - orhs_, i );
9070 row( sres_ , i ) -= row( olhs_ - orhs_, i );
9071 row( osres_ , i ) -= row( olhs_ - orhs_, i );
9072 row( refres_, i ) -= row( reflhs_ - refrhs_, i );
9073 }
9074 }
9075 catch( std::exception& ex ) {
9076 convertException<OMT1,OMT2>( ex );
9077 }
9078
9079 checkResults<OMT1,OMT2>();
9080 }
9081
9082 // Row-wise subtraction with subtraction assignment with evaluated matrices
9083 {
9084 test_ = "Row-wise subtraction with subtraction assignment with evaluated matrices";
9085 error_ = "Failed subtraction assignment operation";
9086
9087 try {
9088 initResults();
9089 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9090 row( dres_ , i ) -= row( eval( lhs_ ) - eval( rhs_ ), i );
9091 row( odres_ , i ) -= row( eval( lhs_ ) - eval( rhs_ ), i );
9092 row( sres_ , i ) -= row( eval( lhs_ ) - eval( rhs_ ), i );
9093 row( osres_ , i ) -= row( eval( lhs_ ) - eval( rhs_ ), i );
9094 row( refres_, i ) -= row( eval( reflhs_ ) - eval( refrhs_ ), i );
9095 }
9096 }
9097 catch( std::exception& ex ) {
9098 convertException<MT1,MT2>( ex );
9099 }
9100
9101 checkResults<MT1,MT2>();
9102
9103 try {
9104 initResults();
9105 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9106 row( dres_ , i ) -= row( eval( lhs_ ) - eval( orhs_ ), i );
9107 row( odres_ , i ) -= row( eval( lhs_ ) - eval( orhs_ ), i );
9108 row( sres_ , i ) -= row( eval( lhs_ ) - eval( orhs_ ), i );
9109 row( osres_ , i ) -= row( eval( lhs_ ) - eval( orhs_ ), i );
9110 row( refres_, i ) -= row( eval( reflhs_ ) - eval( refrhs_ ), i );
9111 }
9112 }
9113 catch( std::exception& ex ) {
9114 convertException<MT1,OMT2>( ex );
9115 }
9116
9117 checkResults<MT1,OMT2>();
9118
9119 try {
9120 initResults();
9121 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9122 row( dres_ , i ) -= row( eval( olhs_ ) - eval( rhs_ ), i );
9123 row( odres_ , i ) -= row( eval( olhs_ ) - eval( rhs_ ), i );
9124 row( sres_ , i ) -= row( eval( olhs_ ) - eval( rhs_ ), i );
9125 row( osres_ , i ) -= row( eval( olhs_ ) - eval( rhs_ ), i );
9126 row( refres_, i ) -= row( eval( reflhs_ ) - eval( refrhs_ ), i );
9127 }
9128 }
9129 catch( std::exception& ex ) {
9130 convertException<OMT1,MT2>( ex );
9131 }
9132
9133 checkResults<OMT1,MT2>();
9134
9135 try {
9136 initResults();
9137 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9138 row( dres_ , i ) -= row( eval( olhs_ ) - eval( orhs_ ), i );
9139 row( odres_ , i ) -= row( eval( olhs_ ) - eval( orhs_ ), i );
9140 row( sres_ , i ) -= row( eval( olhs_ ) - eval( orhs_ ), i );
9141 row( osres_ , i ) -= row( eval( olhs_ ) - eval( orhs_ ), i );
9142 row( refres_, i ) -= row( eval( reflhs_ ) - eval( refrhs_ ), i );
9143 }
9144 }
9145 catch( std::exception& ex ) {
9146 convertException<OMT1,OMT2>( ex );
9147 }
9148
9149 checkResults<OMT1,OMT2>();
9150 }
9151
9152
9153 //=====================================================================================
9154 // Row-wise subtraction with multiplication assignment
9155 //=====================================================================================
9156
9157 // Row-wise subtraction with multiplication assignment with the given matrices
9158 {
9159 test_ = "Row-wise subtraction with multiplication assignment with the given matrices";
9160 error_ = "Failed multiplication assignment operation";
9161
9162 try {
9163 initResults();
9164 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9165 row( dres_ , i ) *= row( lhs_ - rhs_, i );
9166 row( odres_ , i ) *= row( lhs_ - rhs_, i );
9167 row( sres_ , i ) *= row( lhs_ - rhs_, i );
9168 row( osres_ , i ) *= row( lhs_ - rhs_, i );
9169 row( refres_, i ) *= row( reflhs_ - refrhs_, i );
9170 }
9171 }
9172 catch( std::exception& ex ) {
9173 convertException<MT1,MT2>( ex );
9174 }
9175
9176 checkResults<MT1,MT2>();
9177
9178 try {
9179 initResults();
9180 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9181 row( dres_ , i ) *= row( lhs_ - orhs_, i );
9182 row( odres_ , i ) *= row( lhs_ - orhs_, i );
9183 row( sres_ , i ) *= row( lhs_ - orhs_, i );
9184 row( osres_ , i ) *= row( lhs_ - orhs_, i );
9185 row( refres_, i ) *= row( reflhs_ - refrhs_, i );
9186 }
9187 }
9188 catch( std::exception& ex ) {
9189 convertException<MT1,OMT2>( ex );
9190 }
9191
9192 checkResults<MT1,OMT2>();
9193
9194 try {
9195 initResults();
9196 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9197 row( dres_ , i ) *= row( olhs_ - rhs_, i );
9198 row( odres_ , i ) *= row( olhs_ - rhs_, i );
9199 row( sres_ , i ) *= row( olhs_ - rhs_, i );
9200 row( osres_ , i ) *= row( olhs_ - rhs_, i );
9201 row( refres_, i ) *= row( reflhs_ - refrhs_, i );
9202 }
9203 }
9204 catch( std::exception& ex ) {
9205 convertException<OMT1,MT2>( ex );
9206 }
9207
9208 checkResults<OMT1,MT2>();
9209
9210 try {
9211 initResults();
9212 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9213 row( dres_ , i ) *= row( olhs_ - orhs_, i );
9214 row( odres_ , i ) *= row( olhs_ - orhs_, i );
9215 row( sres_ , i ) *= row( olhs_ - orhs_, i );
9216 row( osres_ , i ) *= row( olhs_ - orhs_, i );
9217 row( refres_, i ) *= row( reflhs_ - refrhs_, i );
9218 }
9219 }
9220 catch( std::exception& ex ) {
9221 convertException<OMT1,OMT2>( ex );
9222 }
9223
9224 checkResults<OMT1,OMT2>();
9225 }
9226
9227 // Row-wise subtraction with multiplication assignment with evaluated matrices
9228 {
9229 test_ = "Row-wise subtraction with multiplication assignment with evaluated matrices";
9230 error_ = "Failed multiplication assignment operation";
9231
9232 try {
9233 initResults();
9234 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9235 row( dres_ , i ) *= row( eval( lhs_ ) - eval( rhs_ ), i );
9236 row( odres_ , i ) *= row( eval( lhs_ ) - eval( rhs_ ), i );
9237 row( sres_ , i ) *= row( eval( lhs_ ) - eval( rhs_ ), i );
9238 row( osres_ , i ) *= row( eval( lhs_ ) - eval( rhs_ ), i );
9239 row( refres_, i ) *= row( eval( reflhs_ ) - eval( refrhs_ ), i );
9240 }
9241 }
9242 catch( std::exception& ex ) {
9243 convertException<MT1,MT2>( ex );
9244 }
9245
9246 checkResults<MT1,MT2>();
9247
9248 try {
9249 initResults();
9250 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9251 row( dres_ , i ) *= row( eval( lhs_ ) - eval( orhs_ ), i );
9252 row( odres_ , i ) *= row( eval( lhs_ ) - eval( orhs_ ), i );
9253 row( sres_ , i ) *= row( eval( lhs_ ) - eval( orhs_ ), i );
9254 row( osres_ , i ) *= row( eval( lhs_ ) - eval( orhs_ ), i );
9255 row( refres_, i ) *= row( eval( reflhs_ ) - eval( refrhs_ ), i );
9256 }
9257 }
9258 catch( std::exception& ex ) {
9259 convertException<MT1,OMT2>( ex );
9260 }
9261
9262 checkResults<MT1,OMT2>();
9263
9264 try {
9265 initResults();
9266 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9267 row( dres_ , i ) *= row( eval( olhs_ ) - eval( rhs_ ), i );
9268 row( odres_ , i ) *= row( eval( olhs_ ) - eval( rhs_ ), i );
9269 row( sres_ , i ) *= row( eval( olhs_ ) - eval( rhs_ ), i );
9270 row( osres_ , i ) *= row( eval( olhs_ ) - eval( rhs_ ), i );
9271 row( refres_, i ) *= row( eval( reflhs_ ) - eval( refrhs_ ), i );
9272 }
9273 }
9274 catch( std::exception& ex ) {
9275 convertException<OMT1,MT2>( ex );
9276 }
9277
9278 checkResults<OMT1,MT2>();
9279
9280 try {
9281 initResults();
9282 for( size_t i=0UL; i<lhs_.rows(); ++i ) {
9283 row( dres_ , i ) *= row( eval( olhs_ ) - eval( orhs_ ), i );
9284 row( odres_ , i ) *= row( eval( olhs_ ) - eval( orhs_ ), i );
9285 row( sres_ , i ) *= row( eval( olhs_ ) - eval( orhs_ ), i );
9286 row( osres_ , i ) *= row( eval( olhs_ ) - eval( orhs_ ), i );
9287 row( refres_, i ) *= row( eval( reflhs_ ) - eval( refrhs_ ), i );
9288 }
9289 }
9290 catch( std::exception& ex ) {
9291 convertException<OMT1,OMT2>( ex );
9292 }
9293
9294 checkResults<OMT1,OMT2>();
9295 }
9296
9297
9298 //=====================================================================================
9299 // Failure cases
9300 //=====================================================================================
9301
9302 // Out-of-bounds access (invalid row index)
9303 {
9304 test_ = "Out-of-bounds row construction (invalid row index)";
9305 error_ = "Setup of out-of-bounds row succeeded";
9306
9307 try {
9308 auto r = row( lhs_ - rhs_, lhs_.rows() );
9309
9310 std::ostringstream oss;
9311 oss << " Test: " << test_ << "\n"
9312 << " Error: " << error_ << "\n"
9313 << " Details:\n"
9314 << " Random seed = " << blaze::getSeed() << "\n"
9315 << " Left-hand side sparse matrix type:\n"
9316 << " " << typeid( MT1 ).name() << "\n"
9317 << " Right-hand side sparse matrix type:\n"
9318 << " " << typeid( MT2 ).name() << "\n"
9319 << " Result:\n" << r << "\n";
9320 throw std::runtime_error( oss.str() );
9321 }
9322 catch( std::invalid_argument& ex ) {
9323 checkExceptionMessage( ex, "Invalid row access index" );
9324 }
9325
9326 try {
9327 auto r = row( lhs_ - orhs_, lhs_.rows() );
9328
9329 std::ostringstream oss;
9330 oss << " Test: " << test_ << "\n"
9331 << " Error: " << error_ << "\n"
9332 << " Details:\n"
9333 << " Random seed = " << blaze::getSeed() << "\n"
9334 << " Left-hand side sparse matrix type:\n"
9335 << " " << typeid( MT1 ).name() << "\n"
9336 << " Right-hand side sparse matrix type:\n"
9337 << " " << typeid( OMT2 ).name() << "\n"
9338 << " Result:\n" << r << "\n";
9339 throw std::runtime_error( oss.str() );
9340 }
9341 catch( std::invalid_argument& ex ) {
9342 checkExceptionMessage( ex, "Invalid row access index" );
9343 }
9344
9345 try {
9346 auto r = row( olhs_ - rhs_, olhs_.rows() );
9347
9348 std::ostringstream oss;
9349 oss << " Test: " << test_ << "\n"
9350 << " Error: " << error_ << "\n"
9351 << " Details:\n"
9352 << " Random seed = " << blaze::getSeed() << "\n"
9353 << " Left-hand side sparse matrix type:\n"
9354 << " " << typeid( OMT1 ).name() << "\n"
9355 << " Right-hand side sparse matrix type:\n"
9356 << " " << typeid( MT2 ).name() << "\n"
9357 << " Result:\n" << r << "\n";
9358 throw std::runtime_error( oss.str() );
9359 }
9360 catch( std::invalid_argument& ex ) {
9361 checkExceptionMessage( ex, "Invalid row access index" );
9362 }
9363
9364 try {
9365 auto r = row( olhs_ - orhs_, olhs_.rows() );
9366
9367 std::ostringstream oss;
9368 oss << " Test: " << test_ << "\n"
9369 << " Error: " << error_ << "\n"
9370 << " Details:\n"
9371 << " Random seed = " << blaze::getSeed() << "\n"
9372 << " Left-hand side sparse matrix type:\n"
9373 << " " << typeid( OMT1 ).name() << "\n"
9374 << " Right-hand side sparse matrix type:\n"
9375 << " " << typeid( OMT2 ).name() << "\n"
9376 << " Result:\n" << r << "\n";
9377 throw std::runtime_error( oss.str() );
9378 }
9379 catch( std::invalid_argument& ex ) {
9380 checkExceptionMessage( ex, "Invalid row access index" );
9381 }
9382 }
9383 }
9384 #endif
9385 }
9386 //*************************************************************************************************
9387
9388
9389 //*************************************************************************************************
9390 /*!\brief Testing the rows-wise sparse matrix/sparse matrix subtraction.
9391 //
9392 // \return void
9393 // \exception std::runtime_error Subtraction error detected.
9394 //
9395 // This function tests the rows-wise matrix subtraction with plain assignment, addition assignment,
9396 // subtraction assignment, and Schur product assignment. In case any error resulting from the
9397 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
9398 // thrown.
9399 */
9400 template< typename MT1 // Type of the left-hand side sparse matrix
9401 , typename MT2 > // Type of the right-hand side sparse matrix
testRowsOperation(blaze::TrueType)9402 void OperationTest<MT1,MT2>::testRowsOperation( blaze::TrueType )
9403 {
9404 #if BLAZETEST_MATHTEST_TEST_ROWS_OPERATION
9405 if( BLAZETEST_MATHTEST_TEST_ROWS_OPERATION > 1 )
9406 {
9407 if( lhs_.rows() == 0UL )
9408 return;
9409
9410
9411 std::vector<size_t> indices( lhs_.rows() );
9412 std::iota( indices.begin(), indices.end(), 0UL );
9413 std::random_shuffle( indices.begin(), indices.end() );
9414
9415
9416 //=====================================================================================
9417 // Rows-wise subtraction
9418 //=====================================================================================
9419
9420 // Rows-wise subtraction with the given matrices
9421 {
9422 test_ = "Rows-wise subtraction with the given matrices";
9423 error_ = "Failed subtraction operation";
9424
9425 try {
9426 initResults();
9427 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9428 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9429 rows( dres_ , &indices[index], n ) = rows( lhs_ - rhs_, &indices[index], n );
9430 rows( odres_ , &indices[index], n ) = rows( lhs_ - rhs_, &indices[index], n );
9431 rows( sres_ , &indices[index], n ) = rows( lhs_ - rhs_, &indices[index], n );
9432 rows( osres_ , &indices[index], n ) = rows( lhs_ - rhs_, &indices[index], n );
9433 rows( refres_, &indices[index], n ) = rows( reflhs_ - refrhs_, &indices[index], n );
9434 }
9435 }
9436 catch( std::exception& ex ) {
9437 convertException<MT1,MT2>( ex );
9438 }
9439
9440 checkResults<MT1,MT2>();
9441
9442 try {
9443 initResults();
9444 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9445 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9446 rows( dres_ , &indices[index], n ) = rows( lhs_ - orhs_, &indices[index], n );
9447 rows( odres_ , &indices[index], n ) = rows( lhs_ - orhs_, &indices[index], n );
9448 rows( sres_ , &indices[index], n ) = rows( lhs_ - orhs_, &indices[index], n );
9449 rows( osres_ , &indices[index], n ) = rows( lhs_ - orhs_, &indices[index], n );
9450 rows( refres_, &indices[index], n ) = rows( reflhs_ - refrhs_, &indices[index], n );
9451 }
9452 }
9453 catch( std::exception& ex ) {
9454 convertException<MT1,OMT2>( ex );
9455 }
9456
9457 checkResults<MT1,OMT2>();
9458
9459 try {
9460 initResults();
9461 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9462 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9463 rows( dres_ , &indices[index], n ) = rows( olhs_ - rhs_, &indices[index], n );
9464 rows( odres_ , &indices[index], n ) = rows( olhs_ - rhs_, &indices[index], n );
9465 rows( sres_ , &indices[index], n ) = rows( olhs_ - rhs_, &indices[index], n );
9466 rows( osres_ , &indices[index], n ) = rows( olhs_ - rhs_, &indices[index], n );
9467 rows( refres_, &indices[index], n ) = rows( reflhs_ - refrhs_, &indices[index], n );
9468 }
9469 }
9470 catch( std::exception& ex ) {
9471 convertException<OMT1,MT2>( ex );
9472 }
9473
9474 checkResults<OMT1,MT2>();
9475
9476 try {
9477 initResults();
9478 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9479 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9480 rows( dres_ , &indices[index], n ) = rows( olhs_ - orhs_, &indices[index], n );
9481 rows( odres_ , &indices[index], n ) = rows( olhs_ - orhs_, &indices[index], n );
9482 rows( sres_ , &indices[index], n ) = rows( olhs_ - orhs_, &indices[index], n );
9483 rows( osres_ , &indices[index], n ) = rows( olhs_ - orhs_, &indices[index], n );
9484 rows( refres_, &indices[index], n ) = rows( reflhs_ - refrhs_, &indices[index], n );
9485 }
9486 }
9487 catch( std::exception& ex ) {
9488 convertException<OMT1,OMT2>( ex );
9489 }
9490
9491 checkResults<OMT1,OMT2>();
9492 }
9493
9494 // Rows-wise subtraction with evaluated matrices
9495 {
9496 test_ = "Rows-wise subtraction with evaluated matrices";
9497 error_ = "Failed subtraction operation";
9498
9499 try {
9500 initResults();
9501 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9502 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9503 rows( dres_ , &indices[index], n ) = rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9504 rows( odres_ , &indices[index], n ) = rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9505 rows( sres_ , &indices[index], n ) = rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9506 rows( osres_ , &indices[index], n ) = rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9507 rows( refres_, &indices[index], n ) = rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9508 }
9509 }
9510 catch( std::exception& ex ) {
9511 convertException<MT1,MT2>( ex );
9512 }
9513
9514 checkResults<MT1,MT2>();
9515
9516 try {
9517 initResults();
9518 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9519 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9520 rows( dres_ , &indices[index], n ) = rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9521 rows( odres_ , &indices[index], n ) = rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9522 rows( sres_ , &indices[index], n ) = rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9523 rows( osres_ , &indices[index], n ) = rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9524 rows( refres_, &indices[index], n ) = rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9525 }
9526 }
9527 catch( std::exception& ex ) {
9528 convertException<MT1,OMT2>( ex );
9529 }
9530
9531 checkResults<MT1,OMT2>();
9532
9533 try {
9534 initResults();
9535 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9536 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9537 rows( dres_ , &indices[index], n ) = rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9538 rows( odres_ , &indices[index], n ) = rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9539 rows( sres_ , &indices[index], n ) = rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9540 rows( osres_ , &indices[index], n ) = rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9541 rows( refres_, &indices[index], n ) = rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9542 }
9543 }
9544 catch( std::exception& ex ) {
9545 convertException<OMT1,MT2>( ex );
9546 }
9547
9548 checkResults<OMT1,MT2>();
9549
9550 try {
9551 initResults();
9552 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9553 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9554 rows( dres_ , &indices[index], n ) = rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9555 rows( odres_ , &indices[index], n ) = rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9556 rows( sres_ , &indices[index], n ) = rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9557 rows( osres_ , &indices[index], n ) = rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9558 rows( refres_, &indices[index], n ) = rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9559 }
9560 }
9561 catch( std::exception& ex ) {
9562 convertException<OMT1,OMT2>( ex );
9563 }
9564
9565 checkResults<OMT1,OMT2>();
9566 }
9567
9568
9569 //=====================================================================================
9570 // Rows-wise subtraction with addition assignment
9571 //=====================================================================================
9572
9573 // Rows-wise subtraction with addition assignment with the given matrices
9574 {
9575 test_ = "Rows-wise subtraction with addition assignment with the given matrices";
9576 error_ = "Failed addition assignment operation";
9577
9578 try {
9579 initResults();
9580 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9581 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9582 rows( dres_ , &indices[index], n ) += rows( lhs_ - rhs_, &indices[index], n );
9583 rows( odres_ , &indices[index], n ) += rows( lhs_ - rhs_, &indices[index], n );
9584 rows( sres_ , &indices[index], n ) += rows( lhs_ - rhs_, &indices[index], n );
9585 rows( osres_ , &indices[index], n ) += rows( lhs_ - rhs_, &indices[index], n );
9586 rows( refres_, &indices[index], n ) += rows( reflhs_ - refrhs_, &indices[index], n );
9587 }
9588 }
9589 catch( std::exception& ex ) {
9590 convertException<MT1,MT2>( ex );
9591 }
9592
9593 checkResults<MT1,MT2>();
9594
9595 try {
9596 initResults();
9597 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9598 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9599 rows( dres_ , &indices[index], n ) += rows( lhs_ - orhs_, &indices[index], n );
9600 rows( odres_ , &indices[index], n ) += rows( lhs_ - orhs_, &indices[index], n );
9601 rows( sres_ , &indices[index], n ) += rows( lhs_ - orhs_, &indices[index], n );
9602 rows( osres_ , &indices[index], n ) += rows( lhs_ - orhs_, &indices[index], n );
9603 rows( refres_, &indices[index], n ) += rows( reflhs_ - refrhs_, &indices[index], n );
9604 }
9605 }
9606 catch( std::exception& ex ) {
9607 convertException<MT1,OMT2>( ex );
9608 }
9609
9610 checkResults<MT1,OMT2>();
9611
9612 try {
9613 initResults();
9614 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9615 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9616 rows( dres_ , &indices[index], n ) += rows( olhs_ - rhs_, &indices[index], n );
9617 rows( odres_ , &indices[index], n ) += rows( olhs_ - rhs_, &indices[index], n );
9618 rows( sres_ , &indices[index], n ) += rows( olhs_ - rhs_, &indices[index], n );
9619 rows( osres_ , &indices[index], n ) += rows( olhs_ - rhs_, &indices[index], n );
9620 rows( refres_, &indices[index], n ) += rows( reflhs_ - refrhs_, &indices[index], n );
9621 }
9622 }
9623 catch( std::exception& ex ) {
9624 convertException<OMT1,MT2>( ex );
9625 }
9626
9627 checkResults<OMT1,MT2>();
9628
9629 try {
9630 initResults();
9631 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9632 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9633 rows( dres_ , &indices[index], n ) += rows( olhs_ - orhs_, &indices[index], n );
9634 rows( odres_ , &indices[index], n ) += rows( olhs_ - orhs_, &indices[index], n );
9635 rows( sres_ , &indices[index], n ) += rows( olhs_ - orhs_, &indices[index], n );
9636 rows( osres_ , &indices[index], n ) += rows( olhs_ - orhs_, &indices[index], n );
9637 rows( refres_, &indices[index], n ) += rows( reflhs_ - refrhs_, &indices[index], n );
9638 }
9639 }
9640 catch( std::exception& ex ) {
9641 convertException<OMT1,OMT2>( ex );
9642 }
9643
9644 checkResults<OMT1,OMT2>();
9645 }
9646
9647 // Rows-wise subtraction with addition assignment with evaluated matrices
9648 {
9649 test_ = "Rows-wise subtraction with addition assignment with evaluated matrices";
9650 error_ = "Failed addition assignment operation";
9651
9652 try {
9653 initResults();
9654 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9655 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9656 rows( dres_ , &indices[index], n ) += rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9657 rows( odres_ , &indices[index], n ) += rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9658 rows( sres_ , &indices[index], n ) += rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9659 rows( osres_ , &indices[index], n ) += rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9660 rows( refres_, &indices[index], n ) += rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9661 }
9662 }
9663 catch( std::exception& ex ) {
9664 convertException<MT1,MT2>( ex );
9665 }
9666
9667 checkResults<MT1,MT2>();
9668
9669 try {
9670 initResults();
9671 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9672 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9673 rows( dres_ , &indices[index], n ) += rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9674 rows( odres_ , &indices[index], n ) += rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9675 rows( sres_ , &indices[index], n ) += rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9676 rows( osres_ , &indices[index], n ) += rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9677 rows( refres_, &indices[index], n ) += rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9678 }
9679 }
9680 catch( std::exception& ex ) {
9681 convertException<MT1,OMT2>( ex );
9682 }
9683
9684 checkResults<MT1,OMT2>();
9685
9686 try {
9687 initResults();
9688 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9689 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9690 rows( dres_ , &indices[index], n ) += rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9691 rows( odres_ , &indices[index], n ) += rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9692 rows( sres_ , &indices[index], n ) += rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9693 rows( osres_ , &indices[index], n ) += rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9694 rows( refres_, &indices[index], n ) += rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9695 }
9696 }
9697 catch( std::exception& ex ) {
9698 convertException<OMT1,MT2>( ex );
9699 }
9700
9701 checkResults<OMT1,MT2>();
9702
9703 try {
9704 initResults();
9705 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9706 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9707 rows( dres_ , &indices[index], n ) += rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9708 rows( odres_ , &indices[index], n ) += rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9709 rows( sres_ , &indices[index], n ) += rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9710 rows( osres_ , &indices[index], n ) += rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9711 rows( refres_, &indices[index], n ) += rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9712 }
9713 }
9714 catch( std::exception& ex ) {
9715 convertException<OMT1,OMT2>( ex );
9716 }
9717
9718 checkResults<OMT1,OMT2>();
9719 }
9720
9721
9722 //=====================================================================================
9723 // Rows-wise subtraction with subtraction assignment
9724 //=====================================================================================
9725
9726 // Rows-wise subtraction with subtraction assignment with the given matrices
9727 {
9728 test_ = "Rows-wise subtraction with subtraction assignment with the given matrices";
9729 error_ = "Failed subtraction assignment operation";
9730
9731 try {
9732 initResults();
9733 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9734 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9735 rows( dres_ , &indices[index], n ) -= rows( lhs_ - rhs_, &indices[index], n );
9736 rows( odres_ , &indices[index], n ) -= rows( lhs_ - rhs_, &indices[index], n );
9737 rows( sres_ , &indices[index], n ) -= rows( lhs_ - rhs_, &indices[index], n );
9738 rows( osres_ , &indices[index], n ) -= rows( lhs_ - rhs_, &indices[index], n );
9739 rows( refres_, &indices[index], n ) -= rows( reflhs_ - refrhs_, &indices[index], n );
9740 }
9741 }
9742 catch( std::exception& ex ) {
9743 convertException<MT1,MT2>( ex );
9744 }
9745
9746 checkResults<MT1,MT2>();
9747
9748 try {
9749 initResults();
9750 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9751 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9752 rows( dres_ , &indices[index], n ) -= rows( lhs_ - orhs_, &indices[index], n );
9753 rows( odres_ , &indices[index], n ) -= rows( lhs_ - orhs_, &indices[index], n );
9754 rows( sres_ , &indices[index], n ) -= rows( lhs_ - orhs_, &indices[index], n );
9755 rows( osres_ , &indices[index], n ) -= rows( lhs_ - orhs_, &indices[index], n );
9756 rows( refres_, &indices[index], n ) -= rows( reflhs_ - refrhs_, &indices[index], n );
9757 }
9758 }
9759 catch( std::exception& ex ) {
9760 convertException<MT1,OMT2>( ex );
9761 }
9762
9763 checkResults<MT1,OMT2>();
9764
9765 try {
9766 initResults();
9767 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9768 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9769 rows( dres_ , &indices[index], n ) -= rows( olhs_ - rhs_, &indices[index], n );
9770 rows( odres_ , &indices[index], n ) -= rows( olhs_ - rhs_, &indices[index], n );
9771 rows( sres_ , &indices[index], n ) -= rows( olhs_ - rhs_, &indices[index], n );
9772 rows( osres_ , &indices[index], n ) -= rows( olhs_ - rhs_, &indices[index], n );
9773 rows( refres_, &indices[index], n ) -= rows( reflhs_ - refrhs_, &indices[index], n );
9774 }
9775 }
9776 catch( std::exception& ex ) {
9777 convertException<OMT1,MT2>( ex );
9778 }
9779
9780 checkResults<OMT1,MT2>();
9781
9782 try {
9783 initResults();
9784 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9785 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9786 rows( dres_ , &indices[index], n ) -= rows( olhs_ - orhs_, &indices[index], n );
9787 rows( odres_ , &indices[index], n ) -= rows( olhs_ - orhs_, &indices[index], n );
9788 rows( sres_ , &indices[index], n ) -= rows( olhs_ - orhs_, &indices[index], n );
9789 rows( osres_ , &indices[index], n ) -= rows( olhs_ - orhs_, &indices[index], n );
9790 rows( refres_, &indices[index], n ) -= rows( reflhs_ - refrhs_, &indices[index], n );
9791 }
9792 }
9793 catch( std::exception& ex ) {
9794 convertException<OMT1,OMT2>( ex );
9795 }
9796
9797 checkResults<OMT1,OMT2>();
9798 }
9799
9800 // Rows-wise subtraction with subtraction assignment with evaluated matrices
9801 {
9802 test_ = "Rows-wise subtraction with subtraction assignment with evaluated matrices";
9803 error_ = "Failed subtraction assignment operation";
9804
9805 try {
9806 initResults();
9807 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9808 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9809 rows( dres_ , &indices[index], n ) -= rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9810 rows( odres_ , &indices[index], n ) -= rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9811 rows( sres_ , &indices[index], n ) -= rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9812 rows( osres_ , &indices[index], n ) -= rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9813 rows( refres_, &indices[index], n ) -= rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9814 }
9815 }
9816 catch( std::exception& ex ) {
9817 convertException<MT1,MT2>( ex );
9818 }
9819
9820 checkResults<MT1,MT2>();
9821
9822 try {
9823 initResults();
9824 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9825 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9826 rows( dres_ , &indices[index], n ) -= rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9827 rows( odres_ , &indices[index], n ) -= rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9828 rows( sres_ , &indices[index], n ) -= rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9829 rows( osres_ , &indices[index], n ) -= rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9830 rows( refres_, &indices[index], n ) -= rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9831 }
9832 }
9833 catch( std::exception& ex ) {
9834 convertException<MT1,OMT2>( ex );
9835 }
9836
9837 checkResults<MT1,OMT2>();
9838
9839 try {
9840 initResults();
9841 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9842 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9843 rows( dres_ , &indices[index], n ) -= rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9844 rows( odres_ , &indices[index], n ) -= rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9845 rows( sres_ , &indices[index], n ) -= rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9846 rows( osres_ , &indices[index], n ) -= rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9847 rows( refres_, &indices[index], n ) -= rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9848 }
9849 }
9850 catch( std::exception& ex ) {
9851 convertException<OMT1,MT2>( ex );
9852 }
9853
9854 checkResults<OMT1,MT2>();
9855
9856 try {
9857 initResults();
9858 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9859 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9860 rows( dres_ , &indices[index], n ) -= rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9861 rows( odres_ , &indices[index], n ) -= rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9862 rows( sres_ , &indices[index], n ) -= rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9863 rows( osres_ , &indices[index], n ) -= rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
9864 rows( refres_, &indices[index], n ) -= rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9865 }
9866 }
9867 catch( std::exception& ex ) {
9868 convertException<OMT1,OMT2>( ex );
9869 }
9870
9871 checkResults<OMT1,OMT2>();
9872 }
9873
9874
9875 //=====================================================================================
9876 // Rows-wise subtraction with Schur product assignment
9877 //=====================================================================================
9878
9879 // Rows-wise subtraction with Schur product assignment with the given matrices
9880 {
9881 test_ = "Rows-wise subtraction with Schur product assignment with the given matrices";
9882 error_ = "Failed Schur product assignment operation";
9883
9884 try {
9885 initResults();
9886 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9887 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9888 rows( dres_ , &indices[index], n ) %= rows( lhs_ - rhs_, &indices[index], n );
9889 rows( odres_ , &indices[index], n ) %= rows( lhs_ - rhs_, &indices[index], n );
9890 rows( sres_ , &indices[index], n ) %= rows( lhs_ - rhs_, &indices[index], n );
9891 rows( osres_ , &indices[index], n ) %= rows( lhs_ - rhs_, &indices[index], n );
9892 rows( refres_, &indices[index], n ) %= rows( reflhs_ - refrhs_, &indices[index], n );
9893 }
9894 }
9895 catch( std::exception& ex ) {
9896 convertException<MT1,MT2>( ex );
9897 }
9898
9899 checkResults<MT1,MT2>();
9900
9901 try {
9902 initResults();
9903 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9904 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9905 rows( dres_ , &indices[index], n ) %= rows( lhs_ - orhs_, &indices[index], n );
9906 rows( odres_ , &indices[index], n ) %= rows( lhs_ - orhs_, &indices[index], n );
9907 rows( sres_ , &indices[index], n ) %= rows( lhs_ - orhs_, &indices[index], n );
9908 rows( osres_ , &indices[index], n ) %= rows( lhs_ - orhs_, &indices[index], n );
9909 rows( refres_, &indices[index], n ) %= rows( reflhs_ - refrhs_, &indices[index], n );
9910 }
9911 }
9912 catch( std::exception& ex ) {
9913 convertException<MT1,OMT2>( ex );
9914 }
9915
9916 checkResults<MT1,OMT2>();
9917
9918 try {
9919 initResults();
9920 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9921 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9922 rows( dres_ , &indices[index], n ) %= rows( olhs_ - rhs_, &indices[index], n );
9923 rows( odres_ , &indices[index], n ) %= rows( olhs_ - rhs_, &indices[index], n );
9924 rows( sres_ , &indices[index], n ) %= rows( olhs_ - rhs_, &indices[index], n );
9925 rows( osres_ , &indices[index], n ) %= rows( olhs_ - rhs_, &indices[index], n );
9926 rows( refres_, &indices[index], n ) %= rows( reflhs_ - refrhs_, &indices[index], n );
9927 }
9928 }
9929 catch( std::exception& ex ) {
9930 convertException<OMT1,MT2>( ex );
9931 }
9932
9933 checkResults<OMT1,MT2>();
9934
9935 try {
9936 initResults();
9937 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9938 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9939 rows( dres_ , &indices[index], n ) %= rows( olhs_ - orhs_, &indices[index], n );
9940 rows( odres_ , &indices[index], n ) %= rows( olhs_ - orhs_, &indices[index], n );
9941 rows( sres_ , &indices[index], n ) %= rows( olhs_ - orhs_, &indices[index], n );
9942 rows( osres_ , &indices[index], n ) %= rows( olhs_ - orhs_, &indices[index], n );
9943 rows( refres_, &indices[index], n ) %= rows( reflhs_ - refrhs_, &indices[index], n );
9944 }
9945 }
9946 catch( std::exception& ex ) {
9947 convertException<OMT1,OMT2>( ex );
9948 }
9949
9950 checkResults<OMT1,OMT2>();
9951 }
9952
9953 // Rows-wise subtraction with Schur product assignment with evaluated matrices
9954 {
9955 test_ = "Rows-wise subtraction with Schur product assignment with evaluated matrices";
9956 error_ = "Failed Schur product assignment operation";
9957
9958 try {
9959 initResults();
9960 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9961 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9962 rows( dres_ , &indices[index], n ) %= rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9963 rows( odres_ , &indices[index], n ) %= rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9964 rows( sres_ , &indices[index], n ) %= rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9965 rows( osres_ , &indices[index], n ) %= rows( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
9966 rows( refres_, &indices[index], n ) %= rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9967 }
9968 }
9969 catch( std::exception& ex ) {
9970 convertException<MT1,MT2>( ex );
9971 }
9972
9973 checkResults<MT1,MT2>();
9974
9975 try {
9976 initResults();
9977 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9978 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9979 rows( dres_ , &indices[index], n ) %= rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9980 rows( odres_ , &indices[index], n ) %= rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9981 rows( sres_ , &indices[index], n ) %= rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9982 rows( osres_ , &indices[index], n ) %= rows( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
9983 rows( refres_, &indices[index], n ) %= rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
9984 }
9985 }
9986 catch( std::exception& ex ) {
9987 convertException<MT1,OMT2>( ex );
9988 }
9989
9990 checkResults<MT1,OMT2>();
9991
9992 try {
9993 initResults();
9994 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9995 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9996 rows( dres_ , &indices[index], n ) %= rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9997 rows( odres_ , &indices[index], n ) %= rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9998 rows( sres_ , &indices[index], n ) %= rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
9999 rows( osres_ , &indices[index], n ) %= rows( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
10000 rows( refres_, &indices[index], n ) %= rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
10001 }
10002 }
10003 catch( std::exception& ex ) {
10004 convertException<OMT1,MT2>( ex );
10005 }
10006
10007 checkResults<OMT1,MT2>();
10008
10009 try {
10010 initResults();
10011 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10012 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10013 rows( dres_ , &indices[index], n ) %= rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
10014 rows( odres_ , &indices[index], n ) %= rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
10015 rows( sres_ , &indices[index], n ) %= rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
10016 rows( osres_ , &indices[index], n ) %= rows( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
10017 rows( refres_, &indices[index], n ) %= rows( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
10018 }
10019 }
10020 catch( std::exception& ex ) {
10021 convertException<OMT1,OMT2>( ex );
10022 }
10023
10024 checkResults<OMT1,OMT2>();
10025 }
10026
10027
10028 //=====================================================================================
10029 // Failure cases
10030 //=====================================================================================
10031
10032 // Out-of-bounds access (invalid row index; initializer_list)
10033 {
10034 test_ = "Out-of-bounds row selection construction (invalid row index; initializer_list)";
10035 error_ = "Setup of out-of-bounds row selection succeeded";
10036
10037 try {
10038 auto r = rows( lhs_ - rhs_, { lhs_.rows() } );
10039
10040 std::ostringstream oss;
10041 oss << " Test: " << test_ << "\n"
10042 << " Error: " << error_ << "\n"
10043 << " Details:\n"
10044 << " Random seed = " << blaze::getSeed() << "\n"
10045 << " Left-hand side sparse matrix type:\n"
10046 << " " << typeid( MT1 ).name() << "\n"
10047 << " Right-hand side sparse matrix type:\n"
10048 << " " << typeid( MT2 ).name() << "\n"
10049 << " Result:\n" << r << "\n";
10050 throw std::runtime_error( oss.str() );
10051 }
10052 catch( std::invalid_argument& ex ) {
10053 checkExceptionMessage( ex, "Invalid row access index" );
10054 }
10055
10056 try {
10057 auto r = rows( lhs_ - orhs_, { lhs_.rows() } );
10058
10059 std::ostringstream oss;
10060 oss << " Test: " << test_ << "\n"
10061 << " Error: " << error_ << "\n"
10062 << " Details:\n"
10063 << " Random seed = " << blaze::getSeed() << "\n"
10064 << " Left-hand side sparse matrix type:\n"
10065 << " " << typeid( MT1 ).name() << "\n"
10066 << " Right-hand side sparse matrix type:\n"
10067 << " " << typeid( OMT2 ).name() << "\n"
10068 << " Result:\n" << r << "\n";
10069 throw std::runtime_error( oss.str() );
10070 }
10071 catch( std::invalid_argument& ex ) {
10072 checkExceptionMessage( ex, "Invalid row access index" );
10073 }
10074
10075 try {
10076 auto r = rows( olhs_ - rhs_, { olhs_.rows() } );
10077
10078 std::ostringstream oss;
10079 oss << " Test: " << test_ << "\n"
10080 << " Error: " << error_ << "\n"
10081 << " Details:\n"
10082 << " Random seed = " << blaze::getSeed() << "\n"
10083 << " Left-hand side sparse matrix type:\n"
10084 << " " << typeid( OMT1 ).name() << "\n"
10085 << " Right-hand side sparse matrix type:\n"
10086 << " " << typeid( MT2 ).name() << "\n"
10087 << " Result:\n" << r << "\n";
10088 throw std::runtime_error( oss.str() );
10089 }
10090 catch( std::invalid_argument& ex ) {
10091 checkExceptionMessage( ex, "Invalid row access index" );
10092 }
10093
10094 try {
10095 auto r = rows( olhs_ - orhs_, { olhs_.rows() } );
10096
10097 std::ostringstream oss;
10098 oss << " Test: " << test_ << "\n"
10099 << " Error: " << error_ << "\n"
10100 << " Details:\n"
10101 << " Random seed = " << blaze::getSeed() << "\n"
10102 << " Left-hand side sparse matrix type:\n"
10103 << " " << typeid( OMT1 ).name() << "\n"
10104 << " Right-hand side sparse matrix type:\n"
10105 << " " << typeid( OMT2 ).name() << "\n"
10106 << " Result:\n" << r << "\n";
10107 throw std::runtime_error( oss.str() );
10108 }
10109 catch( std::invalid_argument& ex ) {
10110 checkExceptionMessage( ex, "Invalid row access index" );
10111 }
10112 }
10113
10114 // Out-of-bounds access (invalid row index; lambda)
10115 {
10116 test_ = "Out-of-bounds row selection construction (invalid row index; lambda)";
10117 error_ = "Setup of out-of-bounds row selection succeeded";
10118
10119 try {
10120 auto r = rows( lhs_ - rhs_, [index=lhs_.rows()]( size_t ){ return index; }, 1UL );
10121
10122 std::ostringstream oss;
10123 oss << " Test: " << test_ << "\n"
10124 << " Error: " << error_ << "\n"
10125 << " Details:\n"
10126 << " Random seed = " << blaze::getSeed() << "\n"
10127 << " Left-hand side sparse matrix type:\n"
10128 << " " << typeid( MT1 ).name() << "\n"
10129 << " Right-hand side sparse matrix type:\n"
10130 << " " << typeid( MT2 ).name() << "\n"
10131 << " Result:\n" << r << "\n";
10132 throw std::runtime_error( oss.str() );
10133 }
10134 catch( std::invalid_argument& ex ) {
10135 checkExceptionMessage( ex, "Invalid row access index" );
10136 }
10137
10138 try {
10139 auto r = rows( lhs_ - orhs_, [index=lhs_.rows()]( size_t ){ return index; }, 1UL );
10140
10141 std::ostringstream oss;
10142 oss << " Test: " << test_ << "\n"
10143 << " Error: " << error_ << "\n"
10144 << " Details:\n"
10145 << " Random seed = " << blaze::getSeed() << "\n"
10146 << " Left-hand side sparse matrix type:\n"
10147 << " " << typeid( MT1 ).name() << "\n"
10148 << " Right-hand side sparse matrix type:\n"
10149 << " " << typeid( OMT2 ).name() << "\n"
10150 << " Result:\n" << r << "\n";
10151 throw std::runtime_error( oss.str() );
10152 }
10153 catch( std::invalid_argument& ex ) {
10154 checkExceptionMessage( ex, "Invalid row access index" );
10155 }
10156
10157 try {
10158 auto r = rows( olhs_ - rhs_, [index=olhs_.rows()]( size_t ){ return index; }, 1UL );
10159
10160 std::ostringstream oss;
10161 oss << " Test: " << test_ << "\n"
10162 << " Error: " << error_ << "\n"
10163 << " Details:\n"
10164 << " Random seed = " << blaze::getSeed() << "\n"
10165 << " Left-hand side sparse matrix type:\n"
10166 << " " << typeid( OMT1 ).name() << "\n"
10167 << " Right-hand side sparse matrix type:\n"
10168 << " " << typeid( MT2 ).name() << "\n"
10169 << " Result:\n" << r << "\n";
10170 throw std::runtime_error( oss.str() );
10171 }
10172 catch( std::invalid_argument& ex ) {
10173 checkExceptionMessage( ex, "Invalid row access index" );
10174 }
10175
10176 try {
10177 auto r = rows( olhs_ - orhs_, [index=olhs_.rows()]( size_t ){ return index; }, 1UL );
10178
10179 std::ostringstream oss;
10180 oss << " Test: " << test_ << "\n"
10181 << " Error: " << error_ << "\n"
10182 << " Details:\n"
10183 << " Random seed = " << blaze::getSeed() << "\n"
10184 << " Left-hand side sparse matrix type:\n"
10185 << " " << typeid( OMT1 ).name() << "\n"
10186 << " Right-hand side sparse matrix type:\n"
10187 << " " << typeid( OMT2 ).name() << "\n"
10188 << " Result:\n" << r << "\n";
10189 throw std::runtime_error( oss.str() );
10190 }
10191 catch( std::invalid_argument& ex ) {
10192 checkExceptionMessage( ex, "Invalid row access index" );
10193 }
10194 }
10195 }
10196 #endif
10197 }
10198 //*************************************************************************************************
10199
10200
10201 //*************************************************************************************************
10202 /*!\brief Skipping the rows-wise sparse matrix/sparse matrix subtraction.
10203 //
10204 // \return void
10205 //
10206 // This function is called in case the rows-wise matrix/matrix subtraction operation is not
10207 // available for the given matrix types \a MT1 and \a MT2.
10208 */
10209 template< typename MT1 // Type of the left-hand side sparse matrix
10210 , typename MT2 > // Type of the right-hand side sparse matrix
testRowsOperation(blaze::FalseType)10211 void OperationTest<MT1,MT2>::testRowsOperation( blaze::FalseType )
10212 {}
10213 //*************************************************************************************************
10214
10215
10216 //*************************************************************************************************
10217 /*!\brief Testing the column-wise sparse matrix/sparse matrix subtraction.
10218 //
10219 // \return void
10220 // \exception std::runtime_error Subtraction error detected.
10221 //
10222 // This function tests the column-wise matrix subtraction with plain assignment, addition
10223 // assignment, subtraction assignment, and multiplication assignment. In case any error resulting
10224 // from the subtraction or the subsequent assignment is detected, a \a std::runtime_error exception
10225 // is thrown.
10226 */
10227 template< typename MT1 // Type of the left-hand side sparse matrix
10228 , typename MT2 > // Type of the right-hand side sparse matrix
testColumnOperation()10229 void OperationTest<MT1,MT2>::testColumnOperation()
10230 {
10231 #if BLAZETEST_MATHTEST_TEST_COLUMN_OPERATION
10232 if( BLAZETEST_MATHTEST_TEST_COLUMN_OPERATION > 1 )
10233 {
10234 if( lhs_.columns() == 0UL )
10235 return;
10236
10237
10238 //=====================================================================================
10239 // Column-wise subtraction
10240 //=====================================================================================
10241
10242 // Column-wise subtraction with the given matrices
10243 {
10244 test_ = "Column-wise subtraction with the given matrices";
10245 error_ = "Failed subtraction operation";
10246
10247 try {
10248 initResults();
10249 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10250 column( dres_ , j ) = column( lhs_ - rhs_, j );
10251 column( odres_ , j ) = column( lhs_ - rhs_, j );
10252 column( sres_ , j ) = column( lhs_ - rhs_, j );
10253 column( osres_ , j ) = column( lhs_ - rhs_, j );
10254 column( refres_, j ) = column( reflhs_ - refrhs_, j );
10255 }
10256 }
10257 catch( std::exception& ex ) {
10258 convertException<MT1,MT2>( ex );
10259 }
10260
10261 checkResults<MT1,MT2>();
10262
10263 try {
10264 initResults();
10265 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10266 column( dres_ , j ) = column( lhs_ - orhs_, j );
10267 column( odres_ , j ) = column( lhs_ - orhs_, j );
10268 column( sres_ , j ) = column( lhs_ - orhs_, j );
10269 column( osres_ , j ) = column( lhs_ - orhs_, j );
10270 column( refres_, j ) = column( reflhs_ - refrhs_, j );
10271 }
10272 }
10273 catch( std::exception& ex ) {
10274 convertException<MT1,OMT2>( ex );
10275 }
10276
10277 checkResults<MT1,OMT2>();
10278
10279 try {
10280 initResults();
10281 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10282 column( dres_ , j ) = column( olhs_ - rhs_, j );
10283 column( odres_ , j ) = column( olhs_ - rhs_, j );
10284 column( sres_ , j ) = column( olhs_ - rhs_, j );
10285 column( osres_ , j ) = column( olhs_ - rhs_, j );
10286 column( refres_, j ) = column( reflhs_ - refrhs_, j );
10287 }
10288 }
10289 catch( std::exception& ex ) {
10290 convertException<OMT1,MT2>( ex );
10291 }
10292
10293 checkResults<OMT1,MT2>();
10294
10295 try {
10296 initResults();
10297 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10298 column( dres_ , j ) = column( olhs_ - orhs_, j );
10299 column( odres_ , j ) = column( olhs_ - orhs_, j );
10300 column( sres_ , j ) = column( olhs_ - orhs_, j );
10301 column( osres_ , j ) = column( olhs_ - orhs_, j );
10302 column( refres_, j ) = column( reflhs_ - refrhs_, j );
10303 }
10304 }
10305 catch( std::exception& ex ) {
10306 convertException<OMT1,OMT2>( ex );
10307 }
10308
10309 checkResults<OMT1,OMT2>();
10310 }
10311
10312 // Column-wise subtraction with evaluated matrices
10313 {
10314 test_ = "Column-wise subtraction with evaluated matrices";
10315 error_ = "Failed subtraction operation";
10316
10317 try {
10318 initResults();
10319 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10320 column( dres_ , j ) = column( eval( lhs_ ) - eval( rhs_ ), j );
10321 column( odres_ , j ) = column( eval( lhs_ ) - eval( rhs_ ), j );
10322 column( sres_ , j ) = column( eval( lhs_ ) - eval( rhs_ ), j );
10323 column( osres_ , j ) = column( eval( lhs_ ) - eval( rhs_ ), j );
10324 column( refres_, j ) = column( eval( reflhs_ ) - eval( refrhs_ ), j );
10325 }
10326 }
10327 catch( std::exception& ex ) {
10328 convertException<MT1,MT2>( ex );
10329 }
10330
10331 checkResults<MT1,MT2>();
10332
10333 try {
10334 initResults();
10335 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10336 column( dres_ , j ) = column( eval( lhs_ ) - eval( orhs_ ), j );
10337 column( odres_ , j ) = column( eval( lhs_ ) - eval( orhs_ ), j );
10338 column( sres_ , j ) = column( eval( lhs_ ) - eval( orhs_ ), j );
10339 column( osres_ , j ) = column( eval( lhs_ ) - eval( orhs_ ), j );
10340 column( refres_, j ) = column( eval( reflhs_ ) - eval( refrhs_ ), j );
10341 }
10342 }
10343 catch( std::exception& ex ) {
10344 convertException<MT1,OMT2>( ex );
10345 }
10346
10347 checkResults<MT1,OMT2>();
10348
10349 try {
10350 initResults();
10351 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10352 column( dres_ , j ) = column( eval( olhs_ ) - eval( rhs_ ), j );
10353 column( odres_ , j ) = column( eval( olhs_ ) - eval( rhs_ ), j );
10354 column( sres_ , j ) = column( eval( olhs_ ) - eval( rhs_ ), j );
10355 column( osres_ , j ) = column( eval( olhs_ ) - eval( rhs_ ), j );
10356 column( refres_, j ) = column( eval( reflhs_ ) - eval( refrhs_ ), j );
10357 }
10358 }
10359 catch( std::exception& ex ) {
10360 convertException<OMT1,MT2>( ex );
10361 }
10362
10363 checkResults<OMT1,MT2>();
10364
10365 try {
10366 initResults();
10367 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10368 column( dres_ , j ) = column( eval( olhs_ ) - eval( orhs_ ), j );
10369 column( odres_ , j ) = column( eval( olhs_ ) - eval( orhs_ ), j );
10370 column( sres_ , j ) = column( eval( olhs_ ) - eval( orhs_ ), j );
10371 column( osres_ , j ) = column( eval( olhs_ ) - eval( orhs_ ), j );
10372 column( refres_, j ) = column( eval( reflhs_ ) - eval( refrhs_ ), j );
10373 }
10374 }
10375 catch( std::exception& ex ) {
10376 convertException<OMT1,OMT2>( ex );
10377 }
10378
10379 checkResults<OMT1,OMT2>();
10380 }
10381
10382
10383 //=====================================================================================
10384 // Column-wise subtraction with addition assignment
10385 //=====================================================================================
10386
10387 // Column-wise subtraction with addition assignment with the given matrices
10388 {
10389 test_ = "Column-wise subtraction with addition assignment with the given matrices";
10390 error_ = "Failed addition assignment operation";
10391
10392 try {
10393 initResults();
10394 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10395 column( dres_ , j ) += column( lhs_ - rhs_, j );
10396 column( odres_ , j ) += column( lhs_ - rhs_, j );
10397 column( sres_ , j ) += column( lhs_ - rhs_, j );
10398 column( osres_ , j ) += column( lhs_ - rhs_, j );
10399 column( refres_, j ) += column( reflhs_ - refrhs_, j );
10400 }
10401 }
10402 catch( std::exception& ex ) {
10403 convertException<MT1,MT2>( ex );
10404 }
10405
10406 checkResults<MT1,MT2>();
10407
10408 try {
10409 initResults();
10410 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10411 column( dres_ , j ) += column( lhs_ - orhs_, j );
10412 column( odres_ , j ) += column( lhs_ - orhs_, j );
10413 column( sres_ , j ) += column( lhs_ - orhs_, j );
10414 column( osres_ , j ) += column( lhs_ - orhs_, j );
10415 column( refres_, j ) += column( reflhs_ - refrhs_, j );
10416 }
10417 }
10418 catch( std::exception& ex ) {
10419 convertException<MT1,OMT2>( ex );
10420 }
10421
10422 checkResults<MT1,OMT2>();
10423
10424 try {
10425 initResults();
10426 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10427 column( dres_ , j ) += column( olhs_ - rhs_, j );
10428 column( odres_ , j ) += column( olhs_ - rhs_, j );
10429 column( sres_ , j ) += column( olhs_ - rhs_, j );
10430 column( osres_ , j ) += column( olhs_ - rhs_, j );
10431 column( refres_, j ) += column( reflhs_ - refrhs_, j );
10432 }
10433 }
10434 catch( std::exception& ex ) {
10435 convertException<OMT1,MT2>( ex );
10436 }
10437
10438 checkResults<OMT1,MT2>();
10439
10440 try {
10441 initResults();
10442 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10443 column( dres_ , j ) += column( olhs_ - orhs_, j );
10444 column( odres_ , j ) += column( olhs_ - orhs_, j );
10445 column( sres_ , j ) += column( olhs_ - orhs_, j );
10446 column( osres_ , j ) += column( olhs_ - orhs_, j );
10447 column( refres_, j ) += column( reflhs_ - refrhs_, j );
10448 }
10449 }
10450 catch( std::exception& ex ) {
10451 convertException<OMT1,OMT2>( ex );
10452 }
10453
10454 checkResults<OMT1,OMT2>();
10455 }
10456
10457 // Column-wise subtraction with addition assignment with evaluated matrices
10458 {
10459 test_ = "Column-wise subtraction with addition assignment with evaluated matrices";
10460 error_ = "Failed addition assignment operation";
10461
10462 try {
10463 initResults();
10464 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10465 column( dres_ , j ) += column( eval( lhs_ ) - eval( rhs_ ), j );
10466 column( odres_ , j ) += column( eval( lhs_ ) - eval( rhs_ ), j );
10467 column( sres_ , j ) += column( eval( lhs_ ) - eval( rhs_ ), j );
10468 column( osres_ , j ) += column( eval( lhs_ ) - eval( rhs_ ), j );
10469 column( refres_, j ) += column( eval( reflhs_ ) - eval( refrhs_ ), j );
10470 }
10471 }
10472 catch( std::exception& ex ) {
10473 convertException<MT1,MT2>( ex );
10474 }
10475
10476 checkResults<MT1,MT2>();
10477
10478 try {
10479 initResults();
10480 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10481 column( dres_ , j ) += column( eval( lhs_ ) - eval( orhs_ ), j );
10482 column( odres_ , j ) += column( eval( lhs_ ) - eval( orhs_ ), j );
10483 column( sres_ , j ) += column( eval( lhs_ ) - eval( orhs_ ), j );
10484 column( osres_ , j ) += column( eval( lhs_ ) - eval( orhs_ ), j );
10485 column( refres_, j ) += column( eval( reflhs_ ) - eval( refrhs_ ), j );
10486 }
10487 }
10488 catch( std::exception& ex ) {
10489 convertException<MT1,OMT2>( ex );
10490 }
10491
10492 checkResults<MT1,OMT2>();
10493
10494 try {
10495 initResults();
10496 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10497 column( dres_ , j ) += column( eval( olhs_ ) - eval( rhs_ ), j );
10498 column( odres_ , j ) += column( eval( olhs_ ) - eval( rhs_ ), j );
10499 column( sres_ , j ) += column( eval( olhs_ ) - eval( rhs_ ), j );
10500 column( osres_ , j ) += column( eval( olhs_ ) - eval( rhs_ ), j );
10501 column( refres_, j ) += column( eval( reflhs_ ) - eval( refrhs_ ), j );
10502 }
10503 }
10504 catch( std::exception& ex ) {
10505 convertException<OMT1,MT2>( ex );
10506 }
10507
10508 checkResults<OMT1,MT2>();
10509
10510 try {
10511 initResults();
10512 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10513 column( dres_ , j ) += column( eval( olhs_ ) - eval( orhs_ ), j );
10514 column( odres_ , j ) += column( eval( olhs_ ) - eval( orhs_ ), j );
10515 column( sres_ , j ) += column( eval( olhs_ ) - eval( orhs_ ), j );
10516 column( osres_ , j ) += column( eval( olhs_ ) - eval( orhs_ ), j );
10517 column( refres_, j ) += column( eval( reflhs_ ) - eval( refrhs_ ), j );
10518 }
10519 }
10520 catch( std::exception& ex ) {
10521 convertException<OMT1,OMT2>( ex );
10522 }
10523
10524 checkResults<OMT1,OMT2>();
10525 }
10526
10527
10528 //=====================================================================================
10529 // Column-wise subtraction with subtraction assignment
10530 //=====================================================================================
10531
10532 // Column-wise subtraction with subtraction assignment with the given matrices
10533 {
10534 test_ = "Column-wise subtraction with subtraction assignment with the given matrices";
10535 error_ = "Failed subtraction assignment operation";
10536
10537 try {
10538 initResults();
10539 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10540 column( dres_ , j ) -= column( lhs_ - rhs_, j );
10541 column( odres_ , j ) -= column( lhs_ - rhs_, j );
10542 column( sres_ , j ) -= column( lhs_ - rhs_, j );
10543 column( osres_ , j ) -= column( lhs_ - rhs_, j );
10544 column( refres_, j ) -= column( reflhs_ - refrhs_, j );
10545 }
10546 }
10547 catch( std::exception& ex ) {
10548 convertException<MT1,MT2>( ex );
10549 }
10550
10551 checkResults<MT1,MT2>();
10552
10553 try {
10554 initResults();
10555 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10556 column( dres_ , j ) -= column( lhs_ - orhs_, j );
10557 column( odres_ , j ) -= column( lhs_ - orhs_, j );
10558 column( sres_ , j ) -= column( lhs_ - orhs_, j );
10559 column( osres_ , j ) -= column( lhs_ - orhs_, j );
10560 column( refres_, j ) -= column( reflhs_ - refrhs_, j );
10561 }
10562 }
10563 catch( std::exception& ex ) {
10564 convertException<MT1,OMT2>( ex );
10565 }
10566
10567 checkResults<MT1,OMT2>();
10568
10569 try {
10570 initResults();
10571 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10572 column( dres_ , j ) -= column( olhs_ - rhs_, j );
10573 column( odres_ , j ) -= column( olhs_ - rhs_, j );
10574 column( sres_ , j ) -= column( olhs_ - rhs_, j );
10575 column( osres_ , j ) -= column( olhs_ - rhs_, j );
10576 column( refres_, j ) -= column( reflhs_ - refrhs_, j );
10577 }
10578 }
10579 catch( std::exception& ex ) {
10580 convertException<OMT1,MT2>( ex );
10581 }
10582
10583 checkResults<OMT1,MT2>();
10584
10585 try {
10586 initResults();
10587 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10588 column( dres_ , j ) -= column( olhs_ - orhs_, j );
10589 column( odres_ , j ) -= column( olhs_ - orhs_, j );
10590 column( sres_ , j ) -= column( olhs_ - orhs_, j );
10591 column( osres_ , j ) -= column( olhs_ - orhs_, j );
10592 column( refres_, j ) -= column( reflhs_ - refrhs_, j );
10593 }
10594 }
10595 catch( std::exception& ex ) {
10596 convertException<OMT1,OMT2>( ex );
10597 }
10598
10599 checkResults<OMT1,OMT2>();
10600 }
10601
10602 // Column-wise subtraction with subtraction assignment with evaluated matrices
10603 {
10604 test_ = "Column-wise subtraction with subtraction assignment with evaluated matrices";
10605 error_ = "Failed subtraction assignment operation";
10606
10607 try {
10608 initResults();
10609 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10610 column( dres_ , j ) -= column( eval( lhs_ ) - eval( rhs_ ), j );
10611 column( odres_ , j ) -= column( eval( lhs_ ) - eval( rhs_ ), j );
10612 column( sres_ , j ) -= column( eval( lhs_ ) - eval( rhs_ ), j );
10613 column( osres_ , j ) -= column( eval( lhs_ ) - eval( rhs_ ), j );
10614 column( refres_, j ) -= column( eval( reflhs_ ) - eval( refrhs_ ), j );
10615 }
10616 }
10617 catch( std::exception& ex ) {
10618 convertException<MT1,MT2>( ex );
10619 }
10620
10621 checkResults<MT1,MT2>();
10622
10623 try {
10624 initResults();
10625 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10626 column( dres_ , j ) -= column( eval( lhs_ ) - eval( orhs_ ), j );
10627 column( odres_ , j ) -= column( eval( lhs_ ) - eval( orhs_ ), j );
10628 column( sres_ , j ) -= column( eval( lhs_ ) - eval( orhs_ ), j );
10629 column( osres_ , j ) -= column( eval( lhs_ ) - eval( orhs_ ), j );
10630 column( refres_, j ) -= column( eval( reflhs_ ) - eval( refrhs_ ), j );
10631 }
10632 }
10633 catch( std::exception& ex ) {
10634 convertException<MT1,OMT2>( ex );
10635 }
10636
10637 checkResults<MT1,OMT2>();
10638
10639 try {
10640 initResults();
10641 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10642 column( dres_ , j ) -= column( eval( olhs_ ) - eval( rhs_ ), j );
10643 column( odres_ , j ) -= column( eval( olhs_ ) - eval( rhs_ ), j );
10644 column( sres_ , j ) -= column( eval( olhs_ ) - eval( rhs_ ), j );
10645 column( osres_ , j ) -= column( eval( olhs_ ) - eval( rhs_ ), j );
10646 column( refres_, j ) -= column( eval( reflhs_ ) - eval( refrhs_ ), j );
10647 }
10648 }
10649 catch( std::exception& ex ) {
10650 convertException<OMT1,MT2>( ex );
10651 }
10652
10653 checkResults<OMT1,MT2>();
10654
10655 try {
10656 initResults();
10657 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10658 column( dres_ , j ) -= column( eval( olhs_ ) - eval( orhs_ ), j );
10659 column( odres_ , j ) -= column( eval( olhs_ ) - eval( orhs_ ), j );
10660 column( sres_ , j ) -= column( eval( olhs_ ) - eval( orhs_ ), j );
10661 column( osres_ , j ) -= column( eval( olhs_ ) - eval( orhs_ ), j );
10662 column( refres_, j ) -= column( eval( reflhs_ ) - eval( refrhs_ ), j );
10663 }
10664 }
10665 catch( std::exception& ex ) {
10666 convertException<OMT1,OMT2>( ex );
10667 }
10668
10669 checkResults<OMT1,OMT2>();
10670 }
10671
10672
10673 //=====================================================================================
10674 // Column-wise subtraction with multiplication assignment
10675 //=====================================================================================
10676
10677 // Column-wise subtraction with multiplication assignment with the given matrices
10678 {
10679 test_ = "Column-wise subtraction with multiplication assignment with the given matrices";
10680 error_ = "Failed multiplication assignment operation";
10681
10682 try {
10683 initResults();
10684 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10685 column( dres_ , j ) *= column( lhs_ - rhs_, j );
10686 column( odres_ , j ) *= column( lhs_ - rhs_, j );
10687 column( sres_ , j ) *= column( lhs_ - rhs_, j );
10688 column( osres_ , j ) *= column( lhs_ - rhs_, j );
10689 column( refres_, j ) *= column( reflhs_ - refrhs_, j );
10690 }
10691 }
10692 catch( std::exception& ex ) {
10693 convertException<MT1,MT2>( ex );
10694 }
10695
10696 checkResults<MT1,MT2>();
10697
10698 try {
10699 initResults();
10700 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10701 column( dres_ , j ) *= column( lhs_ - orhs_, j );
10702 column( odres_ , j ) *= column( lhs_ - orhs_, j );
10703 column( sres_ , j ) *= column( lhs_ - orhs_, j );
10704 column( osres_ , j ) *= column( lhs_ - orhs_, j );
10705 column( refres_, j ) *= column( reflhs_ - refrhs_, j );
10706 }
10707 }
10708 catch( std::exception& ex ) {
10709 convertException<MT1,OMT2>( ex );
10710 }
10711
10712 checkResults<MT1,OMT2>();
10713
10714 try {
10715 initResults();
10716 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10717 column( dres_ , j ) *= column( olhs_ - rhs_, j );
10718 column( odres_ , j ) *= column( olhs_ - rhs_, j );
10719 column( sres_ , j ) *= column( olhs_ - rhs_, j );
10720 column( osres_ , j ) *= column( olhs_ - rhs_, j );
10721 column( refres_, j ) *= column( reflhs_ - refrhs_, j );
10722 }
10723 }
10724 catch( std::exception& ex ) {
10725 convertException<OMT1,MT2>( ex );
10726 }
10727
10728 checkResults<OMT1,MT2>();
10729
10730 try {
10731 initResults();
10732 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10733 column( dres_ , j ) *= column( olhs_ - orhs_, j );
10734 column( odres_ , j ) *= column( olhs_ - orhs_, j );
10735 column( sres_ , j ) *= column( olhs_ - orhs_, j );
10736 column( osres_ , j ) *= column( olhs_ - orhs_, j );
10737 column( refres_, j ) *= column( reflhs_ - refrhs_, j );
10738 }
10739 }
10740 catch( std::exception& ex ) {
10741 convertException<OMT1,OMT2>( ex );
10742 }
10743
10744 checkResults<OMT1,OMT2>();
10745 }
10746
10747 // Column-wise subtraction with multiplication assignment with evaluated matrices
10748 {
10749 test_ = "Column-wise subtraction with multiplication assignment with evaluated matrices";
10750 error_ = "Failed multiplication assignment operation";
10751
10752 try {
10753 initResults();
10754 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10755 column( dres_ , j ) *= column( eval( lhs_ ) - eval( rhs_ ), j );
10756 column( odres_ , j ) *= column( eval( lhs_ ) - eval( rhs_ ), j );
10757 column( sres_ , j ) *= column( eval( lhs_ ) - eval( rhs_ ), j );
10758 column( osres_ , j ) *= column( eval( lhs_ ) - eval( rhs_ ), j );
10759 column( refres_, j ) *= column( eval( reflhs_ ) - eval( refrhs_ ), j );
10760 }
10761 }
10762 catch( std::exception& ex ) {
10763 convertException<MT1,MT2>( ex );
10764 }
10765
10766 checkResults<MT1,MT2>();
10767
10768 try {
10769 initResults();
10770 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10771 column( dres_ , j ) *= column( eval( lhs_ ) - eval( orhs_ ), j );
10772 column( odres_ , j ) *= column( eval( lhs_ ) - eval( orhs_ ), j );
10773 column( sres_ , j ) *= column( eval( lhs_ ) - eval( orhs_ ), j );
10774 column( osres_ , j ) *= column( eval( lhs_ ) - eval( orhs_ ), j );
10775 column( refres_, j ) *= column( eval( reflhs_ ) - eval( refrhs_ ), j );
10776 }
10777 }
10778 catch( std::exception& ex ) {
10779 convertException<MT1,OMT2>( ex );
10780 }
10781
10782 checkResults<MT1,OMT2>();
10783
10784 try {
10785 initResults();
10786 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10787 column( dres_ , j ) *= column( eval( olhs_ ) - eval( rhs_ ), j );
10788 column( odres_ , j ) *= column( eval( olhs_ ) - eval( rhs_ ), j );
10789 column( sres_ , j ) *= column( eval( olhs_ ) - eval( rhs_ ), j );
10790 column( osres_ , j ) *= column( eval( olhs_ ) - eval( rhs_ ), j );
10791 column( refres_, j ) *= column( eval( reflhs_ ) - eval( refrhs_ ), j );
10792 }
10793 }
10794 catch( std::exception& ex ) {
10795 convertException<OMT1,MT2>( ex );
10796 }
10797
10798 checkResults<OMT1,MT2>();
10799
10800 try {
10801 initResults();
10802 for( size_t j=0UL; j<lhs_.columns(); ++j ) {
10803 column( dres_ , j ) *= column( eval( olhs_ ) - eval( orhs_ ), j );
10804 column( odres_ , j ) *= column( eval( olhs_ ) - eval( orhs_ ), j );
10805 column( sres_ , j ) *= column( eval( olhs_ ) - eval( orhs_ ), j );
10806 column( osres_ , j ) *= column( eval( olhs_ ) - eval( orhs_ ), j );
10807 column( refres_, j ) *= column( eval( reflhs_ ) - eval( refrhs_ ), j );
10808 }
10809 }
10810 catch( std::exception& ex ) {
10811 convertException<OMT1,OMT2>( ex );
10812 }
10813
10814 checkResults<OMT1,OMT2>();
10815 }
10816
10817
10818 //=====================================================================================
10819 // Failure cases
10820 //=====================================================================================
10821
10822 // Out-of-bounds access (invalid column index)
10823 {
10824 test_ = "Out-of-bounds column construction (invalid column index)";
10825 error_ = "Setup of out-of-bounds column succeeded";
10826
10827 try {
10828 auto c = column( lhs_ - rhs_, lhs_.columns() );
10829
10830 std::ostringstream oss;
10831 oss << " Test: " << test_ << "\n"
10832 << " Error: " << error_ << "\n"
10833 << " Details:\n"
10834 << " Random seed = " << blaze::getSeed() << "\n"
10835 << " Left-hand side sparse matrix type:\n"
10836 << " " << typeid( MT1 ).name() << "\n"
10837 << " Right-hand side sparse matrix type:\n"
10838 << " " << typeid( MT2 ).name() << "\n"
10839 << " Result:\n" << c << "\n";
10840 throw std::runtime_error( oss.str() );
10841 }
10842 catch( std::invalid_argument& ex ) {
10843 checkExceptionMessage( ex, "Invalid column access index" );
10844 }
10845
10846 try {
10847 auto c = column( lhs_ - orhs_, lhs_.columns() );
10848
10849 std::ostringstream oss;
10850 oss << " Test: " << test_ << "\n"
10851 << " Error: " << error_ << "\n"
10852 << " Details:\n"
10853 << " Random seed = " << blaze::getSeed() << "\n"
10854 << " Left-hand side sparse matrix type:\n"
10855 << " " << typeid( MT1 ).name() << "\n"
10856 << " Right-hand side sparse matrix type:\n"
10857 << " " << typeid( OMT2 ).name() << "\n"
10858 << " Result:\n" << c << "\n";
10859 throw std::runtime_error( oss.str() );
10860 }
10861 catch( std::invalid_argument& ex ) {
10862 checkExceptionMessage( ex, "Invalid column access index" );
10863 }
10864
10865 try {
10866 auto c = column( olhs_ - rhs_, olhs_.columns() );
10867
10868 std::ostringstream oss;
10869 oss << " Test: " << test_ << "\n"
10870 << " Error: " << error_ << "\n"
10871 << " Details:\n"
10872 << " Random seed = " << blaze::getSeed() << "\n"
10873 << " Left-hand side sparse matrix type:\n"
10874 << " " << typeid( OMT1 ).name() << "\n"
10875 << " Right-hand side sparse matrix type:\n"
10876 << " " << typeid( MT2 ).name() << "\n"
10877 << " Result:\n" << c << "\n";
10878 throw std::runtime_error( oss.str() );
10879 }
10880 catch( std::invalid_argument& ex ) {
10881 checkExceptionMessage( ex, "Invalid column access index" );
10882 }
10883
10884 try {
10885 auto c = column( olhs_ - orhs_, olhs_.columns() );
10886
10887 std::ostringstream oss;
10888 oss << " Test: " << test_ << "\n"
10889 << " Error: " << error_ << "\n"
10890 << " Details:\n"
10891 << " Random seed = " << blaze::getSeed() << "\n"
10892 << " Left-hand side sparse matrix type:\n"
10893 << " " << typeid( OMT1 ).name() << "\n"
10894 << " Right-hand side sparse matrix type:\n"
10895 << " " << typeid( OMT2 ).name() << "\n"
10896 << " Result:\n" << c << "\n";
10897 throw std::runtime_error( oss.str() );
10898 }
10899 catch( std::invalid_argument& ex ) {
10900 checkExceptionMessage( ex, "Invalid column access index" );
10901 }
10902 }
10903 }
10904 #endif
10905 }
10906 //*************************************************************************************************
10907
10908
10909 //*************************************************************************************************
10910 /*!\brief Testing the columns-wise sparse matrix/sparse matrix subtraction.
10911 //
10912 // \return void
10913 // \exception std::runtime_error Subtraction error detected.
10914 //
10915 // This function tests the columns-wise matrix subtraction with plain assignment, addition
10916 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
10917 // from the subtraction or the subsequent assignment is detected, a \a std::runtime_error exception
10918 // is thrown.
10919 */
10920 template< typename MT1 // Type of the left-hand side sparse matrix
10921 , typename MT2 > // Type of the right-hand side sparse matrix
testColumnsOperation(blaze::TrueType)10922 void OperationTest<MT1,MT2>::testColumnsOperation( blaze::TrueType )
10923 {
10924 #if BLAZETEST_MATHTEST_TEST_COLUMNS_OPERATION
10925 if( BLAZETEST_MATHTEST_TEST_COLUMNS_OPERATION > 1 )
10926 {
10927 if( lhs_.columns() == 0UL )
10928 return;
10929
10930
10931 std::vector<size_t> indices( lhs_.columns() );
10932 std::iota( indices.begin(), indices.end(), 0UL );
10933 std::random_shuffle( indices.begin(), indices.end() );
10934
10935
10936 //=====================================================================================
10937 // Columns-wise subtraction
10938 //=====================================================================================
10939
10940 // Columns-wise subtraction with the given matrices
10941 {
10942 test_ = "Columns-wise subtraction with the given matrices";
10943 error_ = "Failed subtraction operation";
10944
10945 try {
10946 initResults();
10947 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10948 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10949 columns( dres_ , &indices[index], n ) = columns( lhs_ - rhs_, &indices[index], n );
10950 columns( odres_ , &indices[index], n ) = columns( lhs_ - rhs_, &indices[index], n );
10951 columns( sres_ , &indices[index], n ) = columns( lhs_ - rhs_, &indices[index], n );
10952 columns( osres_ , &indices[index], n ) = columns( lhs_ - rhs_, &indices[index], n );
10953 columns( refres_, &indices[index], n ) = columns( reflhs_ - refrhs_, &indices[index], n );
10954 }
10955 }
10956 catch( std::exception& ex ) {
10957 convertException<MT1,MT2>( ex );
10958 }
10959
10960 checkResults<MT1,MT2>();
10961
10962 try {
10963 initResults();
10964 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10965 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10966 columns( dres_ , &indices[index], n ) = columns( lhs_ - orhs_, &indices[index], n );
10967 columns( odres_ , &indices[index], n ) = columns( lhs_ - orhs_, &indices[index], n );
10968 columns( sres_ , &indices[index], n ) = columns( lhs_ - orhs_, &indices[index], n );
10969 columns( osres_ , &indices[index], n ) = columns( lhs_ - orhs_, &indices[index], n );
10970 columns( refres_, &indices[index], n ) = columns( reflhs_ - refrhs_, &indices[index], n );
10971 }
10972 }
10973 catch( std::exception& ex ) {
10974 convertException<MT1,OMT2>( ex );
10975 }
10976
10977 checkResults<MT1,OMT2>();
10978
10979 try {
10980 initResults();
10981 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10982 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10983 columns( dres_ , &indices[index], n ) = columns( olhs_ - rhs_, &indices[index], n );
10984 columns( odres_ , &indices[index], n ) = columns( olhs_ - rhs_, &indices[index], n );
10985 columns( sres_ , &indices[index], n ) = columns( olhs_ - rhs_, &indices[index], n );
10986 columns( osres_ , &indices[index], n ) = columns( olhs_ - rhs_, &indices[index], n );
10987 columns( refres_, &indices[index], n ) = columns( reflhs_ - refrhs_, &indices[index], n );
10988 }
10989 }
10990 catch( std::exception& ex ) {
10991 convertException<OMT1,MT2>( ex );
10992 }
10993
10994 checkResults<OMT1,MT2>();
10995
10996 try {
10997 initResults();
10998 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10999 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11000 columns( dres_ , &indices[index], n ) = columns( olhs_ - orhs_, &indices[index], n );
11001 columns( odres_ , &indices[index], n ) = columns( olhs_ - orhs_, &indices[index], n );
11002 columns( sres_ , &indices[index], n ) = columns( olhs_ - orhs_, &indices[index], n );
11003 columns( osres_ , &indices[index], n ) = columns( olhs_ - orhs_, &indices[index], n );
11004 columns( refres_, &indices[index], n ) = columns( reflhs_ - refrhs_, &indices[index], n );
11005 }
11006 }
11007 catch( std::exception& ex ) {
11008 convertException<OMT1,OMT2>( ex );
11009 }
11010
11011 checkResults<OMT1,OMT2>();
11012 }
11013
11014 // Columns-wise subtraction with evaluated matrices
11015 {
11016 test_ = "Columns-wise subtraction with evaluated matrices";
11017 error_ = "Failed subtraction operation";
11018
11019 try {
11020 initResults();
11021 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11022 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11023 columns( dres_ , &indices[index], n ) = columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11024 columns( odres_ , &indices[index], n ) = columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11025 columns( sres_ , &indices[index], n ) = columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11026 columns( osres_ , &indices[index], n ) = columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11027 columns( refres_, &indices[index], n ) = columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11028 }
11029 }
11030 catch( std::exception& ex ) {
11031 convertException<MT1,MT2>( ex );
11032 }
11033
11034 checkResults<MT1,MT2>();
11035
11036 try {
11037 initResults();
11038 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11039 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11040 columns( dres_ , &indices[index], n ) = columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11041 columns( odres_ , &indices[index], n ) = columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11042 columns( sres_ , &indices[index], n ) = columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11043 columns( osres_ , &indices[index], n ) = columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11044 columns( refres_, &indices[index], n ) = columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11045 }
11046 }
11047 catch( std::exception& ex ) {
11048 convertException<MT1,OMT2>( ex );
11049 }
11050
11051 checkResults<MT1,OMT2>();
11052
11053 try {
11054 initResults();
11055 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11056 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11057 columns( dres_ , &indices[index], n ) = columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11058 columns( odres_ , &indices[index], n ) = columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11059 columns( sres_ , &indices[index], n ) = columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11060 columns( osres_ , &indices[index], n ) = columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11061 columns( refres_, &indices[index], n ) = columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11062 }
11063 }
11064 catch( std::exception& ex ) {
11065 convertException<OMT1,MT2>( ex );
11066 }
11067
11068 checkResults<OMT1,MT2>();
11069
11070 try {
11071 initResults();
11072 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11073 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11074 columns( dres_ , &indices[index], n ) = columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11075 columns( odres_ , &indices[index], n ) = columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11076 columns( sres_ , &indices[index], n ) = columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11077 columns( osres_ , &indices[index], n ) = columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11078 columns( refres_, &indices[index], n ) = columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11079 }
11080 }
11081 catch( std::exception& ex ) {
11082 convertException<OMT1,OMT2>( ex );
11083 }
11084
11085 checkResults<OMT1,OMT2>();
11086 }
11087
11088
11089 //=====================================================================================
11090 // Columns-wise subtraction with addition assignment
11091 //=====================================================================================
11092
11093 // Columns-wise subtraction with addition assignment with the given matrices
11094 {
11095 test_ = "Columns-wise subtraction with addition assignment with the given matrices";
11096 error_ = "Failed addition assignment operation";
11097
11098 try {
11099 initResults();
11100 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11101 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11102 columns( dres_ , &indices[index], n ) += columns( lhs_ - rhs_, &indices[index], n );
11103 columns( odres_ , &indices[index], n ) += columns( lhs_ - rhs_, &indices[index], n );
11104 columns( sres_ , &indices[index], n ) += columns( lhs_ - rhs_, &indices[index], n );
11105 columns( osres_ , &indices[index], n ) += columns( lhs_ - rhs_, &indices[index], n );
11106 columns( refres_, &indices[index], n ) += columns( reflhs_ - refrhs_, &indices[index], n );
11107 }
11108 }
11109 catch( std::exception& ex ) {
11110 convertException<MT1,MT2>( ex );
11111 }
11112
11113 checkResults<MT1,MT2>();
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( lhs_ - orhs_, &indices[index], n );
11120 columns( odres_ , &indices[index], n ) += columns( lhs_ - orhs_, &indices[index], n );
11121 columns( sres_ , &indices[index], n ) += columns( lhs_ - orhs_, &indices[index], n );
11122 columns( osres_ , &indices[index], n ) += columns( lhs_ - orhs_, &indices[index], n );
11123 columns( refres_, &indices[index], n ) += columns( reflhs_ - refrhs_, &indices[index], n );
11124 }
11125 }
11126 catch( std::exception& ex ) {
11127 convertException<MT1,OMT2>( ex );
11128 }
11129
11130 checkResults<MT1,OMT2>();
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( olhs_ - rhs_, &indices[index], n );
11137 columns( odres_ , &indices[index], n ) += columns( olhs_ - rhs_, &indices[index], n );
11138 columns( sres_ , &indices[index], n ) += columns( olhs_ - rhs_, &indices[index], n );
11139 columns( osres_ , &indices[index], n ) += columns( olhs_ - rhs_, &indices[index], n );
11140 columns( refres_, &indices[index], n ) += columns( reflhs_ - refrhs_, &indices[index], n );
11141 }
11142 }
11143 catch( std::exception& ex ) {
11144 convertException<OMT1,MT2>( ex );
11145 }
11146
11147 checkResults<OMT1,MT2>();
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( olhs_ - orhs_, &indices[index], n );
11154 columns( odres_ , &indices[index], n ) += columns( olhs_ - orhs_, &indices[index], n );
11155 columns( sres_ , &indices[index], n ) += columns( olhs_ - orhs_, &indices[index], n );
11156 columns( osres_ , &indices[index], n ) += columns( olhs_ - orhs_, &indices[index], n );
11157 columns( refres_, &indices[index], n ) += columns( reflhs_ - refrhs_, &indices[index], n );
11158 }
11159 }
11160 catch( std::exception& ex ) {
11161 convertException<OMT1,OMT2>( ex );
11162 }
11163
11164 checkResults<OMT1,OMT2>();
11165 }
11166
11167 // Columns-wise subtraction with addition assignment with evaluated matrices
11168 {
11169 test_ = "Columns-wise subtraction with addition assignment with evaluated matrices";
11170 error_ = "Failed addition assignment operation";
11171
11172 try {
11173 initResults();
11174 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11175 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11176 columns( dres_ , &indices[index], n ) += columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11177 columns( odres_ , &indices[index], n ) += columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11178 columns( sres_ , &indices[index], n ) += columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11179 columns( osres_ , &indices[index], n ) += columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11180 columns( refres_, &indices[index], n ) += columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11181 }
11182 }
11183 catch( std::exception& ex ) {
11184 convertException<MT1,MT2>( ex );
11185 }
11186
11187 checkResults<MT1,MT2>();
11188
11189 try {
11190 initResults();
11191 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11192 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11193 columns( dres_ , &indices[index], n ) += columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11194 columns( odres_ , &indices[index], n ) += columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11195 columns( sres_ , &indices[index], n ) += columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11196 columns( osres_ , &indices[index], n ) += columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11197 columns( refres_, &indices[index], n ) += columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11198 }
11199 }
11200 catch( std::exception& ex ) {
11201 convertException<MT1,OMT2>( ex );
11202 }
11203
11204 checkResults<MT1,OMT2>();
11205
11206 try {
11207 initResults();
11208 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11209 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11210 columns( dres_ , &indices[index], n ) += columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11211 columns( odres_ , &indices[index], n ) += columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11212 columns( sres_ , &indices[index], n ) += columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11213 columns( osres_ , &indices[index], n ) += columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11214 columns( refres_, &indices[index], n ) += columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11215 }
11216 }
11217 catch( std::exception& ex ) {
11218 convertException<OMT1,MT2>( ex );
11219 }
11220
11221 checkResults<OMT1,MT2>();
11222
11223 try {
11224 initResults();
11225 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11226 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11227 columns( dres_ , &indices[index], n ) += columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11228 columns( odres_ , &indices[index], n ) += columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11229 columns( sres_ , &indices[index], n ) += columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11230 columns( osres_ , &indices[index], n ) += columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11231 columns( refres_, &indices[index], n ) += columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11232 }
11233 }
11234 catch( std::exception& ex ) {
11235 convertException<OMT1,OMT2>( ex );
11236 }
11237
11238 checkResults<OMT1,OMT2>();
11239 }
11240
11241
11242 //=====================================================================================
11243 // Columns-wise subtraction with subtraction assignment
11244 //=====================================================================================
11245
11246 // Columns-wise subtraction with subtraction assignment with the given matrices
11247 {
11248 test_ = "Columns-wise subtraction with subtraction assignment with the given matrices";
11249 error_ = "Failed subtraction assignment operation";
11250
11251 try {
11252 initResults();
11253 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11254 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11255 columns( dres_ , &indices[index], n ) -= columns( lhs_ - rhs_, &indices[index], n );
11256 columns( odres_ , &indices[index], n ) -= columns( lhs_ - rhs_, &indices[index], n );
11257 columns( sres_ , &indices[index], n ) -= columns( lhs_ - rhs_, &indices[index], n );
11258 columns( osres_ , &indices[index], n ) -= columns( lhs_ - rhs_, &indices[index], n );
11259 columns( refres_, &indices[index], n ) -= columns( reflhs_ - refrhs_, &indices[index], n );
11260 }
11261 }
11262 catch( std::exception& ex ) {
11263 convertException<MT1,MT2>( ex );
11264 }
11265
11266 checkResults<MT1,MT2>();
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( lhs_ - orhs_, &indices[index], n );
11273 columns( odres_ , &indices[index], n ) -= columns( lhs_ - orhs_, &indices[index], n );
11274 columns( sres_ , &indices[index], n ) -= columns( lhs_ - orhs_, &indices[index], n );
11275 columns( osres_ , &indices[index], n ) -= columns( lhs_ - orhs_, &indices[index], n );
11276 columns( refres_, &indices[index], n ) -= columns( reflhs_ - refrhs_, &indices[index], n );
11277 }
11278 }
11279 catch( std::exception& ex ) {
11280 convertException<MT1,OMT2>( ex );
11281 }
11282
11283 checkResults<MT1,OMT2>();
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( olhs_ - rhs_, &indices[index], n );
11290 columns( odres_ , &indices[index], n ) -= columns( olhs_ - rhs_, &indices[index], n );
11291 columns( sres_ , &indices[index], n ) -= columns( olhs_ - rhs_, &indices[index], n );
11292 columns( osres_ , &indices[index], n ) -= columns( olhs_ - rhs_, &indices[index], n );
11293 columns( refres_, &indices[index], n ) -= columns( reflhs_ - refrhs_, &indices[index], n );
11294 }
11295 }
11296 catch( std::exception& ex ) {
11297 convertException<OMT1,MT2>( ex );
11298 }
11299
11300 checkResults<OMT1,MT2>();
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( olhs_ - orhs_, &indices[index], n );
11307 columns( odres_ , &indices[index], n ) -= columns( olhs_ - orhs_, &indices[index], n );
11308 columns( sres_ , &indices[index], n ) -= columns( olhs_ - orhs_, &indices[index], n );
11309 columns( osres_ , &indices[index], n ) -= columns( olhs_ - orhs_, &indices[index], n );
11310 columns( refres_, &indices[index], n ) -= columns( reflhs_ - refrhs_, &indices[index], n );
11311 }
11312 }
11313 catch( std::exception& ex ) {
11314 convertException<OMT1,OMT2>( ex );
11315 }
11316
11317 checkResults<OMT1,OMT2>();
11318 }
11319
11320 // Columns-wise subtraction with subtraction assignment with evaluated matrices
11321 {
11322 test_ = "Columns-wise subtraction with subtraction assignment with evaluated matrices";
11323 error_ = "Failed subtraction assignment operation";
11324
11325 try {
11326 initResults();
11327 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11328 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11329 columns( dres_ , &indices[index], n ) -= columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11330 columns( odres_ , &indices[index], n ) -= columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11331 columns( sres_ , &indices[index], n ) -= columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11332 columns( osres_ , &indices[index], n ) -= columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11333 columns( refres_, &indices[index], n ) -= columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11334 }
11335 }
11336 catch( std::exception& ex ) {
11337 convertException<MT1,MT2>( ex );
11338 }
11339
11340 checkResults<MT1,MT2>();
11341
11342 try {
11343 initResults();
11344 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11345 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11346 columns( dres_ , &indices[index], n ) -= columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11347 columns( odres_ , &indices[index], n ) -= columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11348 columns( sres_ , &indices[index], n ) -= columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11349 columns( osres_ , &indices[index], n ) -= columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11350 columns( refres_, &indices[index], n ) -= columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11351 }
11352 }
11353 catch( std::exception& ex ) {
11354 convertException<MT1,OMT2>( ex );
11355 }
11356
11357 checkResults<MT1,OMT2>();
11358
11359 try {
11360 initResults();
11361 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11362 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11363 columns( dres_ , &indices[index], n ) -= columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11364 columns( odres_ , &indices[index], n ) -= columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11365 columns( sres_ , &indices[index], n ) -= columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11366 columns( osres_ , &indices[index], n ) -= columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11367 columns( refres_, &indices[index], n ) -= columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11368 }
11369 }
11370 catch( std::exception& ex ) {
11371 convertException<OMT1,MT2>( ex );
11372 }
11373
11374 checkResults<OMT1,MT2>();
11375
11376 try {
11377 initResults();
11378 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11379 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11380 columns( dres_ , &indices[index], n ) -= columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11381 columns( odres_ , &indices[index], n ) -= columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11382 columns( sres_ , &indices[index], n ) -= columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11383 columns( osres_ , &indices[index], n ) -= columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11384 columns( refres_, &indices[index], n ) -= columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11385 }
11386 }
11387 catch( std::exception& ex ) {
11388 convertException<OMT1,OMT2>( ex );
11389 }
11390
11391 checkResults<OMT1,OMT2>();
11392 }
11393
11394
11395 //=====================================================================================
11396 // Columns-wise subtraction with Schur product assignment
11397 //=====================================================================================
11398
11399 // Columns-wise subtraction with Schur product assignment with the given matrices
11400 {
11401 test_ = "Columns-wise subtraction with Schur product assignment with the given matrices";
11402 error_ = "Failed Schur product assignment operation";
11403
11404 try {
11405 initResults();
11406 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11407 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11408 columns( dres_ , &indices[index], n ) %= columns( lhs_ - rhs_, &indices[index], n );
11409 columns( odres_ , &indices[index], n ) %= columns( lhs_ - rhs_, &indices[index], n );
11410 columns( sres_ , &indices[index], n ) %= columns( lhs_ - rhs_, &indices[index], n );
11411 columns( osres_ , &indices[index], n ) %= columns( lhs_ - rhs_, &indices[index], n );
11412 columns( refres_, &indices[index], n ) %= columns( reflhs_ - refrhs_, &indices[index], n );
11413 }
11414 }
11415 catch( std::exception& ex ) {
11416 convertException<MT1,MT2>( ex );
11417 }
11418
11419 checkResults<MT1,MT2>();
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( lhs_ - orhs_, &indices[index], n );
11426 columns( odres_ , &indices[index], n ) %= columns( lhs_ - orhs_, &indices[index], n );
11427 columns( sres_ , &indices[index], n ) %= columns( lhs_ - orhs_, &indices[index], n );
11428 columns( osres_ , &indices[index], n ) %= columns( lhs_ - orhs_, &indices[index], n );
11429 columns( refres_, &indices[index], n ) %= columns( reflhs_ - refrhs_, &indices[index], n );
11430 }
11431 }
11432 catch( std::exception& ex ) {
11433 convertException<MT1,OMT2>( ex );
11434 }
11435
11436 checkResults<MT1,OMT2>();
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( olhs_ - rhs_, &indices[index], n );
11443 columns( odres_ , &indices[index], n ) %= columns( olhs_ - rhs_, &indices[index], n );
11444 columns( sres_ , &indices[index], n ) %= columns( olhs_ - rhs_, &indices[index], n );
11445 columns( osres_ , &indices[index], n ) %= columns( olhs_ - rhs_, &indices[index], n );
11446 columns( refres_, &indices[index], n ) %= columns( reflhs_ - refrhs_, &indices[index], n );
11447 }
11448 }
11449 catch( std::exception& ex ) {
11450 convertException<OMT1,MT2>( ex );
11451 }
11452
11453 checkResults<OMT1,MT2>();
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( olhs_ - orhs_, &indices[index], n );
11460 columns( odres_ , &indices[index], n ) %= columns( olhs_ - orhs_, &indices[index], n );
11461 columns( sres_ , &indices[index], n ) %= columns( olhs_ - orhs_, &indices[index], n );
11462 columns( osres_ , &indices[index], n ) %= columns( olhs_ - orhs_, &indices[index], n );
11463 columns( refres_, &indices[index], n ) %= columns( reflhs_ - refrhs_, &indices[index], n );
11464 }
11465 }
11466 catch( std::exception& ex ) {
11467 convertException<OMT1,OMT2>( ex );
11468 }
11469
11470 checkResults<OMT1,OMT2>();
11471 }
11472
11473 // Columns-wise subtraction with Schur product assignment with evaluated matrices
11474 {
11475 test_ = "Columns-wise subtraction with Schur product assignment with evaluated matrices";
11476 error_ = "Failed Schur product assignment operation";
11477
11478 try {
11479 initResults();
11480 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11481 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11482 columns( dres_ , &indices[index], n ) %= columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11483 columns( odres_ , &indices[index], n ) %= columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11484 columns( sres_ , &indices[index], n ) %= columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11485 columns( osres_ , &indices[index], n ) %= columns( eval( lhs_ ) - eval( rhs_ ), &indices[index], n );
11486 columns( refres_, &indices[index], n ) %= columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11487 }
11488 }
11489 catch( std::exception& ex ) {
11490 convertException<MT1,MT2>( ex );
11491 }
11492
11493 checkResults<MT1,MT2>();
11494
11495 try {
11496 initResults();
11497 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11498 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11499 columns( dres_ , &indices[index], n ) %= columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11500 columns( odres_ , &indices[index], n ) %= columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11501 columns( sres_ , &indices[index], n ) %= columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11502 columns( osres_ , &indices[index], n ) %= columns( eval( lhs_ ) - eval( orhs_ ), &indices[index], n );
11503 columns( refres_, &indices[index], n ) %= columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11504 }
11505 }
11506 catch( std::exception& ex ) {
11507 convertException<MT1,OMT2>( ex );
11508 }
11509
11510 checkResults<MT1,OMT2>();
11511
11512 try {
11513 initResults();
11514 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11515 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11516 columns( dres_ , &indices[index], n ) %= columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11517 columns( odres_ , &indices[index], n ) %= columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11518 columns( sres_ , &indices[index], n ) %= columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11519 columns( osres_ , &indices[index], n ) %= columns( eval( olhs_ ) - eval( rhs_ ), &indices[index], n );
11520 columns( refres_, &indices[index], n ) %= columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11521 }
11522 }
11523 catch( std::exception& ex ) {
11524 convertException<OMT1,MT2>( ex );
11525 }
11526
11527 checkResults<OMT1,MT2>();
11528
11529 try {
11530 initResults();
11531 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11532 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11533 columns( dres_ , &indices[index], n ) %= columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11534 columns( odres_ , &indices[index], n ) %= columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11535 columns( sres_ , &indices[index], n ) %= columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11536 columns( osres_ , &indices[index], n ) %= columns( eval( olhs_ ) - eval( orhs_ ), &indices[index], n );
11537 columns( refres_, &indices[index], n ) %= columns( eval( reflhs_ ) - eval( refrhs_ ), &indices[index], n );
11538 }
11539 }
11540 catch( std::exception& ex ) {
11541 convertException<OMT1,OMT2>( ex );
11542 }
11543
11544 checkResults<OMT1,OMT2>();
11545 }
11546
11547
11548 //=====================================================================================
11549 // Failure cases
11550 //=====================================================================================
11551
11552 // Out-of-bounds access (invalid column index; initializer_list)
11553 {
11554 test_ = "Out-of-bounds column selection construction (invalid column index; initializer_list)";
11555 error_ = "Setup of out-of-bounds column selection succeeded";
11556
11557 try {
11558 auto c = columns( lhs_ - rhs_, { lhs_.columns() } );
11559
11560 std::ostringstream oss;
11561 oss << " Test: " << test_ << "\n"
11562 << " Error: " << error_ << "\n"
11563 << " Details:\n"
11564 << " Random seed = " << blaze::getSeed() << "\n"
11565 << " Left-hand side sparse matrix type:\n"
11566 << " " << typeid( MT1 ).name() << "\n"
11567 << " Right-hand side sparse matrix type:\n"
11568 << " " << typeid( MT2 ).name() << "\n"
11569 << " Result:\n" << c << "\n";
11570 throw std::runtime_error( oss.str() );
11571 }
11572 catch( std::invalid_argument& ex ) {
11573 checkExceptionMessage( ex, "Invalid column access index" );
11574 }
11575
11576 try {
11577 auto c = columns( lhs_ - orhs_, { lhs_.columns() } );
11578
11579 std::ostringstream oss;
11580 oss << " Test: " << test_ << "\n"
11581 << " Error: " << error_ << "\n"
11582 << " Details:\n"
11583 << " Random seed = " << blaze::getSeed() << "\n"
11584 << " Left-hand side sparse matrix type:\n"
11585 << " " << typeid( MT1 ).name() << "\n"
11586 << " Right-hand side sparse matrix type:\n"
11587 << " " << typeid( OMT2 ).name() << "\n"
11588 << " Result:\n" << c << "\n";
11589 throw std::runtime_error( oss.str() );
11590 }
11591 catch( std::invalid_argument& ex ) {
11592 checkExceptionMessage( ex, "Invalid column access index" );
11593 }
11594
11595 try {
11596 auto c = columns( olhs_ - rhs_, { olhs_.columns() } );
11597
11598 std::ostringstream oss;
11599 oss << " Test: " << test_ << "\n"
11600 << " Error: " << error_ << "\n"
11601 << " Details:\n"
11602 << " Random seed = " << blaze::getSeed() << "\n"
11603 << " Left-hand side sparse matrix type:\n"
11604 << " " << typeid( OMT1 ).name() << "\n"
11605 << " Right-hand side sparse matrix type:\n"
11606 << " " << typeid( MT2 ).name() << "\n"
11607 << " Result:\n" << c << "\n";
11608 throw std::runtime_error( oss.str() );
11609 }
11610 catch( std::invalid_argument& ex ) {
11611 checkExceptionMessage( ex, "Invalid column access index" );
11612 }
11613
11614 try {
11615 auto c = columns( olhs_ - orhs_, { olhs_.columns() } );
11616
11617 std::ostringstream oss;
11618 oss << " Test: " << test_ << "\n"
11619 << " Error: " << error_ << "\n"
11620 << " Details:\n"
11621 << " Random seed = " << blaze::getSeed() << "\n"
11622 << " Left-hand side sparse matrix type:\n"
11623 << " " << typeid( OMT1 ).name() << "\n"
11624 << " Right-hand side sparse matrix type:\n"
11625 << " " << typeid( OMT2 ).name() << "\n"
11626 << " Result:\n" << c << "\n";
11627 throw std::runtime_error( oss.str() );
11628 }
11629 catch( std::invalid_argument& ex ) {
11630 checkExceptionMessage( ex, "Invalid column access index" );
11631 }
11632 }
11633
11634 // Out-of-bounds access (invalid column index; lambda)
11635 {
11636 test_ = "Out-of-bounds column selection construction (invalid column index; lambda)";
11637 error_ = "Setup of out-of-bounds column selection succeeded";
11638
11639 try {
11640 auto c = columns( lhs_ - rhs_, [index=lhs_.columns()]( size_t ){ return index; }, 1UL );
11641
11642 std::ostringstream oss;
11643 oss << " Test: " << test_ << "\n"
11644 << " Error: " << error_ << "\n"
11645 << " Details:\n"
11646 << " Random seed = " << blaze::getSeed() << "\n"
11647 << " Left-hand side sparse matrix type:\n"
11648 << " " << typeid( MT1 ).name() << "\n"
11649 << " Right-hand side sparse matrix type:\n"
11650 << " " << typeid( MT2 ).name() << "\n"
11651 << " Result:\n" << c << "\n";
11652 throw std::runtime_error( oss.str() );
11653 }
11654 catch( std::invalid_argument& ex ) {
11655 checkExceptionMessage( ex, "Invalid column access index" );
11656 }
11657
11658 try {
11659 auto c = columns( lhs_ - orhs_, [index=lhs_.columns()]( size_t ){ return index; }, 1UL );
11660
11661 std::ostringstream oss;
11662 oss << " Test: " << test_ << "\n"
11663 << " Error: " << error_ << "\n"
11664 << " Details:\n"
11665 << " Random seed = " << blaze::getSeed() << "\n"
11666 << " Left-hand side sparse matrix type:\n"
11667 << " " << typeid( MT1 ).name() << "\n"
11668 << " Right-hand side sparse matrix type:\n"
11669 << " " << typeid( OMT2 ).name() << "\n"
11670 << " Result:\n" << c << "\n";
11671 throw std::runtime_error( oss.str() );
11672 }
11673 catch( std::invalid_argument& ex ) {
11674 checkExceptionMessage( ex, "Invalid column access index" );
11675 }
11676
11677 try {
11678 auto c = columns( olhs_ - rhs_, [index=olhs_.columns()]( size_t ){ return index; }, 1UL );
11679
11680 std::ostringstream oss;
11681 oss << " Test: " << test_ << "\n"
11682 << " Error: " << error_ << "\n"
11683 << " Details:\n"
11684 << " Random seed = " << blaze::getSeed() << "\n"
11685 << " Left-hand side sparse matrix type:\n"
11686 << " " << typeid( OMT1 ).name() << "\n"
11687 << " Right-hand side sparse matrix type:\n"
11688 << " " << typeid( MT2 ).name() << "\n"
11689 << " Result:\n" << c << "\n";
11690 throw std::runtime_error( oss.str() );
11691 }
11692 catch( std::invalid_argument& ex ) {
11693 checkExceptionMessage( ex, "Invalid column access index" );
11694 }
11695
11696 try {
11697 auto c = columns( olhs_ - orhs_, [index=olhs_.columns()]( size_t ){ return index; }, 1UL );
11698
11699 std::ostringstream oss;
11700 oss << " Test: " << test_ << "\n"
11701 << " Error: " << error_ << "\n"
11702 << " Details:\n"
11703 << " Random seed = " << blaze::getSeed() << "\n"
11704 << " Left-hand side sparse matrix type:\n"
11705 << " " << typeid( OMT1 ).name() << "\n"
11706 << " Right-hand side sparse matrix type:\n"
11707 << " " << typeid( OMT2 ).name() << "\n"
11708 << " Result:\n" << c << "\n";
11709 throw std::runtime_error( oss.str() );
11710 }
11711 catch( std::invalid_argument& ex ) {
11712 checkExceptionMessage( ex, "Invalid column access index" );
11713 }
11714 }
11715 }
11716 #endif
11717 }
11718 //*************************************************************************************************
11719
11720
11721 //*************************************************************************************************
11722 /*!\brief Skipping the columns-wise sparse matrix/sparse matrix subtraction.
11723 //
11724 // \return void
11725 //
11726 // This function is called in case the columns-wise matrix/matrix subtraction operation is not
11727 // available for the given matrix types \a MT1 and \a MT2.
11728 */
11729 template< typename MT1 // Type of the left-hand side sparse matrix
11730 , typename MT2 > // Type of the right-hand side sparse matrix
testColumnsOperation(blaze::FalseType)11731 void OperationTest<MT1,MT2>::testColumnsOperation( blaze::FalseType )
11732 {}
11733 //*************************************************************************************************
11734
11735
11736 //*************************************************************************************************
11737 /*!\brief Testing the band-wise sparse matrix/sparse matrix subtraction.
11738 //
11739 // \return void
11740 // \exception std::runtime_error Subtraction error detected.
11741 //
11742 // This function tests the band-wise matrix subtraction with plain assignment, addition assignment,
11743 // subtraction assignment, and multiplication assignment. In case any error resulting from the
11744 // subtraction or the subsequent assignment is detected, a \a std::runtime_error exception is
11745 // thrown.
11746 */
11747 template< typename MT1 // Type of the left-hand side sparse matrix
11748 , typename MT2 > // Type of the right-hand side sparse matrix
testBandOperation()11749 void OperationTest<MT1,MT2>::testBandOperation()
11750 {
11751 #if BLAZETEST_MATHTEST_TEST_BAND_OPERATION
11752 if( BLAZETEST_MATHTEST_TEST_BAND_OPERATION > 1 )
11753 {
11754 if( lhs_.rows() == 0UL || lhs_.columns() == 0UL )
11755 return;
11756
11757
11758 const ptrdiff_t ibegin( 1UL - lhs_.rows() );
11759 const ptrdiff_t iend ( lhs_.columns() );
11760
11761
11762 //=====================================================================================
11763 // Band-wise subtraction
11764 //=====================================================================================
11765
11766 // Band-wise subtraction with the given matrices
11767 {
11768 test_ = "Band-wise subtraction with the given matrices";
11769 error_ = "Failed subtraction operation";
11770
11771 try {
11772 initResults();
11773 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11774 band( dres_ , i ) = band( lhs_ - rhs_, i );
11775 band( odres_ , i ) = band( lhs_ - rhs_, i );
11776 band( sres_ , i ) = band( lhs_ - rhs_, i );
11777 band( osres_ , i ) = band( lhs_ - rhs_, i );
11778 band( refres_, i ) = band( reflhs_ - refrhs_, i );
11779 }
11780 }
11781 catch( std::exception& ex ) {
11782 convertException<MT1,MT2>( ex );
11783 }
11784
11785 checkResults<MT1,MT2>();
11786
11787 try {
11788 initResults();
11789 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11790 band( dres_ , i ) = band( lhs_ - orhs_, i );
11791 band( odres_ , i ) = band( lhs_ - orhs_, i );
11792 band( sres_ , i ) = band( lhs_ - orhs_, i );
11793 band( osres_ , i ) = band( lhs_ - orhs_, i );
11794 band( refres_, i ) = band( reflhs_ - refrhs_, i );
11795 }
11796 }
11797 catch( std::exception& ex ) {
11798 convertException<MT1,OMT2>( ex );
11799 }
11800
11801 checkResults<MT1,OMT2>();
11802
11803 try {
11804 initResults();
11805 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11806 band( dres_ , i ) = band( olhs_ - rhs_, i );
11807 band( odres_ , i ) = band( olhs_ - rhs_, i );
11808 band( sres_ , i ) = band( olhs_ - rhs_, i );
11809 band( osres_ , i ) = band( olhs_ - rhs_, i );
11810 band( refres_, i ) = band( reflhs_ - refrhs_, i );
11811 }
11812 }
11813 catch( std::exception& ex ) {
11814 convertException<OMT1,MT2>( ex );
11815 }
11816
11817 checkResults<OMT1,MT2>();
11818
11819 try {
11820 initResults();
11821 for( size_t i=ibegin; i<iend; ++i ) {
11822 band( dres_ , i ) = band( olhs_ - orhs_, i );
11823 band( odres_ , i ) = band( olhs_ - orhs_, i );
11824 band( sres_ , i ) = band( olhs_ - orhs_, i );
11825 band( osres_ , i ) = band( olhs_ - orhs_, i );
11826 band( refres_, i ) = band( reflhs_ - refrhs_, i );
11827 }
11828 }
11829 catch( std::exception& ex ) {
11830 convertException<OMT1,OMT2>( ex );
11831 }
11832
11833 checkResults<OMT1,OMT2>();
11834 }
11835
11836 // Band-wise subtraction with evaluated matrices
11837 {
11838 test_ = "Band-wise subtraction with evaluated matrices";
11839 error_ = "Failed subtraction operation";
11840
11841 try {
11842 initResults();
11843 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11844 band( dres_ , i ) = band( eval( lhs_ ) - eval( rhs_ ), i );
11845 band( odres_ , i ) = band( eval( lhs_ ) - eval( rhs_ ), i );
11846 band( sres_ , i ) = band( eval( lhs_ ) - eval( rhs_ ), i );
11847 band( osres_ , i ) = band( eval( lhs_ ) - eval( rhs_ ), i );
11848 band( refres_, i ) = band( eval( reflhs_ ) - eval( refrhs_ ), i );
11849 }
11850 }
11851 catch( std::exception& ex ) {
11852 convertException<MT1,MT2>( ex );
11853 }
11854
11855 checkResults<MT1,MT2>();
11856
11857 try {
11858 initResults();
11859 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11860 band( dres_ , i ) = band( eval( lhs_ ) - eval( orhs_ ), i );
11861 band( odres_ , i ) = band( eval( lhs_ ) - eval( orhs_ ), i );
11862 band( sres_ , i ) = band( eval( lhs_ ) - eval( orhs_ ), i );
11863 band( osres_ , i ) = band( eval( lhs_ ) - eval( orhs_ ), i );
11864 band( refres_, i ) = band( eval( reflhs_ ) - eval( refrhs_ ), i );
11865 }
11866 }
11867 catch( std::exception& ex ) {
11868 convertException<MT1,OMT2>( ex );
11869 }
11870
11871 checkResults<MT1,OMT2>();
11872
11873 try {
11874 initResults();
11875 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11876 band( dres_ , i ) = band( eval( olhs_ ) - eval( rhs_ ), i );
11877 band( odres_ , i ) = band( eval( olhs_ ) - eval( rhs_ ), i );
11878 band( sres_ , i ) = band( eval( olhs_ ) - eval( rhs_ ), i );
11879 band( osres_ , i ) = band( eval( olhs_ ) - eval( rhs_ ), i );
11880 band( refres_, i ) = band( eval( reflhs_ ) - eval( refrhs_ ), i );
11881 }
11882 }
11883 catch( std::exception& ex ) {
11884 convertException<OMT1,MT2>( ex );
11885 }
11886
11887 checkResults<OMT1,MT2>();
11888
11889 try {
11890 initResults();
11891 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11892 band( dres_ , i ) = band( eval( olhs_ ) - eval( orhs_ ), i );
11893 band( odres_ , i ) = band( eval( olhs_ ) - eval( orhs_ ), i );
11894 band( sres_ , i ) = band( eval( olhs_ ) - eval( orhs_ ), i );
11895 band( osres_ , i ) = band( eval( olhs_ ) - eval( orhs_ ), i );
11896 band( refres_, i ) = band( eval( reflhs_ ) - eval( refrhs_ ), i );
11897 }
11898 }
11899 catch( std::exception& ex ) {
11900 convertException<OMT1,OMT2>( ex );
11901 }
11902
11903 checkResults<OMT1,OMT2>();
11904 }
11905
11906
11907 //=====================================================================================
11908 // Band-wise subtraction with addition assignment
11909 //=====================================================================================
11910
11911 // Band-wise subtraction with addition assignment with the given matrices
11912 {
11913 test_ = "Band-wise subtraction with addition assignment with the given matrices";
11914 error_ = "Failed addition assignment operation";
11915
11916 try {
11917 initResults();
11918 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11919 band( dres_ , i ) += band( lhs_ - rhs_, i );
11920 band( odres_ , i ) += band( lhs_ - rhs_, i );
11921 band( sres_ , i ) += band( lhs_ - rhs_, i );
11922 band( osres_ , i ) += band( lhs_ - rhs_, i );
11923 band( refres_, i ) += band( reflhs_ - refrhs_, i );
11924 }
11925 }
11926 catch( std::exception& ex ) {
11927 convertException<MT1,MT2>( ex );
11928 }
11929
11930 checkResults<MT1,MT2>();
11931
11932 try {
11933 initResults();
11934 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11935 band( dres_ , i ) += band( lhs_ - orhs_, i );
11936 band( odres_ , i ) += band( lhs_ - orhs_, i );
11937 band( sres_ , i ) += band( lhs_ - orhs_, i );
11938 band( osres_ , i ) += band( lhs_ - orhs_, i );
11939 band( refres_, i ) += band( reflhs_ - refrhs_, i );
11940 }
11941 }
11942 catch( std::exception& ex ) {
11943 convertException<MT1,OMT2>( ex );
11944 }
11945
11946 checkResults<MT1,OMT2>();
11947
11948 try {
11949 initResults();
11950 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11951 band( dres_ , i ) += band( olhs_ - rhs_, i );
11952 band( odres_ , i ) += band( olhs_ - rhs_, i );
11953 band( sres_ , i ) += band( olhs_ - rhs_, i );
11954 band( osres_ , i ) += band( olhs_ - rhs_, i );
11955 band( refres_, i ) += band( reflhs_ - refrhs_, i );
11956 }
11957 }
11958 catch( std::exception& ex ) {
11959 convertException<OMT1,MT2>( ex );
11960 }
11961
11962 checkResults<OMT1,MT2>();
11963
11964 try {
11965 initResults();
11966 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11967 band( dres_ , i ) += band( olhs_ - orhs_, i );
11968 band( odres_ , i ) += band( olhs_ - orhs_, i );
11969 band( sres_ , i ) += band( olhs_ - orhs_, i );
11970 band( osres_ , i ) += band( olhs_ - orhs_, i );
11971 band( refres_, i ) += band( reflhs_ - refrhs_, i );
11972 }
11973 }
11974 catch( std::exception& ex ) {
11975 convertException<OMT1,OMT2>( ex );
11976 }
11977
11978 checkResults<OMT1,OMT2>();
11979 }
11980
11981 // Band-wise subtraction with addition assignment with evaluated matrices
11982 {
11983 test_ = "Band-wise subtraction with addition assignment with evaluated matrices";
11984 error_ = "Failed addition assignment operation";
11985
11986 try {
11987 initResults();
11988 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11989 band( dres_ , i ) += band( eval( lhs_ ) - eval( rhs_ ), i );
11990 band( odres_ , i ) += band( eval( lhs_ ) - eval( rhs_ ), i );
11991 band( sres_ , i ) += band( eval( lhs_ ) - eval( rhs_ ), i );
11992 band( osres_ , i ) += band( eval( lhs_ ) - eval( rhs_ ), i );
11993 band( refres_, i ) += band( eval( reflhs_ ) - eval( refrhs_ ), i );
11994 }
11995 }
11996 catch( std::exception& ex ) {
11997 convertException<MT1,MT2>( ex );
11998 }
11999
12000 checkResults<MT1,MT2>();
12001
12002 try {
12003 initResults();
12004 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12005 band( dres_ , i ) += band( eval( lhs_ ) - eval( orhs_ ), i );
12006 band( odres_ , i ) += band( eval( lhs_ ) - eval( orhs_ ), i );
12007 band( sres_ , i ) += band( eval( lhs_ ) - eval( orhs_ ), i );
12008 band( osres_ , i ) += band( eval( lhs_ ) - eval( orhs_ ), i );
12009 band( refres_, i ) += band( eval( reflhs_ ) - eval( refrhs_ ), i );
12010 }
12011 }
12012 catch( std::exception& ex ) {
12013 convertException<MT1,OMT2>( ex );
12014 }
12015
12016 checkResults<MT1,OMT2>();
12017
12018 try {
12019 initResults();
12020 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12021 band( dres_ , i ) += band( eval( olhs_ ) - eval( rhs_ ), i );
12022 band( odres_ , i ) += band( eval( olhs_ ) - eval( rhs_ ), i );
12023 band( sres_ , i ) += band( eval( olhs_ ) - eval( rhs_ ), i );
12024 band( osres_ , i ) += band( eval( olhs_ ) - eval( rhs_ ), i );
12025 band( refres_, i ) += band( eval( reflhs_ ) - eval( refrhs_ ), i );
12026 }
12027 }
12028 catch( std::exception& ex ) {
12029 convertException<OMT1,MT2>( ex );
12030 }
12031
12032 checkResults<OMT1,MT2>();
12033
12034 try {
12035 initResults();
12036 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12037 band( dres_ , i ) += band( eval( olhs_ ) - eval( orhs_ ), i );
12038 band( odres_ , i ) += band( eval( olhs_ ) - eval( orhs_ ), i );
12039 band( sres_ , i ) += band( eval( olhs_ ) - eval( orhs_ ), i );
12040 band( osres_ , i ) += band( eval( olhs_ ) - eval( orhs_ ), i );
12041 band( refres_, i ) += band( eval( reflhs_ ) - eval( refrhs_ ), i );
12042 }
12043 }
12044 catch( std::exception& ex ) {
12045 convertException<OMT1,OMT2>( ex );
12046 }
12047
12048 checkResults<OMT1,OMT2>();
12049 }
12050
12051
12052 //=====================================================================================
12053 // Band-wise subtraction with subtraction assignment
12054 //=====================================================================================
12055
12056 // Band-wise subtraction with subtraction assignment with the given matrices
12057 {
12058 test_ = "Band-wise subtraction with subtraction assignment with the given matrices";
12059 error_ = "Failed subtraction assignment operation";
12060
12061 try {
12062 initResults();
12063 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12064 band( dres_ , i ) -= band( lhs_ - rhs_, i );
12065 band( odres_ , i ) -= band( lhs_ - rhs_, i );
12066 band( sres_ , i ) -= band( lhs_ - rhs_, i );
12067 band( osres_ , i ) -= band( lhs_ - rhs_, i );
12068 band( refres_, i ) -= band( reflhs_ - refrhs_, i );
12069 }
12070 }
12071 catch( std::exception& ex ) {
12072 convertException<MT1,MT2>( ex );
12073 }
12074
12075 checkResults<MT1,MT2>();
12076
12077 try {
12078 initResults();
12079 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12080 band( dres_ , i ) -= band( lhs_ - orhs_, i );
12081 band( odres_ , i ) -= band( lhs_ - orhs_, i );
12082 band( sres_ , i ) -= band( lhs_ - orhs_, i );
12083 band( osres_ , i ) -= band( lhs_ - orhs_, i );
12084 band( refres_, i ) -= band( reflhs_ - refrhs_, i );
12085 }
12086 }
12087 catch( std::exception& ex ) {
12088 convertException<MT1,OMT2>( ex );
12089 }
12090
12091 checkResults<MT1,OMT2>();
12092
12093 try {
12094 initResults();
12095 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12096 band( dres_ , i ) -= band( olhs_ - rhs_, i );
12097 band( odres_ , i ) -= band( olhs_ - rhs_, i );
12098 band( sres_ , i ) -= band( olhs_ - rhs_, i );
12099 band( osres_ , i ) -= band( olhs_ - rhs_, i );
12100 band( refres_, i ) -= band( reflhs_ - refrhs_, i );
12101 }
12102 }
12103 catch( std::exception& ex ) {
12104 convertException<OMT1,MT2>( ex );
12105 }
12106
12107 checkResults<OMT1,MT2>();
12108
12109 try {
12110 initResults();
12111 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12112 band( dres_ , i ) -= band( olhs_ - orhs_, i );
12113 band( odres_ , i ) -= band( olhs_ - orhs_, i );
12114 band( sres_ , i ) -= band( olhs_ - orhs_, i );
12115 band( osres_ , i ) -= band( olhs_ - orhs_, i );
12116 band( refres_, i ) -= band( reflhs_ - refrhs_, i );
12117 }
12118 }
12119 catch( std::exception& ex ) {
12120 convertException<OMT1,OMT2>( ex );
12121 }
12122
12123 checkResults<OMT1,OMT2>();
12124 }
12125
12126 // Band-wise subtraction with subtraction assignment with evaluated matrices
12127 {
12128 test_ = "Band-wise subtraction with subtraction assignment with evaluated matrices";
12129 error_ = "Failed subtraction assignment operation";
12130
12131 try {
12132 initResults();
12133 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12134 band( dres_ , i ) -= band( eval( lhs_ ) - eval( rhs_ ), i );
12135 band( odres_ , i ) -= band( eval( lhs_ ) - eval( rhs_ ), i );
12136 band( sres_ , i ) -= band( eval( lhs_ ) - eval( rhs_ ), i );
12137 band( osres_ , i ) -= band( eval( lhs_ ) - eval( rhs_ ), i );
12138 band( refres_, i ) -= band( eval( reflhs_ ) - eval( refrhs_ ), i );
12139 }
12140 }
12141 catch( std::exception& ex ) {
12142 convertException<MT1,MT2>( ex );
12143 }
12144
12145 checkResults<MT1,MT2>();
12146
12147 try {
12148 initResults();
12149 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12150 band( dres_ , i ) -= band( eval( lhs_ ) - eval( orhs_ ), i );
12151 band( odres_ , i ) -= band( eval( lhs_ ) - eval( orhs_ ), i );
12152 band( sres_ , i ) -= band( eval( lhs_ ) - eval( orhs_ ), i );
12153 band( osres_ , i ) -= band( eval( lhs_ ) - eval( orhs_ ), i );
12154 band( refres_, i ) -= band( eval( reflhs_ ) - eval( refrhs_ ), i );
12155 }
12156 }
12157 catch( std::exception& ex ) {
12158 convertException<MT1,OMT2>( ex );
12159 }
12160
12161 checkResults<MT1,OMT2>();
12162
12163 try {
12164 initResults();
12165 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12166 band( dres_ , i ) -= band( eval( olhs_ ) - eval( rhs_ ), i );
12167 band( odres_ , i ) -= band( eval( olhs_ ) - eval( rhs_ ), i );
12168 band( sres_ , i ) -= band( eval( olhs_ ) - eval( rhs_ ), i );
12169 band( osres_ , i ) -= band( eval( olhs_ ) - eval( rhs_ ), i );
12170 band( refres_, i ) -= band( eval( reflhs_ ) - eval( refrhs_ ), i );
12171 }
12172 }
12173 catch( std::exception& ex ) {
12174 convertException<OMT1,MT2>( ex );
12175 }
12176
12177 checkResults<OMT1,MT2>();
12178
12179 try {
12180 initResults();
12181 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12182 band( dres_ , i ) -= band( eval( olhs_ ) - eval( orhs_ ), i );
12183 band( odres_ , i ) -= band( eval( olhs_ ) - eval( orhs_ ), i );
12184 band( sres_ , i ) -= band( eval( olhs_ ) - eval( orhs_ ), i );
12185 band( osres_ , i ) -= band( eval( olhs_ ) - eval( orhs_ ), i );
12186 band( refres_, i ) -= band( eval( reflhs_ ) - eval( refrhs_ ), i );
12187 }
12188 }
12189 catch( std::exception& ex ) {
12190 convertException<OMT1,OMT2>( ex );
12191 }
12192
12193 checkResults<OMT1,OMT2>();
12194 }
12195
12196
12197 //=====================================================================================
12198 // Band-wise subtraction with multiplication assignment
12199 //=====================================================================================
12200
12201 // Band-wise subtraction with multiplication assignment with the given matrices
12202 {
12203 test_ = "Band-wise subtraction with multiplication assignment with the given matrices";
12204 error_ = "Failed multiplication assignment operation";
12205
12206 try {
12207 initResults();
12208 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12209 band( dres_ , i ) *= band( lhs_ - rhs_, i );
12210 band( odres_ , i ) *= band( lhs_ - rhs_, i );
12211 band( sres_ , i ) *= band( lhs_ - rhs_, i );
12212 band( osres_ , i ) *= band( lhs_ - rhs_, i );
12213 band( refres_, i ) *= band( reflhs_ - refrhs_, i );
12214 }
12215 }
12216 catch( std::exception& ex ) {
12217 convertException<MT1,MT2>( ex );
12218 }
12219
12220 checkResults<MT1,MT2>();
12221
12222 try {
12223 initResults();
12224 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12225 band( dres_ , i ) *= band( lhs_ - orhs_, i );
12226 band( odres_ , i ) *= band( lhs_ - orhs_, i );
12227 band( sres_ , i ) *= band( lhs_ - orhs_, i );
12228 band( osres_ , i ) *= band( lhs_ - orhs_, i );
12229 band( refres_, i ) *= band( reflhs_ - refrhs_, i );
12230 }
12231 }
12232 catch( std::exception& ex ) {
12233 convertException<MT1,OMT2>( ex );
12234 }
12235
12236 checkResults<MT1,OMT2>();
12237
12238 try {
12239 initResults();
12240 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12241 band( dres_ , i ) *= band( olhs_ - rhs_, i );
12242 band( odres_ , i ) *= band( olhs_ - rhs_, i );
12243 band( sres_ , i ) *= band( olhs_ - rhs_, i );
12244 band( osres_ , i ) *= band( olhs_ - rhs_, i );
12245 band( refres_, i ) *= band( reflhs_ - refrhs_, i );
12246 }
12247 }
12248 catch( std::exception& ex ) {
12249 convertException<OMT1,MT2>( ex );
12250 }
12251
12252 checkResults<OMT1,MT2>();
12253
12254 try {
12255 initResults();
12256 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12257 band( dres_ , i ) *= band( olhs_ - orhs_, i );
12258 band( odres_ , i ) *= band( olhs_ - orhs_, i );
12259 band( sres_ , i ) *= band( olhs_ - orhs_, i );
12260 band( osres_ , i ) *= band( olhs_ - orhs_, i );
12261 band( refres_, i ) *= band( reflhs_ - refrhs_, i );
12262 }
12263 }
12264 catch( std::exception& ex ) {
12265 convertException<OMT1,OMT2>( ex );
12266 }
12267
12268 checkResults<OMT1,OMT2>();
12269 }
12270
12271 // Band-wise subtraction with multiplication assignment with evaluated matrices
12272 {
12273 test_ = "Band-wise subtraction with multiplication assignment with evaluated matrices";
12274 error_ = "Failed multiplication assignment operation";
12275
12276 try {
12277 initResults();
12278 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12279 band( dres_ , i ) *= band( eval( lhs_ ) - eval( rhs_ ), i );
12280 band( odres_ , i ) *= band( eval( lhs_ ) - eval( rhs_ ), i );
12281 band( sres_ , i ) *= band( eval( lhs_ ) - eval( rhs_ ), i );
12282 band( osres_ , i ) *= band( eval( lhs_ ) - eval( rhs_ ), i );
12283 band( refres_, i ) *= band( eval( reflhs_ ) - eval( refrhs_ ), i );
12284 }
12285 }
12286 catch( std::exception& ex ) {
12287 convertException<MT1,MT2>( ex );
12288 }
12289
12290 checkResults<MT1,MT2>();
12291
12292 try {
12293 initResults();
12294 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12295 band( dres_ , i ) *= band( eval( lhs_ ) - eval( orhs_ ), i );
12296 band( odres_ , i ) *= band( eval( lhs_ ) - eval( orhs_ ), i );
12297 band( sres_ , i ) *= band( eval( lhs_ ) - eval( orhs_ ), i );
12298 band( osres_ , i ) *= band( eval( lhs_ ) - eval( orhs_ ), i );
12299 band( refres_, i ) *= band( eval( reflhs_ ) - eval( refrhs_ ), i );
12300 }
12301 }
12302 catch( std::exception& ex ) {
12303 convertException<MT1,OMT2>( ex );
12304 }
12305
12306 checkResults<MT1,OMT2>();
12307
12308 try {
12309 initResults();
12310 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12311 band( dres_ , i ) *= band( eval( olhs_ ) - eval( rhs_ ), i );
12312 band( odres_ , i ) *= band( eval( olhs_ ) - eval( rhs_ ), i );
12313 band( sres_ , i ) *= band( eval( olhs_ ) - eval( rhs_ ), i );
12314 band( osres_ , i ) *= band( eval( olhs_ ) - eval( rhs_ ), i );
12315 band( refres_, i ) *= band( eval( reflhs_ ) - eval( refrhs_ ), i );
12316 }
12317 }
12318 catch( std::exception& ex ) {
12319 convertException<OMT1,MT2>( ex );
12320 }
12321
12322 checkResults<OMT1,MT2>();
12323
12324 try {
12325 initResults();
12326 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12327 band( dres_ , i ) *= band( eval( olhs_ ) - eval( orhs_ ), i );
12328 band( odres_ , i ) *= band( eval( olhs_ ) - eval( orhs_ ), i );
12329 band( sres_ , i ) *= band( eval( olhs_ ) - eval( orhs_ ), i );
12330 band( osres_ , i ) *= band( eval( olhs_ ) - eval( orhs_ ), i );
12331 band( refres_, i ) *= band( eval( reflhs_ ) - eval( refrhs_ ), i );
12332 }
12333 }
12334 catch( std::exception& ex ) {
12335 convertException<OMT1,OMT2>( ex );
12336 }
12337
12338 checkResults<OMT1,OMT2>();
12339 }
12340
12341
12342 //=====================================================================================
12343 // Failure cases
12344 //=====================================================================================
12345
12346 // Out-of-bounds access (invalid lower band index)
12347 {
12348 test_ = "Out-of-bounds band construction (invalid lower band index)";
12349 error_ = "Setup of out-of-bounds band succeeded";
12350
12351 try {
12352 auto b = band( lhs_ - rhs_, -lhs_.rows() );
12353
12354 std::ostringstream oss;
12355 oss << " Test: " << test_ << "\n"
12356 << " Error: " << error_ << "\n"
12357 << " Details:\n"
12358 << " Random seed = " << blaze::getSeed() << "\n"
12359 << " Left-hand side sparse matrix type:\n"
12360 << " " << typeid( MT1 ).name() << "\n"
12361 << " Right-hand side sparse matrix type:\n"
12362 << " " << typeid( MT2 ).name() << "\n"
12363 << " Result:\n" << b << "\n";
12364 throw std::runtime_error( oss.str() );
12365 }
12366 catch( std::invalid_argument& ex ) {
12367 checkExceptionMessage( ex, "Invalid band access index" );
12368 }
12369
12370 try {
12371 auto b = band( lhs_ - orhs_, -lhs_.rows() );
12372
12373 std::ostringstream oss;
12374 oss << " Test: " << test_ << "\n"
12375 << " Error: " << error_ << "\n"
12376 << " Details:\n"
12377 << " Random seed = " << blaze::getSeed() << "\n"
12378 << " Left-hand side sparse matrix type:\n"
12379 << " " << typeid( MT1 ).name() << "\n"
12380 << " Right-hand side sparse matrix type:\n"
12381 << " " << typeid( OMT2 ).name() << "\n"
12382 << " Result:\n" << b << "\n";
12383 throw std::runtime_error( oss.str() );
12384 }
12385 catch( std::invalid_argument& ex ) {
12386 checkExceptionMessage( ex, "Invalid band access index" );
12387 }
12388
12389 try {
12390 auto b = band( olhs_ - rhs_, -olhs_.rows() );
12391
12392 std::ostringstream oss;
12393 oss << " Test: " << test_ << "\n"
12394 << " Error: " << error_ << "\n"
12395 << " Details:\n"
12396 << " Random seed = " << blaze::getSeed() << "\n"
12397 << " Left-hand side sparse matrix type:\n"
12398 << " " << typeid( OMT1 ).name() << "\n"
12399 << " Right-hand side sparse matrix type:\n"
12400 << " " << typeid( MT2 ).name() << "\n"
12401 << " Result:\n" << b << "\n";
12402 throw std::runtime_error( oss.str() );
12403 }
12404 catch( std::invalid_argument& ex ) {
12405 checkExceptionMessage( ex, "Invalid band access index" );
12406 }
12407
12408 try {
12409 auto b = band( olhs_ - orhs_, -olhs_.rows() );
12410
12411 std::ostringstream oss;
12412 oss << " Test: " << test_ << "\n"
12413 << " Error: " << error_ << "\n"
12414 << " Details:\n"
12415 << " Random seed = " << blaze::getSeed() << "\n"
12416 << " Left-hand side sparse matrix type:\n"
12417 << " " << typeid( OMT1 ).name() << "\n"
12418 << " Right-hand side sparse matrix type:\n"
12419 << " " << typeid( OMT2 ).name() << "\n"
12420 << " Result:\n" << b << "\n";
12421 throw std::runtime_error( oss.str() );
12422 }
12423 catch( std::invalid_argument& ex ) {
12424 checkExceptionMessage( ex, "Invalid band access index" );
12425 }
12426 }
12427
12428 // Out-of-bounds access (invalid upper band index)
12429 {
12430 test_ = "Out-of-bounds band construction (invalid upper band index)";
12431 error_ = "Setup of out-of-bounds band succeeded";
12432
12433 try {
12434 auto b = band( lhs_ - rhs_, lhs_.columns() );
12435
12436 std::ostringstream oss;
12437 oss << " Test: " << test_ << "\n"
12438 << " Error: " << error_ << "\n"
12439 << " Details:\n"
12440 << " Random seed = " << blaze::getSeed() << "\n"
12441 << " Left-hand side sparse matrix type:\n"
12442 << " " << typeid( MT1 ).name() << "\n"
12443 << " Right-hand side sparse matrix type:\n"
12444 << " " << typeid( MT2 ).name() << "\n"
12445 << " Result:\n" << b << "\n";
12446 throw std::runtime_error( oss.str() );
12447 }
12448 catch( std::invalid_argument& ex ) {
12449 checkExceptionMessage( ex, "Invalid band access index" );
12450 }
12451
12452 try {
12453 auto b = band( lhs_ - orhs_, lhs_.columns() );
12454
12455 std::ostringstream oss;
12456 oss << " Test: " << test_ << "\n"
12457 << " Error: " << error_ << "\n"
12458 << " Details:\n"
12459 << " Random seed = " << blaze::getSeed() << "\n"
12460 << " Left-hand side sparse matrix type:\n"
12461 << " " << typeid( MT1 ).name() << "\n"
12462 << " Right-hand side sparse matrix type:\n"
12463 << " " << typeid( OMT2 ).name() << "\n"
12464 << " Result:\n" << b << "\n";
12465 throw std::runtime_error( oss.str() );
12466 }
12467 catch( std::invalid_argument& ex ) {
12468 checkExceptionMessage( ex, "Invalid band access index" );
12469 }
12470
12471 try {
12472 auto b = band( olhs_ - rhs_, olhs_.columns() );
12473
12474 std::ostringstream oss;
12475 oss << " Test: " << test_ << "\n"
12476 << " Error: " << error_ << "\n"
12477 << " Details:\n"
12478 << " Random seed = " << blaze::getSeed() << "\n"
12479 << " Left-hand side sparse matrix type:\n"
12480 << " " << typeid( OMT1 ).name() << "\n"
12481 << " Right-hand side sparse matrix type:\n"
12482 << " " << typeid( MT2 ).name() << "\n"
12483 << " Result:\n" << b << "\n";
12484 throw std::runtime_error( oss.str() );
12485 }
12486 catch( std::invalid_argument& ex ) {
12487 checkExceptionMessage( ex, "Invalid band access index" );
12488 }
12489
12490 try {
12491 auto b = band( olhs_ - orhs_, olhs_.columns() );
12492
12493 std::ostringstream oss;
12494 oss << " Test: " << test_ << "\n"
12495 << " Error: " << error_ << "\n"
12496 << " Details:\n"
12497 << " Random seed = " << blaze::getSeed() << "\n"
12498 << " Left-hand side sparse matrix type:\n"
12499 << " " << typeid( OMT1 ).name() << "\n"
12500 << " Right-hand side sparse matrix type:\n"
12501 << " " << typeid( OMT2 ).name() << "\n"
12502 << " Result:\n" << b << "\n";
12503 throw std::runtime_error( oss.str() );
12504 }
12505 catch( std::invalid_argument& ex ) {
12506 checkExceptionMessage( ex, "Invalid band access index" );
12507 }
12508 }
12509 }
12510 #endif
12511 }
12512 //*************************************************************************************************
12513
12514
12515 //*************************************************************************************************
12516 /*!\brief Testing the customized sparse matrix/sparse matrix subtraction.
12517 //
12518 // \param op The custom operation to be tested.
12519 // \param name The human-readable name of the operation.
12520 // \return void
12521 // \exception std::runtime_error Subtraction error detected.
12522 //
12523 // This function tests the matrix subtraction with plain assignment, addition assignment,
12524 // subtraction assignment, and Schur product assignment in combination with a custom operation.
12525 // In case any error resulting from the subtraction or the subsequent assignment is detected,
12526 // a \a std::runtime_error exception is thrown.
12527 */
12528 template< typename MT1 // Type of the left-hand side sparse matrix
12529 , typename MT2 > // Type of the right-hand side sparse matrix
12530 template< typename OP > // Type of the custom operation
testCustomOperation(OP op,const std::string & name)12531 void OperationTest<MT1,MT2>::testCustomOperation( OP op, const std::string& name )
12532 {
12533 //=====================================================================================
12534 // Customized subtraction
12535 //=====================================================================================
12536
12537 // Customized subtraction with the given matrices
12538 {
12539 test_ = "Customized subtraction with the given matrices (" + name + ")";
12540 error_ = "Failed subtraction operation";
12541
12542 try {
12543 initResults();
12544 dres_ = op( lhs_ - rhs_ );
12545 odres_ = op( lhs_ - rhs_ );
12546 sres_ = op( lhs_ - rhs_ );
12547 osres_ = op( lhs_ - rhs_ );
12548 refres_ = op( reflhs_ - refrhs_ );
12549 }
12550 catch( std::exception& ex ) {
12551 convertException<MT1,MT2>( ex );
12552 }
12553
12554 checkResults<MT1,MT2>();
12555
12556 try {
12557 initResults();
12558 dres_ = op( lhs_ - orhs_ );
12559 odres_ = op( lhs_ - orhs_ );
12560 sres_ = op( lhs_ - orhs_ );
12561 osres_ = op( lhs_ - orhs_ );
12562 refres_ = op( reflhs_ - refrhs_ );
12563 }
12564 catch( std::exception& ex ) {
12565 convertException<MT1,OMT2>( ex );
12566 }
12567
12568 checkResults<MT1,OMT2>();
12569
12570 try {
12571 initResults();
12572 dres_ = op( olhs_ - rhs_ );
12573 odres_ = op( olhs_ - rhs_ );
12574 sres_ = op( olhs_ - rhs_ );
12575 osres_ = op( olhs_ - rhs_ );
12576 refres_ = op( reflhs_ - refrhs_ );
12577 }
12578 catch( std::exception& ex ) {
12579 convertException<OMT1,MT2>( ex );
12580 }
12581
12582 checkResults<OMT1,MT2>();
12583
12584 try {
12585 initResults();
12586 dres_ = op( olhs_ - orhs_ );
12587 odres_ = op( olhs_ - orhs_ );
12588 sres_ = op( olhs_ - orhs_ );
12589 osres_ = op( olhs_ - orhs_ );
12590 refres_ = op( reflhs_ - refrhs_ );
12591 }
12592 catch( std::exception& ex ) {
12593 convertException<OMT1,OMT2>( ex );
12594 }
12595
12596 checkResults<OMT1,OMT2>();
12597 }
12598
12599 // Customized subtraction with evaluated matrices
12600 {
12601 test_ = "Customized subtraction with evaluated matrices (" + name + ")";
12602 error_ = "Failed subtraction operation";
12603
12604 try {
12605 initResults();
12606 dres_ = op( eval( lhs_ ) - eval( rhs_ ) );
12607 odres_ = op( eval( lhs_ ) - eval( rhs_ ) );
12608 sres_ = op( eval( lhs_ ) - eval( rhs_ ) );
12609 osres_ = op( eval( lhs_ ) - eval( rhs_ ) );
12610 refres_ = op( eval( reflhs_ ) - eval( refrhs_ ) );
12611 }
12612 catch( std::exception& ex ) {
12613 convertException<MT1,MT2>( ex );
12614 }
12615
12616 checkResults<MT1,MT2>();
12617
12618 try {
12619 initResults();
12620 dres_ = op( eval( lhs_ ) - eval( orhs_ ) );
12621 odres_ = op( eval( lhs_ ) - eval( orhs_ ) );
12622 sres_ = op( eval( lhs_ ) - eval( orhs_ ) );
12623 osres_ = op( eval( lhs_ ) - eval( orhs_ ) );
12624 refres_ = op( eval( reflhs_ ) - eval( refrhs_ ) );
12625 }
12626 catch( std::exception& ex ) {
12627 convertException<MT1,OMT2>( ex );
12628 }
12629
12630 checkResults<MT1,OMT2>();
12631
12632 try {
12633 initResults();
12634 dres_ = op( eval( olhs_ ) - eval( rhs_ ) );
12635 odres_ = op( eval( olhs_ ) - eval( rhs_ ) );
12636 sres_ = op( eval( olhs_ ) - eval( rhs_ ) );
12637 osres_ = op( eval( olhs_ ) - eval( rhs_ ) );
12638 refres_ = op( eval( reflhs_ ) - eval( refrhs_ ) );
12639 }
12640 catch( std::exception& ex ) {
12641 convertException<OMT1,MT2>( ex );
12642 }
12643
12644 checkResults<OMT1,MT2>();
12645
12646 try {
12647 initResults();
12648 dres_ = op( eval( olhs_ ) - eval( orhs_ ) );
12649 odres_ = op( eval( olhs_ ) - eval( orhs_ ) );
12650 sres_ = op( eval( olhs_ ) - eval( orhs_ ) );
12651 osres_ = op( eval( olhs_ ) - eval( orhs_ ) );
12652 refres_ = op( eval( reflhs_ ) - eval( refrhs_ ) );
12653 }
12654 catch( std::exception& ex ) {
12655 convertException<OMT1,OMT2>( ex );
12656 }
12657
12658 checkResults<OMT1,OMT2>();
12659 }
12660
12661
12662 //=====================================================================================
12663 // Customized subtraction with addition assignment
12664 //=====================================================================================
12665
12666 // Customized subtraction with addition assignment with the given matrices
12667 {
12668 test_ = "Customized subtraction with addition assignment with the given matrices (" + name + ")";
12669 error_ = "Failed addition assignment operation";
12670
12671 try {
12672 initResults();
12673 dres_ += op( lhs_ - rhs_ );
12674 odres_ += op( lhs_ - rhs_ );
12675 sres_ += op( lhs_ - rhs_ );
12676 osres_ += op( lhs_ - rhs_ );
12677 refres_ += op( reflhs_ - refrhs_ );
12678 }
12679 catch( std::exception& ex ) {
12680 convertException<MT1,MT2>( ex );
12681 }
12682
12683 checkResults<MT1,MT2>();
12684
12685 try {
12686 initResults();
12687 dres_ += op( lhs_ - orhs_ );
12688 odres_ += op( lhs_ - orhs_ );
12689 sres_ += op( lhs_ - orhs_ );
12690 osres_ += op( lhs_ - orhs_ );
12691 refres_ += op( reflhs_ - refrhs_ );
12692 }
12693 catch( std::exception& ex ) {
12694 convertException<MT1,OMT2>( ex );
12695 }
12696
12697 checkResults<MT1,OMT2>();
12698
12699 try {
12700 initResults();
12701 dres_ += op( olhs_ - rhs_ );
12702 odres_ += op( olhs_ - rhs_ );
12703 sres_ += op( olhs_ - rhs_ );
12704 osres_ += op( olhs_ - rhs_ );
12705 refres_ += op( reflhs_ - refrhs_ );
12706 }
12707 catch( std::exception& ex ) {
12708 convertException<OMT1,MT2>( ex );
12709 }
12710
12711 checkResults<OMT1,MT2>();
12712
12713 try {
12714 initResults();
12715 dres_ += op( olhs_ - orhs_ );
12716 odres_ += op( olhs_ - orhs_ );
12717 sres_ += op( olhs_ - orhs_ );
12718 osres_ += op( olhs_ - orhs_ );
12719 refres_ += op( reflhs_ - refrhs_ );
12720 }
12721 catch( std::exception& ex ) {
12722 convertException<OMT1,OMT2>( ex );
12723 }
12724
12725 checkResults<OMT1,OMT2>();
12726 }
12727
12728 // Customized subtraction with addition assignment with evaluated matrices
12729 {
12730 test_ = "Customized subtraction with addition assignment with evaluated matrices (" + name + ")";
12731 error_ = "Failed addition assignment operation";
12732
12733 try {
12734 initResults();
12735 dres_ += op( eval( lhs_ ) - eval( rhs_ ) );
12736 odres_ += op( eval( lhs_ ) - eval( rhs_ ) );
12737 sres_ += op( eval( lhs_ ) - eval( rhs_ ) );
12738 osres_ += op( eval( lhs_ ) - eval( rhs_ ) );
12739 refres_ += op( eval( reflhs_ ) - eval( refrhs_ ) );
12740 }
12741 catch( std::exception& ex ) {
12742 convertException<MT1,MT2>( ex );
12743 }
12744
12745 checkResults<MT1,MT2>();
12746
12747 try {
12748 initResults();
12749 dres_ += op( eval( lhs_ ) - eval( orhs_ ) );
12750 odres_ += op( eval( lhs_ ) - eval( orhs_ ) );
12751 sres_ += op( eval( lhs_ ) - eval( orhs_ ) );
12752 osres_ += op( eval( lhs_ ) - eval( orhs_ ) );
12753 refres_ += op( eval( reflhs_ ) - eval( refrhs_ ) );
12754 }
12755 catch( std::exception& ex ) {
12756 convertException<MT1,OMT2>( ex );
12757 }
12758
12759 checkResults<MT1,OMT2>();
12760
12761 try {
12762 initResults();
12763 dres_ += op( eval( olhs_ ) - eval( rhs_ ) );
12764 odres_ += op( eval( olhs_ ) - eval( rhs_ ) );
12765 sres_ += op( eval( olhs_ ) - eval( rhs_ ) );
12766 osres_ += op( eval( olhs_ ) - eval( rhs_ ) );
12767 refres_ += op( eval( reflhs_ ) - eval( refrhs_ ) );
12768 }
12769 catch( std::exception& ex ) {
12770 convertException<OMT1,MT2>( ex );
12771 }
12772
12773 checkResults<OMT1,MT2>();
12774
12775 try {
12776 initResults();
12777 dres_ += op( eval( olhs_ ) - eval( orhs_ ) );
12778 odres_ += op( eval( olhs_ ) - eval( orhs_ ) );
12779 sres_ += op( eval( olhs_ ) - eval( orhs_ ) );
12780 osres_ += op( eval( olhs_ ) - eval( orhs_ ) );
12781 refres_ += op( eval( reflhs_ ) - eval( refrhs_ ) );
12782 }
12783 catch( std::exception& ex ) {
12784 convertException<OMT1,OMT2>( ex );
12785 }
12786
12787 checkResults<OMT1,OMT2>();
12788 }
12789
12790
12791 //=====================================================================================
12792 // Customized subtraction with subtraction assignment
12793 //=====================================================================================
12794
12795 // Customized subtraction with subtraction assignment with the given matrices
12796 {
12797 test_ = "Customized subtraction with subtraction assignment with the given matrices (" + name + ")";
12798 error_ = "Failed subtraction assignment operation";
12799
12800 try {
12801 initResults();
12802 dres_ -= op( lhs_ - rhs_ );
12803 odres_ -= op( lhs_ - rhs_ );
12804 sres_ -= op( lhs_ - rhs_ );
12805 osres_ -= op( lhs_ - rhs_ );
12806 refres_ -= op( reflhs_ - refrhs_ );
12807 }
12808 catch( std::exception& ex ) {
12809 convertException<MT1,MT2>( ex );
12810 }
12811
12812 checkResults<MT1,MT2>();
12813
12814 try {
12815 initResults();
12816 dres_ -= op( lhs_ - orhs_ );
12817 odres_ -= op( lhs_ - orhs_ );
12818 sres_ -= op( lhs_ - orhs_ );
12819 osres_ -= op( lhs_ - orhs_ );
12820 refres_ -= op( reflhs_ - refrhs_ );
12821 }
12822 catch( std::exception& ex ) {
12823 convertException<MT1,OMT2>( ex );
12824 }
12825
12826 checkResults<MT1,OMT2>();
12827
12828 try {
12829 initResults();
12830 dres_ -= op( olhs_ - rhs_ );
12831 odres_ -= op( olhs_ - rhs_ );
12832 sres_ -= op( olhs_ - rhs_ );
12833 osres_ -= op( olhs_ - rhs_ );
12834 refres_ -= op( reflhs_ - refrhs_ );
12835 }
12836 catch( std::exception& ex ) {
12837 convertException<OMT1,MT2>( ex );
12838 }
12839
12840 checkResults<OMT1,MT2>();
12841
12842 try {
12843 initResults();
12844 dres_ -= op( olhs_ - orhs_ );
12845 odres_ -= op( olhs_ - orhs_ );
12846 sres_ -= op( olhs_ - orhs_ );
12847 osres_ -= op( olhs_ - orhs_ );
12848 refres_ -= op( reflhs_ - refrhs_ );
12849 }
12850 catch( std::exception& ex ) {
12851 convertException<OMT1,OMT2>( ex );
12852 }
12853
12854 checkResults<OMT1,OMT2>();
12855 }
12856
12857 // Customized subtraction with subtraction assignment with evaluated matrices
12858 {
12859 test_ = "Customized subtraction with subtraction assignment with evaluated matrices (" + name + ")";
12860 error_ = "Failed subtraction assignment operation";
12861
12862 try {
12863 initResults();
12864 dres_ -= op( eval( lhs_ ) - eval( rhs_ ) );
12865 odres_ -= op( eval( lhs_ ) - eval( rhs_ ) );
12866 sres_ -= op( eval( lhs_ ) - eval( rhs_ ) );
12867 osres_ -= op( eval( lhs_ ) - eval( rhs_ ) );
12868 refres_ -= op( eval( reflhs_ ) - eval( refrhs_ ) );
12869 }
12870 catch( std::exception& ex ) {
12871 convertException<MT1,MT2>( ex );
12872 }
12873
12874 checkResults<MT1,MT2>();
12875
12876 try {
12877 initResults();
12878 dres_ -= op( eval( lhs_ ) - eval( orhs_ ) );
12879 odres_ -= op( eval( lhs_ ) - eval( orhs_ ) );
12880 sres_ -= op( eval( lhs_ ) - eval( orhs_ ) );
12881 osres_ -= op( eval( lhs_ ) - eval( orhs_ ) );
12882 refres_ -= op( eval( reflhs_ ) - eval( refrhs_ ) );
12883 }
12884 catch( std::exception& ex ) {
12885 convertException<MT1,OMT2>( ex );
12886 }
12887
12888 checkResults<MT1,OMT2>();
12889
12890 try {
12891 initResults();
12892 dres_ -= op( eval( olhs_ ) - eval( rhs_ ) );
12893 odres_ -= op( eval( olhs_ ) - eval( rhs_ ) );
12894 sres_ -= op( eval( olhs_ ) - eval( rhs_ ) );
12895 osres_ -= op( eval( olhs_ ) - eval( rhs_ ) );
12896 refres_ -= op( eval( reflhs_ ) - eval( refrhs_ ) );
12897 }
12898 catch( std::exception& ex ) {
12899 convertException<OMT1,MT2>( ex );
12900 }
12901
12902 checkResults<OMT1,MT2>();
12903
12904 try {
12905 initResults();
12906 dres_ -= op( eval( olhs_ ) - eval( orhs_ ) );
12907 odres_ -= op( eval( olhs_ ) - eval( orhs_ ) );
12908 sres_ -= op( eval( olhs_ ) - eval( orhs_ ) );
12909 osres_ -= op( eval( olhs_ ) - eval( orhs_ ) );
12910 refres_ -= op( eval( reflhs_ ) - eval( refrhs_ ) );
12911 }
12912 catch( std::exception& ex ) {
12913 convertException<OMT1,OMT2>( ex );
12914 }
12915
12916 checkResults<OMT1,OMT2>();
12917 }
12918
12919
12920 //=====================================================================================
12921 // Customized subtraction with Schur product assignment
12922 //=====================================================================================
12923
12924 // Customized subtraction with Schur product assignment with the given matrices
12925 {
12926 test_ = "Customized subtraction with Schur product assignment with the given matrices (" + name + ")";
12927 error_ = "Failed Schur product assignment operation";
12928
12929 try {
12930 initResults();
12931 dres_ %= op( lhs_ - rhs_ );
12932 odres_ %= op( lhs_ - rhs_ );
12933 sres_ %= op( lhs_ - rhs_ );
12934 osres_ %= op( lhs_ - rhs_ );
12935 refres_ %= op( reflhs_ - refrhs_ );
12936 }
12937 catch( std::exception& ex ) {
12938 convertException<MT1,MT2>( ex );
12939 }
12940
12941 checkResults<MT1,MT2>();
12942
12943 try {
12944 initResults();
12945 dres_ %= op( lhs_ - orhs_ );
12946 odres_ %= op( lhs_ - orhs_ );
12947 sres_ %= op( lhs_ - orhs_ );
12948 osres_ %= op( lhs_ - orhs_ );
12949 refres_ %= op( reflhs_ - refrhs_ );
12950 }
12951 catch( std::exception& ex ) {
12952 convertException<MT1,OMT2>( ex );
12953 }
12954
12955 checkResults<MT1,OMT2>();
12956
12957 try {
12958 initResults();
12959 dres_ %= op( olhs_ - rhs_ );
12960 odres_ %= op( olhs_ - rhs_ );
12961 sres_ %= op( olhs_ - rhs_ );
12962 osres_ %= op( olhs_ - rhs_ );
12963 refres_ %= op( reflhs_ - refrhs_ );
12964 }
12965 catch( std::exception& ex ) {
12966 convertException<OMT1,MT2>( ex );
12967 }
12968
12969 checkResults<OMT1,MT2>();
12970
12971 try {
12972 initResults();
12973 dres_ %= op( olhs_ - orhs_ );
12974 odres_ %= op( olhs_ - orhs_ );
12975 sres_ %= op( olhs_ - orhs_ );
12976 osres_ %= op( olhs_ - orhs_ );
12977 refres_ %= op( reflhs_ - refrhs_ );
12978 }
12979 catch( std::exception& ex ) {
12980 convertException<OMT1,OMT2>( ex );
12981 }
12982
12983 checkResults<OMT1,OMT2>();
12984 }
12985
12986 // Customized subtraction with Schur product assignment with evaluated matrices
12987 {
12988 test_ = "Customized subtraction with Schur product assignment with evaluated matrices (" + name + ")";
12989 error_ = "Failed Schur product assignment operation";
12990
12991 try {
12992 initResults();
12993 dres_ %= op( eval( lhs_ ) - eval( rhs_ ) );
12994 odres_ %= op( eval( lhs_ ) - eval( rhs_ ) );
12995 sres_ %= op( eval( lhs_ ) - eval( rhs_ ) );
12996 osres_ %= op( eval( lhs_ ) - eval( rhs_ ) );
12997 refres_ %= op( eval( reflhs_ ) - eval( refrhs_ ) );
12998 }
12999 catch( std::exception& ex ) {
13000 convertException<MT1,MT2>( ex );
13001 }
13002
13003 checkResults<MT1,MT2>();
13004
13005 try {
13006 initResults();
13007 dres_ %= op( eval( lhs_ ) - eval( orhs_ ) );
13008 odres_ %= op( eval( lhs_ ) - eval( orhs_ ) );
13009 sres_ %= op( eval( lhs_ ) - eval( orhs_ ) );
13010 osres_ %= op( eval( lhs_ ) - eval( orhs_ ) );
13011 refres_ %= op( eval( reflhs_ ) - eval( refrhs_ ) );
13012 }
13013 catch( std::exception& ex ) {
13014 convertException<MT1,OMT2>( ex );
13015 }
13016
13017 checkResults<MT1,OMT2>();
13018
13019 try {
13020 initResults();
13021 dres_ %= op( eval( olhs_ ) - eval( rhs_ ) );
13022 odres_ %= op( eval( olhs_ ) - eval( rhs_ ) );
13023 sres_ %= op( eval( olhs_ ) - eval( rhs_ ) );
13024 osres_ %= op( eval( olhs_ ) - eval( rhs_ ) );
13025 refres_ %= op( eval( reflhs_ ) - eval( refrhs_ ) );
13026 }
13027 catch( std::exception& ex ) {
13028 convertException<OMT1,MT2>( ex );
13029 }
13030
13031 checkResults<OMT1,MT2>();
13032
13033 try {
13034 initResults();
13035 dres_ %= op( eval( olhs_ ) - eval( orhs_ ) );
13036 odres_ %= op( eval( olhs_ ) - eval( orhs_ ) );
13037 sres_ %= op( eval( olhs_ ) - eval( orhs_ ) );
13038 osres_ %= op( eval( olhs_ ) - eval( orhs_ ) );
13039 refres_ %= op( eval( reflhs_ ) - eval( refrhs_ ) );
13040 }
13041 catch( std::exception& ex ) {
13042 convertException<OMT1,OMT2>( ex );
13043 }
13044
13045 checkResults<OMT1,OMT2>();
13046 }
13047 }
13048 //*************************************************************************************************
13049
13050
13051
13052
13053 //=================================================================================================
13054 //
13055 // ERROR DETECTION FUNCTIONS
13056 //
13057 //=================================================================================================
13058
13059 //*************************************************************************************************
13060 /*!\brief Checking and comparing the computed results.
13061 //
13062 // \return void
13063 // \exception std::runtime_error Incorrect dense result detected.
13064 // \exception std::runtime_error Incorrect sparse result detected.
13065 //
13066 // This function is called after each test case to check and compare the computed results. The
13067 // two template arguments \a LT and \a RT indicate the types of the left-hand side and right-hand
13068 // side operands used for the computations.
13069 */
13070 template< typename MT1 // Type of the left-hand side sparse matrix
13071 , typename MT2 > // Type of the right-hand side sparse matrix
13072 template< typename LT // Type of the left-hand side operand
13073 , typename RT > // Type of the right-hand side operand
checkResults()13074 void OperationTest<MT1,MT2>::checkResults()
13075 {
13076 using blaze::IsRowMajorMatrix;
13077
13078 if( !isEqual( dres_, refres_ ) || !isEqual( odres_, refres_ ) ) {
13079 std::ostringstream oss;
13080 oss.precision( 20 );
13081 oss << " Test : " << test_ << "\n"
13082 << " Error: Incorrect dense result detected\n"
13083 << " Details:\n"
13084 << " Random seed = " << blaze::getSeed() << "\n"
13085 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13086 << " " << typeid( LT ).name() << "\n"
13087 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13088 << " " << typeid( RT ).name() << "\n"
13089 << " Result:\n" << dres_ << "\n"
13090 << " Result with opposite storage order:\n" << odres_ << "\n"
13091 << " Expected result:\n" << refres_ << "\n";
13092 throw std::runtime_error( oss.str() );
13093 }
13094
13095 if( !isEqual( sres_, refres_ ) || !isEqual( osres_, refres_ ) ) {
13096 std::ostringstream oss;
13097 oss.precision( 20 );
13098 oss << " Test : " << test_ << "\n"
13099 << " Error: Incorrect sparse result detected\n"
13100 << " Details:\n"
13101 << " Random seed = " << blaze::getSeed() << "\n"
13102 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13103 << " " << typeid( LT ).name() << "\n"
13104 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13105 << " " << typeid( RT ).name() << "\n"
13106 << " Result:\n" << sres_ << "\n"
13107 << " Result with opposite storage order:\n" << osres_ << "\n"
13108 << " Expected result:\n" << refres_ << "\n";
13109 throw std::runtime_error( oss.str() );
13110 }
13111 }
13112 //*************************************************************************************************
13113
13114
13115 //*************************************************************************************************
13116 /*!\brief Checking and comparing the computed transpose results.
13117 //
13118 // \return void
13119 // \exception std::runtime_error Incorrect dense result detected.
13120 // \exception std::runtime_error Incorrect sparse result detected.
13121 //
13122 // This function is called after each test case to check and compare the computed transpose
13123 // results. The two template arguments \a LT and \a RT indicate the types of the left-hand
13124 // side and right-hand side operands used for the computations.
13125 */
13126 template< typename MT1 // Type of the left-hand side sparse matrix
13127 , typename MT2 > // Type of the right-hand side sparse matrix
13128 template< typename LT // Type of the left-hand side operand
13129 , typename RT > // Type of the right-hand side operand
checkTransposeResults()13130 void OperationTest<MT1,MT2>::checkTransposeResults()
13131 {
13132 using blaze::IsRowMajorMatrix;
13133
13134 if( !isEqual( tdres_, refres_ ) || !isEqual( todres_, refres_ ) ) {
13135 std::ostringstream oss;
13136 oss.precision( 20 );
13137 oss << " Test : " << test_ << "\n"
13138 << " Error: Incorrect dense result detected\n"
13139 << " Details:\n"
13140 << " Random seed = " << blaze::getSeed() << "\n"
13141 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13142 << " " << typeid( LT ).name() << "\n"
13143 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13144 << " " << typeid( RT ).name() << "\n"
13145 << " Transpose result:\n" << tdres_ << "\n"
13146 << " Transpose result with opposite storage order:\n" << todres_ << "\n"
13147 << " Expected result:\n" << refres_ << "\n";
13148 throw std::runtime_error( oss.str() );
13149 }
13150
13151 if( !isEqual( tsres_, refres_ ) || !isEqual( tosres_, refres_ ) ) {
13152 std::ostringstream oss;
13153 oss.precision( 20 );
13154 oss << " Test : " << test_ << "\n"
13155 << " Error: Incorrect sparse result detected\n"
13156 << " Details:\n"
13157 << " Random seed = " << blaze::getSeed() << "\n"
13158 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13159 << " " << typeid( LT ).name() << "\n"
13160 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13161 << " " << typeid( RT ).name() << "\n"
13162 << " Transpose result:\n" << tsres_ << "\n"
13163 << " Transpose result with opposite storage order:\n" << tosres_ << "\n"
13164 << " Expected result:\n" << refres_ << "\n";
13165 throw std::runtime_error( oss.str() );
13166 }
13167 }
13168 //*************************************************************************************************
13169
13170
13171 //*************************************************************************************************
13172 /*!\brief Checking and comparing the error message of the given exception.
13173 //
13174 // \param ex The exception to be checked.
13175 // \param message The expected error message.
13176 // \return void
13177 // \exception std::runtime_error Wrong error message.
13178 //
13179 // This function is called to check the error message of the given exception. In case the error
13180 // message does not correspond to the expected message, a \a std::runtime_error exception is
13181 // thrown.
13182 */
13183 template< typename MT1 // Type of the left-hand side sparse matrix
13184 , typename MT2 > // Type of the right-hand side sparse matrix
checkExceptionMessage(const std::exception & ex,const std::string & message)13185 void OperationTest<MT1,MT2>::checkExceptionMessage( const std::exception& ex, const std::string& message )
13186 {
13187 if( ex.what() != message ) {
13188 std::ostringstream oss;
13189 oss << " Test: " << test_ << "\n"
13190 << " Error: Wrong error message\n"
13191 << " Details:\n"
13192 << " Error message: \"" << ex.what() << "\"\n"
13193 << " Expected error message: \"" << message << "\"\n";
13194 throw std::runtime_error( oss.str() );
13195 }
13196 }
13197 //*************************************************************************************************
13198
13199
13200
13201
13202 //=================================================================================================
13203 //
13204 // UTILITY FUNCTIONS
13205 //
13206 //=================================================================================================
13207
13208 //*************************************************************************************************
13209 /*!\brief Initializing the non-transpose result matrices.
13210 //
13211 // \return void
13212 //
13213 // This function is called before each non-transpose test case to initialize the according result
13214 // matrices to random values.
13215 */
13216 template< typename MT1 // Type of the left-hand side sparse matrix
13217 , typename MT2 > // Type of the right-hand side sparse matrix
initResults()13218 void OperationTest<MT1,MT2>::initResults()
13219 {
13220 const blaze::UnderlyingBuiltin_t<SRE> min( randmin );
13221 const blaze::UnderlyingBuiltin_t<SRE> max( randmax );
13222
13223 resize( sres_, rows( lhs_ ), columns( lhs_ ) );
13224 randomize( sres_, min, max );
13225
13226 dres_ = sres_;
13227 odres_ = sres_;
13228 osres_ = sres_;
13229 refres_ = sres_;
13230 }
13231 //*************************************************************************************************
13232
13233
13234 //*************************************************************************************************
13235 /*!\brief Initializing the transpose result matrices.
13236 //
13237 // \return void
13238 //
13239 // This function is called before each transpose test case to initialize the according result
13240 // matrices to random values.
13241 */
13242 template< typename MT1 // Type of the left-hand side sparse matrix
13243 , typename MT2 > // Type of the right-hand side sparse matrix
initTransposeResults()13244 void OperationTest<MT1,MT2>::initTransposeResults()
13245 {
13246 const blaze::UnderlyingBuiltin_t<TSRE> min( randmin );
13247 const blaze::UnderlyingBuiltin_t<TSRE> max( randmax );
13248
13249 resize( tsres_, columns( lhs_ ), rows( lhs_ ) );
13250 randomize( tsres_, min, max );
13251
13252 tdres_ = tsres_;
13253 todres_ = tsres_;
13254 tosres_ = tsres_;
13255 refres_ = tsres_;
13256 }
13257 //*************************************************************************************************
13258
13259
13260 //*************************************************************************************************
13261 /*!\brief Convert the given exception into a \a std::runtime_error exception.
13262 //
13263 // \param ex The \a std::exception to be extended.
13264 // \return void
13265 // \exception std::runtime_error The converted exception.
13266 //
13267 // This function converts the given exception to a \a std::runtime_error exception. Additionally,
13268 // the function extends the given exception message by all available information for the failed
13269 // test. The two template arguments \a LT and \a RT indicate the types of the left-hand side and
13270 // right-hand side operands used for the computations.
13271 */
13272 template< typename MT1 // Type of the left-hand side sparse matrix
13273 , typename MT2 > // Type of the right-hand side sparse matrix
13274 template< typename LT // Type of the left-hand side operand
13275 , typename RT > // Type of the right-hand side operand
convertException(const std::exception & ex)13276 void OperationTest<MT1,MT2>::convertException( const std::exception& ex )
13277 {
13278 using blaze::IsRowMajorMatrix;
13279
13280 std::ostringstream oss;
13281 oss << " Test : " << test_ << "\n"
13282 << " Error: " << error_ << "\n"
13283 << " Details:\n"
13284 << " Random seed = " << blaze::getSeed() << "\n"
13285 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13286 << " " << typeid( LT ).name() << "\n"
13287 << " Right-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13288 << " " << typeid( RT ).name() << "\n"
13289 << " Error message: " << ex.what() << "\n";
13290 throw std::runtime_error( oss.str() );
13291 }
13292 //*************************************************************************************************
13293
13294
13295
13296
13297 //=================================================================================================
13298 //
13299 // GLOBAL TEST FUNCTIONS
13300 //
13301 //=================================================================================================
13302
13303 //*************************************************************************************************
13304 /*!\brief Testing the matrix subtraction between two specific matrix types.
13305 //
13306 // \param creator1 The creator for the left-hand side matrix.
13307 // \param creator2 The creator for the right-hand side matrix.
13308 // \return void
13309 */
13310 template< typename MT1 // Type of the left-hand side sparse matrix
13311 , typename MT2 > // Type of the right-hand side sparse matrix
runTest(const Creator<MT1> & creator1,const Creator<MT2> & creator2)13312 void runTest( const Creator<MT1>& creator1, const Creator<MT2>& creator2 )
13313 {
13314 #if BLAZETEST_MATHTEST_TEST_SUBTRACTION
13315 if( BLAZETEST_MATHTEST_TEST_SUBTRACTION > 1 )
13316 {
13317 for( size_t rep=0UL; rep<BLAZETEST_REPETITIONS; ++rep ) {
13318 OperationTest<MT1,MT2>( creator1, creator2 );
13319 }
13320 }
13321 #endif
13322 }
13323 //*************************************************************************************************
13324
13325
13326
13327
13328 //=================================================================================================
13329 //
13330 // MACROS
13331 //
13332 //=================================================================================================
13333
13334 //*************************************************************************************************
13335 /*! \cond BLAZE_INTERNAL */
13336 /*!\brief Macro for the definition of a sparse matrix/sparse matrix subtraction test case.
13337 */
13338 #define DEFINE_SMATSMATSUB_OPERATION_TEST( MT1, MT2 ) \
13339 extern template class blazetest::mathtest::operations::smatsmatsub::OperationTest<MT1,MT2>
13340 /*! \endcond */
13341 //*************************************************************************************************
13342
13343
13344 //*************************************************************************************************
13345 /*! \cond BLAZE_INTERNAL */
13346 /*!\brief Macro for the execution of a sparse matrix/sparse matrix subtraction test case.
13347 */
13348 #define RUN_SMATSMATSUB_OPERATION_TEST( C1, C2 ) \
13349 blazetest::mathtest::operations::smatsmatsub::runTest( C1, C2 )
13350 /*! \endcond */
13351 //*************************************************************************************************
13352
13353 } // namespace smatsmatsub
13354
13355 } // namespace operations
13356
13357 } // namespace mathtest
13358
13359 } // namespace blazetest
13360
13361 #endif
13362