1 //=================================================================================================
2 /*!
3 // \file blazetest/mathtest/operations/smatdmatkron/OperationTest.h
4 // \brief Header file for the sparse matrix/dense matrix Kronecker product 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_SMATDMATKRON_OPERATIONTEST_H_
36 #define _BLAZETEST_MATHTEST_OPERATIONS_SMATDMATKRON_OPERATIONTEST_H_
37
38
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42
43 #include <algorithm>
44 #include <sstream>
45 #include <stdexcept>
46 #include <string>
47 #include <typeinfo>
48 #include <utility>
49 #include <vector>
50 #include <blaze/math/Aliases.h>
51 #include <blaze/math/CompressedMatrix.h>
52 #include <blaze/math/constraints/ColumnMajorMatrix.h>
53 #include <blaze/math/constraints/DenseMatrix.h>
54 #include <blaze/math/constraints/RowMajorMatrix.h>
55 #include <blaze/math/constraints/Scalar.h>
56 #include <blaze/math/constraints/SparseMatrix.h>
57 #include <blaze/math/constraints/StorageOrder.h>
58 #include <blaze/math/DynamicMatrix.h>
59 #include <blaze/math/Functors.h>
60 #include <blaze/math/shims/Equal.h>
61 #include <blaze/math/shims/IsDefault.h>
62 #include <blaze/math/traits/KronTrait.h>
63 #include <blaze/math/typetraits/IsDiagonal.h>
64 #include <blaze/math/typetraits/IsHermitian.h>
65 #include <blaze/math/typetraits/IsResizable.h>
66 #include <blaze/math/typetraits/IsRowMajorMatrix.h>
67 #include <blaze/math/typetraits/IsSquare.h>
68 #include <blaze/math/typetraits/IsSymmetric.h>
69 #include <blaze/math/typetraits/IsTriangular.h>
70 #include <blaze/math/typetraits/IsUniform.h>
71 #include <blaze/math/typetraits/UnderlyingBuiltin.h>
72 #include <blaze/math/typetraits/UnderlyingScalar.h>
73 #include <blaze/math/Views.h>
74 #include <blaze/util/algorithms/Min.h>
75 #include <blaze/util/constraints/DerivedFrom.h>
76 #include <blaze/util/constraints/SameType.h>
77 #include <blaze/util/IntegralConstant.h>
78 #include <blaze/util/mpl/If.h>
79 #include <blaze/util/mpl/Nor.h>
80 #include <blaze/util/mpl/Not.h>
81 #include <blaze/util/mpl/Or.h>
82 #include <blaze/util/Random.h>
83 #include <blaze/util/typetraits/IsComplex.h>
84 #include <blaze/util/typetraits/RemoveCVRef.h>
85 #include <blazetest/system/LAPACK.h>
86 #include <blazetest/system/MathTest.h>
87 #include <blazetest/mathtest/Creator.h>
88 #include <blazetest/mathtest/IsEqual.h>
89 #include <blazetest/mathtest/MatchAdaptor.h>
90 #include <blazetest/mathtest/MatchSymmetry.h>
91 #include <blazetest/mathtest/RandomMaximum.h>
92 #include <blazetest/mathtest/RandomMinimum.h>
93
94
95 namespace blazetest {
96
97 namespace mathtest {
98
99 namespace operations {
100
101 namespace smatdmatkron {
102
103 //=================================================================================================
104 //
105 // CLASS DEFINITION
106 //
107 //=================================================================================================
108
109 //*************************************************************************************************
110 /*!\brief Auxiliary class template for the sparse matrix/dense matrix Kronecker product operation test.
111 //
112 // This class template represents one particular matrix Kronecker product test between two matrices
113 // of a particular type. The two template arguments \a MT1 and \a MT2 represent the types of the
114 // left-hand side and right-hand side matrix, respectively.
115 */
116 template< typename MT1 // Type of the left-hand side sparse matrix
117 , typename MT2 > // Type of the right-hand side dense matrix
118 class OperationTest
119 {
120 private:
121 //**Type definitions****************************************************************************
122 using ET1 = blaze::ElementType_t<MT1>; //!< Element type 1
123 using ET2 = blaze::ElementType_t<MT2>; //!< Element type 2
124
125 using OMT1 = blaze::OppositeType_t<MT1>; //!< Matrix type 1 with opposite storage order
126 using OMT2 = blaze::OppositeType_t<MT2>; //!< Matrix type 2 with opposite storage order
127 using TMT1 = blaze::TransposeType_t<MT1>; //!< Transpose matrix type 1
128 using TMT2 = blaze::TransposeType_t<MT2>; //!< Transpose matrix type 2
129 using TOMT1 = blaze::TransposeType_t<OMT1>; //!< Transpose matrix type 1 with opposite storage order
130 using TOMT2 = blaze::TransposeType_t<OMT2>; //!< Transpose matrix type 2 with opposite storage order
131
132 //! Sparse result type
133 using SRE = blaze::KronTrait_t<MT1,MT2>;
134
135 using SET = blaze::ElementType_t<SRE>; //!< Element type of the sparse result
136 using OSRE = blaze::OppositeType_t<SRE>; //!< Sparse result type with opposite storage order
137 using TSRE = blaze::TransposeType_t<SRE>; //!< Transpose sparse result type
138 using TOSRE = blaze::TransposeType_t<OSRE>; //!< Transpose sparse result type with opposite storage order
139
140 //! Dense result type
141 using DRE = MatchAdaptor_t< SRE, blaze::DynamicMatrix<SET,false> >;
142
143 using DET = blaze::ElementType_t<DRE>; //!< Element type of the dense result
144 using ODRE = blaze::OppositeType_t<DRE>; //!< Dense result type with opposite storage order
145 using TDRE = blaze::TransposeType_t<DRE>; //!< Transpose dense result type
146 using TODRE = blaze::TransposeType_t<ODRE>; //!< Transpose dense result type with opposite storage order
147
148 using RT1 = blaze::DynamicMatrix<ET1,false>; //!< Reference type 1
149 using RT2 = blaze::DynamicMatrix<ET2,false>; //!< Reference type 2
150
151 //! Reference result type
152 using RRE = MatchSymmetry_t< DRE, blaze::KronTrait_t<RT1,RT2> >;
153
154 //! Type of the matrix/matrix Kronecker product expression
155 using MatMatKronExprType =
156 blaze::RemoveCVRef_t< decltype( kron( std::declval<MT1>(), std::declval<MT2>() ) ) >;
157
158 //! Type of the matrix/transpose matrix Kronecker product expression
159 using MatTMatKronExprType =
160 blaze::RemoveCVRef_t< decltype( kron( std::declval<MT1>(), std::declval<OMT2>() ) ) >;
161
162 //! Type of the transpose matrix/matrix Kronecker product expression
163 using TMatMatKronExprType =
164 blaze::RemoveCVRef_t< decltype( kron( std::declval<OMT1>(), std::declval<MT2>() ) ) >;
165
166 //! Type of the transpose matrix/transpose matrix Kronecker product expression
167 using TMatTMatKronExprType =
168 blaze::RemoveCVRef_t< decltype( kron( std::declval<OMT1>(), std::declval<OMT2>() ) ) >;
169 //**********************************************************************************************
170
171 public:
172 //**Constructors********************************************************************************
173 /*!\name Constructors */
174 //@{
175 explicit OperationTest( const Creator<MT1>& creator1, const Creator<MT2>& creator2 );
176 // No explicitly declared copy constructor.
177 //@}
178 //**********************************************************************************************
179
180 //**Destructor**********************************************************************************
181 // No explicitly declared destructor.
182 //**********************************************************************************************
183
184 private:
185 //**Test functions******************************************************************************
186 /*!\name Test functions */
187 //@{
188 void testInitialStatus ();
189 void testAssignment ();
190 void testEvaluation ();
191 void testElementAccess ();
192 void testBasicOperation ();
193 void testNegatedOperation ();
194 template< typename T > void testScaledOperation ( T scalar );
195 void testTransOperation ();
196 void testCTransOperation ();
197 void testAbsOperation ();
198 void testConjOperation ();
199 void testRealOperation ();
200 void testImagOperation ();
201 void testEvalOperation ();
202 void testSerialOperation ();
203 void testNoAliasOperation ();
204 void testNoSIMDOperation ();
205 void testDeclSymOperation ( blaze::TrueType );
206 void testDeclSymOperation ( blaze::FalseType );
207 void testDeclHermOperation ( blaze::TrueType );
208 void testDeclHermOperation ( blaze::FalseType );
209 void testDeclLowOperation ( blaze::TrueType );
210 void testDeclLowOperation ( blaze::FalseType );
211 void testDeclUppOperation ( blaze::TrueType );
212 void testDeclUppOperation ( blaze::FalseType );
213 void testDeclDiagOperation ( blaze::TrueType );
214 void testDeclDiagOperation ( blaze::FalseType );
215 void testSubmatrixOperation( blaze::TrueType );
216 void testSubmatrixOperation( blaze::FalseType );
217 void testRowOperation ( blaze::TrueType );
218 void testRowOperation ( blaze::FalseType );
219 void testRowsOperation ( blaze::TrueType );
220 void testRowsOperation ( blaze::FalseType );
221 void testColumnOperation ( blaze::TrueType );
222 void testColumnOperation ( blaze::FalseType );
223 void testColumnsOperation ( blaze::TrueType );
224 void testColumnsOperation ( blaze::FalseType );
225 void testBandOperation ( blaze::TrueType );
226 void testBandOperation ( blaze::FalseType );
227
228 template< typename OP > void testCustomOperation( OP op, const std::string& name );
229 //@}
230 //**********************************************************************************************
231
232 //**Error detection functions*******************************************************************
233 /*!\name Error detection functions */
234 //@{
235 template< typename LT, typename RT > void checkResults();
236 template< typename LT, typename RT > void checkTransposeResults();
237 void checkExceptionMessage( const std::exception& ex, const std::string& message );
238 //@}
239 //**********************************************************************************************
240
241 //**Utility functions***************************************************************************
242 /*!\name Utility functions */
243 //@{
244 void initResults();
245 void initTransposeResults();
246 template< typename LT, typename RT > void convertException( const std::exception& ex );
247 //@}
248 //**********************************************************************************************
249
250 //**Member variables****************************************************************************
251 /*!\name Member variables */
252 //@{
253 MT1 lhs_; //!< The left-hand side sparse matrix.
254 MT2 rhs_; //!< The right-hand side dense matrix.
255 OMT1 olhs_; //!< The left-hand side sparse matrix with opposite storage order.
256 OMT2 orhs_; //!< The right-hand side dense matrix with opposite storage order.
257 DRE dres_; //!< The dense result matrix.
258 SRE sres_; //!< The sparse result matrix.
259 ODRE odres_; //!< The dense result matrix with opposite storage order.
260 OSRE osres_; //!< The sparse result matrix with opposite storage order.
261 TDRE tdres_; //!< The transpose dense result matrix.
262 TSRE tsres_; //!< The transpose sparse result matrix.
263 TODRE todres_; //!< The transpose dense result matrix with opposite storage order.
264 TOSRE tosres_; //!< The transpose sparse result matrix with opposite storage order.
265 RT1 reflhs_; //!< The reference left-hand side matrix.
266 RT2 refrhs_; //!< The reference right-hand side matrix.
267 RRE refres_; //!< The reference result.
268
269 std::string test_; //!< Label of the currently performed test.
270 std::string error_; //!< Description of the current error type.
271 //@}
272 //**********************************************************************************************
273
274 //**Compile time checks*************************************************************************
275 /*! \cond BLAZE_INTERNAL */
276 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( MT1 );
277 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( MT2 );
278 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( OMT1 );
279 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( OMT2 );
280 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TMT1 );
281 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( TMT2 );
282 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TOMT1 );
283 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( TOMT2 );
284 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( RT1 );
285 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( RT2 );
286 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( RRE );
287 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( DRE );
288 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( SRE );
289 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( ODRE );
290 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( OSRE );
291 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( TDRE );
292 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TSRE );
293 BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE ( TODRE );
294 BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( TOSRE );
295
296 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( MT1 );
297 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( MT2 );
298 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OMT1 );
299 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OMT2 );
300 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TMT1 );
301 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TMT2 );
302 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TOMT1 );
303 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TOMT2 );
304 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( RT1 );
305 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( RT2 );
306 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( DRE );
307 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( SRE );
308 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( ODRE );
309 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OSRE );
310 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TDRE );
311 BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( TSRE );
312 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TODRE );
313 BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE ( TOSRE );
314
315 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET1, blaze::ElementType_t<OMT1> );
316 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET2, blaze::ElementType_t<OMT2> );
317 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET1, blaze::ElementType_t<TMT1> );
318 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET2, blaze::ElementType_t<TMT2> );
319 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET1, blaze::ElementType_t<TOMT1> );
320 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( ET2, blaze::ElementType_t<TOMT2> );
321 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<DRE> );
322 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<ODRE> );
323 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<TDRE> );
324 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<TODRE> );
325 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DET, blaze::ElementType_t<SRE> );
326 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<SRE> );
327 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<OSRE> );
328 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<TSRE> );
329 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<TOSRE> );
330 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SET, blaze::ElementType_t<DRE> );
331 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT1, blaze::OppositeType_t<OMT1> );
332 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT2, blaze::OppositeType_t<OMT2> );
333 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT1, blaze::TransposeType_t<TMT1> );
334 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( MT2, blaze::TransposeType_t<TMT2> );
335 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DRE, blaze::OppositeType_t<ODRE> );
336 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( DRE, blaze::TransposeType_t<TDRE> );
337 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SRE, blaze::OppositeType_t<OSRE> );
338 BLAZE_CONSTRAINT_MUST_BE_SAME_TYPE( SRE, blaze::TransposeType_t<TSRE> );
339
340 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( MatMatKronExprType, blaze::ResultType_t<MatMatKronExprType> );
341 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatMatKronExprType, blaze::OppositeType_t<MatMatKronExprType> );
342 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatMatKronExprType, blaze::TransposeType_t<MatMatKronExprType> );
343
344 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( MatTMatKronExprType, blaze::ResultType_t<MatTMatKronExprType> );
345 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatTMatKronExprType, blaze::OppositeType_t<MatTMatKronExprType> );
346 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( MatTMatKronExprType, blaze::TransposeType_t<MatTMatKronExprType> );
347
348 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( TMatMatKronExprType, blaze::ResultType_t<TMatMatKronExprType> );
349 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatMatKronExprType, blaze::OppositeType_t<TMatMatKronExprType> );
350 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatMatKronExprType, blaze::TransposeType_t<TMatMatKronExprType> );
351
352 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER ( TMatTMatKronExprType, blaze::ResultType_t<TMatTMatKronExprType> );
353 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatTMatKronExprType, blaze::OppositeType_t<TMatTMatKronExprType> );
354 BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_DIFFERENT_STORAGE_ORDER( TMatTMatKronExprType, blaze::TransposeType_t<TMatTMatKronExprType> );
355
356 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( MatMatKronExprType , blaze::BaseType_t<MatMatKronExprType > );
357 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( MatTMatKronExprType , blaze::BaseType_t<MatTMatKronExprType > );
358 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( TMatMatKronExprType , blaze::BaseType_t<TMatMatKronExprType > );
359 BLAZE_CONSTRAINT_MUST_BE_DERIVED_FROM( TMatTMatKronExprType, blaze::BaseType_t<TMatTMatKronExprType> );
360 /*! \endcond */
361 //**********************************************************************************************
362 };
363 //*************************************************************************************************
364
365
366
367
368 //=================================================================================================
369 //
370 // CONSTRUCTORS
371 //
372 //=================================================================================================
373
374 //*************************************************************************************************
375 /*!\brief Constructor for the sparse matrix/dense matrix Kronecker product operation test.
376 //
377 // \param creator1 The creator for the left-hand side sparse matrix of the matrix Kronecker product.
378 // \param creator2 The creator for the right-hand side dense matrix of the matrix Kronecker product.
379 // \exception std::runtime_error Operation error detected.
380 */
381 template< typename MT1 // Type of the left-hand side sparse matrix
382 , typename MT2 > // Type of the right-hand side dense matrix
OperationTest(const Creator<MT1> & creator1,const Creator<MT2> & creator2)383 OperationTest<MT1,MT2>::OperationTest( const Creator<MT1>& creator1, const Creator<MT2>& creator2 )
384 : lhs_( creator1() ) // The left-hand side sparse matrix
385 , rhs_( creator2() ) // The right-hand side dense matrix
386 , olhs_( lhs_ ) // The left-hand side sparse matrix with opposite storage order
387 , orhs_( rhs_ ) // The right-hand side dense matrix with opposite storage order
388 , dres_() // The dense result matrix
389 , sres_() // The sparse result matrix
390 , odres_() // The dense result matrix with opposite storage order
391 , osres_() // The sparse result matrix with opposite storage order
392 , tdres_() // The transpose dense result matrix
393 , tsres_() // The transpose sparse result matrix
394 , todres_() // The transpose dense result matrix with opposite storage order
395 , tosres_() // The transpose sparse result matrix with opposite storage order
396 , reflhs_( lhs_ ) // The reference left-hand side matrix
397 , refrhs_( rhs_ ) // The reference right-hand side matrix
398 , refres_() // The reference result
399 , test_() // Label of the currently performed test
400 , error_() // Description of the current error type
401 {
402 using namespace blaze;
403
404 using Scalar = UnderlyingScalar_t<DET>;
405
406 testInitialStatus();
407 testAssignment();
408 testEvaluation();
409 testElementAccess();
410 testBasicOperation();
411 testNegatedOperation();
412 testScaledOperation( 2 );
413 testScaledOperation( 2UL );
414 testScaledOperation( 2.0F );
415 testScaledOperation( 2.0 );
416 testScaledOperation( Scalar( 2 ) );
417 testTransOperation();
418 testCTransOperation();
419 testAbsOperation();
420 testConjOperation();
421 testRealOperation();
422 testImagOperation();
423 testEvalOperation();
424 testSerialOperation();
425 testNoAliasOperation();
426 testNoSIMDOperation();
427 testDeclSymOperation( Or_t< IsSquare<DRE>, IsResizable<DRE> >() );
428 testDeclHermOperation( Or_t< IsSquare<DRE>, IsResizable<DRE> >() );
429 testDeclLowOperation( Or_t< IsSquare<DRE>, IsResizable<DRE> >() );
430 testDeclUppOperation( Or_t< IsSquare<DRE>, IsResizable<DRE> >() );
431 testDeclDiagOperation( Or_t< IsSquare<DRE>, IsResizable<DRE> >() );
432 testSubmatrixOperation( Not_t< IsUniform<DRE> >() );
433 testRowOperation( Not_t< IsUniform<DRE> >() );
434 testRowsOperation( Nor_t< IsUniform<DRE>, IsSymmetric<DRE>, IsHermitian<DRE> >() );
435 testColumnOperation( Not_t< IsUniform<DRE> >() );
436 testColumnsOperation( Nor_t< IsUniform<DRE>, IsSymmetric<DRE>, IsHermitian<DRE> >() );
437 testBandOperation( Not_t< IsUniform<DRE> >() );
438 }
439 //*************************************************************************************************
440
441
442
443
444 //=================================================================================================
445 //
446 // TEST FUNCTIONS
447 //
448 //=================================================================================================
449
450 //*************************************************************************************************
451 /*!\brief Tests on the initial status of the matrices.
452 //
453 // \return void
454 // \exception std::runtime_error Initialization error detected.
455 //
456 // This function runs tests on the initial status of the matrices. In case any initialization
457 // error is detected, a \a std::runtime_error exception is thrown.
458 */
459 template< typename MT1 // Type of the left-hand side sparse matrix
460 , typename MT2 > // Type of the right-hand side dense matrix
testInitialStatus()461 void OperationTest<MT1,MT2>::testInitialStatus()
462 {
463 //=====================================================================================
464 // Performing initial tests with the row-major types
465 //=====================================================================================
466
467 // Checking the number of rows of the left-hand side operand
468 if( lhs_.rows() != reflhs_.rows() ) {
469 std::ostringstream oss;
470 oss << " Test: Initial size comparison of left-hand side row-major sparse operand\n"
471 << " Error: Invalid number of rows\n"
472 << " Details:\n"
473 << " Random seed = " << blaze::getSeed() << "\n"
474 << " Row-major sparse matrix type:\n"
475 << " " << typeid( MT1 ).name() << "\n"
476 << " Detected number of rows = " << lhs_.rows() << "\n"
477 << " Expected number of rows = " << reflhs_.rows() << "\n";
478 throw std::runtime_error( oss.str() );
479 }
480
481 // Checking the number of columns of the left-hand side operand
482 if( lhs_.columns() != reflhs_.columns() ) {
483 std::ostringstream oss;
484 oss << " Test: Initial size comparison of left-hand side row-major sparse operand\n"
485 << " Error: Invalid number of columns\n"
486 << " Details:\n"
487 << " Random seed = " << blaze::getSeed() << "\n"
488 << " Row-major sparse matrix type:\n"
489 << " " << typeid( MT1 ).name() << "\n"
490 << " Detected number of columns = " << lhs_.columns() << "\n"
491 << " Expected number of columns = " << reflhs_.columns() << "\n";
492 throw std::runtime_error( oss.str() );
493 }
494
495 // Checking the number of rows of the right-hand side operand
496 if( rhs_.rows() != refrhs_.rows() ) {
497 std::ostringstream oss;
498 oss << " Test: Initial size comparison of right-hand side row-major dense operand\n"
499 << " Error: Invalid number of rows\n"
500 << " Details:\n"
501 << " Random seed = " << blaze::getSeed() << "\n"
502 << " Row-major dense matrix type:\n"
503 << " " << typeid( MT2 ).name() << "\n"
504 << " Detected number of rows = " << rhs_.rows() << "\n"
505 << " Expected number of rows = " << refrhs_.rows() << "\n";
506 throw std::runtime_error( oss.str() );
507 }
508
509 // Checking the number of columns of the right-hand side operand
510 if( rhs_.columns() != refrhs_.columns() ) {
511 std::ostringstream oss;
512 oss << " Test: Initial size comparison of right-hand side row-major dense operand\n"
513 << " Error: Invalid number of columns\n"
514 << " Details:\n"
515 << " Random seed = " << blaze::getSeed() << "\n"
516 << " Row-major dense matrix type:\n"
517 << " " << typeid( MT2 ).name() << "\n"
518 << " Detected number of columns = " << rhs_.columns() << "\n"
519 << " Expected number of columns = " << refrhs_.columns() << "\n";
520 throw std::runtime_error( oss.str() );
521 }
522
523 // Checking the initialization of the left-hand side operand
524 if( !isEqual( lhs_, reflhs_ ) ) {
525 std::ostringstream oss;
526 oss << " Test: Initial test of initialization of left-hand side row-major sparse operand\n"
527 << " Error: Invalid matrix initialization\n"
528 << " Details:\n"
529 << " Random seed = " << blaze::getSeed() << "\n"
530 << " Row-major sparse matrix type:\n"
531 << " " << typeid( MT1 ).name() << "\n"
532 << " Current initialization:\n" << lhs_ << "\n"
533 << " Expected initialization:\n" << reflhs_ << "\n";
534 throw std::runtime_error( oss.str() );
535 }
536
537 // Checking the initialization of the right-hand side operand
538 if( !isEqual( rhs_, refrhs_ ) ) {
539 std::ostringstream oss;
540 oss << " Test: Initial test of initialization of right-hand side row-major dense operand\n"
541 << " Error: Invalid matrix initialization\n"
542 << " Details:\n"
543 << " Random seed = " << blaze::getSeed() << "\n"
544 << " Row-major dense matrix type:\n"
545 << " " << typeid( MT2 ).name() << "\n"
546 << " Current initialization:\n" << rhs_ << "\n"
547 << " Expected initialization:\n" << refrhs_ << "\n";
548 throw std::runtime_error( oss.str() );
549 }
550
551
552 //=====================================================================================
553 // Performing initial tests with the column-major types
554 //=====================================================================================
555
556 // Checking the number of rows of the left-hand side operand
557 if( olhs_.rows() != reflhs_.rows() ) {
558 std::ostringstream oss;
559 oss << " Test: Initial size comparison of left-hand side column-major sparse operand\n"
560 << " Error: Invalid number of rows\n"
561 << " Details:\n"
562 << " Random seed = " << blaze::getSeed() << "\n"
563 << " Column-major sparse matrix type:\n"
564 << " " << typeid( OMT1 ).name() << "\n"
565 << " Detected number of rows = " << olhs_.rows() << "\n"
566 << " Expected number of rows = " << reflhs_.rows() << "\n";
567 throw std::runtime_error( oss.str() );
568 }
569
570 // Checking the number of columns of the left-hand side operand
571 if( olhs_.columns() != reflhs_.columns() ) {
572 std::ostringstream oss;
573 oss << " Test: Initial size comparison of left-hand side column-major sparse operand\n"
574 << " Error: Invalid number of columns\n"
575 << " Details:\n"
576 << " Random seed = " << blaze::getSeed() << "\n"
577 << " Column-major sparse matrix type:\n"
578 << " " << typeid( OMT1 ).name() << "\n"
579 << " Detected number of columns = " << olhs_.columns() << "\n"
580 << " Expected number of columns = " << reflhs_.columns() << "\n";
581 throw std::runtime_error( oss.str() );
582 }
583
584 // Checking the number of rows of the right-hand side operand
585 if( orhs_.rows() != refrhs_.rows() ) {
586 std::ostringstream oss;
587 oss << " Test: Initial size comparison of right-hand side column-major dense operand\n"
588 << " Error: Invalid number of rows\n"
589 << " Details:\n"
590 << " Random seed = " << blaze::getSeed() << "\n"
591 << " Column-major dense matrix type:\n"
592 << " " << typeid( OMT2 ).name() << "\n"
593 << " Detected number of rows = " << orhs_.rows() << "\n"
594 << " Expected number of rows = " << refrhs_.rows() << "\n";
595 throw std::runtime_error( oss.str() );
596 }
597
598 // Checking the number of columns of the right-hand side operand
599 if( orhs_.columns() != refrhs_.columns() ) {
600 std::ostringstream oss;
601 oss << " Test: Initial size comparison of right-hand side column-major dense operand\n"
602 << " Error: Invalid number of columns\n"
603 << " Details:\n"
604 << " Random seed = " << blaze::getSeed() << "\n"
605 << " Column-major dense matrix type:\n"
606 << " " << typeid( OMT2 ).name() << "\n"
607 << " Detected number of columns = " << orhs_.columns() << "\n"
608 << " Expected number of columns = " << refrhs_.columns() << "\n";
609 throw std::runtime_error( oss.str() );
610 }
611
612 // Checking the initialization of the left-hand side operand
613 if( !isEqual( olhs_, reflhs_ ) ) {
614 std::ostringstream oss;
615 oss << " Test: Initial test of initialization of left-hand side column-major sparse operand\n"
616 << " Error: Invalid matrix initialization\n"
617 << " Details:\n"
618 << " Random seed = " << blaze::getSeed() << "\n"
619 << " Column-major sparse matrix type:\n"
620 << " " << typeid( OMT1 ).name() << "\n"
621 << " Current initialization:\n" << olhs_ << "\n"
622 << " Expected initialization:\n" << reflhs_ << "\n";
623 throw std::runtime_error( oss.str() );
624 }
625
626 // Checking the initialization of the right-hand side operand
627 if( !isEqual( orhs_, refrhs_ ) ) {
628 std::ostringstream oss;
629 oss << " Test: Initial test of initialization of right-hand side column-major dense operand\n"
630 << " Error: Invalid matrix initialization\n"
631 << " Details:\n"
632 << " Random seed = " << blaze::getSeed() << "\n"
633 << " Column-major dense matrix type:\n"
634 << " " << typeid( OMT2 ).name() << "\n"
635 << " Current initialization:\n" << orhs_ << "\n"
636 << " Expected initialization:\n" << refrhs_ << "\n";
637 throw std::runtime_error( oss.str() );
638 }
639 }
640 //*************************************************************************************************
641
642
643 //*************************************************************************************************
644 /*!\brief Testing the matrix assignment.
645 //
646 // \return void
647 // \exception std::runtime_error Assignment error detected.
648 //
649 // This function tests the matrix assignment. In case any error is detected, a
650 // \a std::runtime_error exception is thrown.
651 */
652 template< typename MT1 // Type of the left-hand side sparse matrix
653 , typename MT2 > // Type of the right-hand side dense matrix
testAssignment()654 void OperationTest<MT1,MT2>::testAssignment()
655 {
656 //=====================================================================================
657 // // Performing an assignment with the row-major types
658 //=====================================================================================
659
660 try {
661 lhs_ = reflhs_;
662 rhs_ = refrhs_;
663 }
664 catch( std::exception& ex ) {
665 std::ostringstream oss;
666 oss << " Test: Assignment with the row-major types\n"
667 << " Error: Failed assignment\n"
668 << " Details:\n"
669 << " Random seed = " << blaze::getSeed() << "\n"
670 << " Left-hand side row-major sparse matrix type:\n"
671 << " " << typeid( MT1 ).name() << "\n"
672 << " Right-hand side row-major dense matrix type:\n"
673 << " " << typeid( MT2 ).name() << "\n"
674 << " Error message: " << ex.what() << "\n";
675 throw std::runtime_error( oss.str() );
676 }
677
678 if( !isEqual( lhs_, reflhs_ ) ) {
679 std::ostringstream oss;
680 oss << " Test: Checking the assignment result of left-hand side row-major sparse operand\n"
681 << " Error: Invalid matrix initialization\n"
682 << " Details:\n"
683 << " Random seed = " << blaze::getSeed() << "\n"
684 << " Row-major sparse matrix type:\n"
685 << " " << typeid( MT1 ).name() << "\n"
686 << " Current initialization:\n" << lhs_ << "\n"
687 << " Expected initialization:\n" << reflhs_ << "\n";
688 throw std::runtime_error( oss.str() );
689 }
690
691 if( !isEqual( rhs_, refrhs_ ) ) {
692 std::ostringstream oss;
693 oss << " Test: Checking the assignment result of right-hand side row-major dense operand\n"
694 << " Error: Invalid matrix initialization\n"
695 << " Details:\n"
696 << " Random seed = " << blaze::getSeed() << "\n"
697 << " Row-major dense matrix type:\n"
698 << " " << typeid( MT2 ).name() << "\n"
699 << " Current initialization:\n" << rhs_ << "\n"
700 << " Expected initialization:\n" << refrhs_ << "\n";
701 throw std::runtime_error( oss.str() );
702 }
703
704
705 //=====================================================================================
706 // Performing an assignment with the column-major types
707 //=====================================================================================
708
709 try {
710 olhs_ = reflhs_;
711 orhs_ = refrhs_;
712 }
713 catch( std::exception& ex ) {
714 std::ostringstream oss;
715 oss << " Test: Assignment with the column-major types\n"
716 << " Error: Failed assignment\n"
717 << " Details:\n"
718 << " Random seed = " << blaze::getSeed() << "\n"
719 << " Left-hand side column-major sparse matrix type:\n"
720 << " " << typeid( OMT1 ).name() << "\n"
721 << " Right-hand side column-major dense matrix type:\n"
722 << " " << typeid( OMT2 ).name() << "\n"
723 << " Error message: " << ex.what() << "\n";
724 throw std::runtime_error( oss.str() );
725 }
726
727 if( !isEqual( olhs_, reflhs_ ) ) {
728 std::ostringstream oss;
729 oss << " Test: Checking the assignment result of left-hand side column-major sparse operand\n"
730 << " Error: Invalid matrix initialization\n"
731 << " Details:\n"
732 << " Random seed = " << blaze::getSeed() << "\n"
733 << " Column-major sparse matrix type:\n"
734 << " " << typeid( OMT1 ).name() << "\n"
735 << " Current initialization:\n" << olhs_ << "\n"
736 << " Expected initialization:\n" << reflhs_ << "\n";
737 throw std::runtime_error( oss.str() );
738 }
739
740 if( !isEqual( orhs_, refrhs_ ) ) {
741 std::ostringstream oss;
742 oss << " Test: Checking the assignment result of right-hand side column-major dense operand\n"
743 << " Error: Invalid matrix initialization\n"
744 << " Details:\n"
745 << " Random seed = " << blaze::getSeed() << "\n"
746 << " Column-major dense matrix type:\n"
747 << " " << typeid( OMT2 ).name() << "\n"
748 << " Current initialization:\n" << orhs_ << "\n"
749 << " Expected initialization:\n" << refrhs_ << "\n";
750 throw std::runtime_error( oss.str() );
751 }
752 }
753 //*************************************************************************************************
754
755
756 //*************************************************************************************************
757 /*!\brief Testing the explicit evaluation.
758 //
759 // \return void
760 // \exception std::runtime_error Evaluation error detected.
761 //
762 // This function tests the explicit evaluation. In case any error is detected, a
763 // \a std::runtime_error exception is thrown.
764 */
765 template< typename MT1 // Type of the left-hand side sparse matrix
766 , typename MT2 > // Type of the right-hand side dense matrix
testEvaluation()767 void OperationTest<MT1,MT2>::testEvaluation()
768 {
769 using blaze::IsRowMajorMatrix;
770
771
772 //=====================================================================================
773 // Testing the evaluation with two row-major matrices
774 //=====================================================================================
775
776 {
777 const auto res ( evaluate( kron( lhs_ , rhs_ ) ) );
778 const auto refres( evaluate( kron( reflhs_, refrhs_ ) ) );
779
780 if( !isEqual( res, refres ) ) {
781 std::ostringstream oss;
782 oss << " Test: Evaluation with the given matrices\n"
783 << " Error: Failed evaluation\n"
784 << " Details:\n"
785 << " Random seed = " << blaze::getSeed() << "\n"
786 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
787 << " " << typeid( lhs_ ).name() << "\n"
788 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
789 << " " << typeid( rhs_ ).name() << "\n"
790 << " Deduced result type:\n"
791 << " " << typeid( res ).name() << "\n"
792 << " Deduced reference result type:\n"
793 << " " << typeid( refres ).name() << "\n"
794 << " Result:\n" << res << "\n"
795 << " Expected result:\n" << refres << "\n";
796 throw std::runtime_error( oss.str() );
797 }
798 }
799
800 {
801 const auto res ( evaluate( kron( eval( lhs_ ) , eval( rhs_ ) ) ) );
802 const auto refres( evaluate( kron( eval( reflhs_ ), eval( refrhs_ ) ) ) );
803
804 if( !isEqual( res, refres ) ) {
805 std::ostringstream oss;
806 oss << " Test: Evaluation with evaluated matrices\n"
807 << " Error: Failed evaluation\n"
808 << " Details:\n"
809 << " Random seed = " << blaze::getSeed() << "\n"
810 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
811 << " " << typeid( lhs_ ).name() << "\n"
812 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
813 << " " << typeid( rhs_ ).name() << "\n"
814 << " Deduced result type:\n"
815 << " " << typeid( res ).name() << "\n"
816 << " Deduced reference result type:\n"
817 << " " << typeid( refres ).name() << "\n"
818 << " Result:\n" << res << "\n"
819 << " Expected result:\n" << refres << "\n";
820 throw std::runtime_error( oss.str() );
821 }
822 }
823
824
825 //=====================================================================================
826 // Testing the evaluation with a row-major matrix and a column-major matrix
827 //=====================================================================================
828
829 {
830 const auto res ( evaluate( kron( lhs_ , orhs_ ) ) );
831 const auto refres( evaluate( kron( reflhs_, refrhs_ ) ) );
832
833 if( !isEqual( res, refres ) ) {
834 std::ostringstream oss;
835 oss << " Test: Evaluation with the given matrices\n"
836 << " Error: Failed evaluation\n"
837 << " Details:\n"
838 << " Random seed = " << blaze::getSeed() << "\n"
839 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
840 << " " << typeid( lhs_ ).name() << "\n"
841 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
842 << " " << typeid( orhs_ ).name() << "\n"
843 << " Deduced result type:\n"
844 << " " << typeid( res ).name() << "\n"
845 << " Deduced reference result type:\n"
846 << " " << typeid( refres ).name() << "\n"
847 << " Result:\n" << res << "\n"
848 << " Expected result:\n" << refres << "\n";
849 throw std::runtime_error( oss.str() );
850 }
851 }
852
853 {
854 const auto res ( evaluate( kron( eval( lhs_ ) , eval( orhs_ ) ) ) );
855 const auto refres( evaluate( kron( eval( reflhs_ ), eval( refrhs_ ) ) ) );
856
857 if( !isEqual( res, refres ) ) {
858 std::ostringstream oss;
859 oss << " Test: Evaluation with the given matrices\n"
860 << " Error: Failed evaluation\n"
861 << " Details:\n"
862 << " Random seed = " << blaze::getSeed() << "\n"
863 << " Left-hand side " << ( IsRowMajorMatrix<MT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
864 << " " << typeid( lhs_ ).name() << "\n"
865 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
866 << " " << typeid( orhs_ ).name() << "\n"
867 << " Deduced result type:\n"
868 << " " << typeid( res ).name() << "\n"
869 << " Deduced reference result type:\n"
870 << " " << typeid( refres ).name() << "\n"
871 << " Result:\n" << res << "\n"
872 << " Expected result:\n" << refres << "\n";
873 throw std::runtime_error( oss.str() );
874 }
875 }
876
877
878 //=====================================================================================
879 // Testing the evaluation with a column-major matrix and a row-major matrix
880 //=====================================================================================
881
882 {
883 const auto res ( evaluate( kron( olhs_ , rhs_ ) ) );
884 const auto refres( evaluate( kron( reflhs_, refrhs_ ) ) );
885
886 if( !isEqual( res, refres ) ) {
887 std::ostringstream oss;
888 oss << " Test: Evaluation with the given matrices\n"
889 << " Error: Failed evaluation\n"
890 << " Details:\n"
891 << " Random seed = " << blaze::getSeed() << "\n"
892 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
893 << " " << typeid( olhs_ ).name() << "\n"
894 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
895 << " " << typeid( rhs_ ).name() << "\n"
896 << " Deduced result type:\n"
897 << " " << typeid( res ).name() << "\n"
898 << " Deduced reference result type:\n"
899 << " " << typeid( refres ).name() << "\n"
900 << " Result:\n" << res << "\n"
901 << " Expected result:\n" << refres << "\n";
902 throw std::runtime_error( oss.str() );
903 }
904 }
905
906 {
907 const auto res ( evaluate( kron( eval( olhs_ ) , eval( rhs_ ) ) ) );
908 const auto refres( evaluate( kron( eval( reflhs_ ), eval( refrhs_ ) ) ) );
909
910 if( !isEqual( res, refres ) ) {
911 std::ostringstream oss;
912 oss << " Test: Evaluation with the given matrices\n"
913 << " Error: Failed evaluation\n"
914 << " Details:\n"
915 << " Random seed = " << blaze::getSeed() << "\n"
916 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
917 << " " << typeid( olhs_ ).name() << "\n"
918 << " Right-hand side " << ( IsRowMajorMatrix<MT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
919 << " " << typeid( rhs_ ).name() << "\n"
920 << " Deduced result type:\n"
921 << " " << typeid( res ).name() << "\n"
922 << " Deduced reference result type:\n"
923 << " " << typeid( refres ).name() << "\n"
924 << " Result:\n" << res << "\n"
925 << " Expected result:\n" << refres << "\n";
926 throw std::runtime_error( oss.str() );
927 }
928 }
929
930
931 //=====================================================================================
932 // Testing the evaluation with two column-major matrices
933 //=====================================================================================
934
935 {
936 const auto res ( evaluate( kron( olhs_ , orhs_ ) ) );
937 const auto refres( evaluate( kron( reflhs_, refrhs_ ) ) );
938
939 if( !isEqual( res, refres ) ) {
940 std::ostringstream oss;
941 oss << " Test: Evaluation with the given matrices\n"
942 << " Error: Failed evaluation\n"
943 << " Details:\n"
944 << " Random seed = " << blaze::getSeed() << "\n"
945 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
946 << " " << typeid( olhs_ ).name() << "\n"
947 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
948 << " " << typeid( orhs_ ).name() << "\n"
949 << " Deduced result type:\n"
950 << " " << typeid( res ).name() << "\n"
951 << " Deduced reference result type:\n"
952 << " " << typeid( refres ).name() << "\n"
953 << " Result:\n" << res << "\n"
954 << " Expected result:\n" << refres << "\n";
955 throw std::runtime_error( oss.str() );
956 }
957 }
958
959 {
960 const auto res ( evaluate( kron( eval( olhs_ ) , eval( orhs_ ) ) ) );
961 const auto refres( evaluate( kron( eval( reflhs_ ), eval( refrhs_ ) ) ) );
962
963 if( !isEqual( res, refres ) ) {
964 std::ostringstream oss;
965 oss << " Test: Evaluation with the given matrices\n"
966 << " Error: Failed evaluation\n"
967 << " Details:\n"
968 << " Random seed = " << blaze::getSeed() << "\n"
969 << " Left-hand side " << ( IsRowMajorMatrix<OMT1>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
970 << " " << typeid( olhs_ ).name() << "\n"
971 << " Right-hand side " << ( IsRowMajorMatrix<OMT2>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
972 << " " << typeid( orhs_ ).name() << "\n"
973 << " Deduced result type:\n"
974 << " " << typeid( res ).name() << "\n"
975 << " Deduced reference result type:\n"
976 << " " << typeid( refres ).name() << "\n"
977 << " Result:\n" << res << "\n"
978 << " Expected result:\n" << refres << "\n";
979 throw std::runtime_error( oss.str() );
980 }
981 }
982 }
983 //*************************************************************************************************
984
985
986 //*************************************************************************************************
987 /*!\brief Testing the matrix element access.
988 //
989 // \return void
990 // \exception std::runtime_error Element access error detected.
991 //
992 // This function tests the element access via the subscript operator. In case any
993 // error is detected, a \a std::runtime_error exception is thrown.
994 */
995 template< typename MT1 // Type of the left-hand side sparse matrix
996 , typename MT2 > // Type of the right-hand side dense matrix
testElementAccess()997 void OperationTest<MT1,MT2>::testElementAccess()
998 {
999 using blaze::equal;
1000
1001
1002 //=====================================================================================
1003 // Testing the element access with two row-major matrices
1004 //=====================================================================================
1005
1006 if( lhs_.rows() > 0UL && lhs_.columns() > 0UL && rhs_.rows() && rhs_.columns() > 0UL )
1007 {
1008 const size_t m( lhs_.rows() * rhs_.rows() - 1UL );
1009 const size_t n( lhs_.columns() * rhs_.columns() - 1UL );
1010
1011 if( !equal( kron( lhs_, rhs_ )(m,n), kron( reflhs_, refrhs_ )(m,n) ) ||
1012 !equal( kron( lhs_, rhs_ ).at(m,n), kron( reflhs_, refrhs_ ).at(m,n) ) ) {
1013 std::ostringstream oss;
1014 oss << " Test : Element access of Kronecker product expression\n"
1015 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1016 << " Details:\n"
1017 << " Random seed = " << blaze::getSeed() << "\n"
1018 << " Left-hand side row-major sparse matrix type:\n"
1019 << " " << typeid( MT1 ).name() << "\n"
1020 << " Right-hand side row-major dense matrix type:\n"
1021 << " " << typeid( MT2 ).name() << "\n";
1022 throw std::runtime_error( oss.str() );
1023 }
1024
1025 if( !equal( kron( lhs_, eval( rhs_ ) )(m,n), kron( reflhs_, eval( refrhs_ ) )(m,n) ) ||
1026 !equal( kron( lhs_, eval( rhs_ ) ).at(m,n), kron( reflhs_, eval( refrhs_ ) ).at(m,n) ) ) {
1027 std::ostringstream oss;
1028 oss << " Test : Element access of right evaluated Kronecker product expression\n"
1029 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1030 << " Details:\n"
1031 << " Random seed = " << blaze::getSeed() << "\n"
1032 << " Left-hand side row-major sparse matrix type:\n"
1033 << " " << typeid( MT1 ).name() << "\n"
1034 << " Right-hand side row-major dense matrix type:\n"
1035 << " " << typeid( MT2 ).name() << "\n";
1036 throw std::runtime_error( oss.str() );
1037 }
1038
1039 if( !equal( kron( eval( lhs_ ), rhs_ )(m,n), kron( eval( reflhs_ ), refrhs_ )(m,n) ) ||
1040 !equal( kron( eval( lhs_ ), rhs_ ).at(m,n), kron( eval( reflhs_ ), refrhs_ ).at(m,n) ) ) {
1041 std::ostringstream oss;
1042 oss << " Test : Element access of left evaluated Kronecker product expression\n"
1043 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1044 << " Details:\n"
1045 << " Random seed = " << blaze::getSeed() << "\n"
1046 << " Left-hand side row-major sparse matrix type:\n"
1047 << " " << typeid( MT1 ).name() << "\n"
1048 << " Right-hand side row-major dense matrix type:\n"
1049 << " " << typeid( MT2 ).name() << "\n";
1050 throw std::runtime_error( oss.str() );
1051 }
1052
1053 if( !equal( kron( eval( lhs_ ), eval( rhs_ ) )(m,n), kron( eval( reflhs_ ), eval( refrhs_ ) )(m,n) ) ||
1054 !equal( kron( eval( lhs_ ), eval( rhs_ ) ).at(m,n), kron( eval( reflhs_ ), eval( refrhs_ ) ).at(m,n) ) ) {
1055 std::ostringstream oss;
1056 oss << " Test : Element access of fully evaluated Kronecker product expression\n"
1057 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1058 << " Details:\n"
1059 << " Random seed = " << blaze::getSeed() << "\n"
1060 << " Left-hand side row-major sparse matrix type:\n"
1061 << " " << typeid( MT1 ).name() << "\n"
1062 << " Right-hand side row-major dense matrix type:\n"
1063 << " " << typeid( MT2 ).name() << "\n";
1064 throw std::runtime_error( oss.str() );
1065 }
1066 }
1067
1068 try {
1069 kron( lhs_, rhs_ ).at( 0UL, lhs_.columns() * rhs_.columns() );
1070
1071 std::ostringstream oss;
1072 oss << " Test : Checked element access of Kronecker product expression\n"
1073 << " Error: Out-of-bound access succeeded\n"
1074 << " Details:\n"
1075 << " Random seed = " << blaze::getSeed() << "\n"
1076 << " Left-hand side row-major sparse matrix type:\n"
1077 << " " << typeid( MT1 ).name() << "\n"
1078 << " Right-hand side row-major dense matrix type:\n"
1079 << " " << typeid( MT2 ).name() << "\n";
1080 throw std::runtime_error( oss.str() );
1081 }
1082 catch( std::out_of_range& ) {}
1083
1084 try {
1085 kron( lhs_, rhs_ ).at( lhs_.rows() * rhs_.rows(), 0UL );
1086
1087 std::ostringstream oss;
1088 oss << " Test : Checked element access of Kronecker product expression\n"
1089 << " Error: Out-of-bound access succeeded\n"
1090 << " Details:\n"
1091 << " Random seed = " << blaze::getSeed() << "\n"
1092 << " Left-hand side row-major sparse matrix type:\n"
1093 << " " << typeid( MT1 ).name() << "\n"
1094 << " Right-hand side row-major dense matrix type:\n"
1095 << " " << typeid( MT2 ).name() << "\n";
1096 throw std::runtime_error( oss.str() );
1097 }
1098 catch( std::out_of_range& ) {}
1099
1100
1101 //=====================================================================================
1102 // Testing the element access with a row-major matrix and a column-major matrix
1103 //=====================================================================================
1104
1105 if( lhs_.rows() > 0UL && lhs_.columns() > 0UL && orhs_.rows() && orhs_.columns() > 0UL )
1106 {
1107 const size_t m( lhs_.rows() * orhs_.rows() - 1UL );
1108 const size_t n( lhs_.columns() * orhs_.columns() - 1UL );
1109
1110 if( !equal( kron( lhs_, orhs_ )(m,n), kron( reflhs_, refrhs_ )(m,n) ) ||
1111 !equal( kron( lhs_, orhs_ ).at(m,n), kron( reflhs_, refrhs_ ).at(m,n) ) ) {
1112 std::ostringstream oss;
1113 oss << " Test : Element access of Kronecker product expression\n"
1114 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1115 << " Details:\n"
1116 << " Random seed = " << blaze::getSeed() << "\n"
1117 << " Left-hand side row-major sparse matrix type:\n"
1118 << " " << typeid( MT1 ).name() << "\n"
1119 << " Right-hand side column-major dense matrix type:\n"
1120 << " " << typeid( OMT2 ).name() << "\n";
1121 throw std::runtime_error( oss.str() );
1122 }
1123
1124 if( !equal( kron( lhs_, eval( orhs_ ) )(m,n), kron( reflhs_, eval( refrhs_ ) )(m,n) ) ||
1125 !equal( kron( lhs_, eval( orhs_ ) ).at(m,n), kron( reflhs_, eval( refrhs_ ) ).at(m,n) ) ) {
1126 std::ostringstream oss;
1127 oss << " Test : Element access of right evaluated Kronecker product expression\n"
1128 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1129 << " Details:\n"
1130 << " Random seed = " << blaze::getSeed() << "\n"
1131 << " Left-hand side row-major sparse matrix type:\n"
1132 << " " << typeid( MT1 ).name() << "\n"
1133 << " Right-hand side column-major dense matrix type:\n"
1134 << " " << typeid( OMT2 ).name() << "\n";
1135 throw std::runtime_error( oss.str() );
1136 }
1137
1138 if( !equal( kron( eval( lhs_ ), orhs_ )(m,n), kron( eval( reflhs_ ), refrhs_ )(m,n) ) ||
1139 !equal( kron( eval( lhs_ ), orhs_ ).at(m,n), kron( eval( reflhs_ ), refrhs_ ).at(m,n) ) ) {
1140 std::ostringstream oss;
1141 oss << " Test : Element access of left evaluated Kronecker product expression\n"
1142 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1143 << " Details:\n"
1144 << " Random seed = " << blaze::getSeed() << "\n"
1145 << " Left-hand side row-major sparse matrix type:\n"
1146 << " " << typeid( MT1 ).name() << "\n"
1147 << " Right-hand side column-major dense matrix type:\n"
1148 << " " << typeid( OMT2 ).name() << "\n";
1149 throw std::runtime_error( oss.str() );
1150 }
1151
1152 if( !equal( kron( eval( lhs_ ), eval( orhs_ ) )(m,n), kron( eval( reflhs_ ), eval( refrhs_ ) )(m,n) ) ||
1153 !equal( kron( eval( lhs_ ), eval( orhs_ ) ).at(m,n), kron( eval( reflhs_ ), eval( refrhs_ ) ).at(m,n) ) ) {
1154 std::ostringstream oss;
1155 oss << " Test : Element access of fully evaluated Kronecker product expression\n"
1156 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1157 << " Details:\n"
1158 << " Random seed = " << blaze::getSeed() << "\n"
1159 << " Left-hand side row-major sparse matrix type:\n"
1160 << " " << typeid( MT1 ).name() << "\n"
1161 << " Right-hand side column-major dense matrix type:\n"
1162 << " " << typeid( OMT2 ).name() << "\n";
1163 throw std::runtime_error( oss.str() );
1164 }
1165 }
1166
1167 try {
1168 kron( lhs_, orhs_ ).at( 0UL, lhs_.columns() * orhs_.columns() );
1169
1170 std::ostringstream oss;
1171 oss << " Test : Checked element access of Kronecker product expression\n"
1172 << " Error: Out-of-bound access succeeded\n"
1173 << " Details:\n"
1174 << " Random seed = " << blaze::getSeed() << "\n"
1175 << " Left-hand side row-major sparse matrix type:\n"
1176 << " " << typeid( MT1 ).name() << "\n"
1177 << " Right-hand side column-major dense matrix type:\n"
1178 << " " << typeid( OMT2 ).name() << "\n";
1179 throw std::runtime_error( oss.str() );
1180 }
1181 catch( std::out_of_range& ) {}
1182
1183 try {
1184 kron( lhs_, orhs_ ).at( lhs_.rows() * orhs_.rows(), 0UL );
1185
1186 std::ostringstream oss;
1187 oss << " Test : Checked element access of Kronecker product expression\n"
1188 << " Error: Out-of-bound access succeeded\n"
1189 << " Details:\n"
1190 << " Random seed = " << blaze::getSeed() << "\n"
1191 << " Left-hand side row-major sparse matrix type:\n"
1192 << " " << typeid( MT1 ).name() << "\n"
1193 << " Right-hand side column-major dense matrix type:\n"
1194 << " " << typeid( OMT2 ).name() << "\n";
1195 throw std::runtime_error( oss.str() );
1196 }
1197 catch( std::out_of_range& ) {}
1198
1199
1200 //=====================================================================================
1201 // Testing the element access with a column-major matrix and a row-major matrix
1202 //=====================================================================================
1203
1204 if( olhs_.rows() > 0UL && olhs_.columns() > 0UL && rhs_.rows() && rhs_.columns() > 0UL )
1205 {
1206 const size_t m( olhs_.rows() * rhs_.rows() - 1UL );
1207 const size_t n( olhs_.columns() * rhs_.columns() - 1UL );
1208
1209 if( !equal( kron( olhs_, rhs_ )(m,n), kron( reflhs_, refrhs_ )(m,n) ) ||
1210 !equal( kron( olhs_, rhs_ ).at(m,n), kron( reflhs_, refrhs_ ).at(m,n) ) ) {
1211 std::ostringstream oss;
1212 oss << " Test : Element access of Kronecker product expression\n"
1213 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1214 << " Details:\n"
1215 << " Random seed = " << blaze::getSeed() << "\n"
1216 << " Left-hand side column-major sparse matrix type:\n"
1217 << " " << typeid( OMT1 ).name() << "\n"
1218 << " Right-hand side row-major dense matrix type:\n"
1219 << " " << typeid( MT2 ).name() << "\n";
1220 throw std::runtime_error( oss.str() );
1221 }
1222
1223 if( !equal( kron( olhs_, eval( rhs_ ) )(m,n), kron( reflhs_, eval( refrhs_ ) )(m,n) ) ||
1224 !equal( kron( olhs_, eval( rhs_ ) ).at(m,n), kron( reflhs_, eval( refrhs_ ) ).at(m,n) ) ) {
1225 std::ostringstream oss;
1226 oss << " Test : Element access of right evaluated Kronecker product expression\n"
1227 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1228 << " Details:\n"
1229 << " Random seed = " << blaze::getSeed() << "\n"
1230 << " Left-hand side column-major sparse matrix type:\n"
1231 << " " << typeid( OMT1 ).name() << "\n"
1232 << " Right-hand side row-major dense matrix type:\n"
1233 << " " << typeid( MT2 ).name() << "\n";
1234 throw std::runtime_error( oss.str() );
1235 }
1236
1237 if( !equal( kron( eval( olhs_ ), rhs_ )(m,n), kron( eval( reflhs_ ), refrhs_ )(m,n) ) ||
1238 !equal( kron( eval( olhs_ ), rhs_ ).at(m,n), kron( eval( reflhs_ ), refrhs_ ).at(m,n) ) ) {
1239 std::ostringstream oss;
1240 oss << " Test : Element access of left evaluated Kronecker product expression\n"
1241 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1242 << " Details:\n"
1243 << " Random seed = " << blaze::getSeed() << "\n"
1244 << " Left-hand side column-major sparse matrix type:\n"
1245 << " " << typeid( OMT1 ).name() << "\n"
1246 << " Right-hand side row-major dense matrix type:\n"
1247 << " " << typeid( MT2 ).name() << "\n";
1248 throw std::runtime_error( oss.str() );
1249 }
1250
1251 if( !equal( kron( eval( olhs_ ), eval( rhs_ ) )(m,n), kron( eval( reflhs_ ), eval( refrhs_ ) )(m,n) ) ||
1252 !equal( kron( eval( olhs_ ), eval( rhs_ ) ).at(m,n), kron( eval( reflhs_ ), eval( refrhs_ ) ).at(m,n) ) ) {
1253 std::ostringstream oss;
1254 oss << " Test : Element access of fully evaluated Kronecker product expression\n"
1255 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1256 << " Details:\n"
1257 << " Random seed = " << blaze::getSeed() << "\n"
1258 << " Left-hand side column-major sparse matrix type:\n"
1259 << " " << typeid( OMT1 ).name() << "\n"
1260 << " Right-hand side row-major dense matrix type:\n"
1261 << " " << typeid( MT2 ).name() << "\n";
1262 throw std::runtime_error( oss.str() );
1263 }
1264 }
1265
1266 try {
1267 kron( olhs_, rhs_ ).at( 0UL, olhs_.columns() * rhs_.columns() );
1268
1269 std::ostringstream oss;
1270 oss << " Test : Checked element access of Kronecker product expression\n"
1271 << " Error: Out-of-bound access succeeded\n"
1272 << " Details:\n"
1273 << " Random seed = " << blaze::getSeed() << "\n"
1274 << " Left-hand side column-major sparse matrix type:\n"
1275 << " " << typeid( OMT1 ).name() << "\n"
1276 << " Right-hand side row-major dense matrix type:\n"
1277 << " " << typeid( MT2 ).name() << "\n";
1278 throw std::runtime_error( oss.str() );
1279 }
1280 catch( std::out_of_range& ) {}
1281
1282 try {
1283 kron( olhs_, rhs_ ).at( olhs_.rows() * rhs_.rows(), 0UL );
1284
1285 std::ostringstream oss;
1286 oss << " Test : Checked element access of Kronecker product expression\n"
1287 << " Error: Out-of-bound access succeeded\n"
1288 << " Details:\n"
1289 << " Random seed = " << blaze::getSeed() << "\n"
1290 << " Left-hand side column-major sparse matrix type:\n"
1291 << " " << typeid( OMT1 ).name() << "\n"
1292 << " Right-hand side row-major dense matrix type:\n"
1293 << " " << typeid( MT2 ).name() << "\n";
1294 throw std::runtime_error( oss.str() );
1295 }
1296 catch( std::out_of_range& ) {}
1297
1298
1299 //=====================================================================================
1300 // Testing the element access with two column-major matrices
1301 //=====================================================================================
1302
1303 if( olhs_.rows() > 0UL && olhs_.columns() > 0UL && orhs_.rows() && orhs_.columns() > 0UL )
1304 {
1305 const size_t m( olhs_.rows() * orhs_.rows() - 1UL );
1306 const size_t n( olhs_.columns() * orhs_.columns() - 1UL );
1307
1308 if( !equal( kron( olhs_, orhs_ )(m,n), kron( reflhs_, refrhs_ )(m,n) ) ||
1309 !equal( kron( olhs_, orhs_ ).at(m,n), kron( reflhs_, refrhs_ ).at(m,n) ) ) {
1310 std::ostringstream oss;
1311 oss << " Test : Element access of Kronecker product expression\n"
1312 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1313 << " Details:\n"
1314 << " Random seed = " << blaze::getSeed() << "\n"
1315 << " Left-hand side column-major sparse matrix type:\n"
1316 << " " << typeid( OMT1 ).name() << "\n"
1317 << " Right-hand side column-major dense matrix type:\n"
1318 << " " << typeid( OMT2 ).name() << "\n";
1319 throw std::runtime_error( oss.str() );
1320 }
1321
1322 if( !equal( kron( olhs_, eval( orhs_ ) )(m,n), kron( reflhs_, eval( refrhs_ ) )(m,n) ) ||
1323 !equal( kron( olhs_, eval( orhs_ ) ).at(m,n), kron( reflhs_, eval( refrhs_ ) ).at(m,n) ) ) {
1324 std::ostringstream oss;
1325 oss << " Test : Element access of right evaluated Kronecker product expression\n"
1326 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1327 << " Details:\n"
1328 << " Random seed = " << blaze::getSeed() << "\n"
1329 << " Left-hand side column-major sparse matrix type:\n"
1330 << " " << typeid( OMT1 ).name() << "\n"
1331 << " Right-hand side column-major dense matrix type:\n"
1332 << " " << typeid( OMT2 ).name() << "\n";
1333 throw std::runtime_error( oss.str() );
1334 }
1335
1336 if( !equal( kron( eval( olhs_ ), orhs_ )(m,n), kron( eval( reflhs_ ), refrhs_ )(m,n) ) ||
1337 !equal( kron( eval( olhs_ ), orhs_ ).at(m,n), kron( eval( reflhs_ ), refrhs_ ).at(m,n) ) ) {
1338 std::ostringstream oss;
1339 oss << " Test : Element access of left evaluated Kronecker product expression\n"
1340 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1341 << " Details:\n"
1342 << " Random seed = " << blaze::getSeed() << "\n"
1343 << " Left-hand side column-major sparse matrix type:\n"
1344 << " " << typeid( OMT1 ).name() << "\n"
1345 << " Right-hand side column-major dense matrix type:\n"
1346 << " " << typeid( OMT2 ).name() << "\n";
1347 throw std::runtime_error( oss.str() );
1348 }
1349
1350 if( !equal( kron( eval( olhs_ ), eval( orhs_ ) )(m,n), kron( eval( reflhs_ ), eval( refrhs_ ) )(m,n) ) ||
1351 !equal( kron( eval( olhs_ ), eval( orhs_ ) ).at(m,n), kron( eval( reflhs_ ), eval( refrhs_ ) ).at(m,n) ) ) {
1352 std::ostringstream oss;
1353 oss << " Test : Element access of fully evaluated Kronecker product expression\n"
1354 << " Error: Unequal resulting elements at element (" << m << "," << n << ") detected\n"
1355 << " Details:\n"
1356 << " Random seed = " << blaze::getSeed() << "\n"
1357 << " Left-hand side column-major sparse matrix type:\n"
1358 << " " << typeid( OMT1 ).name() << "\n"
1359 << " Right-hand side column-major dense matrix type:\n"
1360 << " " << typeid( OMT2 ).name() << "\n";
1361 throw std::runtime_error( oss.str() );
1362 }
1363 }
1364
1365 try {
1366 kron( olhs_, orhs_ ).at( 0UL, olhs_.columns() * orhs_.columns() );
1367
1368 std::ostringstream oss;
1369 oss << " Test : Checked element access of Kronecker product expression\n"
1370 << " Error: Out-of-bound access succeeded\n"
1371 << " Details:\n"
1372 << " Random seed = " << blaze::getSeed() << "\n"
1373 << " Left-hand side column-major sparse matrix type:\n"
1374 << " " << typeid( OMT1 ).name() << "\n"
1375 << " Right-hand side column-major dense matrix type:\n"
1376 << " " << typeid( OMT2 ).name() << "\n";
1377 throw std::runtime_error( oss.str() );
1378 }
1379 catch( std::out_of_range& ) {}
1380
1381 try {
1382 kron( olhs_, orhs_ ).at( olhs_.rows() * orhs_.rows(), 0UL );
1383
1384 std::ostringstream oss;
1385 oss << " Test : Checked element access of Kronecker product expression\n"
1386 << " Error: Out-of-bound access succeeded\n"
1387 << " Details:\n"
1388 << " Random seed = " << blaze::getSeed() << "\n"
1389 << " Left-hand side column-major sparse matrix type:\n"
1390 << " " << typeid( OMT1 ).name() << "\n"
1391 << " Right-hand side column-major dense matrix type:\n"
1392 << " " << typeid( OMT2 ).name() << "\n";
1393 throw std::runtime_error( oss.str() );
1394 }
1395 catch( std::out_of_range& ) {}
1396 }
1397 //*************************************************************************************************
1398
1399
1400 //*************************************************************************************************
1401 /*!\brief Testing the plain sparse matrix/dense matrix Kronecker product.
1402 //
1403 // \return void
1404 // \exception std::runtime_error Kronecker product error detected.
1405 //
1406 // This function tests the plain matrix Kronecker product with plain assignment, addition
1407 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
1408 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
1409 // exception is thrown.
1410 */
1411 template< typename MT1 // Type of the left-hand side sparse matrix
1412 , typename MT2 > // Type of the right-hand side dense matrix
testBasicOperation()1413 void OperationTest<MT1,MT2>::testBasicOperation()
1414 {
1415 #if BLAZETEST_MATHTEST_TEST_BASIC_OPERATION
1416 if( BLAZETEST_MATHTEST_TEST_BASIC_OPERATION > 1 )
1417 {
1418 //=====================================================================================
1419 // Kronecker product
1420 //=====================================================================================
1421
1422 // Kronecker product with the given matrices
1423 {
1424 test_ = "Kronecker product with the given matrices";
1425 error_ = "Failed Kronecker product operation";
1426
1427 try {
1428 initResults();
1429 dres_ = kron( lhs_, rhs_ );
1430 odres_ = kron( lhs_, rhs_ );
1431 sres_ = kron( lhs_, rhs_ );
1432 osres_ = kron( lhs_, rhs_ );
1433 refres_ = kron( reflhs_, refrhs_ );
1434 }
1435 catch( std::exception& ex ) {
1436 convertException<MT1,MT2>( ex );
1437 }
1438
1439 checkResults<MT1,MT2>();
1440
1441 try {
1442 initResults();
1443 dres_ = kron( lhs_, orhs_ );
1444 odres_ = kron( lhs_, orhs_ );
1445 sres_ = kron( lhs_, orhs_ );
1446 osres_ = kron( lhs_, orhs_ );
1447 refres_ = kron( reflhs_, refrhs_ );
1448 }
1449 catch( std::exception& ex ) {
1450 convertException<MT1,OMT2>( ex );
1451 }
1452
1453 checkResults<MT1,OMT2>();
1454
1455 try {
1456 initResults();
1457 dres_ = kron( olhs_, rhs_ );
1458 odres_ = kron( olhs_, rhs_ );
1459 sres_ = kron( olhs_, rhs_ );
1460 osres_ = kron( olhs_, rhs_ );
1461 refres_ = kron( reflhs_, refrhs_ );
1462 }
1463 catch( std::exception& ex ) {
1464 convertException<OMT1,MT2>( ex );
1465 }
1466
1467 checkResults<OMT1,MT2>();
1468
1469 try {
1470 initResults();
1471 dres_ = kron( olhs_, orhs_ );
1472 odres_ = kron( olhs_, orhs_ );
1473 sres_ = kron( olhs_, orhs_ );
1474 osres_ = kron( olhs_, orhs_ );
1475 refres_ = kron( reflhs_, refrhs_ );
1476 }
1477 catch( std::exception& ex ) {
1478 convertException<OMT1,OMT2>( ex );
1479 }
1480
1481 checkResults<OMT1,OMT2>();
1482 }
1483
1484 // Kronecker product with evaluated matrices
1485 {
1486 test_ = "Kronecker product with evaluated matrices";
1487 error_ = "Failed Kronecker product operation";
1488
1489 try {
1490 initResults();
1491 dres_ = kron( eval( lhs_ ), eval( rhs_ ) );
1492 odres_ = kron( eval( lhs_ ), eval( rhs_ ) );
1493 sres_ = kron( eval( lhs_ ), eval( rhs_ ) );
1494 osres_ = kron( eval( lhs_ ), eval( rhs_ ) );
1495 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) );
1496 }
1497 catch( std::exception& ex ) {
1498 convertException<MT1,MT2>( ex );
1499 }
1500
1501 checkResults<MT1,MT2>();
1502
1503 try {
1504 initResults();
1505 dres_ = kron( eval( lhs_ ), eval( orhs_ ) );
1506 odres_ = kron( eval( lhs_ ), eval( orhs_ ) );
1507 sres_ = kron( eval( lhs_ ), eval( orhs_ ) );
1508 osres_ = kron( eval( lhs_ ), eval( orhs_ ) );
1509 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) );
1510 }
1511 catch( std::exception& ex ) {
1512 convertException<MT1,OMT2>( ex );
1513 }
1514
1515 checkResults<MT1,OMT2>();
1516
1517 try {
1518 initResults();
1519 dres_ = kron( eval( olhs_ ), eval( rhs_ ) );
1520 odres_ = kron( eval( olhs_ ), eval( rhs_ ) );
1521 sres_ = kron( eval( olhs_ ), eval( rhs_ ) );
1522 osres_ = kron( eval( olhs_ ), eval( rhs_ ) );
1523 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) );
1524 }
1525 catch( std::exception& ex ) {
1526 convertException<OMT1,MT2>( ex );
1527 }
1528
1529 checkResults<OMT1,MT2>();
1530
1531 try {
1532 initResults();
1533 dres_ = kron( eval( olhs_ ), eval( orhs_ ) );
1534 odres_ = kron( eval( olhs_ ), eval( orhs_ ) );
1535 sres_ = kron( eval( olhs_ ), eval( orhs_ ) );
1536 osres_ = kron( eval( olhs_ ), eval( orhs_ ) );
1537 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) );
1538 }
1539 catch( std::exception& ex ) {
1540 convertException<OMT1,OMT2>( ex );
1541 }
1542
1543 checkResults<OMT1,OMT2>();
1544 }
1545
1546
1547 //=====================================================================================
1548 // Kronecker product with addition assignment
1549 //=====================================================================================
1550
1551 // Kronecker product with addition assignment with the given matrices
1552 {
1553 test_ = "Kronecker product with addition assignment with the given matrices";
1554 error_ = "Failed addition assignment operation";
1555
1556 try {
1557 initResults();
1558 dres_ += kron( lhs_, rhs_ );
1559 odres_ += kron( lhs_, rhs_ );
1560 sres_ += kron( lhs_, rhs_ );
1561 osres_ += kron( lhs_, rhs_ );
1562 refres_ += kron( reflhs_, refrhs_ );
1563 }
1564 catch( std::exception& ex ) {
1565 convertException<MT1,MT2>( ex );
1566 }
1567
1568 checkResults<MT1,MT2>();
1569
1570 try {
1571 initResults();
1572 dres_ += kron( lhs_, orhs_ );
1573 odres_ += kron( lhs_, orhs_ );
1574 sres_ += kron( lhs_, orhs_ );
1575 osres_ += kron( lhs_, orhs_ );
1576 refres_ += kron( reflhs_, refrhs_ );
1577 }
1578 catch( std::exception& ex ) {
1579 convertException<MT1,OMT2>( ex );
1580 }
1581
1582 checkResults<MT1,OMT2>();
1583
1584 try {
1585 initResults();
1586 dres_ += kron( olhs_, rhs_ );
1587 odres_ += kron( olhs_, rhs_ );
1588 sres_ += kron( olhs_, rhs_ );
1589 osres_ += kron( olhs_, rhs_ );
1590 refres_ += kron( reflhs_, refrhs_ );
1591 }
1592 catch( std::exception& ex ) {
1593 convertException<OMT1,MT2>( ex );
1594 }
1595
1596 checkResults<OMT1,MT2>();
1597
1598 try {
1599 initResults();
1600 dres_ += kron( olhs_, orhs_ );
1601 odres_ += kron( olhs_, orhs_ );
1602 sres_ += kron( olhs_, orhs_ );
1603 osres_ += kron( olhs_, orhs_ );
1604 refres_ += kron( reflhs_, refrhs_ );
1605 }
1606 catch( std::exception& ex ) {
1607 convertException<OMT1,OMT2>( ex );
1608 }
1609
1610 checkResults<OMT1,OMT2>();
1611 }
1612
1613 // Kronecker product with addition assignment with evaluated matrices
1614 {
1615 test_ = "Kronecker product with addition assignment with evaluated matrices";
1616 error_ = "Failed addition assignment operation";
1617
1618 try {
1619 initResults();
1620 dres_ += kron( eval( lhs_ ), eval( rhs_ ) );
1621 odres_ += kron( eval( lhs_ ), eval( rhs_ ) );
1622 sres_ += kron( eval( lhs_ ), eval( rhs_ ) );
1623 osres_ += kron( eval( lhs_ ), eval( rhs_ ) );
1624 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) );
1625 }
1626 catch( std::exception& ex ) {
1627 convertException<MT1,MT2>( ex );
1628 }
1629
1630 checkResults<MT1,MT2>();
1631
1632 try {
1633 initResults();
1634 dres_ += kron( eval( lhs_ ), eval( orhs_ ) );
1635 odres_ += kron( eval( lhs_ ), eval( orhs_ ) );
1636 sres_ += kron( eval( lhs_ ), eval( orhs_ ) );
1637 osres_ += kron( eval( lhs_ ), eval( orhs_ ) );
1638 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) );
1639 }
1640 catch( std::exception& ex ) {
1641 convertException<MT1,OMT2>( ex );
1642 }
1643
1644 checkResults<MT1,OMT2>();
1645
1646 try {
1647 initResults();
1648 dres_ += kron( eval( olhs_ ), eval( rhs_ ) );
1649 odres_ += kron( eval( olhs_ ), eval( rhs_ ) );
1650 sres_ += kron( eval( olhs_ ), eval( rhs_ ) );
1651 osres_ += kron( eval( olhs_ ), eval( rhs_ ) );
1652 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) );
1653 }
1654 catch( std::exception& ex ) {
1655 convertException<OMT1,MT2>( ex );
1656 }
1657
1658 checkResults<OMT1,MT2>();
1659
1660 try {
1661 initResults();
1662 dres_ += kron( eval( olhs_ ), eval( orhs_ ) );
1663 odres_ += kron( eval( olhs_ ), eval( orhs_ ) );
1664 sres_ += kron( eval( olhs_ ), eval( orhs_ ) );
1665 osres_ += kron( eval( olhs_ ), eval( orhs_ ) );
1666 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) );
1667 }
1668 catch( std::exception& ex ) {
1669 convertException<OMT1,OMT2>( ex );
1670 }
1671
1672 checkResults<OMT1,OMT2>();
1673 }
1674
1675
1676 //=====================================================================================
1677 // Kronecker product with subtraction assignment with the given matrices
1678 //=====================================================================================
1679
1680 // Kronecker product with subtraction assignment with the given matrices
1681 {
1682 test_ = "Kronecker product with subtraction assignment with the given matrices";
1683 error_ = "Failed subtraction assignment operation";
1684
1685 try {
1686 initResults();
1687 dres_ -= kron( lhs_, rhs_ );
1688 odres_ -= kron( lhs_, rhs_ );
1689 sres_ -= kron( lhs_, rhs_ );
1690 osres_ -= kron( lhs_, rhs_ );
1691 refres_ -= kron( reflhs_, refrhs_ );
1692 }
1693 catch( std::exception& ex ) {
1694 convertException<MT1,MT2>( ex );
1695 }
1696
1697 checkResults<MT1,MT2>();
1698
1699 try {
1700 initResults();
1701 dres_ -= kron( lhs_, orhs_ );
1702 odres_ -= kron( lhs_, orhs_ );
1703 sres_ -= kron( lhs_, orhs_ );
1704 osres_ -= kron( lhs_, orhs_ );
1705 refres_ -= kron( reflhs_, refrhs_ );
1706 }
1707 catch( std::exception& ex ) {
1708 convertException<MT1,OMT2>( ex );
1709 }
1710
1711 checkResults<MT1,OMT2>();
1712
1713 try {
1714 initResults();
1715 dres_ -= kron( olhs_, rhs_ );
1716 odres_ -= kron( olhs_, rhs_ );
1717 sres_ -= kron( olhs_, rhs_ );
1718 osres_ -= kron( olhs_, rhs_ );
1719 refres_ -= kron( reflhs_, refrhs_ );
1720 }
1721 catch( std::exception& ex ) {
1722 convertException<OMT1,MT2>( ex );
1723 }
1724
1725 checkResults<OMT1,MT2>();
1726
1727 try {
1728 initResults();
1729 dres_ -= kron( olhs_, orhs_ );
1730 odres_ -= kron( olhs_, orhs_ );
1731 sres_ -= kron( olhs_, orhs_ );
1732 osres_ -= kron( olhs_, orhs_ );
1733 refres_ -= kron( reflhs_, refrhs_ );
1734 }
1735 catch( std::exception& ex ) {
1736 convertException<OMT1,OMT2>( ex );
1737 }
1738
1739 checkResults<OMT1,OMT2>();
1740 }
1741
1742 // Kronecker product with subtraction assignment with evaluated matrices
1743 {
1744 test_ = "Kronecker product with subtraction assignment with evaluated matrices";
1745 error_ = "Failed subtraction assignment operation";
1746
1747 try {
1748 initResults();
1749 dres_ -= kron( eval( lhs_ ), eval( rhs_ ) );
1750 odres_ -= kron( eval( lhs_ ), eval( rhs_ ) );
1751 sres_ -= kron( eval( lhs_ ), eval( rhs_ ) );
1752 osres_ -= kron( eval( lhs_ ), eval( rhs_ ) );
1753 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) );
1754 }
1755 catch( std::exception& ex ) {
1756 convertException<MT1,MT2>( ex );
1757 }
1758
1759 checkResults<MT1,MT2>();
1760
1761 try {
1762 initResults();
1763 dres_ -= kron( eval( lhs_ ), eval( orhs_ ) );
1764 odres_ -= kron( eval( lhs_ ), eval( orhs_ ) );
1765 sres_ -= kron( eval( lhs_ ), eval( orhs_ ) );
1766 osres_ -= kron( eval( lhs_ ), eval( orhs_ ) );
1767 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) );
1768 }
1769 catch( std::exception& ex ) {
1770 convertException<MT1,OMT2>( ex );
1771 }
1772
1773 checkResults<MT1,OMT2>();
1774
1775 try {
1776 initResults();
1777 dres_ -= kron( eval( olhs_ ), eval( rhs_ ) );
1778 odres_ -= kron( eval( olhs_ ), eval( rhs_ ) );
1779 sres_ -= kron( eval( olhs_ ), eval( rhs_ ) );
1780 osres_ -= kron( eval( olhs_ ), eval( rhs_ ) );
1781 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) );
1782 }
1783 catch( std::exception& ex ) {
1784 convertException<OMT1,MT2>( ex );
1785 }
1786
1787 checkResults<OMT1,MT2>();
1788
1789 try {
1790 initResults();
1791 dres_ -= kron( eval( olhs_ ), eval( orhs_ ) );
1792 odres_ -= kron( eval( olhs_ ), eval( orhs_ ) );
1793 sres_ -= kron( eval( olhs_ ), eval( orhs_ ) );
1794 osres_ -= kron( eval( olhs_ ), eval( orhs_ ) );
1795 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) );
1796 }
1797 catch( std::exception& ex ) {
1798 convertException<OMT1,OMT2>( ex );
1799 }
1800
1801 checkResults<OMT1,OMT2>();
1802 }
1803
1804
1805 //=====================================================================================
1806 // Kronecker product with Schur product assignment
1807 //=====================================================================================
1808
1809 // Kronecker product with Schur product assignment with the given matrices
1810 {
1811 test_ = "Kronecker product with Schur product assignment with the given matrices";
1812 error_ = "Failed Schur product assignment operation";
1813
1814 try {
1815 initResults();
1816 dres_ %= kron( lhs_, rhs_ );
1817 odres_ %= kron( lhs_, rhs_ );
1818 sres_ %= kron( lhs_, rhs_ );
1819 osres_ %= kron( lhs_, rhs_ );
1820 refres_ %= kron( reflhs_, refrhs_ );
1821 }
1822 catch( std::exception& ex ) {
1823 convertException<MT1,MT2>( ex );
1824 }
1825
1826 checkResults<MT1,MT2>();
1827
1828 try {
1829 initResults();
1830 dres_ %= kron( lhs_, orhs_ );
1831 odres_ %= kron( lhs_, orhs_ );
1832 sres_ %= kron( lhs_, orhs_ );
1833 osres_ %= kron( lhs_, orhs_ );
1834 refres_ %= kron( reflhs_, refrhs_ );
1835 }
1836 catch( std::exception& ex ) {
1837 convertException<MT1,OMT2>( ex );
1838 }
1839
1840 checkResults<MT1,OMT2>();
1841
1842 try {
1843 initResults();
1844 dres_ %= kron( olhs_, rhs_ );
1845 odres_ %= kron( olhs_, rhs_ );
1846 sres_ %= kron( olhs_, rhs_ );
1847 osres_ %= kron( olhs_, rhs_ );
1848 refres_ %= kron( reflhs_, refrhs_ );
1849 }
1850 catch( std::exception& ex ) {
1851 convertException<OMT1,MT2>( ex );
1852 }
1853
1854 checkResults<OMT1,MT2>();
1855
1856 try {
1857 initResults();
1858 dres_ %= kron( olhs_, orhs_ );
1859 odres_ %= kron( olhs_, orhs_ );
1860 sres_ %= kron( olhs_, orhs_ );
1861 osres_ %= kron( olhs_, orhs_ );
1862 refres_ %= kron( reflhs_, refrhs_ );
1863 }
1864 catch( std::exception& ex ) {
1865 convertException<OMT1,OMT2>( ex );
1866 }
1867
1868 checkResults<OMT1,OMT2>();
1869 }
1870
1871 // Kronecker product with Schur product assignment with evaluated matrices
1872 {
1873 test_ = "Kronecker product with Schur product assignment with evaluated matrices";
1874 error_ = "Failed Schur product assignment operation";
1875
1876 try {
1877 initResults();
1878 dres_ %= kron( eval( lhs_ ), eval( rhs_ ) );
1879 odres_ %= kron( eval( lhs_ ), eval( rhs_ ) );
1880 sres_ %= kron( eval( lhs_ ), eval( rhs_ ) );
1881 osres_ %= kron( eval( lhs_ ), eval( rhs_ ) );
1882 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) );
1883 }
1884 catch( std::exception& ex ) {
1885 convertException<MT1,MT2>( ex );
1886 }
1887
1888 checkResults<MT1,MT2>();
1889
1890 try {
1891 initResults();
1892 dres_ %= kron( eval( lhs_ ), eval( orhs_ ) );
1893 odres_ %= kron( eval( lhs_ ), eval( orhs_ ) );
1894 sres_ %= kron( eval( lhs_ ), eval( orhs_ ) );
1895 osres_ %= kron( eval( lhs_ ), eval( orhs_ ) );
1896 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) );
1897 }
1898 catch( std::exception& ex ) {
1899 convertException<MT1,OMT2>( ex );
1900 }
1901
1902 checkResults<MT1,OMT2>();
1903
1904 try {
1905 initResults();
1906 dres_ %= kron( eval( olhs_ ), eval( rhs_ ) );
1907 odres_ %= kron( eval( olhs_ ), eval( rhs_ ) );
1908 sres_ %= kron( eval( olhs_ ), eval( rhs_ ) );
1909 osres_ %= kron( eval( olhs_ ), eval( rhs_ ) );
1910 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) );
1911 }
1912 catch( std::exception& ex ) {
1913 convertException<OMT1,MT2>( ex );
1914 }
1915
1916 checkResults<OMT1,MT2>();
1917
1918 try {
1919 initResults();
1920 dres_ %= kron( eval( olhs_ ), eval( orhs_ ) );
1921 odres_ %= kron( eval( olhs_ ), eval( orhs_ ) );
1922 sres_ %= kron( eval( olhs_ ), eval( orhs_ ) );
1923 osres_ %= kron( eval( olhs_ ), eval( orhs_ ) );
1924 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) );
1925 }
1926 catch( std::exception& ex ) {
1927 convertException<OMT1,OMT2>( ex );
1928 }
1929
1930 checkResults<OMT1,OMT2>();
1931 }
1932 }
1933 #endif
1934 }
1935 //*************************************************************************************************
1936
1937
1938 //*************************************************************************************************
1939 /*!\brief Testing the negated sparse matrix/dense matrix Kronecker product.
1940 //
1941 // \return void
1942 // \exception std::runtime_error Kronecker product error detected.
1943 //
1944 // This function tests the negated matrix Kronecker product with plain assignment, addition
1945 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
1946 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
1947 // exception is thrown.
1948 */
1949 template< typename MT1 // Type of the left-hand side sparse matrix
1950 , typename MT2 > // Type of the right-hand side dense matrix
testNegatedOperation()1951 void OperationTest<MT1,MT2>::testNegatedOperation()
1952 {
1953 #if BLAZETEST_MATHTEST_TEST_NEGATED_OPERATION
1954 if( BLAZETEST_MATHTEST_TEST_NEGATED_OPERATION > 1 )
1955 {
1956 //=====================================================================================
1957 // Negated Kronecker product
1958 //=====================================================================================
1959
1960 // Negated Kronecker product with the given matrices
1961 {
1962 test_ = "Negated Kronecker product with the given matrices";
1963 error_ = "Failed Kronecker product operation";
1964
1965 try {
1966 initResults();
1967 dres_ = -kron( lhs_, rhs_ );
1968 odres_ = -kron( lhs_, rhs_ );
1969 sres_ = -kron( lhs_, rhs_ );
1970 osres_ = -kron( lhs_, rhs_ );
1971 refres_ = -kron( reflhs_, refrhs_ );
1972 }
1973 catch( std::exception& ex ) {
1974 convertException<MT1,MT2>( ex );
1975 }
1976
1977 checkResults<MT1,MT2>();
1978
1979 try {
1980 initResults();
1981 dres_ = -kron( lhs_, orhs_ );
1982 odres_ = -kron( lhs_, orhs_ );
1983 sres_ = -kron( lhs_, orhs_ );
1984 osres_ = -kron( lhs_, orhs_ );
1985 refres_ = -kron( reflhs_, refrhs_ );
1986 }
1987 catch( std::exception& ex ) {
1988 convertException<MT1,OMT2>( ex );
1989 }
1990
1991 checkResults<MT1,OMT2>();
1992
1993 try {
1994 initResults();
1995 dres_ = -kron( olhs_, rhs_ );
1996 odres_ = -kron( olhs_, rhs_ );
1997 sres_ = -kron( olhs_, rhs_ );
1998 osres_ = -kron( olhs_, rhs_ );
1999 refres_ = -kron( reflhs_, refrhs_ );
2000 }
2001 catch( std::exception& ex ) {
2002 convertException<OMT1,MT2>( ex );
2003 }
2004
2005 checkResults<OMT1,MT2>();
2006
2007 try {
2008 initResults();
2009 dres_ = -kron( olhs_, orhs_ );
2010 odres_ = -kron( olhs_, orhs_ );
2011 sres_ = -kron( olhs_, orhs_ );
2012 osres_ = -kron( olhs_, orhs_ );
2013 refres_ = -kron( reflhs_, refrhs_ );
2014 }
2015 catch( std::exception& ex ) {
2016 convertException<OMT1,OMT2>( ex );
2017 }
2018
2019 checkResults<OMT1,OMT2>();
2020 }
2021
2022 // Negated Kronecker product with evaluated matrices
2023 {
2024 test_ = "Negated Kronecker product with evaluated matrices";
2025 error_ = "Failed Kronecker product operation";
2026
2027 try {
2028 initResults();
2029 dres_ = -kron( eval( lhs_ ), eval( rhs_ ) );
2030 odres_ = -kron( eval( lhs_ ), eval( rhs_ ) );
2031 sres_ = -kron( eval( lhs_ ), eval( rhs_ ) );
2032 osres_ = -kron( eval( lhs_ ), eval( rhs_ ) );
2033 refres_ = -kron( eval( reflhs_ ), eval( refrhs_ ) );
2034 }
2035 catch( std::exception& ex ) {
2036 convertException<MT1,MT2>( ex );
2037 }
2038
2039 checkResults<MT1,MT2>();
2040
2041 try {
2042 initResults();
2043 dres_ = -kron( eval( lhs_ ), eval( orhs_ ) );
2044 odres_ = -kron( eval( lhs_ ), eval( orhs_ ) );
2045 sres_ = -kron( eval( lhs_ ), eval( orhs_ ) );
2046 osres_ = -kron( eval( lhs_ ), eval( orhs_ ) );
2047 refres_ = -kron( eval( reflhs_ ), eval( refrhs_ ) );
2048 }
2049 catch( std::exception& ex ) {
2050 convertException<MT1,OMT2>( ex );
2051 }
2052
2053 checkResults<MT1,OMT2>();
2054
2055 try {
2056 initResults();
2057 dres_ = -kron( eval( olhs_ ), eval( rhs_ ) );
2058 odres_ = -kron( eval( olhs_ ), eval( rhs_ ) );
2059 sres_ = -kron( eval( olhs_ ), eval( rhs_ ) );
2060 osres_ = -kron( eval( olhs_ ), eval( rhs_ ) );
2061 refres_ = -kron( eval( reflhs_ ), eval( refrhs_ ) );
2062 }
2063 catch( std::exception& ex ) {
2064 convertException<OMT1,MT2>( ex );
2065 }
2066
2067 checkResults<OMT1,MT2>();
2068
2069 try {
2070 initResults();
2071 dres_ = -kron( eval( olhs_ ), eval( orhs_ ) );
2072 odres_ = -kron( eval( olhs_ ), eval( orhs_ ) );
2073 sres_ = -kron( eval( olhs_ ), eval( orhs_ ) );
2074 osres_ = -kron( eval( olhs_ ), eval( orhs_ ) );
2075 refres_ = -kron( eval( reflhs_ ), eval( refrhs_ ) );
2076 }
2077 catch( std::exception& ex ) {
2078 convertException<OMT1,OMT2>( ex );
2079 }
2080
2081 checkResults<OMT1,OMT2>();
2082 }
2083
2084
2085 //=====================================================================================
2086 // Negated Kronecker product with addition assignment
2087 //=====================================================================================
2088
2089 // Negated Kronecker product with addition assignment with the given matrices
2090 {
2091 test_ = "Negated Kronecker product with addition assignment with the given matrices";
2092 error_ = "Failed addition assignment operation";
2093
2094 try {
2095 initResults();
2096 dres_ += -kron( lhs_, rhs_ );
2097 odres_ += -kron( lhs_, rhs_ );
2098 sres_ += -kron( lhs_, rhs_ );
2099 osres_ += -kron( lhs_, rhs_ );
2100 refres_ += -kron( reflhs_, refrhs_ );
2101 }
2102 catch( std::exception& ex ) {
2103 convertException<MT1,MT2>( ex );
2104 }
2105
2106 checkResults<MT1,MT2>();
2107
2108 try {
2109 initResults();
2110 dres_ += -kron( lhs_, orhs_ );
2111 odres_ += -kron( lhs_, orhs_ );
2112 sres_ += -kron( lhs_, orhs_ );
2113 osres_ += -kron( lhs_, orhs_ );
2114 refres_ += -kron( reflhs_, refrhs_ );
2115 }
2116 catch( std::exception& ex ) {
2117 convertException<MT1,OMT2>( ex );
2118 }
2119
2120 checkResults<MT1,OMT2>();
2121
2122 try {
2123 initResults();
2124 dres_ += -kron( olhs_, rhs_ );
2125 odres_ += -kron( olhs_, rhs_ );
2126 sres_ += -kron( olhs_, rhs_ );
2127 osres_ += -kron( olhs_, rhs_ );
2128 refres_ += -kron( reflhs_, refrhs_ );
2129 }
2130 catch( std::exception& ex ) {
2131 convertException<OMT1,MT2>( ex );
2132 }
2133
2134 checkResults<OMT1,MT2>();
2135
2136 try {
2137 initResults();
2138 dres_ += -kron( olhs_, orhs_ );
2139 odres_ += -kron( olhs_, orhs_ );
2140 sres_ += -kron( olhs_, orhs_ );
2141 osres_ += -kron( olhs_, orhs_ );
2142 refres_ += -kron( reflhs_, refrhs_ );
2143 }
2144 catch( std::exception& ex ) {
2145 convertException<OMT1,OMT2>( ex );
2146 }
2147
2148 checkResults<OMT1,OMT2>();
2149 }
2150
2151 // Negated Kronecker product with addition assignment with the given matrices
2152 {
2153 test_ = "Negated Kronecker product with addition assignment with evaluated matrices";
2154 error_ = "Failed addition assignment operation";
2155
2156 try {
2157 initResults();
2158 dres_ += -kron( eval( lhs_ ), eval( rhs_ ) );
2159 odres_ += -kron( eval( lhs_ ), eval( rhs_ ) );
2160 sres_ += -kron( eval( lhs_ ), eval( rhs_ ) );
2161 osres_ += -kron( eval( lhs_ ), eval( rhs_ ) );
2162 refres_ += -kron( eval( reflhs_ ), eval( refrhs_ ) );
2163 }
2164 catch( std::exception& ex ) {
2165 convertException<MT1,MT2>( ex );
2166 }
2167
2168 checkResults<MT1,MT2>();
2169
2170 try {
2171 initResults();
2172 dres_ += -kron( eval( lhs_ ), eval( orhs_ ) );
2173 odres_ += -kron( eval( lhs_ ), eval( orhs_ ) );
2174 sres_ += -kron( eval( lhs_ ), eval( orhs_ ) );
2175 osres_ += -kron( eval( lhs_ ), eval( orhs_ ) );
2176 refres_ += -kron( eval( reflhs_ ), eval( refrhs_ ) );
2177 }
2178 catch( std::exception& ex ) {
2179 convertException<MT1,OMT2>( ex );
2180 }
2181
2182 checkResults<MT1,OMT2>();
2183
2184 try {
2185 initResults();
2186 dres_ += -kron( eval( olhs_ ), eval( rhs_ ) );
2187 odres_ += -kron( eval( olhs_ ), eval( rhs_ ) );
2188 sres_ += -kron( eval( olhs_ ), eval( rhs_ ) );
2189 osres_ += -kron( eval( olhs_ ), eval( rhs_ ) );
2190 refres_ += -kron( eval( reflhs_ ), eval( refrhs_ ) );
2191 }
2192 catch( std::exception& ex ) {
2193 convertException<OMT1,MT2>( ex );
2194 }
2195
2196 checkResults<OMT1,MT2>();
2197
2198 try {
2199 initResults();
2200 dres_ += -kron( eval( olhs_ ), eval( orhs_ ) );
2201 odres_ += -kron( eval( olhs_ ), eval( orhs_ ) );
2202 sres_ += -kron( eval( olhs_ ), eval( orhs_ ) );
2203 osres_ += -kron( eval( olhs_ ), eval( orhs_ ) );
2204 refres_ += -kron( eval( reflhs_ ), eval( refrhs_ ) );
2205 }
2206 catch( std::exception& ex ) {
2207 convertException<OMT1,OMT2>( ex );
2208 }
2209
2210 checkResults<OMT1,OMT2>();
2211 }
2212
2213
2214 //=====================================================================================
2215 // Negated Kronecker product with subtraction assignment
2216 //=====================================================================================
2217
2218 // Negated Kronecker product with subtraction assignment with the given matrices
2219 {
2220 test_ = "Negated Kronecker product with subtraction assignment with the given matrices";
2221 error_ = "Failed subtraction assignment operation";
2222
2223 try {
2224 initResults();
2225 dres_ -= -kron( lhs_, rhs_ );
2226 odres_ -= -kron( lhs_, rhs_ );
2227 sres_ -= -kron( lhs_, rhs_ );
2228 osres_ -= -kron( lhs_, rhs_ );
2229 refres_ -= -kron( reflhs_, refrhs_ );
2230 }
2231 catch( std::exception& ex ) {
2232 convertException<MT1,MT2>( ex );
2233 }
2234
2235 checkResults<MT1,MT2>();
2236
2237 try {
2238 initResults();
2239 dres_ -= -kron( lhs_, orhs_ );
2240 odres_ -= -kron( lhs_, orhs_ );
2241 sres_ -= -kron( lhs_, orhs_ );
2242 osres_ -= -kron( lhs_, orhs_ );
2243 refres_ -= -kron( reflhs_, refrhs_ );
2244 }
2245 catch( std::exception& ex ) {
2246 convertException<MT1,OMT2>( ex );
2247 }
2248
2249 checkResults<MT1,OMT2>();
2250
2251 try {
2252 initResults();
2253 dres_ -= -kron( olhs_, rhs_ );
2254 odres_ -= -kron( olhs_, rhs_ );
2255 sres_ -= -kron( olhs_, rhs_ );
2256 osres_ -= -kron( olhs_, rhs_ );
2257 refres_ -= -kron( reflhs_, refrhs_ );
2258 }
2259 catch( std::exception& ex ) {
2260 convertException<OMT1,MT2>( ex );
2261 }
2262
2263 checkResults<OMT1,MT2>();
2264
2265 try {
2266 initResults();
2267 dres_ -= -kron( olhs_, orhs_ );
2268 odres_ -= -kron( olhs_, orhs_ );
2269 sres_ -= -kron( olhs_, orhs_ );
2270 osres_ -= -kron( olhs_, orhs_ );
2271 refres_ -= -kron( reflhs_, refrhs_ );
2272 }
2273 catch( std::exception& ex ) {
2274 convertException<OMT1,OMT2>( ex );
2275 }
2276
2277 checkResults<OMT1,OMT2>();
2278 }
2279
2280 // Negated Kronecker product with subtraction assignment with evaluated matrices
2281 {
2282 test_ = "Negated Kronecker product with subtraction assignment with evaluated matrices";
2283 error_ = "Failed subtraction assignment operation";
2284
2285 try {
2286 initResults();
2287 dres_ -= -kron( eval( lhs_ ), eval( rhs_ ) );
2288 odres_ -= -kron( eval( lhs_ ), eval( rhs_ ) );
2289 sres_ -= -kron( eval( lhs_ ), eval( rhs_ ) );
2290 osres_ -= -kron( eval( lhs_ ), eval( rhs_ ) );
2291 refres_ -= -kron( eval( reflhs_ ), eval( refrhs_ ) );
2292 }
2293 catch( std::exception& ex ) {
2294 convertException<MT1,MT2>( ex );
2295 }
2296
2297 checkResults<MT1,MT2>();
2298
2299 try {
2300 initResults();
2301 dres_ -= -kron( eval( lhs_ ), eval( orhs_ ) );
2302 odres_ -= -kron( eval( lhs_ ), eval( orhs_ ) );
2303 sres_ -= -kron( eval( lhs_ ), eval( orhs_ ) );
2304 osres_ -= -kron( eval( lhs_ ), eval( orhs_ ) );
2305 refres_ -= -kron( eval( reflhs_ ), eval( refrhs_ ) );
2306 }
2307 catch( std::exception& ex ) {
2308 convertException<MT1,OMT2>( ex );
2309 }
2310
2311 checkResults<MT1,OMT2>();
2312
2313 try {
2314 initResults();
2315 dres_ -= -kron( eval( olhs_ ), eval( rhs_ ) );
2316 odres_ -= -kron( eval( olhs_ ), eval( rhs_ ) );
2317 sres_ -= -kron( eval( olhs_ ), eval( rhs_ ) );
2318 osres_ -= -kron( eval( olhs_ ), eval( rhs_ ) );
2319 refres_ -= -kron( eval( reflhs_ ), eval( refrhs_ ) );
2320 }
2321 catch( std::exception& ex ) {
2322 convertException<OMT1,MT2>( ex );
2323 }
2324
2325 checkResults<OMT1,MT2>();
2326
2327 try {
2328 initResults();
2329 dres_ -= -kron( eval( olhs_ ), eval( orhs_ ) );
2330 odres_ -= -kron( eval( olhs_ ), eval( orhs_ ) );
2331 sres_ -= -kron( eval( olhs_ ), eval( orhs_ ) );
2332 osres_ -= -kron( eval( olhs_ ), eval( orhs_ ) );
2333 refres_ -= -kron( eval( reflhs_ ), eval( refrhs_ ) );
2334 }
2335 catch( std::exception& ex ) {
2336 convertException<OMT1,OMT2>( ex );
2337 }
2338
2339 checkResults<OMT1,OMT2>();
2340 }
2341
2342
2343 //=====================================================================================
2344 // Negated Kronecker product with Schur product assignment
2345 //=====================================================================================
2346
2347 // Negated Kronecker product with Schur product assignment with the given matrices
2348 {
2349 test_ = "Negated Kronecker product with Schur product assignment with the given matrices";
2350 error_ = "Failed Schur product assignment operation";
2351
2352 try {
2353 initResults();
2354 dres_ %= -kron( lhs_, rhs_ );
2355 odres_ %= -kron( lhs_, rhs_ );
2356 sres_ %= -kron( lhs_, rhs_ );
2357 osres_ %= -kron( lhs_, rhs_ );
2358 refres_ %= -kron( reflhs_, refrhs_ );
2359 }
2360 catch( std::exception& ex ) {
2361 convertException<MT1,MT2>( ex );
2362 }
2363
2364 checkResults<MT1,MT2>();
2365
2366 try {
2367 initResults();
2368 dres_ %= -kron( lhs_, orhs_ );
2369 odres_ %= -kron( lhs_, orhs_ );
2370 sres_ %= -kron( lhs_, orhs_ );
2371 osres_ %= -kron( lhs_, orhs_ );
2372 refres_ %= -kron( reflhs_, refrhs_ );
2373 }
2374 catch( std::exception& ex ) {
2375 convertException<MT1,OMT2>( ex );
2376 }
2377
2378 checkResults<MT1,OMT2>();
2379
2380 try {
2381 initResults();
2382 dres_ %= -kron( olhs_, rhs_ );
2383 odres_ %= -kron( olhs_, rhs_ );
2384 sres_ %= -kron( olhs_, rhs_ );
2385 osres_ %= -kron( olhs_, rhs_ );
2386 refres_ %= -kron( reflhs_, refrhs_ );
2387 }
2388 catch( std::exception& ex ) {
2389 convertException<OMT1,MT2>( ex );
2390 }
2391
2392 checkResults<OMT1,MT2>();
2393
2394 try {
2395 initResults();
2396 dres_ %= -kron( olhs_, orhs_ );
2397 odres_ %= -kron( olhs_, orhs_ );
2398 sres_ %= -kron( olhs_, orhs_ );
2399 osres_ %= -kron( olhs_, orhs_ );
2400 refres_ %= -kron( reflhs_, refrhs_ );
2401 }
2402 catch( std::exception& ex ) {
2403 convertException<OMT1,OMT2>( ex );
2404 }
2405
2406 checkResults<OMT1,OMT2>();
2407 }
2408
2409 // Negated Kronecker product with Schur product assignment with the given matrices
2410 {
2411 test_ = "Negated Kronecker product with Schur product assignment with evaluated matrices";
2412 error_ = "Failed Schur product assignment operation";
2413
2414 try {
2415 initResults();
2416 dres_ %= -kron( eval( lhs_ ), eval( rhs_ ) );
2417 odres_ %= -kron( eval( lhs_ ), eval( rhs_ ) );
2418 sres_ %= -kron( eval( lhs_ ), eval( rhs_ ) );
2419 osres_ %= -kron( eval( lhs_ ), eval( rhs_ ) );
2420 refres_ %= -kron( eval( reflhs_ ), eval( refrhs_ ) );
2421 }
2422 catch( std::exception& ex ) {
2423 convertException<MT1,MT2>( ex );
2424 }
2425
2426 checkResults<MT1,MT2>();
2427
2428 try {
2429 initResults();
2430 dres_ %= -kron( eval( lhs_ ), eval( orhs_ ) );
2431 odres_ %= -kron( eval( lhs_ ), eval( orhs_ ) );
2432 sres_ %= -kron( eval( lhs_ ), eval( orhs_ ) );
2433 osres_ %= -kron( eval( lhs_ ), eval( orhs_ ) );
2434 refres_ %= -kron( eval( reflhs_ ), eval( refrhs_ ) );
2435 }
2436 catch( std::exception& ex ) {
2437 convertException<MT1,OMT2>( ex );
2438 }
2439
2440 checkResults<MT1,OMT2>();
2441
2442 try {
2443 initResults();
2444 dres_ %= -kron( eval( olhs_ ), eval( rhs_ ) );
2445 odres_ %= -kron( eval( olhs_ ), eval( rhs_ ) );
2446 sres_ %= -kron( eval( olhs_ ), eval( rhs_ ) );
2447 osres_ %= -kron( eval( olhs_ ), eval( rhs_ ) );
2448 refres_ %= -kron( eval( reflhs_ ), eval( refrhs_ ) );
2449 }
2450 catch( std::exception& ex ) {
2451 convertException<OMT1,MT2>( ex );
2452 }
2453
2454 checkResults<OMT1,MT2>();
2455
2456 try {
2457 initResults();
2458 dres_ %= -kron( eval( olhs_ ), eval( orhs_ ) );
2459 odres_ %= -kron( eval( olhs_ ), eval( orhs_ ) );
2460 sres_ %= -kron( eval( olhs_ ), eval( orhs_ ) );
2461 osres_ %= -kron( eval( olhs_ ), eval( orhs_ ) );
2462 refres_ %= -kron( eval( reflhs_ ), eval( refrhs_ ) );
2463 }
2464 catch( std::exception& ex ) {
2465 convertException<OMT1,OMT2>( ex );
2466 }
2467
2468 checkResults<OMT1,OMT2>();
2469 }
2470 }
2471 #endif
2472 }
2473 //*************************************************************************************************
2474
2475
2476 //*************************************************************************************************
2477 /*!\brief Testing the scaled sparse matrix/dense matrix Kronecker product.
2478 //
2479 // \param scalar The scalar value.
2480 // \return void
2481 // \exception std::runtime_error Kronecker product error detected.
2482 //
2483 // This function tests the scaled matrix Kronecker product with plain assignment, addition
2484 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
2485 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
2486 // exception is thrown.
2487 */
2488 template< typename MT1 // Type of the left-hand side sparse matrix
2489 , typename MT2 > // Type of the right-hand side dense matrix
2490 template< typename T > // Type of the scalar
testScaledOperation(T scalar)2491 void OperationTest<MT1,MT2>::testScaledOperation( T scalar )
2492 {
2493 BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE( T );
2494
2495 if( scalar == T(0) )
2496 throw std::invalid_argument( "Invalid scalar parameter" );
2497
2498
2499 #if BLAZETEST_MATHTEST_TEST_SCALED_OPERATION
2500 if( BLAZETEST_MATHTEST_TEST_SCALED_OPERATION > 1 )
2501 {
2502 //=====================================================================================
2503 // Self-scaling (M*=s)
2504 //=====================================================================================
2505
2506 // Self-scaling (M*=s)
2507 {
2508 test_ = "Self-scaling (M*=s)";
2509
2510 try {
2511 dres_ = kron( lhs_, rhs_ );
2512 odres_ = dres_;
2513 sres_ = dres_;
2514 osres_ = dres_;
2515 refres_ = dres_;
2516
2517 dres_ *= scalar;
2518 odres_ *= scalar;
2519 sres_ *= scalar;
2520 osres_ *= scalar;
2521 refres_ *= scalar;
2522 }
2523 catch( std::exception& ex ) {
2524 std::ostringstream oss;
2525 oss << " Test : " << test_ << "\n"
2526 << " Error: Failed self-scaling operation\n"
2527 << " Details:\n"
2528 << " Random seed = " << blaze::getSeed() << "\n"
2529 << " Scalar = " << scalar << "\n"
2530 << " Error message: " << ex.what() << "\n";
2531 throw std::runtime_error( oss.str() );
2532 }
2533
2534 checkResults<MT1,MT2>();
2535 }
2536
2537
2538 //=====================================================================================
2539 // Self-scaling (M=M*s)
2540 //=====================================================================================
2541
2542 // Self-scaling (M=M*s)
2543 {
2544 test_ = "Self-scaling (M=M*s)";
2545
2546 try {
2547 dres_ = kron( lhs_, rhs_ );
2548 odres_ = dres_;
2549 sres_ = dres_;
2550 osres_ = dres_;
2551 refres_ = dres_;
2552
2553 dres_ = dres_ * scalar;
2554 odres_ = odres_ * scalar;
2555 sres_ = sres_ * scalar;
2556 osres_ = osres_ * scalar;
2557 refres_ = refres_ * scalar;
2558 }
2559 catch( std::exception& ex ) {
2560 std::ostringstream oss;
2561 oss << " Test : " << test_ << "\n"
2562 << " Error: Failed self-scaling operation\n"
2563 << " Details:\n"
2564 << " Random seed = " << blaze::getSeed() << "\n"
2565 << " Scalar = " << scalar << "\n"
2566 << " Error message: " << ex.what() << "\n";
2567 throw std::runtime_error( oss.str() );
2568 }
2569
2570 checkResults<MT1,MT2>();
2571 }
2572
2573
2574 //=====================================================================================
2575 // Self-scaling (M=s*M)
2576 //=====================================================================================
2577
2578 // Self-scaling (M=s*M)
2579 {
2580 test_ = "Self-scaling (M=s*M)";
2581
2582 try {
2583 dres_ = kron( lhs_, rhs_ );
2584 odres_ = dres_;
2585 sres_ = dres_;
2586 osres_ = dres_;
2587 refres_ = dres_;
2588
2589 dres_ = scalar * dres_;
2590 odres_ = scalar * odres_;
2591 sres_ = scalar * sres_;
2592 osres_ = scalar * osres_;
2593 refres_ = scalar * refres_;
2594 }
2595 catch( std::exception& ex ) {
2596 std::ostringstream oss;
2597 oss << " Test : " << test_ << "\n"
2598 << " Error: Failed self-scaling operation\n"
2599 << " Details:\n"
2600 << " Random seed = " << blaze::getSeed() << "\n"
2601 << " Scalar = " << scalar << "\n"
2602 << " Error message: " << ex.what() << "\n";
2603 throw std::runtime_error( oss.str() );
2604 }
2605
2606 checkResults<MT1,MT2>();
2607 }
2608
2609
2610 //=====================================================================================
2611 // Self-scaling (M/=s)
2612 //=====================================================================================
2613
2614 // Self-scaling (M/=s)
2615 {
2616 test_ = "Self-scaling (M/=s)";
2617
2618 try {
2619 dres_ = kron( lhs_, rhs_ );
2620 odres_ = dres_;
2621 sres_ = dres_;
2622 osres_ = dres_;
2623 refres_ = dres_;
2624
2625 dres_ /= scalar;
2626 odres_ /= scalar;
2627 sres_ /= scalar;
2628 osres_ /= scalar;
2629 refres_ /= scalar;
2630 }
2631 catch( std::exception& ex ) {
2632 std::ostringstream oss;
2633 oss << " Test : " << test_ << "\n"
2634 << " Error: Failed self-scaling operation\n"
2635 << " Details:\n"
2636 << " Random seed = " << blaze::getSeed() << "\n"
2637 << " Scalar = " << scalar << "\n"
2638 << " Error message: " << ex.what() << "\n";
2639 throw std::runtime_error( oss.str() );
2640 }
2641
2642 checkResults<MT1,MT2>();
2643 }
2644
2645
2646 //=====================================================================================
2647 // Self-scaling (M=M/s)
2648 //=====================================================================================
2649
2650 // Self-scaling (M=M/s)
2651 {
2652 test_ = "Self-scaling (M=M/s)";
2653
2654 try {
2655 dres_ = kron( lhs_, rhs_ );
2656 odres_ = dres_;
2657 sres_ = dres_;
2658 osres_ = dres_;
2659 refres_ = dres_;
2660
2661 dres_ = dres_ / scalar;
2662 odres_ = odres_ / scalar;
2663 sres_ = sres_ / scalar;
2664 osres_ = osres_ / scalar;
2665 refres_ = refres_ / scalar;
2666 }
2667 catch( std::exception& ex ) {
2668 std::ostringstream oss;
2669 oss << " Test : " << test_ << "\n"
2670 << " Error: Failed self-scaling operation\n"
2671 << " Details:\n"
2672 << " Random seed = " << blaze::getSeed() << "\n"
2673 << " Scalar = " << scalar << "\n"
2674 << " Error message: " << ex.what() << "\n";
2675 throw std::runtime_error( oss.str() );
2676 }
2677
2678 checkResults<MT1,MT2>();
2679 }
2680
2681
2682 //=====================================================================================
2683 // Scaled Kronecker product (s*OP)
2684 //=====================================================================================
2685
2686 // Scaled Kronecker product with the given matrices
2687 {
2688 test_ = "Scaled Kronecker product with the given matrices (s*OP)";
2689 error_ = "Failed Kronecker product operation";
2690
2691 try {
2692 initResults();
2693 dres_ = scalar * kron( lhs_, rhs_ );
2694 odres_ = scalar * kron( lhs_, rhs_ );
2695 sres_ = scalar * kron( lhs_, rhs_ );
2696 osres_ = scalar * kron( lhs_, rhs_ );
2697 refres_ = scalar * kron( reflhs_, refrhs_ );
2698 }
2699 catch( std::exception& ex ) {
2700 convertException<MT1,MT2>( ex );
2701 }
2702
2703 checkResults<MT1,MT2>();
2704
2705 try {
2706 initResults();
2707 dres_ = scalar * kron( lhs_, orhs_ );
2708 odres_ = scalar * kron( lhs_, orhs_ );
2709 sres_ = scalar * kron( lhs_, orhs_ );
2710 osres_ = scalar * kron( lhs_, orhs_ );
2711 refres_ = scalar * kron( reflhs_, refrhs_ );
2712 }
2713 catch( std::exception& ex ) {
2714 convertException<MT1,OMT2>( ex );
2715 }
2716
2717 checkResults<MT1,OMT2>();
2718
2719 try {
2720 initResults();
2721 dres_ = scalar * kron( olhs_, rhs_ );
2722 odres_ = scalar * kron( olhs_, rhs_ );
2723 sres_ = scalar * kron( olhs_, rhs_ );
2724 osres_ = scalar * kron( olhs_, rhs_ );
2725 refres_ = scalar * kron( reflhs_, refrhs_ );
2726 }
2727 catch( std::exception& ex ) {
2728 convertException<OMT1,MT2>( ex );
2729 }
2730
2731 checkResults<OMT1,MT2>();
2732
2733 try {
2734 initResults();
2735 dres_ = scalar * kron( olhs_, orhs_ );
2736 odres_ = scalar * kron( olhs_, orhs_ );
2737 sres_ = scalar * kron( olhs_, orhs_ );
2738 osres_ = scalar * kron( olhs_, orhs_ );
2739 refres_ = scalar * kron( reflhs_, refrhs_ );
2740 }
2741 catch( std::exception& ex ) {
2742 convertException<OMT1,OMT2>( ex );
2743 }
2744
2745 checkResults<OMT1,OMT2>();
2746 }
2747
2748 // Scaled Kronecker product with evaluated matrices
2749 {
2750 test_ = "Scaled Kronecker product with evaluated matrices (s*OP)";
2751 error_ = "Failed Kronecker product operation";
2752
2753 try {
2754 initResults();
2755 dres_ = scalar * kron( eval( lhs_ ), eval( rhs_ ) );
2756 odres_ = scalar * kron( eval( lhs_ ), eval( rhs_ ) );
2757 sres_ = scalar * kron( eval( lhs_ ), eval( rhs_ ) );
2758 osres_ = scalar * kron( eval( lhs_ ), eval( rhs_ ) );
2759 refres_ = scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
2760 }
2761 catch( std::exception& ex ) {
2762 convertException<MT1,MT2>( ex );
2763 }
2764
2765 checkResults<MT1,MT2>();
2766
2767 try {
2768 initResults();
2769 dres_ = scalar * kron( eval( lhs_ ), eval( orhs_ ) );
2770 odres_ = scalar * kron( eval( lhs_ ), eval( orhs_ ) );
2771 sres_ = scalar * kron( eval( lhs_ ), eval( orhs_ ) );
2772 osres_ = scalar * kron( eval( lhs_ ), eval( orhs_ ) );
2773 refres_ = scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
2774 }
2775 catch( std::exception& ex ) {
2776 convertException<MT1,OMT2>( ex );
2777 }
2778
2779 checkResults<MT1,OMT2>();
2780
2781 try {
2782 initResults();
2783 dres_ = scalar * kron( eval( olhs_ ), eval( rhs_ ) );
2784 odres_ = scalar * kron( eval( olhs_ ), eval( rhs_ ) );
2785 sres_ = scalar * kron( eval( olhs_ ), eval( rhs_ ) );
2786 osres_ = scalar * kron( eval( olhs_ ), eval( rhs_ ) );
2787 refres_ = scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
2788 }
2789 catch( std::exception& ex ) {
2790 convertException<OMT1,MT2>( ex );
2791 }
2792
2793 checkResults<OMT1,MT2>();
2794
2795 try {
2796 initResults();
2797 dres_ = scalar * kron( eval( olhs_ ), eval( orhs_ ) );
2798 odres_ = scalar * kron( eval( olhs_ ), eval( orhs_ ) );
2799 sres_ = scalar * kron( eval( olhs_ ), eval( orhs_ ) );
2800 osres_ = scalar * kron( eval( olhs_ ), eval( orhs_ ) );
2801 refres_ = scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
2802 }
2803 catch( std::exception& ex ) {
2804 convertException<OMT1,OMT2>( ex );
2805 }
2806
2807 checkResults<OMT1,OMT2>();
2808 }
2809
2810
2811 //=====================================================================================
2812 // Scaled Kronecker product (OP*s)
2813 //=====================================================================================
2814
2815 // Scaled Kronecker product with the given matrices
2816 {
2817 test_ = "Scaled Kronecker product with the given matrices (OP*s)";
2818 error_ = "Failed Kronecker product operation";
2819
2820 try {
2821 initResults();
2822 dres_ = kron( lhs_, rhs_ ) * scalar;
2823 odres_ = kron( lhs_, rhs_ ) * scalar;
2824 sres_ = kron( lhs_, rhs_ ) * scalar;
2825 osres_ = kron( lhs_, rhs_ ) * scalar;
2826 refres_ = kron( reflhs_, refrhs_ ) * scalar;
2827 }
2828 catch( std::exception& ex ) {
2829 convertException<MT1,MT2>( ex );
2830 }
2831
2832 checkResults<MT1,MT2>();
2833
2834 try {
2835 initResults();
2836 dres_ = kron( lhs_, orhs_ ) * scalar;
2837 odres_ = kron( lhs_, orhs_ ) * scalar;
2838 sres_ = kron( lhs_, orhs_ ) * scalar;
2839 osres_ = kron( lhs_, orhs_ ) * scalar;
2840 refres_ = kron( reflhs_, refrhs_ ) * scalar;
2841 }
2842 catch( std::exception& ex ) {
2843 convertException<MT1,OMT2>( ex );
2844 }
2845
2846 checkResults<MT1,OMT2>();
2847
2848 try {
2849 initResults();
2850 dres_ = kron( olhs_, rhs_ ) * scalar;
2851 odres_ = kron( olhs_, rhs_ ) * scalar;
2852 sres_ = kron( olhs_, rhs_ ) * scalar;
2853 osres_ = kron( olhs_, rhs_ ) * scalar;
2854 refres_ = kron( reflhs_, refrhs_ ) * scalar;
2855 }
2856 catch( std::exception& ex ) {
2857 convertException<OMT1,MT2>( ex );
2858 }
2859
2860 checkResults<OMT1,MT2>();
2861
2862 try {
2863 initResults();
2864 dres_ = kron( olhs_, orhs_ ) * scalar;
2865 odres_ = kron( olhs_, orhs_ ) * scalar;
2866 sres_ = kron( olhs_, orhs_ ) * scalar;
2867 osres_ = kron( olhs_, orhs_ ) * scalar;
2868 refres_ = kron( reflhs_, refrhs_ ) * scalar;
2869 }
2870 catch( std::exception& ex ) {
2871 convertException<OMT1,OMT2>( ex );
2872 }
2873
2874 checkResults<OMT1,OMT2>();
2875 }
2876
2877 // Scaled Kronecker product with evaluated matrices
2878 {
2879 test_ = "Scaled Kronecker product with evaluated matrices (OP*s)";
2880 error_ = "Failed Kronecker product operation";
2881
2882 try {
2883 initResults();
2884 dres_ = kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
2885 odres_ = kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
2886 sres_ = kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
2887 osres_ = kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
2888 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
2889 }
2890 catch( std::exception& ex ) {
2891 convertException<MT1,MT2>( ex );
2892 }
2893
2894 checkResults<MT1,MT2>();
2895
2896 try {
2897 initResults();
2898 dres_ = kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
2899 odres_ = kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
2900 sres_ = kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
2901 osres_ = kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
2902 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
2903 }
2904 catch( std::exception& ex ) {
2905 convertException<MT1,OMT2>( ex );
2906 }
2907
2908 checkResults<MT1,OMT2>();
2909
2910 try {
2911 initResults();
2912 dres_ = kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
2913 odres_ = kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
2914 sres_ = kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
2915 osres_ = kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
2916 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
2917 }
2918 catch( std::exception& ex ) {
2919 convertException<OMT1,MT2>( ex );
2920 }
2921
2922 checkResults<OMT1,MT2>();
2923
2924 try {
2925 initResults();
2926 dres_ = kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
2927 odres_ = kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
2928 sres_ = kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
2929 osres_ = kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
2930 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
2931 }
2932 catch( std::exception& ex ) {
2933 convertException<OMT1,OMT2>( ex );
2934 }
2935
2936 checkResults<OMT1,OMT2>();
2937 }
2938
2939
2940 //=====================================================================================
2941 // Scaled Kronecker product (OP/s)
2942 //=====================================================================================
2943
2944 // Scaled Kronecker product with the given matrices
2945 {
2946 test_ = "Scaled Kronecker product with the given matrices (OP/s)";
2947 error_ = "Failed Kronecker product operation";
2948
2949 try {
2950 initResults();
2951 dres_ = kron( lhs_, rhs_ ) / scalar;
2952 odres_ = kron( lhs_, rhs_ ) / scalar;
2953 sres_ = kron( lhs_, rhs_ ) / scalar;
2954 osres_ = kron( lhs_, rhs_ ) / scalar;
2955 refres_ = kron( reflhs_, refrhs_ ) / scalar;
2956 }
2957 catch( std::exception& ex ) {
2958 convertException<MT1,MT2>( ex );
2959 }
2960
2961 checkResults<MT1,MT2>();
2962
2963 try {
2964 initResults();
2965 dres_ = kron( lhs_, orhs_ ) / scalar;
2966 odres_ = kron( lhs_, orhs_ ) / scalar;
2967 sres_ = kron( lhs_, orhs_ ) / scalar;
2968 osres_ = kron( lhs_, orhs_ ) / scalar;
2969 refres_ = kron( reflhs_, refrhs_ ) / scalar;
2970 }
2971 catch( std::exception& ex ) {
2972 convertException<MT1,OMT2>( ex );
2973 }
2974
2975 checkResults<MT1,OMT2>();
2976
2977 try {
2978 initResults();
2979 dres_ = kron( olhs_, rhs_ ) / scalar;
2980 odres_ = kron( olhs_, rhs_ ) / scalar;
2981 sres_ = kron( olhs_, rhs_ ) / scalar;
2982 osres_ = kron( olhs_, rhs_ ) / scalar;
2983 refres_ = kron( reflhs_, refrhs_ ) / scalar;
2984 }
2985 catch( std::exception& ex ) {
2986 convertException<OMT1,MT2>( ex );
2987 }
2988
2989 checkResults<OMT1,MT2>();
2990
2991 try {
2992 initResults();
2993 dres_ = kron( olhs_, orhs_ ) / scalar;
2994 odres_ = kron( olhs_, orhs_ ) / scalar;
2995 sres_ = kron( olhs_, orhs_ ) / scalar;
2996 osres_ = kron( olhs_, orhs_ ) / scalar;
2997 refres_ = kron( reflhs_, refrhs_ ) / scalar;
2998 }
2999 catch( std::exception& ex ) {
3000 convertException<OMT1,OMT2>( ex );
3001 }
3002
3003 checkResults<OMT1,OMT2>();
3004 }
3005
3006 // Scaled Kronecker product with evaluated matrices
3007 {
3008 test_ = "Scaled Kronecker product with evaluated matrices (OP/s)";
3009 error_ = "Failed Kronecker product operation";
3010
3011 try {
3012 initResults();
3013 dres_ = kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3014 odres_ = kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3015 sres_ = kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3016 osres_ = kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3017 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3018 }
3019 catch( std::exception& ex ) {
3020 convertException<MT1,MT2>( ex );
3021 }
3022
3023 checkResults<MT1,MT2>();
3024
3025 try {
3026 initResults();
3027 dres_ = kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3028 odres_ = kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3029 sres_ = kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3030 osres_ = kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3031 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3032 }
3033 catch( std::exception& ex ) {
3034 convertException<MT1,OMT2>( ex );
3035 }
3036
3037 checkResults<MT1,OMT2>();
3038
3039 try {
3040 initResults();
3041 dres_ = kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3042 odres_ = kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3043 sres_ = kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3044 osres_ = kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3045 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3046 }
3047 catch( std::exception& ex ) {
3048 convertException<OMT1,MT2>( ex );
3049 }
3050
3051 checkResults<OMT1,MT2>();
3052
3053 try {
3054 initResults();
3055 dres_ = kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3056 odres_ = kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3057 sres_ = kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3058 osres_ = kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3059 refres_ = kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3060 }
3061 catch( std::exception& ex ) {
3062 convertException<OMT1,OMT2>( ex );
3063 }
3064
3065 checkResults<OMT1,OMT2>();
3066 }
3067
3068
3069 //=====================================================================================
3070 // Scaled Kronecker product with addition assignment (s*OP)
3071 //=====================================================================================
3072
3073 // Scaled Kronecker product with addition assignment with the given matrices
3074 {
3075 test_ = "Scaled Kronecker product with addition assignment with the given matrices (s*OP)";
3076 error_ = "Failed addition assignment operation";
3077
3078 try {
3079 initResults();
3080 dres_ += scalar * kron( lhs_, rhs_ );
3081 odres_ += scalar * kron( lhs_, rhs_ );
3082 sres_ += scalar * kron( lhs_, rhs_ );
3083 osres_ += scalar * kron( lhs_, rhs_ );
3084 refres_ += scalar * kron( reflhs_, refrhs_ );
3085 }
3086 catch( std::exception& ex ) {
3087 convertException<MT1,MT2>( ex );
3088 }
3089
3090 checkResults<MT1,MT2>();
3091
3092 try {
3093 initResults();
3094 dres_ += scalar * kron( lhs_, orhs_ );
3095 odres_ += scalar * kron( lhs_, orhs_ );
3096 sres_ += scalar * kron( lhs_, orhs_ );
3097 osres_ += scalar * kron( lhs_, orhs_ );
3098 refres_ += scalar * kron( reflhs_, refrhs_ );
3099 }
3100 catch( std::exception& ex ) {
3101 convertException<MT1,OMT2>( ex );
3102 }
3103
3104 checkResults<MT1,OMT2>();
3105
3106 try {
3107 initResults();
3108 dres_ += scalar * kron( olhs_, rhs_ );
3109 odres_ += scalar * kron( olhs_, rhs_ );
3110 sres_ += scalar * kron( olhs_, rhs_ );
3111 osres_ += scalar * kron( olhs_, rhs_ );
3112 refres_ += scalar * kron( reflhs_, refrhs_ );
3113 }
3114 catch( std::exception& ex ) {
3115 convertException<OMT1,MT2>( ex );
3116 }
3117
3118 checkResults<OMT1,MT2>();
3119
3120 try {
3121 initResults();
3122 dres_ += scalar * kron( olhs_, orhs_ );
3123 odres_ += scalar * kron( olhs_, orhs_ );
3124 sres_ += scalar * kron( olhs_, orhs_ );
3125 osres_ += scalar * kron( olhs_, orhs_ );
3126 refres_ += scalar * kron( reflhs_, refrhs_ );
3127 }
3128 catch( std::exception& ex ) {
3129 convertException<OMT1,OMT2>( ex );
3130 }
3131
3132 checkResults<OMT1,OMT2>();
3133 }
3134
3135 // Scaled Kronecker product with addition assignment with evaluated matrices
3136 {
3137 test_ = "Scaled Kronecker product with addition assignment with evaluated matrices (s*OP)";
3138 error_ = "Failed addition assignment operation";
3139
3140 try {
3141 initResults();
3142 dres_ += scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3143 odres_ += scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3144 sres_ += scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3145 osres_ += scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3146 refres_ += scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3147 }
3148 catch( std::exception& ex ) {
3149 convertException<MT1,MT2>( ex );
3150 }
3151
3152 checkResults<MT1,MT2>();
3153
3154 try {
3155 initResults();
3156 dres_ += scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3157 odres_ += scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3158 sres_ += scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3159 osres_ += scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3160 refres_ += scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3161 }
3162 catch( std::exception& ex ) {
3163 convertException<MT1,OMT2>( ex );
3164 }
3165
3166 checkResults<MT1,OMT2>();
3167
3168 try {
3169 initResults();
3170 dres_ += scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3171 odres_ += scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3172 sres_ += scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3173 osres_ += scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3174 refres_ += scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3175 }
3176 catch( std::exception& ex ) {
3177 convertException<OMT1,MT2>( ex );
3178 }
3179
3180 checkResults<OMT1,MT2>();
3181
3182 try {
3183 initResults();
3184 dres_ += scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3185 odres_ += scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3186 sres_ += scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3187 osres_ += scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3188 refres_ += scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3189 }
3190 catch( std::exception& ex ) {
3191 convertException<OMT1,OMT2>( ex );
3192 }
3193
3194 checkResults<OMT1,OMT2>();
3195 }
3196
3197
3198 //=====================================================================================
3199 // Scaled Kronecker product with addition assignment (OP*s)
3200 //=====================================================================================
3201
3202 // Scaled Kronecker product with addition assignment with the given matrices
3203 {
3204 test_ = "Scaled Kronecker product with addition assignment with the given matrices (OP*s)";
3205 error_ = "Failed addition assignment operation";
3206
3207 try {
3208 initResults();
3209 dres_ += kron( lhs_, rhs_ ) * scalar;
3210 odres_ += kron( lhs_, rhs_ ) * scalar;
3211 sres_ += kron( lhs_, rhs_ ) * scalar;
3212 osres_ += kron( lhs_, rhs_ ) * scalar;
3213 refres_ += kron( reflhs_, refrhs_ ) * scalar;
3214 }
3215 catch( std::exception& ex ) {
3216 convertException<MT1,MT2>( ex );
3217 }
3218
3219 checkResults<MT1,MT2>();
3220
3221 try {
3222 initResults();
3223 dres_ += kron( lhs_, orhs_ ) * scalar;
3224 odres_ += kron( lhs_, orhs_ ) * scalar;
3225 sres_ += kron( lhs_, orhs_ ) * scalar;
3226 osres_ += kron( lhs_, orhs_ ) * scalar;
3227 refres_ += kron( reflhs_, refrhs_ ) * scalar;
3228 }
3229 catch( std::exception& ex ) {
3230 convertException<MT1,OMT2>( ex );
3231 }
3232
3233 checkResults<MT1,OMT2>();
3234
3235 try {
3236 initResults();
3237 dres_ += kron( olhs_, rhs_ ) * scalar;
3238 odres_ += kron( olhs_, rhs_ ) * scalar;
3239 sres_ += kron( olhs_, rhs_ ) * scalar;
3240 osres_ += kron( olhs_, rhs_ ) * scalar;
3241 refres_ += kron( reflhs_, refrhs_ ) * scalar;
3242 }
3243 catch( std::exception& ex ) {
3244 convertException<OMT1,MT2>( ex );
3245 }
3246
3247 checkResults<OMT1,MT2>();
3248
3249 try {
3250 initResults();
3251 dres_ += kron( olhs_, orhs_ ) * scalar;
3252 odres_ += kron( olhs_, orhs_ ) * scalar;
3253 sres_ += kron( olhs_, orhs_ ) * scalar;
3254 osres_ += kron( olhs_, orhs_ ) * scalar;
3255 refres_ += kron( reflhs_, refrhs_ ) * scalar;
3256 }
3257 catch( std::exception& ex ) {
3258 convertException<OMT1,OMT2>( ex );
3259 }
3260
3261 checkResults<OMT1,OMT2>();
3262 }
3263
3264 // Scaled Kronecker product with addition assignment with evaluated matrices
3265 {
3266 test_ = "Scaled Kronecker product with addition assignment with evaluated matrices (OP*s)";
3267 error_ = "Failed addition assignment operation";
3268
3269 try {
3270 initResults();
3271 dres_ += kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
3272 odres_ += kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
3273 sres_ += kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
3274 osres_ += kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
3275 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
3276 }
3277 catch( std::exception& ex ) {
3278 convertException<MT1,MT2>( ex );
3279 }
3280
3281 checkResults<MT1,MT2>();
3282
3283 try {
3284 initResults();
3285 dres_ += kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
3286 odres_ += kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
3287 sres_ += kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
3288 osres_ += kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
3289 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
3290 }
3291 catch( std::exception& ex ) {
3292 convertException<MT1,OMT2>( ex );
3293 }
3294
3295 checkResults<MT1,OMT2>();
3296
3297 try {
3298 initResults();
3299 dres_ += kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
3300 odres_ += kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
3301 sres_ += kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
3302 osres_ += kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
3303 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
3304 }
3305 catch( std::exception& ex ) {
3306 convertException<OMT1,MT2>( ex );
3307 }
3308
3309 checkResults<OMT1,MT2>();
3310
3311 try {
3312 initResults();
3313 dres_ += kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
3314 odres_ += kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
3315 sres_ += kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
3316 osres_ += kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
3317 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
3318 }
3319 catch( std::exception& ex ) {
3320 convertException<OMT1,OMT2>( ex );
3321 }
3322
3323 checkResults<OMT1,OMT2>();
3324 }
3325
3326
3327 //=====================================================================================
3328 // Scaled Kronecker product with addition assignment (OP/s)
3329 //=====================================================================================
3330
3331 // Scaled Kronecker product with addition assignment with the given matrices
3332 {
3333 test_ = "Scaled Kronecker product with addition assignment with the given matrices (OP/s)";
3334 error_ = "Failed addition assignment operation";
3335
3336 try {
3337 initResults();
3338 dres_ += kron( lhs_, rhs_ ) / scalar;
3339 odres_ += kron( lhs_, rhs_ ) / scalar;
3340 sres_ += kron( lhs_, rhs_ ) / scalar;
3341 osres_ += kron( lhs_, rhs_ ) / scalar;
3342 refres_ += kron( reflhs_, refrhs_ ) / scalar;
3343 }
3344 catch( std::exception& ex ) {
3345 convertException<MT1,MT2>( ex );
3346 }
3347
3348 checkResults<MT1,MT2>();
3349
3350 try {
3351 initResults();
3352 dres_ += kron( lhs_, orhs_ ) / scalar;
3353 odres_ += kron( lhs_, orhs_ ) / scalar;
3354 sres_ += kron( lhs_, orhs_ ) / scalar;
3355 osres_ += kron( lhs_, orhs_ ) / scalar;
3356 refres_ += kron( reflhs_, refrhs_ ) / scalar;
3357 }
3358 catch( std::exception& ex ) {
3359 convertException<MT1,OMT2>( ex );
3360 }
3361
3362 checkResults<MT1,OMT2>();
3363
3364 try {
3365 initResults();
3366 dres_ += kron( olhs_, rhs_ ) / scalar;
3367 odres_ += kron( olhs_, rhs_ ) / scalar;
3368 sres_ += kron( olhs_, rhs_ ) / scalar;
3369 osres_ += kron( olhs_, rhs_ ) / scalar;
3370 refres_ += kron( reflhs_, refrhs_ ) / scalar;
3371 }
3372 catch( std::exception& ex ) {
3373 convertException<OMT1,MT2>( ex );
3374 }
3375
3376 checkResults<OMT1,MT2>();
3377
3378 try {
3379 initResults();
3380 dres_ += kron( olhs_, orhs_ ) / scalar;
3381 odres_ += kron( olhs_, orhs_ ) / scalar;
3382 sres_ += kron( olhs_, orhs_ ) / scalar;
3383 osres_ += kron( olhs_, orhs_ ) / scalar;
3384 refres_ += kron( reflhs_, refrhs_ ) / scalar;
3385 }
3386 catch( std::exception& ex ) {
3387 convertException<OMT1,OMT2>( ex );
3388 }
3389
3390 checkResults<OMT1,OMT2>();
3391 }
3392
3393 // Scaled Kronecker product with addition assignment with evaluated matrices
3394 {
3395 test_ = "Scaled Kronecker product with addition assignment with evaluated matrices (OP/s)";
3396 error_ = "Failed addition assignment operation";
3397
3398 try {
3399 initResults();
3400 dres_ += kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3401 odres_ += kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3402 sres_ += kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3403 osres_ += kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3404 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3405 }
3406 catch( std::exception& ex ) {
3407 convertException<MT1,MT2>( ex );
3408 }
3409
3410 checkResults<MT1,MT2>();
3411
3412 try {
3413 initResults();
3414 dres_ += kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3415 odres_ += kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3416 sres_ += kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3417 osres_ += kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3418 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3419 }
3420 catch( std::exception& ex ) {
3421 convertException<MT1,OMT2>( ex );
3422 }
3423
3424 checkResults<MT1,OMT2>();
3425
3426 try {
3427 initResults();
3428 dres_ += kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3429 odres_ += kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3430 sres_ += kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3431 osres_ += kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3432 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3433 }
3434 catch( std::exception& ex ) {
3435 convertException<OMT1,MT2>( ex );
3436 }
3437
3438 checkResults<OMT1,MT2>();
3439
3440 try {
3441 initResults();
3442 dres_ += kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3443 odres_ += kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3444 sres_ += kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3445 osres_ += kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3446 refres_ += kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3447 }
3448 catch( std::exception& ex ) {
3449 convertException<OMT1,OMT2>( ex );
3450 }
3451
3452 checkResults<OMT1,OMT2>();
3453 }
3454
3455
3456 //=====================================================================================
3457 // Scaled Kronecker product with subtraction assignment (s*OP)
3458 //=====================================================================================
3459
3460 // Scaled Kronecker product with subtraction assignment with the given matrices
3461 {
3462 test_ = "Scaled Kronecker product with subtraction assignment with the given matrices (s*OP)";
3463 error_ = "Failed subtraction assignment operation";
3464
3465 try {
3466 initResults();
3467 dres_ -= scalar * kron( lhs_, rhs_ );
3468 odres_ -= scalar * kron( lhs_, rhs_ );
3469 sres_ -= scalar * kron( lhs_, rhs_ );
3470 osres_ -= scalar * kron( lhs_, rhs_ );
3471 refres_ -= scalar * kron( reflhs_, refrhs_ );
3472 }
3473 catch( std::exception& ex ) {
3474 convertException<MT1,MT2>( ex );
3475 }
3476
3477 checkResults<MT1,MT2>();
3478
3479 try {
3480 initResults();
3481 dres_ -= scalar * kron( lhs_, orhs_ );
3482 odres_ -= scalar * kron( lhs_, orhs_ );
3483 sres_ -= scalar * kron( lhs_, orhs_ );
3484 osres_ -= scalar * kron( lhs_, orhs_ );
3485 refres_ -= scalar * kron( reflhs_, refrhs_ );
3486 }
3487 catch( std::exception& ex ) {
3488 convertException<MT1,OMT2>( ex );
3489 }
3490
3491 checkResults<MT1,OMT2>();
3492
3493 try {
3494 initResults();
3495 dres_ -= scalar * kron( olhs_, rhs_ );
3496 odres_ -= scalar * kron( olhs_, rhs_ );
3497 sres_ -= scalar * kron( olhs_, rhs_ );
3498 osres_ -= scalar * kron( olhs_, rhs_ );
3499 refres_ -= scalar * kron( reflhs_, refrhs_ );
3500 }
3501 catch( std::exception& ex ) {
3502 convertException<OMT1,MT2>( ex );
3503 }
3504
3505 checkResults<OMT1,MT2>();
3506
3507 try {
3508 initResults();
3509 dres_ -= scalar * kron( olhs_, orhs_ );
3510 odres_ -= scalar * kron( olhs_, orhs_ );
3511 sres_ -= scalar * kron( olhs_, orhs_ );
3512 osres_ -= scalar * kron( olhs_, orhs_ );
3513 refres_ -= scalar * kron( reflhs_, refrhs_ );
3514 }
3515 catch( std::exception& ex ) {
3516 convertException<OMT1,OMT2>( ex );
3517 }
3518
3519 checkResults<OMT1,OMT2>();
3520 }
3521
3522 // Scaled Kronecker product with subtraction assignment with evaluated matrices
3523 {
3524 test_ = "Scaled Kronecker product with subtraction assignment with evaluated matrices (s*OP)";
3525 error_ = "Failed subtraction assignment operation";
3526
3527 try {
3528 initResults();
3529 dres_ -= scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3530 odres_ -= scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3531 sres_ -= scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3532 osres_ -= scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3533 refres_ -= scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3534 }
3535 catch( std::exception& ex ) {
3536 convertException<MT1,MT2>( ex );
3537 }
3538
3539 checkResults<MT1,MT2>();
3540
3541 try {
3542 initResults();
3543 dres_ -= scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3544 odres_ -= scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3545 sres_ -= scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3546 osres_ -= scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3547 refres_ -= scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3548 }
3549 catch( std::exception& ex ) {
3550 convertException<MT1,OMT2>( ex );
3551 }
3552
3553 checkResults<MT1,OMT2>();
3554
3555 try {
3556 initResults();
3557 dres_ -= scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3558 odres_ -= scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3559 sres_ -= scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3560 osres_ -= scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3561 refres_ -= scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3562 }
3563 catch( std::exception& ex ) {
3564 convertException<OMT1,MT2>( ex );
3565 }
3566
3567 checkResults<OMT1,MT2>();
3568
3569 try {
3570 initResults();
3571 dres_ -= scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3572 odres_ -= scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3573 sres_ -= scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3574 osres_ -= scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3575 refres_ -= scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3576 }
3577 catch( std::exception& ex ) {
3578 convertException<OMT1,OMT2>( ex );
3579 }
3580
3581 checkResults<OMT1,OMT2>();
3582 }
3583
3584
3585 //=====================================================================================
3586 // Scaled Kronecker product with subtraction assignment (OP*s)
3587 //=====================================================================================
3588
3589 // Scaled Kronecker product with subtraction assignment with the given matrices
3590 {
3591 test_ = "Scaled Kronecker product with subtraction assignment with the given matrices (OP*s)";
3592 error_ = "Failed subtraction assignment operation";
3593
3594 try {
3595 initResults();
3596 dres_ -= kron( lhs_, rhs_ ) * scalar;
3597 odres_ -= kron( lhs_, rhs_ ) * scalar;
3598 sres_ -= kron( lhs_, rhs_ ) * scalar;
3599 osres_ -= kron( lhs_, rhs_ ) * scalar;
3600 refres_ -= kron( reflhs_, refrhs_ ) * scalar;
3601 }
3602 catch( std::exception& ex ) {
3603 convertException<MT1,MT2>( ex );
3604 }
3605
3606 checkResults<MT1,MT2>();
3607
3608 try {
3609 initResults();
3610 dres_ -= kron( lhs_, orhs_ ) * scalar;
3611 odres_ -= kron( lhs_, orhs_ ) * scalar;
3612 sres_ -= kron( lhs_, orhs_ ) * scalar;
3613 osres_ -= kron( lhs_, orhs_ ) * scalar;
3614 refres_ -= kron( reflhs_, refrhs_ ) * scalar;
3615 }
3616 catch( std::exception& ex ) {
3617 convertException<MT1,OMT2>( ex );
3618 }
3619
3620 checkResults<MT1,OMT2>();
3621
3622 try {
3623 initResults();
3624 dres_ -= kron( olhs_, rhs_ ) * scalar;
3625 odres_ -= kron( olhs_, rhs_ ) * scalar;
3626 sres_ -= kron( olhs_, rhs_ ) * scalar;
3627 osres_ -= kron( olhs_, rhs_ ) * scalar;
3628 refres_ -= kron( reflhs_, refrhs_ ) * scalar;
3629 }
3630 catch( std::exception& ex ) {
3631 convertException<OMT1,MT2>( ex );
3632 }
3633
3634 checkResults<OMT1,MT2>();
3635
3636 try {
3637 initResults();
3638 dres_ -= kron( olhs_, orhs_ ) * scalar;
3639 odres_ -= kron( olhs_, orhs_ ) * scalar;
3640 sres_ -= kron( olhs_, orhs_ ) * scalar;
3641 osres_ -= kron( olhs_, orhs_ ) * scalar;
3642 refres_ -= kron( reflhs_, refrhs_ ) * scalar;
3643 }
3644 catch( std::exception& ex ) {
3645 convertException<OMT1,OMT2>( ex );
3646 }
3647
3648 checkResults<OMT1,OMT2>();
3649 }
3650
3651 // Scaled Kronecker product with subtraction assignment with evaluated matrices
3652 {
3653 test_ = "Scaled Kronecker product with subtraction assignment with evaluated matrices (OP*s)";
3654 error_ = "Failed subtraction assignment operation";
3655
3656 try {
3657 initResults();
3658 dres_ -= kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
3659 odres_ -= kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
3660 sres_ -= kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
3661 osres_ -= kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
3662 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
3663 }
3664 catch( std::exception& ex ) {
3665 convertException<MT1,MT2>( ex );
3666 }
3667
3668 checkResults<MT1,MT2>();
3669
3670 try {
3671 initResults();
3672 dres_ -= kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
3673 odres_ -= kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
3674 sres_ -= kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
3675 osres_ -= kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
3676 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
3677 }
3678 catch( std::exception& ex ) {
3679 convertException<MT1,OMT2>( ex );
3680 }
3681
3682 checkResults<MT1,OMT2>();
3683
3684 try {
3685 initResults();
3686 dres_ -= kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
3687 odres_ -= kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
3688 sres_ -= kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
3689 osres_ -= kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
3690 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
3691 }
3692 catch( std::exception& ex ) {
3693 convertException<OMT1,MT2>( ex );
3694 }
3695
3696 checkResults<OMT1,MT2>();
3697
3698 try {
3699 initResults();
3700 dres_ -= kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
3701 odres_ -= kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
3702 sres_ -= kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
3703 osres_ -= kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
3704 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
3705 }
3706 catch( std::exception& ex ) {
3707 convertException<OMT1,OMT2>( ex );
3708 }
3709
3710 checkResults<OMT1,OMT2>();
3711 }
3712
3713
3714 //=====================================================================================
3715 // Scaled Kronecker product with subtraction assignment (OP/s)
3716 //=====================================================================================
3717
3718 // Scaled Kronecker product with subtraction assignment with the given matrices
3719 {
3720 test_ = "Scaled Kronecker product with subtraction assignment with the given matrices (OP/s)";
3721 error_ = "Failed subtraction assignment operation";
3722
3723 try {
3724 initResults();
3725 dres_ -= kron( lhs_, rhs_ ) / scalar;
3726 odres_ -= kron( lhs_, rhs_ ) / scalar;
3727 sres_ -= kron( lhs_, rhs_ ) / scalar;
3728 osres_ -= kron( lhs_, rhs_ ) / scalar;
3729 refres_ -= kron( reflhs_, refrhs_ ) / scalar;
3730 }
3731 catch( std::exception& ex ) {
3732 convertException<MT1,MT2>( ex );
3733 }
3734
3735 checkResults<MT1,MT2>();
3736
3737 try {
3738 initResults();
3739 dres_ -= kron( lhs_, orhs_ ) / scalar;
3740 odres_ -= kron( lhs_, orhs_ ) / scalar;
3741 sres_ -= kron( lhs_, orhs_ ) / scalar;
3742 osres_ -= kron( lhs_, orhs_ ) / scalar;
3743 refres_ -= kron( reflhs_, refrhs_ ) / scalar;
3744 }
3745 catch( std::exception& ex ) {
3746 convertException<MT1,OMT2>( ex );
3747 }
3748
3749 checkResults<MT1,OMT2>();
3750
3751 try {
3752 initResults();
3753 dres_ -= kron( olhs_, rhs_ ) / scalar;
3754 odres_ -= kron( olhs_, rhs_ ) / scalar;
3755 sres_ -= kron( olhs_, rhs_ ) / scalar;
3756 osres_ -= kron( olhs_, rhs_ ) / scalar;
3757 refres_ -= kron( reflhs_, refrhs_ ) / scalar;
3758 }
3759 catch( std::exception& ex ) {
3760 convertException<OMT1,MT2>( ex );
3761 }
3762
3763 checkResults<OMT1,MT2>();
3764
3765 try {
3766 initResults();
3767 dres_ -= kron( olhs_, orhs_ ) / scalar;
3768 odres_ -= kron( olhs_, orhs_ ) / scalar;
3769 sres_ -= kron( olhs_, orhs_ ) / scalar;
3770 osres_ -= kron( olhs_, orhs_ ) / scalar;
3771 refres_ -= kron( reflhs_, refrhs_ ) / scalar;
3772 }
3773 catch( std::exception& ex ) {
3774 convertException<OMT1,OMT2>( ex );
3775 }
3776
3777 checkResults<OMT1,OMT2>();
3778 }
3779
3780 // Scaled Kronecker product with subtraction assignment with evaluated matrices
3781 {
3782 test_ = "Scaled Kronecker product with subtraction assignment with evaluated matrices (OP/s)";
3783 error_ = "Failed subtraction assignment operation";
3784
3785 try {
3786 initResults();
3787 dres_ -= kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3788 odres_ -= kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3789 sres_ -= kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3790 osres_ -= kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
3791 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3792 }
3793 catch( std::exception& ex ) {
3794 convertException<MT1,MT2>( ex );
3795 }
3796
3797 checkResults<MT1,MT2>();
3798
3799 try {
3800 initResults();
3801 dres_ -= kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3802 odres_ -= kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3803 sres_ -= kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3804 osres_ -= kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
3805 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3806 }
3807 catch( std::exception& ex ) {
3808 convertException<MT1,OMT2>( ex );
3809 }
3810
3811 checkResults<MT1,OMT2>();
3812
3813 try {
3814 initResults();
3815 dres_ -= kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3816 odres_ -= kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3817 sres_ -= kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3818 osres_ -= kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
3819 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3820 }
3821 catch( std::exception& ex ) {
3822 convertException<OMT1,MT2>( ex );
3823 }
3824
3825 checkResults<OMT1,MT2>();
3826
3827 try {
3828 initResults();
3829 dres_ -= kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3830 odres_ -= kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3831 sres_ -= kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3832 osres_ -= kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
3833 refres_ -= kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
3834 }
3835 catch( std::exception& ex ) {
3836 convertException<OMT1,OMT2>( ex );
3837 }
3838
3839 checkResults<OMT1,OMT2>();
3840 }
3841
3842
3843 //=====================================================================================
3844 // Scaled Kronecker product with Schur product assignment (s*OP)
3845 //=====================================================================================
3846
3847 // Scaled Kronecker product with Schur product assignment with the given matrices
3848 {
3849 test_ = "Scaled Kronecker product with Schur product assignment with the given matrices (s*OP)";
3850 error_ = "Failed Schur product assignment operation";
3851
3852 try {
3853 initResults();
3854 dres_ %= scalar * kron( lhs_, rhs_ );
3855 odres_ %= scalar * kron( lhs_, rhs_ );
3856 sres_ %= scalar * kron( lhs_, rhs_ );
3857 osres_ %= scalar * kron( lhs_, rhs_ );
3858 refres_ %= scalar * kron( reflhs_, refrhs_ );
3859 }
3860 catch( std::exception& ex ) {
3861 convertException<MT1,MT2>( ex );
3862 }
3863
3864 checkResults<MT1,MT2>();
3865
3866 try {
3867 initResults();
3868 dres_ %= scalar * kron( lhs_, orhs_ );
3869 odres_ %= scalar * kron( lhs_, orhs_ );
3870 sres_ %= scalar * kron( lhs_, orhs_ );
3871 osres_ %= scalar * kron( lhs_, orhs_ );
3872 refres_ %= scalar * kron( reflhs_, refrhs_ );
3873 }
3874 catch( std::exception& ex ) {
3875 convertException<MT1,OMT2>( ex );
3876 }
3877
3878 checkResults<MT1,OMT2>();
3879
3880 try {
3881 initResults();
3882 dres_ %= scalar * kron( olhs_, rhs_ );
3883 odres_ %= scalar * kron( olhs_, rhs_ );
3884 sres_ %= scalar * kron( olhs_, rhs_ );
3885 osres_ %= scalar * kron( olhs_, rhs_ );
3886 refres_ %= scalar * kron( reflhs_, refrhs_ );
3887 }
3888 catch( std::exception& ex ) {
3889 convertException<OMT1,MT2>( ex );
3890 }
3891
3892 checkResults<OMT1,MT2>();
3893
3894 try {
3895 initResults();
3896 dres_ %= scalar * kron( olhs_, orhs_ );
3897 odres_ %= scalar * kron( olhs_, orhs_ );
3898 sres_ %= scalar * kron( olhs_, orhs_ );
3899 osres_ %= scalar * kron( olhs_, orhs_ );
3900 refres_ %= scalar * kron( reflhs_, refrhs_ );
3901 }
3902 catch( std::exception& ex ) {
3903 convertException<OMT1,OMT2>( ex );
3904 }
3905
3906 checkResults<OMT1,OMT2>();
3907 }
3908
3909 // Scaled Kronecker product with Schur product assignment with evaluated matrices
3910 {
3911 test_ = "Scaled Kronecker product with Schur product assignment with evaluated matrices (s*OP)";
3912 error_ = "Failed Schur product assignment operation";
3913
3914 try {
3915 initResults();
3916 dres_ %= scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3917 odres_ %= scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3918 sres_ %= scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3919 osres_ %= scalar * kron( eval( lhs_ ), eval( rhs_ ) );
3920 refres_ %= scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3921 }
3922 catch( std::exception& ex ) {
3923 convertException<MT1,MT2>( ex );
3924 }
3925
3926 checkResults<MT1,MT2>();
3927
3928 try {
3929 initResults();
3930 dres_ %= scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3931 odres_ %= scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3932 sres_ %= scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3933 osres_ %= scalar * kron( eval( lhs_ ), eval( orhs_ ) );
3934 refres_ %= scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3935 }
3936 catch( std::exception& ex ) {
3937 convertException<MT1,OMT2>( ex );
3938 }
3939
3940 checkResults<MT1,OMT2>();
3941
3942 try {
3943 initResults();
3944 dres_ %= scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3945 odres_ %= scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3946 sres_ %= scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3947 osres_ %= scalar * kron( eval( olhs_ ), eval( rhs_ ) );
3948 refres_ %= scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3949 }
3950 catch( std::exception& ex ) {
3951 convertException<OMT1,MT2>( ex );
3952 }
3953
3954 checkResults<OMT1,MT2>();
3955
3956 try {
3957 initResults();
3958 dres_ %= scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3959 odres_ %= scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3960 sres_ %= scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3961 osres_ %= scalar * kron( eval( olhs_ ), eval( orhs_ ) );
3962 refres_ %= scalar * kron( eval( reflhs_ ), eval( refrhs_ ) );
3963 }
3964 catch( std::exception& ex ) {
3965 convertException<OMT1,OMT2>( ex );
3966 }
3967
3968 checkResults<OMT1,OMT2>();
3969 }
3970
3971
3972 //=====================================================================================
3973 // Scaled Kronecker product with Schur product assignment (OP*s)
3974 //=====================================================================================
3975
3976 // Scaled Kronecker product with Schur product assignment with the given matrices
3977 {
3978 test_ = "Scaled Kronecker product with Schur product assignment with the given matrices (OP*s)";
3979 error_ = "Failed Schur product assignment operation";
3980
3981 try {
3982 initResults();
3983 dres_ %= kron( lhs_, rhs_ ) * scalar;
3984 odres_ %= kron( lhs_, rhs_ ) * scalar;
3985 sres_ %= kron( lhs_, rhs_ ) * scalar;
3986 osres_ %= kron( lhs_, rhs_ ) * scalar;
3987 refres_ %= kron( reflhs_, refrhs_ ) * scalar;
3988 }
3989 catch( std::exception& ex ) {
3990 convertException<MT1,MT2>( ex );
3991 }
3992
3993 checkResults<MT1,MT2>();
3994
3995 try {
3996 initResults();
3997 dres_ %= kron( lhs_, orhs_ ) * scalar;
3998 odres_ %= kron( lhs_, orhs_ ) * scalar;
3999 sres_ %= kron( lhs_, orhs_ ) * scalar;
4000 osres_ %= kron( lhs_, orhs_ ) * scalar;
4001 refres_ %= kron( reflhs_, refrhs_ ) * scalar;
4002 }
4003 catch( std::exception& ex ) {
4004 convertException<MT1,OMT2>( ex );
4005 }
4006
4007 checkResults<MT1,OMT2>();
4008
4009 try {
4010 initResults();
4011 dres_ %= kron( olhs_, rhs_ ) * scalar;
4012 odres_ %= kron( olhs_, rhs_ ) * scalar;
4013 sres_ %= kron( olhs_, rhs_ ) * scalar;
4014 osres_ %= kron( olhs_, rhs_ ) * scalar;
4015 refres_ %= kron( reflhs_, refrhs_ ) * scalar;
4016 }
4017 catch( std::exception& ex ) {
4018 convertException<OMT1,MT2>( ex );
4019 }
4020
4021 checkResults<OMT1,MT2>();
4022
4023 try {
4024 initResults();
4025 dres_ %= kron( olhs_, orhs_ ) * scalar;
4026 odres_ %= kron( olhs_, orhs_ ) * scalar;
4027 sres_ %= kron( olhs_, orhs_ ) * scalar;
4028 osres_ %= kron( olhs_, orhs_ ) * scalar;
4029 refres_ %= kron( reflhs_, refrhs_ ) * scalar;
4030 }
4031 catch( std::exception& ex ) {
4032 convertException<OMT1,OMT2>( ex );
4033 }
4034
4035 checkResults<OMT1,OMT2>();
4036 }
4037
4038 // Scaled Kronecker product with Schur product assignment with evaluated matrices
4039 {
4040 test_ = "Scaled Kronecker product with Schur product assignment with evaluated matrices (OP*s)";
4041 error_ = "Failed Schur product assignment operation";
4042
4043 try {
4044 initResults();
4045 dres_ %= kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
4046 odres_ %= kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
4047 sres_ %= kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
4048 osres_ %= kron( eval( lhs_ ), eval( rhs_ ) ) * scalar;
4049 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
4050 }
4051 catch( std::exception& ex ) {
4052 convertException<MT1,MT2>( ex );
4053 }
4054
4055 checkResults<MT1,MT2>();
4056
4057 try {
4058 initResults();
4059 dres_ %= kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
4060 odres_ %= kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
4061 sres_ %= kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
4062 osres_ %= kron( eval( lhs_ ), eval( orhs_ ) ) * scalar;
4063 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
4064 }
4065 catch( std::exception& ex ) {
4066 convertException<MT1,OMT2>( ex );
4067 }
4068
4069 checkResults<MT1,OMT2>();
4070
4071 try {
4072 initResults();
4073 dres_ %= kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
4074 odres_ %= kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
4075 sres_ %= kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
4076 osres_ %= kron( eval( olhs_ ), eval( rhs_ ) ) * scalar;
4077 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
4078 }
4079 catch( std::exception& ex ) {
4080 convertException<OMT1,MT2>( ex );
4081 }
4082
4083 checkResults<OMT1,MT2>();
4084
4085 try {
4086 initResults();
4087 dres_ %= kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
4088 odres_ %= kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
4089 sres_ %= kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
4090 osres_ %= kron( eval( olhs_ ), eval( orhs_ ) ) * scalar;
4091 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) ) * scalar;
4092 }
4093 catch( std::exception& ex ) {
4094 convertException<OMT1,OMT2>( ex );
4095 }
4096
4097 checkResults<OMT1,OMT2>();
4098 }
4099
4100
4101 //=====================================================================================
4102 // Scaled Kronecker product with Schur product assignment (OP/s)
4103 //=====================================================================================
4104
4105 // Scaled Kronecker product with Schur product assignment with the given matrices
4106 {
4107 test_ = "Scaled Kronecker product with Schur product assignment with the given matrices (OP/s)";
4108 error_ = "Failed Schur product assignment operation";
4109
4110 try {
4111 initResults();
4112 dres_ %= kron( lhs_, rhs_ ) / scalar;
4113 odres_ %= kron( lhs_, rhs_ ) / scalar;
4114 sres_ %= kron( lhs_, rhs_ ) / scalar;
4115 osres_ %= kron( lhs_, rhs_ ) / scalar;
4116 refres_ %= kron( reflhs_, refrhs_ ) / scalar;
4117 }
4118 catch( std::exception& ex ) {
4119 convertException<MT1,MT2>( ex );
4120 }
4121
4122 checkResults<MT1,MT2>();
4123
4124 try {
4125 initResults();
4126 dres_ %= kron( lhs_, orhs_ ) / scalar;
4127 odres_ %= kron( lhs_, orhs_ ) / scalar;
4128 sres_ %= kron( lhs_, orhs_ ) / scalar;
4129 osres_ %= kron( lhs_, orhs_ ) / scalar;
4130 refres_ %= kron( reflhs_, refrhs_ ) / scalar;
4131 }
4132 catch( std::exception& ex ) {
4133 convertException<MT1,OMT2>( ex );
4134 }
4135
4136 checkResults<MT1,OMT2>();
4137
4138 try {
4139 initResults();
4140 dres_ %= kron( olhs_, rhs_ ) / scalar;
4141 odres_ %= kron( olhs_, rhs_ ) / scalar;
4142 sres_ %= kron( olhs_, rhs_ ) / scalar;
4143 osres_ %= kron( olhs_, rhs_ ) / scalar;
4144 refres_ %= kron( reflhs_, refrhs_ ) / scalar;
4145 }
4146 catch( std::exception& ex ) {
4147 convertException<OMT1,MT2>( ex );
4148 }
4149
4150 checkResults<OMT1,MT2>();
4151
4152 try {
4153 initResults();
4154 dres_ %= kron( olhs_, orhs_ ) / scalar;
4155 odres_ %= kron( olhs_, orhs_ ) / scalar;
4156 sres_ %= kron( olhs_, orhs_ ) / scalar;
4157 osres_ %= kron( olhs_, orhs_ ) / scalar;
4158 refres_ %= kron( reflhs_, refrhs_ ) / scalar;
4159 }
4160 catch( std::exception& ex ) {
4161 convertException<OMT1,OMT2>( ex );
4162 }
4163
4164 checkResults<OMT1,OMT2>();
4165 }
4166
4167 // Scaled Kronecker product with Schur product assignment with evaluated matrices
4168 {
4169 test_ = "Scaled Kronecker product with Schur product assignment with evaluated matrices (OP/s)";
4170 error_ = "Failed Schur product assignment operation";
4171
4172 try {
4173 initResults();
4174 dres_ %= kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
4175 odres_ %= kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
4176 sres_ %= kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
4177 osres_ %= kron( eval( lhs_ ), eval( rhs_ ) ) / scalar;
4178 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
4179 }
4180 catch( std::exception& ex ) {
4181 convertException<MT1,MT2>( ex );
4182 }
4183
4184 checkResults<MT1,MT2>();
4185
4186 try {
4187 initResults();
4188 dres_ %= kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
4189 odres_ %= kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
4190 sres_ %= kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
4191 osres_ %= kron( eval( lhs_ ), eval( orhs_ ) ) / scalar;
4192 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
4193 }
4194 catch( std::exception& ex ) {
4195 convertException<MT1,OMT2>( ex );
4196 }
4197
4198 checkResults<MT1,OMT2>();
4199
4200 try {
4201 initResults();
4202 dres_ %= kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
4203 odres_ %= kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
4204 sres_ %= kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
4205 osres_ %= kron( eval( olhs_ ), eval( rhs_ ) ) / scalar;
4206 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
4207 }
4208 catch( std::exception& ex ) {
4209 convertException<OMT1,MT2>( ex );
4210 }
4211
4212 checkResults<OMT1,MT2>();
4213
4214 try {
4215 initResults();
4216 dres_ %= kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
4217 odres_ %= kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
4218 sres_ %= kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
4219 osres_ %= kron( eval( olhs_ ), eval( orhs_ ) ) / scalar;
4220 refres_ %= kron( eval( reflhs_ ), eval( refrhs_ ) ) / scalar;
4221 }
4222 catch( std::exception& ex ) {
4223 convertException<OMT1,OMT2>( ex );
4224 }
4225
4226 checkResults<OMT1,OMT2>();
4227 }
4228 }
4229 #endif
4230 }
4231 //*************************************************************************************************
4232
4233
4234 //*************************************************************************************************
4235 /*!\brief Testing the transpose sparse matrix/dense matrix Kronecker product.
4236 //
4237 // \return void
4238 // \exception std::runtime_error Kronecker product error detected.
4239 //
4240 // This function tests the transpose matrix Kronecker product with plain assignment. In case
4241 // any error resulting from the Kronecker product or the subsequent assignment is detected, a
4242 // \a std::runtime_error exception is thrown.
4243 */
4244 template< typename MT1 // Type of the left-hand side sparse matrix
4245 , typename MT2 > // Type of the right-hand side dense matrix
testTransOperation()4246 void OperationTest<MT1,MT2>::testTransOperation()
4247 {
4248 #if BLAZETEST_MATHTEST_TEST_TRANS_OPERATION
4249 if( BLAZETEST_MATHTEST_TEST_TRANS_OPERATION > 1 )
4250 {
4251 //=====================================================================================
4252 // Transpose Kronecker product
4253 //=====================================================================================
4254
4255 // Transpose Kronecker product with the given matrices
4256 {
4257 test_ = "Transpose Kronecker product with the given matrices";
4258 error_ = "Failed Kronecker product operation";
4259
4260 try {
4261 initTransposeResults();
4262 tdres_ = trans( kron( lhs_, rhs_ ) );
4263 todres_ = trans( kron( lhs_, rhs_ ) );
4264 tsres_ = trans( kron( lhs_, rhs_ ) );
4265 tosres_ = trans( kron( lhs_, rhs_ ) );
4266 refres_ = trans( kron( reflhs_, refrhs_ ) );
4267 }
4268 catch( std::exception& ex ) {
4269 convertException<MT1,MT2>( ex );
4270 }
4271
4272 checkTransposeResults<MT1,MT2>();
4273
4274 try {
4275 initTransposeResults();
4276 tdres_ = trans( kron( lhs_, orhs_ ) );
4277 todres_ = trans( kron( lhs_, orhs_ ) );
4278 tsres_ = trans( kron( lhs_, orhs_ ) );
4279 tosres_ = trans( kron( lhs_, orhs_ ) );
4280 refres_ = trans( kron( reflhs_, refrhs_ ) );
4281 }
4282 catch( std::exception& ex ) {
4283 convertException<MT1,OMT2>( ex );
4284 }
4285
4286 checkTransposeResults<MT1,OMT2>();
4287
4288 try {
4289 initTransposeResults();
4290 tdres_ = trans( kron( olhs_, rhs_ ) );
4291 todres_ = trans( kron( olhs_, rhs_ ) );
4292 tsres_ = trans( kron( olhs_, rhs_ ) );
4293 tosres_ = trans( kron( olhs_, rhs_ ) );
4294 refres_ = trans( kron( reflhs_, refrhs_ ) );
4295 }
4296 catch( std::exception& ex ) {
4297 convertException<OMT1,MT2>( ex );
4298 }
4299
4300 checkTransposeResults<OMT1,MT2>();
4301
4302 try {
4303 initTransposeResults();
4304 tdres_ = trans( kron( olhs_, orhs_ ) );
4305 todres_ = trans( kron( olhs_, orhs_ ) );
4306 tsres_ = trans( kron( olhs_, orhs_ ) );
4307 tosres_ = trans( kron( olhs_, orhs_ ) );
4308 refres_ = trans( kron( reflhs_, refrhs_ ) );
4309 }
4310 catch( std::exception& ex ) {
4311 convertException<OMT1,OMT2>( ex );
4312 }
4313
4314 checkTransposeResults<OMT1,OMT2>();
4315 }
4316
4317 // Transpose Kronecker product with evaluated matrices
4318 {
4319 test_ = "Transpose Kronecker product with evaluated matrices";
4320 error_ = "Failed Kronecker product operation";
4321
4322 try {
4323 initTransposeResults();
4324 tdres_ = trans( kron( eval( lhs_ ), eval( rhs_ ) ) );
4325 todres_ = trans( kron( eval( lhs_ ), eval( rhs_ ) ) );
4326 tsres_ = trans( kron( eval( lhs_ ), eval( rhs_ ) ) );
4327 tosres_ = trans( kron( eval( lhs_ ), eval( rhs_ ) ) );
4328 refres_ = trans( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
4329 }
4330 catch( std::exception& ex ) {
4331 convertException<MT1,MT2>( ex );
4332 }
4333
4334 checkTransposeResults<MT1,MT2>();
4335
4336 try {
4337 initTransposeResults();
4338 tdres_ = trans( kron( eval( lhs_ ), eval( orhs_ ) ) );
4339 todres_ = trans( kron( eval( lhs_ ), eval( orhs_ ) ) );
4340 tsres_ = trans( kron( eval( lhs_ ), eval( orhs_ ) ) );
4341 tosres_ = trans( kron( eval( lhs_ ), eval( orhs_ ) ) );
4342 refres_ = trans( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
4343 }
4344 catch( std::exception& ex ) {
4345 convertException<MT1,OMT2>( ex );
4346 }
4347
4348 checkTransposeResults<MT1,OMT2>();
4349
4350 try {
4351 initTransposeResults();
4352 tdres_ = trans( kron( eval( olhs_ ), eval( rhs_ ) ) );
4353 todres_ = trans( kron( eval( olhs_ ), eval( rhs_ ) ) );
4354 tsres_ = trans( kron( eval( olhs_ ), eval( rhs_ ) ) );
4355 tosres_ = trans( kron( eval( olhs_ ), eval( rhs_ ) ) );
4356 refres_ = trans( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
4357 }
4358 catch( std::exception& ex ) {
4359 convertException<OMT1,MT2>( ex );
4360 }
4361
4362 checkTransposeResults<OMT1,MT2>();
4363
4364 try {
4365 initTransposeResults();
4366 tdres_ = trans( kron( eval( olhs_ ), eval( orhs_ ) ) );
4367 todres_ = trans( kron( eval( olhs_ ), eval( orhs_ ) ) );
4368 tsres_ = trans( kron( eval( olhs_ ), eval( orhs_ ) ) );
4369 tosres_ = trans( kron( eval( olhs_ ), eval( orhs_ ) ) );
4370 refres_ = trans( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
4371 }
4372 catch( std::exception& ex ) {
4373 convertException<OMT1,OMT2>( ex );
4374 }
4375
4376 checkTransposeResults<OMT1,OMT2>();
4377 }
4378 }
4379 #endif
4380 }
4381 //*************************************************************************************************
4382
4383
4384 //*************************************************************************************************
4385 /*!\brief Testing the conjugate transpose sparse matrix/dense matrix Kronecker product.
4386 //
4387 // \return void
4388 // \exception std::runtime_error Kronecker product error detected.
4389 //
4390 // This function tests the conjugate transpose matrix Kronecker product with plain assignment. In
4391 // case any error resulting from the Kronecker product or the subsequent assignment is detected,
4392 // a \a std::runtime_error exception is thrown.
4393 */
4394 template< typename MT1 // Type of the left-hand side sparse matrix
4395 , typename MT2 > // Type of the right-hand side dense matrix
testCTransOperation()4396 void OperationTest<MT1,MT2>::testCTransOperation()
4397 {
4398 #if BLAZETEST_MATHTEST_TEST_CTRANS_OPERATION
4399 if( BLAZETEST_MATHTEST_TEST_CTRANS_OPERATION > 1 )
4400 {
4401 //=====================================================================================
4402 // Conjugate transpose Kronecker product
4403 //=====================================================================================
4404
4405 // Conjugate transpose Kronecker product with the given matrices
4406 {
4407 test_ = "Conjugate transpose Kronecker product with the given matrices";
4408 error_ = "Failed Kronecker product operation";
4409
4410 try {
4411 initTransposeResults();
4412 tdres_ = ctrans( kron( lhs_, rhs_ ) );
4413 todres_ = ctrans( kron( lhs_, rhs_ ) );
4414 tsres_ = ctrans( kron( lhs_, rhs_ ) );
4415 tosres_ = ctrans( kron( lhs_, rhs_ ) );
4416 refres_ = ctrans( kron( reflhs_, refrhs_ ) );
4417 }
4418 catch( std::exception& ex ) {
4419 convertException<MT1,MT2>( ex );
4420 }
4421
4422 checkTransposeResults<MT1,MT2>();
4423
4424 try {
4425 initTransposeResults();
4426 tdres_ = ctrans( kron( lhs_, orhs_ ) );
4427 todres_ = ctrans( kron( lhs_, orhs_ ) );
4428 tsres_ = ctrans( kron( lhs_, orhs_ ) );
4429 tosres_ = ctrans( kron( lhs_, orhs_ ) );
4430 refres_ = ctrans( kron( reflhs_, refrhs_ ) );
4431 }
4432 catch( std::exception& ex ) {
4433 convertException<MT1,OMT2>( ex );
4434 }
4435
4436 checkTransposeResults<MT1,OMT2>();
4437
4438 try {
4439 initTransposeResults();
4440 tdres_ = ctrans( kron( olhs_, rhs_ ) );
4441 todres_ = ctrans( kron( olhs_, rhs_ ) );
4442 tsres_ = ctrans( kron( olhs_, rhs_ ) );
4443 tosres_ = ctrans( kron( olhs_, rhs_ ) );
4444 refres_ = ctrans( kron( reflhs_, refrhs_ ) );
4445 }
4446 catch( std::exception& ex ) {
4447 convertException<OMT1,MT2>( ex );
4448 }
4449
4450 checkTransposeResults<OMT1,MT2>();
4451
4452 try {
4453 initTransposeResults();
4454 tdres_ = ctrans( kron( olhs_, orhs_ ) );
4455 todres_ = ctrans( kron( olhs_, orhs_ ) );
4456 tsres_ = ctrans( kron( olhs_, orhs_ ) );
4457 tosres_ = ctrans( kron( olhs_, orhs_ ) );
4458 refres_ = ctrans( kron( reflhs_, refrhs_ ) );
4459 }
4460 catch( std::exception& ex ) {
4461 convertException<OMT1,OMT2>( ex );
4462 }
4463
4464 checkTransposeResults<OMT1,OMT2>();
4465 }
4466
4467 // Conjugate transpose Kronecker product with evaluated matrices
4468 {
4469 test_ = "Conjugate transpose Kronecker product with evaluated matrices";
4470 error_ = "Failed Kronecker product operation";
4471
4472 try {
4473 initTransposeResults();
4474 tdres_ = ctrans( kron( eval( lhs_ ), eval( rhs_ ) ) );
4475 todres_ = ctrans( kron( eval( lhs_ ), eval( rhs_ ) ) );
4476 tsres_ = ctrans( kron( eval( lhs_ ), eval( rhs_ ) ) );
4477 tosres_ = ctrans( kron( eval( lhs_ ), eval( rhs_ ) ) );
4478 refres_ = ctrans( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
4479 }
4480 catch( std::exception& ex ) {
4481 convertException<MT1,MT2>( ex );
4482 }
4483
4484 checkTransposeResults<MT1,MT2>();
4485
4486 try {
4487 initTransposeResults();
4488 tdres_ = ctrans( kron( eval( lhs_ ), eval( orhs_ ) ) );
4489 todres_ = ctrans( kron( eval( lhs_ ), eval( orhs_ ) ) );
4490 tsres_ = ctrans( kron( eval( lhs_ ), eval( orhs_ ) ) );
4491 tosres_ = ctrans( kron( eval( lhs_ ), eval( orhs_ ) ) );
4492 refres_ = ctrans( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
4493 }
4494 catch( std::exception& ex ) {
4495 convertException<MT1,OMT2>( ex );
4496 }
4497
4498 checkTransposeResults<MT1,OMT2>();
4499
4500 try {
4501 initTransposeResults();
4502 tdres_ = ctrans( kron( eval( olhs_ ), eval( rhs_ ) ) );
4503 todres_ = ctrans( kron( eval( olhs_ ), eval( rhs_ ) ) );
4504 tsres_ = ctrans( kron( eval( olhs_ ), eval( rhs_ ) ) );
4505 tosres_ = ctrans( kron( eval( olhs_ ), eval( rhs_ ) ) );
4506 refres_ = ctrans( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
4507 }
4508 catch( std::exception& ex ) {
4509 convertException<OMT1,MT2>( ex );
4510 }
4511
4512 checkTransposeResults<OMT1,MT2>();
4513
4514 try {
4515 initTransposeResults();
4516 tdres_ = ctrans( kron( eval( olhs_ ), eval( orhs_ ) ) );
4517 todres_ = ctrans( kron( eval( olhs_ ), eval( orhs_ ) ) );
4518 tsres_ = ctrans( kron( eval( olhs_ ), eval( orhs_ ) ) );
4519 tosres_ = ctrans( kron( eval( olhs_ ), eval( orhs_ ) ) );
4520 refres_ = ctrans( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
4521 }
4522 catch( std::exception& ex ) {
4523 convertException<OMT1,OMT2>( ex );
4524 }
4525
4526 checkTransposeResults<OMT1,OMT2>();
4527 }
4528 }
4529 #endif
4530 }
4531 //*************************************************************************************************
4532
4533
4534 //*************************************************************************************************
4535 /*!\brief Testing the abs sparse matrix/dense matrix Kronecker product.
4536 //
4537 // \return void
4538 // \exception std::runtime_error Kronecker product error detected.
4539 //
4540 // This function tests the abs matrix Kronecker product with plain assignment, addition
4541 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4542 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
4543 // exception is thrown.
4544 */
4545 template< typename MT1 // Type of the left-hand side sparse matrix
4546 , typename MT2 > // Type of the right-hand side dense matrix
testAbsOperation()4547 void OperationTest<MT1,MT2>::testAbsOperation()
4548 {
4549 #if BLAZETEST_MATHTEST_TEST_ABS_OPERATION
4550 if( BLAZETEST_MATHTEST_TEST_ABS_OPERATION > 1 )
4551 {
4552 testCustomOperation( blaze::Abs(), "abs" );
4553 }
4554 #endif
4555 }
4556 //*************************************************************************************************
4557
4558
4559 //*************************************************************************************************
4560 /*!\brief Testing the conjugate sparse matrix/dense matrix Kronecker product.
4561 //
4562 // \return void
4563 // \exception std::runtime_error Kronecker product error detected.
4564 //
4565 // This function tests the conjugate matrix Kronecker product with plain assignment, addition
4566 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4567 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
4568 // exception is thrown.
4569 */
4570 template< typename MT1 // Type of the left-hand side sparse matrix
4571 , typename MT2 > // Type of the right-hand side dense matrix
testConjOperation()4572 void OperationTest<MT1,MT2>::testConjOperation()
4573 {
4574 #if BLAZETEST_MATHTEST_TEST_CONJ_OPERATION
4575 if( BLAZETEST_MATHTEST_TEST_CONJ_OPERATION > 1 )
4576 {
4577 testCustomOperation( blaze::Conj(), "conj" );
4578 }
4579 #endif
4580 }
4581 //*************************************************************************************************
4582
4583
4584 //*************************************************************************************************
4585 /*!\brief Testing the \a real sparse matrix/dense matrix Kronecker product.
4586 //
4587 // \return void
4588 // \exception std::runtime_error Kronecker product error detected.
4589 //
4590 // This function tests the \a real matrix Kronecker product with plain assignment, addition
4591 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4592 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
4593 // exception is thrown.
4594 */
4595 template< typename MT1 // Type of the left-hand side sparse matrix
4596 , typename MT2 > // Type of the right-hand side dense matrix
testRealOperation()4597 void OperationTest<MT1,MT2>::testRealOperation()
4598 {
4599 #if BLAZETEST_MATHTEST_TEST_REAL_OPERATION
4600 if( BLAZETEST_MATHTEST_TEST_REAL_OPERATION > 1 )
4601 {
4602 testCustomOperation( blaze::Real(), "real" );
4603 }
4604 #endif
4605 }
4606 //*************************************************************************************************
4607
4608
4609 //*************************************************************************************************
4610 /*!\brief Testing the \a imag sparse matrix/dense matrix Kronecker product.
4611 //
4612 // \return void
4613 // \exception std::runtime_error Kronecker product error detected.
4614 //
4615 // This function tests the \a imag matrix Kronecker product with plain assignment, addition
4616 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4617 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
4618 // exception is thrown.
4619 */
4620 template< typename MT1 // Type of the left-hand side sparse matrix
4621 , typename MT2 > // Type of the right-hand side dense matrix
testImagOperation()4622 void OperationTest<MT1,MT2>::testImagOperation()
4623 {
4624 #if BLAZETEST_MATHTEST_TEST_IMAG_OPERATION
4625 if( BLAZETEST_MATHTEST_TEST_IMAG_OPERATION > 1 &&
4626 ( !blaze::IsHermitian<DRE>::value || blaze::isSymmetric( imag( kron( lhs_, rhs_ ) ) ) ) )
4627 {
4628 testCustomOperation( blaze::Imag(), "imag" );
4629 }
4630 #endif
4631 }
4632 //*************************************************************************************************
4633
4634
4635 //*************************************************************************************************
4636 /*!\brief Testing the evaluated sparse matrix/dense matrix Kronecker product.
4637 //
4638 // \return void
4639 // \exception std::runtime_error Kronecker product error detected.
4640 //
4641 // This function tests the evaluated matrix Kronecker product with plain assignment, addition
4642 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4643 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
4644 // exception is thrown.
4645 */
4646 template< typename MT1 // Type of the left-hand side sparse matrix
4647 , typename MT2 > // Type of the right-hand side dense matrix
testEvalOperation()4648 void OperationTest<MT1,MT2>::testEvalOperation()
4649 {
4650 #if BLAZETEST_MATHTEST_TEST_EVAL_OPERATION
4651 if( BLAZETEST_MATHTEST_TEST_EVAL_OPERATION > 1 )
4652 {
4653 testCustomOperation( blaze::Eval(), "eval" );
4654 }
4655 #endif
4656 }
4657 //*************************************************************************************************
4658
4659
4660 //*************************************************************************************************
4661 /*!\brief Testing the serialized sparse matrix/dense matrix Kronecker product.
4662 //
4663 // \return void
4664 // \exception std::runtime_error Kronecker product error detected.
4665 //
4666 // This function tests the serialized matrix Kronecker product with plain assignment, addition
4667 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4668 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
4669 // exception is thrown.
4670 */
4671 template< typename MT1 // Type of the left-hand side sparse matrix
4672 , typename MT2 > // Type of the right-hand side dense matrix
testSerialOperation()4673 void OperationTest<MT1,MT2>::testSerialOperation()
4674 {
4675 #if BLAZETEST_MATHTEST_TEST_SERIAL_OPERATION
4676 if( BLAZETEST_MATHTEST_TEST_SERIAL_OPERATION > 1 )
4677 {
4678 testCustomOperation( blaze::Serial(), "serial" );
4679 }
4680 #endif
4681 }
4682 //*************************************************************************************************
4683
4684
4685 //*************************************************************************************************
4686 /*!\brief Testing the non-aliased sparse matrix/dense matrix Kronecker product.
4687 //
4688 // \return void
4689 // \exception std::runtime_error Kronecker product error detected.
4690 //
4691 // This function tests the non-aliased matrix Kronecker product with plain assignment, addition
4692 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4693 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
4694 // exception is thrown.
4695 */
4696 template< typename MT1 // Type of the left-hand side sparse matrix
4697 , typename MT2 > // Type of the right-hand side dense matrix
testNoAliasOperation()4698 void OperationTest<MT1,MT2>::testNoAliasOperation()
4699 {
4700 #if BLAZETEST_MATHTEST_TEST_NOALIAS_OPERATION
4701 if( BLAZETEST_MATHTEST_TEST_NOALIAS_OPERATION > 1 )
4702 {
4703 testCustomOperation( blaze::NoAlias(), "noalias" );
4704 }
4705 #endif
4706 }
4707 //*************************************************************************************************
4708
4709
4710 //*************************************************************************************************
4711 /*!\brief Testing the non-SIMD sparse matrix/dense matrix Kronecker product.
4712 //
4713 // \return void
4714 // \exception std::runtime_error Kronecker product error detected.
4715 //
4716 // This function tests the non-SIMD matrix Kronecker product with plain assignment, addition
4717 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4718 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
4719 // exception is thrown.
4720 */
4721 template< typename MT1 // Type of the left-hand side sparse matrix
4722 , typename MT2 > // Type of the right-hand side dense matrix
testNoSIMDOperation()4723 void OperationTest<MT1,MT2>::testNoSIMDOperation()
4724 {
4725 #if BLAZETEST_MATHTEST_TEST_NOSIMD_OPERATION
4726 if( BLAZETEST_MATHTEST_TEST_NOSIMD_OPERATION > 1 )
4727 {
4728 testCustomOperation( blaze::NoSIMD(), "nosimd" );
4729 }
4730 #endif
4731 }
4732 //*************************************************************************************************
4733
4734
4735 //*************************************************************************************************
4736 /*!\brief Testing the symmetric sparse matrix/dense matrix Kronecker product.
4737 //
4738 // \return void
4739 // \exception std::runtime_error Kronecker product error detected.
4740 //
4741 // This function tests the symmetric matrix Kronecker product with plain assignment, addition
4742 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
4743 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
4744 // exception is thrown.
4745 */
4746 template< typename MT1 // Type of the left-hand side sparse matrix
4747 , typename MT2 > // Type of the right-hand side dense matrix
testDeclSymOperation(blaze::TrueType)4748 void OperationTest<MT1,MT2>::testDeclSymOperation( blaze::TrueType )
4749 {
4750 #if BLAZETEST_MATHTEST_TEST_DECLSYM_OPERATION
4751 if( BLAZETEST_MATHTEST_TEST_DECLSYM_OPERATION > 1 )
4752 {
4753 if( ( !blaze::IsDiagonal<MT1>::value && blaze::IsTriangular<MT1>::value ) ||
4754 ( !blaze::IsDiagonal<MT2>::value && blaze::IsTriangular<MT2>::value ) ||
4755 ( !blaze::IsDiagonal<MT1>::value && blaze::IsHermitian<MT1>::value && blaze::IsComplex<ET1>::value ) ||
4756 ( !blaze::IsDiagonal<MT2>::value && blaze::IsHermitian<MT2>::value && blaze::IsComplex<ET2>::value ) ||
4757 ( lhs_.rows() != lhs_.columns() ) ||
4758 ( rhs_.rows() != rhs_.columns() ) )
4759 return;
4760
4761
4762 //=====================================================================================
4763 // Test-specific setup of the left-hand side operand
4764 //=====================================================================================
4765
4766 MT1 lhs ( lhs_ * trans( lhs_ ) );
4767 OMT1 olhs ( lhs );
4768 RT1 reflhs( lhs );
4769
4770
4771 //=====================================================================================
4772 // Test-specific setup of the right-hand side operand
4773 //=====================================================================================
4774
4775 MT2 rhs ( rhs_ * trans( rhs_ ) );
4776 OMT2 orhs ( rhs );
4777 RT2 refrhs( rhs );
4778
4779
4780 //=====================================================================================
4781 // Declsym Kronecker product
4782 //=====================================================================================
4783
4784 // Declsym Kronecker product with the given matrices
4785 {
4786 test_ = "Declsym Kronecker product with the given matrices";
4787 error_ = "Failed Kronecker product operation";
4788
4789 try {
4790 initResults();
4791 dres_ = declsym( kron( lhs, rhs ) );
4792 odres_ = declsym( kron( lhs, rhs ) );
4793 sres_ = declsym( kron( lhs, rhs ) );
4794 osres_ = declsym( kron( lhs, rhs ) );
4795 refres_ = declsym( kron( reflhs, refrhs ) );
4796 }
4797 catch( std::exception& ex ) {
4798 convertException<MT1,MT2>( ex );
4799 }
4800
4801 checkResults<MT1,MT2>();
4802
4803 try {
4804 initResults();
4805 dres_ = declsym( kron( lhs, orhs ) );
4806 odres_ = declsym( kron( lhs, orhs ) );
4807 sres_ = declsym( kron( lhs, orhs ) );
4808 osres_ = declsym( kron( lhs, orhs ) );
4809 refres_ = declsym( kron( reflhs, refrhs ) );
4810 }
4811 catch( std::exception& ex ) {
4812 convertException<MT1,OMT2>( ex );
4813 }
4814
4815 checkResults<MT1,OMT2>();
4816
4817 try {
4818 initResults();
4819 dres_ = declsym( kron( olhs, rhs ) );
4820 odres_ = declsym( kron( olhs, rhs ) );
4821 sres_ = declsym( kron( olhs, rhs ) );
4822 osres_ = declsym( kron( olhs, rhs ) );
4823 refres_ = declsym( kron( reflhs, refrhs ) );
4824 }
4825 catch( std::exception& ex ) {
4826 convertException<OMT1,MT2>( ex );
4827 }
4828
4829 checkResults<OMT1,MT2>();
4830
4831 try {
4832 initResults();
4833 dres_ = declsym( kron( olhs, orhs ) );
4834 odres_ = declsym( kron( olhs, orhs ) );
4835 sres_ = declsym( kron( olhs, orhs ) );
4836 osres_ = declsym( kron( olhs, orhs ) );
4837 refres_ = declsym( kron( reflhs, refrhs ) );
4838 }
4839 catch( std::exception& ex ) {
4840 convertException<OMT1,OMT2>( ex );
4841 }
4842
4843 checkResults<OMT1,OMT2>();
4844 }
4845
4846 // Declsym Kronecker product with evaluated matrices
4847 {
4848 test_ = "Declsym Kronecker product with evaluated left-hand side matrix";
4849 error_ = "Failed Kronecker product operation";
4850
4851 try {
4852 initResults();
4853 dres_ = declsym( kron( eval( lhs ), eval( rhs ) ) );
4854 odres_ = declsym( kron( eval( lhs ), eval( rhs ) ) );
4855 sres_ = declsym( kron( eval( lhs ), eval( rhs ) ) );
4856 osres_ = declsym( kron( eval( lhs ), eval( rhs ) ) );
4857 refres_ = declsym( kron( eval( reflhs ), eval( refrhs ) ) );
4858 }
4859 catch( std::exception& ex ) {
4860 convertException<MT1,MT2>( ex );
4861 }
4862
4863 checkResults<MT1,MT2>();
4864
4865 try {
4866 initResults();
4867 dres_ = declsym( kron( eval( lhs ), eval( orhs ) ) );
4868 odres_ = declsym( kron( eval( lhs ), eval( orhs ) ) );
4869 sres_ = declsym( kron( eval( lhs ), eval( orhs ) ) );
4870 osres_ = declsym( kron( eval( lhs ), eval( orhs ) ) );
4871 refres_ = declsym( kron( eval( reflhs ), eval( refrhs ) ) );
4872 }
4873 catch( std::exception& ex ) {
4874 convertException<MT1,OMT2>( ex );
4875 }
4876
4877 checkResults<MT1,OMT2>();
4878
4879 try {
4880 initResults();
4881 dres_ = declsym( kron( eval( olhs ), eval( rhs ) ) );
4882 odres_ = declsym( kron( eval( olhs ), eval( rhs ) ) );
4883 sres_ = declsym( kron( eval( olhs ), eval( rhs ) ) );
4884 osres_ = declsym( kron( eval( olhs ), eval( rhs ) ) );
4885 refres_ = declsym( kron( eval( reflhs ), eval( refrhs ) ) );
4886 }
4887 catch( std::exception& ex ) {
4888 convertException<OMT1,MT2>( ex );
4889 }
4890
4891 checkResults<OMT1,MT2>();
4892
4893 try {
4894 initResults();
4895 dres_ = declsym( kron( eval( olhs ), eval( orhs ) ) );
4896 odres_ = declsym( kron( eval( olhs ), eval( orhs ) ) );
4897 sres_ = declsym( kron( eval( olhs ), eval( orhs ) ) );
4898 osres_ = declsym( kron( eval( olhs ), eval( orhs ) ) );
4899 refres_ = declsym( kron( eval( reflhs ), eval( refrhs ) ) );
4900 }
4901 catch( std::exception& ex ) {
4902 convertException<OMT1,OMT2>( ex );
4903 }
4904
4905 checkResults<OMT1,OMT2>();
4906 }
4907
4908
4909 //=====================================================================================
4910 // Declsym Kronecker product with addition assignment
4911 //=====================================================================================
4912
4913 // Declsym Kronecker product with addition assignment with the given matrices
4914 {
4915 test_ = "Declsym Kronecker product with addition assignment with the given matrices";
4916 error_ = "Failed addition assignment operation";
4917
4918 try {
4919 initResults();
4920 dres_ += declsym( kron( lhs, rhs ) );
4921 odres_ += declsym( kron( lhs, rhs ) );
4922 sres_ += declsym( kron( lhs, rhs ) );
4923 osres_ += declsym( kron( lhs, rhs ) );
4924 refres_ += declsym( kron( reflhs, refrhs ) );
4925 }
4926 catch( std::exception& ex ) {
4927 convertException<MT1,MT2>( ex );
4928 }
4929
4930 checkResults<MT1,MT2>();
4931
4932 try {
4933 initResults();
4934 dres_ += declsym( kron( lhs, orhs ) );
4935 odres_ += declsym( kron( lhs, orhs ) );
4936 sres_ += declsym( kron( lhs, orhs ) );
4937 osres_ += declsym( kron( lhs, orhs ) );
4938 refres_ += declsym( kron( reflhs, refrhs ) );
4939 }
4940 catch( std::exception& ex ) {
4941 convertException<MT1,OMT2>( ex );
4942 }
4943
4944 checkResults<MT1,OMT2>();
4945
4946 try {
4947 initResults();
4948 dres_ += declsym( kron( olhs, rhs ) );
4949 odres_ += declsym( kron( olhs, rhs ) );
4950 sres_ += declsym( kron( olhs, rhs ) );
4951 osres_ += declsym( kron( olhs, rhs ) );
4952 refres_ += declsym( kron( reflhs, refrhs ) );
4953 }
4954 catch( std::exception& ex ) {
4955 convertException<OMT1,MT2>( ex );
4956 }
4957
4958 checkResults<OMT1,MT2>();
4959
4960 try {
4961 initResults();
4962 dres_ += declsym( kron( olhs, orhs ) );
4963 odres_ += declsym( kron( olhs, orhs ) );
4964 sres_ += declsym( kron( olhs, orhs ) );
4965 osres_ += declsym( kron( olhs, orhs ) );
4966 refres_ += declsym( kron( reflhs, refrhs ) );
4967 }
4968 catch( std::exception& ex ) {
4969 convertException<OMT1,OMT2>( ex );
4970 }
4971
4972 checkResults<OMT1,OMT2>();
4973 }
4974
4975 // Declsym Kronecker product with addition assignment with evaluated matrices
4976 {
4977 test_ = "Declsym Kronecker product with addition assignment with evaluated matrices";
4978 error_ = "Failed addition assignment operation";
4979
4980 try {
4981 initResults();
4982 dres_ += declsym( kron( eval( lhs ), eval( rhs ) ) );
4983 odres_ += declsym( kron( eval( lhs ), eval( rhs ) ) );
4984 sres_ += declsym( kron( eval( lhs ), eval( rhs ) ) );
4985 osres_ += declsym( kron( eval( lhs ), eval( rhs ) ) );
4986 refres_ += declsym( kron( eval( reflhs ), eval( refrhs ) ) );
4987 }
4988 catch( std::exception& ex ) {
4989 convertException<MT1,MT2>( ex );
4990 }
4991
4992 checkResults<MT1,MT2>();
4993
4994 try {
4995 initResults();
4996 dres_ += declsym( kron( eval( lhs ), eval( orhs ) ) );
4997 odres_ += declsym( kron( eval( lhs ), eval( orhs ) ) );
4998 sres_ += declsym( kron( eval( lhs ), eval( orhs ) ) );
4999 osres_ += declsym( kron( eval( lhs ), eval( orhs ) ) );
5000 refres_ += declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5001 }
5002 catch( std::exception& ex ) {
5003 convertException<MT1,OMT2>( ex );
5004 }
5005
5006 checkResults<MT1,OMT2>();
5007
5008 try {
5009 initResults();
5010 dres_ += declsym( kron( eval( olhs ), eval( rhs ) ) );
5011 odres_ += declsym( kron( eval( olhs ), eval( rhs ) ) );
5012 sres_ += declsym( kron( eval( olhs ), eval( rhs ) ) );
5013 osres_ += declsym( kron( eval( olhs ), eval( rhs ) ) );
5014 refres_ += declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5015 }
5016 catch( std::exception& ex ) {
5017 convertException<OMT1,MT2>( ex );
5018 }
5019
5020 checkResults<OMT1,MT2>();
5021
5022 try {
5023 initResults();
5024 dres_ += declsym( kron( eval( olhs ), eval( orhs ) ) );
5025 odres_ += declsym( kron( eval( olhs ), eval( orhs ) ) );
5026 sres_ += declsym( kron( eval( olhs ), eval( orhs ) ) );
5027 osres_ += declsym( kron( eval( olhs ), eval( orhs ) ) );
5028 refres_ += declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5029 }
5030 catch( std::exception& ex ) {
5031 convertException<OMT1,OMT2>( ex );
5032 }
5033
5034 checkResults<OMT1,OMT2>();
5035 }
5036
5037
5038 //=====================================================================================
5039 // Declsym Kronecker product with subtraction assignment
5040 //=====================================================================================
5041
5042 // Declsym Kronecker product with subtraction assignment with the given matrices
5043 {
5044 test_ = "Declsym Kronecker product with subtraction assignment with the given matrices";
5045 error_ = "Failed subtraction assignment operation";
5046
5047 try {
5048 initResults();
5049 dres_ -= declsym( kron( lhs, rhs ) );
5050 odres_ -= declsym( kron( lhs, rhs ) );
5051 sres_ -= declsym( kron( lhs, rhs ) );
5052 osres_ -= declsym( kron( lhs, rhs ) );
5053 refres_ -= declsym( kron( reflhs, refrhs ) );
5054 }
5055 catch( std::exception& ex ) {
5056 convertException<MT1,MT2>( ex );
5057 }
5058
5059 checkResults<MT1,MT2>();
5060
5061 try {
5062 initResults();
5063 dres_ -= declsym( kron( lhs, orhs ) );
5064 odres_ -= declsym( kron( lhs, orhs ) );
5065 sres_ -= declsym( kron( lhs, orhs ) );
5066 osres_ -= declsym( kron( lhs, orhs ) );
5067 refres_ -= declsym( kron( reflhs, refrhs ) );
5068 }
5069 catch( std::exception& ex ) {
5070 convertException<MT1,OMT2>( ex );
5071 }
5072
5073 checkResults<MT1,OMT2>();
5074
5075 try {
5076 initResults();
5077 dres_ -= declsym( kron( olhs, rhs ) );
5078 odres_ -= declsym( kron( olhs, rhs ) );
5079 sres_ -= declsym( kron( olhs, rhs ) );
5080 osres_ -= declsym( kron( olhs, rhs ) );
5081 refres_ -= declsym( kron( reflhs, refrhs ) );
5082 }
5083 catch( std::exception& ex ) {
5084 convertException<OMT1,MT2>( ex );
5085 }
5086
5087 checkResults<OMT1,MT2>();
5088
5089 try {
5090 initResults();
5091 dres_ -= declsym( kron( olhs, orhs ) );
5092 odres_ -= declsym( kron( olhs, orhs ) );
5093 sres_ -= declsym( kron( olhs, orhs ) );
5094 osres_ -= declsym( kron( olhs, orhs ) );
5095 refres_ -= declsym( kron( reflhs, refrhs ) );
5096 }
5097 catch( std::exception& ex ) {
5098 convertException<OMT1,OMT2>( ex );
5099 }
5100
5101 checkResults<OMT1,OMT2>();
5102 }
5103
5104 // Declsym Kronecker product with subtraction assignment with evaluated matrices
5105 {
5106 test_ = "Declsym Kronecker product with subtraction assignment with evaluated matrices";
5107 error_ = "Failed subtraction assignment operation";
5108
5109 try {
5110 initResults();
5111 dres_ -= declsym( kron( eval( lhs ), eval( rhs ) ) );
5112 odres_ -= declsym( kron( eval( lhs ), eval( rhs ) ) );
5113 sres_ -= declsym( kron( eval( lhs ), eval( rhs ) ) );
5114 osres_ -= declsym( kron( eval( lhs ), eval( rhs ) ) );
5115 refres_ -= declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5116 }
5117 catch( std::exception& ex ) {
5118 convertException<MT1,MT2>( ex );
5119 }
5120
5121 checkResults<MT1,MT2>();
5122
5123 try {
5124 initResults();
5125 dres_ -= declsym( kron( eval( lhs ), eval( orhs ) ) );
5126 odres_ -= declsym( kron( eval( lhs ), eval( orhs ) ) );
5127 sres_ -= declsym( kron( eval( lhs ), eval( orhs ) ) );
5128 osres_ -= declsym( kron( eval( lhs ), eval( orhs ) ) );
5129 refres_ -= declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5130 }
5131 catch( std::exception& ex ) {
5132 convertException<MT1,OMT2>( ex );
5133 }
5134
5135 checkResults<MT1,OMT2>();
5136
5137 try {
5138 initResults();
5139 dres_ -= declsym( kron( eval( olhs ), eval( rhs ) ) );
5140 odres_ -= declsym( kron( eval( olhs ), eval( rhs ) ) );
5141 sres_ -= declsym( kron( eval( olhs ), eval( rhs ) ) );
5142 osres_ -= declsym( kron( eval( olhs ), eval( rhs ) ) );
5143 refres_ -= declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5144 }
5145 catch( std::exception& ex ) {
5146 convertException<OMT1,MT2>( ex );
5147 }
5148
5149 checkResults<OMT1,MT2>();
5150
5151 try {
5152 initResults();
5153 dres_ -= declsym( kron( eval( olhs ), eval( orhs ) ) );
5154 odres_ -= declsym( kron( eval( olhs ), eval( orhs ) ) );
5155 sres_ -= declsym( kron( eval( olhs ), eval( orhs ) ) );
5156 osres_ -= declsym( kron( eval( olhs ), eval( orhs ) ) );
5157 refres_ -= declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5158 }
5159 catch( std::exception& ex ) {
5160 convertException<OMT1,OMT2>( ex );
5161 }
5162
5163 checkResults<OMT1,OMT2>();
5164 }
5165
5166
5167 //=====================================================================================
5168 // Declsym Kronecker product with Schur product assignment
5169 //=====================================================================================
5170
5171 // Declsym Kronecker product with Schur product assignment with the given matrices
5172 {
5173 test_ = "Declsym Kronecker product with Schur product assignment with the given matrices";
5174 error_ = "Failed Schur product assignment operation";
5175
5176 try {
5177 initResults();
5178 dres_ %= declsym( kron( lhs, rhs ) );
5179 odres_ %= declsym( kron( lhs, rhs ) );
5180 sres_ %= declsym( kron( lhs, rhs ) );
5181 osres_ %= declsym( kron( lhs, rhs ) );
5182 refres_ %= declsym( kron( reflhs, refrhs ) );
5183 }
5184 catch( std::exception& ex ) {
5185 convertException<MT1,MT2>( ex );
5186 }
5187
5188 checkResults<MT1,MT2>();
5189
5190 try {
5191 initResults();
5192 dres_ %= declsym( kron( lhs, orhs ) );
5193 odres_ %= declsym( kron( lhs, orhs ) );
5194 sres_ %= declsym( kron( lhs, orhs ) );
5195 osres_ %= declsym( kron( lhs, orhs ) );
5196 refres_ %= declsym( kron( reflhs, refrhs ) );
5197 }
5198 catch( std::exception& ex ) {
5199 convertException<MT1,OMT2>( ex );
5200 }
5201
5202 checkResults<MT1,OMT2>();
5203
5204 try {
5205 initResults();
5206 dres_ %= declsym( kron( olhs, rhs ) );
5207 odres_ %= declsym( kron( olhs, rhs ) );
5208 sres_ %= declsym( kron( olhs, rhs ) );
5209 osres_ %= declsym( kron( olhs, rhs ) );
5210 refres_ %= declsym( kron( reflhs, refrhs ) );
5211 }
5212 catch( std::exception& ex ) {
5213 convertException<OMT1,MT2>( ex );
5214 }
5215
5216 checkResults<OMT1,MT2>();
5217
5218 try {
5219 initResults();
5220 dres_ %= declsym( kron( olhs, orhs ) );
5221 odres_ %= declsym( kron( olhs, orhs ) );
5222 sres_ %= declsym( kron( olhs, orhs ) );
5223 osres_ %= declsym( kron( olhs, orhs ) );
5224 refres_ %= declsym( kron( reflhs, refrhs ) );
5225 }
5226 catch( std::exception& ex ) {
5227 convertException<OMT1,OMT2>( ex );
5228 }
5229
5230 checkResults<OMT1,OMT2>();
5231 }
5232
5233 // Declsym Kronecker product with Schur product assignment with evaluated matrices
5234 {
5235 test_ = "Declsym Kronecker product with Schur product assignment with evaluated matrices";
5236 error_ = "Failed Schur product assignment operation";
5237
5238 try {
5239 initResults();
5240 dres_ %= declsym( kron( eval( lhs ), eval( rhs ) ) );
5241 odres_ %= declsym( kron( eval( lhs ), eval( rhs ) ) );
5242 sres_ %= declsym( kron( eval( lhs ), eval( rhs ) ) );
5243 osres_ %= declsym( kron( eval( lhs ), eval( rhs ) ) );
5244 refres_ %= declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5245 }
5246 catch( std::exception& ex ) {
5247 convertException<MT1,MT2>( ex );
5248 }
5249
5250 checkResults<MT1,MT2>();
5251
5252 try {
5253 initResults();
5254 dres_ %= declsym( kron( eval( lhs ), eval( orhs ) ) );
5255 odres_ %= declsym( kron( eval( lhs ), eval( orhs ) ) );
5256 sres_ %= declsym( kron( eval( lhs ), eval( orhs ) ) );
5257 osres_ %= declsym( kron( eval( lhs ), eval( orhs ) ) );
5258 refres_ %= declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5259 }
5260 catch( std::exception& ex ) {
5261 convertException<MT1,OMT2>( ex );
5262 }
5263
5264 checkResults<MT1,OMT2>();
5265
5266 try {
5267 initResults();
5268 dres_ %= declsym( kron( eval( olhs ), eval( rhs ) ) );
5269 odres_ %= declsym( kron( eval( olhs ), eval( rhs ) ) );
5270 sres_ %= declsym( kron( eval( olhs ), eval( rhs ) ) );
5271 osres_ %= declsym( kron( eval( olhs ), eval( rhs ) ) );
5272 refres_ %= declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5273 }
5274 catch( std::exception& ex ) {
5275 convertException<OMT1,MT2>( ex );
5276 }
5277
5278 checkResults<OMT1,MT2>();
5279
5280 try {
5281 initResults();
5282 dres_ %= declsym( kron( eval( olhs ), eval( orhs ) ) );
5283 odres_ %= declsym( kron( eval( olhs ), eval( orhs ) ) );
5284 sres_ %= declsym( kron( eval( olhs ), eval( orhs ) ) );
5285 osres_ %= declsym( kron( eval( olhs ), eval( orhs ) ) );
5286 refres_ %= declsym( kron( eval( reflhs ), eval( refrhs ) ) );
5287 }
5288 catch( std::exception& ex ) {
5289 convertException<OMT1,OMT2>( ex );
5290 }
5291
5292 checkResults<OMT1,OMT2>();
5293 }
5294 }
5295 #endif
5296 }
5297 //*************************************************************************************************
5298
5299
5300 //*************************************************************************************************
5301 /*!\brief Skipping the symmetric sparse matrix/dense matrix Kronecker product.
5302 //
5303 // \return void
5304 //
5305 // This function is called in case the symmetric matrix/matrix Kronecker product operation is not
5306 // available for the given matrix types \a MT1 and \a MT2.
5307 */
5308 template< typename MT1 // Type of the left-hand side sparse matrix
5309 , typename MT2 > // Type of the right-hand side dense matrix
testDeclSymOperation(blaze::FalseType)5310 void OperationTest<MT1,MT2>::testDeclSymOperation( blaze::FalseType )
5311 {}
5312 //*************************************************************************************************
5313
5314
5315 //*************************************************************************************************
5316 /*!\brief Testing the Hermitian sparse matrix/dense matrix Kronecker product.
5317 //
5318 // \return void
5319 // \exception std::runtime_error Kronecker product error detected.
5320 //
5321 // This function tests the Hermitian matrix Kronecker product with plain assignment, addition
5322 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
5323 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
5324 // exception is thrown.
5325 */
5326 template< typename MT1 // Type of the left-hand side sparse matrix
5327 , typename MT2 > // Type of the right-hand side dense matrix
testDeclHermOperation(blaze::TrueType)5328 void OperationTest<MT1,MT2>::testDeclHermOperation( blaze::TrueType )
5329 {
5330 #if BLAZETEST_MATHTEST_TEST_DECLHERM_OPERATION
5331 if( BLAZETEST_MATHTEST_TEST_DECLHERM_OPERATION > 1 )
5332 {
5333 if( ( !blaze::IsDiagonal<MT1>::value && blaze::IsTriangular<MT1>::value ) ||
5334 ( !blaze::IsDiagonal<MT2>::value && blaze::IsTriangular<MT2>::value ) ||
5335 ( !blaze::IsDiagonal<MT1>::value && blaze::IsSymmetric<MT1>::value && blaze::IsComplex<ET1>::value ) ||
5336 ( !blaze::IsDiagonal<MT2>::value && blaze::IsSymmetric<MT2>::value && blaze::IsComplex<ET2>::value ) ||
5337 ( lhs_.rows() != lhs_.columns() ) ||
5338 ( rhs_.rows() != rhs_.columns() ) )
5339 return;
5340
5341
5342 //=====================================================================================
5343 // Test-specific setup of the left-hand side operand
5344 //=====================================================================================
5345
5346 MT1 lhs ( lhs_ * ctrans( lhs_ ) );
5347 OMT1 olhs ( lhs );
5348 RT1 reflhs( lhs );
5349
5350
5351 //=====================================================================================
5352 // Test-specific setup of the right-hand side operand
5353 //=====================================================================================
5354
5355 MT2 rhs ( rhs_ * ctrans( rhs_ ) );
5356 OMT2 orhs ( rhs );
5357 RT2 refrhs( rhs );
5358
5359
5360 //=====================================================================================
5361 // Declherm Kronecker product
5362 //=====================================================================================
5363
5364 // Declherm Kronecker product with the given matrices
5365 {
5366 test_ = "Declherm Kronecker product with the given matrices";
5367 error_ = "Failed Kronecker product operation";
5368
5369 try {
5370 initResults();
5371 dres_ = declherm( kron( lhs, rhs ) );
5372 odres_ = declherm( kron( lhs, rhs ) );
5373 sres_ = declherm( kron( lhs, rhs ) );
5374 osres_ = declherm( kron( lhs, rhs ) );
5375 refres_ = declherm( kron( reflhs, refrhs ) );
5376 }
5377 catch( std::exception& ex ) {
5378 convertException<MT1,MT2>( ex );
5379 }
5380
5381 checkResults<MT1,MT2>();
5382
5383 try {
5384 initResults();
5385 dres_ = declherm( kron( lhs, orhs ) );
5386 odres_ = declherm( kron( lhs, orhs ) );
5387 sres_ = declherm( kron( lhs, orhs ) );
5388 osres_ = declherm( kron( lhs, orhs ) );
5389 refres_ = declherm( kron( reflhs, refrhs ) );
5390 }
5391 catch( std::exception& ex ) {
5392 convertException<MT1,OMT2>( ex );
5393 }
5394
5395 checkResults<MT1,OMT2>();
5396
5397 try {
5398 initResults();
5399 dres_ = declherm( kron( olhs, rhs ) );
5400 odres_ = declherm( kron( olhs, rhs ) );
5401 sres_ = declherm( kron( olhs, rhs ) );
5402 osres_ = declherm( kron( olhs, rhs ) );
5403 refres_ = declherm( kron( reflhs, refrhs ) );
5404 }
5405 catch( std::exception& ex ) {
5406 convertException<OMT1,MT2>( ex );
5407 }
5408
5409 checkResults<OMT1,MT2>();
5410
5411 try {
5412 initResults();
5413 dres_ = declherm( kron( olhs, orhs ) );
5414 odres_ = declherm( kron( olhs, orhs ) );
5415 sres_ = declherm( kron( olhs, orhs ) );
5416 osres_ = declherm( kron( olhs, orhs ) );
5417 refres_ = declherm( kron( reflhs, refrhs ) );
5418 }
5419 catch( std::exception& ex ) {
5420 convertException<OMT1,OMT2>( ex );
5421 }
5422
5423 checkResults<OMT1,OMT2>();
5424 }
5425
5426 // Declherm Kronecker product with evaluated matrices
5427 {
5428 test_ = "Declherm Kronecker product with evaluated left-hand side matrix";
5429 error_ = "Failed Kronecker product operation";
5430
5431 try {
5432 initResults();
5433 dres_ = declherm( kron( eval( lhs ), eval( rhs ) ) );
5434 odres_ = declherm( kron( eval( lhs ), eval( rhs ) ) );
5435 sres_ = declherm( kron( eval( lhs ), eval( rhs ) ) );
5436 osres_ = declherm( kron( eval( lhs ), eval( rhs ) ) );
5437 refres_ = declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5438 }
5439 catch( std::exception& ex ) {
5440 convertException<MT1,MT2>( ex );
5441 }
5442
5443 checkResults<MT1,MT2>();
5444
5445 try {
5446 initResults();
5447 dres_ = declherm( kron( eval( lhs ), eval( orhs ) ) );
5448 odres_ = declherm( kron( eval( lhs ), eval( orhs ) ) );
5449 sres_ = declherm( kron( eval( lhs ), eval( orhs ) ) );
5450 osres_ = declherm( kron( eval( lhs ), eval( orhs ) ) );
5451 refres_ = declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5452 }
5453 catch( std::exception& ex ) {
5454 convertException<MT1,OMT2>( ex );
5455 }
5456
5457 checkResults<MT1,OMT2>();
5458
5459 try {
5460 initResults();
5461 dres_ = declherm( kron( eval( olhs ), eval( rhs ) ) );
5462 odres_ = declherm( kron( eval( olhs ), eval( rhs ) ) );
5463 sres_ = declherm( kron( eval( olhs ), eval( rhs ) ) );
5464 osres_ = declherm( kron( eval( olhs ), eval( rhs ) ) );
5465 refres_ = declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5466 }
5467 catch( std::exception& ex ) {
5468 convertException<OMT1,MT2>( ex );
5469 }
5470
5471 checkResults<OMT1,MT2>();
5472
5473 try {
5474 initResults();
5475 dres_ = declherm( kron( eval( olhs ), eval( orhs ) ) );
5476 odres_ = declherm( kron( eval( olhs ), eval( orhs ) ) );
5477 sres_ = declherm( kron( eval( olhs ), eval( orhs ) ) );
5478 osres_ = declherm( kron( eval( olhs ), eval( orhs ) ) );
5479 refres_ = declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5480 }
5481 catch( std::exception& ex ) {
5482 convertException<OMT1,OMT2>( ex );
5483 }
5484
5485 checkResults<OMT1,OMT2>();
5486 }
5487
5488
5489 //=====================================================================================
5490 // Declherm Kronecker product with addition assignment
5491 //=====================================================================================
5492
5493 // Declherm Kronecker product with addition assignment with the given matrices
5494 {
5495 test_ = "Declherm Kronecker product with addition assignment with the given matrices";
5496 error_ = "Failed addition assignment operation";
5497
5498 try {
5499 initResults();
5500 dres_ += declherm( kron( lhs, rhs ) );
5501 odres_ += declherm( kron( lhs, rhs ) );
5502 sres_ += declherm( kron( lhs, rhs ) );
5503 osres_ += declherm( kron( lhs, rhs ) );
5504 refres_ += declherm( kron( reflhs, refrhs ) );
5505 }
5506 catch( std::exception& ex ) {
5507 convertException<MT1,MT2>( ex );
5508 }
5509
5510 checkResults<MT1,MT2>();
5511
5512 try {
5513 initResults();
5514 dres_ += declherm( kron( lhs, orhs ) );
5515 odres_ += declherm( kron( lhs, orhs ) );
5516 sres_ += declherm( kron( lhs, orhs ) );
5517 osres_ += declherm( kron( lhs, orhs ) );
5518 refres_ += declherm( kron( reflhs, refrhs ) );
5519 }
5520 catch( std::exception& ex ) {
5521 convertException<MT1,OMT2>( ex );
5522 }
5523
5524 checkResults<MT1,OMT2>();
5525
5526 try {
5527 initResults();
5528 dres_ += declherm( kron( olhs, rhs ) );
5529 odres_ += declherm( kron( olhs, rhs ) );
5530 sres_ += declherm( kron( olhs, rhs ) );
5531 osres_ += declherm( kron( olhs, rhs ) );
5532 refres_ += declherm( kron( reflhs, refrhs ) );
5533 }
5534 catch( std::exception& ex ) {
5535 convertException<OMT1,MT2>( ex );
5536 }
5537
5538 checkResults<OMT1,MT2>();
5539
5540 try {
5541 initResults();
5542 dres_ += declherm( kron( olhs, orhs ) );
5543 odres_ += declherm( kron( olhs, orhs ) );
5544 sres_ += declherm( kron( olhs, orhs ) );
5545 osres_ += declherm( kron( olhs, orhs ) );
5546 refres_ += declherm( kron( reflhs, refrhs ) );
5547 }
5548 catch( std::exception& ex ) {
5549 convertException<OMT1,OMT2>( ex );
5550 }
5551
5552 checkResults<OMT1,OMT2>();
5553 }
5554
5555 // Declherm Kronecker product with addition assignment with evaluated matrices
5556 {
5557 test_ = "Declherm Kronecker product with addition assignment with evaluated matrices";
5558 error_ = "Failed addition assignment operation";
5559
5560 try {
5561 initResults();
5562 dres_ += declherm( kron( eval( lhs ), eval( rhs ) ) );
5563 odres_ += declherm( kron( eval( lhs ), eval( rhs ) ) );
5564 sres_ += declherm( kron( eval( lhs ), eval( rhs ) ) );
5565 osres_ += declherm( kron( eval( lhs ), eval( rhs ) ) );
5566 refres_ += declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5567 }
5568 catch( std::exception& ex ) {
5569 convertException<MT1,MT2>( ex );
5570 }
5571
5572 checkResults<MT1,MT2>();
5573
5574 try {
5575 initResults();
5576 dres_ += declherm( kron( eval( lhs ), eval( orhs ) ) );
5577 odres_ += declherm( kron( eval( lhs ), eval( orhs ) ) );
5578 sres_ += declherm( kron( eval( lhs ), eval( orhs ) ) );
5579 osres_ += declherm( kron( eval( lhs ), eval( orhs ) ) );
5580 refres_ += declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5581 }
5582 catch( std::exception& ex ) {
5583 convertException<MT1,OMT2>( ex );
5584 }
5585
5586 checkResults<MT1,OMT2>();
5587
5588 try {
5589 initResults();
5590 dres_ += declherm( kron( eval( olhs ), eval( rhs ) ) );
5591 odres_ += declherm( kron( eval( olhs ), eval( rhs ) ) );
5592 sres_ += declherm( kron( eval( olhs ), eval( rhs ) ) );
5593 osres_ += declherm( kron( eval( olhs ), eval( rhs ) ) );
5594 refres_ += declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5595 }
5596 catch( std::exception& ex ) {
5597 convertException<OMT1,MT2>( ex );
5598 }
5599
5600 checkResults<OMT1,MT2>();
5601
5602 try {
5603 initResults();
5604 dres_ += declherm( kron( eval( olhs ), eval( orhs ) ) );
5605 odres_ += declherm( kron( eval( olhs ), eval( orhs ) ) );
5606 sres_ += declherm( kron( eval( olhs ), eval( orhs ) ) );
5607 osres_ += declherm( kron( eval( olhs ), eval( orhs ) ) );
5608 refres_ += declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5609 }
5610 catch( std::exception& ex ) {
5611 convertException<OMT1,OMT2>( ex );
5612 }
5613
5614 checkResults<OMT1,OMT2>();
5615 }
5616
5617
5618 //=====================================================================================
5619 // Declherm Kronecker product with subtraction assignment
5620 //=====================================================================================
5621
5622 // Declherm Kronecker product with subtraction assignment with the given matrices
5623 {
5624 test_ = "Declherm Kronecker product with subtraction assignment with the given matrices";
5625 error_ = "Failed subtraction assignment operation";
5626
5627 try {
5628 initResults();
5629 dres_ -= declherm( kron( lhs, rhs ) );
5630 odres_ -= declherm( kron( lhs, rhs ) );
5631 sres_ -= declherm( kron( lhs, rhs ) );
5632 osres_ -= declherm( kron( lhs, rhs ) );
5633 refres_ -= declherm( kron( reflhs, refrhs ) );
5634 }
5635 catch( std::exception& ex ) {
5636 convertException<MT1,MT2>( ex );
5637 }
5638
5639 checkResults<MT1,MT2>();
5640
5641 try {
5642 initResults();
5643 dres_ -= declherm( kron( lhs, orhs ) );
5644 odres_ -= declherm( kron( lhs, orhs ) );
5645 sres_ -= declherm( kron( lhs, orhs ) );
5646 osres_ -= declherm( kron( lhs, orhs ) );
5647 refres_ -= declherm( kron( reflhs, refrhs ) );
5648 }
5649 catch( std::exception& ex ) {
5650 convertException<MT1,OMT2>( ex );
5651 }
5652
5653 checkResults<MT1,OMT2>();
5654
5655 try {
5656 initResults();
5657 dres_ -= declherm( kron( olhs, rhs ) );
5658 odres_ -= declherm( kron( olhs, rhs ) );
5659 sres_ -= declherm( kron( olhs, rhs ) );
5660 osres_ -= declherm( kron( olhs, rhs ) );
5661 refres_ -= declherm( kron( reflhs, refrhs ) );
5662 }
5663 catch( std::exception& ex ) {
5664 convertException<OMT1,MT2>( ex );
5665 }
5666
5667 checkResults<OMT1,MT2>();
5668
5669 try {
5670 initResults();
5671 dres_ -= declherm( kron( olhs, orhs ) );
5672 odres_ -= declherm( kron( olhs, orhs ) );
5673 sres_ -= declherm( kron( olhs, orhs ) );
5674 osres_ -= declherm( kron( olhs, orhs ) );
5675 refres_ -= declherm( kron( reflhs, refrhs ) );
5676 }
5677 catch( std::exception& ex ) {
5678 convertException<OMT1,OMT2>( ex );
5679 }
5680
5681 checkResults<OMT1,OMT2>();
5682 }
5683
5684 // Declherm Kronecker product with subtraction assignment with evaluated matrices
5685 {
5686 test_ = "Declherm Kronecker product with subtraction assignment with evaluated matrices";
5687 error_ = "Failed subtraction assignment operation";
5688
5689 try {
5690 initResults();
5691 dres_ -= declherm( kron( eval( lhs ), eval( rhs ) ) );
5692 odres_ -= declherm( kron( eval( lhs ), eval( rhs ) ) );
5693 sres_ -= declherm( kron( eval( lhs ), eval( rhs ) ) );
5694 osres_ -= declherm( kron( eval( lhs ), eval( rhs ) ) );
5695 refres_ -= declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5696 }
5697 catch( std::exception& ex ) {
5698 convertException<MT1,MT2>( ex );
5699 }
5700
5701 checkResults<MT1,MT2>();
5702
5703 try {
5704 initResults();
5705 dres_ -= declherm( kron( eval( lhs ), eval( orhs ) ) );
5706 odres_ -= declherm( kron( eval( lhs ), eval( orhs ) ) );
5707 sres_ -= declherm( kron( eval( lhs ), eval( orhs ) ) );
5708 osres_ -= declherm( kron( eval( lhs ), eval( orhs ) ) );
5709 refres_ -= declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5710 }
5711 catch( std::exception& ex ) {
5712 convertException<MT1,OMT2>( ex );
5713 }
5714
5715 checkResults<MT1,OMT2>();
5716
5717 try {
5718 initResults();
5719 dres_ -= declherm( kron( eval( olhs ), eval( rhs ) ) );
5720 odres_ -= declherm( kron( eval( olhs ), eval( rhs ) ) );
5721 sres_ -= declherm( kron( eval( olhs ), eval( rhs ) ) );
5722 osres_ -= declherm( kron( eval( olhs ), eval( rhs ) ) );
5723 refres_ -= declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5724 }
5725 catch( std::exception& ex ) {
5726 convertException<OMT1,MT2>( ex );
5727 }
5728
5729 checkResults<OMT1,MT2>();
5730
5731 try {
5732 initResults();
5733 dres_ -= declherm( kron( eval( olhs ), eval( orhs ) ) );
5734 odres_ -= declherm( kron( eval( olhs ), eval( orhs ) ) );
5735 sres_ -= declherm( kron( eval( olhs ), eval( orhs ) ) );
5736 osres_ -= declherm( kron( eval( olhs ), eval( orhs ) ) );
5737 refres_ -= declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5738 }
5739 catch( std::exception& ex ) {
5740 convertException<OMT1,OMT2>( ex );
5741 }
5742
5743 checkResults<OMT1,OMT2>();
5744 }
5745
5746
5747 //=====================================================================================
5748 // Declherm Kronecker product with Schur product assignment
5749 //=====================================================================================
5750
5751 // Declherm Kronecker product with Schur product assignment with the given matrices
5752 {
5753 test_ = "Declherm Kronecker product with Schur product assignment with the given matrices";
5754 error_ = "Failed Schur product assignment operation";
5755
5756 try {
5757 initResults();
5758 dres_ %= declherm( kron( lhs, rhs ) );
5759 odres_ %= declherm( kron( lhs, rhs ) );
5760 sres_ %= declherm( kron( lhs, rhs ) );
5761 osres_ %= declherm( kron( lhs, rhs ) );
5762 refres_ %= declherm( kron( reflhs, refrhs ) );
5763 }
5764 catch( std::exception& ex ) {
5765 convertException<MT1,MT2>( ex );
5766 }
5767
5768 checkResults<MT1,MT2>();
5769
5770 try {
5771 initResults();
5772 dres_ %= declherm( kron( lhs, orhs ) );
5773 odres_ %= declherm( kron( lhs, orhs ) );
5774 sres_ %= declherm( kron( lhs, orhs ) );
5775 osres_ %= declherm( kron( lhs, orhs ) );
5776 refres_ %= declherm( kron( reflhs, refrhs ) );
5777 }
5778 catch( std::exception& ex ) {
5779 convertException<MT1,OMT2>( ex );
5780 }
5781
5782 checkResults<MT1,OMT2>();
5783
5784 try {
5785 initResults();
5786 dres_ %= declherm( kron( olhs, rhs ) );
5787 odres_ %= declherm( kron( olhs, rhs ) );
5788 sres_ %= declherm( kron( olhs, rhs ) );
5789 osres_ %= declherm( kron( olhs, rhs ) );
5790 refres_ %= declherm( kron( reflhs, refrhs ) );
5791 }
5792 catch( std::exception& ex ) {
5793 convertException<OMT1,MT2>( ex );
5794 }
5795
5796 checkResults<OMT1,MT2>();
5797
5798 try {
5799 initResults();
5800 dres_ %= declherm( kron( olhs, orhs ) );
5801 odres_ %= declherm( kron( olhs, orhs ) );
5802 sres_ %= declherm( kron( olhs, orhs ) );
5803 osres_ %= declherm( kron( olhs, orhs ) );
5804 refres_ %= declherm( kron( reflhs, refrhs ) );
5805 }
5806 catch( std::exception& ex ) {
5807 convertException<OMT1,OMT2>( ex );
5808 }
5809
5810 checkResults<OMT1,OMT2>();
5811 }
5812
5813 // Declherm Kronecker product with Schur product assignment with evaluated matrices
5814 {
5815 test_ = "Declherm Kronecker product with Schur product assignment with evaluated matrices";
5816 error_ = "Failed Schur product assignment operation";
5817
5818 try {
5819 initResults();
5820 dres_ %= declherm( kron( eval( lhs ), eval( rhs ) ) );
5821 odres_ %= declherm( kron( eval( lhs ), eval( rhs ) ) );
5822 sres_ %= declherm( kron( eval( lhs ), eval( rhs ) ) );
5823 osres_ %= declherm( kron( eval( lhs ), eval( rhs ) ) );
5824 refres_ %= declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5825 }
5826 catch( std::exception& ex ) {
5827 convertException<MT1,MT2>( ex );
5828 }
5829
5830 checkResults<MT1,MT2>();
5831
5832 try {
5833 initResults();
5834 dres_ %= declherm( kron( eval( lhs ), eval( orhs ) ) );
5835 odres_ %= declherm( kron( eval( lhs ), eval( orhs ) ) );
5836 sres_ %= declherm( kron( eval( lhs ), eval( orhs ) ) );
5837 osres_ %= declherm( kron( eval( lhs ), eval( orhs ) ) );
5838 refres_ %= declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5839 }
5840 catch( std::exception& ex ) {
5841 convertException<MT1,OMT2>( ex );
5842 }
5843
5844 checkResults<MT1,OMT2>();
5845
5846 try {
5847 initResults();
5848 dres_ %= declherm( kron( eval( olhs ), eval( rhs ) ) );
5849 odres_ %= declherm( kron( eval( olhs ), eval( rhs ) ) );
5850 sres_ %= declherm( kron( eval( olhs ), eval( rhs ) ) );
5851 osres_ %= declherm( kron( eval( olhs ), eval( rhs ) ) );
5852 refres_ %= declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5853 }
5854 catch( std::exception& ex ) {
5855 convertException<OMT1,MT2>( ex );
5856 }
5857
5858 checkResults<OMT1,MT2>();
5859
5860 try {
5861 initResults();
5862 dres_ %= declherm( kron( eval( olhs ), eval( orhs ) ) );
5863 odres_ %= declherm( kron( eval( olhs ), eval( orhs ) ) );
5864 sres_ %= declherm( kron( eval( olhs ), eval( orhs ) ) );
5865 osres_ %= declherm( kron( eval( olhs ), eval( orhs ) ) );
5866 refres_ %= declherm( kron( eval( reflhs ), eval( refrhs ) ) );
5867 }
5868 catch( std::exception& ex ) {
5869 convertException<OMT1,OMT2>( ex );
5870 }
5871
5872 checkResults<OMT1,OMT2>();
5873 }
5874 }
5875 #endif
5876 }
5877 //*************************************************************************************************
5878
5879
5880 //*************************************************************************************************
5881 /*!\brief Skipping the Hermitian sparse matrix/dense matrix Kronecker product.
5882 //
5883 // \return void
5884 //
5885 // This function is called in case the Hermitian matrix/matrix Kronecker product operation is not
5886 // available for the given matrix types \a MT1 and \a MT2.
5887 */
5888 template< typename MT1 // Type of the left-hand side sparse matrix
5889 , typename MT2 > // Type of the right-hand side dense matrix
testDeclHermOperation(blaze::FalseType)5890 void OperationTest<MT1,MT2>::testDeclHermOperation( blaze::FalseType )
5891 {}
5892 //*************************************************************************************************
5893
5894
5895 //*************************************************************************************************
5896 /*!\brief Testing the lower sparse matrix/dense matrix Kronecker product.
5897 //
5898 // \return void
5899 // \exception std::runtime_error Kronecker product error detected.
5900 //
5901 // This function tests the lower matrix Kronecker product with plain assignment, addition
5902 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
5903 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
5904 // exception is thrown.
5905 */
5906 template< typename MT1 // Type of the left-hand side sparse matrix
5907 , typename MT2 > // Type of the right-hand side dense matrix
testDeclLowOperation(blaze::TrueType)5908 void OperationTest<MT1,MT2>::testDeclLowOperation( blaze::TrueType )
5909 {
5910 #if BLAZETEST_MATHTEST_TEST_DECLLOW_OPERATION
5911 if( BLAZETEST_MATHTEST_TEST_DECLLOW_OPERATION > 1 )
5912 {
5913 if( lhs_.rows() != lhs_.columns() || rhs_.rows() != rhs_.columns() )
5914 return;
5915
5916
5917 //=====================================================================================
5918 // Test-specific setup of the left-hand side operand
5919 //=====================================================================================
5920
5921 MT1 lhs( lhs_ );
5922
5923 blaze::resetUpper( lhs );
5924
5925 OMT1 olhs ( lhs );
5926 RT1 reflhs( lhs );
5927
5928
5929 //=====================================================================================
5930 // Test-specific setup of the right-hand side operand
5931 //=====================================================================================
5932
5933 MT2 rhs( rhs_ );
5934
5935 blaze::resetUpper( rhs );
5936
5937 OMT2 orhs ( rhs );
5938 RT2 refrhs( rhs );
5939
5940
5941 //=====================================================================================
5942 // Decllow Kronecker product
5943 //=====================================================================================
5944
5945 // Decllow Kronecker product with the given matrices
5946 {
5947 test_ = "Decllow Kronecker product with the given matrices";
5948 error_ = "Failed Kronecker product operation";
5949
5950 try {
5951 initResults();
5952 dres_ = decllow( kron( lhs, rhs ) );
5953 odres_ = decllow( kron( lhs, rhs ) );
5954 sres_ = decllow( kron( lhs, rhs ) );
5955 osres_ = decllow( kron( lhs, rhs ) );
5956 refres_ = decllow( kron( reflhs, refrhs ) );
5957 }
5958 catch( std::exception& ex ) {
5959 convertException<MT1,MT2>( ex );
5960 }
5961
5962 checkResults<MT1,MT2>();
5963
5964 try {
5965 initResults();
5966 dres_ = decllow( kron( lhs, orhs ) );
5967 odres_ = decllow( kron( lhs, orhs ) );
5968 sres_ = decllow( kron( lhs, orhs ) );
5969 osres_ = decllow( kron( lhs, orhs ) );
5970 refres_ = decllow( kron( reflhs, refrhs ) );
5971 }
5972 catch( std::exception& ex ) {
5973 convertException<MT1,OMT2>( ex );
5974 }
5975
5976 checkResults<MT1,OMT2>();
5977
5978 try {
5979 initResults();
5980 dres_ = decllow( kron( olhs, rhs ) );
5981 odres_ = decllow( kron( olhs, rhs ) );
5982 sres_ = decllow( kron( olhs, rhs ) );
5983 osres_ = decllow( kron( olhs, rhs ) );
5984 refres_ = decllow( kron( reflhs, refrhs ) );
5985 }
5986 catch( std::exception& ex ) {
5987 convertException<OMT1,MT2>( ex );
5988 }
5989
5990 checkResults<OMT1,MT2>();
5991
5992 try {
5993 initResults();
5994 dres_ = decllow( kron( olhs, orhs ) );
5995 odres_ = decllow( kron( olhs, orhs ) );
5996 sres_ = decllow( kron( olhs, orhs ) );
5997 osres_ = decllow( kron( olhs, rhs ) );
5998 refres_ = decllow( kron( reflhs, refrhs ) );
5999 }
6000 catch( std::exception& ex ) {
6001 convertException<OMT1,OMT2>( ex );
6002 }
6003
6004 checkResults<OMT1,OMT2>();
6005 }
6006
6007 // Decllow Kronecker product with evaluated matrices
6008 {
6009 test_ = "Decllow Kronecker product with evaluated left-hand side matrix";
6010 error_ = "Failed Kronecker product operation";
6011
6012 try {
6013 initResults();
6014 dres_ = decllow( kron( eval( lhs ), eval( rhs ) ) );
6015 odres_ = decllow( kron( eval( lhs ), eval( rhs ) ) );
6016 sres_ = decllow( kron( eval( lhs ), eval( rhs ) ) );
6017 osres_ = decllow( kron( eval( lhs ), eval( rhs ) ) );
6018 refres_ = decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6019 }
6020 catch( std::exception& ex ) {
6021 convertException<MT1,MT2>( ex );
6022 }
6023
6024 checkResults<MT1,MT2>();
6025
6026 try {
6027 initResults();
6028 dres_ = decllow( kron( eval( lhs ), eval( orhs ) ) );
6029 odres_ = decllow( kron( eval( lhs ), eval( orhs ) ) );
6030 sres_ = decllow( kron( eval( lhs ), eval( orhs ) ) );
6031 osres_ = decllow( kron( eval( lhs ), eval( orhs ) ) );
6032 refres_ = decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6033 }
6034 catch( std::exception& ex ) {
6035 convertException<MT1,OMT2>( ex );
6036 }
6037
6038 checkResults<MT1,OMT2>();
6039
6040 try {
6041 initResults();
6042 dres_ = decllow( kron( eval( olhs ), eval( rhs ) ) );
6043 odres_ = decllow( kron( eval( olhs ), eval( rhs ) ) );
6044 sres_ = decllow( kron( eval( olhs ), eval( rhs ) ) );
6045 osres_ = decllow( kron( eval( olhs ), eval( rhs ) ) );
6046 refres_ = decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6047 }
6048 catch( std::exception& ex ) {
6049 convertException<OMT1,MT2>( ex );
6050 }
6051
6052 checkResults<OMT1,MT2>();
6053
6054 try {
6055 initResults();
6056 dres_ = decllow( kron( eval( olhs ), eval( orhs ) ) );
6057 odres_ = decllow( kron( eval( olhs ), eval( orhs ) ) );
6058 sres_ = decllow( kron( eval( olhs ), eval( orhs ) ) );
6059 osres_ = decllow( kron( eval( olhs ), eval( orhs ) ) );
6060 refres_ = decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6061 }
6062 catch( std::exception& ex ) {
6063 convertException<OMT1,OMT2>( ex );
6064 }
6065
6066 checkResults<OMT1,OMT2>();
6067 }
6068
6069
6070 //=====================================================================================
6071 // Decllow Kronecker product with addition assignment
6072 //=====================================================================================
6073
6074 // Decllow Kronecker product with addition assignment with the given matrices
6075 {
6076 test_ = "Decllow Kronecker product with addition assignment with the given matrices";
6077 error_ = "Failed addition assignment operation";
6078
6079 try {
6080 initResults();
6081 dres_ += decllow( kron( lhs, rhs ) );
6082 odres_ += decllow( kron( lhs, rhs ) );
6083 sres_ += decllow( kron( lhs, rhs ) );
6084 osres_ += decllow( kron( lhs, rhs ) );
6085 refres_ += decllow( kron( reflhs, refrhs ) );
6086 }
6087 catch( std::exception& ex ) {
6088 convertException<MT1,MT2>( ex );
6089 }
6090
6091 checkResults<MT1,MT2>();
6092
6093 try {
6094 initResults();
6095 dres_ += decllow( kron( lhs, orhs ) );
6096 odres_ += decllow( kron( lhs, orhs ) );
6097 sres_ += decllow( kron( lhs, orhs ) );
6098 osres_ += decllow( kron( lhs, orhs ) );
6099 refres_ += decllow( kron( reflhs, refrhs ) );
6100 }
6101 catch( std::exception& ex ) {
6102 convertException<MT1,OMT2>( ex );
6103 }
6104
6105 checkResults<MT1,OMT2>();
6106
6107 try {
6108 initResults();
6109 dres_ += decllow( kron( olhs, rhs ) );
6110 odres_ += decllow( kron( olhs, rhs ) );
6111 sres_ += decllow( kron( olhs, rhs ) );
6112 osres_ += decllow( kron( olhs, rhs ) );
6113 refres_ += decllow( kron( reflhs, refrhs ) );
6114 }
6115 catch( std::exception& ex ) {
6116 convertException<OMT1,MT2>( ex );
6117 }
6118
6119 checkResults<OMT1,MT2>();
6120
6121 try {
6122 initResults();
6123 dres_ += decllow( kron( olhs, orhs ) );
6124 odres_ += decllow( kron( olhs, orhs ) );
6125 sres_ += decllow( kron( olhs, orhs ) );
6126 osres_ += decllow( kron( olhs, orhs ) );
6127 refres_ += decllow( kron( reflhs, refrhs ) );
6128 }
6129 catch( std::exception& ex ) {
6130 convertException<OMT1,OMT2>( ex );
6131 }
6132
6133 checkResults<OMT1,OMT2>();
6134 }
6135
6136 // Decllow Kronecker product with addition assignment with evaluated matrices
6137 {
6138 test_ = "Decllow Kronecker product with addition assignment with evaluated matrices";
6139 error_ = "Failed addition assignment operation";
6140
6141 try {
6142 initResults();
6143 dres_ += decllow( kron( eval( lhs ), eval( rhs ) ) );
6144 odres_ += decllow( kron( eval( lhs ), eval( rhs ) ) );
6145 sres_ += decllow( kron( eval( lhs ), eval( rhs ) ) );
6146 osres_ += decllow( kron( eval( lhs ), eval( rhs ) ) );
6147 refres_ += decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6148 }
6149 catch( std::exception& ex ) {
6150 convertException<MT1,MT2>( ex );
6151 }
6152
6153 checkResults<MT1,MT2>();
6154
6155 try {
6156 initResults();
6157 dres_ += decllow( kron( eval( lhs ), eval( orhs ) ) );
6158 odres_ += decllow( kron( eval( lhs ), eval( orhs ) ) );
6159 sres_ += decllow( kron( eval( lhs ), eval( orhs ) ) );
6160 osres_ += decllow( kron( eval( lhs ), eval( orhs ) ) );
6161 refres_ += decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6162 }
6163 catch( std::exception& ex ) {
6164 convertException<MT1,OMT2>( ex );
6165 }
6166
6167 checkResults<MT1,OMT2>();
6168
6169 try {
6170 initResults();
6171 dres_ += decllow( kron( eval( olhs ), eval( rhs ) ) );
6172 odres_ += decllow( kron( eval( olhs ), eval( rhs ) ) );
6173 sres_ += decllow( kron( eval( olhs ), eval( rhs ) ) );
6174 osres_ += decllow( kron( eval( olhs ), eval( rhs ) ) );
6175 refres_ += decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6176 }
6177 catch( std::exception& ex ) {
6178 convertException<OMT1,MT2>( ex );
6179 }
6180
6181 checkResults<OMT1,MT2>();
6182
6183 try {
6184 initResults();
6185 dres_ += decllow( kron( eval( olhs ), eval( orhs ) ) );
6186 odres_ += decllow( kron( eval( olhs ), eval( orhs ) ) );
6187 sres_ += decllow( kron( eval( olhs ), eval( orhs ) ) );
6188 osres_ += decllow( kron( eval( olhs ), eval( orhs ) ) );
6189 refres_ += decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6190 }
6191 catch( std::exception& ex ) {
6192 convertException<OMT1,OMT2>( ex );
6193 }
6194
6195 checkResults<OMT1,OMT2>();
6196 }
6197
6198
6199 //=====================================================================================
6200 // Decllow Kronecker product with subtraction assignment
6201 //=====================================================================================
6202
6203 // Decllow Kronecker product with subtraction assignment with the given matrices
6204 {
6205 test_ = "Decllow Kronecker product with subtraction assignment with the given matrices";
6206 error_ = "Failed subtraction assignment operation";
6207
6208 try {
6209 initResults();
6210 dres_ -= decllow( kron( lhs, rhs ) );
6211 odres_ -= decllow( kron( lhs, rhs ) );
6212 sres_ -= decllow( kron( lhs, rhs ) );
6213 osres_ -= decllow( kron( lhs, rhs ) );
6214 refres_ -= decllow( kron( reflhs, refrhs ) );
6215 }
6216 catch( std::exception& ex ) {
6217 convertException<MT1,MT2>( ex );
6218 }
6219
6220 checkResults<MT1,MT2>();
6221
6222 try {
6223 initResults();
6224 dres_ -= decllow( kron( lhs, orhs ) );
6225 odres_ -= decllow( kron( lhs, orhs ) );
6226 sres_ -= decllow( kron( lhs, orhs ) );
6227 osres_ -= decllow( kron( lhs, orhs ) );
6228 refres_ -= decllow( kron( reflhs, refrhs ) );
6229 }
6230 catch( std::exception& ex ) {
6231 convertException<MT1,OMT2>( ex );
6232 }
6233
6234 checkResults<MT1,OMT2>();
6235
6236 try {
6237 initResults();
6238 dres_ -= decllow( kron( olhs, rhs ) );
6239 odres_ -= decllow( kron( olhs, rhs ) );
6240 sres_ -= decllow( kron( olhs, rhs ) );
6241 osres_ -= decllow( kron( olhs, rhs ) );
6242 refres_ -= decllow( kron( reflhs, refrhs ) );
6243 }
6244 catch( std::exception& ex ) {
6245 convertException<OMT1,MT2>( ex );
6246 }
6247
6248 checkResults<OMT1,MT2>();
6249
6250 try {
6251 initResults();
6252 dres_ -= decllow( kron( olhs, orhs ) );
6253 odres_ -= decllow( kron( olhs, orhs ) );
6254 sres_ -= decllow( kron( olhs, orhs ) );
6255 osres_ -= decllow( kron( olhs, orhs ) );
6256 refres_ -= decllow( kron( reflhs, refrhs ) );
6257 }
6258 catch( std::exception& ex ) {
6259 convertException<OMT1,OMT2>( ex );
6260 }
6261
6262 checkResults<OMT1,OMT2>();
6263 }
6264
6265 // Decllow Kronecker product with subtraction assignment with evaluated matrices
6266 {
6267 test_ = "Decllow Kronecker product with subtraction assignment with evaluated matrices";
6268 error_ = "Failed subtraction assignment operation";
6269
6270 try {
6271 initResults();
6272 dres_ -= decllow( kron( eval( lhs ), eval( rhs ) ) );
6273 odres_ -= decllow( kron( eval( lhs ), eval( rhs ) ) );
6274 sres_ -= decllow( kron( eval( lhs ), eval( rhs ) ) );
6275 osres_ -= decllow( kron( eval( lhs ), eval( rhs ) ) );
6276 refres_ -= decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6277 }
6278 catch( std::exception& ex ) {
6279 convertException<MT1,MT2>( ex );
6280 }
6281
6282 checkResults<MT1,MT2>();
6283
6284 try {
6285 initResults();
6286 dres_ -= decllow( kron( eval( lhs ), eval( orhs ) ) );
6287 odres_ -= decllow( kron( eval( lhs ), eval( orhs ) ) );
6288 sres_ -= decllow( kron( eval( lhs ), eval( orhs ) ) );
6289 osres_ -= decllow( kron( eval( lhs ), eval( orhs ) ) );
6290 refres_ -= decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6291 }
6292 catch( std::exception& ex ) {
6293 convertException<MT1,OMT2>( ex );
6294 }
6295
6296 checkResults<MT1,OMT2>();
6297
6298 try {
6299 initResults();
6300 dres_ -= decllow( kron( eval( olhs ), eval( rhs ) ) );
6301 odres_ -= decllow( kron( eval( olhs ), eval( rhs ) ) );
6302 sres_ -= decllow( kron( eval( olhs ), eval( rhs ) ) );
6303 osres_ -= decllow( kron( eval( olhs ), eval( rhs ) ) );
6304 refres_ -= decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6305 }
6306 catch( std::exception& ex ) {
6307 convertException<OMT1,MT2>( ex );
6308 }
6309
6310 checkResults<OMT1,MT2>();
6311
6312 try {
6313 initResults();
6314 dres_ -= decllow( kron( eval( olhs ), eval( orhs ) ) );
6315 odres_ -= decllow( kron( eval( olhs ), eval( orhs ) ) );
6316 sres_ -= decllow( kron( eval( olhs ), eval( orhs ) ) );
6317 osres_ -= decllow( kron( eval( olhs ), eval( orhs ) ) );
6318 refres_ -= decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6319 }
6320 catch( std::exception& ex ) {
6321 convertException<OMT1,OMT2>( ex );
6322 }
6323
6324 checkResults<OMT1,OMT2>();
6325 }
6326
6327
6328 //=====================================================================================
6329 // Decllow Kronecker product with Schur product assignment
6330 //=====================================================================================
6331
6332 // Decllow Kronecker product with Schur product assignment with the given matrices
6333 {
6334 test_ = "Decllow Kronecker product with Schur product assignment with the given matrices";
6335 error_ = "Failed Schur product assignment operation";
6336
6337 try {
6338 initResults();
6339 dres_ %= decllow( kron( lhs, rhs ) );
6340 odres_ %= decllow( kron( lhs, rhs ) );
6341 sres_ %= decllow( kron( lhs, rhs ) );
6342 osres_ %= decllow( kron( lhs, rhs ) );
6343 refres_ %= decllow( kron( reflhs, refrhs ) );
6344 }
6345 catch( std::exception& ex ) {
6346 convertException<MT1,MT2>( ex );
6347 }
6348
6349 checkResults<MT1,MT2>();
6350
6351 try {
6352 initResults();
6353 dres_ %= decllow( kron( lhs, orhs ) );
6354 odres_ %= decllow( kron( lhs, orhs ) );
6355 sres_ %= decllow( kron( lhs, orhs ) );
6356 osres_ %= decllow( kron( lhs, orhs ) );
6357 refres_ %= decllow( kron( reflhs, refrhs ) );
6358 }
6359 catch( std::exception& ex ) {
6360 convertException<MT1,OMT2>( ex );
6361 }
6362
6363 checkResults<MT1,OMT2>();
6364
6365 try {
6366 initResults();
6367 dres_ %= decllow( kron( olhs, rhs ) );
6368 odres_ %= decllow( kron( olhs, rhs ) );
6369 sres_ %= decllow( kron( olhs, rhs ) );
6370 osres_ %= decllow( kron( olhs, rhs ) );
6371 refres_ %= decllow( kron( reflhs, refrhs ) );
6372 }
6373 catch( std::exception& ex ) {
6374 convertException<OMT1,MT2>( ex );
6375 }
6376
6377 checkResults<OMT1,MT2>();
6378
6379 try {
6380 initResults();
6381 dres_ %= decllow( kron( olhs, orhs ) );
6382 odres_ %= decllow( kron( olhs, orhs ) );
6383 sres_ %= decllow( kron( olhs, orhs ) );
6384 osres_ %= decllow( kron( olhs, orhs ) );
6385 refres_ %= decllow( kron( reflhs, refrhs ) );
6386 }
6387 catch( std::exception& ex ) {
6388 convertException<OMT1,OMT2>( ex );
6389 }
6390
6391 checkResults<OMT1,OMT2>();
6392 }
6393
6394 // Decllow Kronecker product with Schur product assignment with evaluated matrices
6395 {
6396 test_ = "Decllow Kronecker product with Schur product assignment with evaluated matrices";
6397 error_ = "Failed Schur product assignment operation";
6398
6399 try {
6400 initResults();
6401 dres_ %= decllow( kron( eval( lhs ), eval( rhs ) ) );
6402 odres_ %= decllow( kron( eval( lhs ), eval( rhs ) ) );
6403 sres_ %= decllow( kron( eval( lhs ), eval( rhs ) ) );
6404 osres_ %= decllow( kron( eval( lhs ), eval( rhs ) ) );
6405 refres_ %= decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6406 }
6407 catch( std::exception& ex ) {
6408 convertException<MT1,MT2>( ex );
6409 }
6410
6411 checkResults<MT1,MT2>();
6412
6413 try {
6414 initResults();
6415 dres_ %= decllow( kron( eval( lhs ), eval( orhs ) ) );
6416 odres_ %= decllow( kron( eval( lhs ), eval( orhs ) ) );
6417 sres_ %= decllow( kron( eval( lhs ), eval( orhs ) ) );
6418 osres_ %= decllow( kron( eval( lhs ), eval( orhs ) ) );
6419 refres_ %= decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6420 }
6421 catch( std::exception& ex ) {
6422 convertException<MT1,OMT2>( ex );
6423 }
6424
6425 checkResults<MT1,OMT2>();
6426
6427 try {
6428 initResults();
6429 dres_ %= decllow( kron( eval( olhs ), eval( rhs ) ) );
6430 odres_ %= decllow( kron( eval( olhs ), eval( rhs ) ) );
6431 sres_ %= decllow( kron( eval( olhs ), eval( rhs ) ) );
6432 osres_ %= decllow( kron( eval( olhs ), eval( rhs ) ) );
6433 refres_ %= decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6434 }
6435 catch( std::exception& ex ) {
6436 convertException<OMT1,MT2>( ex );
6437 }
6438
6439 checkResults<OMT1,MT2>();
6440
6441 try {
6442 initResults();
6443 dres_ %= decllow( kron( eval( olhs ), eval( orhs ) ) );
6444 odres_ %= decllow( kron( eval( olhs ), eval( orhs ) ) );
6445 sres_ %= decllow( kron( eval( olhs ), eval( orhs ) ) );
6446 osres_ %= decllow( kron( eval( olhs ), eval( orhs ) ) );
6447 refres_ %= decllow( kron( eval( reflhs ), eval( refrhs ) ) );
6448 }
6449 catch( std::exception& ex ) {
6450 convertException<OMT1,OMT2>( ex );
6451 }
6452
6453 checkResults<OMT1,OMT2>();
6454 }
6455 }
6456 #endif
6457 }
6458 //*************************************************************************************************
6459
6460
6461 //*************************************************************************************************
6462 /*!\brief Skipping the lower sparse matrix/dense matrix Kronecker product.
6463 //
6464 // \return void
6465 //
6466 // This function is called in case the lower matrix/matrix Kronecker product operation is not
6467 // available for the given matrix types \a MT1 and \a MT2.
6468 */
6469 template< typename MT1 // Type of the left-hand side sparse matrix
6470 , typename MT2 > // Type of the right-hand side dense matrix
testDeclLowOperation(blaze::FalseType)6471 void OperationTest<MT1,MT2>::testDeclLowOperation( blaze::FalseType )
6472 {}
6473 //*************************************************************************************************
6474
6475
6476 //*************************************************************************************************
6477 /*!\brief Testing the upper sparse matrix/dense matrix Kronecker product.
6478 //
6479 // \return void
6480 // \exception std::runtime_error Kronecker product error detected.
6481 //
6482 // This function tests the upper matrix Kronecker product with plain assignment, addition
6483 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
6484 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
6485 // exception is thrown.
6486 */
6487 template< typename MT1 // Type of the left-hand side sparse matrix
6488 , typename MT2 > // Type of the right-hand side dense matrix
testDeclUppOperation(blaze::TrueType)6489 void OperationTest<MT1,MT2>::testDeclUppOperation( blaze::TrueType )
6490 {
6491 #if BLAZETEST_MATHTEST_TEST_DECLUPP_OPERATION
6492 if( BLAZETEST_MATHTEST_TEST_DECLUPP_OPERATION > 1 )
6493 {
6494 if( lhs_.rows() != lhs_.columns() || rhs_.rows() != rhs_.columns() )
6495 return;
6496
6497
6498 //=====================================================================================
6499 // Test-specific setup of the left-hand side operand
6500 //=====================================================================================
6501
6502 MT1 lhs( lhs_ );
6503
6504 blaze::resetLower( lhs );
6505
6506 OMT1 olhs ( lhs );
6507 RT1 reflhs( lhs );
6508
6509
6510 //=====================================================================================
6511 // Test-specific setup of the right-hand side operand
6512 //=====================================================================================
6513
6514 MT2 rhs( rhs_ );
6515
6516 blaze::resetLower( rhs );
6517
6518 OMT2 orhs ( rhs );
6519 RT2 refrhs( rhs );
6520
6521
6522 //=====================================================================================
6523 // Declupp Kronecker product
6524 //=====================================================================================
6525
6526 // Declupp Kronecker product with the given matrices
6527 {
6528 test_ = "Declupp Kronecker product with the given matrices";
6529 error_ = "Failed Kronecker product operation";
6530
6531 try {
6532 initResults();
6533 dres_ = declupp( kron( lhs, rhs ) );
6534 odres_ = declupp( kron( lhs, rhs ) );
6535 sres_ = declupp( kron( lhs, rhs ) );
6536 osres_ = declupp( kron( lhs, rhs ) );
6537 refres_ = declupp( kron( reflhs, refrhs ) );
6538 }
6539 catch( std::exception& ex ) {
6540 convertException<MT1,MT2>( ex );
6541 }
6542
6543 checkResults<MT1,MT2>();
6544
6545 try {
6546 initResults();
6547 dres_ = declupp( kron( lhs, orhs ) );
6548 odres_ = declupp( kron( lhs, orhs ) );
6549 sres_ = declupp( kron( lhs, orhs ) );
6550 osres_ = declupp( kron( lhs, orhs ) );
6551 refres_ = declupp( kron( reflhs, refrhs ) );
6552 }
6553 catch( std::exception& ex ) {
6554 convertException<MT1,OMT2>( ex );
6555 }
6556
6557 checkResults<MT1,OMT2>();
6558
6559 try {
6560 initResults();
6561 dres_ = declupp( kron( olhs, rhs ) );
6562 odres_ = declupp( kron( olhs, rhs ) );
6563 sres_ = declupp( kron( olhs, rhs ) );
6564 osres_ = declupp( kron( olhs, rhs ) );
6565 refres_ = declupp( kron( reflhs, refrhs ) );
6566 }
6567 catch( std::exception& ex ) {
6568 convertException<OMT1,MT2>( ex );
6569 }
6570
6571 checkResults<OMT1,MT2>();
6572
6573 try {
6574 initResults();
6575 dres_ = declupp( kron( olhs, orhs ) );
6576 odres_ = declupp( kron( olhs, orhs ) );
6577 sres_ = declupp( kron( olhs, orhs ) );
6578 osres_ = declupp( kron( olhs, orhs ) );
6579 refres_ = declupp( kron( reflhs, refrhs ) );
6580 }
6581 catch( std::exception& ex ) {
6582 convertException<OMT1,OMT2>( ex );
6583 }
6584
6585 checkResults<OMT1,OMT2>();
6586 }
6587
6588 // Declupp Kronecker product with evaluated matrices
6589 {
6590 test_ = "Declupp Kronecker product with evaluated left-hand side matrix";
6591 error_ = "Failed Kronecker product operation";
6592
6593 try {
6594 initResults();
6595 dres_ = declupp( kron( eval( lhs ), eval( rhs ) ) );
6596 odres_ = declupp( kron( eval( lhs ), eval( rhs ) ) );
6597 sres_ = declupp( kron( eval( lhs ), eval( rhs ) ) );
6598 osres_ = declupp( kron( eval( lhs ), eval( rhs ) ) );
6599 refres_ = declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6600 }
6601 catch( std::exception& ex ) {
6602 convertException<MT1,MT2>( ex );
6603 }
6604
6605 checkResults<MT1,MT2>();
6606
6607 try {
6608 initResults();
6609 dres_ = declupp( kron( eval( lhs ), eval( orhs ) ) );
6610 odres_ = declupp( kron( eval( lhs ), eval( orhs ) ) );
6611 sres_ = declupp( kron( eval( lhs ), eval( orhs ) ) );
6612 osres_ = declupp( kron( eval( lhs ), eval( orhs ) ) );
6613 refres_ = declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6614 }
6615 catch( std::exception& ex ) {
6616 convertException<MT1,OMT2>( ex );
6617 }
6618
6619 checkResults<MT1,OMT2>();
6620
6621 try {
6622 initResults();
6623 dres_ = declupp( kron( eval( olhs ), eval( rhs ) ) );
6624 odres_ = declupp( kron( eval( olhs ), eval( rhs ) ) );
6625 sres_ = declupp( kron( eval( olhs ), eval( rhs ) ) );
6626 osres_ = declupp( kron( eval( olhs ), eval( rhs ) ) );
6627 refres_ = declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6628 }
6629 catch( std::exception& ex ) {
6630 convertException<OMT1,MT2>( ex );
6631 }
6632
6633 checkResults<OMT1,MT2>();
6634
6635 try {
6636 initResults();
6637 dres_ = declupp( kron( eval( olhs ), eval( orhs ) ) );
6638 odres_ = declupp( kron( eval( olhs ), eval( orhs ) ) );
6639 sres_ = declupp( kron( eval( olhs ), eval( orhs ) ) );
6640 osres_ = declupp( kron( eval( olhs ), eval( orhs ) ) );
6641 refres_ = declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6642 }
6643 catch( std::exception& ex ) {
6644 convertException<OMT1,OMT2>( ex );
6645 }
6646
6647 checkResults<OMT1,OMT2>();
6648 }
6649
6650
6651 //=====================================================================================
6652 // Declupp Kronecker product with addition assignment
6653 //=====================================================================================
6654
6655 // Declupp Kronecker product with addition assignment with the given matrices
6656 {
6657 test_ = "Declupp Kronecker product with addition assignment with the given matrices";
6658 error_ = "Failed addition assignment operation";
6659
6660 try {
6661 initResults();
6662 dres_ += declupp( kron( lhs, rhs ) );
6663 odres_ += declupp( kron( lhs, rhs ) );
6664 sres_ += declupp( kron( lhs, rhs ) );
6665 osres_ += declupp( kron( lhs, rhs ) );
6666 refres_ += declupp( kron( reflhs, refrhs ) );
6667 }
6668 catch( std::exception& ex ) {
6669 convertException<MT1,MT2>( ex );
6670 }
6671
6672 checkResults<MT1,MT2>();
6673
6674 try {
6675 initResults();
6676 dres_ += declupp( kron( lhs, orhs ) );
6677 odres_ += declupp( kron( lhs, orhs ) );
6678 sres_ += declupp( kron( lhs, orhs ) );
6679 osres_ += declupp( kron( lhs, orhs ) );
6680 refres_ += declupp( kron( reflhs, refrhs ) );
6681 }
6682 catch( std::exception& ex ) {
6683 convertException<MT1,OMT2>( ex );
6684 }
6685
6686 checkResults<MT1,OMT2>();
6687
6688 try {
6689 initResults();
6690 dres_ += declupp( kron( olhs, rhs ) );
6691 odres_ += declupp( kron( olhs, rhs ) );
6692 sres_ += declupp( kron( olhs, rhs ) );
6693 osres_ += declupp( kron( olhs, rhs ) );
6694 refres_ += declupp( kron( reflhs, refrhs ) );
6695 }
6696 catch( std::exception& ex ) {
6697 convertException<OMT1,MT2>( ex );
6698 }
6699
6700 checkResults<OMT1,MT2>();
6701
6702 try {
6703 initResults();
6704 dres_ += declupp( kron( olhs, orhs ) );
6705 odres_ += declupp( kron( olhs, orhs ) );
6706 sres_ += declupp( kron( olhs, orhs ) );
6707 osres_ += declupp( kron( olhs, orhs ) );
6708 refres_ += declupp( kron( reflhs, refrhs ) );
6709 }
6710 catch( std::exception& ex ) {
6711 convertException<OMT1,OMT2>( ex );
6712 }
6713
6714 checkResults<OMT1,OMT2>();
6715 }
6716
6717 // Declupp Kronecker product with addition assignment with evaluated matrices
6718 {
6719 test_ = "Declupp Kronecker product with addition assignment with evaluated matrices";
6720 error_ = "Failed addition assignment operation";
6721
6722 try {
6723 initResults();
6724 dres_ += declupp( kron( eval( lhs ), eval( rhs ) ) );
6725 odres_ += declupp( kron( eval( lhs ), eval( rhs ) ) );
6726 sres_ += declupp( kron( eval( lhs ), eval( rhs ) ) );
6727 osres_ += declupp( kron( eval( lhs ), eval( rhs ) ) );
6728 refres_ += declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6729 }
6730 catch( std::exception& ex ) {
6731 convertException<MT1,MT2>( ex );
6732 }
6733
6734 checkResults<MT1,MT2>();
6735
6736 try {
6737 initResults();
6738 dres_ += declupp( kron( eval( lhs ), eval( orhs ) ) );
6739 odres_ += declupp( kron( eval( lhs ), eval( orhs ) ) );
6740 sres_ += declupp( kron( eval( lhs ), eval( orhs ) ) );
6741 osres_ += declupp( kron( eval( lhs ), eval( orhs ) ) );
6742 refres_ += declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6743 }
6744 catch( std::exception& ex ) {
6745 convertException<MT1,OMT2>( ex );
6746 }
6747
6748 checkResults<MT1,OMT2>();
6749
6750 try {
6751 initResults();
6752 dres_ += declupp( kron( eval( olhs ), eval( rhs ) ) );
6753 odres_ += declupp( kron( eval( olhs ), eval( rhs ) ) );
6754 sres_ += declupp( kron( eval( olhs ), eval( rhs ) ) );
6755 osres_ += declupp( kron( eval( olhs ), eval( rhs ) ) );
6756 refres_ += declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6757 }
6758 catch( std::exception& ex ) {
6759 convertException<OMT1,MT2>( ex );
6760 }
6761
6762 checkResults<OMT1,MT2>();
6763
6764 try {
6765 initResults();
6766 dres_ += declupp( kron( eval( olhs ), eval( orhs ) ) );
6767 odres_ += declupp( kron( eval( olhs ), eval( orhs ) ) );
6768 sres_ += declupp( kron( eval( olhs ), eval( orhs ) ) );
6769 osres_ += declupp( kron( eval( olhs ), eval( orhs ) ) );
6770 refres_ += declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6771 }
6772 catch( std::exception& ex ) {
6773 convertException<OMT1,OMT2>( ex );
6774 }
6775
6776 checkResults<OMT1,OMT2>();
6777 }
6778
6779
6780 //=====================================================================================
6781 // Declupp Kronecker product with subtraction assignment
6782 //=====================================================================================
6783
6784 // Declupp Kronecker product with subtraction assignment with the given matrices
6785 {
6786 test_ = "Declupp Kronecker product with subtraction assignment with the given matrices";
6787 error_ = "Failed subtraction assignment operation";
6788
6789 try {
6790 initResults();
6791 dres_ -= declupp( kron( lhs, rhs ) );
6792 odres_ -= declupp( kron( lhs, rhs ) );
6793 sres_ -= declupp( kron( lhs, rhs ) );
6794 osres_ -= declupp( kron( lhs, rhs ) );
6795 refres_ -= declupp( kron( reflhs, refrhs ) );
6796 }
6797 catch( std::exception& ex ) {
6798 convertException<MT1,MT2>( ex );
6799 }
6800
6801 checkResults<MT1,MT2>();
6802
6803 try {
6804 initResults();
6805 dres_ -= declupp( kron( lhs, orhs ) );
6806 odres_ -= declupp( kron( lhs, orhs ) );
6807 sres_ -= declupp( kron( lhs, orhs ) );
6808 osres_ -= declupp( kron( lhs, orhs ) );
6809 refres_ -= declupp( kron( reflhs, refrhs ) );
6810 }
6811 catch( std::exception& ex ) {
6812 convertException<MT1,OMT2>( ex );
6813 }
6814
6815 checkResults<MT1,OMT2>();
6816
6817 try {
6818 initResults();
6819 dres_ -= declupp( kron( olhs, rhs ) );
6820 odres_ -= declupp( kron( olhs, rhs ) );
6821 sres_ -= declupp( kron( olhs, rhs ) );
6822 osres_ -= declupp( kron( olhs, rhs ) );
6823 refres_ -= declupp( kron( reflhs, refrhs ) );
6824 }
6825 catch( std::exception& ex ) {
6826 convertException<OMT1,MT2>( ex );
6827 }
6828
6829 checkResults<OMT1,MT2>();
6830
6831 try {
6832 initResults();
6833 dres_ -= declupp( kron( olhs, orhs ) );
6834 odres_ -= declupp( kron( olhs, orhs ) );
6835 sres_ -= declupp( kron( olhs, orhs ) );
6836 osres_ -= declupp( kron( olhs, orhs ) );
6837 refres_ -= declupp( kron( reflhs, refrhs ) );
6838 }
6839 catch( std::exception& ex ) {
6840 convertException<OMT1,OMT2>( ex );
6841 }
6842
6843 checkResults<OMT1,OMT2>();
6844 }
6845
6846 // Declupp Kronecker product with subtraction assignment with evaluated matrices
6847 {
6848 test_ = "Declupp Kronecker product with subtraction assignment with evaluated matrices";
6849 error_ = "Failed subtraction assignment operation";
6850
6851 try {
6852 initResults();
6853 dres_ -= declupp( kron( eval( lhs ), eval( rhs ) ) );
6854 odres_ -= declupp( kron( eval( lhs ), eval( rhs ) ) );
6855 sres_ -= declupp( kron( eval( lhs ), eval( rhs ) ) );
6856 osres_ -= declupp( kron( eval( lhs ), eval( rhs ) ) );
6857 refres_ -= declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6858 }
6859 catch( std::exception& ex ) {
6860 convertException<MT1,MT2>( ex );
6861 }
6862
6863 checkResults<MT1,MT2>();
6864
6865 try {
6866 initResults();
6867 dres_ -= declupp( kron( eval( lhs ), eval( orhs ) ) );
6868 odres_ -= declupp( kron( eval( lhs ), eval( orhs ) ) );
6869 sres_ -= declupp( kron( eval( lhs ), eval( orhs ) ) );
6870 osres_ -= declupp( kron( eval( lhs ), eval( orhs ) ) );
6871 refres_ -= declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6872 }
6873 catch( std::exception& ex ) {
6874 convertException<MT1,OMT2>( ex );
6875 }
6876
6877 checkResults<MT1,OMT2>();
6878
6879 try {
6880 initResults();
6881 dres_ -= declupp( kron( eval( olhs ), eval( rhs ) ) );
6882 odres_ -= declupp( kron( eval( olhs ), eval( rhs ) ) );
6883 sres_ -= declupp( kron( eval( olhs ), eval( rhs ) ) );
6884 osres_ -= declupp( kron( eval( olhs ), eval( rhs ) ) );
6885 refres_ -= declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6886 }
6887 catch( std::exception& ex ) {
6888 convertException<OMT1,MT2>( ex );
6889 }
6890
6891 checkResults<OMT1,MT2>();
6892
6893 try {
6894 initResults();
6895 dres_ -= declupp( kron( eval( olhs ), eval( orhs ) ) );
6896 odres_ -= declupp( kron( eval( olhs ), eval( orhs ) ) );
6897 sres_ -= declupp( kron( eval( olhs ), eval( orhs ) ) );
6898 osres_ -= declupp( kron( eval( olhs ), eval( orhs ) ) );
6899 refres_ -= declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6900 }
6901 catch( std::exception& ex ) {
6902 convertException<OMT1,OMT2>( ex );
6903 }
6904
6905 checkResults<OMT1,OMT2>();
6906 }
6907
6908
6909 //=====================================================================================
6910 // Declupp Kronecker product with Schur product assignment
6911 //=====================================================================================
6912
6913 // Declupp Kronecker product with Schur product assignment with the given matrices
6914 {
6915 test_ = "Declupp Kronecker product with Schur product assignment with the given matrices";
6916 error_ = "Failed Schur product assignment operation";
6917
6918 try {
6919 initResults();
6920 dres_ %= declupp( kron( lhs, rhs ) );
6921 odres_ %= declupp( kron( lhs, rhs ) );
6922 sres_ %= declupp( kron( lhs, rhs ) );
6923 osres_ %= declupp( kron( lhs, rhs ) );
6924 refres_ %= declupp( kron( reflhs, refrhs ) );
6925 }
6926 catch( std::exception& ex ) {
6927 convertException<MT1,MT2>( ex );
6928 }
6929
6930 checkResults<MT1,MT2>();
6931
6932 try {
6933 initResults();
6934 dres_ %= declupp( kron( lhs, orhs ) );
6935 odres_ %= declupp( kron( lhs, orhs ) );
6936 sres_ %= declupp( kron( lhs, orhs ) );
6937 osres_ %= declupp( kron( lhs, orhs ) );
6938 refres_ %= declupp( kron( reflhs, refrhs ) );
6939 }
6940 catch( std::exception& ex ) {
6941 convertException<MT1,OMT2>( ex );
6942 }
6943
6944 checkResults<MT1,OMT2>();
6945
6946 try {
6947 initResults();
6948 dres_ %= declupp( kron( olhs, rhs ) );
6949 odres_ %= declupp( kron( olhs, rhs ) );
6950 sres_ %= declupp( kron( olhs, rhs ) );
6951 osres_ %= declupp( kron( olhs, rhs ) );
6952 refres_ %= declupp( kron( reflhs, refrhs ) );
6953 }
6954 catch( std::exception& ex ) {
6955 convertException<OMT1,MT2>( ex );
6956 }
6957
6958 checkResults<OMT1,MT2>();
6959
6960 try {
6961 initResults();
6962 dres_ %= declupp( kron( olhs, orhs ) );
6963 odres_ %= declupp( kron( olhs, orhs ) );
6964 sres_ %= declupp( kron( olhs, orhs ) );
6965 osres_ %= declupp( kron( olhs, orhs ) );
6966 refres_ %= declupp( kron( reflhs, refrhs ) );
6967 }
6968 catch( std::exception& ex ) {
6969 convertException<OMT1,OMT2>( ex );
6970 }
6971
6972 checkResults<OMT1,OMT2>();
6973 }
6974
6975 // Declupp Kronecker product with Schur product assignment with evaluated matrices
6976 {
6977 test_ = "Declupp Kronecker product with Schur product assignment with evaluated matrices";
6978 error_ = "Failed Schur product assignment operation";
6979
6980 try {
6981 initResults();
6982 dres_ %= declupp( kron( eval( lhs ), eval( rhs ) ) );
6983 odres_ %= declupp( kron( eval( lhs ), eval( rhs ) ) );
6984 sres_ %= declupp( kron( eval( lhs ), eval( rhs ) ) );
6985 osres_ %= declupp( kron( eval( lhs ), eval( rhs ) ) );
6986 refres_ %= declupp( kron( eval( reflhs ), eval( refrhs ) ) );
6987 }
6988 catch( std::exception& ex ) {
6989 convertException<MT1,MT2>( ex );
6990 }
6991
6992 checkResults<MT1,MT2>();
6993
6994 try {
6995 initResults();
6996 dres_ %= declupp( kron( eval( lhs ), eval( orhs ) ) );
6997 odres_ %= declupp( kron( eval( lhs ), eval( orhs ) ) );
6998 sres_ %= declupp( kron( eval( lhs ), eval( orhs ) ) );
6999 osres_ %= declupp( kron( eval( lhs ), eval( orhs ) ) );
7000 refres_ %= declupp( kron( eval( reflhs ), eval( refrhs ) ) );
7001 }
7002 catch( std::exception& ex ) {
7003 convertException<MT1,OMT2>( ex );
7004 }
7005
7006 checkResults<MT1,OMT2>();
7007
7008 try {
7009 initResults();
7010 dres_ %= declupp( kron( eval( olhs ), eval( rhs ) ) );
7011 odres_ %= declupp( kron( eval( olhs ), eval( rhs ) ) );
7012 sres_ %= declupp( kron( eval( olhs ), eval( rhs ) ) );
7013 osres_ %= declupp( kron( eval( olhs ), eval( rhs ) ) );
7014 refres_ %= declupp( kron( eval( reflhs ), eval( refrhs ) ) );
7015 }
7016 catch( std::exception& ex ) {
7017 convertException<OMT1,MT2>( ex );
7018 }
7019
7020 checkResults<OMT1,MT2>();
7021
7022 try {
7023 initResults();
7024 dres_ %= declupp( kron( eval( olhs ), eval( orhs ) ) );
7025 odres_ %= declupp( kron( eval( olhs ), eval( orhs ) ) );
7026 sres_ %= declupp( kron( eval( olhs ), eval( orhs ) ) );
7027 osres_ %= declupp( kron( eval( olhs ), eval( orhs ) ) );
7028 refres_ %= declupp( kron( eval( reflhs ), eval( refrhs ) ) );
7029 }
7030 catch( std::exception& ex ) {
7031 convertException<OMT1,OMT2>( ex );
7032 }
7033
7034 checkResults<OMT1,OMT2>();
7035 }
7036 }
7037 #endif
7038 }
7039 //*************************************************************************************************
7040
7041
7042 //*************************************************************************************************
7043 /*!\brief Skipping the upper sparse matrix/dense matrix Kronecker product.
7044 //
7045 // \return void
7046 //
7047 // This function is called in case the upper matrix/matrix Kronecker product operation is not
7048 // available for the given matrix types \a MT1 and \a MT2.
7049 */
7050 template< typename MT1 // Type of the left-hand side sparse matrix
7051 , typename MT2 > // Type of the right-hand side dense matrix
testDeclUppOperation(blaze::FalseType)7052 void OperationTest<MT1,MT2>::testDeclUppOperation( blaze::FalseType )
7053 {}
7054 //*************************************************************************************************
7055
7056
7057 //*************************************************************************************************
7058 /*!\brief Testing the diagonal sparse matrix/dense matrix Kronecker product.
7059 //
7060 // \return void
7061 // \exception std::runtime_error Kronecker product error detected.
7062 //
7063 // This function tests the diagonal matrix Kronecker product with plain assignment, addition
7064 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
7065 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
7066 // exception is thrown.
7067 */
7068 template< typename MT1 // Type of the left-hand side sparse matrix
7069 , typename MT2 > // Type of the right-hand side dense matrix
testDeclDiagOperation(blaze::TrueType)7070 void OperationTest<MT1,MT2>::testDeclDiagOperation( blaze::TrueType )
7071 {
7072 #if BLAZETEST_MATHTEST_TEST_DECLDIAG_OPERATION
7073 if( BLAZETEST_MATHTEST_TEST_DECLDIAG_OPERATION > 1 )
7074 {
7075 if( lhs_.rows() != lhs_.columns() || rhs_.rows() != rhs_.columns() )
7076 return;
7077
7078
7079 //=====================================================================================
7080 // Test-specific setup of the left-hand side operand
7081 //=====================================================================================
7082
7083 MT1 lhs( lhs_ );
7084
7085 blaze::resetLower( lhs );
7086 blaze::resetUpper( lhs );
7087
7088 OMT1 olhs ( lhs );
7089 RT1 reflhs( lhs );
7090
7091
7092 //=====================================================================================
7093 // Test-specific setup of the right-hand side operand
7094 //=====================================================================================
7095
7096 MT2 rhs( rhs_ );
7097
7098 blaze::resetLower( rhs );
7099 blaze::resetUpper( rhs );
7100
7101 OMT2 orhs ( rhs );
7102 RT2 refrhs( rhs );
7103
7104
7105 //=====================================================================================
7106 // Decldiag Kronecker product
7107 //=====================================================================================
7108
7109 // Decldiag Kronecker product with the given matrices
7110 {
7111 test_ = "Decldiag Kronecker product with the given matrices";
7112 error_ = "Failed Kronecker product operation";
7113
7114 try {
7115 initResults();
7116 dres_ = decldiag( kron( lhs, rhs ) );
7117 odres_ = decldiag( kron( lhs, rhs ) );
7118 sres_ = decldiag( kron( lhs, rhs ) );
7119 osres_ = decldiag( kron( lhs, rhs ) );
7120 refres_ = decldiag( kron( reflhs, refrhs ) );
7121 }
7122 catch( std::exception& ex ) {
7123 convertException<MT1,MT2>( ex );
7124 }
7125
7126 checkResults<MT1,MT2>();
7127
7128 try {
7129 initResults();
7130 dres_ = decldiag( kron( lhs, orhs ) );
7131 odres_ = decldiag( kron( lhs, orhs ) );
7132 sres_ = decldiag( kron( lhs, orhs ) );
7133 osres_ = decldiag( kron( lhs, orhs ) );
7134 refres_ = decldiag( kron( reflhs, refrhs ) );
7135 }
7136 catch( std::exception& ex ) {
7137 convertException<MT1,OMT2>( ex );
7138 }
7139
7140 checkResults<MT1,OMT2>();
7141
7142 try {
7143 initResults();
7144 dres_ = decldiag( kron( olhs, rhs ) );
7145 odres_ = decldiag( kron( olhs, rhs ) );
7146 sres_ = decldiag( kron( olhs, rhs ) );
7147 osres_ = decldiag( kron( olhs, rhs ) );
7148 refres_ = decldiag( kron( reflhs, refrhs ) );
7149 }
7150 catch( std::exception& ex ) {
7151 convertException<OMT1,MT2>( ex );
7152 }
7153
7154 checkResults<OMT1,MT2>();
7155
7156 try {
7157 initResults();
7158 dres_ = decldiag( kron( olhs, orhs ) );
7159 odres_ = decldiag( kron( olhs, orhs ) );
7160 sres_ = decldiag( kron( olhs, orhs ) );
7161 osres_ = decldiag( kron( olhs, orhs ) );
7162 refres_ = decldiag( kron( reflhs, refrhs ) );
7163 }
7164 catch( std::exception& ex ) {
7165 convertException<OMT1,OMT2>( ex );
7166 }
7167
7168 checkResults<OMT1,OMT2>();
7169 }
7170
7171 // Decldiag Kronecker product with evaluated matrices
7172 {
7173 test_ = "Decldiag Kronecker product with evaluated left-hand side matrix";
7174 error_ = "Failed Kronecker product operation";
7175
7176 try {
7177 initResults();
7178 dres_ = decldiag( kron( eval( lhs ), eval( rhs ) ) );
7179 odres_ = decldiag( kron( eval( lhs ), eval( rhs ) ) );
7180 sres_ = decldiag( kron( eval( lhs ), eval( rhs ) ) );
7181 osres_ = decldiag( kron( eval( lhs ), eval( rhs ) ) );
7182 refres_ = decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7183 }
7184 catch( std::exception& ex ) {
7185 convertException<MT1,MT2>( ex );
7186 }
7187
7188 checkResults<MT1,MT2>();
7189
7190 try {
7191 initResults();
7192 dres_ = decldiag( kron( eval( lhs ), eval( orhs ) ) );
7193 odres_ = decldiag( kron( eval( lhs ), eval( orhs ) ) );
7194 sres_ = decldiag( kron( eval( lhs ), eval( orhs ) ) );
7195 osres_ = decldiag( kron( eval( lhs ), eval( orhs ) ) );
7196 refres_ = decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7197 }
7198 catch( std::exception& ex ) {
7199 convertException<MT1,OMT2>( ex );
7200 }
7201
7202 checkResults<MT1,OMT2>();
7203
7204 try {
7205 initResults();
7206 dres_ = decldiag( kron( eval( olhs ), eval( rhs ) ) );
7207 odres_ = decldiag( kron( eval( olhs ), eval( rhs ) ) );
7208 sres_ = decldiag( kron( eval( olhs ), eval( rhs ) ) );
7209 osres_ = decldiag( kron( eval( olhs ), eval( rhs ) ) );
7210 refres_ = decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7211 }
7212 catch( std::exception& ex ) {
7213 convertException<OMT1,MT2>( ex );
7214 }
7215
7216 checkResults<OMT1,MT2>();
7217
7218 try {
7219 initResults();
7220 dres_ = decldiag( kron( eval( olhs ), eval( orhs ) ) );
7221 odres_ = decldiag( kron( eval( olhs ), eval( orhs ) ) );
7222 sres_ = decldiag( kron( eval( olhs ), eval( orhs ) ) );
7223 osres_ = decldiag( kron( eval( olhs ), eval( orhs ) ) );
7224 refres_ = decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7225 }
7226 catch( std::exception& ex ) {
7227 convertException<OMT1,OMT2>( ex );
7228 }
7229
7230 checkResults<OMT1,OMT2>();
7231 }
7232
7233
7234 //=====================================================================================
7235 // Decldiag Kronecker product with addition assignment
7236 //=====================================================================================
7237
7238 // Decldiag Kronecker product with addition assignment with the given matrices
7239 {
7240 test_ = "Decldiag Kronecker product with addition assignment with the given matrices";
7241 error_ = "Failed addition assignment operation";
7242
7243 try {
7244 initResults();
7245 dres_ += decldiag( kron( lhs, rhs ) );
7246 odres_ += decldiag( kron( lhs, rhs ) );
7247 sres_ += decldiag( kron( lhs, rhs ) );
7248 osres_ += decldiag( kron( lhs, rhs ) );
7249 refres_ += decldiag( kron( reflhs, refrhs ) );
7250 }
7251 catch( std::exception& ex ) {
7252 convertException<MT1,MT2>( ex );
7253 }
7254
7255 checkResults<MT1,MT2>();
7256
7257 try {
7258 initResults();
7259 dres_ += decldiag( kron( lhs, orhs ) );
7260 odres_ += decldiag( kron( lhs, orhs ) );
7261 sres_ += decldiag( kron( lhs, orhs ) );
7262 osres_ += decldiag( kron( lhs, orhs ) );
7263 refres_ += decldiag( kron( reflhs, refrhs ) );
7264 }
7265 catch( std::exception& ex ) {
7266 convertException<MT1,OMT2>( ex );
7267 }
7268
7269 checkResults<MT1,OMT2>();
7270
7271 try {
7272 initResults();
7273 dres_ += decldiag( kron( olhs, rhs ) );
7274 odres_ += decldiag( kron( olhs, rhs ) );
7275 sres_ += decldiag( kron( olhs, rhs ) );
7276 osres_ += decldiag( kron( olhs, rhs ) );
7277 refres_ += decldiag( kron( reflhs, refrhs ) );
7278 }
7279 catch( std::exception& ex ) {
7280 convertException<OMT1,MT2>( ex );
7281 }
7282
7283 checkResults<OMT1,MT2>();
7284
7285 try {
7286 initResults();
7287 dres_ += decldiag( kron( olhs, orhs ) );
7288 odres_ += decldiag( kron( olhs, orhs ) );
7289 sres_ += decldiag( kron( olhs, orhs ) );
7290 osres_ += decldiag( kron( olhs, orhs ) );
7291 refres_ += decldiag( kron( reflhs, refrhs ) );
7292 }
7293 catch( std::exception& ex ) {
7294 convertException<OMT1,OMT2>( ex );
7295 }
7296
7297 checkResults<OMT1,OMT2>();
7298 }
7299
7300 // Decldiag Kronecker product with addition assignment with evaluated matrices
7301 {
7302 test_ = "Decldiag Kronecker product with addition assignment with evaluated matrices";
7303 error_ = "Failed addition assignment operation";
7304
7305 try {
7306 initResults();
7307 dres_ += decldiag( kron( eval( lhs ), eval( rhs ) ) );
7308 odres_ += decldiag( kron( eval( lhs ), eval( rhs ) ) );
7309 sres_ += decldiag( kron( eval( lhs ), eval( rhs ) ) );
7310 osres_ += decldiag( kron( eval( lhs ), eval( rhs ) ) );
7311 refres_ += decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7312 }
7313 catch( std::exception& ex ) {
7314 convertException<MT1,MT2>( ex );
7315 }
7316
7317 checkResults<MT1,MT2>();
7318
7319 try {
7320 initResults();
7321 dres_ += decldiag( kron( eval( lhs ), eval( orhs ) ) );
7322 odres_ += decldiag( kron( eval( lhs ), eval( orhs ) ) );
7323 sres_ += decldiag( kron( eval( lhs ), eval( orhs ) ) );
7324 osres_ += decldiag( kron( eval( lhs ), eval( orhs ) ) );
7325 refres_ += decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7326 }
7327 catch( std::exception& ex ) {
7328 convertException<MT1,OMT2>( ex );
7329 }
7330
7331 checkResults<MT1,OMT2>();
7332
7333 try {
7334 initResults();
7335 dres_ += decldiag( kron( eval( olhs ), eval( rhs ) ) );
7336 odres_ += decldiag( kron( eval( olhs ), eval( rhs ) ) );
7337 sres_ += decldiag( kron( eval( olhs ), eval( rhs ) ) );
7338 osres_ += decldiag( kron( eval( olhs ), eval( rhs ) ) );
7339 refres_ += decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7340 }
7341 catch( std::exception& ex ) {
7342 convertException<OMT1,MT2>( ex );
7343 }
7344
7345 checkResults<OMT1,MT2>();
7346
7347 try {
7348 initResults();
7349 dres_ += decldiag( kron( eval( olhs ), eval( orhs ) ) );
7350 odres_ += decldiag( kron( eval( olhs ), eval( orhs ) ) );
7351 sres_ += decldiag( kron( eval( olhs ), eval( orhs ) ) );
7352 osres_ += decldiag( kron( eval( olhs ), eval( orhs ) ) );
7353 refres_ += decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7354 }
7355 catch( std::exception& ex ) {
7356 convertException<OMT1,OMT2>( ex );
7357 }
7358
7359 checkResults<OMT1,OMT2>();
7360 }
7361
7362
7363 //=====================================================================================
7364 // Decldiag Kronecker product with subtraction assignment
7365 //=====================================================================================
7366
7367 // Decldiag Kronecker product with subtraction assignment with the given matrices
7368 {
7369 test_ = "Decldiag Kronecker product with subtraction assignment with the given matrices";
7370 error_ = "Failed subtraction assignment operation";
7371
7372 try {
7373 initResults();
7374 dres_ -= decldiag( kron( lhs, rhs ) );
7375 odres_ -= decldiag( kron( lhs, rhs ) );
7376 sres_ -= decldiag( kron( lhs, rhs ) );
7377 osres_ -= decldiag( kron( lhs, rhs ) );
7378 refres_ -= decldiag( kron( reflhs, refrhs ) );
7379 }
7380 catch( std::exception& ex ) {
7381 convertException<MT1,MT2>( ex );
7382 }
7383
7384 checkResults<MT1,MT2>();
7385
7386 try {
7387 initResults();
7388 dres_ -= decldiag( kron( lhs, orhs ) );
7389 odres_ -= decldiag( kron( lhs, orhs ) );
7390 sres_ -= decldiag( kron( lhs, orhs ) );
7391 osres_ -= decldiag( kron( lhs, orhs ) );
7392 refres_ -= decldiag( kron( reflhs, refrhs ) );
7393 }
7394 catch( std::exception& ex ) {
7395 convertException<MT1,OMT2>( ex );
7396 }
7397
7398 checkResults<MT1,OMT2>();
7399
7400 try {
7401 initResults();
7402 dres_ -= decldiag( kron( olhs, rhs ) );
7403 odres_ -= decldiag( kron( olhs, rhs ) );
7404 sres_ -= decldiag( kron( olhs, rhs ) );
7405 osres_ -= decldiag( kron( olhs, rhs ) );
7406 refres_ -= decldiag( kron( reflhs, refrhs ) );
7407 }
7408 catch( std::exception& ex ) {
7409 convertException<OMT1,MT2>( ex );
7410 }
7411
7412 checkResults<OMT1,MT2>();
7413
7414 try {
7415 initResults();
7416 dres_ -= decldiag( kron( olhs, orhs ) );
7417 odres_ -= decldiag( kron( olhs, orhs ) );
7418 sres_ -= decldiag( kron( olhs, orhs ) );
7419 osres_ -= decldiag( kron( olhs, orhs ) );
7420 refres_ -= decldiag( kron( reflhs, refrhs ) );
7421 }
7422 catch( std::exception& ex ) {
7423 convertException<OMT1,OMT2>( ex );
7424 }
7425
7426 checkResults<OMT1,OMT2>();
7427 }
7428
7429 // Decldiag Kronecker product with subtraction assignment with evaluated matrices
7430 {
7431 test_ = "Decldiag Kronecker product with subtraction assignment with evaluated matrices";
7432 error_ = "Failed subtraction assignment operation";
7433
7434 try {
7435 initResults();
7436 dres_ -= decldiag( kron( eval( lhs ), eval( rhs ) ) );
7437 odres_ -= decldiag( kron( eval( lhs ), eval( rhs ) ) );
7438 sres_ -= decldiag( kron( eval( lhs ), eval( rhs ) ) );
7439 osres_ -= decldiag( kron( eval( lhs ), eval( rhs ) ) );
7440 refres_ -= decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7441 }
7442 catch( std::exception& ex ) {
7443 convertException<MT1,MT2>( ex );
7444 }
7445
7446 checkResults<MT1,MT2>();
7447
7448 try {
7449 initResults();
7450 dres_ -= decldiag( kron( eval( lhs ), eval( orhs ) ) );
7451 odres_ -= decldiag( kron( eval( lhs ), eval( orhs ) ) );
7452 sres_ -= decldiag( kron( eval( lhs ), eval( orhs ) ) );
7453 osres_ -= decldiag( kron( eval( lhs ), eval( orhs ) ) );
7454 refres_ -= decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7455 }
7456 catch( std::exception& ex ) {
7457 convertException<MT1,OMT2>( ex );
7458 }
7459
7460 checkResults<MT1,OMT2>();
7461
7462 try {
7463 initResults();
7464 dres_ -= decldiag( kron( eval( olhs ), eval( rhs ) ) );
7465 odres_ -= decldiag( kron( eval( olhs ), eval( rhs ) ) );
7466 sres_ -= decldiag( kron( eval( olhs ), eval( rhs ) ) );
7467 osres_ -= decldiag( kron( eval( olhs ), eval( rhs ) ) );
7468 refres_ -= decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7469 }
7470 catch( std::exception& ex ) {
7471 convertException<OMT1,MT2>( ex );
7472 }
7473
7474 checkResults<OMT1,MT2>();
7475
7476 try {
7477 initResults();
7478 dres_ -= decldiag( kron( eval( olhs ), eval( orhs ) ) );
7479 odres_ -= decldiag( kron( eval( olhs ), eval( orhs ) ) );
7480 sres_ -= decldiag( kron( eval( olhs ), eval( orhs ) ) );
7481 osres_ -= decldiag( kron( eval( olhs ), eval( orhs ) ) );
7482 refres_ -= decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7483 }
7484 catch( std::exception& ex ) {
7485 convertException<OMT1,OMT2>( ex );
7486 }
7487
7488 checkResults<OMT1,OMT2>();
7489 }
7490
7491
7492 //=====================================================================================
7493 // Decldiag Kronecker product with Schur product assignment
7494 //=====================================================================================
7495
7496 // Decldiag Kronecker product with Schur product assignment with the given matrices
7497 {
7498 test_ = "Decldiag Kronecker product with Schur product assignment with the given matrices";
7499 error_ = "Failed Schur product assignment operation";
7500
7501 try {
7502 initResults();
7503 dres_ %= decldiag( kron( lhs, rhs ) );
7504 odres_ %= decldiag( kron( lhs, rhs ) );
7505 sres_ %= decldiag( kron( lhs, rhs ) );
7506 osres_ %= decldiag( kron( lhs, rhs ) );
7507 refres_ %= decldiag( kron( reflhs, refrhs ) );
7508 }
7509 catch( std::exception& ex ) {
7510 convertException<MT1,MT2>( ex );
7511 }
7512
7513 checkResults<MT1,MT2>();
7514
7515 try {
7516 initResults();
7517 dres_ %= decldiag( kron( lhs, orhs ) );
7518 odres_ %= decldiag( kron( lhs, orhs ) );
7519 sres_ %= decldiag( kron( lhs, orhs ) );
7520 osres_ %= decldiag( kron( lhs, orhs ) );
7521 refres_ %= decldiag( kron( reflhs, refrhs ) );
7522 }
7523 catch( std::exception& ex ) {
7524 convertException<MT1,OMT2>( ex );
7525 }
7526
7527 checkResults<MT1,OMT2>();
7528
7529 try {
7530 initResults();
7531 dres_ %= decldiag( kron( olhs, rhs ) );
7532 odres_ %= decldiag( kron( olhs, rhs ) );
7533 sres_ %= decldiag( kron( olhs, rhs ) );
7534 osres_ %= decldiag( kron( olhs, rhs ) );
7535 refres_ %= decldiag( kron( reflhs, refrhs ) );
7536 }
7537 catch( std::exception& ex ) {
7538 convertException<OMT1,MT2>( ex );
7539 }
7540
7541 checkResults<OMT1,MT2>();
7542
7543 try {
7544 initResults();
7545 dres_ %= decldiag( kron( olhs, orhs ) );
7546 odres_ %= decldiag( kron( olhs, orhs ) );
7547 sres_ %= decldiag( kron( olhs, orhs ) );
7548 osres_ %= decldiag( kron( olhs, orhs ) );
7549 refres_ %= decldiag( kron( reflhs, refrhs ) );
7550 }
7551 catch( std::exception& ex ) {
7552 convertException<OMT1,OMT2>( ex );
7553 }
7554
7555 checkResults<OMT1,OMT2>();
7556 }
7557
7558 // Decldiag Kronecker product with Schur product assignment with evaluated matrices
7559 {
7560 test_ = "Decldiag Kronecker product with Schur product assignment with evaluated matrices";
7561 error_ = "Failed Schur product assignment operation";
7562
7563 try {
7564 initResults();
7565 dres_ %= decldiag( kron( eval( lhs ), eval( rhs ) ) );
7566 odres_ %= decldiag( kron( eval( lhs ), eval( rhs ) ) );
7567 sres_ %= decldiag( kron( eval( lhs ), eval( rhs ) ) );
7568 osres_ %= decldiag( kron( eval( lhs ), eval( rhs ) ) );
7569 refres_ %= decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7570 }
7571 catch( std::exception& ex ) {
7572 convertException<MT1,MT2>( ex );
7573 }
7574
7575 checkResults<MT1,MT2>();
7576
7577 try {
7578 initResults();
7579 dres_ %= decldiag( kron( eval( lhs ), eval( orhs ) ) );
7580 odres_ %= decldiag( kron( eval( lhs ), eval( orhs ) ) );
7581 sres_ %= decldiag( kron( eval( lhs ), eval( orhs ) ) );
7582 osres_ %= decldiag( kron( eval( lhs ), eval( orhs ) ) );
7583 refres_ %= decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7584 }
7585 catch( std::exception& ex ) {
7586 convertException<MT1,OMT2>( ex );
7587 }
7588
7589 checkResults<MT1,OMT2>();
7590
7591 try {
7592 initResults();
7593 dres_ %= decldiag( kron( eval( olhs ), eval( rhs ) ) );
7594 odres_ %= decldiag( kron( eval( olhs ), eval( rhs ) ) );
7595 sres_ %= decldiag( kron( eval( olhs ), eval( rhs ) ) );
7596 osres_ %= decldiag( kron( eval( olhs ), eval( rhs ) ) );
7597 refres_ %= decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7598 }
7599 catch( std::exception& ex ) {
7600 convertException<OMT1,MT2>( ex );
7601 }
7602
7603 checkResults<OMT1,MT2>();
7604
7605 try {
7606 initResults();
7607 dres_ %= decldiag( kron( eval( olhs ), eval( orhs ) ) );
7608 odres_ %= decldiag( kron( eval( olhs ), eval( orhs ) ) );
7609 sres_ %= decldiag( kron( eval( olhs ), eval( orhs ) ) );
7610 osres_ %= decldiag( kron( eval( olhs ), eval( orhs ) ) );
7611 refres_ %= decldiag( kron( eval( reflhs ), eval( refrhs ) ) );
7612 }
7613 catch( std::exception& ex ) {
7614 convertException<OMT1,OMT2>( ex );
7615 }
7616
7617 checkResults<OMT1,OMT2>();
7618 }
7619 }
7620 #endif
7621 }
7622 //*************************************************************************************************
7623
7624
7625 //*************************************************************************************************
7626 /*!\brief Skipping the diagonal sparse matrix/dense matrix Kronecker product.
7627 //
7628 // \return void
7629 //
7630 // This function is called in case the diagonal matrix/matrix Kronecker product operation is not
7631 // available for the given matrix types \a MT1 and \a MT2.
7632 */
7633 template< typename MT1 // Type of the left-hand side sparse matrix
7634 , typename MT2 > // Type of the right-hand side dense matrix
testDeclDiagOperation(blaze::FalseType)7635 void OperationTest<MT1,MT2>::testDeclDiagOperation( blaze::FalseType )
7636 {}
7637 //*************************************************************************************************
7638
7639
7640 //*************************************************************************************************
7641 /*!\brief Testing the submatrix-wise sparse matrix/dense matrix Kronecker product.
7642 //
7643 // \return void
7644 // \exception std::runtime_error Kronecker product error detected.
7645 //
7646 // This function tests the submatrix-wise matrix Kronecker product with plain assignment,
7647 // addition assignment, subtraction assignment, and Schur product assignment. In case
7648 // any error resulting from the subtraction or the subsequent assignment is detected,
7649 // a \a std::runtime_error exception is thrown.
7650 */
7651 template< typename MT1 // Type of the left-hand side sparse matrix
7652 , typename MT2 > // Type of the right-hand side dense matrix
testSubmatrixOperation(blaze::TrueType)7653 void OperationTest<MT1,MT2>::testSubmatrixOperation( blaze::TrueType )
7654 {
7655 #if BLAZETEST_MATHTEST_TEST_SUBMATRIX_OPERATION
7656 if( BLAZETEST_MATHTEST_TEST_SUBMATRIX_OPERATION > 1 )
7657 {
7658 if( lhs_.rows() * rhs_.rows() == 0UL || lhs_.columns() * rhs_.columns() == 0UL )
7659 return;
7660
7661
7662 //=====================================================================================
7663 // Submatrix-wise Kronecker product
7664 //=====================================================================================
7665
7666 // Submatrix-wise Kronecker product with the given matrices
7667 {
7668 test_ = "Submatrix-wise Kronecker product with the given matrices";
7669 error_ = "Failed Kronecker product operation";
7670
7671 try {
7672 initResults();
7673 for( size_t row=0UL, m=0UL; row<lhs_.rows()*rhs_.rows(); row+=m ) {
7674 m = blaze::rand<size_t>( 1UL, lhs_.rows()*rhs_.rows() - row );
7675 for( size_t column=0UL, n=0UL; column<lhs_.columns()*rhs_.columns(); column+=n ) {
7676 n = blaze::rand<size_t>( 1UL, lhs_.columns()*rhs_.columns() - column );
7677 submatrix( dres_ , row, column, m, n ) = submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
7678 submatrix( odres_ , row, column, m, n ) = submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
7679 submatrix( sres_ , row, column, m, n ) = submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
7680 submatrix( osres_ , row, column, m, n ) = submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
7681 submatrix( refres_, row, column, m, n ) = submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
7682 }
7683 }
7684 }
7685 catch( std::exception& ex ) {
7686 convertException<MT1,MT2>( ex );
7687 }
7688
7689 checkResults<MT1,MT2>();
7690
7691 try {
7692 initResults();
7693 for( size_t row=0UL, m=0UL; row<lhs_.rows()*orhs_.rows(); row+=m ) {
7694 m = blaze::rand<size_t>( 1UL, lhs_.rows()*orhs_.rows() - row );
7695 for( size_t column=0UL, n=0UL; column<lhs_.columns()*orhs_.columns(); column+=n ) {
7696 n = blaze::rand<size_t>( 1UL, lhs_.columns()*orhs_.columns() - column );
7697 submatrix( dres_ , row, column, m, n ) = submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
7698 submatrix( odres_ , row, column, m, n ) = submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
7699 submatrix( sres_ , row, column, m, n ) = submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
7700 submatrix( osres_ , row, column, m, n ) = submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
7701 submatrix( refres_, row, column, m, n ) = submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
7702 }
7703 }
7704 }
7705 catch( std::exception& ex ) {
7706 convertException<MT1,OMT2>( ex );
7707 }
7708
7709 checkResults<MT1,OMT2>();
7710
7711 try {
7712 initResults();
7713 for( size_t row=0UL, m=0UL; row<olhs_.rows()*rhs_.rows(); row+=m ) {
7714 m = blaze::rand<size_t>( 1UL, olhs_.rows()*rhs_.rows() - row );
7715 for( size_t column=0UL, n=0UL; column<olhs_.columns()*rhs_.columns(); column+=n ) {
7716 n = blaze::rand<size_t>( 1UL, olhs_.columns()*rhs_.columns() - column );
7717 submatrix( dres_ , row, column, m, n ) = submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
7718 submatrix( odres_ , row, column, m, n ) = submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
7719 submatrix( sres_ , row, column, m, n ) = submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
7720 submatrix( osres_ , row, column, m, n ) = submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
7721 submatrix( refres_, row, column, m, n ) = submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
7722 }
7723 }
7724 }
7725 catch( std::exception& ex ) {
7726 convertException<OMT1,MT2>( ex );
7727 }
7728
7729 checkResults<OMT1,MT2>();
7730
7731 try {
7732 initResults();
7733 for( size_t row=0UL, m=0UL; row<olhs_.rows()*orhs_.rows(); row+=m ) {
7734 m = blaze::rand<size_t>( 1UL, olhs_.rows()*orhs_.rows() - row );
7735 for( size_t column=0UL, n=0UL; column<olhs_.columns()*orhs_.columns(); column+=n ) {
7736 n = blaze::rand<size_t>( 1UL, olhs_.columns()*orhs_.columns() - column );
7737 submatrix( dres_ , row, column, m, n ) = submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
7738 submatrix( odres_ , row, column, m, n ) = submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
7739 submatrix( sres_ , row, column, m, n ) = submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
7740 submatrix( osres_ , row, column, m, n ) = submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
7741 submatrix( refres_, row, column, m, n ) = submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
7742 }
7743 }
7744 }
7745 catch( std::exception& ex ) {
7746 convertException<OMT1,OMT2>( ex );
7747 }
7748
7749 checkResults<OMT1,OMT2>();
7750 }
7751
7752 // Submatrix-wise Kronecker product with evaluated matrices
7753 {
7754 test_ = "Submatrix-wise Kronecker product with evaluated matrices";
7755 error_ = "Failed Kronecker product operation";
7756
7757 try {
7758 initResults();
7759 for( size_t row=0UL, m=0UL; row<lhs_.rows()*rhs_.rows(); row+=m ) {
7760 m = blaze::rand<size_t>( 1UL, lhs_.rows()*rhs_.rows() - row );
7761 for( size_t column=0UL, n=0UL; column<lhs_.columns()*rhs_.columns(); column+=n ) {
7762 n = blaze::rand<size_t>( 1UL, lhs_.columns()*rhs_.columns() - column );
7763 submatrix( dres_ , row, column, m, n ) = submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
7764 submatrix( odres_ , row, column, m, n ) = submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
7765 submatrix( sres_ , row, column, m, n ) = submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
7766 submatrix( osres_ , row, column, m, n ) = submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
7767 submatrix( refres_, row, column, m, n ) = submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
7768 }
7769 }
7770 }
7771 catch( std::exception& ex ) {
7772 convertException<MT1,MT2>( ex );
7773 }
7774
7775 checkResults<MT1,MT2>();
7776
7777 try {
7778 initResults();
7779 for( size_t row=0UL, m=0UL; row<lhs_.rows()*orhs_.rows(); row+=m ) {
7780 m = blaze::rand<size_t>( 1UL, lhs_.rows()*orhs_.rows() - row );
7781 for( size_t column=0UL, n=0UL; column<lhs_.columns()*orhs_.columns(); column+=n ) {
7782 n = blaze::rand<size_t>( 1UL, lhs_.columns()*orhs_.columns() - column );
7783 submatrix( dres_ , row, column, m, n ) = submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
7784 submatrix( odres_ , row, column, m, n ) = submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
7785 submatrix( sres_ , row, column, m, n ) = submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
7786 submatrix( osres_ , row, column, m, n ) = submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
7787 submatrix( refres_, row, column, m, n ) = submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
7788 }
7789 }
7790 }
7791 catch( std::exception& ex ) {
7792 convertException<MT1,OMT2>( ex );
7793 }
7794
7795 checkResults<MT1,OMT2>();
7796
7797 try {
7798 initResults();
7799 for( size_t row=0UL, m=0UL; row<olhs_.rows()*rhs_.rows(); row+=m ) {
7800 m = blaze::rand<size_t>( 1UL, olhs_.rows()*rhs_.rows() - row );
7801 for( size_t column=0UL, n=0UL; column<olhs_.columns()*rhs_.columns(); column+=n ) {
7802 n = blaze::rand<size_t>( 1UL, olhs_.columns()*rhs_.columns() - column );
7803 submatrix( dres_ , row, column, m, n ) = submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
7804 submatrix( odres_ , row, column, m, n ) = submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
7805 submatrix( sres_ , row, column, m, n ) = submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
7806 submatrix( osres_ , row, column, m, n ) = submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
7807 submatrix( refres_, row, column, m, n ) = submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
7808 }
7809 }
7810 }
7811 catch( std::exception& ex ) {
7812 convertException<OMT1,MT2>( ex );
7813 }
7814
7815 checkResults<OMT1,MT2>();
7816
7817 try {
7818 initResults();
7819 for( size_t row=0UL, m=0UL; row<olhs_.rows()*orhs_.rows(); row+=m ) {
7820 m = blaze::rand<size_t>( 1UL, olhs_.rows()*orhs_.rows() - row );
7821 for( size_t column=0UL, n=0UL; column<olhs_.columns()*orhs_.columns(); column+=n ) {
7822 n = blaze::rand<size_t>( 1UL, olhs_.columns()*orhs_.columns() - column );
7823 submatrix( dres_ , row, column, m, n ) = submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
7824 submatrix( odres_ , row, column, m, n ) = submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
7825 submatrix( sres_ , row, column, m, n ) = submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
7826 submatrix( osres_ , row, column, m, n ) = submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
7827 submatrix( refres_, row, column, m, n ) = submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
7828 }
7829 }
7830 }
7831 catch( std::exception& ex ) {
7832 convertException<OMT1,OMT2>( ex );
7833 }
7834
7835 checkResults<OMT1,OMT2>();
7836 }
7837
7838
7839 //=====================================================================================
7840 // Submatrix-wise Kronecker product with addition assignment
7841 //=====================================================================================
7842
7843 // Submatrix-wise Kronecker product with addition assignment with the given matrices
7844 {
7845 test_ = "Submatrix-wise Kronecker product with addition assignment with the given matrices";
7846 error_ = "Failed addition assignment operation";
7847
7848 try {
7849 initResults();
7850 for( size_t row=0UL, m=0UL; row<lhs_.rows()*rhs_.rows(); row+=m ) {
7851 m = blaze::rand<size_t>( 1UL, lhs_.rows()*rhs_.rows() - row );
7852 for( size_t column=0UL, n=0UL; column<lhs_.columns()*rhs_.columns(); column+=n ) {
7853 n = blaze::rand<size_t>( 1UL, lhs_.columns()*rhs_.columns() - column );
7854 submatrix( dres_ , row, column, m, n ) += submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
7855 submatrix( odres_ , row, column, m, n ) += submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
7856 submatrix( sres_ , row, column, m, n ) += submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
7857 submatrix( osres_ , row, column, m, n ) += submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
7858 submatrix( refres_, row, column, m, n ) += submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
7859 }
7860 }
7861 }
7862 catch( std::exception& ex ) {
7863 convertException<MT1,MT2>( ex );
7864 }
7865
7866 checkResults<MT1,MT2>();
7867
7868 try {
7869 initResults();
7870 for( size_t row=0UL, m=0UL; row<lhs_.rows()*orhs_.rows(); row+=m ) {
7871 m = blaze::rand<size_t>( 1UL, lhs_.rows()*orhs_.rows() - row );
7872 for( size_t column=0UL, n=0UL; column<lhs_.columns()*orhs_.columns(); column+=n ) {
7873 n = blaze::rand<size_t>( 1UL, lhs_.columns()*orhs_.columns() - column );
7874 submatrix( dres_ , row, column, m, n ) += submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
7875 submatrix( odres_ , row, column, m, n ) += submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
7876 submatrix( sres_ , row, column, m, n ) += submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
7877 submatrix( osres_ , row, column, m, n ) += submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
7878 submatrix( refres_, row, column, m, n ) += submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
7879 }
7880 }
7881 }
7882 catch( std::exception& ex ) {
7883 convertException<MT1,OMT2>( ex );
7884 }
7885
7886 checkResults<MT1,OMT2>();
7887
7888 try {
7889 initResults();
7890 for( size_t row=0UL, m=0UL; row<olhs_.rows()*rhs_.rows(); row+=m ) {
7891 m = blaze::rand<size_t>( 1UL, olhs_.rows()*rhs_.rows() - row );
7892 for( size_t column=0UL, n=0UL; column<olhs_.columns()*rhs_.columns(); column+=n ) {
7893 n = blaze::rand<size_t>( 1UL, olhs_.columns()*rhs_.columns() - column );
7894 submatrix( dres_ , row, column, m, n ) += submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
7895 submatrix( odres_ , row, column, m, n ) += submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
7896 submatrix( sres_ , row, column, m, n ) += submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
7897 submatrix( osres_ , row, column, m, n ) += submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
7898 submatrix( refres_, row, column, m, n ) += submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
7899 }
7900 }
7901 }
7902 catch( std::exception& ex ) {
7903 convertException<OMT1,MT2>( ex );
7904 }
7905
7906 checkResults<OMT1,MT2>();
7907
7908 try {
7909 initResults();
7910 for( size_t row=0UL, m=0UL; row<olhs_.rows()*orhs_.rows(); row+=m ) {
7911 m = blaze::rand<size_t>( 1UL, olhs_.rows()*orhs_.rows() - row );
7912 for( size_t column=0UL, n=0UL; column<olhs_.columns()*orhs_.columns(); column+=n ) {
7913 n = blaze::rand<size_t>( 1UL, olhs_.columns()*orhs_.columns() - column );
7914 submatrix( dres_ , row, column, m, n ) += submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
7915 submatrix( odres_ , row, column, m, n ) += submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
7916 submatrix( sres_ , row, column, m, n ) += submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
7917 submatrix( osres_ , row, column, m, n ) += submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
7918 submatrix( refres_, row, column, m, n ) += submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
7919 }
7920 }
7921 }
7922 catch( std::exception& ex ) {
7923 convertException<OMT1,OMT2>( ex );
7924 }
7925
7926 checkResults<OMT1,OMT2>();
7927 }
7928
7929 // Submatrix-wise Kronecker product with addition assignment with evaluated matrices
7930 {
7931 test_ = "Submatrix-wise Kronecker product with addition assignment with evaluated matrices";
7932 error_ = "Failed addition assignment operation";
7933
7934 try {
7935 initResults();
7936 for( size_t row=0UL, m=0UL; row<lhs_.rows()*rhs_.rows(); row+=m ) {
7937 m = blaze::rand<size_t>( 1UL, lhs_.rows()*rhs_.rows() - row );
7938 for( size_t column=0UL, n=0UL; column<lhs_.columns()*rhs_.columns(); column+=n ) {
7939 n = blaze::rand<size_t>( 1UL, lhs_.columns()*rhs_.columns() - column );
7940 submatrix( dres_ , row, column, m, n ) += submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
7941 submatrix( odres_ , row, column, m, n ) += submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
7942 submatrix( sres_ , row, column, m, n ) += submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
7943 submatrix( osres_ , row, column, m, n ) += submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
7944 submatrix( refres_, row, column, m, n ) += submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
7945 }
7946 }
7947 }
7948 catch( std::exception& ex ) {
7949 convertException<MT1,MT2>( ex );
7950 }
7951
7952 checkResults<MT1,MT2>();
7953
7954 try {
7955 initResults();
7956 for( size_t row=0UL, m=0UL; row<lhs_.rows()*orhs_.rows(); row+=m ) {
7957 m = blaze::rand<size_t>( 1UL, lhs_.rows()*orhs_.rows() - row );
7958 for( size_t column=0UL, n=0UL; column<lhs_.columns()*orhs_.columns(); column+=n ) {
7959 n = blaze::rand<size_t>( 1UL, lhs_.columns()*orhs_.columns() - column );
7960 submatrix( dres_ , row, column, m, n ) += submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
7961 submatrix( odres_ , row, column, m, n ) += submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
7962 submatrix( sres_ , row, column, m, n ) += submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
7963 submatrix( osres_ , row, column, m, n ) += submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
7964 submatrix( refres_, row, column, m, n ) += submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
7965 }
7966 }
7967 }
7968 catch( std::exception& ex ) {
7969 convertException<MT1,OMT2>( ex );
7970 }
7971
7972 checkResults<MT1,OMT2>();
7973
7974 try {
7975 initResults();
7976 for( size_t row=0UL, m=0UL; row<olhs_.rows()*rhs_.rows(); row+=m ) {
7977 m = blaze::rand<size_t>( 1UL, olhs_.rows()*rhs_.rows() - row );
7978 for( size_t column=0UL, n=0UL; column<olhs_.columns()*rhs_.columns(); column+=n ) {
7979 n = blaze::rand<size_t>( 1UL, olhs_.columns()*rhs_.columns() - column );
7980 submatrix( dres_ , row, column, m, n ) += submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
7981 submatrix( odres_ , row, column, m, n ) += submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
7982 submatrix( sres_ , row, column, m, n ) += submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
7983 submatrix( osres_ , row, column, m, n ) += submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
7984 submatrix( refres_, row, column, m, n ) += submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
7985 }
7986 }
7987 }
7988 catch( std::exception& ex ) {
7989 convertException<OMT1,MT2>( ex );
7990 }
7991
7992 checkResults<OMT1,MT2>();
7993
7994 try {
7995 initResults();
7996 for( size_t row=0UL, m=0UL; row<olhs_.rows()*orhs_.rows(); row+=m ) {
7997 m = blaze::rand<size_t>( 1UL, olhs_.rows()*orhs_.rows() - row );
7998 for( size_t column=0UL, n=0UL; column<olhs_.columns()*orhs_.columns(); column+=n ) {
7999 n = blaze::rand<size_t>( 1UL, olhs_.columns()*orhs_.columns() - column );
8000 submatrix( dres_ , row, column, m, n ) += submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8001 submatrix( odres_ , row, column, m, n ) += submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8002 submatrix( sres_ , row, column, m, n ) += submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8003 submatrix( osres_ , row, column, m, n ) += submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8004 submatrix( refres_, row, column, m, n ) += submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
8005 }
8006 }
8007 }
8008 catch( std::exception& ex ) {
8009 convertException<OMT1,OMT2>( ex );
8010 }
8011
8012 checkResults<OMT1,OMT2>();
8013 }
8014
8015
8016 //=====================================================================================
8017 // Submatrix-wise Kronecker product with subtraction assignment
8018 //=====================================================================================
8019
8020 // Submatrix-wise Kronecker product with subtraction assignment with the given matrices
8021 {
8022 test_ = "Submatrix-wise Kronecker product with subtraction assignment with the given matrices";
8023 error_ = "Failed subtraction assignment operation";
8024
8025 try {
8026 initResults();
8027 for( size_t row=0UL, m=0UL; row<lhs_.rows()*rhs_.rows(); row+=m ) {
8028 m = blaze::rand<size_t>( 1UL, lhs_.rows()*rhs_.rows() - row );
8029 for( size_t column=0UL, n=0UL; column<lhs_.columns()*rhs_.columns(); column+=n ) {
8030 n = blaze::rand<size_t>( 1UL, lhs_.columns()*rhs_.columns() - column );
8031 submatrix( dres_ , row, column, m, n ) -= submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
8032 submatrix( odres_ , row, column, m, n ) -= submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
8033 submatrix( sres_ , row, column, m, n ) -= submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
8034 submatrix( osres_ , row, column, m, n ) -= submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
8035 submatrix( refres_, row, column, m, n ) -= submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
8036 }
8037 }
8038 }
8039 catch( std::exception& ex ) {
8040 convertException<MT1,MT2>( ex );
8041 }
8042
8043 checkResults<MT1,MT2>();
8044
8045 try {
8046 initResults();
8047 for( size_t row=0UL, m=0UL; row<lhs_.rows()*orhs_.rows(); row+=m ) {
8048 m = blaze::rand<size_t>( 1UL, lhs_.rows()*orhs_.rows() - row );
8049 for( size_t column=0UL, n=0UL; column<lhs_.columns()*orhs_.columns(); column+=n ) {
8050 n = blaze::rand<size_t>( 1UL, lhs_.columns()*orhs_.columns() - column );
8051 submatrix( dres_ , row, column, m, n ) -= submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
8052 submatrix( odres_ , row, column, m, n ) -= submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
8053 submatrix( sres_ , row, column, m, n ) -= submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
8054 submatrix( osres_ , row, column, m, n ) -= submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
8055 submatrix( refres_, row, column, m, n ) -= submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
8056 }
8057 }
8058 }
8059 catch( std::exception& ex ) {
8060 convertException<MT1,OMT2>( ex );
8061 }
8062
8063 checkResults<MT1,OMT2>();
8064
8065 try {
8066 initResults();
8067 for( size_t row=0UL, m=0UL; row<olhs_.rows()*rhs_.rows(); row+=m ) {
8068 m = blaze::rand<size_t>( 1UL, olhs_.rows()*rhs_.rows() - row );
8069 for( size_t column=0UL, n=0UL; column<olhs_.columns()*rhs_.columns(); column+=n ) {
8070 n = blaze::rand<size_t>( 1UL, olhs_.columns()*rhs_.columns() - column );
8071 submatrix( dres_ , row, column, m, n ) -= submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
8072 submatrix( odres_ , row, column, m, n ) -= submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
8073 submatrix( sres_ , row, column, m, n ) -= submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
8074 submatrix( osres_ , row, column, m, n ) -= submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
8075 submatrix( refres_, row, column, m, n ) -= submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
8076 }
8077 }
8078 }
8079 catch( std::exception& ex ) {
8080 convertException<OMT1,MT2>( ex );
8081 }
8082
8083 checkResults<OMT1,MT2>();
8084
8085 try {
8086 initResults();
8087 for( size_t row=0UL, m=0UL; row<olhs_.rows()*orhs_.rows(); row+=m ) {
8088 m = blaze::rand<size_t>( 1UL, olhs_.rows()*orhs_.rows() - row );
8089 for( size_t column=0UL, n=0UL; column<olhs_.columns()*orhs_.columns(); column+=n ) {
8090 n = blaze::rand<size_t>( 1UL, olhs_.columns()*orhs_.columns() - column );
8091 submatrix( dres_ , row, column, m, n ) -= submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
8092 submatrix( odres_ , row, column, m, n ) -= submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
8093 submatrix( sres_ , row, column, m, n ) -= submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
8094 submatrix( osres_ , row, column, m, n ) -= submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
8095 submatrix( refres_, row, column, m, n ) -= submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
8096 }
8097 }
8098 }
8099 catch( std::exception& ex ) {
8100 convertException<OMT1,OMT2>( ex );
8101 }
8102
8103 checkResults<OMT1,OMT2>();
8104 }
8105
8106 // Submatrix-wise Kronecker product with subtraction assignment with evaluated matrices
8107 {
8108 test_ = "Submatrix-wise Kronecker product with subtraction assignment with evaluated matrices";
8109 error_ = "Failed subtraction assignment operation";
8110
8111 try {
8112 initResults();
8113 for( size_t row=0UL, m=0UL; row<lhs_.rows()*rhs_.rows(); row+=m ) {
8114 m = blaze::rand<size_t>( 1UL, lhs_.rows()*rhs_.rows() - row );
8115 for( size_t column=0UL, n=0UL; column<lhs_.columns()*rhs_.columns(); column+=n ) {
8116 n = blaze::rand<size_t>( 1UL, lhs_.columns()*rhs_.columns() - column );
8117 submatrix( dres_ , row, column, m, n ) -= submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
8118 submatrix( odres_ , row, column, m, n ) -= submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
8119 submatrix( sres_ , row, column, m, n ) -= submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
8120 submatrix( osres_ , row, column, m, n ) -= submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
8121 submatrix( refres_, row, column, m, n ) -= submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
8122 }
8123 }
8124 }
8125 catch( std::exception& ex ) {
8126 convertException<MT1,MT2>( ex );
8127 }
8128
8129 checkResults<MT1,MT2>();
8130
8131 try {
8132 initResults();
8133 for( size_t row=0UL, m=0UL; row<lhs_.rows()*orhs_.rows(); row+=m ) {
8134 m = blaze::rand<size_t>( 1UL, lhs_.rows()*orhs_.rows() - row );
8135 for( size_t column=0UL, n=0UL; column<lhs_.columns()*orhs_.columns(); column+=n ) {
8136 n = blaze::rand<size_t>( 1UL, lhs_.columns()*orhs_.columns() - column );
8137 submatrix( dres_ , row, column, m, n ) -= submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
8138 submatrix( odres_ , row, column, m, n ) -= submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
8139 submatrix( sres_ , row, column, m, n ) -= submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
8140 submatrix( osres_ , row, column, m, n ) -= submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
8141 submatrix( refres_, row, column, m, n ) -= submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
8142 }
8143 }
8144 }
8145 catch( std::exception& ex ) {
8146 convertException<MT1,OMT2>( ex );
8147 }
8148
8149 checkResults<MT1,OMT2>();
8150
8151 try {
8152 initResults();
8153 for( size_t row=0UL, m=0UL; row<olhs_.rows()*rhs_.rows(); row+=m ) {
8154 m = blaze::rand<size_t>( 1UL, olhs_.rows()*rhs_.rows() - row );
8155 for( size_t column=0UL, n=0UL; column<olhs_.columns()*rhs_.columns(); column+=n ) {
8156 n = blaze::rand<size_t>( 1UL, olhs_.columns()*rhs_.columns() - column );
8157 submatrix( dres_ , row, column, m, n ) -= submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
8158 submatrix( odres_ , row, column, m, n ) -= submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
8159 submatrix( sres_ , row, column, m, n ) -= submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
8160 submatrix( osres_ , row, column, m, n ) -= submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
8161 submatrix( refres_, row, column, m, n ) -= submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
8162 }
8163 }
8164 }
8165 catch( std::exception& ex ) {
8166 convertException<OMT1,MT2>( ex );
8167 }
8168
8169 checkResults<OMT1,MT2>();
8170
8171 try {
8172 initResults();
8173 for( size_t row=0UL, m=0UL; row<olhs_.rows()*orhs_.rows(); row+=m ) {
8174 m = blaze::rand<size_t>( 1UL, olhs_.rows()*orhs_.rows() - row );
8175 for( size_t column=0UL, n=0UL; column<olhs_.columns()*orhs_.columns(); column+=n ) {
8176 n = blaze::rand<size_t>( 1UL, olhs_.columns()*orhs_.columns() - column );
8177 submatrix( dres_ , row, column, m, n ) -= submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8178 submatrix( odres_ , row, column, m, n ) -= submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8179 submatrix( sres_ , row, column, m, n ) -= submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8180 submatrix( osres_ , row, column, m, n ) -= submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8181 submatrix( refres_, row, column, m, n ) -= submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
8182 }
8183 }
8184 }
8185 catch( std::exception& ex ) {
8186 convertException<OMT1,OMT2>( ex );
8187 }
8188
8189 checkResults<OMT1,OMT2>();
8190 }
8191
8192
8193 //=====================================================================================
8194 // Submatrix-wise Kronecker product with Schur product assignment
8195 //=====================================================================================
8196
8197 // Submatrix-wise Kronecker product with Schur product assignment with the given matrices
8198 {
8199 test_ = "Submatrix-wise Kronecker product with Schur product assignment with the given matrices";
8200 error_ = "Failed Schur product assignment operation";
8201
8202 try {
8203 initResults();
8204 for( size_t row=0UL, m=0UL; row<lhs_.rows()*rhs_.rows(); row+=m ) {
8205 m = blaze::rand<size_t>( 1UL, lhs_.rows()*rhs_.rows() - row );
8206 for( size_t column=0UL, n=0UL; column<lhs_.columns()*rhs_.columns(); column+=n ) {
8207 n = blaze::rand<size_t>( 1UL, lhs_.columns()*rhs_.columns() - column );
8208 submatrix( dres_ , row, column, m, n ) %= submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
8209 submatrix( odres_ , row, column, m, n ) %= submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
8210 submatrix( sres_ , row, column, m, n ) %= submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
8211 submatrix( osres_ , row, column, m, n ) %= submatrix( kron( lhs_, rhs_ ) , row, column, m, n );
8212 submatrix( refres_, row, column, m, n ) %= submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
8213 }
8214 }
8215 }
8216 catch( std::exception& ex ) {
8217 convertException<MT1,MT2>( ex );
8218 }
8219
8220 checkResults<MT1,MT2>();
8221
8222 try {
8223 initResults();
8224 for( size_t row=0UL, m=0UL; row<lhs_.rows()*orhs_.rows(); row+=m ) {
8225 m = blaze::rand<size_t>( 1UL, lhs_.rows()*orhs_.rows() - row );
8226 for( size_t column=0UL, n=0UL; column<lhs_.columns()*orhs_.columns(); column+=n ) {
8227 n = blaze::rand<size_t>( 1UL, lhs_.columns()*orhs_.columns() - column );
8228 submatrix( dres_ , row, column, m, n ) %= submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
8229 submatrix( odres_ , row, column, m, n ) %= submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
8230 submatrix( sres_ , row, column, m, n ) %= submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
8231 submatrix( osres_ , row, column, m, n ) %= submatrix( kron( lhs_, orhs_ ) , row, column, m, n );
8232 submatrix( refres_, row, column, m, n ) %= submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
8233 }
8234 }
8235 }
8236 catch( std::exception& ex ) {
8237 convertException<MT1,OMT2>( ex );
8238 }
8239
8240 checkResults<MT1,OMT2>();
8241
8242 try {
8243 initResults();
8244 for( size_t row=0UL, m=0UL; row<olhs_.rows()*rhs_.rows(); row+=m ) {
8245 m = blaze::rand<size_t>( 1UL, olhs_.rows()*rhs_.rows() - row );
8246 for( size_t column=0UL, n=0UL; column<olhs_.columns()*rhs_.columns(); column+=n ) {
8247 n = blaze::rand<size_t>( 1UL, olhs_.columns()*rhs_.columns() - column );
8248 submatrix( dres_ , row, column, m, n ) %= submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
8249 submatrix( odres_ , row, column, m, n ) %= submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
8250 submatrix( sres_ , row, column, m, n ) %= submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
8251 submatrix( osres_ , row, column, m, n ) %= submatrix( kron( olhs_, rhs_ ) , row, column, m, n );
8252 submatrix( refres_, row, column, m, n ) %= submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
8253 }
8254 }
8255 }
8256 catch( std::exception& ex ) {
8257 convertException<OMT1,MT2>( ex );
8258 }
8259
8260 checkResults<OMT1,MT2>();
8261
8262 try {
8263 initResults();
8264 for( size_t row=0UL, m=0UL; row<olhs_.rows()*orhs_.rows(); row+=m ) {
8265 m = blaze::rand<size_t>( 1UL, olhs_.rows()*orhs_.rows() - row );
8266 for( size_t column=0UL, n=0UL; column<olhs_.columns()*orhs_.columns(); column+=n ) {
8267 n = blaze::rand<size_t>( 1UL, olhs_.columns()*orhs_.columns() - column );
8268 submatrix( dres_ , row, column, m, n ) %= submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
8269 submatrix( odres_ , row, column, m, n ) %= submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
8270 submatrix( sres_ , row, column, m, n ) %= submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
8271 submatrix( osres_ , row, column, m, n ) %= submatrix( kron( olhs_, orhs_ ) , row, column, m, n );
8272 submatrix( refres_, row, column, m, n ) %= submatrix( kron( reflhs_, refrhs_ ), row, column, m, n );
8273 }
8274 }
8275 }
8276 catch( std::exception& ex ) {
8277 convertException<OMT1,OMT2>( ex );
8278 }
8279
8280 checkResults<OMT1,OMT2>();
8281 }
8282
8283 // Submatrix-wise Kronecker product with Schur product assignment with evaluated matrices
8284 {
8285 test_ = "Submatrix-wise Kronecker product with Schur product assignment with evaluated matrices";
8286 error_ = "Failed Schur product assignment operation";
8287
8288 try {
8289 initResults();
8290 for( size_t row=0UL, m=0UL; row<lhs_.rows()*rhs_.rows(); row+=m ) {
8291 m = blaze::rand<size_t>( 1UL, lhs_.rows()*rhs_.rows() - row );
8292 for( size_t column=0UL, n=0UL; column<lhs_.columns()*rhs_.columns(); column+=n ) {
8293 n = blaze::rand<size_t>( 1UL, lhs_.columns()*rhs_.columns() - column );
8294 submatrix( dres_ , row, column, m, n ) %= submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
8295 submatrix( odres_ , row, column, m, n ) %= submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
8296 submatrix( sres_ , row, column, m, n ) %= submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
8297 submatrix( osres_ , row, column, m, n ) %= submatrix( kron( eval( lhs_ ), eval( rhs_ ) ) , row, column, m, n );
8298 submatrix( refres_, row, column, m, n ) %= submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
8299 }
8300 }
8301 }
8302 catch( std::exception& ex ) {
8303 convertException<MT1,MT2>( ex );
8304 }
8305
8306 checkResults<MT1,MT2>();
8307
8308 try {
8309 initResults();
8310 for( size_t row=0UL, m=0UL; row<lhs_.rows()*orhs_.rows(); row+=m ) {
8311 m = blaze::rand<size_t>( 1UL, lhs_.rows()*orhs_.rows() - row );
8312 for( size_t column=0UL, n=0UL; column<lhs_.columns()*orhs_.columns(); column+=n ) {
8313 n = blaze::rand<size_t>( 1UL, lhs_.columns()*orhs_.columns() - column );
8314 submatrix( dres_ , row, column, m, n ) %= submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
8315 submatrix( odres_ , row, column, m, n ) %= submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
8316 submatrix( sres_ , row, column, m, n ) %= submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
8317 submatrix( osres_ , row, column, m, n ) %= submatrix( kron( eval( lhs_ ), eval( orhs_ ) ) , row, column, m, n );
8318 submatrix( refres_, row, column, m, n ) %= submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
8319 }
8320 }
8321 }
8322 catch( std::exception& ex ) {
8323 convertException<MT1,OMT2>( ex );
8324 }
8325
8326 checkResults<MT1,OMT2>();
8327
8328 try {
8329 initResults();
8330 for( size_t row=0UL, m=0UL; row<olhs_.rows()*rhs_.rows(); row+=m ) {
8331 m = blaze::rand<size_t>( 1UL, olhs_.rows()*rhs_.rows() - row );
8332 for( size_t column=0UL, n=0UL; column<olhs_.columns()*rhs_.columns(); column+=n ) {
8333 n = blaze::rand<size_t>( 1UL, olhs_.columns()*rhs_.columns() - column );
8334 submatrix( dres_ , row, column, m, n ) %= submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
8335 submatrix( odres_ , row, column, m, n ) %= submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
8336 submatrix( sres_ , row, column, m, n ) %= submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
8337 submatrix( osres_ , row, column, m, n ) %= submatrix( kron( eval( olhs_ ), eval( rhs_ ) ) , row, column, m, n );
8338 submatrix( refres_, row, column, m, n ) %= submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
8339 }
8340 }
8341 }
8342 catch( std::exception& ex ) {
8343 convertException<OMT1,MT2>( ex );
8344 }
8345
8346 checkResults<OMT1,MT2>();
8347
8348 try {
8349 initResults();
8350 for( size_t row=0UL, m=0UL; row<olhs_.rows()*orhs_.rows(); row+=m ) {
8351 m = blaze::rand<size_t>( 1UL, olhs_.rows()*orhs_.rows() - row );
8352 for( size_t column=0UL, n=0UL; column<olhs_.columns()*orhs_.columns(); column+=n ) {
8353 n = blaze::rand<size_t>( 1UL, olhs_.columns()*orhs_.columns() - column );
8354 submatrix( dres_ , row, column, m, n ) %= submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8355 submatrix( odres_ , row, column, m, n ) %= submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8356 submatrix( sres_ , row, column, m, n ) %= submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8357 submatrix( osres_ , row, column, m, n ) %= submatrix( kron( eval( olhs_ ), eval( orhs_ ) ) , row, column, m, n );
8358 submatrix( refres_, row, column, m, n ) %= submatrix( kron( eval( reflhs_ ), eval( refrhs_ ) ), row, column, m, n );
8359 }
8360 }
8361 }
8362 catch( std::exception& ex ) {
8363 convertException<OMT1,OMT2>( ex );
8364 }
8365
8366 checkResults<OMT1,OMT2>();
8367 }
8368
8369
8370 //=====================================================================================
8371 // Failure cases
8372 //=====================================================================================
8373
8374 // Out-of-bounds submatrix construction (invalid number of rows)
8375 {
8376 test_ = "Out-of-bounds submatrix construction (invalid number of rows)";
8377 error_ = "Setup of out-of-bounds submatrix succeeded";
8378
8379 try {
8380 auto sm = submatrix( kron( lhs_, rhs_ ), 1UL, 0UL, lhs_.rows()*rhs_.rows(), lhs_.columns()*rhs_.columns() );
8381
8382 std::ostringstream oss;
8383 oss << " Test: " << test_ << "\n"
8384 << " Error: " << error_ << "\n"
8385 << " Details:\n"
8386 << " Random seed = " << blaze::getSeed() << "\n"
8387 << " Left-hand side sparse matrix type:\n"
8388 << " " << typeid( MT1 ).name() << "\n"
8389 << " Right-hand side dense matrix type:\n"
8390 << " " << typeid( MT2 ).name() << "\n"
8391 << " Result:\n" << sm << "\n";
8392 throw std::runtime_error( oss.str() );
8393 }
8394 catch( std::invalid_argument& ex ) {
8395 checkExceptionMessage( ex, "Invalid submatrix specification" );
8396 }
8397
8398 try {
8399 auto sm = submatrix( kron( lhs_, orhs_ ), 1UL, 0UL, lhs_.rows()*orhs_.rows(), lhs_.columns()*orhs_.columns() );
8400
8401 std::ostringstream oss;
8402 oss << " Test: " << test_ << "\n"
8403 << " Error: " << error_ << "\n"
8404 << " Details:\n"
8405 << " Random seed = " << blaze::getSeed() << "\n"
8406 << " Left-hand side sparse matrix type:\n"
8407 << " " << typeid( MT1 ).name() << "\n"
8408 << " Right-hand side dense matrix type:\n"
8409 << " " << typeid( OMT2 ).name() << "\n"
8410 << " Result:\n" << sm << "\n";
8411 throw std::runtime_error( oss.str() );
8412 }
8413 catch( std::invalid_argument& ex ) {
8414 checkExceptionMessage( ex, "Invalid submatrix specification" );
8415 }
8416
8417 try {
8418 auto sm = submatrix( kron( olhs_, rhs_ ), 1UL, 0UL, olhs_.rows()*rhs_.rows(), olhs_.columns()*rhs_.columns() );
8419
8420 std::ostringstream oss;
8421 oss << " Test: " << test_ << "\n"
8422 << " Error: " << error_ << "\n"
8423 << " Details:\n"
8424 << " Random seed = " << blaze::getSeed() << "\n"
8425 << " Left-hand side sparse matrix type:\n"
8426 << " " << typeid( OMT1 ).name() << "\n"
8427 << " Right-hand side dense matrix type:\n"
8428 << " " << typeid( MT2 ).name() << "\n"
8429 << " Result:\n" << sm << "\n";
8430 throw std::runtime_error( oss.str() );
8431 }
8432 catch( std::invalid_argument& ex ) {
8433 checkExceptionMessage( ex, "Invalid submatrix specification" );
8434 }
8435
8436 try {
8437 auto sm = submatrix( kron( olhs_, orhs_ ), 1UL, 0UL, olhs_.rows()*orhs_.rows(), olhs_.columns()*orhs_.columns() );
8438
8439 std::ostringstream oss;
8440 oss << " Test: " << test_ << "\n"
8441 << " Error: " << error_ << "\n"
8442 << " Details:\n"
8443 << " Random seed = " << blaze::getSeed() << "\n"
8444 << " Left-hand side sparse matrix type:\n"
8445 << " " << typeid( OMT1 ).name() << "\n"
8446 << " Right-hand side dense matrix type:\n"
8447 << " " << typeid( OMT2 ).name() << "\n"
8448 << " Result:\n" << sm << "\n";
8449 throw std::runtime_error( oss.str() );
8450 }
8451 catch( std::invalid_argument& ex ) {
8452 checkExceptionMessage( ex, "Invalid submatrix specification" );
8453 }
8454 }
8455
8456 // Out-of-bounds access (invalid number of columns)
8457 {
8458 test_ = "Out-of-bounds submatrix construction (invalid number of columns)";
8459 error_ = "Setup of out-of-bounds submatrix succeeded";
8460
8461 try {
8462 auto sm = submatrix( kron( lhs_, rhs_ ), 0UL, 1UL, lhs_.rows()*rhs_.rows(), lhs_.columns()*rhs_.columns() );
8463
8464 std::ostringstream oss;
8465 oss << " Test: " << test_ << "\n"
8466 << " Error: " << error_ << "\n"
8467 << " Details:\n"
8468 << " Random seed = " << blaze::getSeed() << "\n"
8469 << " Left-hand side sparse matrix type:\n"
8470 << " " << typeid( MT1 ).name() << "\n"
8471 << " Right-hand side dense matrix type:\n"
8472 << " " << typeid( MT2 ).name() << "\n"
8473 << " Result:\n" << sm << "\n";
8474 throw std::runtime_error( oss.str() );
8475 }
8476 catch( std::invalid_argument& ex ) {
8477 checkExceptionMessage( ex, "Invalid submatrix specification" );
8478 }
8479
8480 try {
8481 auto sm = submatrix( kron( lhs_, orhs_ ), 0UL, 1UL, lhs_.rows()*orhs_.rows(), lhs_.columns()*orhs_.columns() );
8482
8483 std::ostringstream oss;
8484 oss << " Test: " << test_ << "\n"
8485 << " Error: " << error_ << "\n"
8486 << " Details:\n"
8487 << " Random seed = " << blaze::getSeed() << "\n"
8488 << " Left-hand side sparse matrix type:\n"
8489 << " " << typeid( MT1 ).name() << "\n"
8490 << " Right-hand side dense matrix type:\n"
8491 << " " << typeid( OMT2 ).name() << "\n"
8492 << " Result:\n" << sm << "\n";
8493 throw std::runtime_error( oss.str() );
8494 }
8495 catch( std::invalid_argument& ex ) {
8496 checkExceptionMessage( ex, "Invalid submatrix specification" );
8497 }
8498
8499 try {
8500 auto sm = submatrix( kron( olhs_, rhs_ ), 0UL, 1UL, olhs_.rows()*rhs_.rows(), olhs_.columns()*rhs_.columns() );
8501
8502 std::ostringstream oss;
8503 oss << " Test: " << test_ << "\n"
8504 << " Error: " << error_ << "\n"
8505 << " Details:\n"
8506 << " Random seed = " << blaze::getSeed() << "\n"
8507 << " Left-hand side sparse matrix type:\n"
8508 << " " << typeid( OMT1 ).name() << "\n"
8509 << " Right-hand side dense matrix type:\n"
8510 << " " << typeid( MT2 ).name() << "\n"
8511 << " Result:\n" << sm << "\n";
8512 throw std::runtime_error( oss.str() );
8513 }
8514 catch( std::invalid_argument& ex ) {
8515 checkExceptionMessage( ex, "Invalid submatrix specification" );
8516 }
8517
8518 try {
8519 auto sm = submatrix( kron( olhs_, orhs_ ), 0UL, 1UL, olhs_.rows()*orhs_.rows(), olhs_.columns()*orhs_.columns() );
8520
8521 std::ostringstream oss;
8522 oss << " Test: " << test_ << "\n"
8523 << " Error: " << error_ << "\n"
8524 << " Details:\n"
8525 << " Random seed = " << blaze::getSeed() << "\n"
8526 << " Left-hand side sparse matrix type:\n"
8527 << " " << typeid( OMT1 ).name() << "\n"
8528 << " Right-hand side dense matrix type:\n"
8529 << " " << typeid( OMT2 ).name() << "\n"
8530 << " Result:\n" << sm << "\n";
8531 throw std::runtime_error( oss.str() );
8532 }
8533 catch( std::invalid_argument& ex ) {
8534 checkExceptionMessage( ex, "Invalid submatrix specification" );
8535 }
8536 }
8537
8538 // Out-of-bounds access (invalid row index)
8539 {
8540 test_ = "Out-of-bounds submatrix construction (invalid row index)";
8541 error_ = "Setup of out-of-bounds submatrix succeeded";
8542
8543 try {
8544 auto sm = submatrix( kron( lhs_, rhs_ ), lhs_.rows()*rhs_.rows(), 0UL, 1UL, lhs_.columns()*rhs_.columns() );
8545
8546 std::ostringstream oss;
8547 oss << " Test: " << test_ << "\n"
8548 << " Error: " << error_ << "\n"
8549 << " Details:\n"
8550 << " Random seed = " << blaze::getSeed() << "\n"
8551 << " Left-hand side sparse matrix type:\n"
8552 << " " << typeid( MT1 ).name() << "\n"
8553 << " Right-hand side dense matrix type:\n"
8554 << " " << typeid( MT2 ).name() << "\n"
8555 << " Result:\n" << sm << "\n";
8556 throw std::runtime_error( oss.str() );
8557 }
8558 catch( std::invalid_argument& ex ) {
8559 checkExceptionMessage( ex, "Invalid submatrix specification" );
8560 }
8561
8562 try {
8563 auto sm = submatrix( kron( lhs_, orhs_ ), lhs_.rows()*orhs_.rows(), 0UL, 1UL, lhs_.columns()*orhs_.columns() );
8564
8565 std::ostringstream oss;
8566 oss << " Test: " << test_ << "\n"
8567 << " Error: " << error_ << "\n"
8568 << " Details:\n"
8569 << " Random seed = " << blaze::getSeed() << "\n"
8570 << " Left-hand side sparse matrix type:\n"
8571 << " " << typeid( MT1 ).name() << "\n"
8572 << " Right-hand side dense matrix type:\n"
8573 << " " << typeid( OMT2 ).name() << "\n"
8574 << " Result:\n" << sm << "\n";
8575 throw std::runtime_error( oss.str() );
8576 }
8577 catch( std::invalid_argument& ex ) {
8578 checkExceptionMessage( ex, "Invalid submatrix specification" );
8579 }
8580
8581 try {
8582 auto sm = submatrix( kron( olhs_, rhs_ ), olhs_.rows()*rhs_.rows(), 0UL, 1UL, olhs_.columns()*rhs_.columns() );
8583
8584 std::ostringstream oss;
8585 oss << " Test: " << test_ << "\n"
8586 << " Error: " << error_ << "\n"
8587 << " Details:\n"
8588 << " Random seed = " << blaze::getSeed() << "\n"
8589 << " Left-hand side sparse matrix type:\n"
8590 << " " << typeid( OMT1 ).name() << "\n"
8591 << " Right-hand side dense matrix type:\n"
8592 << " " << typeid( MT2 ).name() << "\n"
8593 << " Result:\n" << sm << "\n";
8594 throw std::runtime_error( oss.str() );
8595 }
8596 catch( std::invalid_argument& ex ) {
8597 checkExceptionMessage( ex, "Invalid submatrix specification" );
8598 }
8599
8600 try {
8601 auto sm = submatrix( kron( olhs_, orhs_ ), olhs_.rows()*orhs_.rows(), 0UL, 1UL, olhs_.columns()*orhs_.columns() );
8602
8603 std::ostringstream oss;
8604 oss << " Test: " << test_ << "\n"
8605 << " Error: " << error_ << "\n"
8606 << " Details:\n"
8607 << " Random seed = " << blaze::getSeed() << "\n"
8608 << " Left-hand side sparse matrix type:\n"
8609 << " " << typeid( OMT1 ).name() << "\n"
8610 << " Right-hand side dense matrix type:\n"
8611 << " " << typeid( OMT2 ).name() << "\n"
8612 << " Result:\n" << sm << "\n";
8613 throw std::runtime_error( oss.str() );
8614 }
8615 catch( std::invalid_argument& ex ) {
8616 checkExceptionMessage( ex, "Invalid submatrix specification" );
8617 }
8618 }
8619
8620 // Out-of-bounds access (invalid column index)
8621 {
8622 test_ = "Out-of-bounds submatrix construction (invalid column index)";
8623 error_ = "Setup of out-of-bounds submatrix succeeded";
8624
8625 try {
8626 auto sm = submatrix( kron( lhs_, rhs_ ), 0UL, lhs_.columns()*rhs_.columns(), lhs_.rows()*rhs_.rows(), 1UL );
8627
8628 std::ostringstream oss;
8629 oss << " Test: " << test_ << "\n"
8630 << " Error: " << error_ << "\n"
8631 << " Details:\n"
8632 << " Random seed = " << blaze::getSeed() << "\n"
8633 << " Left-hand side sparse matrix type:\n"
8634 << " " << typeid( MT1 ).name() << "\n"
8635 << " Right-hand side dense matrix type:\n"
8636 << " " << typeid( MT2 ).name() << "\n"
8637 << " Result:\n" << sm << "\n";
8638 throw std::runtime_error( oss.str() );
8639 }
8640 catch( std::invalid_argument& ex ) {
8641 checkExceptionMessage( ex, "Invalid submatrix specification" );
8642 }
8643
8644 try {
8645 auto sm = submatrix( kron( lhs_, orhs_ ), 0UL, lhs_.columns()*orhs_.columns(), lhs_.rows()*orhs_.rows(), 1UL );
8646
8647 std::ostringstream oss;
8648 oss << " Test: " << test_ << "\n"
8649 << " Error: " << error_ << "\n"
8650 << " Details:\n"
8651 << " Random seed = " << blaze::getSeed() << "\n"
8652 << " Left-hand side sparse matrix type:\n"
8653 << " " << typeid( MT1 ).name() << "\n"
8654 << " Right-hand side dense matrix type:\n"
8655 << " " << typeid( OMT2 ).name() << "\n"
8656 << " Result:\n" << sm << "\n";
8657 throw std::runtime_error( oss.str() );
8658 }
8659 catch( std::invalid_argument& ex ) {
8660 checkExceptionMessage( ex, "Invalid submatrix specification" );
8661 }
8662
8663 try {
8664 auto sm = submatrix( kron( olhs_, rhs_ ), 0UL, olhs_.columns()*rhs_.columns(), olhs_.rows()*rhs_.rows(), 1UL );
8665
8666 std::ostringstream oss;
8667 oss << " Test: " << test_ << "\n"
8668 << " Error: " << error_ << "\n"
8669 << " Details:\n"
8670 << " Random seed = " << blaze::getSeed() << "\n"
8671 << " Left-hand side sparse matrix type:\n"
8672 << " " << typeid( OMT1 ).name() << "\n"
8673 << " Right-hand side dense matrix type:\n"
8674 << " " << typeid( MT2 ).name() << "\n"
8675 << " Result:\n" << sm << "\n";
8676 throw std::runtime_error( oss.str() );
8677 }
8678 catch( std::invalid_argument& ex ) {
8679 checkExceptionMessage( ex, "Invalid submatrix specification" );
8680 }
8681
8682 try {
8683 auto sm = submatrix( kron( olhs_, orhs_ ), 0UL, olhs_.columns()*orhs_.columns(), olhs_.rows()*orhs_.rows(), 1UL );
8684
8685 std::ostringstream oss;
8686 oss << " Test: " << test_ << "\n"
8687 << " Error: " << error_ << "\n"
8688 << " Details:\n"
8689 << " Random seed = " << blaze::getSeed() << "\n"
8690 << " Left-hand side sparse matrix type:\n"
8691 << " " << typeid( OMT1 ).name() << "\n"
8692 << " Right-hand side dense matrix type:\n"
8693 << " " << typeid( OMT2 ).name() << "\n"
8694 << " Result:\n" << sm << "\n";
8695 throw std::runtime_error( oss.str() );
8696 }
8697 catch( std::invalid_argument& ex ) {
8698 checkExceptionMessage( ex, "Invalid submatrix specification" );
8699 }
8700 }
8701 }
8702 #endif
8703 }
8704 //*************************************************************************************************
8705
8706
8707 //*************************************************************************************************
8708 /*!\brief Skipping the submatrix-wise sparse matrix/dense matrix Kronecker product.
8709 //
8710 // \return void
8711 //
8712 // This function is called in case the submatrix-wise matrix/matrix Kronecker product operation
8713 // is not available for the given matrix types \a MT1 and \a MT2.
8714 */
8715 template< typename MT1 // Type of the left-hand side sparse matrix
8716 , typename MT2 > // Type of the right-hand side dense matrix
testSubmatrixOperation(blaze::FalseType)8717 void OperationTest<MT1,MT2>::testSubmatrixOperation( blaze::FalseType )
8718 {}
8719 //*************************************************************************************************
8720
8721
8722 //*************************************************************************************************
8723 /*!\brief Testing the row-wise sparse matrix/dense matrix Kronecker product.
8724 //
8725 // \return void
8726 // \exception std::runtime_error Kronecker product error detected.
8727 //
8728 // This function tests the row-wise matrix Kronecker product with plain assignment, addition
8729 // assignment, subtraction assignment, and multiplication assignment. In case any error resulting
8730 // from the Schur product or the subsequent assignment is detected, a \a std::runtime_error
8731 // exception is thrown.
8732 */
8733 template< typename MT1 // Type of the left-hand side sparse matrix
8734 , typename MT2 > // Type of the right-hand side dense matrix
testRowOperation(blaze::TrueType)8735 void OperationTest<MT1,MT2>::testRowOperation( blaze::TrueType )
8736 {
8737 #if BLAZETEST_MATHTEST_TEST_ROW_OPERATION
8738 if( BLAZETEST_MATHTEST_TEST_ROW_OPERATION > 1 )
8739 {
8740 if( lhs_.rows() * rhs_.rows() == 0UL )
8741 return;
8742
8743
8744 //=====================================================================================
8745 // Row-wise Kronecker product
8746 //=====================================================================================
8747
8748 // Row-wise Kronecker product with the given matrices
8749 {
8750 test_ = "Row-wise Kronecker product with the given matrices";
8751 error_ = "Failed Kronecker product operation";
8752
8753 try {
8754 initResults();
8755 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8756 row( dres_ , i ) = row( kron( lhs_, rhs_ ), i );
8757 row( odres_ , i ) = row( kron( lhs_, rhs_ ), i );
8758 row( sres_ , i ) = row( kron( lhs_, rhs_ ), i );
8759 row( osres_ , i ) = row( kron( lhs_, rhs_ ), i );
8760 row( refres_, i ) = row( kron( reflhs_, refrhs_ ), i );
8761 }
8762 }
8763 catch( std::exception& ex ) {
8764 convertException<MT1,MT2>( ex );
8765 }
8766
8767 checkResults<MT1,MT2>();
8768
8769 try {
8770 initResults();
8771 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8772 row( dres_ , i ) = row( kron( lhs_, orhs_ ), i );
8773 row( odres_ , i ) = row( kron( lhs_, orhs_ ), i );
8774 row( sres_ , i ) = row( kron( lhs_, orhs_ ), i );
8775 row( osres_ , i ) = row( kron( lhs_, orhs_ ), i );
8776 row( refres_, i ) = row( kron( reflhs_, refrhs_ ), i );
8777 }
8778 }
8779 catch( std::exception& ex ) {
8780 convertException<MT1,OMT2>( ex );
8781 }
8782
8783 checkResults<MT1,OMT2>();
8784
8785 try {
8786 initResults();
8787 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8788 row( dres_ , i ) = row( kron( olhs_, rhs_ ), i );
8789 row( odres_ , i ) = row( kron( olhs_, rhs_ ), i );
8790 row( sres_ , i ) = row( kron( olhs_, rhs_ ), i );
8791 row( osres_ , i ) = row( kron( olhs_, rhs_ ), i );
8792 row( refres_, i ) = row( kron( reflhs_, refrhs_ ), i );
8793 }
8794 }
8795 catch( std::exception& ex ) {
8796 convertException<OMT1,MT2>( ex );
8797 }
8798
8799 checkResults<OMT1,MT2>();
8800
8801 try {
8802 initResults();
8803 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8804 row( dres_ , i ) = row( kron( olhs_, orhs_ ), i );
8805 row( odres_ , i ) = row( kron( olhs_, orhs_ ), i );
8806 row( sres_ , i ) = row( kron( olhs_, orhs_ ), i );
8807 row( osres_ , i ) = row( kron( olhs_, orhs_ ), i );
8808 row( refres_, i ) = row( kron( reflhs_, refrhs_ ), i );
8809 }
8810 }
8811 catch( std::exception& ex ) {
8812 convertException<OMT1,OMT2>( ex );
8813 }
8814
8815 checkResults<OMT1,OMT2>();
8816 }
8817
8818 // Row-wise Kronecker product with evaluated matrices
8819 {
8820 test_ = "Row-wise Kronecker product with evaluated matrices";
8821 error_ = "Failed Kronecker product operation";
8822
8823 try {
8824 initResults();
8825 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8826 row( dres_ , i ) = row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
8827 row( odres_ , i ) = row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
8828 row( sres_ , i ) = row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
8829 row( osres_ , i ) = row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
8830 row( refres_, i ) = row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
8831 }
8832 }
8833 catch( std::exception& ex ) {
8834 convertException<MT1,MT2>( ex );
8835 }
8836
8837 checkResults<MT1,MT2>();
8838
8839 try {
8840 initResults();
8841 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8842 row( dres_ , i ) = row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
8843 row( odres_ , i ) = row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
8844 row( sres_ , i ) = row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
8845 row( osres_ , i ) = row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
8846 row( refres_, i ) = row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
8847 }
8848 }
8849 catch( std::exception& ex ) {
8850 convertException<MT1,OMT2>( ex );
8851 }
8852
8853 checkResults<MT1,OMT2>();
8854
8855 try {
8856 initResults();
8857 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8858 row( dres_ , i ) = row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
8859 row( odres_ , i ) = row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
8860 row( sres_ , i ) = row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
8861 row( osres_ , i ) = row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
8862 row( refres_, i ) = row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
8863 }
8864 }
8865 catch( std::exception& ex ) {
8866 convertException<OMT1,MT2>( ex );
8867 }
8868
8869 checkResults<OMT1,MT2>();
8870
8871 try {
8872 initResults();
8873 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8874 row( dres_ , i ) = row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
8875 row( odres_ , i ) = row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
8876 row( sres_ , i ) = row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
8877 row( osres_ , i ) = row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
8878 row( refres_, i ) = row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
8879 }
8880 }
8881 catch( std::exception& ex ) {
8882 convertException<OMT1,OMT2>( ex );
8883 }
8884
8885 checkResults<OMT1,OMT2>();
8886 }
8887
8888
8889 //=====================================================================================
8890 // Row-wise Kronecker product with addition assignment
8891 //=====================================================================================
8892
8893 // Row-wise Kronecker product with addition assignment with the given matrices
8894 {
8895 test_ = "Row-wise Kronecker product with addition assignment with the given matrices";
8896 error_ = "Failed addition assignment operation";
8897
8898 try {
8899 initResults();
8900 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8901 row( dres_ , i ) += row( kron( lhs_, rhs_ ), i );
8902 row( odres_ , i ) += row( kron( lhs_, rhs_ ), i );
8903 row( sres_ , i ) += row( kron( lhs_, rhs_ ), i );
8904 row( osres_ , i ) += row( kron( lhs_, rhs_ ), i );
8905 row( refres_, i ) += row( kron( reflhs_, refrhs_ ), i );
8906 }
8907 }
8908 catch( std::exception& ex ) {
8909 convertException<MT1,MT2>( ex );
8910 }
8911
8912 checkResults<MT1,MT2>();
8913
8914 try {
8915 initResults();
8916 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8917 row( dres_ , i ) += row( kron( lhs_, orhs_ ), i );
8918 row( odres_ , i ) += row( kron( lhs_, orhs_ ), i );
8919 row( sres_ , i ) += row( kron( lhs_, orhs_ ), i );
8920 row( osres_ , i ) += row( kron( lhs_, orhs_ ), i );
8921 row( refres_, i ) += row( kron( reflhs_, refrhs_ ), i );
8922 }
8923 }
8924 catch( std::exception& ex ) {
8925 convertException<MT1,OMT2>( ex );
8926 }
8927
8928 checkResults<MT1,OMT2>();
8929
8930 try {
8931 initResults();
8932 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8933 row( dres_ , i ) += row( kron( olhs_, rhs_ ), i );
8934 row( odres_ , i ) += row( kron( olhs_, rhs_ ), i );
8935 row( sres_ , i ) += row( kron( olhs_, rhs_ ), i );
8936 row( osres_ , i ) += row( kron( olhs_, rhs_ ), i );
8937 row( refres_, i ) += row( kron( reflhs_, refrhs_ ), i );
8938 }
8939 }
8940 catch( std::exception& ex ) {
8941 convertException<OMT1,MT2>( ex );
8942 }
8943
8944 checkResults<OMT1,MT2>();
8945
8946 try {
8947 initResults();
8948 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8949 row( dres_ , i ) += row( kron( olhs_, orhs_ ), i );
8950 row( odres_ , i ) += row( kron( olhs_, orhs_ ), i );
8951 row( sres_ , i ) += row( kron( olhs_, orhs_ ), i );
8952 row( osres_ , i ) += row( kron( olhs_, orhs_ ), i );
8953 row( refres_, i ) += row( kron( reflhs_, refrhs_ ), i );
8954 }
8955 }
8956 catch( std::exception& ex ) {
8957 convertException<OMT1,OMT2>( ex );
8958 }
8959
8960 checkResults<OMT1,OMT2>();
8961 }
8962
8963 // Row-wise Kronecker product with addition assignment with evaluated matrices
8964 {
8965 test_ = "Row-wise Kronecker product with addition assignment with evaluated matrices";
8966 error_ = "Failed addition assignment operation";
8967
8968 try {
8969 initResults();
8970 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8971 row( dres_ , i ) += row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
8972 row( odres_ , i ) += row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
8973 row( sres_ , i ) += row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
8974 row( osres_ , i ) += row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
8975 row( refres_, i ) += row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
8976 }
8977 }
8978 catch( std::exception& ex ) {
8979 convertException<MT1,MT2>( ex );
8980 }
8981
8982 checkResults<MT1,MT2>();
8983
8984 try {
8985 initResults();
8986 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
8987 row( dres_ , i ) += row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
8988 row( odres_ , i ) += row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
8989 row( sres_ , i ) += row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
8990 row( osres_ , i ) += row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
8991 row( refres_, i ) += row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
8992 }
8993 }
8994 catch( std::exception& ex ) {
8995 convertException<MT1,OMT2>( ex );
8996 }
8997
8998 checkResults<MT1,OMT2>();
8999
9000 try {
9001 initResults();
9002 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9003 row( dres_ , i ) += row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9004 row( odres_ , i ) += row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9005 row( sres_ , i ) += row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9006 row( osres_ , i ) += row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9007 row( refres_, i ) += row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
9008 }
9009 }
9010 catch( std::exception& ex ) {
9011 convertException<OMT1,MT2>( ex );
9012 }
9013
9014 checkResults<OMT1,MT2>();
9015
9016 try {
9017 initResults();
9018 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9019 row( dres_ , i ) += row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9020 row( odres_ , i ) += row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9021 row( sres_ , i ) += row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9022 row( osres_ , i ) += row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9023 row( refres_, i ) += row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
9024 }
9025 }
9026 catch( std::exception& ex ) {
9027 convertException<OMT1,OMT2>( ex );
9028 }
9029
9030 checkResults<OMT1,OMT2>();
9031 }
9032
9033
9034 //=====================================================================================
9035 // Row-wise Kronecker product with subtraction assignment
9036 //=====================================================================================
9037
9038 // Row-wise Kronecker product with subtraction assignment with the given matrices
9039 {
9040 test_ = "Row-wise Kronecker product with subtraction assignment with the given matrices";
9041 error_ = "Failed subtraction assignment operation";
9042
9043 try {
9044 initResults();
9045 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9046 row( dres_ , i ) -= row( kron( lhs_, rhs_ ), i );
9047 row( odres_ , i ) -= row( kron( lhs_, rhs_ ), i );
9048 row( sres_ , i ) -= row( kron( lhs_, rhs_ ), i );
9049 row( osres_ , i ) -= row( kron( lhs_, rhs_ ), i );
9050 row( refres_, i ) -= row( kron( reflhs_, refrhs_ ), i );
9051 }
9052 }
9053 catch( std::exception& ex ) {
9054 convertException<MT1,MT2>( ex );
9055 }
9056
9057 checkResults<MT1,MT2>();
9058
9059 try {
9060 initResults();
9061 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9062 row( dres_ , i ) -= row( kron( lhs_, orhs_ ), i );
9063 row( odres_ , i ) -= row( kron( lhs_, orhs_ ), i );
9064 row( sres_ , i ) -= row( kron( lhs_, orhs_ ), i );
9065 row( osres_ , i ) -= row( kron( lhs_, orhs_ ), i );
9066 row( refres_, i ) -= row( kron( reflhs_, refrhs_ ), i );
9067 }
9068 }
9069 catch( std::exception& ex ) {
9070 convertException<MT1,OMT2>( ex );
9071 }
9072
9073 checkResults<MT1,OMT2>();
9074
9075 try {
9076 initResults();
9077 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9078 row( dres_ , i ) -= row( kron( olhs_, rhs_ ), i );
9079 row( odres_ , i ) -= row( kron( olhs_, rhs_ ), i );
9080 row( sres_ , i ) -= row( kron( olhs_, rhs_ ), i );
9081 row( osres_ , i ) -= row( kron( olhs_, rhs_ ), i );
9082 row( refres_, i ) -= row( kron( reflhs_, refrhs_ ), i );
9083 }
9084 }
9085 catch( std::exception& ex ) {
9086 convertException<OMT1,MT2>( ex );
9087 }
9088
9089 checkResults<OMT1,MT2>();
9090
9091 try {
9092 initResults();
9093 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9094 row( dres_ , i ) -= row( kron( olhs_, orhs_ ), i );
9095 row( odres_ , i ) -= row( kron( olhs_, orhs_ ), i );
9096 row( sres_ , i ) -= row( kron( olhs_, orhs_ ), i );
9097 row( osres_ , i ) -= row( kron( olhs_, orhs_ ), i );
9098 row( refres_, i ) -= row( kron( reflhs_, refrhs_ ), i );
9099 }
9100 }
9101 catch( std::exception& ex ) {
9102 convertException<OMT1,OMT2>( ex );
9103 }
9104
9105 checkResults<OMT1,OMT2>();
9106 }
9107
9108 // Row-wise Kronecker product with subtraction assignment with evaluated matrices
9109 {
9110 test_ = "Row-wise Kronecker product with subtraction assignment with evaluated matrices";
9111 error_ = "Failed subtraction assignment operation";
9112
9113 try {
9114 initResults();
9115 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9116 row( dres_ , i ) -= row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
9117 row( odres_ , i ) -= row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
9118 row( sres_ , i ) -= row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
9119 row( osres_ , i ) -= row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
9120 row( refres_, i ) -= row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
9121 }
9122 }
9123 catch( std::exception& ex ) {
9124 convertException<MT1,MT2>( ex );
9125 }
9126
9127 checkResults<MT1,MT2>();
9128
9129 try {
9130 initResults();
9131 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9132 row( dres_ , i ) -= row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
9133 row( odres_ , i ) -= row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
9134 row( sres_ , i ) -= row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
9135 row( osres_ , i ) -= row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
9136 row( refres_, i ) -= row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
9137 }
9138 }
9139 catch( std::exception& ex ) {
9140 convertException<MT1,OMT2>( ex );
9141 }
9142
9143 checkResults<MT1,OMT2>();
9144
9145 try {
9146 initResults();
9147 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9148 row( dres_ , i ) -= row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9149 row( odres_ , i ) -= row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9150 row( sres_ , i ) -= row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9151 row( osres_ , i ) -= row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9152 row( refres_, i ) -= row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
9153 }
9154 }
9155 catch( std::exception& ex ) {
9156 convertException<OMT1,MT2>( ex );
9157 }
9158
9159 checkResults<OMT1,MT2>();
9160
9161 try {
9162 initResults();
9163 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9164 row( dres_ , i ) -= row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9165 row( odres_ , i ) -= row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9166 row( sres_ , i ) -= row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9167 row( osres_ , i ) -= row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9168 row( refres_, i ) -= row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
9169 }
9170 }
9171 catch( std::exception& ex ) {
9172 convertException<OMT1,OMT2>( ex );
9173 }
9174
9175 checkResults<OMT1,OMT2>();
9176 }
9177
9178
9179 //=====================================================================================
9180 // Row-wise Kronecker product with multiplication assignment
9181 //=====================================================================================
9182
9183 // Row-wise Kronecker product with multiplication assignment with the given matrices
9184 {
9185 test_ = "Row-wise Kronecker product with multiplication assignment with the given matrices";
9186 error_ = "Failed multiplication assignment operation";
9187
9188 try {
9189 initResults();
9190 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9191 row( dres_ , i ) *= row( kron( lhs_, rhs_ ), i );
9192 row( odres_ , i ) *= row( kron( lhs_, rhs_ ), i );
9193 row( sres_ , i ) *= row( kron( lhs_, rhs_ ), i );
9194 row( osres_ , i ) *= row( kron( lhs_, rhs_ ), i );
9195 row( refres_, i ) *= row( kron( reflhs_, refrhs_ ), i );
9196 }
9197 }
9198 catch( std::exception& ex ) {
9199 convertException<MT1,MT2>( ex );
9200 }
9201
9202 checkResults<MT1,MT2>();
9203
9204 try {
9205 initResults();
9206 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9207 row( dres_ , i ) *= row( kron( lhs_, orhs_ ), i );
9208 row( odres_ , i ) *= row( kron( lhs_, orhs_ ), i );
9209 row( sres_ , i ) *= row( kron( lhs_, orhs_ ), i );
9210 row( osres_ , i ) *= row( kron( lhs_, orhs_ ), i );
9211 row( refres_, i ) *= row( kron( reflhs_, refrhs_ ), i );
9212 }
9213 }
9214 catch( std::exception& ex ) {
9215 convertException<MT1,OMT2>( ex );
9216 }
9217
9218 checkResults<MT1,OMT2>();
9219
9220 try {
9221 initResults();
9222 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9223 row( dres_ , i ) *= row( kron( olhs_, rhs_ ), i );
9224 row( odres_ , i ) *= row( kron( olhs_, rhs_ ), i );
9225 row( sres_ , i ) *= row( kron( olhs_, rhs_ ), i );
9226 row( osres_ , i ) *= row( kron( olhs_, rhs_ ), i );
9227 row( refres_, i ) *= row( kron( reflhs_, refrhs_ ), i );
9228 }
9229 }
9230 catch( std::exception& ex ) {
9231 convertException<OMT1,MT2>( ex );
9232 }
9233
9234 checkResults<OMT1,MT2>();
9235
9236 try {
9237 initResults();
9238 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9239 row( dres_ , i ) *= row( kron( olhs_, orhs_ ), i );
9240 row( odres_ , i ) *= row( kron( olhs_, orhs_ ), i );
9241 row( sres_ , i ) *= row( kron( olhs_, orhs_ ), i );
9242 row( osres_ , i ) *= row( kron( olhs_, orhs_ ), i );
9243 row( refres_, i ) *= row( kron( reflhs_, refrhs_ ), i );
9244 }
9245 }
9246 catch( std::exception& ex ) {
9247 convertException<OMT1,OMT2>( ex );
9248 }
9249
9250 checkResults<OMT1,OMT2>();
9251 }
9252
9253 // Row-wise Kronecker product with multiplication assignment with evaluated matrices
9254 {
9255 test_ = "Row-wise Kronecker product with multiplication assignment with evaluated matrices";
9256 error_ = "Failed multiplication assignment operation";
9257
9258 try {
9259 initResults();
9260 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9261 row( dres_ , i ) *= row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
9262 row( odres_ , i ) *= row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
9263 row( sres_ , i ) *= row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
9264 row( osres_ , i ) *= row( kron( eval( lhs_ ), eval( rhs_ ) ), i );
9265 row( refres_, i ) *= row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
9266 }
9267 }
9268 catch( std::exception& ex ) {
9269 convertException<MT1,MT2>( ex );
9270 }
9271
9272 checkResults<MT1,MT2>();
9273
9274 try {
9275 initResults();
9276 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9277 row( dres_ , i ) *= row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
9278 row( odres_ , i ) *= row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
9279 row( sres_ , i ) *= row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
9280 row( osres_ , i ) *= row( kron( eval( lhs_ ), eval( orhs_ ) ), i );
9281 row( refres_, i ) *= row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
9282 }
9283 }
9284 catch( std::exception& ex ) {
9285 convertException<MT1,OMT2>( ex );
9286 }
9287
9288 checkResults<MT1,OMT2>();
9289
9290 try {
9291 initResults();
9292 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9293 row( dres_ , i ) *= row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9294 row( odres_ , i ) *= row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9295 row( sres_ , i ) *= row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9296 row( osres_ , i ) *= row( kron( eval( olhs_ ), eval( rhs_ ) ), i );
9297 row( refres_, i ) *= row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
9298 }
9299 }
9300 catch( std::exception& ex ) {
9301 convertException<OMT1,MT2>( ex );
9302 }
9303
9304 checkResults<OMT1,MT2>();
9305
9306 try {
9307 initResults();
9308 for( size_t i=0UL; i<lhs_.rows()*rhs_.rows(); ++i ) {
9309 row( dres_ , i ) *= row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9310 row( odres_ , i ) *= row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9311 row( sres_ , i ) *= row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9312 row( osres_ , i ) *= row( kron( eval( olhs_ ), eval( orhs_ ) ), i );
9313 row( refres_, i ) *= row( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
9314 }
9315 }
9316 catch( std::exception& ex ) {
9317 convertException<OMT1,OMT2>( ex );
9318 }
9319
9320 checkResults<OMT1,OMT2>();
9321 }
9322
9323
9324 //=====================================================================================
9325 // Failure cases
9326 //=====================================================================================
9327
9328 // Out-of-bounds access (invalid row index)
9329 {
9330 test_ = "Out-of-bounds row construction (invalid row index)";
9331 error_ = "Setup of out-of-bounds row succeeded";
9332
9333 try {
9334 auto r = row( kron( lhs_, rhs_ ), lhs_.rows()*rhs_.rows() );
9335
9336 std::ostringstream oss;
9337 oss << " Test: " << test_ << "\n"
9338 << " Error: " << error_ << "\n"
9339 << " Details:\n"
9340 << " Random seed = " << blaze::getSeed() << "\n"
9341 << " Left-hand side sparse matrix type:\n"
9342 << " " << typeid( MT1 ).name() << "\n"
9343 << " Right-hand side dense matrix type:\n"
9344 << " " << typeid( MT2 ).name() << "\n"
9345 << " Result:\n" << r << "\n";
9346 throw std::runtime_error( oss.str() );
9347 }
9348 catch( std::invalid_argument& ex ) {
9349 checkExceptionMessage( ex, "Invalid row access index" );
9350 }
9351
9352 try {
9353 auto r = row( kron( lhs_, orhs_ ), lhs_.rows()*orhs_.rows() );
9354
9355 std::ostringstream oss;
9356 oss << " Test: " << test_ << "\n"
9357 << " Error: " << error_ << "\n"
9358 << " Details:\n"
9359 << " Random seed = " << blaze::getSeed() << "\n"
9360 << " Left-hand side sparse matrix type:\n"
9361 << " " << typeid( MT1 ).name() << "\n"
9362 << " Right-hand side dense matrix type:\n"
9363 << " " << typeid( OMT2 ).name() << "\n"
9364 << " Result:\n" << r << "\n";
9365 throw std::runtime_error( oss.str() );
9366 }
9367 catch( std::invalid_argument& ex ) {
9368 checkExceptionMessage( ex, "Invalid row access index" );
9369 }
9370
9371 try {
9372 auto r = row( kron( olhs_, rhs_ ), olhs_.rows()*rhs_.rows() );
9373
9374 std::ostringstream oss;
9375 oss << " Test: " << test_ << "\n"
9376 << " Error: " << error_ << "\n"
9377 << " Details:\n"
9378 << " Random seed = " << blaze::getSeed() << "\n"
9379 << " Left-hand side sparse matrix type:\n"
9380 << " " << typeid( OMT1 ).name() << "\n"
9381 << " Right-hand side dense matrix type:\n"
9382 << " " << typeid( MT2 ).name() << "\n"
9383 << " Result:\n" << r << "\n";
9384 throw std::runtime_error( oss.str() );
9385 }
9386 catch( std::invalid_argument& ex ) {
9387 checkExceptionMessage( ex, "Invalid row access index" );
9388 }
9389
9390 try {
9391 auto r = row( kron( olhs_, orhs_ ), olhs_.rows()*orhs_.rows() );
9392
9393 std::ostringstream oss;
9394 oss << " Test: " << test_ << "\n"
9395 << " Error: " << error_ << "\n"
9396 << " Details:\n"
9397 << " Random seed = " << blaze::getSeed() << "\n"
9398 << " Left-hand side sparse matrix type:\n"
9399 << " " << typeid( OMT1 ).name() << "\n"
9400 << " Right-hand side dense matrix type:\n"
9401 << " " << typeid( OMT2 ).name() << "\n"
9402 << " Result:\n" << r << "\n";
9403 throw std::runtime_error( oss.str() );
9404 }
9405 catch( std::invalid_argument& ex ) {
9406 checkExceptionMessage( ex, "Invalid row access index" );
9407 }
9408 }
9409 }
9410 #endif
9411 }
9412 //*************************************************************************************************
9413
9414
9415 //*************************************************************************************************
9416 /*!\brief Skipping the row-wise sparse matrix/dense matrix Kronecker product.
9417 //
9418 // \return void
9419 //
9420 // This function is called in case the row-wise matrix/matrix Kronecker product operation is not
9421 // available for the given matrix types \a MT1 and \a MT2.
9422 */
9423 template< typename MT1 // Type of the left-hand side sparse matrix
9424 , typename MT2 > // Type of the right-hand side dense matrix
testRowOperation(blaze::FalseType)9425 void OperationTest<MT1,MT2>::testRowOperation( blaze::FalseType )
9426 {}
9427 //*************************************************************************************************
9428
9429
9430 //*************************************************************************************************
9431 /*!\brief Testing the rows-wise sparse matrix/dense matrix Kronecker product.
9432 //
9433 // \return void
9434 // \exception std::runtime_error Kronecker product error detected.
9435 //
9436 // This function tests the rows-wise matrix Kronecker product with plain assignment, addition
9437 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
9438 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
9439 // exception is thrown.
9440 */
9441 template< typename MT1 // Type of the left-hand side sparse matrix
9442 , typename MT2 > // Type of the right-hand side dense matrix
testRowsOperation(blaze::TrueType)9443 void OperationTest<MT1,MT2>::testRowsOperation( blaze::TrueType )
9444 {
9445 #if BLAZETEST_MATHTEST_TEST_ROWS_OPERATION
9446 if( BLAZETEST_MATHTEST_TEST_ROWS_OPERATION > 1 )
9447 {
9448 if( lhs_.rows() * rhs_.rows() == 0UL )
9449 return;
9450
9451
9452 std::vector<size_t> indices( lhs_.rows() * rhs_.rows() );
9453 std::iota( indices.begin(), indices.end(), 0UL );
9454 std::random_shuffle( indices.begin(), indices.end() );
9455
9456
9457 //=====================================================================================
9458 // Rows-wise Kronecker product
9459 //=====================================================================================
9460
9461 // Rows-wise Kronecker product with the given matrices
9462 {
9463 test_ = "Rows-wise Kronecker product with the given matrices";
9464 error_ = "Failed Kronecker product operation";
9465
9466 try {
9467 initResults();
9468 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9469 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9470 rows( dres_ , &indices[index], n ) = rows( kron( lhs_, rhs_ ), &indices[index], n );
9471 rows( odres_ , &indices[index], n ) = rows( kron( lhs_, rhs_ ), &indices[index], n );
9472 rows( sres_ , &indices[index], n ) = rows( kron( lhs_, rhs_ ), &indices[index], n );
9473 rows( osres_ , &indices[index], n ) = rows( kron( lhs_, rhs_ ), &indices[index], n );
9474 rows( refres_, &indices[index], n ) = rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9475 }
9476 }
9477 catch( std::exception& ex ) {
9478 convertException<MT1,MT2>( ex );
9479 }
9480
9481 checkResults<MT1,MT2>();
9482
9483 try {
9484 initResults();
9485 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9486 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9487 rows( dres_ , &indices[index], n ) = rows( kron( lhs_, orhs_ ), &indices[index], n );
9488 rows( odres_ , &indices[index], n ) = rows( kron( lhs_, orhs_ ), &indices[index], n );
9489 rows( sres_ , &indices[index], n ) = rows( kron( lhs_, orhs_ ), &indices[index], n );
9490 rows( osres_ , &indices[index], n ) = rows( kron( lhs_, orhs_ ), &indices[index], n );
9491 rows( refres_, &indices[index], n ) = rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9492 }
9493 }
9494 catch( std::exception& ex ) {
9495 convertException<MT1,OMT2>( ex );
9496 }
9497
9498 checkResults<MT1,OMT2>();
9499
9500 try {
9501 initResults();
9502 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9503 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9504 rows( dres_ , &indices[index], n ) = rows( kron( olhs_, rhs_ ), &indices[index], n );
9505 rows( odres_ , &indices[index], n ) = rows( kron( olhs_, rhs_ ), &indices[index], n );
9506 rows( sres_ , &indices[index], n ) = rows( kron( olhs_, rhs_ ), &indices[index], n );
9507 rows( osres_ , &indices[index], n ) = rows( kron( olhs_, rhs_ ), &indices[index], n );
9508 rows( refres_, &indices[index], n ) = rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9509 }
9510 }
9511 catch( std::exception& ex ) {
9512 convertException<OMT1,MT2>( ex );
9513 }
9514
9515 checkResults<OMT1,MT2>();
9516
9517 try {
9518 initResults();
9519 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9520 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9521 rows( dres_ , &indices[index], n ) = rows( kron( olhs_, orhs_ ), &indices[index], n );
9522 rows( odres_ , &indices[index], n ) = rows( kron( olhs_, orhs_ ), &indices[index], n );
9523 rows( sres_ , &indices[index], n ) = rows( kron( olhs_, orhs_ ), &indices[index], n );
9524 rows( osres_ , &indices[index], n ) = rows( kron( olhs_, orhs_ ), &indices[index], n );
9525 rows( refres_, &indices[index], n ) = rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9526 }
9527 }
9528 catch( std::exception& ex ) {
9529 convertException<OMT1,OMT2>( ex );
9530 }
9531
9532 checkResults<OMT1,OMT2>();
9533 }
9534
9535 // Rows-wise Kronecker product with evaluated matrices
9536 {
9537 test_ = "Rows-wise Kronecker product with evaluated matrices";
9538 error_ = "Failed Kronecker product operation";
9539
9540 try {
9541 initResults();
9542 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9543 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9544 rows( dres_ , &indices[index], n ) = rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9545 rows( odres_ , &indices[index], n ) = rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9546 rows( sres_ , &indices[index], n ) = rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9547 rows( osres_ , &indices[index], n ) = rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9548 rows( refres_, &indices[index], n ) = rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9549 }
9550 }
9551 catch( std::exception& ex ) {
9552 convertException<MT1,MT2>( ex );
9553 }
9554
9555 checkResults<MT1,MT2>();
9556
9557 try {
9558 initResults();
9559 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9560 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9561 rows( dres_ , &indices[index], n ) = rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9562 rows( odres_ , &indices[index], n ) = rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9563 rows( sres_ , &indices[index], n ) = rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9564 rows( osres_ , &indices[index], n ) = rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9565 rows( refres_, &indices[index], n ) = rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9566 }
9567 }
9568 catch( std::exception& ex ) {
9569 convertException<MT1,OMT2>( ex );
9570 }
9571
9572 checkResults<MT1,OMT2>();
9573
9574 try {
9575 initResults();
9576 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9577 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9578 rows( dres_ , &indices[index], n ) = rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9579 rows( odres_ , &indices[index], n ) = rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9580 rows( sres_ , &indices[index], n ) = rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9581 rows( osres_ , &indices[index], n ) = rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9582 rows( refres_, &indices[index], n ) = rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9583 }
9584 }
9585 catch( std::exception& ex ) {
9586 convertException<OMT1,MT2>( ex );
9587 }
9588
9589 checkResults<OMT1,MT2>();
9590
9591 try {
9592 initResults();
9593 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9594 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9595 rows( dres_ , &indices[index], n ) = rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9596 rows( odres_ , &indices[index], n ) = rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9597 rows( sres_ , &indices[index], n ) = rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9598 rows( osres_ , &indices[index], n ) = rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9599 rows( refres_, &indices[index], n ) = rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9600 }
9601 }
9602 catch( std::exception& ex ) {
9603 convertException<OMT1,OMT2>( ex );
9604 }
9605
9606 checkResults<OMT1,OMT2>();
9607 }
9608
9609
9610 //=====================================================================================
9611 // Rows-wise Kronecker product with addition assignment
9612 //=====================================================================================
9613
9614 // Rows-wise Kronecker product with addition assignment with the given matrices
9615 {
9616 test_ = "Rows-wise Kronecker product with addition assignment with the given matrices";
9617 error_ = "Failed addition assignment operation";
9618
9619 try {
9620 initResults();
9621 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9622 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9623 rows( dres_ , &indices[index], n ) += rows( kron( lhs_, rhs_ ), &indices[index], n );
9624 rows( odres_ , &indices[index], n ) += rows( kron( lhs_, rhs_ ), &indices[index], n );
9625 rows( sres_ , &indices[index], n ) += rows( kron( lhs_, rhs_ ), &indices[index], n );
9626 rows( osres_ , &indices[index], n ) += rows( kron( lhs_, rhs_ ), &indices[index], n );
9627 rows( refres_, &indices[index], n ) += rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9628 }
9629 }
9630 catch( std::exception& ex ) {
9631 convertException<MT1,MT2>( ex );
9632 }
9633
9634 checkResults<MT1,MT2>();
9635
9636 try {
9637 initResults();
9638 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9639 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9640 rows( dres_ , &indices[index], n ) += rows( kron( lhs_, orhs_ ), &indices[index], n );
9641 rows( odres_ , &indices[index], n ) += rows( kron( lhs_, orhs_ ), &indices[index], n );
9642 rows( sres_ , &indices[index], n ) += rows( kron( lhs_, orhs_ ), &indices[index], n );
9643 rows( osres_ , &indices[index], n ) += rows( kron( lhs_, orhs_ ), &indices[index], n );
9644 rows( refres_, &indices[index], n ) += rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9645 }
9646 }
9647 catch( std::exception& ex ) {
9648 convertException<MT1,OMT2>( ex );
9649 }
9650
9651 checkResults<MT1,OMT2>();
9652
9653 try {
9654 initResults();
9655 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9656 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9657 rows( dres_ , &indices[index], n ) += rows( kron( olhs_, rhs_ ), &indices[index], n );
9658 rows( odres_ , &indices[index], n ) += rows( kron( olhs_, rhs_ ), &indices[index], n );
9659 rows( sres_ , &indices[index], n ) += rows( kron( olhs_, rhs_ ), &indices[index], n );
9660 rows( osres_ , &indices[index], n ) += rows( kron( olhs_, rhs_ ), &indices[index], n );
9661 rows( refres_, &indices[index], n ) += rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9662 }
9663 }
9664 catch( std::exception& ex ) {
9665 convertException<OMT1,MT2>( ex );
9666 }
9667
9668 checkResults<OMT1,MT2>();
9669
9670 try {
9671 initResults();
9672 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9673 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9674 rows( dres_ , &indices[index], n ) += rows( kron( olhs_, orhs_ ), &indices[index], n );
9675 rows( odres_ , &indices[index], n ) += rows( kron( olhs_, orhs_ ), &indices[index], n );
9676 rows( sres_ , &indices[index], n ) += rows( kron( olhs_, orhs_ ), &indices[index], n );
9677 rows( osres_ , &indices[index], n ) += rows( kron( olhs_, orhs_ ), &indices[index], n );
9678 rows( refres_, &indices[index], n ) += rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9679 }
9680 }
9681 catch( std::exception& ex ) {
9682 convertException<OMT1,OMT2>( ex );
9683 }
9684
9685 checkResults<OMT1,OMT2>();
9686 }
9687
9688 // Rows-wise Kronecker product with addition assignment with evaluated matrices
9689 {
9690 test_ = "Rows-wise Kronecker product with addition assignment with evaluated matrices";
9691 error_ = "Failed addition assignment operation";
9692
9693 try {
9694 initResults();
9695 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9696 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9697 rows( dres_ , &indices[index], n ) += rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9698 rows( odres_ , &indices[index], n ) += rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9699 rows( sres_ , &indices[index], n ) += rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9700 rows( osres_ , &indices[index], n ) += rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9701 rows( refres_, &indices[index], n ) += rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9702 }
9703 }
9704 catch( std::exception& ex ) {
9705 convertException<MT1,MT2>( ex );
9706 }
9707
9708 checkResults<MT1,MT2>();
9709
9710 try {
9711 initResults();
9712 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9713 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9714 rows( dres_ , &indices[index], n ) += rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9715 rows( odres_ , &indices[index], n ) += rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9716 rows( sres_ , &indices[index], n ) += rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9717 rows( osres_ , &indices[index], n ) += rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9718 rows( refres_, &indices[index], n ) += rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9719 }
9720 }
9721 catch( std::exception& ex ) {
9722 convertException<MT1,OMT2>( ex );
9723 }
9724
9725 checkResults<MT1,OMT2>();
9726
9727 try {
9728 initResults();
9729 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9730 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9731 rows( dres_ , &indices[index], n ) += rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9732 rows( odres_ , &indices[index], n ) += rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9733 rows( sres_ , &indices[index], n ) += rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9734 rows( osres_ , &indices[index], n ) += rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9735 rows( refres_, &indices[index], n ) += rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9736 }
9737 }
9738 catch( std::exception& ex ) {
9739 convertException<OMT1,MT2>( ex );
9740 }
9741
9742 checkResults<OMT1,MT2>();
9743
9744 try {
9745 initResults();
9746 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9747 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9748 rows( dres_ , &indices[index], n ) += rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9749 rows( odres_ , &indices[index], n ) += rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9750 rows( sres_ , &indices[index], n ) += rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9751 rows( osres_ , &indices[index], n ) += rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9752 rows( refres_, &indices[index], n ) += rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9753 }
9754 }
9755 catch( std::exception& ex ) {
9756 convertException<OMT1,OMT2>( ex );
9757 }
9758
9759 checkResults<OMT1,OMT2>();
9760 }
9761
9762
9763 //=====================================================================================
9764 // Rows-wise Kronecker product with subtraction assignment
9765 //=====================================================================================
9766
9767 // Rows-wise Kronecker product with subtraction assignment with the given matrices
9768 {
9769 test_ = "Rows-wise Kronecker product with subtraction assignment with the given matrices";
9770 error_ = "Failed subtraction assignment operation";
9771
9772 try {
9773 initResults();
9774 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9775 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9776 rows( dres_ , &indices[index], n ) -= rows( kron( lhs_, rhs_ ), &indices[index], n );
9777 rows( odres_ , &indices[index], n ) -= rows( kron( lhs_, rhs_ ), &indices[index], n );
9778 rows( sres_ , &indices[index], n ) -= rows( kron( lhs_, rhs_ ), &indices[index], n );
9779 rows( osres_ , &indices[index], n ) -= rows( kron( lhs_, rhs_ ), &indices[index], n );
9780 rows( refres_, &indices[index], n ) -= rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9781 }
9782 }
9783 catch( std::exception& ex ) {
9784 convertException<MT1,MT2>( ex );
9785 }
9786
9787 checkResults<MT1,MT2>();
9788
9789 try {
9790 initResults();
9791 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9792 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9793 rows( dres_ , &indices[index], n ) -= rows( kron( lhs_, orhs_ ), &indices[index], n );
9794 rows( odres_ , &indices[index], n ) -= rows( kron( lhs_, orhs_ ), &indices[index], n );
9795 rows( sres_ , &indices[index], n ) -= rows( kron( lhs_, orhs_ ), &indices[index], n );
9796 rows( osres_ , &indices[index], n ) -= rows( kron( lhs_, orhs_ ), &indices[index], n );
9797 rows( refres_, &indices[index], n ) -= rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9798 }
9799 }
9800 catch( std::exception& ex ) {
9801 convertException<MT1,OMT2>( ex );
9802 }
9803
9804 checkResults<MT1,OMT2>();
9805
9806 try {
9807 initResults();
9808 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9809 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9810 rows( dres_ , &indices[index], n ) -= rows( kron( olhs_, rhs_ ), &indices[index], n );
9811 rows( odres_ , &indices[index], n ) -= rows( kron( olhs_, rhs_ ), &indices[index], n );
9812 rows( sres_ , &indices[index], n ) -= rows( kron( olhs_, rhs_ ), &indices[index], n );
9813 rows( osres_ , &indices[index], n ) -= rows( kron( olhs_, rhs_ ), &indices[index], n );
9814 rows( refres_, &indices[index], n ) -= rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9815 }
9816 }
9817 catch( std::exception& ex ) {
9818 convertException<OMT1,MT2>( ex );
9819 }
9820
9821 checkResults<OMT1,MT2>();
9822
9823 try {
9824 initResults();
9825 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9826 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9827 rows( dres_ , &indices[index], n ) -= rows( kron( olhs_, orhs_ ), &indices[index], n );
9828 rows( odres_ , &indices[index], n ) -= rows( kron( olhs_, orhs_ ), &indices[index], n );
9829 rows( sres_ , &indices[index], n ) -= rows( kron( olhs_, orhs_ ), &indices[index], n );
9830 rows( osres_ , &indices[index], n ) -= rows( kron( olhs_, orhs_ ), &indices[index], n );
9831 rows( refres_, &indices[index], n ) -= rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9832 }
9833 }
9834 catch( std::exception& ex ) {
9835 convertException<OMT1,OMT2>( ex );
9836 }
9837
9838 checkResults<OMT1,OMT2>();
9839 }
9840
9841 // Rows-wise Kronecker product with subtraction assignment with evaluated matrices
9842 {
9843 test_ = "Rows-wise Kronecker product with subtraction assignment with evaluated matrices";
9844 error_ = "Failed subtraction assignment operation";
9845
9846 try {
9847 initResults();
9848 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9849 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9850 rows( dres_ , &indices[index], n ) -= rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9851 rows( odres_ , &indices[index], n ) -= rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9852 rows( sres_ , &indices[index], n ) -= rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9853 rows( osres_ , &indices[index], n ) -= rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
9854 rows( refres_, &indices[index], n ) -= rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9855 }
9856 }
9857 catch( std::exception& ex ) {
9858 convertException<MT1,MT2>( ex );
9859 }
9860
9861 checkResults<MT1,MT2>();
9862
9863 try {
9864 initResults();
9865 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9866 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9867 rows( dres_ , &indices[index], n ) -= rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9868 rows( odres_ , &indices[index], n ) -= rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9869 rows( sres_ , &indices[index], n ) -= rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9870 rows( osres_ , &indices[index], n ) -= rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
9871 rows( refres_, &indices[index], n ) -= rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9872 }
9873 }
9874 catch( std::exception& ex ) {
9875 convertException<MT1,OMT2>( ex );
9876 }
9877
9878 checkResults<MT1,OMT2>();
9879
9880 try {
9881 initResults();
9882 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9883 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9884 rows( dres_ , &indices[index], n ) -= rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9885 rows( odres_ , &indices[index], n ) -= rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9886 rows( sres_ , &indices[index], n ) -= rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9887 rows( osres_ , &indices[index], n ) -= rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
9888 rows( refres_, &indices[index], n ) -= rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9889 }
9890 }
9891 catch( std::exception& ex ) {
9892 convertException<OMT1,MT2>( ex );
9893 }
9894
9895 checkResults<OMT1,MT2>();
9896
9897 try {
9898 initResults();
9899 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9900 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9901 rows( dres_ , &indices[index], n ) -= rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9902 rows( odres_ , &indices[index], n ) -= rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9903 rows( sres_ , &indices[index], n ) -= rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9904 rows( osres_ , &indices[index], n ) -= rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
9905 rows( refres_, &indices[index], n ) -= rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
9906 }
9907 }
9908 catch( std::exception& ex ) {
9909 convertException<OMT1,OMT2>( ex );
9910 }
9911
9912 checkResults<OMT1,OMT2>();
9913 }
9914
9915
9916 //=====================================================================================
9917 // Rows-wise Kronecker product with Schur product assignment
9918 //=====================================================================================
9919
9920 // Rows-wise Kronecker product with Schur product assignment with the given matrices
9921 {
9922 test_ = "Rows-wise Kronecker product with Schur product assignment with the given matrices";
9923 error_ = "Failed Schur product assignment operation";
9924
9925 try {
9926 initResults();
9927 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9928 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9929 rows( dres_ , &indices[index], n ) %= rows( kron( lhs_, rhs_ ), &indices[index], n );
9930 rows( odres_ , &indices[index], n ) %= rows( kron( lhs_, rhs_ ), &indices[index], n );
9931 rows( sres_ , &indices[index], n ) %= rows( kron( lhs_, rhs_ ), &indices[index], n );
9932 rows( osres_ , &indices[index], n ) %= rows( kron( lhs_, rhs_ ), &indices[index], n );
9933 rows( refres_, &indices[index], n ) %= rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9934 }
9935 }
9936 catch( std::exception& ex ) {
9937 convertException<MT1,MT2>( ex );
9938 }
9939
9940 checkResults<MT1,MT2>();
9941
9942 try {
9943 initResults();
9944 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9945 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9946 rows( dres_ , &indices[index], n ) %= rows( kron( lhs_, orhs_ ), &indices[index], n );
9947 rows( odres_ , &indices[index], n ) %= rows( kron( lhs_, orhs_ ), &indices[index], n );
9948 rows( sres_ , &indices[index], n ) %= rows( kron( lhs_, orhs_ ), &indices[index], n );
9949 rows( osres_ , &indices[index], n ) %= rows( kron( lhs_, orhs_ ), &indices[index], n );
9950 rows( refres_, &indices[index], n ) %= rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9951 }
9952 }
9953 catch( std::exception& ex ) {
9954 convertException<MT1,OMT2>( ex );
9955 }
9956
9957 checkResults<MT1,OMT2>();
9958
9959 try {
9960 initResults();
9961 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9962 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9963 rows( dres_ , &indices[index], n ) %= rows( kron( olhs_, rhs_ ), &indices[index], n );
9964 rows( odres_ , &indices[index], n ) %= rows( kron( olhs_, rhs_ ), &indices[index], n );
9965 rows( sres_ , &indices[index], n ) %= rows( kron( olhs_, rhs_ ), &indices[index], n );
9966 rows( osres_ , &indices[index], n ) %= rows( kron( olhs_, rhs_ ), &indices[index], n );
9967 rows( refres_, &indices[index], n ) %= rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9968 }
9969 }
9970 catch( std::exception& ex ) {
9971 convertException<OMT1,MT2>( ex );
9972 }
9973
9974 checkResults<OMT1,MT2>();
9975
9976 try {
9977 initResults();
9978 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
9979 n = blaze::rand<size_t>( 1UL, indices.size() - index );
9980 rows( dres_ , &indices[index], n ) %= rows( kron( olhs_, orhs_ ), &indices[index], n );
9981 rows( odres_ , &indices[index], n ) %= rows( kron( olhs_, orhs_ ), &indices[index], n );
9982 rows( sres_ , &indices[index], n ) %= rows( kron( olhs_, orhs_ ), &indices[index], n );
9983 rows( osres_ , &indices[index], n ) %= rows( kron( olhs_, orhs_ ), &indices[index], n );
9984 rows( refres_, &indices[index], n ) %= rows( kron( reflhs_, refrhs_ ), &indices[index], n );
9985 }
9986 }
9987 catch( std::exception& ex ) {
9988 convertException<OMT1,OMT2>( ex );
9989 }
9990
9991 checkResults<OMT1,OMT2>();
9992 }
9993
9994 // Rows-wise Kronecker product with Schur product assignment with evaluated matrices
9995 {
9996 test_ = "Rows-wise Kronecker product with Schur product assignment with evaluated matrices";
9997 error_ = "Failed Schur product assignment operation";
9998
9999 try {
10000 initResults();
10001 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10002 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10003 rows( dres_ , &indices[index], n ) %= rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
10004 rows( odres_ , &indices[index], n ) %= rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
10005 rows( sres_ , &indices[index], n ) %= rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
10006 rows( osres_ , &indices[index], n ) %= rows( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
10007 rows( refres_, &indices[index], n ) %= rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
10008 }
10009 }
10010 catch( std::exception& ex ) {
10011 convertException<MT1,MT2>( ex );
10012 }
10013
10014 checkResults<MT1,MT2>();
10015
10016 try {
10017 initResults();
10018 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10019 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10020 rows( dres_ , &indices[index], n ) %= rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
10021 rows( odres_ , &indices[index], n ) %= rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
10022 rows( sres_ , &indices[index], n ) %= rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
10023 rows( osres_ , &indices[index], n ) %= rows( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
10024 rows( refres_, &indices[index], n ) %= rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
10025 }
10026 }
10027 catch( std::exception& ex ) {
10028 convertException<MT1,OMT2>( ex );
10029 }
10030
10031 checkResults<MT1,OMT2>();
10032
10033 try {
10034 initResults();
10035 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10036 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10037 rows( dres_ , &indices[index], n ) %= rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
10038 rows( odres_ , &indices[index], n ) %= rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
10039 rows( sres_ , &indices[index], n ) %= rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
10040 rows( osres_ , &indices[index], n ) %= rows( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
10041 rows( refres_, &indices[index], n ) %= rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
10042 }
10043 }
10044 catch( std::exception& ex ) {
10045 convertException<OMT1,MT2>( ex );
10046 }
10047
10048 checkResults<OMT1,MT2>();
10049
10050 try {
10051 initResults();
10052 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
10053 n = blaze::rand<size_t>( 1UL, indices.size() - index );
10054 rows( dres_ , &indices[index], n ) %= rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
10055 rows( odres_ , &indices[index], n ) %= rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
10056 rows( sres_ , &indices[index], n ) %= rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
10057 rows( osres_ , &indices[index], n ) %= rows( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
10058 rows( refres_, &indices[index], n ) %= rows( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
10059 }
10060 }
10061 catch( std::exception& ex ) {
10062 convertException<OMT1,OMT2>( ex );
10063 }
10064
10065 checkResults<OMT1,OMT2>();
10066 }
10067
10068
10069 //=====================================================================================
10070 // Failure cases
10071 //=====================================================================================
10072
10073 // Out-of-bounds access (invalid row index; initializer_list)
10074 {
10075 test_ = "Out-of-bounds row selection construction (invalid row index; initializer_list)";
10076 error_ = "Setup of out-of-bounds row selection succeeded";
10077
10078 try {
10079 auto r = rows( kron( lhs_, rhs_ ), { lhs_.rows()*rhs_.rows() } );
10080
10081 std::ostringstream oss;
10082 oss << " Test: " << test_ << "\n"
10083 << " Error: " << error_ << "\n"
10084 << " Details:\n"
10085 << " Random seed = " << blaze::getSeed() << "\n"
10086 << " Left-hand side sparse matrix type:\n"
10087 << " " << typeid( MT1 ).name() << "\n"
10088 << " Right-hand side dense matrix type:\n"
10089 << " " << typeid( MT2 ).name() << "\n"
10090 << " Result:\n" << r << "\n";
10091 throw std::runtime_error( oss.str() );
10092 }
10093 catch( std::invalid_argument& ex ) {
10094 checkExceptionMessage( ex, "Invalid row access index" );
10095 }
10096
10097 try {
10098 auto r = rows( kron( lhs_, orhs_ ), { lhs_.rows()*orhs_.rows() } );
10099
10100 std::ostringstream oss;
10101 oss << " Test: " << test_ << "\n"
10102 << " Error: " << error_ << "\n"
10103 << " Details:\n"
10104 << " Random seed = " << blaze::getSeed() << "\n"
10105 << " Left-hand side sparse matrix type:\n"
10106 << " " << typeid( MT1 ).name() << "\n"
10107 << " Right-hand side dense matrix type:\n"
10108 << " " << typeid( OMT2 ).name() << "\n"
10109 << " Result:\n" << r << "\n";
10110 throw std::runtime_error( oss.str() );
10111 }
10112 catch( std::invalid_argument& ex ) {
10113 checkExceptionMessage( ex, "Invalid row access index" );
10114 }
10115
10116 try {
10117 auto r = rows( kron( olhs_, rhs_ ), { olhs_.rows()*rhs_.rows() } );
10118
10119 std::ostringstream oss;
10120 oss << " Test: " << test_ << "\n"
10121 << " Error: " << error_ << "\n"
10122 << " Details:\n"
10123 << " Random seed = " << blaze::getSeed() << "\n"
10124 << " Left-hand side sparse matrix type:\n"
10125 << " " << typeid( OMT1 ).name() << "\n"
10126 << " Right-hand side dense matrix type:\n"
10127 << " " << typeid( MT2 ).name() << "\n"
10128 << " Result:\n" << r << "\n";
10129 throw std::runtime_error( oss.str() );
10130 }
10131 catch( std::invalid_argument& ex ) {
10132 checkExceptionMessage( ex, "Invalid row access index" );
10133 }
10134
10135 try {
10136 auto r = rows( kron( olhs_, orhs_ ), { olhs_.rows()*orhs_.rows() } );
10137
10138 std::ostringstream oss;
10139 oss << " Test: " << test_ << "\n"
10140 << " Error: " << error_ << "\n"
10141 << " Details:\n"
10142 << " Random seed = " << blaze::getSeed() << "\n"
10143 << " Left-hand side sparse matrix type:\n"
10144 << " " << typeid( OMT1 ).name() << "\n"
10145 << " Right-hand side dense matrix type:\n"
10146 << " " << typeid( OMT2 ).name() << "\n"
10147 << " Result:\n" << r << "\n";
10148 throw std::runtime_error( oss.str() );
10149 }
10150 catch( std::invalid_argument& ex ) {
10151 checkExceptionMessage( ex, "Invalid row access index" );
10152 }
10153 }
10154
10155 // Out-of-bounds access (invalid row index; lambda)
10156 {
10157 test_ = "Out-of-bounds row selection construction (invalid row index; lambda)";
10158 error_ = "Setup of out-of-bounds row selection succeeded";
10159
10160 try {
10161 auto r = rows( kron( lhs_, rhs_ ), [index=lhs_.rows()*rhs_.rows()]( size_t ){ return index; }, 1UL );
10162
10163 std::ostringstream oss;
10164 oss << " Test: " << test_ << "\n"
10165 << " Error: " << error_ << "\n"
10166 << " Details:\n"
10167 << " Random seed = " << blaze::getSeed() << "\n"
10168 << " Left-hand side sparse matrix type:\n"
10169 << " " << typeid( MT1 ).name() << "\n"
10170 << " Right-hand side dense matrix type:\n"
10171 << " " << typeid( MT2 ).name() << "\n"
10172 << " Result:\n" << r << "\n";
10173 throw std::runtime_error( oss.str() );
10174 }
10175 catch( std::invalid_argument& ex ) {
10176 checkExceptionMessage( ex, "Invalid row access index" );
10177 }
10178
10179 try {
10180 auto r = rows( kron( lhs_, orhs_ ), [index=lhs_.rows()*orhs_.rows()]( size_t ){ return index; }, 1UL );
10181
10182 std::ostringstream oss;
10183 oss << " Test: " << test_ << "\n"
10184 << " Error: " << error_ << "\n"
10185 << " Details:\n"
10186 << " Random seed = " << blaze::getSeed() << "\n"
10187 << " Left-hand side sparse matrix type:\n"
10188 << " " << typeid( MT1 ).name() << "\n"
10189 << " Right-hand side dense matrix type:\n"
10190 << " " << typeid( OMT2 ).name() << "\n"
10191 << " Result:\n" << r << "\n";
10192 throw std::runtime_error( oss.str() );
10193 }
10194 catch( std::invalid_argument& ex ) {
10195 checkExceptionMessage( ex, "Invalid row access index" );
10196 }
10197
10198 try {
10199 auto r = rows( kron( olhs_, rhs_ ), [index=olhs_.rows()*rhs_.rows()]( size_t ){ return index; }, 1UL );
10200
10201 std::ostringstream oss;
10202 oss << " Test: " << test_ << "\n"
10203 << " Error: " << error_ << "\n"
10204 << " Details:\n"
10205 << " Random seed = " << blaze::getSeed() << "\n"
10206 << " Left-hand side sparse matrix type:\n"
10207 << " " << typeid( OMT1 ).name() << "\n"
10208 << " Right-hand side dense matrix type:\n"
10209 << " " << typeid( MT2 ).name() << "\n"
10210 << " Result:\n" << r << "\n";
10211 throw std::runtime_error( oss.str() );
10212 }
10213 catch( std::invalid_argument& ex ) {
10214 checkExceptionMessage( ex, "Invalid row access index" );
10215 }
10216
10217 try {
10218 auto r = rows( kron( olhs_, orhs_ ), [index=olhs_.rows()*orhs_.rows()]( size_t ){ return index; }, 1UL );
10219
10220 std::ostringstream oss;
10221 oss << " Test: " << test_ << "\n"
10222 << " Error: " << error_ << "\n"
10223 << " Details:\n"
10224 << " Random seed = " << blaze::getSeed() << "\n"
10225 << " Left-hand side sparse matrix type:\n"
10226 << " " << typeid( OMT1 ).name() << "\n"
10227 << " Right-hand side dense matrix type:\n"
10228 << " " << typeid( OMT2 ).name() << "\n"
10229 << " Result:\n" << r << "\n";
10230 throw std::runtime_error( oss.str() );
10231 }
10232 catch( std::invalid_argument& ex ) {
10233 checkExceptionMessage( ex, "Invalid row access index" );
10234 }
10235 }
10236 }
10237 #endif
10238 }
10239 //*************************************************************************************************
10240
10241
10242 //*************************************************************************************************
10243 /*!\brief Skipping the rows-wise sparse matrix/dense matrix Kronecker product.
10244 //
10245 // \return void
10246 //
10247 // This function is called in case the rows-wise matrix/matrix Kronecker product operation is not
10248 // available for the given matrix types \a MT1 and \a MT2.
10249 */
10250 template< typename MT1 // Type of the left-hand side sparse matrix
10251 , typename MT2 > // Type of the right-hand side dense matrix
testRowsOperation(blaze::FalseType)10252 void OperationTest<MT1,MT2>::testRowsOperation( blaze::FalseType )
10253 {}
10254 //*************************************************************************************************
10255
10256
10257 //*************************************************************************************************
10258 /*!\brief Testing the column-wise sparse matrix/dense matrix Kronecker product.
10259 //
10260 // \return void
10261 // \exception std::runtime_error Kronecker product error detected.
10262 //
10263 // This function tests the column-wise matrix Kronecker product with plain assignment, addition
10264 // assignment, subtraction assignment, and multiplication assignment. In case any error resulting
10265 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
10266 // exception is thrown.
10267 */
10268 template< typename MT1 // Type of the left-hand side sparse matrix
10269 , typename MT2 > // Type of the right-hand side dense matrix
testColumnOperation(blaze::TrueType)10270 void OperationTest<MT1,MT2>::testColumnOperation( blaze::TrueType )
10271 {
10272 #if BLAZETEST_MATHTEST_TEST_COLUMN_OPERATION
10273 if( BLAZETEST_MATHTEST_TEST_COLUMN_OPERATION > 1 )
10274 {
10275 if( lhs_.columns() * rhs_.columns() == 0UL )
10276 return;
10277
10278
10279 //=====================================================================================
10280 // Column-wise Kronecker product
10281 //=====================================================================================
10282
10283 // Column-wise Kronecker product with the given matrices
10284 {
10285 test_ = "Column-wise Kronecker product with the given matrices";
10286 error_ = "Failed Kronecker product operation";
10287
10288 try {
10289 initResults();
10290 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10291 column( dres_ , j ) = column( kron( lhs_, rhs_ ), j );
10292 column( odres_ , j ) = column( kron( lhs_, rhs_ ), j );
10293 column( sres_ , j ) = column( kron( lhs_, rhs_ ), j );
10294 column( osres_ , j ) = column( kron( lhs_, rhs_ ), j );
10295 column( refres_, j ) = column( kron( reflhs_, refrhs_ ), j );
10296 }
10297 }
10298 catch( std::exception& ex ) {
10299 convertException<MT1,MT2>( ex );
10300 }
10301
10302 checkResults<MT1,MT2>();
10303
10304 try {
10305 initResults();
10306 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10307 column( dres_ , j ) = column( kron( lhs_, orhs_ ), j );
10308 column( odres_ , j ) = column( kron( lhs_, orhs_ ), j );
10309 column( sres_ , j ) = column( kron( lhs_, orhs_ ), j );
10310 column( osres_ , j ) = column( kron( lhs_, orhs_ ), j );
10311 column( refres_, j ) = column( kron( reflhs_, refrhs_ ), j );
10312 }
10313 }
10314 catch( std::exception& ex ) {
10315 convertException<MT1,OMT2>( ex );
10316 }
10317
10318 checkResults<MT1,OMT2>();
10319
10320 try {
10321 initResults();
10322 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10323 column( dres_ , j ) = column( kron( olhs_, rhs_ ), j );
10324 column( odres_ , j ) = column( kron( olhs_, rhs_ ), j );
10325 column( sres_ , j ) = column( kron( olhs_, rhs_ ), j );
10326 column( osres_ , j ) = column( kron( olhs_, rhs_ ), j );
10327 column( refres_, j ) = column( kron( reflhs_, refrhs_ ), j );
10328 }
10329 }
10330 catch( std::exception& ex ) {
10331 convertException<OMT1,MT2>( ex );
10332 }
10333
10334 checkResults<OMT1,MT2>();
10335
10336 try {
10337 initResults();
10338 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10339 column( dres_ , j ) = column( kron( olhs_, orhs_ ), j );
10340 column( odres_ , j ) = column( kron( olhs_, orhs_ ), j );
10341 column( sres_ , j ) = column( kron( olhs_, orhs_ ), j );
10342 column( osres_ , j ) = column( kron( olhs_, orhs_ ), j );
10343 column( refres_, j ) = column( kron( reflhs_, refrhs_ ), j );
10344 }
10345 }
10346 catch( std::exception& ex ) {
10347 convertException<OMT1,OMT2>( ex );
10348 }
10349
10350 checkResults<OMT1,OMT2>();
10351 }
10352
10353 // Column-wise Kronecker product with evaluated matrices
10354 {
10355 test_ = "Column-wise Kronecker product with evaluated matrices";
10356 error_ = "Failed Kronecker product operation";
10357
10358 try {
10359 initResults();
10360 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10361 column( dres_ , j ) = column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10362 column( odres_ , j ) = column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10363 column( sres_ , j ) = column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10364 column( osres_ , j ) = column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10365 column( refres_, j ) = column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10366 }
10367 }
10368 catch( std::exception& ex ) {
10369 convertException<MT1,MT2>( ex );
10370 }
10371
10372 checkResults<MT1,MT2>();
10373
10374 try {
10375 initResults();
10376 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10377 column( dres_ , j ) = column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10378 column( odres_ , j ) = column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10379 column( sres_ , j ) = column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10380 column( osres_ , j ) = column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10381 column( refres_, j ) = column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10382 }
10383 }
10384 catch( std::exception& ex ) {
10385 convertException<MT1,OMT2>( ex );
10386 }
10387
10388 checkResults<MT1,OMT2>();
10389
10390 try {
10391 initResults();
10392 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10393 column( dres_ , j ) = column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10394 column( odres_ , j ) = column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10395 column( sres_ , j ) = column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10396 column( osres_ , j ) = column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10397 column( refres_, j ) = column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10398 }
10399 }
10400 catch( std::exception& ex ) {
10401 convertException<OMT1,MT2>( ex );
10402 }
10403
10404 checkResults<OMT1,MT2>();
10405
10406 try {
10407 initResults();
10408 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10409 column( dres_ , j ) = column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10410 column( odres_ , j ) = column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10411 column( sres_ , j ) = column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10412 column( osres_ , j ) = column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10413 column( refres_, j ) = column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10414 }
10415 }
10416 catch( std::exception& ex ) {
10417 convertException<OMT1,OMT2>( ex );
10418 }
10419
10420 checkResults<OMT1,OMT2>();
10421 }
10422
10423
10424 //=====================================================================================
10425 // Column-wise Kronecker product with addition assignment
10426 //=====================================================================================
10427
10428 // Column-wise Kronecker product with addition assignment with the given matrices
10429 {
10430 test_ = "Column-wise Kronecker product with addition assignment with the given matrices";
10431 error_ = "Failed addition assignment operation";
10432
10433 try {
10434 initResults();
10435 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10436 column( dres_ , j ) += column( kron( lhs_, rhs_ ), j );
10437 column( odres_ , j ) += column( kron( lhs_, rhs_ ), j );
10438 column( sres_ , j ) += column( kron( lhs_, rhs_ ), j );
10439 column( osres_ , j ) += column( kron( lhs_, rhs_ ), j );
10440 column( refres_, j ) += column( kron( reflhs_, refrhs_ ), j );
10441 }
10442 }
10443 catch( std::exception& ex ) {
10444 convertException<MT1,MT2>( ex );
10445 }
10446
10447 checkResults<MT1,MT2>();
10448
10449 try {
10450 initResults();
10451 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10452 column( dres_ , j ) += column( kron( lhs_, orhs_ ), j );
10453 column( odres_ , j ) += column( kron( lhs_, orhs_ ), j );
10454 column( sres_ , j ) += column( kron( lhs_, orhs_ ), j );
10455 column( osres_ , j ) += column( kron( lhs_, orhs_ ), j );
10456 column( refres_, j ) += column( kron( reflhs_, refrhs_ ), j );
10457 }
10458 }
10459 catch( std::exception& ex ) {
10460 convertException<MT1,OMT2>( ex );
10461 }
10462
10463 checkResults<MT1,OMT2>();
10464
10465 try {
10466 initResults();
10467 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10468 column( dres_ , j ) += column( kron( olhs_, rhs_ ), j );
10469 column( odres_ , j ) += column( kron( olhs_, rhs_ ), j );
10470 column( sres_ , j ) += column( kron( olhs_, rhs_ ), j );
10471 column( osres_ , j ) += column( kron( olhs_, rhs_ ), j );
10472 column( refres_, j ) += column( kron( reflhs_, refrhs_ ), j );
10473 }
10474 }
10475 catch( std::exception& ex ) {
10476 convertException<OMT1,MT2>( ex );
10477 }
10478
10479 checkResults<OMT1,MT2>();
10480
10481 try {
10482 initResults();
10483 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10484 column( dres_ , j ) += column( kron( olhs_, orhs_ ), j );
10485 column( odres_ , j ) += column( kron( olhs_, orhs_ ), j );
10486 column( sres_ , j ) += column( kron( olhs_, orhs_ ), j );
10487 column( osres_ , j ) += column( kron( olhs_, orhs_ ), j );
10488 column( refres_, j ) += column( kron( reflhs_, refrhs_ ), j );
10489 }
10490 }
10491 catch( std::exception& ex ) {
10492 convertException<OMT1,OMT2>( ex );
10493 }
10494
10495 checkResults<OMT1,OMT2>();
10496 }
10497
10498 // Column-wise Kronecker product with addition assignment with evaluated matrices
10499 {
10500 test_ = "Column-wise Kronecker product with addition assignment with evaluated matrices";
10501 error_ = "Failed addition assignment operation";
10502
10503 try {
10504 initResults();
10505 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10506 column( dres_ , j ) += column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10507 column( odres_ , j ) += column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10508 column( sres_ , j ) += column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10509 column( osres_ , j ) += column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10510 column( refres_, j ) += column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10511 }
10512 }
10513 catch( std::exception& ex ) {
10514 convertException<MT1,MT2>( ex );
10515 }
10516
10517 checkResults<MT1,MT2>();
10518
10519 try {
10520 initResults();
10521 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10522 column( dres_ , j ) += column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10523 column( odres_ , j ) += column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10524 column( sres_ , j ) += column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10525 column( osres_ , j ) += column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10526 column( refres_, j ) += column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10527 }
10528 }
10529 catch( std::exception& ex ) {
10530 convertException<MT1,OMT2>( ex );
10531 }
10532
10533 checkResults<MT1,OMT2>();
10534
10535 try {
10536 initResults();
10537 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10538 column( dres_ , j ) += column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10539 column( odres_ , j ) += column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10540 column( sres_ , j ) += column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10541 column( osres_ , j ) += column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10542 column( refres_, j ) += column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10543 }
10544 }
10545 catch( std::exception& ex ) {
10546 convertException<OMT1,MT2>( ex );
10547 }
10548
10549 checkResults<OMT1,MT2>();
10550
10551 try {
10552 initResults();
10553 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10554 column( dres_ , j ) += column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10555 column( odres_ , j ) += column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10556 column( sres_ , j ) += column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10557 column( osres_ , j ) += column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10558 column( refres_, j ) += column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10559 }
10560 }
10561 catch( std::exception& ex ) {
10562 convertException<OMT1,OMT2>( ex );
10563 }
10564
10565 checkResults<OMT1,OMT2>();
10566 }
10567
10568
10569 //=====================================================================================
10570 // Column-wise Kronecker product with subtraction assignment
10571 //=====================================================================================
10572
10573 // Column-wise Kronecker product with subtraction assignment with the given matrices
10574 {
10575 test_ = "Column-wise Kronecker product with subtraction assignment with the given matrices";
10576 error_ = "Failed subtraction assignment operation";
10577
10578 try {
10579 initResults();
10580 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10581 column( dres_ , j ) -= column( kron( lhs_, rhs_ ), j );
10582 column( odres_ , j ) -= column( kron( lhs_, rhs_ ), j );
10583 column( sres_ , j ) -= column( kron( lhs_, rhs_ ), j );
10584 column( osres_ , j ) -= column( kron( lhs_, rhs_ ), j );
10585 column( refres_, j ) -= column( kron( reflhs_, refrhs_ ), j );
10586 }
10587 }
10588 catch( std::exception& ex ) {
10589 convertException<MT1,MT2>( ex );
10590 }
10591
10592 checkResults<MT1,MT2>();
10593
10594 try {
10595 initResults();
10596 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10597 column( dres_ , j ) -= column( kron( lhs_, orhs_ ), j );
10598 column( odres_ , j ) -= column( kron( lhs_, orhs_ ), j );
10599 column( sres_ , j ) -= column( kron( lhs_, orhs_ ), j );
10600 column( osres_ , j ) -= column( kron( lhs_, orhs_ ), j );
10601 column( refres_, j ) -= column( kron( reflhs_, refrhs_ ), j );
10602 }
10603 }
10604 catch( std::exception& ex ) {
10605 convertException<MT1,OMT2>( ex );
10606 }
10607
10608 checkResults<MT1,OMT2>();
10609
10610 try {
10611 initResults();
10612 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10613 column( dres_ , j ) -= column( kron( olhs_, rhs_ ), j );
10614 column( odres_ , j ) -= column( kron( olhs_, rhs_ ), j );
10615 column( sres_ , j ) -= column( kron( olhs_, rhs_ ), j );
10616 column( osres_ , j ) -= column( kron( olhs_, rhs_ ), j );
10617 column( refres_, j ) -= column( kron( reflhs_, refrhs_ ), j );
10618 }
10619 }
10620 catch( std::exception& ex ) {
10621 convertException<OMT1,MT2>( ex );
10622 }
10623
10624 checkResults<OMT1,MT2>();
10625
10626 try {
10627 initResults();
10628 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10629 column( dres_ , j ) -= column( kron( olhs_, orhs_ ), j );
10630 column( odres_ , j ) -= column( kron( olhs_, orhs_ ), j );
10631 column( sres_ , j ) -= column( kron( olhs_, orhs_ ), j );
10632 column( osres_ , j ) -= column( kron( olhs_, orhs_ ), j );
10633 column( refres_, j ) -= column( kron( reflhs_, refrhs_ ), j );
10634 }
10635 }
10636 catch( std::exception& ex ) {
10637 convertException<OMT1,OMT2>( ex );
10638 }
10639
10640 checkResults<OMT1,OMT2>();
10641 }
10642
10643 // Column-wise Kronecker product with subtraction assignment with evaluated matrices
10644 {
10645 test_ = "Column-wise Kronecker product with subtraction assignment with evaluated matrices";
10646 error_ = "Failed subtraction assignment operation";
10647
10648 try {
10649 initResults();
10650 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10651 column( dres_ , j ) -= column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10652 column( odres_ , j ) -= column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10653 column( sres_ , j ) -= column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10654 column( osres_ , j ) -= column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10655 column( refres_, j ) -= column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10656 }
10657 }
10658 catch( std::exception& ex ) {
10659 convertException<MT1,MT2>( ex );
10660 }
10661
10662 checkResults<MT1,MT2>();
10663
10664 try {
10665 initResults();
10666 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10667 column( dres_ , j ) -= column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10668 column( odres_ , j ) -= column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10669 column( sres_ , j ) -= column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10670 column( osres_ , j ) -= column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10671 column( refres_, j ) -= column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10672 }
10673 }
10674 catch( std::exception& ex ) {
10675 convertException<MT1,OMT2>( ex );
10676 }
10677
10678 checkResults<MT1,OMT2>();
10679
10680 try {
10681 initResults();
10682 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10683 column( dres_ , j ) -= column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10684 column( odres_ , j ) -= column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10685 column( sres_ , j ) -= column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10686 column( osres_ , j ) -= column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10687 column( refres_, j ) -= column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10688 }
10689 }
10690 catch( std::exception& ex ) {
10691 convertException<OMT1,MT2>( ex );
10692 }
10693
10694 checkResults<OMT1,MT2>();
10695
10696 try {
10697 initResults();
10698 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10699 column( dres_ , j ) -= column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10700 column( odres_ , j ) -= column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10701 column( sres_ , j ) -= column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10702 column( osres_ , j ) -= column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10703 column( refres_, j ) -= column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10704 }
10705 }
10706 catch( std::exception& ex ) {
10707 convertException<OMT1,OMT2>( ex );
10708 }
10709
10710 checkResults<OMT1,OMT2>();
10711 }
10712
10713
10714 //=====================================================================================
10715 // Column-wise Kronecker product with multiplication assignment
10716 //=====================================================================================
10717
10718 // Column-wise Kronecker product with multiplication assignment with the given matrices
10719 {
10720 test_ = "Column-wise Kronecker product with multiplication assignment with the given matrices";
10721 error_ = "Failed multiplication assignment operation";
10722
10723 try {
10724 initResults();
10725 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10726 column( dres_ , j ) *= column( kron( lhs_, rhs_ ), j );
10727 column( odres_ , j ) *= column( kron( lhs_, rhs_ ), j );
10728 column( sres_ , j ) *= column( kron( lhs_, rhs_ ), j );
10729 column( osres_ , j ) *= column( kron( lhs_, rhs_ ), j );
10730 column( refres_, j ) *= column( kron( reflhs_, refrhs_ ), j );
10731 }
10732 }
10733 catch( std::exception& ex ) {
10734 convertException<MT1,MT2>( ex );
10735 }
10736
10737 checkResults<MT1,MT2>();
10738
10739 try {
10740 initResults();
10741 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10742 column( dres_ , j ) *= column( kron( lhs_, orhs_ ), j );
10743 column( odres_ , j ) *= column( kron( lhs_, orhs_ ), j );
10744 column( sres_ , j ) *= column( kron( lhs_, orhs_ ), j );
10745 column( osres_ , j ) *= column( kron( lhs_, orhs_ ), j );
10746 column( refres_, j ) *= column( kron( reflhs_, refrhs_ ), j );
10747 }
10748 }
10749 catch( std::exception& ex ) {
10750 convertException<MT1,OMT2>( ex );
10751 }
10752
10753 checkResults<MT1,OMT2>();
10754
10755 try {
10756 initResults();
10757 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10758 column( dres_ , j ) *= column( kron( olhs_, rhs_ ), j );
10759 column( odres_ , j ) *= column( kron( olhs_, rhs_ ), j );
10760 column( sres_ , j ) *= column( kron( olhs_, rhs_ ), j );
10761 column( osres_ , j ) *= column( kron( olhs_, rhs_ ), j );
10762 column( refres_, j ) *= column( kron( reflhs_, refrhs_ ), j );
10763 }
10764 }
10765 catch( std::exception& ex ) {
10766 convertException<OMT1,MT2>( ex );
10767 }
10768
10769 checkResults<OMT1,MT2>();
10770
10771 try {
10772 initResults();
10773 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10774 column( dres_ , j ) *= column( kron( olhs_, orhs_ ), j );
10775 column( odres_ , j ) *= column( kron( olhs_, orhs_ ), j );
10776 column( sres_ , j ) *= column( kron( olhs_, orhs_ ), j );
10777 column( osres_ , j ) *= column( kron( olhs_, orhs_ ), j );
10778 column( refres_, j ) *= column( kron( reflhs_, refrhs_ ), j );
10779 }
10780 }
10781 catch( std::exception& ex ) {
10782 convertException<OMT1,OMT2>( ex );
10783 }
10784
10785 checkResults<OMT1,OMT2>();
10786 }
10787
10788 // Column-wise Kronecker product with multiplication assignment with evaluated matrices
10789 {
10790 test_ = "Column-wise Kronecker product with multiplication assignment with evaluated matrices";
10791 error_ = "Failed multiplication assignment operation";
10792
10793 try {
10794 initResults();
10795 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10796 column( dres_ , j ) *= column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10797 column( odres_ , j ) *= column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10798 column( sres_ , j ) *= column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10799 column( osres_ , j ) *= column( kron( eval( lhs_ ), eval( rhs_ ) ), j );
10800 column( refres_, j ) *= column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10801 }
10802 }
10803 catch( std::exception& ex ) {
10804 convertException<MT1,MT2>( ex );
10805 }
10806
10807 checkResults<MT1,MT2>();
10808
10809 try {
10810 initResults();
10811 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10812 column( dres_ , j ) *= column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10813 column( odres_ , j ) *= column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10814 column( sres_ , j ) *= column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10815 column( osres_ , j ) *= column( kron( eval( lhs_ ), eval( orhs_ ) ), j );
10816 column( refres_, j ) *= column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10817 }
10818 }
10819 catch( std::exception& ex ) {
10820 convertException<MT1,OMT2>( ex );
10821 }
10822
10823 checkResults<MT1,OMT2>();
10824
10825 try {
10826 initResults();
10827 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10828 column( dres_ , j ) *= column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10829 column( odres_ , j ) *= column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10830 column( sres_ , j ) *= column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10831 column( osres_ , j ) *= column( kron( eval( olhs_ ), eval( rhs_ ) ), j );
10832 column( refres_, j ) *= column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10833 }
10834 }
10835 catch( std::exception& ex ) {
10836 convertException<OMT1,MT2>( ex );
10837 }
10838
10839 checkResults<OMT1,MT2>();
10840
10841 try {
10842 initResults();
10843 for( size_t j=0UL; j<lhs_.columns()*rhs_.columns(); ++j ) {
10844 column( dres_ , j ) *= column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10845 column( odres_ , j ) *= column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10846 column( sres_ , j ) *= column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10847 column( osres_ , j ) *= column( kron( eval( olhs_ ), eval( orhs_ ) ), j );
10848 column( refres_, j ) *= column( kron( eval( reflhs_ ), eval( refrhs_ ) ), j );
10849 }
10850 }
10851 catch( std::exception& ex ) {
10852 convertException<OMT1,OMT2>( ex );
10853 }
10854
10855 checkResults<OMT1,OMT2>();
10856 }
10857
10858
10859 //=====================================================================================
10860 // Failure cases
10861 //=====================================================================================
10862
10863 // Out-of-bounds access (invalid column index)
10864 {
10865 test_ = "Out-of-bounds column construction (invalid column index)";
10866 error_ = "Setup of out-of-bounds column succeeded";
10867
10868 try {
10869 auto c = column( kron( lhs_, rhs_ ), lhs_.columns()*rhs_.columns() );
10870
10871 std::ostringstream oss;
10872 oss << " Test: " << test_ << "\n"
10873 << " Error: " << error_ << "\n"
10874 << " Details:\n"
10875 << " Random seed = " << blaze::getSeed() << "\n"
10876 << " Left-hand side sparse matrix type:\n"
10877 << " " << typeid( MT1 ).name() << "\n"
10878 << " Right-hand side dense matrix type:\n"
10879 << " " << typeid( MT2 ).name() << "\n"
10880 << " Result:\n" << c << "\n";
10881 throw std::runtime_error( oss.str() );
10882 }
10883 catch( std::invalid_argument& ex ) {
10884 checkExceptionMessage( ex, "Invalid column access index" );
10885 }
10886
10887 try {
10888 auto c = column( kron( lhs_, orhs_ ), lhs_.columns()*orhs_.columns() );
10889
10890 std::ostringstream oss;
10891 oss << " Test: " << test_ << "\n"
10892 << " Error: " << error_ << "\n"
10893 << " Details:\n"
10894 << " Random seed = " << blaze::getSeed() << "\n"
10895 << " Left-hand side sparse matrix type:\n"
10896 << " " << typeid( MT1 ).name() << "\n"
10897 << " Right-hand side dense matrix type:\n"
10898 << " " << typeid( OMT2 ).name() << "\n"
10899 << " Result:\n" << c << "\n";
10900 throw std::runtime_error( oss.str() );
10901 }
10902 catch( std::invalid_argument& ex ) {
10903 checkExceptionMessage( ex, "Invalid column access index" );
10904 }
10905
10906 try {
10907 auto c = column( kron( olhs_, rhs_ ), olhs_.columns()*rhs_.columns() );
10908
10909 std::ostringstream oss;
10910 oss << " Test: " << test_ << "\n"
10911 << " Error: " << error_ << "\n"
10912 << " Details:\n"
10913 << " Random seed = " << blaze::getSeed() << "\n"
10914 << " Left-hand side sparse matrix type:\n"
10915 << " " << typeid( OMT1 ).name() << "\n"
10916 << " Right-hand side dense matrix type:\n"
10917 << " " << typeid( MT2 ).name() << "\n"
10918 << " Result:\n" << c << "\n";
10919 throw std::runtime_error( oss.str() );
10920 }
10921 catch( std::invalid_argument& ex ) {
10922 checkExceptionMessage( ex, "Invalid column access index" );
10923 }
10924
10925 try {
10926 auto c = column( kron( olhs_, orhs_ ), olhs_.columns()*orhs_.columns() );
10927
10928 std::ostringstream oss;
10929 oss << " Test: " << test_ << "\n"
10930 << " Error: " << error_ << "\n"
10931 << " Details:\n"
10932 << " Random seed = " << blaze::getSeed() << "\n"
10933 << " Left-hand side sparse matrix type:\n"
10934 << " " << typeid( OMT1 ).name() << "\n"
10935 << " Right-hand side dense matrix type:\n"
10936 << " " << typeid( OMT2 ).name() << "\n"
10937 << " Result:\n" << c << "\n";
10938 throw std::runtime_error( oss.str() );
10939 }
10940 catch( std::invalid_argument& ex ) {
10941 checkExceptionMessage( ex, "Invalid column access index" );
10942 }
10943 }
10944 }
10945 #endif
10946 }
10947 //*************************************************************************************************
10948
10949
10950 //*************************************************************************************************
10951 /*!\brief Skipping the column-wise sparse matrix/dense matrix Kronecker product.
10952 //
10953 // \return void
10954 //
10955 // This function is called in case the column-wise matrix/matrix Kronecker product operation is
10956 // not available for the given matrix types \a MT1 and \a MT2.
10957 */
10958 template< typename MT1 // Type of the left-hand side sparse matrix
10959 , typename MT2 > // Type of the right-hand side dense matrix
testColumnOperation(blaze::FalseType)10960 void OperationTest<MT1,MT2>::testColumnOperation( blaze::FalseType )
10961 {}
10962 //*************************************************************************************************
10963
10964
10965 //*************************************************************************************************
10966 /*!\brief Testing the columns-wise sparse matrix/dense matrix Kronecker product.
10967 //
10968 // \return void
10969 // \exception std::runtime_error Kronecker product error detected.
10970 //
10971 // This function tests the columns-wise matrix Kronecker product with plain assignment, addition
10972 // assignment, subtraction assignment, and Schur product assignment. In case any error resulting
10973 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
10974 // exception is thrown.
10975 */
10976 template< typename MT1 // Type of the left-hand side sparse matrix
10977 , typename MT2 > // Type of the right-hand side dense matrix
testColumnsOperation(blaze::TrueType)10978 void OperationTest<MT1,MT2>::testColumnsOperation( blaze::TrueType )
10979 {
10980 #if BLAZETEST_MATHTEST_TEST_COLUMNS_OPERATION
10981 if( BLAZETEST_MATHTEST_TEST_COLUMNS_OPERATION > 1 )
10982 {
10983 if( lhs_.columns() * rhs_.columns() == 0UL )
10984 return;
10985
10986
10987 std::vector<size_t> indices( lhs_.columns() * rhs_.columns() );
10988 std::iota( indices.begin(), indices.end(), 0UL );
10989 std::random_shuffle( indices.begin(), indices.end() );
10990
10991
10992 //=====================================================================================
10993 // Columns-wise Kronecker product
10994 //=====================================================================================
10995
10996 // Columns-wise Kronecker product with the given matrices
10997 {
10998 test_ = "Columns-wise Kronecker product with the given matrices";
10999 error_ = "Failed Kronecker product operation";
11000
11001 try {
11002 initResults();
11003 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11004 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11005 columns( dres_ , &indices[index], n ) = columns( kron( lhs_, rhs_ ), &indices[index], n );
11006 columns( odres_ , &indices[index], n ) = columns( kron( lhs_, rhs_ ), &indices[index], n );
11007 columns( sres_ , &indices[index], n ) = columns( kron( lhs_, rhs_ ), &indices[index], n );
11008 columns( osres_ , &indices[index], n ) = columns( kron( lhs_, rhs_ ), &indices[index], n );
11009 columns( refres_, &indices[index], n ) = columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11010 }
11011 }
11012 catch( std::exception& ex ) {
11013 convertException<MT1,MT2>( ex );
11014 }
11015
11016 checkResults<MT1,MT2>();
11017
11018 try {
11019 initResults();
11020 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11021 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11022 columns( dres_ , &indices[index], n ) = columns( kron( lhs_, orhs_ ), &indices[index], n );
11023 columns( odres_ , &indices[index], n ) = columns( kron( lhs_, orhs_ ), &indices[index], n );
11024 columns( sres_ , &indices[index], n ) = columns( kron( lhs_, orhs_ ), &indices[index], n );
11025 columns( osres_ , &indices[index], n ) = columns( kron( lhs_, orhs_ ), &indices[index], n );
11026 columns( refres_, &indices[index], n ) = columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11027 }
11028 }
11029 catch( std::exception& ex ) {
11030 convertException<MT1,OMT2>( ex );
11031 }
11032
11033 checkResults<MT1,OMT2>();
11034
11035 try {
11036 initResults();
11037 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11038 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11039 columns( dres_ , &indices[index], n ) = columns( kron( olhs_, rhs_ ), &indices[index], n );
11040 columns( odres_ , &indices[index], n ) = columns( kron( olhs_, rhs_ ), &indices[index], n );
11041 columns( sres_ , &indices[index], n ) = columns( kron( olhs_, rhs_ ), &indices[index], n );
11042 columns( osres_ , &indices[index], n ) = columns( kron( olhs_, rhs_ ), &indices[index], n );
11043 columns( refres_, &indices[index], n ) = columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11044 }
11045 }
11046 catch( std::exception& ex ) {
11047 convertException<OMT1,MT2>( ex );
11048 }
11049
11050 checkResults<OMT1,MT2>();
11051
11052 try {
11053 initResults();
11054 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11055 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11056 columns( dres_ , &indices[index], n ) = columns( kron( olhs_, orhs_ ), &indices[index], n );
11057 columns( odres_ , &indices[index], n ) = columns( kron( olhs_, orhs_ ), &indices[index], n );
11058 columns( sres_ , &indices[index], n ) = columns( kron( olhs_, orhs_ ), &indices[index], n );
11059 columns( osres_ , &indices[index], n ) = columns( kron( olhs_, orhs_ ), &indices[index], n );
11060 columns( refres_, &indices[index], n ) = columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11061 }
11062 }
11063 catch( std::exception& ex ) {
11064 convertException<OMT1,OMT2>( ex );
11065 }
11066
11067 checkResults<OMT1,OMT2>();
11068 }
11069
11070 // Columns-wise Kronecker product with evaluated matrices
11071 {
11072 test_ = "Columns-wise Kronecker product with evaluated matrices";
11073 error_ = "Failed Kronecker product operation";
11074
11075 try {
11076 initResults();
11077 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11078 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11079 columns( dres_ , &indices[index], n ) = columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11080 columns( odres_ , &indices[index], n ) = columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11081 columns( sres_ , &indices[index], n ) = columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11082 columns( osres_ , &indices[index], n ) = columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11083 columns( refres_, &indices[index], n ) = columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11084 }
11085 }
11086 catch( std::exception& ex ) {
11087 convertException<MT1,MT2>( ex );
11088 }
11089
11090 checkResults<MT1,MT2>();
11091
11092 try {
11093 initResults();
11094 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11095 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11096 columns( dres_ , &indices[index], n ) = columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11097 columns( odres_ , &indices[index], n ) = columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11098 columns( sres_ , &indices[index], n ) = columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11099 columns( osres_ , &indices[index], n ) = columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11100 columns( refres_, &indices[index], n ) = columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11101 }
11102 }
11103 catch( std::exception& ex ) {
11104 convertException<MT1,OMT2>( ex );
11105 }
11106
11107 checkResults<MT1,OMT2>();
11108
11109 try {
11110 initResults();
11111 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11112 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11113 columns( dres_ , &indices[index], n ) = columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11114 columns( odres_ , &indices[index], n ) = columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11115 columns( sres_ , &indices[index], n ) = columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11116 columns( osres_ , &indices[index], n ) = columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11117 columns( refres_, &indices[index], n ) = columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11118 }
11119 }
11120 catch( std::exception& ex ) {
11121 convertException<OMT1,MT2>( ex );
11122 }
11123
11124 checkResults<OMT1,MT2>();
11125
11126 try {
11127 initResults();
11128 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11129 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11130 columns( dres_ , &indices[index], n ) = columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11131 columns( odres_ , &indices[index], n ) = columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11132 columns( sres_ , &indices[index], n ) = columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11133 columns( osres_ , &indices[index], n ) = columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11134 columns( refres_, &indices[index], n ) = columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11135 }
11136 }
11137 catch( std::exception& ex ) {
11138 convertException<OMT1,OMT2>( ex );
11139 }
11140
11141 checkResults<OMT1,OMT2>();
11142 }
11143
11144
11145 //=====================================================================================
11146 // Columns-wise Kronecker product with addition assignment
11147 //=====================================================================================
11148
11149 // Columns-wise Kronecker product with addition assignment with the given matrices
11150 {
11151 test_ = "Columns-wise Kronecker product with addition assignment with the given matrices";
11152 error_ = "Failed addition assignment operation";
11153
11154 try {
11155 initResults();
11156 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11157 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11158 columns( dres_ , &indices[index], n ) += columns( kron( lhs_, rhs_ ), &indices[index], n );
11159 columns( odres_ , &indices[index], n ) += columns( kron( lhs_, rhs_ ), &indices[index], n );
11160 columns( sres_ , &indices[index], n ) += columns( kron( lhs_, rhs_ ), &indices[index], n );
11161 columns( osres_ , &indices[index], n ) += columns( kron( lhs_, rhs_ ), &indices[index], n );
11162 columns( refres_, &indices[index], n ) += columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11163 }
11164 }
11165 catch( std::exception& ex ) {
11166 convertException<MT1,MT2>( ex );
11167 }
11168
11169 checkResults<MT1,MT2>();
11170
11171 try {
11172 initResults();
11173 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11174 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11175 columns( dres_ , &indices[index], n ) += columns( kron( lhs_, orhs_ ), &indices[index], n );
11176 columns( odres_ , &indices[index], n ) += columns( kron( lhs_, orhs_ ), &indices[index], n );
11177 columns( sres_ , &indices[index], n ) += columns( kron( lhs_, orhs_ ), &indices[index], n );
11178 columns( osres_ , &indices[index], n ) += columns( kron( lhs_, orhs_ ), &indices[index], n );
11179 columns( refres_, &indices[index], n ) += columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11180 }
11181 }
11182 catch( std::exception& ex ) {
11183 convertException<MT1,OMT2>( ex );
11184 }
11185
11186 checkResults<MT1,OMT2>();
11187
11188 try {
11189 initResults();
11190 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11191 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11192 columns( dres_ , &indices[index], n ) += columns( kron( olhs_, rhs_ ), &indices[index], n );
11193 columns( odres_ , &indices[index], n ) += columns( kron( olhs_, rhs_ ), &indices[index], n );
11194 columns( sres_ , &indices[index], n ) += columns( kron( olhs_, rhs_ ), &indices[index], n );
11195 columns( osres_ , &indices[index], n ) += columns( kron( olhs_, rhs_ ), &indices[index], n );
11196 columns( refres_, &indices[index], n ) += columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11197 }
11198 }
11199 catch( std::exception& ex ) {
11200 convertException<OMT1,MT2>( ex );
11201 }
11202
11203 checkResults<OMT1,MT2>();
11204
11205 try {
11206 initResults();
11207 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11208 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11209 columns( dres_ , &indices[index], n ) += columns( kron( olhs_, orhs_ ), &indices[index], n );
11210 columns( odres_ , &indices[index], n ) += columns( kron( olhs_, orhs_ ), &indices[index], n );
11211 columns( sres_ , &indices[index], n ) += columns( kron( olhs_, orhs_ ), &indices[index], n );
11212 columns( osres_ , &indices[index], n ) += columns( kron( olhs_, orhs_ ), &indices[index], n );
11213 columns( refres_, &indices[index], n ) += columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11214 }
11215 }
11216 catch( std::exception& ex ) {
11217 convertException<OMT1,OMT2>( ex );
11218 }
11219
11220 checkResults<OMT1,OMT2>();
11221 }
11222
11223 // Columns-wise Kronecker product with addition assignment with evaluated matrices
11224 {
11225 test_ = "Columns-wise Kronecker product with addition assignment with evaluated matrices";
11226 error_ = "Failed addition assignment operation";
11227
11228 try {
11229 initResults();
11230 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11231 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11232 columns( dres_ , &indices[index], n ) += columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11233 columns( odres_ , &indices[index], n ) += columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11234 columns( sres_ , &indices[index], n ) += columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11235 columns( osres_ , &indices[index], n ) += columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11236 columns( refres_, &indices[index], n ) += columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11237 }
11238 }
11239 catch( std::exception& ex ) {
11240 convertException<MT1,MT2>( ex );
11241 }
11242
11243 checkResults<MT1,MT2>();
11244
11245 try {
11246 initResults();
11247 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11248 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11249 columns( dres_ , &indices[index], n ) += columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11250 columns( odres_ , &indices[index], n ) += columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11251 columns( sres_ , &indices[index], n ) += columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11252 columns( osres_ , &indices[index], n ) += columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11253 columns( refres_, &indices[index], n ) += columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11254 }
11255 }
11256 catch( std::exception& ex ) {
11257 convertException<MT1,OMT2>( ex );
11258 }
11259
11260 checkResults<MT1,OMT2>();
11261
11262 try {
11263 initResults();
11264 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11265 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11266 columns( dres_ , &indices[index], n ) += columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11267 columns( odres_ , &indices[index], n ) += columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11268 columns( sres_ , &indices[index], n ) += columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11269 columns( osres_ , &indices[index], n ) += columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11270 columns( refres_, &indices[index], n ) += columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11271 }
11272 }
11273 catch( std::exception& ex ) {
11274 convertException<OMT1,MT2>( ex );
11275 }
11276
11277 checkResults<OMT1,MT2>();
11278
11279 try {
11280 initResults();
11281 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11282 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11283 columns( dres_ , &indices[index], n ) += columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11284 columns( odres_ , &indices[index], n ) += columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11285 columns( sres_ , &indices[index], n ) += columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11286 columns( osres_ , &indices[index], n ) += columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11287 columns( refres_, &indices[index], n ) += columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11288 }
11289 }
11290 catch( std::exception& ex ) {
11291 convertException<OMT1,OMT2>( ex );
11292 }
11293
11294 checkResults<OMT1,OMT2>();
11295 }
11296
11297
11298 //=====================================================================================
11299 // Columns-wise Kronecker product with subtraction assignment
11300 //=====================================================================================
11301
11302 // Columns-wise Kronecker product with subtraction assignment with the given matrices
11303 {
11304 test_ = "Columns-wise Kronecker product with subtraction assignment with the given matrices";
11305 error_ = "Failed subtraction assignment operation";
11306
11307 try {
11308 initResults();
11309 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11310 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11311 columns( dres_ , &indices[index], n ) -= columns( kron( lhs_, rhs_ ), &indices[index], n );
11312 columns( odres_ , &indices[index], n ) -= columns( kron( lhs_, rhs_ ), &indices[index], n );
11313 columns( sres_ , &indices[index], n ) -= columns( kron( lhs_, rhs_ ), &indices[index], n );
11314 columns( osres_ , &indices[index], n ) -= columns( kron( lhs_, rhs_ ), &indices[index], n );
11315 columns( refres_, &indices[index], n ) -= columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11316 }
11317 }
11318 catch( std::exception& ex ) {
11319 convertException<MT1,MT2>( ex );
11320 }
11321
11322 checkResults<MT1,MT2>();
11323
11324 try {
11325 initResults();
11326 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11327 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11328 columns( dres_ , &indices[index], n ) -= columns( kron( lhs_, orhs_ ), &indices[index], n );
11329 columns( odres_ , &indices[index], n ) -= columns( kron( lhs_, orhs_ ), &indices[index], n );
11330 columns( sres_ , &indices[index], n ) -= columns( kron( lhs_, orhs_ ), &indices[index], n );
11331 columns( osres_ , &indices[index], n ) -= columns( kron( lhs_, orhs_ ), &indices[index], n );
11332 columns( refres_, &indices[index], n ) -= columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11333 }
11334 }
11335 catch( std::exception& ex ) {
11336 convertException<MT1,OMT2>( ex );
11337 }
11338
11339 checkResults<MT1,OMT2>();
11340
11341 try {
11342 initResults();
11343 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11344 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11345 columns( dres_ , &indices[index], n ) -= columns( kron( olhs_, rhs_ ), &indices[index], n );
11346 columns( odres_ , &indices[index], n ) -= columns( kron( olhs_, rhs_ ), &indices[index], n );
11347 columns( sres_ , &indices[index], n ) -= columns( kron( olhs_, rhs_ ), &indices[index], n );
11348 columns( osres_ , &indices[index], n ) -= columns( kron( olhs_, rhs_ ), &indices[index], n );
11349 columns( refres_, &indices[index], n ) -= columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11350 }
11351 }
11352 catch( std::exception& ex ) {
11353 convertException<OMT1,MT2>( ex );
11354 }
11355
11356 checkResults<OMT1,MT2>();
11357
11358 try {
11359 initResults();
11360 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11361 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11362 columns( dres_ , &indices[index], n ) -= columns( kron( olhs_, orhs_ ), &indices[index], n );
11363 columns( odres_ , &indices[index], n ) -= columns( kron( olhs_, orhs_ ), &indices[index], n );
11364 columns( sres_ , &indices[index], n ) -= columns( kron( olhs_, orhs_ ), &indices[index], n );
11365 columns( osres_ , &indices[index], n ) -= columns( kron( olhs_, orhs_ ), &indices[index], n );
11366 columns( refres_, &indices[index], n ) -= columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11367 }
11368 }
11369 catch( std::exception& ex ) {
11370 convertException<OMT1,OMT2>( ex );
11371 }
11372
11373 checkResults<OMT1,OMT2>();
11374 }
11375
11376 // Columns-wise Kronecker product with subtraction assignment with evaluated matrices
11377 {
11378 test_ = "Columns-wise Kronecker product with subtraction assignment with evaluated matrices";
11379 error_ = "Failed subtraction assignment operation";
11380
11381 try {
11382 initResults();
11383 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11384 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11385 columns( dres_ , &indices[index], n ) -= columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11386 columns( odres_ , &indices[index], n ) -= columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11387 columns( sres_ , &indices[index], n ) -= columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11388 columns( osres_ , &indices[index], n ) -= columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11389 columns( refres_, &indices[index], n ) -= columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11390 }
11391 }
11392 catch( std::exception& ex ) {
11393 convertException<MT1,MT2>( ex );
11394 }
11395
11396 checkResults<MT1,MT2>();
11397
11398 try {
11399 initResults();
11400 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11401 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11402 columns( dres_ , &indices[index], n ) -= columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11403 columns( odres_ , &indices[index], n ) -= columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11404 columns( sres_ , &indices[index], n ) -= columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11405 columns( osres_ , &indices[index], n ) -= columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11406 columns( refres_, &indices[index], n ) -= columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11407 }
11408 }
11409 catch( std::exception& ex ) {
11410 convertException<MT1,OMT2>( ex );
11411 }
11412
11413 checkResults<MT1,OMT2>();
11414
11415 try {
11416 initResults();
11417 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11418 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11419 columns( dres_ , &indices[index], n ) -= columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11420 columns( odres_ , &indices[index], n ) -= columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11421 columns( sres_ , &indices[index], n ) -= columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11422 columns( osres_ , &indices[index], n ) -= columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11423 columns( refres_, &indices[index], n ) -= columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11424 }
11425 }
11426 catch( std::exception& ex ) {
11427 convertException<OMT1,MT2>( ex );
11428 }
11429
11430 checkResults<OMT1,MT2>();
11431
11432 try {
11433 initResults();
11434 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11435 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11436 columns( dres_ , &indices[index], n ) -= columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11437 columns( odres_ , &indices[index], n ) -= columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11438 columns( sres_ , &indices[index], n ) -= columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11439 columns( osres_ , &indices[index], n ) -= columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11440 columns( refres_, &indices[index], n ) -= columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11441 }
11442 }
11443 catch( std::exception& ex ) {
11444 convertException<OMT1,OMT2>( ex );
11445 }
11446
11447 checkResults<OMT1,OMT2>();
11448 }
11449
11450
11451 //=====================================================================================
11452 // Columns-wise Kronecker product with Schur product assignment
11453 //=====================================================================================
11454
11455 // Columns-wise Kronecker product with Schur product assignment with the given matrices
11456 {
11457 test_ = "Columns-wise Kronecker product with Schur product assignment with the given matrices";
11458 error_ = "Failed Schur product assignment operation";
11459
11460 try {
11461 initResults();
11462 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11463 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11464 columns( dres_ , &indices[index], n ) %= columns( kron( lhs_, rhs_ ), &indices[index], n );
11465 columns( odres_ , &indices[index], n ) %= columns( kron( lhs_, rhs_ ), &indices[index], n );
11466 columns( sres_ , &indices[index], n ) %= columns( kron( lhs_, rhs_ ), &indices[index], n );
11467 columns( osres_ , &indices[index], n ) %= columns( kron( lhs_, rhs_ ), &indices[index], n );
11468 columns( refres_, &indices[index], n ) %= columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11469 }
11470 }
11471 catch( std::exception& ex ) {
11472 convertException<MT1,MT2>( ex );
11473 }
11474
11475 checkResults<MT1,MT2>();
11476
11477 try {
11478 initResults();
11479 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11480 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11481 columns( dres_ , &indices[index], n ) %= columns( kron( lhs_, orhs_ ), &indices[index], n );
11482 columns( odres_ , &indices[index], n ) %= columns( kron( lhs_, orhs_ ), &indices[index], n );
11483 columns( sres_ , &indices[index], n ) %= columns( kron( lhs_, orhs_ ), &indices[index], n );
11484 columns( osres_ , &indices[index], n ) %= columns( kron( lhs_, orhs_ ), &indices[index], n );
11485 columns( refres_, &indices[index], n ) %= columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11486 }
11487 }
11488 catch( std::exception& ex ) {
11489 convertException<MT1,OMT2>( ex );
11490 }
11491
11492 checkResults<MT1,OMT2>();
11493
11494 try {
11495 initResults();
11496 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11497 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11498 columns( dres_ , &indices[index], n ) %= columns( kron( olhs_, rhs_ ), &indices[index], n );
11499 columns( odres_ , &indices[index], n ) %= columns( kron( olhs_, rhs_ ), &indices[index], n );
11500 columns( sres_ , &indices[index], n ) %= columns( kron( olhs_, rhs_ ), &indices[index], n );
11501 columns( osres_ , &indices[index], n ) %= columns( kron( olhs_, rhs_ ), &indices[index], n );
11502 columns( refres_, &indices[index], n ) %= columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11503 }
11504 }
11505 catch( std::exception& ex ) {
11506 convertException<OMT1,MT2>( ex );
11507 }
11508
11509 checkResults<OMT1,MT2>();
11510
11511 try {
11512 initResults();
11513 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11514 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11515 columns( dres_ , &indices[index], n ) %= columns( kron( olhs_, orhs_ ), &indices[index], n );
11516 columns( odres_ , &indices[index], n ) %= columns( kron( olhs_, orhs_ ), &indices[index], n );
11517 columns( sres_ , &indices[index], n ) %= columns( kron( olhs_, orhs_ ), &indices[index], n );
11518 columns( osres_ , &indices[index], n ) %= columns( kron( olhs_, orhs_ ), &indices[index], n );
11519 columns( refres_, &indices[index], n ) %= columns( kron( reflhs_, refrhs_ ), &indices[index], n );
11520 }
11521 }
11522 catch( std::exception& ex ) {
11523 convertException<OMT1,OMT2>( ex );
11524 }
11525
11526 checkResults<OMT1,OMT2>();
11527 }
11528
11529 // Columns-wise Kronecker product with Schur product assignment with evaluated matrices
11530 {
11531 test_ = "Columns-wise Kronecker product with Schur product assignment with evaluated matrices";
11532 error_ = "Failed Schur product assignment operation";
11533
11534 try {
11535 initResults();
11536 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11537 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11538 columns( dres_ , &indices[index], n ) %= columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11539 columns( odres_ , &indices[index], n ) %= columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11540 columns( sres_ , &indices[index], n ) %= columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11541 columns( osres_ , &indices[index], n ) %= columns( kron( eval( lhs_ ), eval( rhs_ ) ), &indices[index], n );
11542 columns( refres_, &indices[index], n ) %= columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11543 }
11544 }
11545 catch( std::exception& ex ) {
11546 convertException<MT1,MT2>( ex );
11547 }
11548
11549 checkResults<MT1,MT2>();
11550
11551 try {
11552 initResults();
11553 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11554 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11555 columns( dres_ , &indices[index], n ) %= columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11556 columns( odres_ , &indices[index], n ) %= columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11557 columns( sres_ , &indices[index], n ) %= columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11558 columns( osres_ , &indices[index], n ) %= columns( kron( eval( lhs_ ), eval( orhs_ ) ), &indices[index], n );
11559 columns( refres_, &indices[index], n ) %= columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11560 }
11561 }
11562 catch( std::exception& ex ) {
11563 convertException<MT1,OMT2>( ex );
11564 }
11565
11566 checkResults<MT1,OMT2>();
11567
11568 try {
11569 initResults();
11570 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11571 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11572 columns( dres_ , &indices[index], n ) %= columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11573 columns( odres_ , &indices[index], n ) %= columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11574 columns( sres_ , &indices[index], n ) %= columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11575 columns( osres_ , &indices[index], n ) %= columns( kron( eval( olhs_ ), eval( rhs_ ) ), &indices[index], n );
11576 columns( refres_, &indices[index], n ) %= columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11577 }
11578 }
11579 catch( std::exception& ex ) {
11580 convertException<OMT1,MT2>( ex );
11581 }
11582
11583 checkResults<OMT1,MT2>();
11584
11585 try {
11586 initResults();
11587 for( size_t index=0UL, n=0UL; index<indices.size(); index+=n ) {
11588 n = blaze::rand<size_t>( 1UL, indices.size() - index );
11589 columns( dres_ , &indices[index], n ) %= columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11590 columns( odres_ , &indices[index], n ) %= columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11591 columns( sres_ , &indices[index], n ) %= columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11592 columns( osres_ , &indices[index], n ) %= columns( kron( eval( olhs_ ), eval( orhs_ ) ), &indices[index], n );
11593 columns( refres_, &indices[index], n ) %= columns( kron( eval( reflhs_ ), eval( refrhs_ ) ), &indices[index], n );
11594 }
11595 }
11596 catch( std::exception& ex ) {
11597 convertException<OMT1,OMT2>( ex );
11598 }
11599
11600 checkResults<OMT1,OMT2>();
11601 }
11602
11603
11604 //=====================================================================================
11605 // Failure cases
11606 //=====================================================================================
11607
11608 // Out-of-bounds access (invalid column index; initializer_list)
11609 {
11610 test_ = "Out-of-bounds column selection construction (invalid column index; initializer_list)";
11611 error_ = "Setup of out-of-bounds column selection succeeded";
11612
11613 try {
11614 auto c = columns( kron( lhs_, rhs_ ), { lhs_.columns()*rhs_.columns() } );
11615
11616 std::ostringstream oss;
11617 oss << " Test: " << test_ << "\n"
11618 << " Error: " << error_ << "\n"
11619 << " Details:\n"
11620 << " Random seed = " << blaze::getSeed() << "\n"
11621 << " Left-hand side sparse matrix type:\n"
11622 << " " << typeid( MT1 ).name() << "\n"
11623 << " Right-hand side dense matrix type:\n"
11624 << " " << typeid( MT2 ).name() << "\n"
11625 << " Result:\n" << c << "\n";
11626 throw std::runtime_error( oss.str() );
11627 }
11628 catch( std::invalid_argument& ex ) {
11629 checkExceptionMessage( ex, "Invalid column access index" );
11630 }
11631
11632 try {
11633 auto c = columns( kron( lhs_, orhs_ ), { lhs_.columns()*orhs_.columns() } );
11634
11635 std::ostringstream oss;
11636 oss << " Test: " << test_ << "\n"
11637 << " Error: " << error_ << "\n"
11638 << " Details:\n"
11639 << " Random seed = " << blaze::getSeed() << "\n"
11640 << " Left-hand side sparse matrix type:\n"
11641 << " " << typeid( MT1 ).name() << "\n"
11642 << " Right-hand side dense matrix type:\n"
11643 << " " << typeid( OMT2 ).name() << "\n"
11644 << " Result:\n" << c << "\n";
11645 throw std::runtime_error( oss.str() );
11646 }
11647 catch( std::invalid_argument& ex ) {
11648 checkExceptionMessage( ex, "Invalid column access index" );
11649 }
11650
11651 try {
11652 auto c = columns( kron( olhs_, rhs_ ), { olhs_.columns()*rhs_.columns() } );
11653
11654 std::ostringstream oss;
11655 oss << " Test: " << test_ << "\n"
11656 << " Error: " << error_ << "\n"
11657 << " Details:\n"
11658 << " Random seed = " << blaze::getSeed() << "\n"
11659 << " Left-hand side sparse matrix type:\n"
11660 << " " << typeid( OMT1 ).name() << "\n"
11661 << " Right-hand side dense matrix type:\n"
11662 << " " << typeid( MT2 ).name() << "\n"
11663 << " Result:\n" << c << "\n";
11664 throw std::runtime_error( oss.str() );
11665 }
11666 catch( std::invalid_argument& ex ) {
11667 checkExceptionMessage( ex, "Invalid column access index" );
11668 }
11669
11670 try {
11671 auto c = columns( kron( olhs_, orhs_ ), { olhs_.columns()*orhs_.columns() } );
11672
11673 std::ostringstream oss;
11674 oss << " Test: " << test_ << "\n"
11675 << " Error: " << error_ << "\n"
11676 << " Details:\n"
11677 << " Random seed = " << blaze::getSeed() << "\n"
11678 << " Left-hand side sparse matrix type:\n"
11679 << " " << typeid( OMT1 ).name() << "\n"
11680 << " Right-hand side dense matrix type:\n"
11681 << " " << typeid( OMT2 ).name() << "\n"
11682 << " Result:\n" << c << "\n";
11683 throw std::runtime_error( oss.str() );
11684 }
11685 catch( std::invalid_argument& ex ) {
11686 checkExceptionMessage( ex, "Invalid column access index" );
11687 }
11688 }
11689
11690 // Out-of-bounds access (invalid column index; lambda)
11691 {
11692 test_ = "Out-of-bounds column selection construction (invalid column index; lambda)";
11693 error_ = "Setup of out-of-bounds column selection succeeded";
11694
11695 try {
11696 auto c = columns( kron( lhs_, rhs_ ), [index=lhs_.columns()*rhs_.columns()]( size_t ){ return index; }, 1UL );
11697
11698 std::ostringstream oss;
11699 oss << " Test: " << test_ << "\n"
11700 << " Error: " << error_ << "\n"
11701 << " Details:\n"
11702 << " Random seed = " << blaze::getSeed() << "\n"
11703 << " Left-hand side sparse matrix type:\n"
11704 << " " << typeid( MT1 ).name() << "\n"
11705 << " Right-hand side dense matrix type:\n"
11706 << " " << typeid( MT2 ).name() << "\n"
11707 << " Result:\n" << c << "\n";
11708 throw std::runtime_error( oss.str() );
11709 }
11710 catch( std::invalid_argument& ex ) {
11711 checkExceptionMessage( ex, "Invalid column access index" );
11712 }
11713
11714 try {
11715 auto c = columns( kron( lhs_, orhs_ ), [index=lhs_.columns()*orhs_.columns()]( size_t ){ return index; }, 1UL );
11716
11717 std::ostringstream oss;
11718 oss << " Test: " << test_ << "\n"
11719 << " Error: " << error_ << "\n"
11720 << " Details:\n"
11721 << " Random seed = " << blaze::getSeed() << "\n"
11722 << " Left-hand side sparse matrix type:\n"
11723 << " " << typeid( MT1 ).name() << "\n"
11724 << " Right-hand side dense matrix type:\n"
11725 << " " << typeid( OMT2 ).name() << "\n"
11726 << " Result:\n" << c << "\n";
11727 throw std::runtime_error( oss.str() );
11728 }
11729 catch( std::invalid_argument& ex ) {
11730 checkExceptionMessage( ex, "Invalid column access index" );
11731 }
11732
11733 try {
11734 auto c = columns( kron( olhs_, rhs_ ), [index=olhs_.columns()*rhs_.columns()]( size_t ){ return index; }, 1UL );
11735
11736 std::ostringstream oss;
11737 oss << " Test: " << test_ << "\n"
11738 << " Error: " << error_ << "\n"
11739 << " Details:\n"
11740 << " Random seed = " << blaze::getSeed() << "\n"
11741 << " Left-hand side sparse matrix type:\n"
11742 << " " << typeid( OMT1 ).name() << "\n"
11743 << " Right-hand side dense matrix type:\n"
11744 << " " << typeid( MT2 ).name() << "\n"
11745 << " Result:\n" << c << "\n";
11746 throw std::runtime_error( oss.str() );
11747 }
11748 catch( std::invalid_argument& ex ) {
11749 checkExceptionMessage( ex, "Invalid column access index" );
11750 }
11751
11752 try {
11753 auto c = columns( kron( olhs_, orhs_ ), [index=olhs_.columns()*orhs_.columns()]( size_t ){ return index; }, 1UL );
11754
11755 std::ostringstream oss;
11756 oss << " Test: " << test_ << "\n"
11757 << " Error: " << error_ << "\n"
11758 << " Details:\n"
11759 << " Random seed = " << blaze::getSeed() << "\n"
11760 << " Left-hand side sparse matrix type:\n"
11761 << " " << typeid( OMT1 ).name() << "\n"
11762 << " Right-hand side dense matrix type:\n"
11763 << " " << typeid( OMT2 ).name() << "\n"
11764 << " Result:\n" << c << "\n";
11765 throw std::runtime_error( oss.str() );
11766 }
11767 catch( std::invalid_argument& ex ) {
11768 checkExceptionMessage( ex, "Invalid column access index" );
11769 }
11770 }
11771 }
11772 #endif
11773 }
11774 //*************************************************************************************************
11775
11776
11777 //*************************************************************************************************
11778 /*!\brief Skipping the columns-wise sparse matrix/dense matrix Kronecker product.
11779 //
11780 // \return void
11781 //
11782 // This function is called in case the columns-wise matrix/matrix Kronecker product operation is
11783 // not available for the given matrix types \a MT1 and \a MT2.
11784 */
11785 template< typename MT1 // Type of the left-hand side sparse matrix
11786 , typename MT2 > // Type of the right-hand side dense matrix
testColumnsOperation(blaze::FalseType)11787 void OperationTest<MT1,MT2>::testColumnsOperation( blaze::FalseType )
11788 {}
11789 //*************************************************************************************************
11790
11791
11792 //*************************************************************************************************
11793 /*!\brief Testing the band-wise sparse matrix/dense matrix Kronecker product.
11794 //
11795 // \return void
11796 // \exception std::runtime_error Kronecker product error detected.
11797 //
11798 // This function tests the band-wise matrix Kronecker product with plain assignment, addition
11799 // assignment, subtraction assignment, and multiplication assignment. In case any error resulting
11800 // from the Kronecker product or the subsequent assignment is detected, a \a std::runtime_error
11801 // exception is thrown.
11802 */
11803 template< typename MT1 // Type of the left-hand side sparse matrix
11804 , typename MT2 > // Type of the right-hand side dense matrix
testBandOperation(blaze::TrueType)11805 void OperationTest<MT1,MT2>::testBandOperation( blaze::TrueType )
11806 {
11807 #if BLAZETEST_MATHTEST_TEST_BAND_OPERATION
11808 if( BLAZETEST_MATHTEST_TEST_BAND_OPERATION > 1 )
11809 {
11810 if( lhs_.rows() * rhs_.rows() == 0UL || lhs_.columns() * rhs_.columns() == 0UL )
11811 return;
11812
11813
11814 const ptrdiff_t ibegin( 1UL - lhs_.rows()*rhs_.rows() );
11815 const ptrdiff_t iend ( lhs_.columns()*rhs_.columns() );
11816
11817
11818 //=====================================================================================
11819 // Band-wise Kronecker product
11820 //=====================================================================================
11821
11822 // Band-wise Kronecker product with the given matrices
11823 {
11824 test_ = "Band-wise Kronecker product with the given matrices";
11825 error_ = "Failed Kronecker product operation";
11826
11827 try {
11828 initResults();
11829 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11830 band( dres_ , i ) = band( kron( lhs_, rhs_ ), i );
11831 band( odres_ , i ) = band( kron( lhs_, rhs_ ), i );
11832 band( sres_ , i ) = band( kron( lhs_, rhs_ ), i );
11833 band( osres_ , i ) = band( kron( lhs_, rhs_ ), i );
11834 band( refres_, i ) = band( kron( reflhs_, refrhs_ ), i );
11835 }
11836 }
11837 catch( std::exception& ex ) {
11838 convertException<MT1,MT2>( ex );
11839 }
11840
11841 checkResults<MT1,MT2>();
11842
11843 try {
11844 initResults();
11845 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11846 band( dres_ , i ) = band( kron( lhs_, orhs_ ), i );
11847 band( odres_ , i ) = band( kron( lhs_, orhs_ ), i );
11848 band( sres_ , i ) = band( kron( lhs_, orhs_ ), i );
11849 band( osres_ , i ) = band( kron( lhs_, orhs_ ), i );
11850 band( refres_, i ) = band( kron( reflhs_, refrhs_ ), i );
11851 }
11852 }
11853 catch( std::exception& ex ) {
11854 convertException<MT1,OMT2>( ex );
11855 }
11856
11857 checkResults<MT1,OMT2>();
11858
11859 try {
11860 initResults();
11861 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11862 band( dres_ , i ) = band( kron( olhs_, rhs_ ), i );
11863 band( odres_ , i ) = band( kron( olhs_, rhs_ ), i );
11864 band( sres_ , i ) = band( kron( olhs_, rhs_ ), i );
11865 band( osres_ , i ) = band( kron( olhs_, rhs_ ), i );
11866 band( refres_, i ) = band( kron( reflhs_, refrhs_ ), i );
11867 }
11868 }
11869 catch( std::exception& ex ) {
11870 convertException<OMT1,MT2>( ex );
11871 }
11872
11873 checkResults<OMT1,MT2>();
11874
11875 try {
11876 initResults();
11877 for( size_t i=ibegin; i<iend; ++i ) {
11878 band( dres_ , i ) = band( kron( olhs_, orhs_ ), i );
11879 band( odres_ , i ) = band( kron( olhs_, orhs_ ), i );
11880 band( sres_ , i ) = band( kron( olhs_, orhs_ ), i );
11881 band( osres_ , i ) = band( kron( olhs_, orhs_ ), i );
11882 band( refres_, i ) = band( kron( reflhs_, refrhs_ ), i );
11883 }
11884 }
11885 catch( std::exception& ex ) {
11886 convertException<OMT1,OMT2>( ex );
11887 }
11888
11889 checkResults<OMT1,OMT2>();
11890 }
11891
11892 // Band-wise Kronecker product with evaluated matrices
11893 {
11894 test_ = "Band-wise Kronecker product with evaluated matrices";
11895 error_ = "Failed Kronecker product operation";
11896
11897 try {
11898 initResults();
11899 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11900 band( dres_ , i ) = band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
11901 band( odres_ , i ) = band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
11902 band( sres_ , i ) = band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
11903 band( osres_ , i ) = band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
11904 band( refres_, i ) = band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
11905 }
11906 }
11907 catch( std::exception& ex ) {
11908 convertException<MT1,MT2>( ex );
11909 }
11910
11911 checkResults<MT1,MT2>();
11912
11913 try {
11914 initResults();
11915 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11916 band( dres_ , i ) = band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
11917 band( odres_ , i ) = band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
11918 band( sres_ , i ) = band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
11919 band( osres_ , i ) = band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
11920 band( refres_, i ) = band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
11921 }
11922 }
11923 catch( std::exception& ex ) {
11924 convertException<MT1,OMT2>( ex );
11925 }
11926
11927 checkResults<MT1,OMT2>();
11928
11929 try {
11930 initResults();
11931 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11932 band( dres_ , i ) = band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
11933 band( odres_ , i ) = band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
11934 band( sres_ , i ) = band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
11935 band( osres_ , i ) = band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
11936 band( refres_, i ) = band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
11937 }
11938 }
11939 catch( std::exception& ex ) {
11940 convertException<OMT1,MT2>( ex );
11941 }
11942
11943 checkResults<OMT1,MT2>();
11944
11945 try {
11946 initResults();
11947 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11948 band( dres_ , i ) = band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
11949 band( odres_ , i ) = band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
11950 band( sres_ , i ) = band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
11951 band( osres_ , i ) = band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
11952 band( refres_, i ) = band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
11953 }
11954 }
11955 catch( std::exception& ex ) {
11956 convertException<OMT1,OMT2>( ex );
11957 }
11958
11959 checkResults<OMT1,OMT2>();
11960 }
11961
11962
11963 //=====================================================================================
11964 // Band-wise Kronecker product with addition assignment
11965 //=====================================================================================
11966
11967 // Band-wise Kronecker product with addition assignment with the given matrices
11968 {
11969 test_ = "Band-wise Kronecker product with addition assignment with the given matrices";
11970 error_ = "Failed addition assignment operation";
11971
11972 try {
11973 initResults();
11974 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11975 band( dres_ , i ) += band( kron( lhs_, rhs_ ), i );
11976 band( odres_ , i ) += band( kron( lhs_, rhs_ ), i );
11977 band( sres_ , i ) += band( kron( lhs_, rhs_ ), i );
11978 band( osres_ , i ) += band( kron( lhs_, rhs_ ), i );
11979 band( refres_, i ) += band( kron( reflhs_, refrhs_ ), i );
11980 }
11981 }
11982 catch( std::exception& ex ) {
11983 convertException<MT1,MT2>( ex );
11984 }
11985
11986 checkResults<MT1,MT2>();
11987
11988 try {
11989 initResults();
11990 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
11991 band( dres_ , i ) += band( kron( lhs_, orhs_ ), i );
11992 band( odres_ , i ) += band( kron( lhs_, orhs_ ), i );
11993 band( sres_ , i ) += band( kron( lhs_, orhs_ ), i );
11994 band( osres_ , i ) += band( kron( lhs_, orhs_ ), i );
11995 band( refres_, i ) += band( kron( reflhs_, refrhs_ ), i );
11996 }
11997 }
11998 catch( std::exception& ex ) {
11999 convertException<MT1,OMT2>( ex );
12000 }
12001
12002 checkResults<MT1,OMT2>();
12003
12004 try {
12005 initResults();
12006 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12007 band( dres_ , i ) += band( kron( olhs_, rhs_ ), i );
12008 band( odres_ , i ) += band( kron( olhs_, rhs_ ), i );
12009 band( sres_ , i ) += band( kron( olhs_, rhs_ ), i );
12010 band( osres_ , i ) += band( kron( olhs_, rhs_ ), i );
12011 band( refres_, i ) += band( kron( reflhs_, refrhs_ ), i );
12012 }
12013 }
12014 catch( std::exception& ex ) {
12015 convertException<OMT1,MT2>( ex );
12016 }
12017
12018 checkResults<OMT1,MT2>();
12019
12020 try {
12021 initResults();
12022 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12023 band( dres_ , i ) += band( kron( olhs_, orhs_ ), i );
12024 band( odres_ , i ) += band( kron( olhs_, orhs_ ), i );
12025 band( sres_ , i ) += band( kron( olhs_, orhs_ ), i );
12026 band( osres_ , i ) += band( kron( olhs_, orhs_ ), i );
12027 band( refres_, i ) += band( kron( reflhs_, refrhs_ ), i );
12028 }
12029 }
12030 catch( std::exception& ex ) {
12031 convertException<OMT1,OMT2>( ex );
12032 }
12033
12034 checkResults<OMT1,OMT2>();
12035 }
12036
12037 // Band-wise Kronecker product with addition assignment with evaluated matrices
12038 {
12039 test_ = "Band-wise Kronecker product with addition assignment with evaluated matrices";
12040 error_ = "Failed addition assignment operation";
12041
12042 try {
12043 initResults();
12044 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12045 band( dres_ , i ) += band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12046 band( odres_ , i ) += band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12047 band( sres_ , i ) += band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12048 band( osres_ , i ) += band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12049 band( refres_, i ) += band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12050 }
12051 }
12052 catch( std::exception& ex ) {
12053 convertException<MT1,MT2>( ex );
12054 }
12055
12056 checkResults<MT1,MT2>();
12057
12058 try {
12059 initResults();
12060 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12061 band( dres_ , i ) += band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12062 band( odres_ , i ) += band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12063 band( sres_ , i ) += band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12064 band( osres_ , i ) += band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12065 band( refres_, i ) += band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12066 }
12067 }
12068 catch( std::exception& ex ) {
12069 convertException<MT1,OMT2>( ex );
12070 }
12071
12072 checkResults<MT1,OMT2>();
12073
12074 try {
12075 initResults();
12076 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12077 band( dres_ , i ) += band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12078 band( odres_ , i ) += band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12079 band( sres_ , i ) += band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12080 band( osres_ , i ) += band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12081 band( refres_, i ) += band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12082 }
12083 }
12084 catch( std::exception& ex ) {
12085 convertException<OMT1,MT2>( ex );
12086 }
12087
12088 checkResults<OMT1,MT2>();
12089
12090 try {
12091 initResults();
12092 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12093 band( dres_ , i ) += band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12094 band( odres_ , i ) += band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12095 band( sres_ , i ) += band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12096 band( osres_ , i ) += band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12097 band( refres_, i ) += band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12098 }
12099 }
12100 catch( std::exception& ex ) {
12101 convertException<OMT1,OMT2>( ex );
12102 }
12103
12104 checkResults<OMT1,OMT2>();
12105 }
12106
12107
12108 //=====================================================================================
12109 // Band-wise Kronecker product with subtraction assignment
12110 //=====================================================================================
12111
12112 // Band-wise Kronecker product with subtraction assignment with the given matrices
12113 {
12114 test_ = "Band-wise Kronecker product with subtraction assignment with the given matrices";
12115 error_ = "Failed subtraction assignment operation";
12116
12117 try {
12118 initResults();
12119 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12120 band( dres_ , i ) -= band( kron( lhs_, rhs_ ), i );
12121 band( odres_ , i ) -= band( kron( lhs_, rhs_ ), i );
12122 band( sres_ , i ) -= band( kron( lhs_, rhs_ ), i );
12123 band( osres_ , i ) -= band( kron( lhs_, rhs_ ), i );
12124 band( refres_, i ) -= band( kron( reflhs_, refrhs_ ), i );
12125 }
12126 }
12127 catch( std::exception& ex ) {
12128 convertException<MT1,MT2>( ex );
12129 }
12130
12131 checkResults<MT1,MT2>();
12132
12133 try {
12134 initResults();
12135 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12136 band( dres_ , i ) -= band( kron( lhs_, orhs_ ), i );
12137 band( odres_ , i ) -= band( kron( lhs_, orhs_ ), i );
12138 band( sres_ , i ) -= band( kron( lhs_, orhs_ ), i );
12139 band( osres_ , i ) -= band( kron( lhs_, orhs_ ), i );
12140 band( refres_, i ) -= band( kron( reflhs_, refrhs_ ), i );
12141 }
12142 }
12143 catch( std::exception& ex ) {
12144 convertException<MT1,OMT2>( ex );
12145 }
12146
12147 checkResults<MT1,OMT2>();
12148
12149 try {
12150 initResults();
12151 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12152 band( dres_ , i ) -= band( kron( olhs_, rhs_ ), i );
12153 band( odres_ , i ) -= band( kron( olhs_, rhs_ ), i );
12154 band( sres_ , i ) -= band( kron( olhs_, rhs_ ), i );
12155 band( osres_ , i ) -= band( kron( olhs_, rhs_ ), i );
12156 band( refres_, i ) -= band( kron( reflhs_, refrhs_ ), i );
12157 }
12158 }
12159 catch( std::exception& ex ) {
12160 convertException<OMT1,MT2>( ex );
12161 }
12162
12163 checkResults<OMT1,MT2>();
12164
12165 try {
12166 initResults();
12167 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12168 band( dres_ , i ) -= band( kron( olhs_, orhs_ ), i );
12169 band( odres_ , i ) -= band( kron( olhs_, orhs_ ), i );
12170 band( sres_ , i ) -= band( kron( olhs_, orhs_ ), i );
12171 band( osres_ , i ) -= band( kron( olhs_, orhs_ ), i );
12172 band( refres_, i ) -= band( kron( reflhs_, refrhs_ ), i );
12173 }
12174 }
12175 catch( std::exception& ex ) {
12176 convertException<OMT1,OMT2>( ex );
12177 }
12178
12179 checkResults<OMT1,OMT2>();
12180 }
12181
12182 // Band-wise Kronecker product with subtraction assignment with evaluated matrices
12183 {
12184 test_ = "Band-wise Kronecker product with subtraction assignment with evaluated matrices";
12185 error_ = "Failed subtraction assignment operation";
12186
12187 try {
12188 initResults();
12189 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12190 band( dres_ , i ) -= band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12191 band( odres_ , i ) -= band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12192 band( sres_ , i ) -= band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12193 band( osres_ , i ) -= band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12194 band( refres_, i ) -= band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12195 }
12196 }
12197 catch( std::exception& ex ) {
12198 convertException<MT1,MT2>( ex );
12199 }
12200
12201 checkResults<MT1,MT2>();
12202
12203 try {
12204 initResults();
12205 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12206 band( dres_ , i ) -= band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12207 band( odres_ , i ) -= band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12208 band( sres_ , i ) -= band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12209 band( osres_ , i ) -= band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12210 band( refres_, i ) -= band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12211 }
12212 }
12213 catch( std::exception& ex ) {
12214 convertException<MT1,OMT2>( ex );
12215 }
12216
12217 checkResults<MT1,OMT2>();
12218
12219 try {
12220 initResults();
12221 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12222 band( dres_ , i ) -= band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12223 band( odres_ , i ) -= band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12224 band( sres_ , i ) -= band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12225 band( osres_ , i ) -= band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12226 band( refres_, i ) -= band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12227 }
12228 }
12229 catch( std::exception& ex ) {
12230 convertException<OMT1,MT2>( ex );
12231 }
12232
12233 checkResults<OMT1,MT2>();
12234
12235 try {
12236 initResults();
12237 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12238 band( dres_ , i ) -= band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12239 band( odres_ , i ) -= band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12240 band( sres_ , i ) -= band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12241 band( osres_ , i ) -= band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12242 band( refres_, i ) -= band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12243 }
12244 }
12245 catch( std::exception& ex ) {
12246 convertException<OMT1,OMT2>( ex );
12247 }
12248
12249 checkResults<OMT1,OMT2>();
12250 }
12251
12252
12253 //=====================================================================================
12254 // Band-wise Kronecker product with multiplication assignment
12255 //=====================================================================================
12256
12257 // Band-wise Kronecker product with multiplication assignment with the given matrices
12258 {
12259 test_ = "Band-wise Kronecker product with multiplication assignment with the given matrices";
12260 error_ = "Failed multiplication assignment operation";
12261
12262 try {
12263 initResults();
12264 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12265 band( dres_ , i ) *= band( kron( lhs_, rhs_ ), i );
12266 band( odres_ , i ) *= band( kron( lhs_, rhs_ ), i );
12267 band( sres_ , i ) *= band( kron( lhs_, rhs_ ), i );
12268 band( osres_ , i ) *= band( kron( lhs_, rhs_ ), i );
12269 band( refres_, i ) *= band( kron( reflhs_, refrhs_ ), i );
12270 }
12271 }
12272 catch( std::exception& ex ) {
12273 convertException<MT1,MT2>( ex );
12274 }
12275
12276 checkResults<MT1,MT2>();
12277
12278 try {
12279 initResults();
12280 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12281 band( dres_ , i ) *= band( kron( lhs_, orhs_ ), i );
12282 band( odres_ , i ) *= band( kron( lhs_, orhs_ ), i );
12283 band( sres_ , i ) *= band( kron( lhs_, orhs_ ), i );
12284 band( osres_ , i ) *= band( kron( lhs_, orhs_ ), i );
12285 band( refres_, i ) *= band( kron( reflhs_, refrhs_ ), i );
12286 }
12287 }
12288 catch( std::exception& ex ) {
12289 convertException<MT1,OMT2>( ex );
12290 }
12291
12292 checkResults<MT1,OMT2>();
12293
12294 try {
12295 initResults();
12296 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12297 band( dres_ , i ) *= band( kron( olhs_, rhs_ ), i );
12298 band( odres_ , i ) *= band( kron( olhs_, rhs_ ), i );
12299 band( sres_ , i ) *= band( kron( olhs_, rhs_ ), i );
12300 band( osres_ , i ) *= band( kron( olhs_, rhs_ ), i );
12301 band( refres_, i ) *= band( kron( reflhs_, refrhs_ ), i );
12302 }
12303 }
12304 catch( std::exception& ex ) {
12305 convertException<OMT1,MT2>( ex );
12306 }
12307
12308 checkResults<OMT1,MT2>();
12309
12310 try {
12311 initResults();
12312 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12313 band( dres_ , i ) *= band( kron( olhs_, orhs_ ), i );
12314 band( odres_ , i ) *= band( kron( olhs_, orhs_ ), i );
12315 band( sres_ , i ) *= band( kron( olhs_, orhs_ ), i );
12316 band( osres_ , i ) *= band( kron( olhs_, orhs_ ), i );
12317 band( refres_, i ) *= band( kron( reflhs_, refrhs_ ), i );
12318 }
12319 }
12320 catch( std::exception& ex ) {
12321 convertException<OMT1,OMT2>( ex );
12322 }
12323
12324 checkResults<OMT1,OMT2>();
12325 }
12326
12327 // Band-wise Kronecker product with multiplication assignment with evaluated matrices
12328 {
12329 test_ = "Band-wise Kronecker product with multiplication assignment with evaluated matrices";
12330 error_ = "Failed multiplication assignment operation";
12331
12332 try {
12333 initResults();
12334 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12335 band( dres_ , i ) *= band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12336 band( odres_ , i ) *= band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12337 band( sres_ , i ) *= band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12338 band( osres_ , i ) *= band( kron( eval( lhs_ ), eval( rhs_ ) ), i );
12339 band( refres_, i ) *= band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12340 }
12341 }
12342 catch( std::exception& ex ) {
12343 convertException<MT1,MT2>( ex );
12344 }
12345
12346 checkResults<MT1,MT2>();
12347
12348 try {
12349 initResults();
12350 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12351 band( dres_ , i ) *= band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12352 band( odres_ , i ) *= band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12353 band( sres_ , i ) *= band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12354 band( osres_ , i ) *= band( kron( eval( lhs_ ), eval( orhs_ ) ), i );
12355 band( refres_, i ) *= band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12356 }
12357 }
12358 catch( std::exception& ex ) {
12359 convertException<MT1,OMT2>( ex );
12360 }
12361
12362 checkResults<MT1,OMT2>();
12363
12364 try {
12365 initResults();
12366 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12367 band( dres_ , i ) *= band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12368 band( odres_ , i ) *= band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12369 band( sres_ , i ) *= band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12370 band( osres_ , i ) *= band( kron( eval( olhs_ ), eval( rhs_ ) ), i );
12371 band( refres_, i ) *= band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12372 }
12373 }
12374 catch( std::exception& ex ) {
12375 convertException<OMT1,MT2>( ex );
12376 }
12377
12378 checkResults<OMT1,MT2>();
12379
12380 try {
12381 initResults();
12382 for( ptrdiff_t i=ibegin; i<iend; ++i ) {
12383 band( dres_ , i ) *= band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12384 band( odres_ , i ) *= band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12385 band( sres_ , i ) *= band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12386 band( osres_ , i ) *= band( kron( eval( olhs_ ), eval( orhs_ ) ), i );
12387 band( refres_, i ) *= band( kron( eval( reflhs_ ), eval( refrhs_ ) ), i );
12388 }
12389 }
12390 catch( std::exception& ex ) {
12391 convertException<OMT1,OMT2>( ex );
12392 }
12393
12394 checkResults<OMT1,OMT2>();
12395 }
12396
12397
12398 //=====================================================================================
12399 // Failure cases
12400 //=====================================================================================
12401
12402 // Out-of-bounds access (invalid lower band index)
12403 {
12404 test_ = "Out-of-bounds band construction (invalid lower band index)";
12405 error_ = "Setup of out-of-bounds band succeeded";
12406
12407 try {
12408 auto b = band( kron( lhs_, rhs_ ), -lhs_.rows()*rhs_.rows() );
12409
12410 std::ostringstream oss;
12411 oss << " Test: " << test_ << "\n"
12412 << " Error: " << error_ << "\n"
12413 << " Details:\n"
12414 << " Random seed = " << blaze::getSeed() << "\n"
12415 << " Left-hand side sparse matrix type:\n"
12416 << " " << typeid( MT1 ).name() << "\n"
12417 << " Right-hand side dense matrix type:\n"
12418 << " " << typeid( MT2 ).name() << "\n"
12419 << " Result:\n" << b << "\n";
12420 throw std::runtime_error( oss.str() );
12421 }
12422 catch( std::invalid_argument& ex ) {
12423 checkExceptionMessage( ex, "Invalid band access index" );
12424 }
12425
12426 try {
12427 auto b = band( kron( lhs_, orhs_ ), -lhs_.rows()*orhs_.rows() );
12428
12429 std::ostringstream oss;
12430 oss << " Test: " << test_ << "\n"
12431 << " Error: " << error_ << "\n"
12432 << " Details:\n"
12433 << " Random seed = " << blaze::getSeed() << "\n"
12434 << " Left-hand side sparse matrix type:\n"
12435 << " " << typeid( MT1 ).name() << "\n"
12436 << " Right-hand side dense matrix type:\n"
12437 << " " << typeid( OMT2 ).name() << "\n"
12438 << " Result:\n" << b << "\n";
12439 throw std::runtime_error( oss.str() );
12440 }
12441 catch( std::invalid_argument& ex ) {
12442 checkExceptionMessage( ex, "Invalid band access index" );
12443 }
12444
12445 try {
12446 auto b = band( kron( olhs_, rhs_ ), -olhs_.rows()*rhs_.rows() );
12447
12448 std::ostringstream oss;
12449 oss << " Test: " << test_ << "\n"
12450 << " Error: " << error_ << "\n"
12451 << " Details:\n"
12452 << " Random seed = " << blaze::getSeed() << "\n"
12453 << " Left-hand side sparse matrix type:\n"
12454 << " " << typeid( OMT1 ).name() << "\n"
12455 << " Right-hand side dense matrix type:\n"
12456 << " " << typeid( MT2 ).name() << "\n"
12457 << " Result:\n" << b << "\n";
12458 throw std::runtime_error( oss.str() );
12459 }
12460 catch( std::invalid_argument& ex ) {
12461 checkExceptionMessage( ex, "Invalid band access index" );
12462 }
12463
12464 try {
12465 auto b = band( kron( olhs_, orhs_ ), -olhs_.rows()*orhs_.rows() );
12466
12467 std::ostringstream oss;
12468 oss << " Test: " << test_ << "\n"
12469 << " Error: " << error_ << "\n"
12470 << " Details:\n"
12471 << " Random seed = " << blaze::getSeed() << "\n"
12472 << " Left-hand side sparse matrix type:\n"
12473 << " " << typeid( OMT1 ).name() << "\n"
12474 << " Right-hand side dense matrix type:\n"
12475 << " " << typeid( OMT2 ).name() << "\n"
12476 << " Result:\n" << b << "\n";
12477 throw std::runtime_error( oss.str() );
12478 }
12479 catch( std::invalid_argument& ex ) {
12480 checkExceptionMessage( ex, "Invalid band access index" );
12481 }
12482 }
12483
12484 // Out-of-bounds access (invalid upper band index)
12485 {
12486 test_ = "Out-of-bounds band construction (invalid upper band index)";
12487 error_ = "Setup of out-of-bounds band succeeded";
12488
12489 try {
12490 auto b = band( kron( lhs_, rhs_ ), lhs_.columns()*rhs_.columns() );
12491
12492 std::ostringstream oss;
12493 oss << " Test: " << test_ << "\n"
12494 << " Error: " << error_ << "\n"
12495 << " Details:\n"
12496 << " Random seed = " << blaze::getSeed() << "\n"
12497 << " Left-hand side sparse matrix type:\n"
12498 << " " << typeid( MT1 ).name() << "\n"
12499 << " Right-hand side dense matrix type:\n"
12500 << " " << typeid( MT2 ).name() << "\n"
12501 << " Result:\n" << b << "\n";
12502 throw std::runtime_error( oss.str() );
12503 }
12504 catch( std::invalid_argument& ex ) {
12505 checkExceptionMessage( ex, "Invalid band access index" );
12506 }
12507
12508 try {
12509 auto b = band( kron( lhs_, orhs_ ), lhs_.columns()*orhs_.columns() );
12510
12511 std::ostringstream oss;
12512 oss << " Test: " << test_ << "\n"
12513 << " Error: " << error_ << "\n"
12514 << " Details:\n"
12515 << " Random seed = " << blaze::getSeed() << "\n"
12516 << " Left-hand side sparse matrix type:\n"
12517 << " " << typeid( MT1 ).name() << "\n"
12518 << " Right-hand side dense matrix type:\n"
12519 << " " << typeid( OMT2 ).name() << "\n"
12520 << " Result:\n" << b << "\n";
12521 throw std::runtime_error( oss.str() );
12522 }
12523 catch( std::invalid_argument& ex ) {
12524 checkExceptionMessage( ex, "Invalid band access index" );
12525 }
12526
12527 try {
12528 auto b = band( kron( olhs_, rhs_ ), olhs_.columns()*rhs_.columns() );
12529
12530 std::ostringstream oss;
12531 oss << " Test: " << test_ << "\n"
12532 << " Error: " << error_ << "\n"
12533 << " Details:\n"
12534 << " Random seed = " << blaze::getSeed() << "\n"
12535 << " Left-hand side sparse matrix type:\n"
12536 << " " << typeid( OMT1 ).name() << "\n"
12537 << " Right-hand side dense matrix type:\n"
12538 << " " << typeid( MT2 ).name() << "\n"
12539 << " Result:\n" << b << "\n";
12540 throw std::runtime_error( oss.str() );
12541 }
12542 catch( std::invalid_argument& ex ) {
12543 checkExceptionMessage( ex, "Invalid band access index" );
12544 }
12545
12546 try {
12547 auto b = band( kron( olhs_, orhs_ ), olhs_.columns()*orhs_.columns() );
12548
12549 std::ostringstream oss;
12550 oss << " Test: " << test_ << "\n"
12551 << " Error: " << error_ << "\n"
12552 << " Details:\n"
12553 << " Random seed = " << blaze::getSeed() << "\n"
12554 << " Left-hand side sparse matrix type:\n"
12555 << " " << typeid( OMT1 ).name() << "\n"
12556 << " Right-hand side dense matrix type:\n"
12557 << " " << typeid( OMT2 ).name() << "\n"
12558 << " Result:\n" << b << "\n";
12559 throw std::runtime_error( oss.str() );
12560 }
12561 catch( std::invalid_argument& ex ) {
12562 checkExceptionMessage( ex, "Invalid band access index" );
12563 }
12564 }
12565 }
12566 #endif
12567 }
12568 //*************************************************************************************************
12569
12570
12571 //*************************************************************************************************
12572 /*!\brief Skipping the band-wise sparse matrix/dense matrix Kronecker product.
12573 //
12574 // \return void
12575 //
12576 // This function is called in case the band-wise matrix/matrix Kronecker product operation is not
12577 // available for the given matrix types \a MT1 and \a MT2.
12578 */
12579 template< typename MT1 // Type of the left-hand side sparse matrix
12580 , typename MT2 > // Type of the right-hand side dense matrix
testBandOperation(blaze::FalseType)12581 void OperationTest<MT1,MT2>::testBandOperation( blaze::FalseType )
12582 {}
12583 //*************************************************************************************************
12584
12585
12586 //*************************************************************************************************
12587 /*!\brief Testing the customized sparse matrix/dense matrix Kronecker product.
12588 //
12589 // \param op The custom operation to be tested.
12590 // \param name The human-readable name of the operation.
12591 // \return void
12592 // \exception std::runtime_error Kronecker product error detected.
12593 //
12594 // This function tests the matrix Kronecker product with plain assignment, addition assignment,
12595 // subtraction assignment, and Schur product assignment in combination with a custom operation.
12596 // In case any error resulting from the Kronecker product or the subsequent assignment is
12597 // detected, a \a std::runtime_error exception is thrown.
12598 */
12599 template< typename MT1 // Type of the left-hand side sparse matrix
12600 , typename MT2 > // Type of the right-hand side dense matrix
12601 template< typename OP > // Type of the custom operation
testCustomOperation(OP op,const std::string & name)12602 void OperationTest<MT1,MT2>::testCustomOperation( OP op, const std::string& name )
12603 {
12604 //=====================================================================================
12605 // Customized Kronecker product
12606 //=====================================================================================
12607
12608 // Customized Kronecker product with the given matrices
12609 {
12610 test_ = "Customized Kronecker product with the given matrices (" + name + ")";
12611 error_ = "Failed Kronecker product operation";
12612
12613 try {
12614 initResults();
12615 dres_ = op( kron( lhs_, rhs_ ) );
12616 odres_ = op( kron( lhs_, rhs_ ) );
12617 sres_ = op( kron( lhs_, rhs_ ) );
12618 osres_ = op( kron( lhs_, rhs_ ) );
12619 refres_ = op( kron( reflhs_, refrhs_ ) );
12620 }
12621 catch( std::exception& ex ) {
12622 convertException<MT1,MT2>( ex );
12623 }
12624
12625 checkResults<MT1,MT2>();
12626
12627 try {
12628 initResults();
12629 dres_ = op( kron( lhs_, orhs_ ) );
12630 odres_ = op( kron( lhs_, orhs_ ) );
12631 sres_ = op( kron( lhs_, orhs_ ) );
12632 osres_ = op( kron( lhs_, orhs_ ) );
12633 refres_ = op( kron( reflhs_, refrhs_ ) );
12634 }
12635 catch( std::exception& ex ) {
12636 convertException<MT1,OMT2>( ex );
12637 }
12638
12639 checkResults<MT1,OMT2>();
12640
12641 try {
12642 initResults();
12643 dres_ = op( kron( olhs_, rhs_ ) );
12644 odres_ = op( kron( olhs_, rhs_ ) );
12645 sres_ = op( kron( olhs_, rhs_ ) );
12646 osres_ = op( kron( olhs_, rhs_ ) );
12647 refres_ = op( kron( reflhs_, refrhs_ ) );
12648 }
12649 catch( std::exception& ex ) {
12650 convertException<OMT1,MT2>( ex );
12651 }
12652
12653 checkResults<OMT1,MT2>();
12654
12655 try {
12656 initResults();
12657 dres_ = op( kron( olhs_, orhs_ ) );
12658 odres_ = op( kron( olhs_, orhs_ ) );
12659 sres_ = op( kron( olhs_, orhs_ ) );
12660 osres_ = op( kron( olhs_, orhs_ ) );
12661 refres_ = op( kron( reflhs_, refrhs_ ) );
12662 }
12663 catch( std::exception& ex ) {
12664 convertException<OMT1,OMT2>( ex );
12665 }
12666
12667 checkResults<OMT1,OMT2>();
12668 }
12669
12670 // Customized Kronecker product with evaluated matrices
12671 {
12672 test_ = "Customized Kronecker product with evaluated matrices (" + name + ")";
12673 error_ = "Failed Kronecker product operation";
12674
12675 try {
12676 initResults();
12677 dres_ = op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12678 odres_ = op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12679 sres_ = op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12680 osres_ = op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12681 refres_ = op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12682 }
12683 catch( std::exception& ex ) {
12684 convertException<MT1,MT2>( ex );
12685 }
12686
12687 checkResults<MT1,MT2>();
12688
12689 try {
12690 initResults();
12691 dres_ = op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12692 odres_ = op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12693 sres_ = op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12694 osres_ = op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12695 refres_ = op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12696 }
12697 catch( std::exception& ex ) {
12698 convertException<MT1,OMT2>( ex );
12699 }
12700
12701 checkResults<MT1,OMT2>();
12702
12703 try {
12704 initResults();
12705 dres_ = op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12706 odres_ = op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12707 sres_ = op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12708 osres_ = op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12709 refres_ = op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12710 }
12711 catch( std::exception& ex ) {
12712 convertException<OMT1,MT2>( ex );
12713 }
12714
12715 checkResults<OMT1,MT2>();
12716
12717 try {
12718 initResults();
12719 dres_ = op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12720 odres_ = op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12721 sres_ = op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12722 osres_ = op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12723 refres_ = op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12724 }
12725 catch( std::exception& ex ) {
12726 convertException<OMT1,OMT2>( ex );
12727 }
12728
12729 checkResults<OMT1,OMT2>();
12730 }
12731
12732
12733 //=====================================================================================
12734 // Customized Kronecker product with addition assignment
12735 //=====================================================================================
12736
12737 // Customized Kronecker product with addition assignment with the given matrices
12738 {
12739 test_ = "Customized Kronecker product with addition assignment with the given matrices (" + name + ")";
12740 error_ = "Failed addition assignment operation";
12741
12742 try {
12743 initResults();
12744 dres_ += op( kron( lhs_, rhs_ ) );
12745 odres_ += op( kron( lhs_, rhs_ ) );
12746 sres_ += op( kron( lhs_, rhs_ ) );
12747 osres_ += op( kron( lhs_, rhs_ ) );
12748 refres_ += op( kron( reflhs_, refrhs_ ) );
12749 }
12750 catch( std::exception& ex ) {
12751 convertException<MT1,MT2>( ex );
12752 }
12753
12754 checkResults<MT1,MT2>();
12755
12756 try {
12757 initResults();
12758 dres_ += op( kron( lhs_, orhs_ ) );
12759 odres_ += op( kron( lhs_, orhs_ ) );
12760 sres_ += op( kron( lhs_, orhs_ ) );
12761 osres_ += op( kron( lhs_, orhs_ ) );
12762 refres_ += op( kron( reflhs_, refrhs_ ) );
12763 }
12764 catch( std::exception& ex ) {
12765 convertException<MT1,OMT2>( ex );
12766 }
12767
12768 checkResults<MT1,OMT2>();
12769
12770 try {
12771 initResults();
12772 dres_ += op( kron( olhs_, rhs_ ) );
12773 odres_ += op( kron( olhs_, rhs_ ) );
12774 sres_ += op( kron( olhs_, rhs_ ) );
12775 osres_ += op( kron( olhs_, rhs_ ) );
12776 refres_ += op( kron( reflhs_, refrhs_ ) );
12777 }
12778 catch( std::exception& ex ) {
12779 convertException<OMT1,MT2>( ex );
12780 }
12781
12782 checkResults<OMT1,MT2>();
12783
12784 try {
12785 initResults();
12786 dres_ += op( kron( olhs_, orhs_ ) );
12787 odres_ += op( kron( olhs_, orhs_ ) );
12788 sres_ += op( kron( olhs_, orhs_ ) );
12789 osres_ += op( kron( olhs_, orhs_ ) );
12790 refres_ += op( kron( reflhs_, refrhs_ ) );
12791 }
12792 catch( std::exception& ex ) {
12793 convertException<OMT1,OMT2>( ex );
12794 }
12795
12796 checkResults<OMT1,OMT2>();
12797 }
12798
12799 // Customized Kronecker product with addition assignment with evaluated matrices
12800 {
12801 test_ = "Customized Kronecker product with addition assignment with evaluated matrices (" + name + ")";
12802 error_ = "Failed addition assignment operation";
12803
12804 try {
12805 initResults();
12806 dres_ += op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12807 odres_ += op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12808 sres_ += op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12809 osres_ += op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12810 refres_ += op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12811 }
12812 catch( std::exception& ex ) {
12813 convertException<MT1,MT2>( ex );
12814 }
12815
12816 checkResults<MT1,MT2>();
12817
12818 try {
12819 initResults();
12820 dres_ += op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12821 odres_ += op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12822 sres_ += op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12823 osres_ += op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12824 refres_ += op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12825 }
12826 catch( std::exception& ex ) {
12827 convertException<MT1,OMT2>( ex );
12828 }
12829
12830 checkResults<MT1,OMT2>();
12831
12832 try {
12833 initResults();
12834 dres_ += op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12835 odres_ += op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12836 sres_ += op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12837 osres_ += op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12838 refres_ += op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12839 }
12840 catch( std::exception& ex ) {
12841 convertException<OMT1,MT2>( ex );
12842 }
12843
12844 checkResults<OMT1,MT2>();
12845
12846 try {
12847 initResults();
12848 dres_ += op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12849 odres_ += op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12850 sres_ += op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12851 osres_ += op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12852 refres_ += op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12853 }
12854 catch( std::exception& ex ) {
12855 convertException<OMT1,OMT2>( ex );
12856 }
12857
12858 checkResults<OMT1,OMT2>();
12859 }
12860
12861
12862 //=====================================================================================
12863 // Customized Kronecker product with subtraction assignment
12864 //=====================================================================================
12865
12866 // Customized Kronecker product with subtraction assignment with the given matrices
12867 {
12868 test_ = "Customized Kronecker product with subtraction assignment with the given matrices (" + name + ")";
12869 error_ = "Failed subtraction assignment operation";
12870
12871 try {
12872 initResults();
12873 dres_ -= op( kron( lhs_, rhs_ ) );
12874 odres_ -= op( kron( lhs_, rhs_ ) );
12875 sres_ -= op( kron( lhs_, rhs_ ) );
12876 osres_ -= op( kron( lhs_, rhs_ ) );
12877 refres_ -= op( kron( reflhs_, refrhs_ ) );
12878 }
12879 catch( std::exception& ex ) {
12880 convertException<MT1,MT2>( ex );
12881 }
12882
12883 checkResults<MT1,MT2>();
12884
12885 try {
12886 initResults();
12887 dres_ -= op( kron( lhs_, orhs_ ) );
12888 odres_ -= op( kron( lhs_, orhs_ ) );
12889 sres_ -= op( kron( lhs_, orhs_ ) );
12890 osres_ -= op( kron( lhs_, orhs_ ) );
12891 refres_ -= op( kron( reflhs_, refrhs_ ) );
12892 }
12893 catch( std::exception& ex ) {
12894 convertException<MT1,OMT2>( ex );
12895 }
12896
12897 checkResults<MT1,OMT2>();
12898
12899 try {
12900 initResults();
12901 dres_ -= op( kron( olhs_, rhs_ ) );
12902 odres_ -= op( kron( olhs_, rhs_ ) );
12903 sres_ -= op( kron( olhs_, rhs_ ) );
12904 osres_ -= op( kron( olhs_, rhs_ ) );
12905 refres_ -= op( kron( reflhs_, refrhs_ ) );
12906 }
12907 catch( std::exception& ex ) {
12908 convertException<OMT1,MT2>( ex );
12909 }
12910
12911 checkResults<OMT1,MT2>();
12912
12913 try {
12914 initResults();
12915 dres_ -= op( kron( olhs_, orhs_ ) );
12916 odres_ -= op( kron( olhs_, orhs_ ) );
12917 sres_ -= op( kron( olhs_, orhs_ ) );
12918 osres_ -= op( kron( olhs_, orhs_ ) );
12919 refres_ -= op( kron( reflhs_, refrhs_ ) );
12920 }
12921 catch( std::exception& ex ) {
12922 convertException<OMT1,OMT2>( ex );
12923 }
12924
12925 checkResults<OMT1,OMT2>();
12926 }
12927
12928 // Customized Kronecker product with subtraction assignment with evaluated matrices
12929 {
12930 test_ = "Customized Kronecker product with subtraction assignment with evaluated matrices (" + name + ")";
12931 error_ = "Failed subtraction assignment operation";
12932
12933 try {
12934 initResults();
12935 dres_ -= op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12936 odres_ -= op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12937 sres_ -= op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12938 osres_ -= op( kron( eval( lhs_ ), eval( rhs_ ) ) );
12939 refres_ -= op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12940 }
12941 catch( std::exception& ex ) {
12942 convertException<MT1,MT2>( ex );
12943 }
12944
12945 checkResults<MT1,MT2>();
12946
12947 try {
12948 initResults();
12949 dres_ -= op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12950 odres_ -= op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12951 sres_ -= op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12952 osres_ -= op( kron( eval( lhs_ ), eval( orhs_ ) ) );
12953 refres_ -= op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12954 }
12955 catch( std::exception& ex ) {
12956 convertException<MT1,OMT2>( ex );
12957 }
12958
12959 checkResults<MT1,OMT2>();
12960
12961 try {
12962 initResults();
12963 dres_ -= op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12964 odres_ -= op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12965 sres_ -= op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12966 osres_ -= op( kron( eval( olhs_ ), eval( rhs_ ) ) );
12967 refres_ -= op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12968 }
12969 catch( std::exception& ex ) {
12970 convertException<OMT1,MT2>( ex );
12971 }
12972
12973 checkResults<OMT1,MT2>();
12974
12975 try {
12976 initResults();
12977 dres_ -= op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12978 odres_ -= op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12979 sres_ -= op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12980 osres_ -= op( kron( eval( olhs_ ), eval( orhs_ ) ) );
12981 refres_ -= op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
12982 }
12983 catch( std::exception& ex ) {
12984 convertException<OMT1,OMT2>( ex );
12985 }
12986
12987 checkResults<OMT1,OMT2>();
12988 }
12989
12990
12991 //=====================================================================================
12992 // Customized Kronecker product with Schur product assignment
12993 //=====================================================================================
12994
12995 // Customized Kronecker product with Schur product assignment with the given matrices
12996 {
12997 test_ = "Customized Kronecker product with Schur product assignment with the given matrices (" + name + ")";
12998 error_ = "Failed Schur product assignment operation";
12999
13000 try {
13001 initResults();
13002 dres_ %= op( kron( lhs_, rhs_ ) );
13003 odres_ %= op( kron( lhs_, rhs_ ) );
13004 sres_ %= op( kron( lhs_, rhs_ ) );
13005 osres_ %= op( kron( lhs_, rhs_ ) );
13006 refres_ %= op( kron( reflhs_, refrhs_ ) );
13007 }
13008 catch( std::exception& ex ) {
13009 convertException<MT1,MT2>( ex );
13010 }
13011
13012 checkResults<MT1,MT2>();
13013
13014 try {
13015 initResults();
13016 dres_ %= op( kron( lhs_, orhs_ ) );
13017 odres_ %= op( kron( lhs_, orhs_ ) );
13018 sres_ %= op( kron( lhs_, orhs_ ) );
13019 osres_ %= op( kron( lhs_, orhs_ ) );
13020 refres_ %= op( kron( reflhs_, refrhs_ ) );
13021 }
13022 catch( std::exception& ex ) {
13023 convertException<MT1,OMT2>( ex );
13024 }
13025
13026 checkResults<MT1,OMT2>();
13027
13028 try {
13029 initResults();
13030 dres_ %= op( kron( olhs_, rhs_ ) );
13031 odres_ %= op( kron( olhs_, rhs_ ) );
13032 sres_ %= op( kron( olhs_, rhs_ ) );
13033 osres_ %= op( kron( olhs_, rhs_ ) );
13034 refres_ %= op( kron( reflhs_, refrhs_ ) );
13035 }
13036 catch( std::exception& ex ) {
13037 convertException<OMT1,MT2>( ex );
13038 }
13039
13040 checkResults<OMT1,MT2>();
13041
13042 try {
13043 initResults();
13044 dres_ %= op( kron( olhs_, orhs_ ) );
13045 odres_ %= op( kron( olhs_, orhs_ ) );
13046 sres_ %= op( kron( olhs_, orhs_ ) );
13047 osres_ %= op( kron( olhs_, orhs_ ) );
13048 refres_ %= op( kron( reflhs_, refrhs_ ) );
13049 }
13050 catch( std::exception& ex ) {
13051 convertException<OMT1,OMT2>( ex );
13052 }
13053
13054 checkResults<OMT1,OMT2>();
13055 }
13056
13057 // Customized Kronecker product with Schur product assignment with evaluated matrices
13058 {
13059 test_ = "Customized Kronecker product with Schur product assignment with evaluated matrices (" + name + ")";
13060 error_ = "Failed Schur product assignment operation";
13061
13062 try {
13063 initResults();
13064 dres_ %= op( kron( eval( lhs_ ), eval( rhs_ ) ) );
13065 odres_ %= op( kron( eval( lhs_ ), eval( rhs_ ) ) );
13066 sres_ %= op( kron( eval( lhs_ ), eval( rhs_ ) ) );
13067 osres_ %= op( kron( eval( lhs_ ), eval( rhs_ ) ) );
13068 refres_ %= op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
13069 }
13070 catch( std::exception& ex ) {
13071 convertException<MT1,MT2>( ex );
13072 }
13073
13074 checkResults<MT1,MT2>();
13075
13076 try {
13077 initResults();
13078 dres_ %= op( kron( eval( lhs_ ), eval( orhs_ ) ) );
13079 odres_ %= op( kron( eval( lhs_ ), eval( orhs_ ) ) );
13080 sres_ %= op( kron( eval( lhs_ ), eval( orhs_ ) ) );
13081 osres_ %= op( kron( eval( lhs_ ), eval( orhs_ ) ) );
13082 refres_ %= op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
13083 }
13084 catch( std::exception& ex ) {
13085 convertException<MT1,OMT2>( ex );
13086 }
13087
13088 checkResults<MT1,OMT2>();
13089
13090 try {
13091 initResults();
13092 dres_ %= op( kron( eval( olhs_ ), eval( rhs_ ) ) );
13093 odres_ %= op( kron( eval( olhs_ ), eval( rhs_ ) ) );
13094 sres_ %= op( kron( eval( olhs_ ), eval( rhs_ ) ) );
13095 osres_ %= op( kron( eval( olhs_ ), eval( rhs_ ) ) );
13096 refres_ %= op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
13097 }
13098 catch( std::exception& ex ) {
13099 convertException<OMT1,MT2>( ex );
13100 }
13101
13102 checkResults<OMT1,MT2>();
13103
13104 try {
13105 initResults();
13106 dres_ %= op( kron( eval( olhs_ ), eval( orhs_ ) ) );
13107 odres_ %= op( kron( eval( olhs_ ), eval( orhs_ ) ) );
13108 sres_ %= op( kron( eval( olhs_ ), eval( orhs_ ) ) );
13109 osres_ %= op( kron( eval( olhs_ ), eval( orhs_ ) ) );
13110 refres_ %= op( kron( eval( reflhs_ ), eval( refrhs_ ) ) );
13111 }
13112 catch( std::exception& ex ) {
13113 convertException<OMT1,OMT2>( ex );
13114 }
13115
13116 checkResults<OMT1,OMT2>();
13117 }
13118 }
13119 //*************************************************************************************************
13120
13121
13122
13123
13124 //=================================================================================================
13125 //
13126 // ERROR DETECTION FUNCTIONS
13127 //
13128 //=================================================================================================
13129
13130 //*************************************************************************************************
13131 /*!\brief Checking and comparing the computed results.
13132 //
13133 // \return void
13134 // \exception std::runtime_error Incorrect dense result detected.
13135 // \exception std::runtime_error Incorrect sparse result detected.
13136 //
13137 // This function is called after each test case to check and compare the computed results. The
13138 // two template arguments \a LT and \a RT indicate the types of the left-hand side and right-hand
13139 // side operands used for the computations.
13140 */
13141 template< typename MT1 // Type of the left-hand side sparse matrix
13142 , typename MT2 > // Type of the right-hand side dense matrix
13143 template< typename LT // Type of the left-hand side operand
13144 , typename RT > // Type of the right-hand side operand
checkResults()13145 void OperationTest<MT1,MT2>::checkResults()
13146 {
13147 using blaze::IsRowMajorMatrix;
13148
13149 if( !isEqual( dres_, refres_ ) || !isEqual( odres_, refres_ ) ) {
13150 std::ostringstream oss;
13151 oss.precision( 20 );
13152 oss << " Test : " << test_ << "\n"
13153 << " Error: Incorrect dense result detected\n"
13154 << " Details:\n"
13155 << " Random seed = " << blaze::getSeed() << "\n"
13156 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13157 << " " << typeid( LT ).name() << "\n"
13158 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
13159 << " " << typeid( RT ).name() << "\n"
13160 << " Result:\n" << dres_ << "\n"
13161 << " Result with opposite storage order:\n" << odres_ << "\n"
13162 << " Expected result:\n" << refres_ << "\n";
13163 throw std::runtime_error( oss.str() );
13164 }
13165
13166 if( !isEqual( sres_, refres_ ) || !isEqual( osres_, refres_ ) ) {
13167 std::ostringstream oss;
13168 oss.precision( 20 );
13169 oss << " Test : " << test_ << "\n"
13170 << " Error: Incorrect sparse result detected\n"
13171 << " Details:\n"
13172 << " Random seed = " << blaze::getSeed() << "\n"
13173 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13174 << " " << typeid( LT ).name() << "\n"
13175 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
13176 << " " << typeid( RT ).name() << "\n"
13177 << " Result:\n" << sres_ << "\n"
13178 << " Result with opposite storage order:\n" << osres_ << "\n"
13179 << " Expected result:\n" << refres_ << "\n";
13180 throw std::runtime_error( oss.str() );
13181 }
13182 }
13183 //*************************************************************************************************
13184
13185
13186 //*************************************************************************************************
13187 /*!\brief Checking and comparing the computed transpose results.
13188 //
13189 // \return void
13190 // \exception std::runtime_error Incorrect dense result detected.
13191 // \exception std::runtime_error Incorrect sparse result detected.
13192 //
13193 // This function is called after each test case to check and compare the computed transpose
13194 // results. The two template arguments \a LT and \a RT indicate the types of the left-hand
13195 // side and right-hand side operands used for the computations.
13196 */
13197 template< typename MT1 // Type of the left-hand side sparse matrix
13198 , typename MT2 > // Type of the right-hand side dense matrix
13199 template< typename LT // Type of the left-hand side operand
13200 , typename RT > // Type of the right-hand side operand
checkTransposeResults()13201 void OperationTest<MT1,MT2>::checkTransposeResults()
13202 {
13203 using blaze::IsRowMajorMatrix;
13204
13205 if( !isEqual( tdres_, refres_ ) || !isEqual( todres_, refres_ ) ) {
13206 std::ostringstream oss;
13207 oss.precision( 20 );
13208 oss << " Test : " << test_ << "\n"
13209 << " Error: Incorrect dense result detected\n"
13210 << " Details:\n"
13211 << " Random seed = " << blaze::getSeed() << "\n"
13212 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13213 << " " << typeid( LT ).name() << "\n"
13214 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
13215 << " " << typeid( RT ).name() << "\n"
13216 << " Transpose result:\n" << tdres_ << "\n"
13217 << " Transpose result with opposite storage order:\n" << todres_ << "\n"
13218 << " Expected result:\n" << refres_ << "\n";
13219 throw std::runtime_error( oss.str() );
13220 }
13221
13222 if( !isEqual( tsres_, refres_ ) || !isEqual( tosres_, refres_ ) ) {
13223 std::ostringstream oss;
13224 oss.precision( 20 );
13225 oss << " Test : " << test_ << "\n"
13226 << " Error: Incorrect sparse result detected\n"
13227 << " Details:\n"
13228 << " Random seed = " << blaze::getSeed() << "\n"
13229 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13230 << " " << typeid( LT ).name() << "\n"
13231 << " Right-hand side " << ( IsRowMajorMatrix<RT>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
13232 << " " << typeid( RT ).name() << "\n"
13233 << " Transpose result:\n" << tsres_ << "\n"
13234 << " Transpose result with opposite storage order:\n" << tosres_ << "\n"
13235 << " Expected result:\n" << refres_ << "\n";
13236 throw std::runtime_error( oss.str() );
13237 }
13238 }
13239 //*************************************************************************************************
13240
13241
13242 //*************************************************************************************************
13243 /*!\brief Checking and comparing the error message of the given exception.
13244 //
13245 // \param ex The exception to be checked.
13246 // \param message The expected error message.
13247 // \return void
13248 // \exception std::runtime_error Wrong error message.
13249 //
13250 // This function is called to check the error message of the given exception. In case the error
13251 // message does not correspond to the expected message, a \a std::runtime_error exception is
13252 // thrown.
13253 */
13254 template< typename MT1 // Type of the left-hand side sparse matrix
13255 , typename MT2 > // Type of the right-hand side dense matrix
checkExceptionMessage(const std::exception & ex,const std::string & message)13256 void OperationTest<MT1,MT2>::checkExceptionMessage( const std::exception& ex, const std::string& message )
13257 {
13258 if( ex.what() != message ) {
13259 std::ostringstream oss;
13260 oss << " Test: " << test_ << "\n"
13261 << " Error: Wrong error message\n"
13262 << " Details:\n"
13263 << " Error message: \"" << ex.what() << "\"\n"
13264 << " Expected error message: \"" << message << "\"\n";
13265 throw std::runtime_error( oss.str() );
13266 }
13267 }
13268 //*************************************************************************************************
13269
13270
13271
13272
13273 //=================================================================================================
13274 //
13275 // UTILITY FUNCTIONS
13276 //
13277 //=================================================================================================
13278
13279 //*************************************************************************************************
13280 /*!\brief Initializing the non-transpose result matrices.
13281 //
13282 // \return void
13283 //
13284 // This function is called before each non-transpose test case to initialize the according result
13285 // matrices to random values.
13286 */
13287 template< typename MT1 // Type of the left-hand side sparse matrix
13288 , typename MT2 > // Type of the right-hand side dense matrix
initResults()13289 void OperationTest<MT1,MT2>::initResults()
13290 {
13291 const blaze::UnderlyingBuiltin_t<DRE> min( randmin );
13292 const blaze::UnderlyingBuiltin_t<DRE> max( randmax );
13293
13294 resize( dres_, rows( lhs_ ) * rows( rhs_ ), columns( lhs_ ) * columns( rhs_ ) );
13295 randomize( dres_, min, max );
13296
13297 odres_ = dres_;
13298 sres_ = dres_;
13299 osres_ = dres_;
13300 refres_ = dres_;
13301 }
13302 //*************************************************************************************************
13303
13304
13305 //*************************************************************************************************
13306 /*!\brief Initializing the transpose result matrices.
13307 //
13308 // \return void
13309 //
13310 // This function is called before each transpose test case to initialize the according result
13311 // matrices to random values.
13312 */
13313 template< typename MT1 // Type of the left-hand side sparse matrix
13314 , typename MT2 > // Type of the right-hand side dense matrix
initTransposeResults()13315 void OperationTest<MT1,MT2>::initTransposeResults()
13316 {
13317 const blaze::UnderlyingBuiltin_t<TDRE> min( randmin );
13318 const blaze::UnderlyingBuiltin_t<TDRE> max( randmax );
13319
13320 resize( tdres_, columns( lhs_ ) * columns( rhs_ ), rows( lhs_ ) * rows( rhs_ ) );
13321 randomize( tdres_, min, max );
13322
13323 todres_ = tdres_;
13324 tsres_ = tdres_;
13325 tosres_ = tdres_;
13326 refres_ = tdres_;
13327 }
13328 //*************************************************************************************************
13329
13330
13331 //*************************************************************************************************
13332 /*!\brief Convert the given exception into a \a std::runtime_error exception.
13333 //
13334 // \param ex The \a std::exception to be extended.
13335 // \return void
13336 // \exception std::runtime_error The converted exception.
13337 //
13338 // This function converts the given exception to a \a std::runtime_error exception. Additionally,
13339 // the function extends the given exception message by all available information for the failed
13340 // test. The two template arguments \a LT and \a RT indicate the types of the left-hand side and
13341 // right-hand side operands used for the computations.
13342 */
13343 template< typename MT1 // Type of the left-hand side sparse matrix
13344 , typename MT2 > // Type of the right-hand side dense matrix
13345 template< typename LT // Type of the left-hand side operand
13346 , typename RT > // Type of the right-hand side operand
convertException(const std::exception & ex)13347 void OperationTest<MT1,MT2>::convertException( const std::exception& ex )
13348 {
13349 using blaze::IsRowMajorMatrix;
13350
13351 std::ostringstream oss;
13352 oss << " Test : " << test_ << "\n"
13353 << " Error: " << error_ << "\n"
13354 << " Details:\n"
13355 << " Random seed = " << blaze::getSeed() << "\n"
13356 << " Left-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " sparse matrix type:\n"
13357 << " " << typeid( LT ).name() << "\n"
13358 << " Right-hand side " << ( IsRowMajorMatrix<LT>::value ? ( "row-major" ) : ( "column-major" ) ) << " dense matrix type:\n"
13359 << " " << typeid( RT ).name() << "\n"
13360 << " Error message: " << ex.what() << "\n";
13361 throw std::runtime_error( oss.str() );
13362 }
13363 //*************************************************************************************************
13364
13365
13366
13367
13368 //=================================================================================================
13369 //
13370 // GLOBAL TEST FUNCTIONS
13371 //
13372 //=================================================================================================
13373
13374 //*************************************************************************************************
13375 /*!\brief Testing the matrix Kronecker product between two specific matrix types.
13376 //
13377 // \param creator1 The creator for the left-hand side matrix.
13378 // \param creator2 The creator for the right-hand side matrix.
13379 // \return void
13380 */
13381 template< typename MT1 // Type of the left-hand side sparse matrix
13382 , typename MT2 > // Type of the right-hand side dense matrix
runTest(const Creator<MT1> & creator1,const Creator<MT2> & creator2)13383 void runTest( const Creator<MT1>& creator1, const Creator<MT2>& creator2 )
13384 {
13385 #if BLAZETEST_MATHTEST_TEST_MULTIPLICATION
13386 if( BLAZETEST_MATHTEST_TEST_MULTIPLICATION > 1 )
13387 {
13388 for( size_t rep=0UL; rep<BLAZETEST_REPETITIONS; ++rep ) {
13389 OperationTest<MT1,MT2>( creator1, creator2 );
13390 }
13391 }
13392 #endif
13393 }
13394 //*************************************************************************************************
13395
13396
13397
13398
13399 //=================================================================================================
13400 //
13401 // MACROS
13402 //
13403 //=================================================================================================
13404
13405 //*************************************************************************************************
13406 /*! \cond BLAZE_INTERNAL */
13407 /*!\brief Macro for the definition of a sparse matrix/dense matrix Kronecker product test case.
13408 */
13409 #define DEFINE_SMATDMATKRON_OPERATION_TEST( MT1, MT2 ) \
13410 extern template class blazetest::mathtest::operations::smatdmatkron::OperationTest<MT1,MT2>
13411 /*! \endcond */
13412 //*************************************************************************************************
13413
13414
13415 //*************************************************************************************************
13416 /*! \cond BLAZE_INTERNAL */
13417 /*!\brief Macro for the execution of a sparse matrix/dense matrix Kronecker product test case.
13418 */
13419 #define RUN_SMATDMATKRON_OPERATION_TEST( C1, C2 ) \
13420 blazetest::mathtest::operations::smatdmatkron::runTest( C1, C2 )
13421 /*! \endcond */
13422 //*************************************************************************************************
13423
13424 } // namespace smatdmatkron
13425
13426 } // namespace operations
13427
13428 } // namespace mathtest
13429
13430 } // namespace blazetest
13431
13432 #endif
13433