1 //=================================================================================================
2 /*!
3 // \file blazetest/mathtest/adaptors/hermitianmatrix/SubmatrixComplexTest.h
4 // \brief Header file for the HermitianMatrix submatrix complex 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_ADAPTORS_HERMITIANMATRIX_SUBMATRIXCOMPLEXTEST_H_
36 #define _BLAZETEST_MATHTEST_ADAPTORS_HERMITIANMATRIX_SUBMATRIXCOMPLEXTEST_H_
37
38
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42
43 #include <sstream>
44 #include <stdexcept>
45 #include <string>
46 #include <blaze/math/CompressedMatrix.h>
47 #include <blaze/math/DynamicMatrix.h>
48 #include <blaze/math/HermitianMatrix.h>
49 #include <blaze/math/Submatrix.h>
50 #include <blaze/math/typetraits/IsRowMajorMatrix.h>
51 #include <blazetest/system/Types.h>
52
53
54 namespace blazetest {
55
56 namespace mathtest {
57
58 namespace adaptors {
59
60 namespace hermitianmatrix {
61
62 //=================================================================================================
63 //
64 // CLASS DEFINITION
65 //
66 //=================================================================================================
67
68 //*************************************************************************************************
69 /*!\brief Auxiliary class for assignment tests to a submatrix of a HermitianMatrix.
70 //
71 // This class performs assignment tests to a submatrix of a HermitianMatrix with complex element
72 // type. It performs a series of both compile time as well as runtime tests.
73 */
74 class SubmatrixComplexTest
75 {
76 private:
77 //**Type definitions****************************************************************************
78 //! Complex element type.
79 using cplx = blaze::complex<int>;
80
81 //! Type of the dense Hermitian matrix.
82 using DHT = blaze::HermitianMatrix< blaze::DynamicMatrix<cplx,blaze::rowMajor> >;
83
84 //! Opposite dense Hermitian matrix type.
85 using DOHT = DHT::OppositeType;
86
87 //! Type of the sparse Hermitian matrix.
88 using SHT = blaze::HermitianMatrix< blaze::CompressedMatrix<cplx,blaze::rowMajor> >;
89
90 //! Opposite sparse Hermitian matrix type.
91 using SOHT = SHT::OppositeType;
92 //**********************************************************************************************
93
94 public:
95 //**Constructors********************************************************************************
96 /*!\name Constructors */
97 //@{
98 explicit SubmatrixComplexTest();
99 // No explicitly declared copy constructor.
100 //@}
101 //**********************************************************************************************
102
103 //**Destructor**********************************************************************************
104 // No explicitly declared destructor.
105 //**********************************************************************************************
106
107 private:
108 //**Test functions******************************************************************************
109 /*!\name Test functions */
110 //@{
111 template< typename HT > void testAssignment ();
112 template< typename HT > void testAddAssign ();
113 template< typename HT > void testSubAssign ();
114 template< typename HT > void testSchurAssign();
115
116 template< typename Type >
117 void checkRows( const Type& matrix, size_t expectedRows ) const;
118
119 template< typename Type >
120 void checkColumns( const Type& matrix, size_t expectedColumns ) const;
121
122 template< typename Type >
123 void checkNonZeros( const Type& matrix, size_t expectedNonZeros ) const;
124 //@}
125 //**********************************************************************************************
126
127 //**Utility functions***************************************************************************
128 /*!\name Utility functions */
129 //@{
130 template< typename HT > void init( HT& herm );
131 //@}
132 //**********************************************************************************************
133
134 //**Member variables****************************************************************************
135 /*!\name Member variables */
136 //@{
137 std::string test_; //!< Label of the currently performed test.
138 //@}
139 //**********************************************************************************************
140 };
141 //*************************************************************************************************
142
143
144
145
146 //=================================================================================================
147 //
148 // TEST FUNCTIONS
149 //
150 //=================================================================================================
151
152 //*************************************************************************************************
153 /*!\brief Test of the assignment to a submatrix of a HermitianMatrix.
154 //
155 // \return void
156 // \exception std::runtime_error Error detected.
157 //
158 // This function performs a test of the assignment to a submatrix of a HermitianMatrix. In case an
159 // error is detected, a \a std::runtime_error exception is thrown.
160 */
161 template< typename HT > // Type of the Hermitian matrix
testAssignment()162 void SubmatrixComplexTest::testAssignment()
163 {
164 //=====================================================================================
165 // Dense matrix assignment
166 //=====================================================================================
167
168 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
169 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
170 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
171 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
172 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
173 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
174 {
175 test_ = "Dense matrix assignment test 1";
176
177 {
178 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
179 mat(0,0) = cplx(12, 0);
180 mat(0,1) = cplx(18,-1);
181 mat(0,2) = cplx(14,-2);
182 mat(0,3) = cplx(15,-3);
183 mat(1,0) = cplx(18, 1);
184 mat(1,1) = cplx(17, 0);
185 mat(1,2) = cplx(11,-1);
186 mat(1,3) = cplx(19,-2);
187
188 HT herm;
189 init( herm );
190
191 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
192 sm = mat;
193
194 checkRows ( herm, 6UL );
195 checkColumns ( herm, 6UL );
196 checkNonZeros( herm, 30UL );
197
198 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) || sm(0,2) != cplx(14,-2) || sm(0,3) != cplx(15,-3) ||
199 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,-2) ) {
200 std::ostringstream oss;
201 oss << " Test: " << test_ << "\n"
202 << " Error: Assignment to submatrix failed\n"
203 << " Details:\n"
204 << " Result:\n" << sm << "\n"
205 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) )\n"
206 "( (18,1) (17, 0) (11,-1) (19,-2) )\n";
207 throw std::runtime_error( oss.str() );
208 }
209
210 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
211 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
212 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
213 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
214 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
215 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
216 std::ostringstream oss;
217 oss << " Test: " << test_ << "\n"
218 << " Error: Assignment to submatrix failed\n"
219 << " Details:\n"
220 << " Result:\n" << herm << "\n"
221 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
222 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
223 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
224 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
225 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
226 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
227 throw std::runtime_error( oss.str() );
228 }
229 }
230
231 {
232 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
233 mat(0,0) = cplx(12, 0);
234 mat(0,1) = cplx(18,-1);
235 mat(1,0) = cplx(18, 1);
236 mat(1,1) = cplx(17, 0);
237 mat(2,0) = cplx(14, 2);
238 mat(2,1) = cplx(11, 1);
239 mat(3,0) = cplx(15, 3);
240 mat(3,1) = cplx(19, 2);
241
242 HT herm;
243 init( herm );
244
245 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
246 sm = mat;
247
248 checkRows ( herm, 6UL );
249 checkColumns ( herm, 6UL );
250 checkNonZeros( herm, 30UL );
251
252 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) ||
253 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) ||
254 sm(2,0) != cplx(14,2) || sm(2,1) != cplx(11, 1) ||
255 sm(3,0) != cplx(15,3) || sm(3,1) != cplx(19, 2) ) {
256 std::ostringstream oss;
257 oss << " Test: " << test_ << "\n"
258 << " Error: Assignment to submatrix failed\n"
259 << " Details:\n"
260 << " Result:\n" << sm << "\n"
261 << " Expected result:\n( (12,0) (18,-1) )\n"
262 "( (18,1) (17, 0) )\n"
263 "( (14,2) (11, 1) )\n"
264 "( (15,3) (19, 2) )\n";
265 throw std::runtime_error( oss.str() );
266 }
267
268 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
269 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
270 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
271 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
272 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
273 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
274 std::ostringstream oss;
275 oss << " Test: " << test_ << "\n"
276 << " Error: Assignment to submatrix failed\n"
277 << " Details:\n"
278 << " Result:\n" << herm << "\n"
279 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
280 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
281 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
282 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
283 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
284 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
285 throw std::runtime_error( oss.str() );
286 }
287 }
288 }
289
290 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
291 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
292 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
293 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )
294 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
295 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
296 {
297 test_ = "Dense matrix assignment test 2";
298
299 {
300 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
301 mat(0,0) = cplx(12,-1);
302 mat(0,1) = cplx(18, 0);
303 mat(0,2) = cplx(14, 2);
304 mat(0,3) = cplx(15,-3);
305 mat(1,0) = cplx(13,-2);
306 mat(1,1) = cplx(14,-2);
307 mat(1,2) = cplx(11, 0);
308 mat(1,3) = cplx(19, 1);
309
310 HT herm;
311 init( herm );
312
313 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
314 sm = mat;
315
316 checkRows ( herm, 6UL );
317 checkColumns ( herm, 6UL );
318 checkNonZeros( herm, 32UL );
319
320 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18, 0) || sm(0,2) != cplx(14,2) || sm(0,3) != cplx(15,-3) ||
321 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,-2) || sm(1,2) != cplx(11,0) || sm(1,3) != cplx(19, 1) ) {
322 std::ostringstream oss;
323 oss << " Test: " << test_ << "\n"
324 << " Error: Assignment to submatrix failed\n"
325 << " Details:\n"
326 << " Result:\n" << sm << "\n"
327 << " Expected result:\n( (12,-1) (18, 0) (14,2) (15,-3) )\n"
328 "( (13,-2) (14,-2) (11,0) (19, 1) )\n";
329 throw std::runtime_error( oss.str() );
330 }
331
332 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
333 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
334 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
335 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
336 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
337 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
338 std::ostringstream oss;
339 oss << " Test: " << test_ << "\n"
340 << " Error: Assignment to submatrix failed\n"
341 << " Details:\n"
342 << " Result:\n" << herm << "\n"
343 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
344 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
345 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
346 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
347 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
348 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
349 throw std::runtime_error( oss.str() );
350 }
351 }
352
353 {
354 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
355 mat(0,0) = cplx(12, 1);
356 mat(0,1) = cplx(13, 2);
357 mat(1,0) = cplx(18, 0);
358 mat(1,1) = cplx(14, 2);
359 mat(2,0) = cplx(14,-2);
360 mat(2,1) = cplx(11, 0);
361 mat(3,0) = cplx(15, 3);
362 mat(3,1) = cplx(19,-1);
363
364 HT herm;
365 init( herm );
366
367 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
368 sm = mat;
369
370 checkRows ( herm, 6UL );
371 checkColumns ( herm, 6UL );
372 checkNonZeros( herm, 32UL );
373
374 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13, 2) ||
375 sm(1,0) != cplx(18, 0) || sm(1,1) != cplx(14, 2) ||
376 sm(2,0) != cplx(14,-2) || sm(2,1) != cplx(11, 0) ||
377 sm(3,0) != cplx(15, 3) || sm(3,1) != cplx(19,-1) ) {
378 std::ostringstream oss;
379 oss << " Test: " << test_ << "\n"
380 << " Error: Assignment to submatrix failed\n"
381 << " Details:\n"
382 << " Result:\n" << sm << "\n"
383 << " Expected result:\n( (12, 1) (13, 2) )\n"
384 "( (18, 0) (14, 2) )\n"
385 "( (14,-2) (11, 0) )\n"
386 "( (15, 3) (19,-1) )\n";
387 throw std::runtime_error( oss.str() );
388 }
389
390 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
391 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
392 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
393 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
394 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
395 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
396 std::ostringstream oss;
397 oss << " Test: " << test_ << "\n"
398 << " Error: Assignment to submatrix failed\n"
399 << " Details:\n"
400 << " Result:\n" << herm << "\n"
401 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
402 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
403 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
404 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
405 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
406 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
407 throw std::runtime_error( oss.str() );
408 }
409 }
410 }
411
412 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
413 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
414 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
415 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
416 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
417 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )
418 {
419 test_ = "Dense matrix assignment test 3";
420
421 {
422 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
423 mat(0,0) = cplx(12,-1);
424 mat(0,1) = cplx(18, 1);
425 mat(0,2) = cplx(14, 0);
426 mat(0,3) = cplx(11, 1);
427 mat(1,0) = cplx(13,-2);
428 mat(1,1) = cplx(14, 0);
429 mat(1,2) = cplx(11,-1);
430 mat(1,3) = cplx(19, 0);
431
432 HT herm;
433 init( herm );
434
435 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
436 sm = mat;
437
438 checkRows ( herm, 6UL );
439 checkColumns ( herm, 6UL );
440 checkNonZeros( herm, 30UL );
441
442 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18,1) || sm(0,2) != cplx(14, 0) || sm(0,3) != cplx(11,1) ||
443 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,0) ) {
444 std::ostringstream oss;
445 oss << " Test: " << test_ << "\n"
446 << " Error: Assignment to submatrix failed\n"
447 << " Details:\n"
448 << " Result:\n" << sm << "\n"
449 << " Expected result:\n( (12,-1) (18,1) (14, 0) (11,1) )\n"
450 "( (13,-2) (14,0) (11,-1) (19,0) )\n";
451 throw std::runtime_error( oss.str() );
452 }
453
454 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
455 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
456 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
457 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
458 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
459 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
460 std::ostringstream oss;
461 oss << " Test: " << test_ << "\n"
462 << " Error: Assignment to submatrix failed\n"
463 << " Details:\n"
464 << " Result:\n" << herm << "\n"
465 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
466 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
467 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
468 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
469 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
470 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
471 throw std::runtime_error( oss.str() );
472 }
473 }
474
475 {
476 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
477 mat(0,0) = cplx(12, 1);
478 mat(0,1) = cplx(13, 2);
479 mat(1,0) = cplx(18,-1);
480 mat(1,1) = cplx(14, 0);
481 mat(2,0) = cplx(14, 0);
482 mat(2,1) = cplx(11, 1);
483 mat(3,0) = cplx(11,-1);
484 mat(3,1) = cplx(19, 0);
485
486 HT herm;
487 init( herm );
488
489 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
490 sm = mat;
491
492 checkRows ( herm, 6UL );
493 checkColumns ( herm, 6UL );
494 checkNonZeros( herm, 30UL );
495
496 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13,2) ||
497 sm(1,0) != cplx(18,-1) || sm(1,1) != cplx(14,0) ||
498 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,1) ||
499 sm(3,0) != cplx(11,-1) || sm(3,1) != cplx(19,0) ) {
500 std::ostringstream oss;
501 oss << " Test: " << test_ << "\n"
502 << " Error: Assignment to submatrix failed\n"
503 << " Details:\n"
504 << " Result:\n" << sm << "\n"
505 << " Expected result:\n( (12, 1) (13,2) )\n"
506 "( (18,-1) (14,0) )\n"
507 "( (14, 0) (11,1) )\n"
508 "( (11,-1) (19,0) )\n";
509 throw std::runtime_error( oss.str() );
510 }
511
512 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
513 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
514 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
515 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
516 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
517 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
518 std::ostringstream oss;
519 oss << " Test: " << test_ << "\n"
520 << " Error: Assignment to submatrix failed\n"
521 << " Details:\n"
522 << " Result:\n" << herm << "\n"
523 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
524 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
525 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
526 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
527 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
528 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
529 throw std::runtime_error( oss.str() );
530 }
531 }
532 }
533
534 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
535 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
536 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
537 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )
538 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
539 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
540 {
541 test_ = "Dense matrix assignment test 4";
542
543 {
544 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
545 mat(0,0) = cplx(12, 1);
546 mat(0,1) = cplx(18,-3);
547 mat(0,2) = cplx(14, 0);
548 mat(0,3) = cplx(11,-1);
549 mat(1,0) = cplx(13,-2);
550 mat(1,1) = cplx(14, 0);
551 mat(1,2) = cplx(11, 1);
552 mat(1,3) = cplx(19, 0);
553 mat(2,0) = cplx(19, 3);
554 mat(2,1) = cplx(11, 2);
555 mat(2,2) = cplx(12, 1);
556 mat(2,3) = cplx(14,-4);
557
558 HT herm;
559 init( herm );
560
561 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
562 sm = mat;
563
564 checkRows ( herm, 6UL );
565 checkColumns ( herm, 6UL );
566 checkNonZeros( herm, 32UL );
567
568 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(18,-3) || sm(0,2) != cplx(14,0) || sm(0,3) != cplx(11,-1) ||
569 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,1) || sm(1,3) != cplx(19, 0) ||
570 sm(2,0) != cplx(19, 3) || sm(2,1) != cplx(11, 2) || sm(2,2) != cplx(12,1) || sm(2,3) != cplx(14,-4) ) {
571 std::ostringstream oss;
572 oss << " Test: " << test_ << "\n"
573 << " Error: Assignment to submatrix failed\n"
574 << " Details:\n"
575 << " Result:\n" << sm << "\n"
576 << " Expected result:\n( (12, 1) (18,-3) (14, 0) (11,-1) )\n"
577 "( (13,-2) (14, 0) (11, 1) (19, 0) )\n"
578 "( (19, 3) (11, 2) (12, 1) (14,-4) )\n";
579 throw std::runtime_error( oss.str() );
580 }
581
582 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
583 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
584 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
585 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
586 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
587 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
588 std::ostringstream oss;
589 oss << " Test: " << test_ << "\n"
590 << " Error: Assignment to submatrix failed\n"
591 << " Details:\n"
592 << " Result:\n" << herm << "\n"
593 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
594 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
595 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
596 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
597 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
598 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
599 throw std::runtime_error( oss.str() );
600 }
601 }
602
603 {
604 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
605 mat(0,0) = cplx(12,-1);
606 mat(0,1) = cplx(13, 2);
607 mat(0,2) = cplx(19,-3);
608 mat(1,0) = cplx(18, 3);
609 mat(1,1) = cplx(14, 0);
610 mat(1,2) = cplx(11,-2);
611 mat(2,0) = cplx(14, 0);
612 mat(2,1) = cplx(11,-1);
613 mat(2,2) = cplx(12,-1);
614 mat(3,0) = cplx(11, 1);
615 mat(3,1) = cplx(19, 0);
616 mat(3,2) = cplx(14, 4);
617
618 HT herm;
619 init( herm );
620
621 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
622 sm = mat;
623
624 checkRows ( herm, 6UL );
625 checkColumns ( herm, 6UL );
626 checkNonZeros( herm, 32UL );
627
628 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(13, 2) || sm(0,2) != cplx(19,-3) ||
629 sm(1,0) != cplx(18, 3) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,-2) ||
630 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,-1) || sm(2,2) != cplx(12,-1) ||
631 sm(3,0) != cplx(11, 1) || sm(3,1) != cplx(19, 0) || sm(3,2) != cplx(14, 4) ) {
632 std::ostringstream oss;
633 oss << " Test: " << test_ << "\n"
634 << " Error: Assignment to submatrix failed\n"
635 << " Details:\n"
636 << " Result:\n" << sm << "\n"
637 << " Expected result:\n( (12,-1) (13, 2) (19,-3) )\n"
638 "( (18, 3) (14, 0) (11,-2) )\n"
639 "( (14, 0) (11,-1) (12,-1) )\n"
640 "( (11, 1) (19, 0) (14, 4) )\n";
641 throw std::runtime_error( oss.str() );
642 }
643
644 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
645 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
646 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
647 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
648 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
649 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
650 std::ostringstream oss;
651 oss << " Test: " << test_ << "\n"
652 << " Error: Assignment to submatrix failed\n"
653 << " Details:\n"
654 << " Result:\n" << herm << "\n"
655 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
656 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
657 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
658 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
659 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
660 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
661 throw std::runtime_error( oss.str() );
662 }
663 }
664 }
665
666 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
667 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (22,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
668 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
669 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
670 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
671 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
672 {
673 test_ = "Dense matrix assignment test 5";
674
675 {
676 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
677 mat(0,0) = cplx(12, 0);
678 mat(0,1) = cplx(18,-1);
679 mat(0,2) = cplx(14,-2);
680 mat(0,3) = cplx(15,-3);
681 mat(1,0) = cplx(22, 1);
682 mat(1,1) = cplx(17, 0);
683 mat(1,2) = cplx(11,-1);
684 mat(1,3) = cplx(19,-2);
685
686 HT herm;
687 init( herm );
688
689 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
690
691 try {
692 sm = mat;
693
694 std::ostringstream oss;
695 oss << " Test: " << test_ << "\n"
696 << " Error: Assignment of invalid matrix succeeded\n"
697 << " Details:\n"
698 << " Result:\n" << herm << "\n";
699 throw std::runtime_error( oss.str() );
700 }
701 catch( std::invalid_argument& ) {}
702 }
703
704 {
705 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
706 mat(0,0) = cplx(12, 0);
707 mat(0,1) = cplx(18,-1);
708 mat(1,0) = cplx(22, 1);
709 mat(1,1) = cplx(17, 0);
710 mat(2,0) = cplx(14, 2);
711 mat(2,1) = cplx(11, 1);
712 mat(3,0) = cplx(15, 3);
713 mat(3,1) = cplx(19, 2);
714
715 HT herm;
716 init( herm );
717
718 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
719
720 try {
721 sm = mat;
722
723 std::ostringstream oss;
724 oss << " Test: " << test_ << "\n"
725 << " Error: Assignment of invalid matrix succeeded\n"
726 << " Details:\n"
727 << " Result:\n" << herm << "\n";
728 throw std::runtime_error( oss.str() );
729 }
730 catch( std::invalid_argument& ) {}
731 }
732 }
733
734 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
735 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
736 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
737 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (22,-2) (11, 0) (19, 1) ( 0, 0) )
738 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
739 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
740 {
741 test_ = "Dense matrix assignment test 6";
742
743 {
744 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
745 mat(0,0) = cplx(12,-1);
746 mat(0,1) = cplx(18, 0);
747 mat(0,2) = cplx(14, 2);
748 mat(0,3) = cplx(15,-3);
749 mat(1,0) = cplx(13,-2);
750 mat(1,1) = cplx(22,-2);
751 mat(1,2) = cplx(11, 0);
752 mat(1,3) = cplx(19, 1);
753
754 HT herm;
755 init( herm );
756
757 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
758
759 try {
760 sm = mat;
761
762 std::ostringstream oss;
763 oss << " Test: " << test_ << "\n"
764 << " Error: Assignment of invalid matrix succeeded\n"
765 << " Details:\n"
766 << " Result:\n" << herm << "\n";
767 throw std::runtime_error( oss.str() );
768 }
769 catch( std::invalid_argument& ) {}
770 }
771
772 {
773 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
774 mat(0,0) = cplx(12, 1);
775 mat(0,1) = cplx(13, 2);
776 mat(1,0) = cplx(18, 0);
777 mat(1,1) = cplx(14, 2);
778 mat(2,0) = cplx(22,-2);
779 mat(2,1) = cplx(11, 0);
780 mat(3,0) = cplx(15, 3);
781 mat(3,1) = cplx(19,-1);
782
783 HT herm;
784 init( herm );
785
786 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
787
788 try {
789 sm = mat;
790
791 std::ostringstream oss;
792 oss << " Test: " << test_ << "\n"
793 << " Error: Assignment of invalid matrix succeeded\n"
794 << " Details:\n"
795 << " Result:\n" << herm << "\n";
796 throw std::runtime_error( oss.str() );
797 }
798 catch( std::invalid_argument& ) {}
799 }
800 }
801
802 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
803 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
804 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
805 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
806 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
807 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (22,-1) (19, 0) )
808 {
809 test_ = "Dense matrix assignment test 7";
810
811 {
812 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
813 mat(0,0) = cplx(12,-1);
814 mat(0,1) = cplx(18, 1);
815 mat(0,2) = cplx(14, 0);
816 mat(0,3) = cplx(11, 1);
817 mat(1,0) = cplx(13,-2);
818 mat(1,1) = cplx(14, 0);
819 mat(1,2) = cplx(22,-1);
820 mat(1,3) = cplx(19, 0);
821
822 HT herm;
823 init( herm );
824
825 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
826
827 try {
828 sm = mat;
829
830 std::ostringstream oss;
831 oss << " Test: " << test_ << "\n"
832 << " Error: Assignment of invalid matrix succeeded\n"
833 << " Details:\n"
834 << " Result:\n" << herm << "\n";
835 throw std::runtime_error( oss.str() );
836 }
837 catch( std::invalid_argument& ) {}
838 }
839
840 {
841 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
842 mat(0,0) = cplx(12, 1);
843 mat(0,1) = cplx(13, 2);
844 mat(1,0) = cplx(18,-1);
845 mat(1,1) = cplx(14, 0);
846 mat(2,0) = cplx(14, 0);
847 mat(2,1) = cplx(11, 1);
848 mat(3,0) = cplx(22,-1);
849 mat(3,1) = cplx(19, 0);
850
851 HT herm;
852 init( herm );
853
854 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
855
856 try {
857 sm = mat;
858
859 std::ostringstream oss;
860 oss << " Test: " << test_ << "\n"
861 << " Error: Assignment of invalid matrix succeeded\n"
862 << " Details:\n"
863 << " Result:\n" << herm << "\n";
864 throw std::runtime_error( oss.str() );
865 }
866 catch( std::invalid_argument& ) {}
867 }
868 }
869
870 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
871 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
872 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
873 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (22, 1) (19, 0) (14, 4) ( 0, 0) )
874 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
875 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
876 {
877 test_ = "Dense matrix assignment test 8";
878
879 {
880 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
881 mat(0,0) = cplx(12, 1);
882 mat(0,1) = cplx(18,-3);
883 mat(0,2) = cplx(14, 0);
884 mat(0,3) = cplx(11,-1);
885 mat(1,0) = cplx(13,-2);
886 mat(1,1) = cplx(14, 0);
887 mat(1,2) = cplx(22, 1);
888 mat(1,3) = cplx(19, 0);
889 mat(2,0) = cplx(19, 3);
890 mat(2,1) = cplx(11, 2);
891 mat(2,2) = cplx(12, 1);
892 mat(2,3) = cplx(14,-4);
893
894 HT herm;
895 init( herm );
896
897 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
898
899 try {
900 sm = mat;
901
902 std::ostringstream oss;
903 oss << " Test: " << test_ << "\n"
904 << " Error: Assignment of invalid matrix succeeded\n"
905 << " Details:\n"
906 << " Result:\n" << herm << "\n";
907 throw std::runtime_error( oss.str() );
908 }
909 catch( std::invalid_argument& ) {}
910 }
911
912 {
913 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
914 mat(0,0) = cplx(12,-1);
915 mat(0,1) = cplx(13, 2);
916 mat(0,2) = cplx(19,-3);
917 mat(1,0) = cplx(18, 3);
918 mat(1,1) = cplx(14, 0);
919 mat(1,2) = cplx(11,-2);
920 mat(2,0) = cplx(14, 0);
921 mat(2,1) = cplx(11,-1);
922 mat(2,2) = cplx(12,-1);
923 mat(3,0) = cplx(22, 1);
924 mat(3,1) = cplx(19, 0);
925 mat(3,2) = cplx(14, 4);
926
927 HT herm;
928 init( herm );
929
930 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
931
932 try {
933 sm = mat;
934
935 std::ostringstream oss;
936 oss << " Test: " << test_ << "\n"
937 << " Error: Assignment of invalid matrix succeeded\n"
938 << " Details:\n"
939 << " Result:\n" << herm << "\n";
940 throw std::runtime_error( oss.str() );
941 }
942 catch( std::invalid_argument& ) {}
943 }
944 }
945
946 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12, 0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
947 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,-1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
948 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14, 2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
949 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15, 3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
950 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
951 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
952 {
953 test_ = "Dense matrix assignment test 9";
954
955 {
956 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
957 mat(0,0) = cplx(12, 0);
958 mat(0,1) = cplx(18,-1);
959 mat(0,2) = cplx(14,-2);
960 mat(0,3) = cplx(15,-3);
961 mat(1,0) = cplx(18,-1);
962 mat(1,1) = cplx(17, 0);
963 mat(1,2) = cplx(11,-1);
964 mat(1,3) = cplx(19,-2);
965
966 HT herm;
967 init( herm );
968
969 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
970
971 try {
972 sm = mat;
973
974 std::ostringstream oss;
975 oss << " Test: " << test_ << "\n"
976 << " Error: Assignment of invalid matrix succeeded\n"
977 << " Details:\n"
978 << " Result:\n" << herm << "\n";
979 throw std::runtime_error( oss.str() );
980 }
981 catch( std::invalid_argument& ) {}
982 }
983
984 {
985 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
986 mat(0,0) = cplx(12, 0);
987 mat(0,1) = cplx(18,-1);
988 mat(1,0) = cplx(18,-1);
989 mat(1,1) = cplx(17, 0);
990 mat(2,0) = cplx(14, 2);
991 mat(2,1) = cplx(11, 1);
992 mat(3,0) = cplx(15, 3);
993 mat(3,1) = cplx(19, 2);
994
995 HT herm;
996 init( herm );
997
998 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
999
1000 try {
1001 sm = mat;
1002
1003 std::ostringstream oss;
1004 oss << " Test: " << test_ << "\n"
1005 << " Error: Assignment of invalid matrix succeeded\n"
1006 << " Details:\n"
1007 << " Result:\n" << herm << "\n";
1008 throw std::runtime_error( oss.str() );
1009 }
1010 catch( std::invalid_argument& ) {}
1011 }
1012 }
1013
1014 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7,3) (-2, 1) ( 5, 0) ( 0, 0) )
1015 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12,1) (13, 2) (-1, 2) ( 8,-2) )
1016 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18,0) (14, 2) (15,-3) (-2, 0) )
1017 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,2) (11, 0) (19, 1) ( 0, 0) )
1018 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15,3) (19,-1) ( 1, 0) (-4, 0) )
1019 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2,0) ( 0, 0) (-4, 0) ( 7, 0) )
1020 {
1021 test_ = "Dense matrix assignment test 10";
1022
1023 {
1024 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
1025 mat(0,0) = cplx(12,-1);
1026 mat(0,1) = cplx(18, 0);
1027 mat(0,2) = cplx(14, 2);
1028 mat(0,3) = cplx(15,-3);
1029 mat(1,0) = cplx(13,-2);
1030 mat(1,1) = cplx(14, 2);
1031 mat(1,2) = cplx(11, 0);
1032 mat(1,3) = cplx(19, 1);
1033
1034 HT herm;
1035 init( herm );
1036
1037 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
1038
1039 try {
1040 sm = mat;
1041
1042 std::ostringstream oss;
1043 oss << " Test: " << test_ << "\n"
1044 << " Error: Assignment of invalid matrix succeeded\n"
1045 << " Details:\n"
1046 << " Result:\n" << herm << "\n";
1047 throw std::runtime_error( oss.str() );
1048 }
1049 catch( std::invalid_argument& ) {}
1050 }
1051
1052 {
1053 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
1054 mat(0,0) = cplx(12, 1);
1055 mat(0,1) = cplx(13, 2);
1056 mat(1,0) = cplx(18, 0);
1057 mat(1,1) = cplx(14, 2);
1058 mat(2,0) = cplx(14, 2);
1059 mat(2,1) = cplx(11, 0);
1060 mat(3,0) = cplx(15, 3);
1061 mat(3,1) = cplx(19,-1);
1062
1063 HT herm;
1064 init( herm );
1065
1066 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
1067
1068 try {
1069 sm = mat;
1070
1071 std::ostringstream oss;
1072 oss << " Test: " << test_ << "\n"
1073 << " Error: Assignment of invalid matrix succeeded\n"
1074 << " Details:\n"
1075 << " Result:\n" << herm << "\n";
1076 throw std::runtime_error( oss.str() );
1077 }
1078 catch( std::invalid_argument& ) {}
1079 }
1080 }
1081
1082 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
1083 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
1084 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
1085 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
1086 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
1087 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11, 1) (19, 0) )
1088 {
1089 test_ = "Dense matrix assignment test 11";
1090
1091 {
1092 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
1093 mat(0,0) = cplx(12,-1);
1094 mat(0,1) = cplx(18, 1);
1095 mat(0,2) = cplx(14, 0);
1096 mat(0,3) = cplx(11, 1);
1097 mat(1,0) = cplx(13,-2);
1098 mat(1,1) = cplx(14, 0);
1099 mat(1,2) = cplx(11, 1);
1100 mat(1,3) = cplx(19, 0);
1101
1102 HT herm;
1103 init( herm );
1104
1105 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
1106
1107 try {
1108 sm = mat;
1109
1110 std::ostringstream oss;
1111 oss << " Test: " << test_ << "\n"
1112 << " Error: Assignment of invalid matrix succeeded\n"
1113 << " Details:\n"
1114 << " Result:\n" << herm << "\n";
1115 throw std::runtime_error( oss.str() );
1116 }
1117 catch( std::invalid_argument& ) {}
1118 }
1119
1120 {
1121 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
1122 mat(0,0) = cplx(12, 1);
1123 mat(0,1) = cplx(13, 2);
1124 mat(1,0) = cplx(18,-1);
1125 mat(1,1) = cplx(14, 0);
1126 mat(2,0) = cplx(14, 0);
1127 mat(2,1) = cplx(11, 1);
1128 mat(3,0) = cplx(11, 1);
1129 mat(3,1) = cplx(19, 0);
1130
1131 HT herm;
1132 init( herm );
1133
1134 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
1135
1136 try {
1137 sm = mat;
1138
1139 std::ostringstream oss;
1140 oss << " Test: " << test_ << "\n"
1141 << " Error: Assignment of invalid matrix succeeded\n"
1142 << " Details:\n"
1143 << " Result:\n" << herm << "\n";
1144 throw std::runtime_error( oss.str() );
1145 }
1146 catch( std::invalid_argument& ) {}
1147 }
1148 }
1149
1150 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
1151 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
1152 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
1153 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11,-1) (19, 0) (14, 4) ( 0, 0) )
1154 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
1155 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
1156 {
1157 test_ = "Dense matrix assignment test 12";
1158
1159 {
1160 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
1161 mat(0,0) = cplx(12, 1);
1162 mat(0,1) = cplx(18,-3);
1163 mat(0,2) = cplx(14, 0);
1164 mat(0,3) = cplx(11,-1);
1165 mat(1,0) = cplx(13,-2);
1166 mat(1,1) = cplx(14, 0);
1167 mat(1,2) = cplx(11,-1);
1168 mat(1,3) = cplx(19, 0);
1169 mat(2,0) = cplx(19, 3);
1170 mat(2,1) = cplx(11, 2);
1171 mat(2,2) = cplx(12, 1);
1172 mat(2,3) = cplx(14,-4);
1173
1174 HT herm;
1175 init( herm );
1176
1177 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
1178
1179 try {
1180 sm = mat;
1181
1182 std::ostringstream oss;
1183 oss << " Test: " << test_ << "\n"
1184 << " Error: Assignment of invalid matrix succeeded\n"
1185 << " Details:\n"
1186 << " Result:\n" << herm << "\n";
1187 throw std::runtime_error( oss.str() );
1188 }
1189 catch( std::invalid_argument& ) {}
1190 }
1191
1192 {
1193 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
1194 mat(0,0) = cplx(12,-1);
1195 mat(0,1) = cplx(13, 2);
1196 mat(0,2) = cplx(19,-3);
1197 mat(1,0) = cplx(18, 3);
1198 mat(1,1) = cplx(14, 0);
1199 mat(1,2) = cplx(11,-2);
1200 mat(2,0) = cplx(14, 0);
1201 mat(2,1) = cplx(11,-1);
1202 mat(2,2) = cplx(12,-1);
1203 mat(3,0) = cplx(11,-1);
1204 mat(3,1) = cplx(19, 0);
1205 mat(3,2) = cplx(14, 4);
1206
1207 HT herm;
1208 init( herm );
1209
1210 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
1211
1212 try {
1213 sm = mat;
1214
1215 std::ostringstream oss;
1216 oss << " Test: " << test_ << "\n"
1217 << " Error: Assignment of invalid matrix succeeded\n"
1218 << " Details:\n"
1219 << " Result:\n" << herm << "\n";
1220 throw std::runtime_error( oss.str() );
1221 }
1222 catch( std::invalid_argument& ) {}
1223 }
1224 }
1225
1226 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
1227 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 1) (11,-1) (19,-2) (-1,2) ( 8,-2) )
1228 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
1229 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
1230 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
1231 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
1232 {
1233 test_ = "Dense matrix assignment test 13";
1234
1235 {
1236 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
1237 mat(0,0) = cplx(12, 0);
1238 mat(0,1) = cplx(18,-1);
1239 mat(0,2) = cplx(14,-2);
1240 mat(0,3) = cplx(15,-3);
1241 mat(1,0) = cplx(18, 1);
1242 mat(1,1) = cplx(17, 1);
1243 mat(1,2) = cplx(11,-1);
1244 mat(1,3) = cplx(19,-2);
1245
1246 HT herm;
1247 init( herm );
1248
1249 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
1250
1251 try {
1252 sm = mat;
1253
1254 std::ostringstream oss;
1255 oss << " Test: " << test_ << "\n"
1256 << " Error: Assignment of invalid matrix succeeded\n"
1257 << " Details:\n"
1258 << " Result:\n" << herm << "\n";
1259 throw std::runtime_error( oss.str() );
1260 }
1261 catch( std::invalid_argument& ) {}
1262 }
1263
1264 {
1265 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
1266 mat(0,0) = cplx(12, 0);
1267 mat(0,1) = cplx(18,-1);
1268 mat(1,0) = cplx(18, 1);
1269 mat(1,1) = cplx(17, 1);
1270 mat(2,0) = cplx(14, 2);
1271 mat(2,1) = cplx(11, 1);
1272 mat(3,0) = cplx(15, 3);
1273 mat(3,1) = cplx(19, 2);
1274
1275 HT herm;
1276 init( herm );
1277
1278 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
1279
1280 try {
1281 sm = mat;
1282
1283 std::ostringstream oss;
1284 oss << " Test: " << test_ << "\n"
1285 << " Error: Assignment of invalid matrix succeeded\n"
1286 << " Details:\n"
1287 << " Result:\n" << herm << "\n";
1288 throw std::runtime_error( oss.str() );
1289 }
1290 catch( std::invalid_argument& ) {}
1291 }
1292 }
1293
1294 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
1295 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
1296 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
1297 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 1) (19, 1) ( 0, 0) )
1298 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
1299 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
1300 {
1301 test_ = "Dense matrix assignment test 14";
1302
1303 {
1304 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
1305 mat(0,0) = cplx(12,-1);
1306 mat(0,1) = cplx(18, 0);
1307 mat(0,2) = cplx(14, 2);
1308 mat(0,3) = cplx(15,-3);
1309 mat(1,0) = cplx(13,-2);
1310 mat(1,1) = cplx(14,-2);
1311 mat(1,2) = cplx(11, 1);
1312 mat(1,3) = cplx(19, 1);
1313
1314 HT herm;
1315 init( herm );
1316
1317 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
1318
1319 try {
1320 sm = mat;
1321
1322 std::ostringstream oss;
1323 oss << " Test: " << test_ << "\n"
1324 << " Error: Assignment of invalid matrix succeeded\n"
1325 << " Details:\n"
1326 << " Result:\n" << herm << "\n";
1327 throw std::runtime_error( oss.str() );
1328 }
1329 catch( std::invalid_argument& ) {}
1330 }
1331
1332 {
1333 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
1334 mat(0,0) = cplx(12, 1);
1335 mat(0,1) = cplx(13, 2);
1336 mat(1,0) = cplx(18, 0);
1337 mat(1,1) = cplx(14, 2);
1338 mat(2,0) = cplx(14,-2);
1339 mat(2,1) = cplx(11, 1);
1340 mat(3,0) = cplx(15, 3);
1341 mat(3,1) = cplx(19,-1);
1342
1343 HT herm;
1344 init( herm );
1345
1346 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
1347
1348 try {
1349 sm = mat;
1350
1351 std::ostringstream oss;
1352 oss << " Test: " << test_ << "\n"
1353 << " Error: Assignment of invalid matrix succeeded\n"
1354 << " Details:\n"
1355 << " Result:\n" << herm << "\n";
1356 throw std::runtime_error( oss.str() );
1357 }
1358 catch( std::invalid_argument& ) {}
1359 }
1360 }
1361
1362 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
1363 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
1364 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
1365 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
1366 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
1367 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 1) )
1368 {
1369 test_ = "Dense matrix assignment test 15";
1370
1371 {
1372 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
1373 mat(0,0) = cplx(12,-1);
1374 mat(0,1) = cplx(18, 1);
1375 mat(0,2) = cplx(14, 0);
1376 mat(0,3) = cplx(11,-1);
1377 mat(1,0) = cplx(13,-2);
1378 mat(1,1) = cplx(14, 0);
1379 mat(1,2) = cplx(11, 1);
1380 mat(1,3) = cplx(19, 1);
1381
1382 HT herm;
1383 init( herm );
1384
1385 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
1386
1387 try {
1388 sm = mat;
1389
1390 std::ostringstream oss;
1391 oss << " Test: " << test_ << "\n"
1392 << " Error: Assignment of invalid matrix succeeded\n"
1393 << " Details:\n"
1394 << " Result:\n" << herm << "\n";
1395 throw std::runtime_error( oss.str() );
1396 }
1397 catch( std::invalid_argument& ) {}
1398 }
1399
1400 {
1401 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
1402 mat(0,0) = cplx(12, 1);
1403 mat(0,1) = cplx(13, 2);
1404 mat(1,0) = cplx(18,-1);
1405 mat(1,1) = cplx(14, 0);
1406 mat(2,0) = cplx(14, 0);
1407 mat(2,1) = cplx(11, 1);
1408 mat(3,0) = cplx(11,-1);
1409 mat(3,1) = cplx(19, 1);
1410
1411 HT herm;
1412 init( herm );
1413
1414 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
1415
1416 try {
1417 sm = mat;
1418
1419 std::ostringstream oss;
1420 oss << " Test: " << test_ << "\n"
1421 << " Error: Assignment of invalid matrix succeeded\n"
1422 << " Details:\n"
1423 << " Result:\n" << herm << "\n";
1424 throw std::runtime_error( oss.str() );
1425 }
1426 catch( std::invalid_argument& ) {}
1427 }
1428 }
1429
1430 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
1431 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
1432 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
1433 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 1) (14, 4) ( 0, 0) )
1434 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
1435 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
1436 {
1437 test_ = "Dense matrix assignment test 16";
1438
1439 {
1440 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
1441 mat(0,0) = cplx(12, 1);
1442 mat(0,1) = cplx(18,-3);
1443 mat(0,2) = cplx(14, 0);
1444 mat(0,3) = cplx(11,-1);
1445 mat(1,0) = cplx(13,-2);
1446 mat(1,1) = cplx(14, 0);
1447 mat(1,2) = cplx(11, 1);
1448 mat(1,3) = cplx(19, 1);
1449 mat(2,0) = cplx(19, 3);
1450 mat(2,1) = cplx(11, 2);
1451 mat(2,2) = cplx(12, 1);
1452 mat(2,3) = cplx(14,-4);
1453
1454 HT herm;
1455 init( herm );
1456
1457 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
1458
1459 try {
1460 sm = mat;
1461
1462 std::ostringstream oss;
1463 oss << " Test: " << test_ << "\n"
1464 << " Error: Assignment of invalid matrix succeeded\n"
1465 << " Details:\n"
1466 << " Result:\n" << herm << "\n";
1467 throw std::runtime_error( oss.str() );
1468 }
1469 catch( std::invalid_argument& ) {}
1470 }
1471
1472 {
1473 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
1474 mat(0,0) = cplx(12,-1);
1475 mat(0,1) = cplx(13, 2);
1476 mat(0,2) = cplx(19,-3);
1477 mat(1,0) = cplx(18, 3);
1478 mat(1,1) = cplx(14, 0);
1479 mat(1,2) = cplx(11,-2);
1480 mat(2,0) = cplx(14, 0);
1481 mat(2,1) = cplx(11,-1);
1482 mat(2,2) = cplx(12,-1);
1483 mat(3,0) = cplx(11, 1);
1484 mat(3,1) = cplx(19, 1);
1485 mat(3,2) = cplx(14, 4);
1486
1487 HT herm;
1488 init( herm );
1489
1490 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
1491
1492 try {
1493 sm = mat;
1494
1495 std::ostringstream oss;
1496 oss << " Test: " << test_ << "\n"
1497 << " Error: Assignment of invalid matrix succeeded\n"
1498 << " Details:\n"
1499 << " Result:\n" << herm << "\n";
1500 throw std::runtime_error( oss.str() );
1501 }
1502 catch( std::invalid_argument& ) {}
1503 }
1504 }
1505
1506
1507 //=====================================================================================
1508 // Sparse matrix assignment
1509 //=====================================================================================
1510
1511 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
1512 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
1513 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
1514 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
1515 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
1516 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
1517 {
1518 test_ = "Sparse matrix assignment test 1";
1519
1520 {
1521 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
1522 mat(0,0) = cplx(12, 0);
1523 mat(0,1) = cplx(18,-1);
1524 mat(0,2) = cplx(14,-2);
1525 mat(0,3) = cplx(15,-3);
1526 mat(1,0) = cplx(18, 1);
1527 mat(1,1) = cplx(17, 0);
1528 mat(1,2) = cplx(11,-1);
1529 mat(1,3) = cplx(19,-2);
1530
1531 HT herm;
1532 init( herm );
1533
1534 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
1535 sm = mat;
1536
1537 checkRows ( herm, 6UL );
1538 checkColumns ( herm, 6UL );
1539 checkNonZeros( herm, 30UL );
1540
1541 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) || sm(0,2) != cplx(14,-2) || sm(0,3) != cplx(15,-3) ||
1542 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,-2) ) {
1543 std::ostringstream oss;
1544 oss << " Test: " << test_ << "\n"
1545 << " Error: Assignment to submatrix failed\n"
1546 << " Details:\n"
1547 << " Result:\n" << sm << "\n"
1548 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) )\n"
1549 "( (18,1) (17, 0) (11,-1) (19,-2) )\n";
1550 throw std::runtime_error( oss.str() );
1551 }
1552
1553 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
1554 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
1555 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
1556 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
1557 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
1558 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
1559 std::ostringstream oss;
1560 oss << " Test: " << test_ << "\n"
1561 << " Error: Assignment to submatrix failed\n"
1562 << " Details:\n"
1563 << " Result:\n" << herm << "\n"
1564 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
1565 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
1566 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
1567 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
1568 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
1569 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
1570 throw std::runtime_error( oss.str() );
1571 }
1572 }
1573
1574 {
1575 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
1576 mat(0,0) = cplx(12, 0);
1577 mat(0,1) = cplx(18,-1);
1578 mat(1,0) = cplx(18, 1);
1579 mat(1,1) = cplx(17, 0);
1580 mat(2,0) = cplx(14, 2);
1581 mat(2,1) = cplx(11, 1);
1582 mat(3,0) = cplx(15, 3);
1583 mat(3,1) = cplx(19, 2);
1584
1585 HT herm;
1586 init( herm );
1587
1588 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
1589 sm = mat;
1590
1591 checkRows ( herm, 6UL );
1592 checkColumns ( herm, 6UL );
1593 checkNonZeros( herm, 30UL );
1594
1595 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) ||
1596 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) ||
1597 sm(2,0) != cplx(14,2) || sm(2,1) != cplx(11, 1) ||
1598 sm(3,0) != cplx(15,3) || sm(3,1) != cplx(19, 2) ) {
1599 std::ostringstream oss;
1600 oss << " Test: " << test_ << "\n"
1601 << " Error: Assignment to submatrix failed\n"
1602 << " Details:\n"
1603 << " Result:\n" << sm << "\n"
1604 << " Expected result:\n( (12,0) (18,-1) )\n"
1605 "( (18,1) (17, 0) )\n"
1606 "( (14,2) (11, 1) )\n"
1607 "( (15,3) (19, 2) )\n";
1608 throw std::runtime_error( oss.str() );
1609 }
1610
1611 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
1612 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
1613 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
1614 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
1615 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
1616 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
1617 std::ostringstream oss;
1618 oss << " Test: " << test_ << "\n"
1619 << " Error: Assignment to submatrix failed\n"
1620 << " Details:\n"
1621 << " Result:\n" << herm << "\n"
1622 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
1623 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
1624 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
1625 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
1626 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
1627 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
1628 throw std::runtime_error( oss.str() );
1629 }
1630 }
1631 }
1632
1633 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
1634 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
1635 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
1636 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )
1637 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
1638 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
1639 {
1640 test_ = "Sparse matrix assignment test 2";
1641
1642 {
1643 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
1644 mat(0,0) = cplx(12,-1);
1645 mat(0,1) = cplx(18, 0);
1646 mat(0,2) = cplx(14, 2);
1647 mat(0,3) = cplx(15,-3);
1648 mat(1,0) = cplx(13,-2);
1649 mat(1,1) = cplx(14,-2);
1650 mat(1,2) = cplx(11, 0);
1651 mat(1,3) = cplx(19, 1);
1652
1653 HT herm;
1654 init( herm );
1655
1656 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
1657 sm = mat;
1658
1659 checkRows ( herm, 6UL );
1660 checkColumns ( herm, 6UL );
1661 checkNonZeros( herm, 32UL );
1662
1663 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18, 0) || sm(0,2) != cplx(14,2) || sm(0,3) != cplx(15,-3) ||
1664 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,-2) || sm(1,2) != cplx(11,0) || sm(1,3) != cplx(19, 1) ) {
1665 std::ostringstream oss;
1666 oss << " Test: " << test_ << "\n"
1667 << " Error: Assignment to submatrix failed\n"
1668 << " Details:\n"
1669 << " Result:\n" << sm << "\n"
1670 << " Expected result:\n( (12,-1) (18, 0) (14,2) (15,-3) )\n"
1671 "( (13,-2) (14,-2) (11,0) (19, 1) )\n";
1672 throw std::runtime_error( oss.str() );
1673 }
1674
1675 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
1676 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
1677 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
1678 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
1679 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
1680 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
1681 std::ostringstream oss;
1682 oss << " Test: " << test_ << "\n"
1683 << " Error: Assignment to submatrix failed\n"
1684 << " Details:\n"
1685 << " Result:\n" << herm << "\n"
1686 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
1687 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
1688 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
1689 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
1690 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
1691 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
1692 throw std::runtime_error( oss.str() );
1693 }
1694 }
1695
1696 {
1697 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
1698 mat(0,0) = cplx(12, 1);
1699 mat(0,1) = cplx(13, 2);
1700 mat(1,0) = cplx(18, 0);
1701 mat(1,1) = cplx(14, 2);
1702 mat(2,0) = cplx(14,-2);
1703 mat(2,1) = cplx(11, 0);
1704 mat(3,0) = cplx(15, 3);
1705 mat(3,1) = cplx(19,-1);
1706
1707 HT herm;
1708 init( herm );
1709
1710 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
1711 sm = mat;
1712
1713 checkRows ( herm, 6UL );
1714 checkColumns ( herm, 6UL );
1715 checkNonZeros( herm, 32UL );
1716
1717 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13, 2) ||
1718 sm(1,0) != cplx(18, 0) || sm(1,1) != cplx(14, 2) ||
1719 sm(2,0) != cplx(14,-2) || sm(2,1) != cplx(11, 0) ||
1720 sm(3,0) != cplx(15, 3) || sm(3,1) != cplx(19,-1) ) {
1721 std::ostringstream oss;
1722 oss << " Test: " << test_ << "\n"
1723 << " Error: Assignment to submatrix failed\n"
1724 << " Details:\n"
1725 << " Result:\n" << sm << "\n"
1726 << " Expected result:\n( (12, 1) (13, 2) )\n"
1727 "( (18, 0) (14, 2) )\n"
1728 "( (14,-2) (11, 0) )\n"
1729 "( (15, 3) (19,-1) )\n";
1730 throw std::runtime_error( oss.str() );
1731 }
1732
1733 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
1734 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
1735 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
1736 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
1737 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
1738 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
1739 std::ostringstream oss;
1740 oss << " Test: " << test_ << "\n"
1741 << " Error: Assignment to submatrix failed\n"
1742 << " Details:\n"
1743 << " Result:\n" << herm << "\n"
1744 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
1745 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
1746 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
1747 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
1748 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
1749 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
1750 throw std::runtime_error( oss.str() );
1751 }
1752 }
1753 }
1754
1755 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
1756 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
1757 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
1758 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
1759 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
1760 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )
1761 {
1762 test_ = "Sparse matrix assignment test 3";
1763
1764 {
1765 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
1766 mat(0,0) = cplx(12,-1);
1767 mat(0,1) = cplx(18, 1);
1768 mat(0,2) = cplx(14, 0);
1769 mat(0,3) = cplx(11, 1);
1770 mat(1,0) = cplx(13,-2);
1771 mat(1,1) = cplx(14, 0);
1772 mat(1,2) = cplx(11,-1);
1773 mat(1,3) = cplx(19, 0);
1774
1775 HT herm;
1776 init( herm );
1777
1778 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
1779 sm = mat;
1780
1781 checkRows ( herm, 6UL );
1782 checkColumns ( herm, 6UL );
1783 checkNonZeros( herm, 30UL );
1784
1785 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18,1) || sm(0,2) != cplx(14, 0) || sm(0,3) != cplx(11,1) ||
1786 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,0) ) {
1787 std::ostringstream oss;
1788 oss << " Test: " << test_ << "\n"
1789 << " Error: Assignment to submatrix failed\n"
1790 << " Details:\n"
1791 << " Result:\n" << sm << "\n"
1792 << " Expected result:\n( (12,-1) (18,1) (14, 0) (11,1) )\n"
1793 "( (13,-2) (14,0) (11,-1) (19,0) )\n";
1794 throw std::runtime_error( oss.str() );
1795 }
1796
1797 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
1798 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
1799 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
1800 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
1801 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
1802 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
1803 std::ostringstream oss;
1804 oss << " Test: " << test_ << "\n"
1805 << " Error: Assignment to submatrix failed\n"
1806 << " Details:\n"
1807 << " Result:\n" << herm << "\n"
1808 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
1809 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
1810 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
1811 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
1812 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
1813 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
1814 throw std::runtime_error( oss.str() );
1815 }
1816 }
1817
1818 {
1819 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
1820 mat(0,0) = cplx(12, 1);
1821 mat(0,1) = cplx(13, 2);
1822 mat(1,0) = cplx(18,-1);
1823 mat(1,1) = cplx(14, 0);
1824 mat(2,0) = cplx(14, 0);
1825 mat(2,1) = cplx(11, 1);
1826 mat(3,0) = cplx(11,-1);
1827 mat(3,1) = cplx(19, 0);
1828
1829 HT herm;
1830 init( herm );
1831
1832 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
1833 sm = mat;
1834
1835 checkRows ( herm, 6UL );
1836 checkColumns ( herm, 6UL );
1837 checkNonZeros( herm, 30UL );
1838
1839 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13,2) ||
1840 sm(1,0) != cplx(18,-1) || sm(1,1) != cplx(14,0) ||
1841 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,1) ||
1842 sm(3,0) != cplx(11,-1) || sm(3,1) != cplx(19,0) ) {
1843 std::ostringstream oss;
1844 oss << " Test: " << test_ << "\n"
1845 << " Error: Assignment to submatrix failed\n"
1846 << " Details:\n"
1847 << " Result:\n" << sm << "\n"
1848 << " Expected result:\n( (12, 1) (13,2) )\n"
1849 "( (18,-1) (14,0) )\n"
1850 "( (14, 0) (11,1) )\n"
1851 "( (11,-1) (19,0) )\n";
1852 throw std::runtime_error( oss.str() );
1853 }
1854
1855 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
1856 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
1857 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
1858 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
1859 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
1860 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
1861 std::ostringstream oss;
1862 oss << " Test: " << test_ << "\n"
1863 << " Error: Assignment to submatrix failed\n"
1864 << " Details:\n"
1865 << " Result:\n" << herm << "\n"
1866 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
1867 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
1868 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
1869 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
1870 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
1871 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
1872 throw std::runtime_error( oss.str() );
1873 }
1874 }
1875 }
1876
1877 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
1878 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
1879 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
1880 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )
1881 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
1882 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
1883 {
1884 test_ = "Sparse matrix assignment test 4";
1885
1886 {
1887 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
1888 mat(0,0) = cplx(12, 1);
1889 mat(0,1) = cplx(18,-3);
1890 mat(0,2) = cplx(14, 0);
1891 mat(0,3) = cplx(11,-1);
1892 mat(1,0) = cplx(13,-2);
1893 mat(1,1) = cplx(14, 0);
1894 mat(1,2) = cplx(11, 1);
1895 mat(1,3) = cplx(19, 0);
1896 mat(2,0) = cplx(19, 3);
1897 mat(2,1) = cplx(11, 2);
1898 mat(2,2) = cplx(12, 1);
1899 mat(2,3) = cplx(14,-4);
1900
1901 HT herm;
1902 init( herm );
1903
1904 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
1905 sm = mat;
1906
1907 checkRows ( herm, 6UL );
1908 checkColumns ( herm, 6UL );
1909 checkNonZeros( herm, 32UL );
1910
1911 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(18,-3) || sm(0,2) != cplx(14,0) || sm(0,3) != cplx(11,-1) ||
1912 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,1) || sm(1,3) != cplx(19, 0) ||
1913 sm(2,0) != cplx(19, 3) || sm(2,1) != cplx(11, 2) || sm(2,2) != cplx(12,1) || sm(2,3) != cplx(14,-4) ) {
1914 std::ostringstream oss;
1915 oss << " Test: " << test_ << "\n"
1916 << " Error: Assignment to submatrix failed\n"
1917 << " Details:\n"
1918 << " Result:\n" << sm << "\n"
1919 << " Expected result:\n( (12, 1) (18,-3) (14, 0) (11,-1) )\n"
1920 "( (13,-2) (14, 0) (11, 1) (19, 0) )\n"
1921 "( (19, 3) (11, 2) (12, 1) (14,-4) )\n";
1922 throw std::runtime_error( oss.str() );
1923 }
1924
1925 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
1926 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
1927 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
1928 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
1929 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
1930 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
1931 std::ostringstream oss;
1932 oss << " Test: " << test_ << "\n"
1933 << " Error: Assignment to submatrix failed\n"
1934 << " Details:\n"
1935 << " Result:\n" << herm << "\n"
1936 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
1937 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
1938 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
1939 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
1940 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
1941 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
1942 throw std::runtime_error( oss.str() );
1943 }
1944 }
1945
1946 {
1947 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
1948 mat(0,0) = cplx(12,-1);
1949 mat(0,1) = cplx(13, 2);
1950 mat(0,2) = cplx(19,-3);
1951 mat(1,0) = cplx(18, 3);
1952 mat(1,1) = cplx(14, 0);
1953 mat(1,2) = cplx(11,-2);
1954 mat(2,0) = cplx(14, 0);
1955 mat(2,1) = cplx(11,-1);
1956 mat(2,2) = cplx(12,-1);
1957 mat(3,0) = cplx(11, 1);
1958 mat(3,1) = cplx(19, 0);
1959 mat(3,2) = cplx(14, 4);
1960
1961 HT herm;
1962 init( herm );
1963
1964 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
1965 sm = mat;
1966
1967 checkRows ( herm, 6UL );
1968 checkColumns ( herm, 6UL );
1969 checkNonZeros( herm, 32UL );
1970
1971 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(13, 2) || sm(0,2) != cplx(19,-3) ||
1972 sm(1,0) != cplx(18, 3) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,-2) ||
1973 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,-1) || sm(2,2) != cplx(12,-1) ||
1974 sm(3,0) != cplx(11, 1) || sm(3,1) != cplx(19, 0) || sm(3,2) != cplx(14, 4) ) {
1975 std::ostringstream oss;
1976 oss << " Test: " << test_ << "\n"
1977 << " Error: Assignment to submatrix failed\n"
1978 << " Details:\n"
1979 << " Result:\n" << sm << "\n"
1980 << " Expected result:\n( (12,-1) (13, 2) (19,-3) )\n"
1981 "( (18, 3) (14, 0) (11,-2) )\n"
1982 "( (14, 0) (11,-1) (12,-1) )\n"
1983 "( (11, 1) (19, 0) (14, 4) )\n";
1984 throw std::runtime_error( oss.str() );
1985 }
1986
1987 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
1988 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
1989 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
1990 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
1991 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
1992 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
1993 std::ostringstream oss;
1994 oss << " Test: " << test_ << "\n"
1995 << " Error: Assignment to submatrix failed\n"
1996 << " Details:\n"
1997 << " Result:\n" << herm << "\n"
1998 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
1999 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
2000 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
2001 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
2002 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
2003 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
2004 throw std::runtime_error( oss.str() );
2005 }
2006 }
2007 }
2008
2009 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
2010 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (22,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
2011 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
2012 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
2013 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
2014 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
2015 {
2016 test_ = "Sparse matrix assignment test 5";
2017
2018 {
2019 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
2020 mat(0,0) = cplx(12, 0);
2021 mat(0,1) = cplx(18,-1);
2022 mat(0,2) = cplx(14,-2);
2023 mat(0,3) = cplx(15,-3);
2024 mat(1,0) = cplx(22, 1);
2025 mat(1,1) = cplx(17, 0);
2026 mat(1,2) = cplx(11,-1);
2027 mat(1,3) = cplx(19,-2);
2028
2029 HT herm;
2030 init( herm );
2031
2032 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
2033
2034 try {
2035 sm = mat;
2036
2037 std::ostringstream oss;
2038 oss << " Test: " << test_ << "\n"
2039 << " Error: Assignment of invalid matrix succeeded\n"
2040 << " Details:\n"
2041 << " Result:\n" << herm << "\n";
2042 throw std::runtime_error( oss.str() );
2043 }
2044 catch( std::invalid_argument& ) {}
2045 }
2046
2047 {
2048 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
2049 mat(0,0) = cplx(12, 0);
2050 mat(0,1) = cplx(18,-1);
2051 mat(1,0) = cplx(22, 1);
2052 mat(1,1) = cplx(17, 0);
2053 mat(2,0) = cplx(14, 2);
2054 mat(2,1) = cplx(11, 1);
2055 mat(3,0) = cplx(15, 3);
2056 mat(3,1) = cplx(19, 2);
2057
2058 HT herm;
2059 init( herm );
2060
2061 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
2062
2063 try {
2064 sm = mat;
2065
2066 std::ostringstream oss;
2067 oss << " Test: " << test_ << "\n"
2068 << " Error: Assignment of invalid matrix succeeded\n"
2069 << " Details:\n"
2070 << " Result:\n" << herm << "\n";
2071 throw std::runtime_error( oss.str() );
2072 }
2073 catch( std::invalid_argument& ) {}
2074 }
2075 }
2076
2077 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
2078 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
2079 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
2080 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (22,-2) (11, 0) (19, 1) ( 0, 0) )
2081 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
2082 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
2083 {
2084 test_ = "Sparse matrix assignment test 6";
2085
2086 {
2087 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
2088 mat(0,0) = cplx(12,-1);
2089 mat(0,1) = cplx(18, 0);
2090 mat(0,2) = cplx(14, 2);
2091 mat(0,3) = cplx(15,-3);
2092 mat(1,0) = cplx(13,-2);
2093 mat(1,1) = cplx(22,-2);
2094 mat(1,2) = cplx(11, 0);
2095 mat(1,3) = cplx(19, 1);
2096
2097 HT herm;
2098 init( herm );
2099
2100 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
2101
2102 try {
2103 sm = mat;
2104
2105 std::ostringstream oss;
2106 oss << " Test: " << test_ << "\n"
2107 << " Error: Assignment of invalid matrix succeeded\n"
2108 << " Details:\n"
2109 << " Result:\n" << herm << "\n";
2110 throw std::runtime_error( oss.str() );
2111 }
2112 catch( std::invalid_argument& ) {}
2113 }
2114
2115 {
2116 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
2117 mat(0,0) = cplx(12, 1);
2118 mat(0,1) = cplx(13, 2);
2119 mat(1,0) = cplx(18, 0);
2120 mat(1,1) = cplx(14, 2);
2121 mat(2,0) = cplx(22,-2);
2122 mat(2,1) = cplx(11, 0);
2123 mat(3,0) = cplx(15, 3);
2124 mat(3,1) = cplx(19,-1);
2125
2126 HT herm;
2127 init( herm );
2128
2129 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
2130
2131 try {
2132 sm = mat;
2133
2134 std::ostringstream oss;
2135 oss << " Test: " << test_ << "\n"
2136 << " Error: Assignment of invalid matrix succeeded\n"
2137 << " Details:\n"
2138 << " Result:\n" << herm << "\n";
2139 throw std::runtime_error( oss.str() );
2140 }
2141 catch( std::invalid_argument& ) {}
2142 }
2143 }
2144
2145 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
2146 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
2147 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
2148 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
2149 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
2150 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (22,-1) (19, 0) )
2151 {
2152 test_ = "Sparse matrix assignment test 7";
2153
2154 {
2155 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
2156 mat(0,0) = cplx(12,-1);
2157 mat(0,1) = cplx(18, 1);
2158 mat(0,2) = cplx(14, 0);
2159 mat(0,3) = cplx(11, 1);
2160 mat(1,0) = cplx(13,-2);
2161 mat(1,1) = cplx(14, 0);
2162 mat(1,2) = cplx(22,-1);
2163 mat(1,3) = cplx(19, 0);
2164
2165 HT herm;
2166 init( herm );
2167
2168 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
2169
2170 try {
2171 sm = mat;
2172
2173 std::ostringstream oss;
2174 oss << " Test: " << test_ << "\n"
2175 << " Error: Assignment of invalid matrix succeeded\n"
2176 << " Details:\n"
2177 << " Result:\n" << herm << "\n";
2178 throw std::runtime_error( oss.str() );
2179 }
2180 catch( std::invalid_argument& ) {}
2181 }
2182
2183 {
2184 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
2185 mat(0,0) = cplx(12, 1);
2186 mat(0,1) = cplx(13, 2);
2187 mat(1,0) = cplx(18,-1);
2188 mat(1,1) = cplx(14, 0);
2189 mat(2,0) = cplx(14, 0);
2190 mat(2,1) = cplx(11, 1);
2191 mat(3,0) = cplx(22,-1);
2192 mat(3,1) = cplx(19, 0);
2193
2194 HT herm;
2195 init( herm );
2196
2197 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
2198
2199 try {
2200 sm = mat;
2201
2202 std::ostringstream oss;
2203 oss << " Test: " << test_ << "\n"
2204 << " Error: Assignment of invalid matrix succeeded\n"
2205 << " Details:\n"
2206 << " Result:\n" << herm << "\n";
2207 throw std::runtime_error( oss.str() );
2208 }
2209 catch( std::invalid_argument& ) {}
2210 }
2211 }
2212
2213 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
2214 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
2215 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
2216 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (22, 1) (19, 0) (14, 4) ( 0, 0) )
2217 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
2218 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
2219 {
2220 test_ = "Sparse matrix assignment test 8";
2221
2222 {
2223 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
2224 mat(0,0) = cplx(12, 1);
2225 mat(0,1) = cplx(18,-3);
2226 mat(0,2) = cplx(14, 0);
2227 mat(0,3) = cplx(11,-1);
2228 mat(1,0) = cplx(13,-2);
2229 mat(1,1) = cplx(14, 0);
2230 mat(1,2) = cplx(22, 1);
2231 mat(1,3) = cplx(19, 0);
2232 mat(2,0) = cplx(19, 3);
2233 mat(2,1) = cplx(11, 2);
2234 mat(2,2) = cplx(12, 1);
2235 mat(2,3) = cplx(14,-4);
2236
2237 HT herm;
2238 init( herm );
2239
2240 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
2241
2242 try {
2243 sm = mat;
2244
2245 std::ostringstream oss;
2246 oss << " Test: " << test_ << "\n"
2247 << " Error: Assignment of invalid matrix succeeded\n"
2248 << " Details:\n"
2249 << " Result:\n" << herm << "\n";
2250 throw std::runtime_error( oss.str() );
2251 }
2252 catch( std::invalid_argument& ) {}
2253 }
2254
2255 {
2256 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
2257 mat(0,0) = cplx(12,-1);
2258 mat(0,1) = cplx(13, 2);
2259 mat(0,2) = cplx(19,-3);
2260 mat(1,0) = cplx(18, 3);
2261 mat(1,1) = cplx(14, 0);
2262 mat(1,2) = cplx(11,-2);
2263 mat(2,0) = cplx(14, 0);
2264 mat(2,1) = cplx(11,-1);
2265 mat(2,2) = cplx(12,-1);
2266 mat(3,0) = cplx(22, 1);
2267 mat(3,1) = cplx(19, 0);
2268 mat(3,2) = cplx(14, 4);
2269
2270 HT herm;
2271 init( herm );
2272
2273 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
2274
2275 try {
2276 sm = mat;
2277
2278 std::ostringstream oss;
2279 oss << " Test: " << test_ << "\n"
2280 << " Error: Assignment of invalid matrix succeeded\n"
2281 << " Details:\n"
2282 << " Result:\n" << herm << "\n";
2283 throw std::runtime_error( oss.str() );
2284 }
2285 catch( std::invalid_argument& ) {}
2286 }
2287 }
2288
2289 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12, 0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
2290 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,-1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
2291 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14, 2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
2292 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15, 3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
2293 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
2294 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
2295 {
2296 test_ = "Sparse matrix assignment test 9";
2297
2298 {
2299 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
2300 mat(0,0) = cplx(12, 0);
2301 mat(0,1) = cplx(18,-1);
2302 mat(0,2) = cplx(14,-2);
2303 mat(0,3) = cplx(15,-3);
2304 mat(1,0) = cplx(18,-1);
2305 mat(1,1) = cplx(17, 0);
2306 mat(1,2) = cplx(11,-1);
2307 mat(1,3) = cplx(19,-2);
2308
2309 HT herm;
2310 init( herm );
2311
2312 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
2313
2314 try {
2315 sm = mat;
2316
2317 std::ostringstream oss;
2318 oss << " Test: " << test_ << "\n"
2319 << " Error: Assignment of invalid matrix succeeded\n"
2320 << " Details:\n"
2321 << " Result:\n" << herm << "\n";
2322 throw std::runtime_error( oss.str() );
2323 }
2324 catch( std::invalid_argument& ) {}
2325 }
2326
2327 {
2328 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
2329 mat(0,0) = cplx(12, 0);
2330 mat(0,1) = cplx(18,-1);
2331 mat(1,0) = cplx(18,-1);
2332 mat(1,1) = cplx(17, 0);
2333 mat(2,0) = cplx(14, 2);
2334 mat(2,1) = cplx(11, 1);
2335 mat(3,0) = cplx(15, 3);
2336 mat(3,1) = cplx(19, 2);
2337
2338 HT herm;
2339 init( herm );
2340
2341 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
2342
2343 try {
2344 sm = mat;
2345
2346 std::ostringstream oss;
2347 oss << " Test: " << test_ << "\n"
2348 << " Error: Assignment of invalid matrix succeeded\n"
2349 << " Details:\n"
2350 << " Result:\n" << herm << "\n";
2351 throw std::runtime_error( oss.str() );
2352 }
2353 catch( std::invalid_argument& ) {}
2354 }
2355 }
2356
2357 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7,3) (-2, 1) ( 5, 0) ( 0, 0) )
2358 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12,1) (13, 2) (-1, 2) ( 8,-2) )
2359 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18,0) (14, 2) (15,-3) (-2, 0) )
2360 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,2) (11, 0) (19, 1) ( 0, 0) )
2361 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15,3) (19,-1) ( 1, 0) (-4, 0) )
2362 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2,0) ( 0, 0) (-4, 0) ( 7, 0) )
2363 {
2364 test_ = "Sparse matrix assignment test 10";
2365
2366 {
2367 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
2368 mat(0,0) = cplx(12,-1);
2369 mat(0,1) = cplx(18, 0);
2370 mat(0,2) = cplx(14, 2);
2371 mat(0,3) = cplx(15,-3);
2372 mat(1,0) = cplx(13,-2);
2373 mat(1,1) = cplx(14, 2);
2374 mat(1,2) = cplx(11, 0);
2375 mat(1,3) = cplx(19, 1);
2376
2377 HT herm;
2378 init( herm );
2379
2380 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
2381
2382 try {
2383 sm = mat;
2384
2385 std::ostringstream oss;
2386 oss << " Test: " << test_ << "\n"
2387 << " Error: Assignment of invalid matrix succeeded\n"
2388 << " Details:\n"
2389 << " Result:\n" << herm << "\n";
2390 throw std::runtime_error( oss.str() );
2391 }
2392 catch( std::invalid_argument& ) {}
2393 }
2394
2395 {
2396 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
2397 mat(0,0) = cplx(12, 1);
2398 mat(0,1) = cplx(13, 2);
2399 mat(1,0) = cplx(18, 0);
2400 mat(1,1) = cplx(14, 2);
2401 mat(2,0) = cplx(14, 2);
2402 mat(2,1) = cplx(11, 0);
2403 mat(3,0) = cplx(15, 3);
2404 mat(3,1) = cplx(19,-1);
2405
2406 HT herm;
2407 init( herm );
2408
2409 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
2410
2411 try {
2412 sm = mat;
2413
2414 std::ostringstream oss;
2415 oss << " Test: " << test_ << "\n"
2416 << " Error: Assignment of invalid matrix succeeded\n"
2417 << " Details:\n"
2418 << " Result:\n" << herm << "\n";
2419 throw std::runtime_error( oss.str() );
2420 }
2421 catch( std::invalid_argument& ) {}
2422 }
2423 }
2424
2425 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
2426 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
2427 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
2428 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
2429 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
2430 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11, 1) (19, 0) )
2431 {
2432 test_ = "Sparse matrix assignment test 11";
2433
2434 {
2435 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
2436 mat(0,0) = cplx(12,-1);
2437 mat(0,1) = cplx(18, 1);
2438 mat(0,2) = cplx(14, 0);
2439 mat(0,3) = cplx(11, 1);
2440 mat(1,0) = cplx(13,-2);
2441 mat(1,1) = cplx(14, 0);
2442 mat(1,2) = cplx(11, 1);
2443 mat(1,3) = cplx(19, 0);
2444
2445 HT herm;
2446 init( herm );
2447
2448 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
2449
2450 try {
2451 sm = mat;
2452
2453 std::ostringstream oss;
2454 oss << " Test: " << test_ << "\n"
2455 << " Error: Assignment of invalid matrix succeeded\n"
2456 << " Details:\n"
2457 << " Result:\n" << herm << "\n";
2458 throw std::runtime_error( oss.str() );
2459 }
2460 catch( std::invalid_argument& ) {}
2461 }
2462
2463 {
2464 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
2465 mat(0,0) = cplx(12, 1);
2466 mat(0,1) = cplx(13, 2);
2467 mat(1,0) = cplx(18,-1);
2468 mat(1,1) = cplx(14, 0);
2469 mat(2,0) = cplx(14, 0);
2470 mat(2,1) = cplx(11, 1);
2471 mat(3,0) = cplx(11, 1);
2472 mat(3,1) = cplx(19, 0);
2473
2474 HT herm;
2475 init( herm );
2476
2477 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
2478
2479 try {
2480 sm = mat;
2481
2482 std::ostringstream oss;
2483 oss << " Test: " << test_ << "\n"
2484 << " Error: Assignment of invalid matrix succeeded\n"
2485 << " Details:\n"
2486 << " Result:\n" << herm << "\n";
2487 throw std::runtime_error( oss.str() );
2488 }
2489 catch( std::invalid_argument& ) {}
2490 }
2491 }
2492
2493 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
2494 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
2495 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
2496 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11,-1) (19, 0) (14, 4) ( 0, 0) )
2497 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
2498 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
2499 {
2500 test_ = "Sparse matrix assignment test 12";
2501
2502 {
2503 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
2504 mat(0,0) = cplx(12, 1);
2505 mat(0,1) = cplx(18,-3);
2506 mat(0,2) = cplx(14, 0);
2507 mat(0,3) = cplx(11,-1);
2508 mat(1,0) = cplx(13,-2);
2509 mat(1,1) = cplx(14, 0);
2510 mat(1,2) = cplx(11,-1);
2511 mat(1,3) = cplx(19, 0);
2512 mat(2,0) = cplx(19, 3);
2513 mat(2,1) = cplx(11, 2);
2514 mat(2,2) = cplx(12, 1);
2515 mat(2,3) = cplx(14,-4);
2516
2517 HT herm;
2518 init( herm );
2519
2520 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
2521
2522 try {
2523 sm = mat;
2524
2525 std::ostringstream oss;
2526 oss << " Test: " << test_ << "\n"
2527 << " Error: Assignment of invalid matrix succeeded\n"
2528 << " Details:\n"
2529 << " Result:\n" << herm << "\n";
2530 throw std::runtime_error( oss.str() );
2531 }
2532 catch( std::invalid_argument& ) {}
2533 }
2534
2535 {
2536 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
2537 mat(0,0) = cplx(12,-1);
2538 mat(0,1) = cplx(13, 2);
2539 mat(0,2) = cplx(19,-3);
2540 mat(1,0) = cplx(18, 3);
2541 mat(1,1) = cplx(14, 0);
2542 mat(1,2) = cplx(11,-2);
2543 mat(2,0) = cplx(14, 0);
2544 mat(2,1) = cplx(11,-1);
2545 mat(2,2) = cplx(12,-1);
2546 mat(3,0) = cplx(11,-1);
2547 mat(3,1) = cplx(19, 0);
2548 mat(3,2) = cplx(14, 4);
2549
2550 HT herm;
2551 init( herm );
2552
2553 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
2554
2555 try {
2556 sm = mat;
2557
2558 std::ostringstream oss;
2559 oss << " Test: " << test_ << "\n"
2560 << " Error: Assignment of invalid matrix succeeded\n"
2561 << " Details:\n"
2562 << " Result:\n" << herm << "\n";
2563 throw std::runtime_error( oss.str() );
2564 }
2565 catch( std::invalid_argument& ) {}
2566 }
2567 }
2568
2569 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
2570 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 1) (11,-1) (19,-2) (-1,2) ( 8,-2) )
2571 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
2572 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
2573 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
2574 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
2575 {
2576 test_ = "Sparse matrix assignment test 13";
2577
2578 {
2579 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
2580 mat(0,0) = cplx(12, 0);
2581 mat(0,1) = cplx(18,-1);
2582 mat(0,2) = cplx(14,-2);
2583 mat(0,3) = cplx(15,-3);
2584 mat(1,0) = cplx(18, 1);
2585 mat(1,1) = cplx(17, 1);
2586 mat(1,2) = cplx(11,-1);
2587 mat(1,3) = cplx(19,-2);
2588
2589 HT herm;
2590 init( herm );
2591
2592 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
2593
2594 try {
2595 sm = mat;
2596
2597 std::ostringstream oss;
2598 oss << " Test: " << test_ << "\n"
2599 << " Error: Assignment of invalid matrix succeeded\n"
2600 << " Details:\n"
2601 << " Result:\n" << herm << "\n";
2602 throw std::runtime_error( oss.str() );
2603 }
2604 catch( std::invalid_argument& ) {}
2605 }
2606
2607 {
2608 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
2609 mat(0,0) = cplx(12, 0);
2610 mat(0,1) = cplx(18,-1);
2611 mat(1,0) = cplx(18, 1);
2612 mat(1,1) = cplx(17, 1);
2613 mat(2,0) = cplx(14, 2);
2614 mat(2,1) = cplx(11, 1);
2615 mat(3,0) = cplx(15, 3);
2616 mat(3,1) = cplx(19, 2);
2617
2618 HT herm;
2619 init( herm );
2620
2621 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
2622
2623 try {
2624 sm = mat;
2625
2626 std::ostringstream oss;
2627 oss << " Test: " << test_ << "\n"
2628 << " Error: Assignment of invalid matrix succeeded\n"
2629 << " Details:\n"
2630 << " Result:\n" << herm << "\n";
2631 throw std::runtime_error( oss.str() );
2632 }
2633 catch( std::invalid_argument& ) {}
2634 }
2635 }
2636
2637 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
2638 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
2639 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
2640 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 1) (19, 1) ( 0, 0) )
2641 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
2642 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
2643 {
2644 test_ = "Sparse matrix assignment test 14";
2645
2646 {
2647 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
2648 mat(0,0) = cplx(12,-1);
2649 mat(0,1) = cplx(18, 0);
2650 mat(0,2) = cplx(14, 2);
2651 mat(0,3) = cplx(15,-3);
2652 mat(1,0) = cplx(13,-2);
2653 mat(1,1) = cplx(14,-2);
2654 mat(1,2) = cplx(11, 1);
2655 mat(1,3) = cplx(19, 1);
2656
2657 HT herm;
2658 init( herm );
2659
2660 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
2661
2662 try {
2663 sm = mat;
2664
2665 std::ostringstream oss;
2666 oss << " Test: " << test_ << "\n"
2667 << " Error: Assignment of invalid matrix succeeded\n"
2668 << " Details:\n"
2669 << " Result:\n" << herm << "\n";
2670 throw std::runtime_error( oss.str() );
2671 }
2672 catch( std::invalid_argument& ) {}
2673 }
2674
2675 {
2676 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
2677 mat(0,0) = cplx(12, 1);
2678 mat(0,1) = cplx(13, 2);
2679 mat(1,0) = cplx(18, 0);
2680 mat(1,1) = cplx(14, 2);
2681 mat(2,0) = cplx(14,-2);
2682 mat(2,1) = cplx(11, 1);
2683 mat(3,0) = cplx(15, 3);
2684 mat(3,1) = cplx(19,-1);
2685
2686 HT herm;
2687 init( herm );
2688
2689 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
2690
2691 try {
2692 sm = mat;
2693
2694 std::ostringstream oss;
2695 oss << " Test: " << test_ << "\n"
2696 << " Error: Assignment of invalid matrix succeeded\n"
2697 << " Details:\n"
2698 << " Result:\n" << herm << "\n";
2699 throw std::runtime_error( oss.str() );
2700 }
2701 catch( std::invalid_argument& ) {}
2702 }
2703 }
2704
2705 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
2706 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
2707 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
2708 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
2709 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
2710 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 1) )
2711 {
2712 test_ = "Sparse matrix assignment test 15";
2713
2714 {
2715 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
2716 mat(0,0) = cplx(12,-1);
2717 mat(0,1) = cplx(18, 1);
2718 mat(0,2) = cplx(14, 0);
2719 mat(0,3) = cplx(11,-1);
2720 mat(1,0) = cplx(13,-2);
2721 mat(1,1) = cplx(14, 0);
2722 mat(1,2) = cplx(11, 1);
2723 mat(1,3) = cplx(19, 1);
2724
2725 HT herm;
2726 init( herm );
2727
2728 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
2729
2730 try {
2731 sm = mat;
2732
2733 std::ostringstream oss;
2734 oss << " Test: " << test_ << "\n"
2735 << " Error: Assignment of invalid matrix succeeded\n"
2736 << " Details:\n"
2737 << " Result:\n" << herm << "\n";
2738 throw std::runtime_error( oss.str() );
2739 }
2740 catch( std::invalid_argument& ) {}
2741 }
2742
2743 {
2744 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
2745 mat(0,0) = cplx(12, 1);
2746 mat(0,1) = cplx(13, 2);
2747 mat(1,0) = cplx(18,-1);
2748 mat(1,1) = cplx(14, 0);
2749 mat(2,0) = cplx(14, 0);
2750 mat(2,1) = cplx(11, 1);
2751 mat(3,0) = cplx(11,-1);
2752 mat(3,1) = cplx(19, 1);
2753
2754 HT herm;
2755 init( herm );
2756
2757 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
2758
2759 try {
2760 sm = mat;
2761
2762 std::ostringstream oss;
2763 oss << " Test: " << test_ << "\n"
2764 << " Error: Assignment of invalid matrix succeeded\n"
2765 << " Details:\n"
2766 << " Result:\n" << herm << "\n";
2767 throw std::runtime_error( oss.str() );
2768 }
2769 catch( std::invalid_argument& ) {}
2770 }
2771 }
2772
2773 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
2774 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
2775 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
2776 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 1) (14, 4) ( 0, 0) )
2777 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
2778 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
2779 {
2780 test_ = "Sparse matrix assignment test 16";
2781
2782 {
2783 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
2784 mat(0,0) = cplx(12, 1);
2785 mat(0,1) = cplx(18,-3);
2786 mat(0,2) = cplx(14, 0);
2787 mat(0,3) = cplx(11,-1);
2788 mat(1,0) = cplx(13,-2);
2789 mat(1,1) = cplx(14, 0);
2790 mat(1,2) = cplx(11, 1);
2791 mat(1,3) = cplx(19, 1);
2792 mat(2,0) = cplx(19, 3);
2793 mat(2,1) = cplx(11, 2);
2794 mat(2,2) = cplx(12, 1);
2795 mat(2,3) = cplx(14,-4);
2796
2797 HT herm;
2798 init( herm );
2799
2800 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
2801
2802 try {
2803 sm = mat;
2804
2805 std::ostringstream oss;
2806 oss << " Test: " << test_ << "\n"
2807 << " Error: Assignment of invalid matrix succeeded\n"
2808 << " Details:\n"
2809 << " Result:\n" << herm << "\n";
2810 throw std::runtime_error( oss.str() );
2811 }
2812 catch( std::invalid_argument& ) {}
2813 }
2814
2815 {
2816 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
2817 mat(0,0) = cplx(12,-1);
2818 mat(0,1) = cplx(13, 2);
2819 mat(0,2) = cplx(19,-3);
2820 mat(1,0) = cplx(18, 3);
2821 mat(1,1) = cplx(14, 0);
2822 mat(1,2) = cplx(11,-2);
2823 mat(2,0) = cplx(14, 0);
2824 mat(2,1) = cplx(11,-1);
2825 mat(2,2) = cplx(12,-1);
2826 mat(3,0) = cplx(11, 1);
2827 mat(3,1) = cplx(19, 1);
2828 mat(3,2) = cplx(14, 4);
2829
2830 HT herm;
2831 init( herm );
2832
2833 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
2834
2835 try {
2836 sm = mat;
2837
2838 std::ostringstream oss;
2839 oss << " Test: " << test_ << "\n"
2840 << " Error: Assignment of invalid matrix succeeded\n"
2841 << " Details:\n"
2842 << " Result:\n" << herm << "\n";
2843 throw std::runtime_error( oss.str() );
2844 }
2845 catch( std::invalid_argument& ) {}
2846 }
2847 }
2848 }
2849 //*************************************************************************************************
2850
2851
2852 //*************************************************************************************************
2853 /*!\brief Test of the addition assignment to a submatrix of a HermitianMatrix.
2854 //
2855 // \return void
2856 // \exception std::runtime_error Error detected.
2857 //
2858 // This function performs a test of the addition assignment to a submatrix of a HermitianMatrix.
2859 // In case an error is detected, a \a std::runtime_error exception is thrown.
2860 */
2861 template< typename HT > // Type of the Hermitian matrix
testAddAssign()2862 void SubmatrixComplexTest::testAddAssign()
2863 {
2864 //=====================================================================================
2865 // Dense matrix addition assignment
2866 //=====================================================================================
2867
2868 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
2869 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
2870 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
2871 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
2872 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
2873 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
2874 {
2875 test_ = "Dense matrix addition assignment test 1";
2876
2877 {
2878 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
2879 mat(0,0) = cplx(11, 0);
2880 mat(0,1) = cplx(22, 0);
2881 mat(0,2) = cplx( 7,-5);
2882 mat(0,3) = cplx(17,-4);
2883 mat(1,0) = cplx(22, 0);
2884 mat(1,1) = cplx(15, 0);
2885 mat(1,2) = cplx(11,-1);
2886 mat(1,3) = cplx(19,-2);
2887
2888 HT herm;
2889 init( herm );
2890
2891 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
2892 sm += mat;
2893
2894 checkRows ( herm, 6UL );
2895 checkColumns ( herm, 6UL );
2896 checkNonZeros( herm, 30UL );
2897
2898 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) || sm(0,2) != cplx(14,-2) || sm(0,3) != cplx(15,-3) ||
2899 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,-2) ) {
2900 std::ostringstream oss;
2901 oss << " Test: " << test_ << "\n"
2902 << " Error: Assignment to submatrix failed\n"
2903 << " Details:\n"
2904 << " Result:\n" << sm << "\n"
2905 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) )\n"
2906 "( (18,1) (17, 0) (11,-1) (19,-2) )\n";
2907 throw std::runtime_error( oss.str() );
2908 }
2909
2910 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
2911 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
2912 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
2913 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
2914 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
2915 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
2916 std::ostringstream oss;
2917 oss << " Test: " << test_ << "\n"
2918 << " Error: Assignment to submatrix failed\n"
2919 << " Details:\n"
2920 << " Result:\n" << herm << "\n"
2921 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
2922 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
2923 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
2924 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
2925 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
2926 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
2927 throw std::runtime_error( oss.str() );
2928 }
2929 }
2930
2931 {
2932 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
2933 mat(0,0) = cplx(11,0);
2934 mat(0,1) = cplx(22,0);
2935 mat(1,0) = cplx(22,0);
2936 mat(1,1) = cplx(15,0);
2937 mat(2,0) = cplx( 7,5);
2938 mat(2,1) = cplx(11,1);
2939 mat(3,0) = cplx(17,4);
2940 mat(3,1) = cplx(19,2);
2941
2942 HT herm;
2943 init( herm );
2944
2945 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
2946 sm += mat;
2947
2948 checkRows ( herm, 6UL );
2949 checkColumns ( herm, 6UL );
2950 checkNonZeros( herm, 30UL );
2951
2952 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) ||
2953 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) ||
2954 sm(2,0) != cplx(14,2) || sm(2,1) != cplx(11, 1) ||
2955 sm(3,0) != cplx(15,3) || sm(3,1) != cplx(19, 2) ) {
2956 std::ostringstream oss;
2957 oss << " Test: " << test_ << "\n"
2958 << " Error: Assignment to submatrix failed\n"
2959 << " Details:\n"
2960 << " Result:\n" << sm << "\n"
2961 << " Expected result:\n( (12,0) (18,-1) )\n"
2962 "( (18,1) (17, 0) )\n"
2963 "( (14,2) (11, 1) )\n"
2964 "( (15,3) (19, 2) )\n";
2965 throw std::runtime_error( oss.str() );
2966 }
2967
2968 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
2969 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
2970 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
2971 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
2972 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
2973 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
2974 std::ostringstream oss;
2975 oss << " Test: " << test_ << "\n"
2976 << " Error: Assignment to submatrix failed\n"
2977 << " Details:\n"
2978 << " Result:\n" << herm << "\n"
2979 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
2980 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
2981 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
2982 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
2983 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
2984 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
2985 throw std::runtime_error( oss.str() );
2986 }
2987 }
2988 }
2989
2990 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
2991 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
2992 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
2993 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )
2994 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
2995 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
2996 {
2997 test_ = "Dense matrix addition assignment test 2";
2998
2999 {
3000 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
3001 mat(0,0) = cplx(12,-1);
3002 mat(0,1) = cplx(15, 0);
3003 mat(0,2) = cplx(13, 1);
3004 mat(0,3) = cplx(15,-3);
3005 mat(1,0) = cplx(13,-2);
3006 mat(1,1) = cplx(13,-1);
3007 mat(1,2) = cplx( 6, 0);
3008 mat(1,3) = cplx(12, 0);
3009
3010 HT herm;
3011 init( herm );
3012
3013 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
3014 sm += mat;
3015
3016 checkRows ( herm, 6UL );
3017 checkColumns ( herm, 6UL );
3018 checkNonZeros( herm, 32UL );
3019
3020 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18, 0) || sm(0,2) != cplx(14,2) || sm(0,3) != cplx(15,-3) ||
3021 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,-2) || sm(1,2) != cplx(11,0) || sm(1,3) != cplx(19, 1) ) {
3022 std::ostringstream oss;
3023 oss << " Test: " << test_ << "\n"
3024 << " Error: Assignment to submatrix failed\n"
3025 << " Details:\n"
3026 << " Result:\n" << sm << "\n"
3027 << " Expected result:\n( (12,-1) (18, 0) (14,2) (15,-3) )\n"
3028 "( (13,-2) (14,-2) (11,0) (19, 1) )\n";
3029 throw std::runtime_error( oss.str() );
3030 }
3031
3032 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
3033 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
3034 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
3035 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
3036 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
3037 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
3038 std::ostringstream oss;
3039 oss << " Test: " << test_ << "\n"
3040 << " Error: Assignment to submatrix failed\n"
3041 << " Details:\n"
3042 << " Result:\n" << herm << "\n"
3043 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
3044 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
3045 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
3046 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
3047 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
3048 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
3049 throw std::runtime_error( oss.str() );
3050 }
3051 }
3052
3053 {
3054 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
3055 mat(0,0) = cplx(12, 1);
3056 mat(0,1) = cplx(13, 2);
3057 mat(1,0) = cplx(15, 0);
3058 mat(1,1) = cplx(13, 1);
3059 mat(2,0) = cplx(13,-1);
3060 mat(2,1) = cplx( 6, 0);
3061 mat(3,0) = cplx(15, 3);
3062 mat(3,1) = cplx(12, 0);
3063
3064 HT herm;
3065 init( herm );
3066
3067 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
3068 sm += mat;
3069
3070 checkRows ( herm, 6UL );
3071 checkColumns ( herm, 6UL );
3072 checkNonZeros( herm, 32UL );
3073
3074 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13, 2) ||
3075 sm(1,0) != cplx(18, 0) || sm(1,1) != cplx(14, 2) ||
3076 sm(2,0) != cplx(14,-2) || sm(2,1) != cplx(11, 0) ||
3077 sm(3,0) != cplx(15, 3) || sm(3,1) != cplx(19,-1) ) {
3078 std::ostringstream oss;
3079 oss << " Test: " << test_ << "\n"
3080 << " Error: Assignment to submatrix failed\n"
3081 << " Details:\n"
3082 << " Result:\n" << sm << "\n"
3083 << " Expected result:\n( (12, 1) (13, 2) )\n"
3084 "( (18, 0) (14, 2) )\n"
3085 "( (14,-2) (11, 0) )\n"
3086 "( (15, 3) (19,-1) )\n";
3087 throw std::runtime_error( oss.str() );
3088 }
3089
3090 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
3091 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
3092 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
3093 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
3094 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
3095 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
3096 std::ostringstream oss;
3097 oss << " Test: " << test_ << "\n"
3098 << " Error: Assignment to submatrix failed\n"
3099 << " Details:\n"
3100 << " Result:\n" << herm << "\n"
3101 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
3102 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
3103 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
3104 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
3105 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
3106 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
3107 throw std::runtime_error( oss.str() );
3108 }
3109 }
3110 }
3111
3112 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
3113 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
3114 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
3115 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
3116 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
3117 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )
3118 {
3119 test_ = "Dense matrix addition assignment test 3";
3120
3121 {
3122 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
3123 mat(0,0) = cplx(12,-1);
3124 mat(0,1) = cplx(11, 2);
3125 mat(0,2) = cplx(13, 0);
3126 mat(0,3) = cplx(15, 1);
3127 mat(1,0) = cplx(15,-2);
3128 mat(1,1) = cplx(14, 0);
3129 mat(1,2) = cplx(15,-1);
3130 mat(1,3) = cplx(12, 0);
3131
3132 HT herm;
3133 init( herm );
3134
3135 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
3136 sm += mat;
3137
3138 checkRows ( herm, 6UL );
3139 checkColumns ( herm, 6UL );
3140 checkNonZeros( herm, 30UL );
3141
3142 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18,1) || sm(0,2) != cplx(14, 0) || sm(0,3) != cplx(11,1) ||
3143 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,0) ) {
3144 std::ostringstream oss;
3145 oss << " Test: " << test_ << "\n"
3146 << " Error: Assignment to submatrix failed\n"
3147 << " Details:\n"
3148 << " Result:\n" << sm << "\n"
3149 << " Expected result:\n( (12,-1) (18,1) (14, 0) (11,1) )\n"
3150 "( (13,-2) (14,0) (11,-1) (19,0) )\n";
3151 throw std::runtime_error( oss.str() );
3152 }
3153
3154 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
3155 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
3156 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
3157 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
3158 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
3159 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
3160 std::ostringstream oss;
3161 oss << " Test: " << test_ << "\n"
3162 << " Error: Assignment to submatrix failed\n"
3163 << " Details:\n"
3164 << " Result:\n" << herm << "\n"
3165 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
3166 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
3167 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
3168 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
3169 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
3170 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
3171 throw std::runtime_error( oss.str() );
3172 }
3173 }
3174
3175 {
3176 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
3177 mat(0,0) = cplx(12, 1);
3178 mat(0,1) = cplx(15, 2);
3179 mat(1,0) = cplx(11,-2);
3180 mat(1,1) = cplx(14, 0);
3181 mat(2,0) = cplx(13, 0);
3182 mat(2,1) = cplx(15, 1);
3183 mat(3,0) = cplx(15,-1);
3184 mat(3,1) = cplx(12, 0);
3185
3186 HT herm;
3187 init( herm );
3188
3189 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
3190 sm += mat;
3191
3192 checkRows ( herm, 6UL );
3193 checkColumns ( herm, 6UL );
3194 checkNonZeros( herm, 30UL );
3195
3196 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13,2) ||
3197 sm(1,0) != cplx(18,-1) || sm(1,1) != cplx(14,0) ||
3198 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,1) ||
3199 sm(3,0) != cplx(11,-1) || sm(3,1) != cplx(19,0) ) {
3200 std::ostringstream oss;
3201 oss << " Test: " << test_ << "\n"
3202 << " Error: Assignment to submatrix failed\n"
3203 << " Details:\n"
3204 << " Result:\n" << sm << "\n"
3205 << " Expected result:\n( (12, 1) (13,2) )\n"
3206 "( (18,-1) (14,0) )\n"
3207 "( (14, 0) (11,1) )\n"
3208 "( (11,-1) (19,0) )\n";
3209 throw std::runtime_error( oss.str() );
3210 }
3211
3212 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
3213 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
3214 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
3215 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
3216 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
3217 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
3218 std::ostringstream oss;
3219 oss << " Test: " << test_ << "\n"
3220 << " Error: Assignment to submatrix failed\n"
3221 << " Details:\n"
3222 << " Result:\n" << herm << "\n"
3223 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
3224 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
3225 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
3226 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
3227 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
3228 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
3229 throw std::runtime_error( oss.str() );
3230 }
3231 }
3232 }
3233
3234 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
3235 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
3236 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
3237 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )
3238 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
3239 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
3240 {
3241 test_ = "Dense matrix addition assignment test 4";
3242
3243 {
3244 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
3245 mat(0,0) = cplx( 5, 4);
3246 mat(0,1) = cplx(18,-3);
3247 mat(0,2) = cplx(11, 0);
3248 mat(0,3) = cplx(10,-2);
3249 mat(1,0) = cplx(15,-1);
3250 mat(1,1) = cplx(14, 0);
3251 mat(1,2) = cplx(10, 2);
3252 mat(1,3) = cplx(14, 0);
3253 mat(2,0) = cplx(14, 3);
3254 mat(2,1) = cplx(12, 4);
3255 mat(2,2) = cplx(12, 1);
3256 mat(2,3) = cplx( 7,-3);
3257
3258 HT herm;
3259 init( herm );
3260
3261 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
3262 sm += mat;
3263
3264 checkRows ( herm, 6UL );
3265 checkColumns ( herm, 6UL );
3266 checkNonZeros( herm, 32UL );
3267
3268 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(18,-3) || sm(0,2) != cplx(14,0) || sm(0,3) != cplx(11,-1) ||
3269 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,1) || sm(1,3) != cplx(19, 0) ||
3270 sm(2,0) != cplx(19, 3) || sm(2,1) != cplx(11, 2) || sm(2,2) != cplx(12,1) || sm(2,3) != cplx(14,-4) ) {
3271 std::ostringstream oss;
3272 oss << " Test: " << test_ << "\n"
3273 << " Error: Assignment to submatrix failed\n"
3274 << " Details:\n"
3275 << " Result:\n" << sm << "\n"
3276 << " Expected result:\n( (12, 1) (18,-3) (14, 0) (11,-1) )\n"
3277 "( (13,-2) (14, 0) (11, 1) (19, 0) )\n"
3278 "( (19, 3) (11, 2) (12, 1) (14,-4) )\n";
3279 throw std::runtime_error( oss.str() );
3280 }
3281
3282 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
3283 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
3284 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
3285 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
3286 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
3287 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
3288 std::ostringstream oss;
3289 oss << " Test: " << test_ << "\n"
3290 << " Error: Assignment to submatrix failed\n"
3291 << " Details:\n"
3292 << " Result:\n" << herm << "\n"
3293 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
3294 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
3295 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
3296 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
3297 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
3298 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
3299 throw std::runtime_error( oss.str() );
3300 }
3301 }
3302
3303 {
3304 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
3305 mat(0,0) = cplx( 5,-4);
3306 mat(0,1) = cplx(15, 1);
3307 mat(0,2) = cplx(14,-3);
3308 mat(1,0) = cplx(18, 3);
3309 mat(1,1) = cplx(14, 0);
3310 mat(1,2) = cplx(12,-4);
3311 mat(2,0) = cplx(11, 0);
3312 mat(2,1) = cplx(10,-2);
3313 mat(2,2) = cplx(12,-1);
3314 mat(3,0) = cplx(10, 2);
3315 mat(3,1) = cplx(14, 0);
3316 mat(3,2) = cplx( 7, 3);
3317
3318 HT herm;
3319 init( herm );
3320
3321 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
3322 sm += mat;
3323
3324 checkRows ( herm, 6UL );
3325 checkColumns ( herm, 6UL );
3326 checkNonZeros( herm, 32UL );
3327
3328 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(13, 2) || sm(0,2) != cplx(19,-3) ||
3329 sm(1,0) != cplx(18, 3) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,-2) ||
3330 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,-1) || sm(2,2) != cplx(12,-1) ||
3331 sm(3,0) != cplx(11, 1) || sm(3,1) != cplx(19, 0) || sm(3,2) != cplx(14, 4) ) {
3332 std::ostringstream oss;
3333 oss << " Test: " << test_ << "\n"
3334 << " Error: Assignment to submatrix failed\n"
3335 << " Details:\n"
3336 << " Result:\n" << sm << "\n"
3337 << " Expected result:\n( (12,-1) (13, 2) (19,-3) )\n"
3338 "( (18, 3) (14, 0) (11,-2) )\n"
3339 "( (14, 0) (11,-1) (12,-1) )\n"
3340 "( (11, 1) (19, 0) (14, 4) )\n";
3341 throw std::runtime_error( oss.str() );
3342 }
3343
3344 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
3345 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
3346 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
3347 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
3348 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
3349 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
3350 std::ostringstream oss;
3351 oss << " Test: " << test_ << "\n"
3352 << " Error: Assignment to submatrix failed\n"
3353 << " Details:\n"
3354 << " Result:\n" << herm << "\n"
3355 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
3356 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
3357 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
3358 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
3359 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
3360 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
3361 throw std::runtime_error( oss.str() );
3362 }
3363 }
3364 }
3365
3366 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
3367 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (22,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
3368 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
3369 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
3370 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
3371 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
3372 {
3373 test_ = "Dense matrix addition assignment test 5";
3374
3375 {
3376 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
3377 mat(0,0) = cplx(11, 0);
3378 mat(0,1) = cplx(22, 0);
3379 mat(0,2) = cplx( 7,-5);
3380 mat(0,3) = cplx(17,-4);
3381 mat(1,0) = cplx(26, 0);
3382 mat(1,1) = cplx(15, 0);
3383 mat(1,2) = cplx(11,-1);
3384 mat(1,3) = cplx(19,-2);
3385
3386 HT herm;
3387 init( herm );
3388
3389 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
3390
3391 try {
3392 sm += mat;
3393
3394 std::ostringstream oss;
3395 oss << " Test: " << test_ << "\n"
3396 << " Error: Assignment of invalid matrix succeeded\n"
3397 << " Details:\n"
3398 << " Result:\n" << herm << "\n";
3399 throw std::runtime_error( oss.str() );
3400 }
3401 catch( std::invalid_argument& ) {}
3402 }
3403
3404 {
3405 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
3406 mat(0,0) = cplx(11,0);
3407 mat(0,1) = cplx(22,0);
3408 mat(1,0) = cplx(26,0);
3409 mat(1,1) = cplx(15,0);
3410 mat(2,0) = cplx( 7,5);
3411 mat(2,1) = cplx(11,1);
3412 mat(3,0) = cplx(17,4);
3413 mat(3,1) = cplx(19,2);
3414
3415 HT herm;
3416 init( herm );
3417
3418 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
3419
3420 try {
3421 sm += mat;
3422
3423 std::ostringstream oss;
3424 oss << " Test: " << test_ << "\n"
3425 << " Error: Assignment of invalid matrix succeeded\n"
3426 << " Details:\n"
3427 << " Result:\n" << herm << "\n";
3428 throw std::runtime_error( oss.str() );
3429 }
3430 catch( std::invalid_argument& ) {}
3431 }
3432 }
3433
3434 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
3435 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
3436 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
3437 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (22,-2) (11, 0) (19, 1) ( 0, 0) )
3438 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
3439 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
3440 {
3441 test_ = "Dense matrix addition assignment test 6";
3442
3443 {
3444 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
3445 mat(0,0) = cplx(12,-1);
3446 mat(0,1) = cplx(15, 0);
3447 mat(0,2) = cplx(13, 1);
3448 mat(0,3) = cplx(15,-3);
3449 mat(1,0) = cplx(13,-2);
3450 mat(1,1) = cplx(21,-1);
3451 mat(1,2) = cplx( 6, 0);
3452 mat(1,3) = cplx(12, 0);
3453
3454 HT herm;
3455 init( herm );
3456
3457 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
3458
3459 try {
3460 sm += mat;
3461
3462 std::ostringstream oss;
3463 oss << " Test: " << test_ << "\n"
3464 << " Error: Assignment of invalid matrix succeeded\n"
3465 << " Details:\n"
3466 << " Result:\n" << herm << "\n";
3467 throw std::runtime_error( oss.str() );
3468 }
3469 catch( std::invalid_argument& ) {}
3470 }
3471
3472 {
3473 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
3474 mat(0,0) = cplx(12, 1);
3475 mat(0,1) = cplx(13, 2);
3476 mat(1,0) = cplx(15, 0);
3477 mat(1,1) = cplx(13, 1);
3478 mat(2,0) = cplx(21,-1);
3479 mat(2,1) = cplx( 6, 0);
3480 mat(3,0) = cplx(15, 3);
3481 mat(3,1) = cplx(12, 0);
3482
3483 HT herm;
3484 init( herm );
3485
3486 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
3487
3488 try {
3489 sm += mat;
3490
3491 std::ostringstream oss;
3492 oss << " Test: " << test_ << "\n"
3493 << " Error: Assignment of invalid matrix succeeded\n"
3494 << " Details:\n"
3495 << " Result:\n" << herm << "\n";
3496 throw std::runtime_error( oss.str() );
3497 }
3498 catch( std::invalid_argument& ) {}
3499 }
3500 }
3501
3502 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
3503 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
3504 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
3505 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
3506 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
3507 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (22,-1) (19, 0) )
3508 {
3509 test_ = "Dense matrix addition assignment test 7";
3510
3511 {
3512 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
3513 mat(0,0) = cplx(12,-1);
3514 mat(0,1) = cplx(11, 2);
3515 mat(0,2) = cplx(13, 0);
3516 mat(0,3) = cplx(15, 1);
3517 mat(1,0) = cplx(15,-2);
3518 mat(1,1) = cplx(14, 0);
3519 mat(1,2) = cplx(26,-1);
3520 mat(1,3) = cplx(12, 0);
3521
3522 HT herm;
3523 init( herm );
3524
3525 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
3526
3527 try {
3528 sm += mat;
3529
3530 std::ostringstream oss;
3531 oss << " Test: " << test_ << "\n"
3532 << " Error: Assignment of invalid matrix succeeded\n"
3533 << " Details:\n"
3534 << " Result:\n" << herm << "\n";
3535 throw std::runtime_error( oss.str() );
3536 }
3537 catch( std::invalid_argument& ) {}
3538 }
3539
3540 {
3541 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
3542 mat(0,0) = cplx(12, 1);
3543 mat(0,1) = cplx(15, 2);
3544 mat(1,0) = cplx(11,-2);
3545 mat(1,1) = cplx(14, 0);
3546 mat(2,0) = cplx(13, 0);
3547 mat(2,1) = cplx(15, 1);
3548 mat(3,0) = cplx(26,-1);
3549 mat(3,1) = cplx(12, 0);
3550
3551 HT herm;
3552 init( herm );
3553
3554 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
3555
3556 try {
3557 sm += mat;
3558
3559 std::ostringstream oss;
3560 oss << " Test: " << test_ << "\n"
3561 << " Error: Assignment of invalid matrix succeeded\n"
3562 << " Details:\n"
3563 << " Result:\n" << herm << "\n";
3564 throw std::runtime_error( oss.str() );
3565 }
3566 catch( std::invalid_argument& ) {}
3567 }
3568 }
3569
3570 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
3571 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
3572 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
3573 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (22, 1) (19, 0) (14, 4) ( 0, 0) )
3574 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
3575 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
3576 {
3577 test_ = "Dense matrix addition assignment test 8";
3578
3579 {
3580 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
3581 mat(0,0) = cplx( 5, 4);
3582 mat(0,1) = cplx(18,-3);
3583 mat(0,2) = cplx(11, 0);
3584 mat(0,3) = cplx(10,-2);
3585 mat(1,0) = cplx(15,-1);
3586 mat(1,1) = cplx(14, 0);
3587 mat(1,2) = cplx(21, 2);
3588 mat(1,3) = cplx(14, 0);
3589 mat(2,0) = cplx(14, 3);
3590 mat(2,1) = cplx(12, 4);
3591 mat(2,2) = cplx(12, 1);
3592 mat(2,3) = cplx( 7,-3);
3593
3594 HT herm;
3595 init( herm );
3596
3597 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
3598
3599 try {
3600 sm += mat;
3601
3602 std::ostringstream oss;
3603 oss << " Test: " << test_ << "\n"
3604 << " Error: Assignment of invalid matrix succeeded\n"
3605 << " Details:\n"
3606 << " Result:\n" << herm << "\n";
3607 throw std::runtime_error( oss.str() );
3608 }
3609 catch( std::invalid_argument& ) {}
3610 }
3611
3612 {
3613 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
3614 mat(0,0) = cplx( 5,-4);
3615 mat(0,1) = cplx(15, 1);
3616 mat(0,2) = cplx(14,-3);
3617 mat(1,0) = cplx(18, 3);
3618 mat(1,1) = cplx(14, 0);
3619 mat(1,2) = cplx(12,-4);
3620 mat(2,0) = cplx(11, 0);
3621 mat(2,1) = cplx(10,-2);
3622 mat(2,2) = cplx(12,-1);
3623 mat(3,0) = cplx(21, 2);
3624 mat(3,1) = cplx(14, 0);
3625 mat(3,2) = cplx( 7, 3);
3626
3627 HT herm;
3628 init( herm );
3629
3630 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
3631
3632 try {
3633 sm += mat;
3634
3635 std::ostringstream oss;
3636 oss << " Test: " << test_ << "\n"
3637 << " Error: Assignment of invalid matrix succeeded\n"
3638 << " Details:\n"
3639 << " Result:\n" << herm << "\n";
3640 throw std::runtime_error( oss.str() );
3641 }
3642 catch( std::invalid_argument& ) {}
3643 }
3644 }
3645
3646 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12, 0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
3647 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,-1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
3648 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14, 2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
3649 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15, 3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
3650 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
3651 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
3652 {
3653 test_ = "Dense matrix addition assignment test 9";
3654
3655 {
3656 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
3657 mat(0,0) = cplx(11, 0);
3658 mat(0,1) = cplx(22, 0);
3659 mat(0,2) = cplx( 7,-5);
3660 mat(0,3) = cplx(17,-4);
3661 mat(1,0) = cplx(22,-2);
3662 mat(1,1) = cplx(15, 0);
3663 mat(1,2) = cplx(11,-1);
3664 mat(1,3) = cplx(19,-2);
3665
3666 HT herm;
3667 init( herm );
3668
3669 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
3670
3671 try {
3672 sm += mat;
3673
3674 std::ostringstream oss;
3675 oss << " Test: " << test_ << "\n"
3676 << " Error: Assignment of invalid matrix succeeded\n"
3677 << " Details:\n"
3678 << " Result:\n" << herm << "\n";
3679 throw std::runtime_error( oss.str() );
3680 }
3681 catch( std::invalid_argument& ) {}
3682 }
3683
3684 {
3685 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
3686 mat(0,0) = cplx(11, 0);
3687 mat(0,1) = cplx(22, 0);
3688 mat(1,0) = cplx(22,-2);
3689 mat(1,1) = cplx(15, 0);
3690 mat(2,0) = cplx( 7, 5);
3691 mat(2,1) = cplx(11, 1);
3692 mat(3,0) = cplx(17, 4);
3693 mat(3,1) = cplx(19, 2);
3694
3695 HT herm;
3696 init( herm );
3697
3698 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
3699
3700 try {
3701 sm += mat;
3702
3703 std::ostringstream oss;
3704 oss << " Test: " << test_ << "\n"
3705 << " Error: Assignment of invalid matrix succeeded\n"
3706 << " Details:\n"
3707 << " Result:\n" << herm << "\n";
3708 throw std::runtime_error( oss.str() );
3709 }
3710 catch( std::invalid_argument& ) {}
3711 }
3712 }
3713
3714 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7,3) (-2, 1) ( 5, 0) ( 0, 0) )
3715 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12,1) (13, 2) (-1, 2) ( 8,-2) )
3716 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18,0) (14, 2) (15,-3) (-2, 0) )
3717 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,2) (11, 0) (19, 1) ( 0, 0) )
3718 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15,3) (19,-1) ( 1, 0) (-4, 0) )
3719 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2,0) ( 0, 0) (-4, 0) ( 7, 0) )
3720 {
3721 test_ = "Dense matrix addition assignment test 10";
3722
3723 {
3724 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
3725 mat(0,0) = cplx(12,-1);
3726 mat(0,1) = cplx(15, 0);
3727 mat(0,2) = cplx(13, 1);
3728 mat(0,3) = cplx(15,-3);
3729 mat(1,0) = cplx(13,-2);
3730 mat(1,1) = cplx(13,-3);
3731 mat(1,2) = cplx( 6, 0);
3732 mat(1,3) = cplx(12, 0);
3733
3734 HT herm;
3735 init( herm );
3736
3737 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
3738
3739 try {
3740 sm += mat;
3741
3742 std::ostringstream oss;
3743 oss << " Test: " << test_ << "\n"
3744 << " Error: Assignment of invalid matrix succeeded\n"
3745 << " Details:\n"
3746 << " Result:\n" << herm << "\n";
3747 throw std::runtime_error( oss.str() );
3748 }
3749 catch( std::invalid_argument& ) {}
3750 }
3751
3752 {
3753 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
3754 mat(0,0) = cplx(12, 1);
3755 mat(0,1) = cplx(13, 2);
3756 mat(1,0) = cplx(15, 0);
3757 mat(1,1) = cplx(13, 1);
3758 mat(2,0) = cplx(13,-3);
3759 mat(2,1) = cplx( 6, 0);
3760 mat(3,0) = cplx(15, 3);
3761 mat(3,1) = cplx(12, 0);
3762
3763 HT herm;
3764 init( herm );
3765
3766 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
3767
3768 try {
3769 sm += mat;
3770
3771 std::ostringstream oss;
3772 oss << " Test: " << test_ << "\n"
3773 << " Error: Assignment of invalid matrix succeeded\n"
3774 << " Details:\n"
3775 << " Result:\n" << herm << "\n";
3776 throw std::runtime_error( oss.str() );
3777 }
3778 catch( std::invalid_argument& ) {}
3779 }
3780 }
3781
3782 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
3783 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
3784 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
3785 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
3786 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
3787 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11, 1) (19, 0) )
3788 {
3789 test_ = "Dense matrix addition assignment test 11";
3790
3791 {
3792 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
3793 mat(0,0) = cplx(12,-1);
3794 mat(0,1) = cplx(11, 2);
3795 mat(0,2) = cplx(13, 0);
3796 mat(0,3) = cplx(15, 1);
3797 mat(1,0) = cplx(15,-2);
3798 mat(1,1) = cplx(14, 0);
3799 mat(1,2) = cplx(15, 1);
3800 mat(1,3) = cplx(12, 0);
3801
3802 HT herm;
3803 init( herm );
3804
3805 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
3806
3807 try {
3808 sm += mat;
3809
3810 std::ostringstream oss;
3811 oss << " Test: " << test_ << "\n"
3812 << " Error: Assignment of invalid matrix succeeded\n"
3813 << " Details:\n"
3814 << " Result:\n" << herm << "\n";
3815 throw std::runtime_error( oss.str() );
3816 }
3817 catch( std::invalid_argument& ) {}
3818 }
3819
3820 {
3821 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
3822 mat(0,0) = cplx(12, 1);
3823 mat(0,1) = cplx(15, 2);
3824 mat(1,0) = cplx(11,-2);
3825 mat(1,1) = cplx(14, 0);
3826 mat(2,0) = cplx(13, 0);
3827 mat(2,1) = cplx(15, 1);
3828 mat(3,0) = cplx(15, 1);
3829 mat(3,1) = cplx(12, 0);
3830
3831 HT herm;
3832 init( herm );
3833
3834 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
3835
3836 try {
3837 sm += mat;
3838
3839 std::ostringstream oss;
3840 oss << " Test: " << test_ << "\n"
3841 << " Error: Assignment of invalid matrix succeeded\n"
3842 << " Details:\n"
3843 << " Result:\n" << herm << "\n";
3844 throw std::runtime_error( oss.str() );
3845 }
3846 catch( std::invalid_argument& ) {}
3847 }
3848 }
3849
3850 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
3851 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
3852 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
3853 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11,-1) (19, 0) (14, 4) ( 0, 0) )
3854 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
3855 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
3856 {
3857 test_ = "Dense matrix addition assignment test 12";
3858
3859 {
3860 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
3861 mat(0,0) = cplx( 5, 4);
3862 mat(0,1) = cplx(18,-3);
3863 mat(0,2) = cplx(11, 0);
3864 mat(0,3) = cplx(10,-2);
3865 mat(1,0) = cplx(15,-1);
3866 mat(1,1) = cplx(14, 0);
3867 mat(1,2) = cplx(10, 0);
3868 mat(1,3) = cplx(14, 0);
3869 mat(2,0) = cplx(14, 3);
3870 mat(2,1) = cplx(12, 4);
3871 mat(2,2) = cplx(12, 1);
3872 mat(2,3) = cplx( 7,-3);
3873
3874 HT herm;
3875 init( herm );
3876
3877 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
3878
3879 try {
3880 sm += mat;
3881
3882 std::ostringstream oss;
3883 oss << " Test: " << test_ << "\n"
3884 << " Error: Assignment of invalid matrix succeeded\n"
3885 << " Details:\n"
3886 << " Result:\n" << herm << "\n";
3887 throw std::runtime_error( oss.str() );
3888 }
3889 catch( std::invalid_argument& ) {}
3890 }
3891
3892 {
3893 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
3894 mat(0,0) = cplx( 5,-4);
3895 mat(0,1) = cplx(15, 1);
3896 mat(0,2) = cplx(14,-3);
3897 mat(1,0) = cplx(18, 3);
3898 mat(1,1) = cplx(14, 0);
3899 mat(1,2) = cplx(12,-4);
3900 mat(2,0) = cplx(11, 0);
3901 mat(2,1) = cplx(10,-2);
3902 mat(2,2) = cplx(12,-1);
3903 mat(3,0) = cplx(10, 0);
3904 mat(3,1) = cplx(14, 0);
3905 mat(3,2) = cplx( 7, 3);
3906
3907 HT herm;
3908 init( herm );
3909
3910 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
3911
3912 try {
3913 sm += mat;
3914
3915 std::ostringstream oss;
3916 oss << " Test: " << test_ << "\n"
3917 << " Error: Assignment of invalid matrix succeeded\n"
3918 << " Details:\n"
3919 << " Result:\n" << herm << "\n";
3920 throw std::runtime_error( oss.str() );
3921 }
3922 catch( std::invalid_argument& ) {}
3923 }
3924 }
3925
3926 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
3927 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 1) (11,-1) (19,-2) (-1,2) ( 8,-2) )
3928 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
3929 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
3930 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
3931 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
3932 {
3933 test_ = "Dense matrix addition assignment test 13";
3934
3935 {
3936 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
3937 mat(0,0) = cplx(11, 0);
3938 mat(0,1) = cplx(22, 0);
3939 mat(0,2) = cplx( 7,-5);
3940 mat(0,3) = cplx(17,-4);
3941 mat(1,0) = cplx(22, 0);
3942 mat(1,1) = cplx(15, 1);
3943 mat(1,2) = cplx(11,-1);
3944 mat(1,3) = cplx(19,-2);
3945
3946 HT herm;
3947 init( herm );
3948
3949 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
3950
3951 try {
3952 sm += mat;
3953
3954 std::ostringstream oss;
3955 oss << " Test: " << test_ << "\n"
3956 << " Error: Assignment of invalid matrix succeeded\n"
3957 << " Details:\n"
3958 << " Result:\n" << herm << "\n";
3959 throw std::runtime_error( oss.str() );
3960 }
3961 catch( std::invalid_argument& ) {}
3962 }
3963
3964 {
3965 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
3966 mat(0,0) = cplx(11,0);
3967 mat(0,1) = cplx(22,0);
3968 mat(1,0) = cplx(22,0);
3969 mat(1,1) = cplx(15,1);
3970 mat(2,0) = cplx( 7,5);
3971 mat(2,1) = cplx(11,1);
3972 mat(3,0) = cplx(17,4);
3973 mat(3,1) = cplx(19,2);
3974
3975 HT herm;
3976 init( herm );
3977
3978 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
3979
3980 try {
3981 sm += mat;
3982
3983 std::ostringstream oss;
3984 oss << " Test: " << test_ << "\n"
3985 << " Error: Assignment of invalid matrix succeeded\n"
3986 << " Details:\n"
3987 << " Result:\n" << herm << "\n";
3988 throw std::runtime_error( oss.str() );
3989 }
3990 catch( std::invalid_argument& ) {}
3991 }
3992 }
3993
3994 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
3995 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
3996 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
3997 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 1) (19, 1) ( 0, 0) )
3998 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
3999 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
4000 {
4001 test_ = "Dense matrix addition assignment test 14";
4002
4003 {
4004 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
4005 mat(0,0) = cplx(12,-1);
4006 mat(0,1) = cplx(15, 0);
4007 mat(0,2) = cplx(13, 1);
4008 mat(0,3) = cplx(15,-3);
4009 mat(1,0) = cplx(13,-2);
4010 mat(1,1) = cplx(13,-1);
4011 mat(1,2) = cplx( 6, 1);
4012 mat(1,3) = cplx(12, 0);
4013
4014 HT herm;
4015 init( herm );
4016
4017 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
4018
4019 try {
4020 sm += mat;
4021
4022 std::ostringstream oss;
4023 oss << " Test: " << test_ << "\n"
4024 << " Error: Assignment of invalid matrix succeeded\n"
4025 << " Details:\n"
4026 << " Result:\n" << herm << "\n";
4027 throw std::runtime_error( oss.str() );
4028 }
4029 catch( std::invalid_argument& ) {}
4030 }
4031
4032 {
4033 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
4034 mat(0,0) = cplx(12, 1);
4035 mat(0,1) = cplx(13, 2);
4036 mat(1,0) = cplx(15, 0);
4037 mat(1,1) = cplx(13, 1);
4038 mat(2,0) = cplx(13,-1);
4039 mat(2,1) = cplx( 6, 1);
4040 mat(3,0) = cplx(15, 3);
4041 mat(3,1) = cplx(12, 0);
4042
4043 HT herm;
4044 init( herm );
4045
4046 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
4047
4048 try {
4049 sm += mat;
4050
4051 std::ostringstream oss;
4052 oss << " Test: " << test_ << "\n"
4053 << " Error: Assignment of invalid matrix succeeded\n"
4054 << " Details:\n"
4055 << " Result:\n" << herm << "\n";
4056 throw std::runtime_error( oss.str() );
4057 }
4058 catch( std::invalid_argument& ) {}
4059 }
4060 }
4061
4062 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
4063 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
4064 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
4065 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
4066 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
4067 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 1) )
4068 {
4069 test_ = "Dense matrix addition assignment test 15";
4070
4071 {
4072 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
4073 mat(0,0) = cplx(12,-1);
4074 mat(0,1) = cplx(11, 2);
4075 mat(0,2) = cplx(13, 0);
4076 mat(0,3) = cplx(15, 1);
4077 mat(1,0) = cplx(15,-2);
4078 mat(1,1) = cplx(14, 0);
4079 mat(1,2) = cplx(15,-1);
4080 mat(1,3) = cplx(12, 1);
4081
4082 HT herm;
4083 init( herm );
4084
4085 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
4086
4087 try {
4088 sm += mat;
4089
4090 std::ostringstream oss;
4091 oss << " Test: " << test_ << "\n"
4092 << " Error: Assignment of invalid matrix succeeded\n"
4093 << " Details:\n"
4094 << " Result:\n" << herm << "\n";
4095 throw std::runtime_error( oss.str() );
4096 }
4097 catch( std::invalid_argument& ) {}
4098 }
4099
4100 {
4101 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
4102 mat(0,0) = cplx(12, 1);
4103 mat(0,1) = cplx(15, 2);
4104 mat(1,0) = cplx(11,-2);
4105 mat(1,1) = cplx(14, 0);
4106 mat(2,0) = cplx(13, 0);
4107 mat(2,1) = cplx(15, 1);
4108 mat(3,0) = cplx(15,-1);
4109 mat(3,1) = cplx(12, 1);
4110
4111 HT herm;
4112 init( herm );
4113
4114 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
4115
4116 try {
4117 sm += mat;
4118
4119 std::ostringstream oss;
4120 oss << " Test: " << test_ << "\n"
4121 << " Error: Assignment of invalid matrix succeeded\n"
4122 << " Details:\n"
4123 << " Result:\n" << herm << "\n";
4124 throw std::runtime_error( oss.str() );
4125 }
4126 catch( std::invalid_argument& ) {}
4127 }
4128 }
4129
4130 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
4131 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
4132 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
4133 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 1) (14, 4) ( 0, 0) )
4134 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
4135 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
4136 {
4137 test_ = "Dense matrix addition assignment test 16";
4138
4139 {
4140 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
4141 mat(0,0) = cplx( 5, 4);
4142 mat(0,1) = cplx(18,-3);
4143 mat(0,2) = cplx(11, 0);
4144 mat(0,3) = cplx(10,-2);
4145 mat(1,0) = cplx(15,-1);
4146 mat(1,1) = cplx(14, 0);
4147 mat(1,2) = cplx(10, 2);
4148 mat(1,3) = cplx(14, 1);
4149 mat(2,0) = cplx(14, 3);
4150 mat(2,1) = cplx(12, 4);
4151 mat(2,2) = cplx(12, 1);
4152 mat(2,3) = cplx( 7,-3);
4153
4154 HT herm;
4155 init( herm );
4156
4157 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
4158
4159 try {
4160 sm += mat;
4161
4162 std::ostringstream oss;
4163 oss << " Test: " << test_ << "\n"
4164 << " Error: Assignment of invalid matrix succeeded\n"
4165 << " Details:\n"
4166 << " Result:\n" << herm << "\n";
4167 throw std::runtime_error( oss.str() );
4168 }
4169 catch( std::invalid_argument& ) {}
4170 }
4171
4172 {
4173 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
4174 mat(0,0) = cplx( 5,-4);
4175 mat(0,1) = cplx(15, 1);
4176 mat(0,2) = cplx(14,-3);
4177 mat(1,0) = cplx(18, 3);
4178 mat(1,1) = cplx(14, 1);
4179 mat(1,2) = cplx(12,-4);
4180 mat(2,0) = cplx(11, 0);
4181 mat(2,1) = cplx(10,-2);
4182 mat(2,2) = cplx(12,-1);
4183 mat(3,0) = cplx(10, 2);
4184 mat(3,1) = cplx(14, 1);
4185 mat(3,2) = cplx( 7, 3);
4186
4187 HT herm;
4188 init( herm );
4189
4190 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
4191
4192 try {
4193 sm += mat;
4194
4195 std::ostringstream oss;
4196 oss << " Test: " << test_ << "\n"
4197 << " Error: Assignment of invalid matrix succeeded\n"
4198 << " Details:\n"
4199 << " Result:\n" << herm << "\n";
4200 throw std::runtime_error( oss.str() );
4201 }
4202 catch( std::invalid_argument& ) {}
4203 }
4204 }
4205
4206
4207 //=====================================================================================
4208 // Sparse matrix addition assignment
4209 //=====================================================================================
4210
4211 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
4212 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
4213 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
4214 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
4215 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
4216 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
4217 {
4218 test_ = "Sparse matrix addition assignment test 1";
4219
4220 {
4221 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
4222 mat(0,0) = cplx(11, 0);
4223 mat(0,1) = cplx(22, 0);
4224 mat(0,2) = cplx( 7,-5);
4225 mat(0,3) = cplx(17,-4);
4226 mat(1,0) = cplx(22, 0);
4227 mat(1,1) = cplx(15, 0);
4228 mat(1,2) = cplx(11,-1);
4229 mat(1,3) = cplx(19,-2);
4230
4231 HT herm;
4232 init( herm );
4233
4234 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
4235 sm += mat;
4236
4237 checkRows ( herm, 6UL );
4238 checkColumns ( herm, 6UL );
4239 checkNonZeros( herm, 30UL );
4240
4241 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) || sm(0,2) != cplx(14,-2) || sm(0,3) != cplx(15,-3) ||
4242 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,-2) ) {
4243 std::ostringstream oss;
4244 oss << " Test: " << test_ << "\n"
4245 << " Error: Assignment to submatrix failed\n"
4246 << " Details:\n"
4247 << " Result:\n" << sm << "\n"
4248 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) )\n"
4249 "( (18,1) (17, 0) (11,-1) (19,-2) )\n";
4250 throw std::runtime_error( oss.str() );
4251 }
4252
4253 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
4254 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
4255 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
4256 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
4257 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
4258 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
4259 std::ostringstream oss;
4260 oss << " Test: " << test_ << "\n"
4261 << " Error: Assignment to submatrix failed\n"
4262 << " Details:\n"
4263 << " Result:\n" << herm << "\n"
4264 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
4265 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
4266 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
4267 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
4268 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
4269 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
4270 throw std::runtime_error( oss.str() );
4271 }
4272 }
4273
4274 {
4275 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
4276 mat(0,0) = cplx(11,0);
4277 mat(0,1) = cplx(22,0);
4278 mat(1,0) = cplx(22,0);
4279 mat(1,1) = cplx(15,0);
4280 mat(2,0) = cplx( 7,5);
4281 mat(2,1) = cplx(11,1);
4282 mat(3,0) = cplx(17,4);
4283 mat(3,1) = cplx(19,2);
4284
4285 HT herm;
4286 init( herm );
4287
4288 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
4289 sm += mat;
4290
4291 checkRows ( herm, 6UL );
4292 checkColumns ( herm, 6UL );
4293 checkNonZeros( herm, 30UL );
4294
4295 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) ||
4296 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) ||
4297 sm(2,0) != cplx(14,2) || sm(2,1) != cplx(11, 1) ||
4298 sm(3,0) != cplx(15,3) || sm(3,1) != cplx(19, 2) ) {
4299 std::ostringstream oss;
4300 oss << " Test: " << test_ << "\n"
4301 << " Error: Assignment to submatrix failed\n"
4302 << " Details:\n"
4303 << " Result:\n" << sm << "\n"
4304 << " Expected result:\n( (12,0) (18,-1) )\n"
4305 "( (18,1) (17, 0) )\n"
4306 "( (14,2) (11, 1) )\n"
4307 "( (15,3) (19, 2) )\n";
4308 throw std::runtime_error( oss.str() );
4309 }
4310
4311 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
4312 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
4313 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
4314 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
4315 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
4316 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
4317 std::ostringstream oss;
4318 oss << " Test: " << test_ << "\n"
4319 << " Error: Assignment to submatrix failed\n"
4320 << " Details:\n"
4321 << " Result:\n" << herm << "\n"
4322 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
4323 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
4324 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
4325 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
4326 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
4327 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
4328 throw std::runtime_error( oss.str() );
4329 }
4330 }
4331 }
4332
4333 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
4334 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
4335 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
4336 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )
4337 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
4338 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
4339 {
4340 test_ = "Sparse matrix addition assignment test 2";
4341
4342 {
4343 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
4344 mat(0,0) = cplx(12,-1);
4345 mat(0,1) = cplx(15, 0);
4346 mat(0,2) = cplx(13, 1);
4347 mat(0,3) = cplx(15,-3);
4348 mat(1,0) = cplx(13,-2);
4349 mat(1,1) = cplx(13,-1);
4350 mat(1,2) = cplx( 6, 0);
4351 mat(1,3) = cplx(12, 0);
4352
4353 HT herm;
4354 init( herm );
4355
4356 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
4357 sm += mat;
4358
4359 checkRows ( herm, 6UL );
4360 checkColumns ( herm, 6UL );
4361 checkNonZeros( herm, 32UL );
4362
4363 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18, 0) || sm(0,2) != cplx(14,2) || sm(0,3) != cplx(15,-3) ||
4364 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,-2) || sm(1,2) != cplx(11,0) || sm(1,3) != cplx(19, 1) ) {
4365 std::ostringstream oss;
4366 oss << " Test: " << test_ << "\n"
4367 << " Error: Assignment to submatrix failed\n"
4368 << " Details:\n"
4369 << " Result:\n" << sm << "\n"
4370 << " Expected result:\n( (12,-1) (18, 0) (14,2) (15,-3) )\n"
4371 "( (13,-2) (14,-2) (11,0) (19, 1) )\n";
4372 throw std::runtime_error( oss.str() );
4373 }
4374
4375 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
4376 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
4377 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
4378 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
4379 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
4380 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
4381 std::ostringstream oss;
4382 oss << " Test: " << test_ << "\n"
4383 << " Error: Assignment to submatrix failed\n"
4384 << " Details:\n"
4385 << " Result:\n" << herm << "\n"
4386 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
4387 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
4388 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
4389 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
4390 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
4391 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
4392 throw std::runtime_error( oss.str() );
4393 }
4394 }
4395
4396 {
4397 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
4398 mat(0,0) = cplx(12, 1);
4399 mat(0,1) = cplx(13, 2);
4400 mat(1,0) = cplx(15, 0);
4401 mat(1,1) = cplx(13, 1);
4402 mat(2,0) = cplx(13,-1);
4403 mat(2,1) = cplx( 6, 0);
4404 mat(3,0) = cplx(15, 3);
4405 mat(3,1) = cplx(12, 0);
4406
4407 HT herm;
4408 init( herm );
4409
4410 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
4411 sm += mat;
4412
4413 checkRows ( herm, 6UL );
4414 checkColumns ( herm, 6UL );
4415 checkNonZeros( herm, 32UL );
4416
4417 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13, 2) ||
4418 sm(1,0) != cplx(18, 0) || sm(1,1) != cplx(14, 2) ||
4419 sm(2,0) != cplx(14,-2) || sm(2,1) != cplx(11, 0) ||
4420 sm(3,0) != cplx(15, 3) || sm(3,1) != cplx(19,-1) ) {
4421 std::ostringstream oss;
4422 oss << " Test: " << test_ << "\n"
4423 << " Error: Assignment to submatrix failed\n"
4424 << " Details:\n"
4425 << " Result:\n" << sm << "\n"
4426 << " Expected result:\n( (12, 1) (13, 2) )\n"
4427 "( (18, 0) (14, 2) )\n"
4428 "( (14,-2) (11, 0) )\n"
4429 "( (15, 3) (19,-1) )\n";
4430 throw std::runtime_error( oss.str() );
4431 }
4432
4433 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
4434 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
4435 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
4436 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
4437 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
4438 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
4439 std::ostringstream oss;
4440 oss << " Test: " << test_ << "\n"
4441 << " Error: Assignment to submatrix failed\n"
4442 << " Details:\n"
4443 << " Result:\n" << herm << "\n"
4444 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
4445 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
4446 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
4447 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
4448 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
4449 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
4450 throw std::runtime_error( oss.str() );
4451 }
4452 }
4453 }
4454
4455 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
4456 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
4457 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
4458 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
4459 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
4460 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )
4461 {
4462 test_ = "Sparse matrix addition assignment test 3";
4463
4464 {
4465 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
4466 mat(0,0) = cplx(12,-1);
4467 mat(0,1) = cplx(11, 2);
4468 mat(0,2) = cplx(13, 0);
4469 mat(0,3) = cplx(15, 1);
4470 mat(1,0) = cplx(15,-2);
4471 mat(1,1) = cplx(14, 0);
4472 mat(1,2) = cplx(15,-1);
4473 mat(1,3) = cplx(12, 0);
4474
4475 HT herm;
4476 init( herm );
4477
4478 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
4479 sm += mat;
4480
4481 checkRows ( herm, 6UL );
4482 checkColumns ( herm, 6UL );
4483 checkNonZeros( herm, 30UL );
4484
4485 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18,1) || sm(0,2) != cplx(14, 0) || sm(0,3) != cplx(11,1) ||
4486 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,0) ) {
4487 std::ostringstream oss;
4488 oss << " Test: " << test_ << "\n"
4489 << " Error: Assignment to submatrix failed\n"
4490 << " Details:\n"
4491 << " Result:\n" << sm << "\n"
4492 << " Expected result:\n( (12,-1) (18,1) (14, 0) (11,1) )\n"
4493 "( (13,-2) (14,0) (11,-1) (19,0) )\n";
4494 throw std::runtime_error( oss.str() );
4495 }
4496
4497 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
4498 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
4499 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
4500 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
4501 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
4502 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
4503 std::ostringstream oss;
4504 oss << " Test: " << test_ << "\n"
4505 << " Error: Assignment to submatrix failed\n"
4506 << " Details:\n"
4507 << " Result:\n" << herm << "\n"
4508 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
4509 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
4510 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
4511 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
4512 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
4513 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
4514 throw std::runtime_error( oss.str() );
4515 }
4516 }
4517
4518 {
4519 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
4520 mat(0,0) = cplx(12, 1);
4521 mat(0,1) = cplx(15, 2);
4522 mat(1,0) = cplx(11,-2);
4523 mat(1,1) = cplx(14, 0);
4524 mat(2,0) = cplx(13, 0);
4525 mat(2,1) = cplx(15, 1);
4526 mat(3,0) = cplx(15,-1);
4527 mat(3,1) = cplx(12, 0);
4528
4529 HT herm;
4530 init( herm );
4531
4532 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
4533 sm += mat;
4534
4535 checkRows ( herm, 6UL );
4536 checkColumns ( herm, 6UL );
4537 checkNonZeros( herm, 30UL );
4538
4539 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13,2) ||
4540 sm(1,0) != cplx(18,-1) || sm(1,1) != cplx(14,0) ||
4541 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,1) ||
4542 sm(3,0) != cplx(11,-1) || sm(3,1) != cplx(19,0) ) {
4543 std::ostringstream oss;
4544 oss << " Test: " << test_ << "\n"
4545 << " Error: Assignment to submatrix failed\n"
4546 << " Details:\n"
4547 << " Result:\n" << sm << "\n"
4548 << " Expected result:\n( (12, 1) (13,2) )\n"
4549 "( (18,-1) (14,0) )\n"
4550 "( (14, 0) (11,1) )\n"
4551 "( (11,-1) (19,0) )\n";
4552 throw std::runtime_error( oss.str() );
4553 }
4554
4555 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
4556 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
4557 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
4558 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
4559 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
4560 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
4561 std::ostringstream oss;
4562 oss << " Test: " << test_ << "\n"
4563 << " Error: Assignment to submatrix failed\n"
4564 << " Details:\n"
4565 << " Result:\n" << herm << "\n"
4566 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
4567 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
4568 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
4569 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
4570 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
4571 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
4572 throw std::runtime_error( oss.str() );
4573 }
4574 }
4575 }
4576
4577 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
4578 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
4579 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
4580 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )
4581 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
4582 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
4583 {
4584 test_ = "Sparse matrix addition assignment test 4";
4585
4586 {
4587 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
4588 mat(0,0) = cplx( 5, 4);
4589 mat(0,1) = cplx(18,-3);
4590 mat(0,2) = cplx(11, 0);
4591 mat(0,3) = cplx(10,-2);
4592 mat(1,0) = cplx(15,-1);
4593 mat(1,1) = cplx(14, 0);
4594 mat(1,2) = cplx(10, 2);
4595 mat(1,3) = cplx(14, 0);
4596 mat(2,0) = cplx(14, 3);
4597 mat(2,1) = cplx(12, 4);
4598 mat(2,2) = cplx(12, 1);
4599 mat(2,3) = cplx( 7,-3);
4600
4601 HT herm;
4602 init( herm );
4603
4604 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
4605 sm += mat;
4606
4607 checkRows ( herm, 6UL );
4608 checkColumns ( herm, 6UL );
4609 checkNonZeros( herm, 32UL );
4610
4611 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(18,-3) || sm(0,2) != cplx(14,0) || sm(0,3) != cplx(11,-1) ||
4612 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,1) || sm(1,3) != cplx(19, 0) ||
4613 sm(2,0) != cplx(19, 3) || sm(2,1) != cplx(11, 2) || sm(2,2) != cplx(12,1) || sm(2,3) != cplx(14,-4) ) {
4614 std::ostringstream oss;
4615 oss << " Test: " << test_ << "\n"
4616 << " Error: Assignment to submatrix failed\n"
4617 << " Details:\n"
4618 << " Result:\n" << sm << "\n"
4619 << " Expected result:\n( (12, 1) (18,-3) (14, 0) (11,-1) )\n"
4620 "( (13,-2) (14, 0) (11, 1) (19, 0) )\n"
4621 "( (19, 3) (11, 2) (12, 1) (14,-4) )\n";
4622 throw std::runtime_error( oss.str() );
4623 }
4624
4625 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
4626 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
4627 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
4628 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
4629 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
4630 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
4631 std::ostringstream oss;
4632 oss << " Test: " << test_ << "\n"
4633 << " Error: Assignment to submatrix failed\n"
4634 << " Details:\n"
4635 << " Result:\n" << herm << "\n"
4636 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
4637 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
4638 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
4639 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
4640 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
4641 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
4642 throw std::runtime_error( oss.str() );
4643 }
4644 }
4645
4646 {
4647 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
4648 mat(0,0) = cplx( 5,-4);
4649 mat(0,1) = cplx(15, 1);
4650 mat(0,2) = cplx(14,-3);
4651 mat(1,0) = cplx(18, 3);
4652 mat(1,1) = cplx(14, 0);
4653 mat(1,2) = cplx(12,-4);
4654 mat(2,0) = cplx(11, 0);
4655 mat(2,1) = cplx(10,-2);
4656 mat(2,2) = cplx(12,-1);
4657 mat(3,0) = cplx(10, 2);
4658 mat(3,1) = cplx(14, 0);
4659 mat(3,2) = cplx( 7, 3);
4660
4661 HT herm;
4662 init( herm );
4663
4664 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
4665 sm += mat;
4666
4667 checkRows ( herm, 6UL );
4668 checkColumns ( herm, 6UL );
4669 checkNonZeros( herm, 32UL );
4670
4671 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(13, 2) || sm(0,2) != cplx(19,-3) ||
4672 sm(1,0) != cplx(18, 3) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,-2) ||
4673 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,-1) || sm(2,2) != cplx(12,-1) ||
4674 sm(3,0) != cplx(11, 1) || sm(3,1) != cplx(19, 0) || sm(3,2) != cplx(14, 4) ) {
4675 std::ostringstream oss;
4676 oss << " Test: " << test_ << "\n"
4677 << " Error: Assignment to submatrix failed\n"
4678 << " Details:\n"
4679 << " Result:\n" << sm << "\n"
4680 << " Expected result:\n( (12,-1) (13, 2) (19,-3) )\n"
4681 "( (18, 3) (14, 0) (11,-2) )\n"
4682 "( (14, 0) (11,-1) (12,-1) )\n"
4683 "( (11, 1) (19, 0) (14, 4) )\n";
4684 throw std::runtime_error( oss.str() );
4685 }
4686
4687 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
4688 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
4689 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
4690 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
4691 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
4692 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
4693 std::ostringstream oss;
4694 oss << " Test: " << test_ << "\n"
4695 << " Error: Assignment to submatrix failed\n"
4696 << " Details:\n"
4697 << " Result:\n" << herm << "\n"
4698 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
4699 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
4700 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
4701 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
4702 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
4703 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
4704 throw std::runtime_error( oss.str() );
4705 }
4706 }
4707 }
4708
4709 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
4710 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (22,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
4711 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
4712 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
4713 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
4714 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
4715 {
4716 test_ = "Sparse matrix addition assignment test 5";
4717
4718 {
4719 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
4720 mat(0,0) = cplx(11, 0);
4721 mat(0,1) = cplx(22, 0);
4722 mat(0,2) = cplx( 7,-5);
4723 mat(0,3) = cplx(17,-4);
4724 mat(1,0) = cplx(26, 0);
4725 mat(1,1) = cplx(15, 0);
4726 mat(1,2) = cplx(11,-1);
4727 mat(1,3) = cplx(19,-2);
4728
4729 HT herm;
4730 init( herm );
4731
4732 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
4733
4734 try {
4735 sm += mat;
4736
4737 std::ostringstream oss;
4738 oss << " Test: " << test_ << "\n"
4739 << " Error: Assignment of invalid matrix succeeded\n"
4740 << " Details:\n"
4741 << " Result:\n" << herm << "\n";
4742 throw std::runtime_error( oss.str() );
4743 }
4744 catch( std::invalid_argument& ) {}
4745 }
4746
4747 {
4748 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
4749 mat(0,0) = cplx(11,0);
4750 mat(0,1) = cplx(22,0);
4751 mat(1,0) = cplx(26,0);
4752 mat(1,1) = cplx(15,0);
4753 mat(2,0) = cplx( 7,5);
4754 mat(2,1) = cplx(11,1);
4755 mat(3,0) = cplx(17,4);
4756 mat(3,1) = cplx(19,2);
4757
4758 HT herm;
4759 init( herm );
4760
4761 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
4762
4763 try {
4764 sm += mat;
4765
4766 std::ostringstream oss;
4767 oss << " Test: " << test_ << "\n"
4768 << " Error: Assignment of invalid matrix succeeded\n"
4769 << " Details:\n"
4770 << " Result:\n" << herm << "\n";
4771 throw std::runtime_error( oss.str() );
4772 }
4773 catch( std::invalid_argument& ) {}
4774 }
4775 }
4776
4777 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
4778 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
4779 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
4780 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (22,-2) (11, 0) (19, 1) ( 0, 0) )
4781 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
4782 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
4783 {
4784 test_ = "Sparse matrix addition assignment test 6";
4785
4786 {
4787 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
4788 mat(0,0) = cplx(12,-1);
4789 mat(0,1) = cplx(15, 0);
4790 mat(0,2) = cplx(13, 1);
4791 mat(0,3) = cplx(15,-3);
4792 mat(1,0) = cplx(13,-2);
4793 mat(1,1) = cplx(21,-1);
4794 mat(1,2) = cplx( 6, 0);
4795 mat(1,3) = cplx(12, 0);
4796
4797 HT herm;
4798 init( herm );
4799
4800 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
4801
4802 try {
4803 sm += mat;
4804
4805 std::ostringstream oss;
4806 oss << " Test: " << test_ << "\n"
4807 << " Error: Assignment of invalid matrix succeeded\n"
4808 << " Details:\n"
4809 << " Result:\n" << herm << "\n";
4810 throw std::runtime_error( oss.str() );
4811 }
4812 catch( std::invalid_argument& ) {}
4813 }
4814
4815 {
4816 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
4817 mat(0,0) = cplx(12, 1);
4818 mat(0,1) = cplx(13, 2);
4819 mat(1,0) = cplx(15, 0);
4820 mat(1,1) = cplx(13, 1);
4821 mat(2,0) = cplx(21,-1);
4822 mat(2,1) = cplx( 6, 0);
4823 mat(3,0) = cplx(15, 3);
4824 mat(3,1) = cplx(12, 0);
4825
4826 HT herm;
4827 init( herm );
4828
4829 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
4830
4831 try {
4832 sm += mat;
4833
4834 std::ostringstream oss;
4835 oss << " Test: " << test_ << "\n"
4836 << " Error: Assignment of invalid matrix succeeded\n"
4837 << " Details:\n"
4838 << " Result:\n" << herm << "\n";
4839 throw std::runtime_error( oss.str() );
4840 }
4841 catch( std::invalid_argument& ) {}
4842 }
4843 }
4844
4845 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
4846 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
4847 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
4848 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
4849 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
4850 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (22,-1) (19, 0) )
4851 {
4852 test_ = "Sparse matrix addition assignment test 7";
4853
4854 {
4855 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
4856 mat(0,0) = cplx(12,-1);
4857 mat(0,1) = cplx(11, 2);
4858 mat(0,2) = cplx(13, 0);
4859 mat(0,3) = cplx(15, 1);
4860 mat(1,0) = cplx(15,-2);
4861 mat(1,1) = cplx(14, 0);
4862 mat(1,2) = cplx(26,-1);
4863 mat(1,3) = cplx(12, 0);
4864
4865 HT herm;
4866 init( herm );
4867
4868 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
4869
4870 try {
4871 sm += mat;
4872
4873 std::ostringstream oss;
4874 oss << " Test: " << test_ << "\n"
4875 << " Error: Assignment of invalid matrix succeeded\n"
4876 << " Details:\n"
4877 << " Result:\n" << herm << "\n";
4878 throw std::runtime_error( oss.str() );
4879 }
4880 catch( std::invalid_argument& ) {}
4881 }
4882
4883 {
4884 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
4885 mat(0,0) = cplx(12, 1);
4886 mat(0,1) = cplx(15, 2);
4887 mat(1,0) = cplx(11,-2);
4888 mat(1,1) = cplx(14, 0);
4889 mat(2,0) = cplx(13, 0);
4890 mat(2,1) = cplx(15, 1);
4891 mat(3,0) = cplx(26,-1);
4892 mat(3,1) = cplx(12, 0);
4893
4894 HT herm;
4895 init( herm );
4896
4897 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
4898
4899 try {
4900 sm += mat;
4901
4902 std::ostringstream oss;
4903 oss << " Test: " << test_ << "\n"
4904 << " Error: Assignment of invalid matrix succeeded\n"
4905 << " Details:\n"
4906 << " Result:\n" << herm << "\n";
4907 throw std::runtime_error( oss.str() );
4908 }
4909 catch( std::invalid_argument& ) {}
4910 }
4911 }
4912
4913 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
4914 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
4915 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
4916 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (22, 1) (19, 0) (14, 4) ( 0, 0) )
4917 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
4918 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
4919 {
4920 test_ = "Sparse matrix addition assignment test 8";
4921
4922 {
4923 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
4924 mat(0,0) = cplx( 5, 4);
4925 mat(0,1) = cplx(18,-3);
4926 mat(0,2) = cplx(11, 0);
4927 mat(0,3) = cplx(10,-2);
4928 mat(1,0) = cplx(15,-1);
4929 mat(1,1) = cplx(14, 0);
4930 mat(1,2) = cplx(21, 2);
4931 mat(1,3) = cplx(14, 0);
4932 mat(2,0) = cplx(14, 3);
4933 mat(2,1) = cplx(12, 4);
4934 mat(2,2) = cplx(12, 1);
4935 mat(2,3) = cplx( 7,-3);
4936
4937 HT herm;
4938 init( herm );
4939
4940 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
4941
4942 try {
4943 sm += mat;
4944
4945 std::ostringstream oss;
4946 oss << " Test: " << test_ << "\n"
4947 << " Error: Assignment of invalid matrix succeeded\n"
4948 << " Details:\n"
4949 << " Result:\n" << herm << "\n";
4950 throw std::runtime_error( oss.str() );
4951 }
4952 catch( std::invalid_argument& ) {}
4953 }
4954
4955 {
4956 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
4957 mat(0,0) = cplx( 5,-4);
4958 mat(0,1) = cplx(15, 1);
4959 mat(0,2) = cplx(14,-3);
4960 mat(1,0) = cplx(18, 3);
4961 mat(1,1) = cplx(14, 0);
4962 mat(1,2) = cplx(12,-4);
4963 mat(2,0) = cplx(11, 0);
4964 mat(2,1) = cplx(10,-2);
4965 mat(2,2) = cplx(12,-1);
4966 mat(3,0) = cplx(21, 2);
4967 mat(3,1) = cplx(14, 0);
4968 mat(3,2) = cplx( 7, 3);
4969
4970 HT herm;
4971 init( herm );
4972
4973 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
4974
4975 try {
4976 sm += mat;
4977
4978 std::ostringstream oss;
4979 oss << " Test: " << test_ << "\n"
4980 << " Error: Assignment of invalid matrix succeeded\n"
4981 << " Details:\n"
4982 << " Result:\n" << herm << "\n";
4983 throw std::runtime_error( oss.str() );
4984 }
4985 catch( std::invalid_argument& ) {}
4986 }
4987 }
4988
4989 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12, 0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
4990 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,-1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
4991 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14, 2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
4992 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15, 3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
4993 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
4994 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
4995 {
4996 test_ = "Sparse matrix addition assignment test 9";
4997
4998 {
4999 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 12UL );
5000 mat(0,0) = cplx(11, 0);
5001 mat(0,1) = cplx(22, 0);
5002 mat(0,2) = cplx( 7,-5);
5003 mat(0,3) = cplx(17,-4);
5004 mat(1,0) = cplx(22,-2);
5005 mat(1,1) = cplx(15, 0);
5006 mat(1,2) = cplx(11,-1);
5007 mat(1,3) = cplx(19,-2);
5008
5009 HT herm;
5010 init( herm );
5011
5012 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
5013
5014 try {
5015 sm += mat;
5016
5017 std::ostringstream oss;
5018 oss << " Test: " << test_ << "\n"
5019 << " Error: Assignment of invalid matrix succeeded\n"
5020 << " Details:\n"
5021 << " Result:\n" << herm << "\n";
5022 throw std::runtime_error( oss.str() );
5023 }
5024 catch( std::invalid_argument& ) {}
5025 }
5026
5027 {
5028 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
5029 mat(0,0) = cplx(11, 0);
5030 mat(0,1) = cplx(22, 0);
5031 mat(1,0) = cplx(22,-2);
5032 mat(1,1) = cplx(15, 0);
5033 mat(2,0) = cplx( 7, 5);
5034 mat(2,1) = cplx(11, 1);
5035 mat(3,0) = cplx(17, 4);
5036 mat(3,1) = cplx(19, 2);
5037
5038 HT herm;
5039 init( herm );
5040
5041 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
5042
5043 try {
5044 sm += mat;
5045
5046 std::ostringstream oss;
5047 oss << " Test: " << test_ << "\n"
5048 << " Error: Assignment of invalid matrix succeeded\n"
5049 << " Details:\n"
5050 << " Result:\n" << herm << "\n";
5051 throw std::runtime_error( oss.str() );
5052 }
5053 catch( std::invalid_argument& ) {}
5054 }
5055 }
5056
5057 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7,3) (-2, 1) ( 5, 0) ( 0, 0) )
5058 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12,1) (13, 2) (-1, 2) ( 8,-2) )
5059 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18,0) (14, 2) (15,-3) (-2, 0) )
5060 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,2) (11, 0) (19, 1) ( 0, 0) )
5061 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15,3) (19,-1) ( 1, 0) (-4, 0) )
5062 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2,0) ( 0, 0) (-4, 0) ( 7, 0) )
5063 {
5064 test_ = "Sparse matrix addition assignment test 10";
5065
5066 {
5067 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
5068 mat(0,0) = cplx(12,-1);
5069 mat(0,1) = cplx(15, 0);
5070 mat(0,2) = cplx(13, 1);
5071 mat(0,3) = cplx(15,-3);
5072 mat(1,0) = cplx(13,-2);
5073 mat(1,1) = cplx(13,-3);
5074 mat(1,2) = cplx( 6, 0);
5075 mat(1,3) = cplx(12, 0);
5076
5077 HT herm;
5078 init( herm );
5079
5080 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
5081
5082 try {
5083 sm += mat;
5084
5085 std::ostringstream oss;
5086 oss << " Test: " << test_ << "\n"
5087 << " Error: Assignment of invalid matrix succeeded\n"
5088 << " Details:\n"
5089 << " Result:\n" << herm << "\n";
5090 throw std::runtime_error( oss.str() );
5091 }
5092 catch( std::invalid_argument& ) {}
5093 }
5094
5095 {
5096 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
5097 mat(0,0) = cplx(12, 1);
5098 mat(0,1) = cplx(13, 2);
5099 mat(1,0) = cplx(15, 0);
5100 mat(1,1) = cplx(13, 1);
5101 mat(2,0) = cplx(13,-3);
5102 mat(2,1) = cplx( 6, 0);
5103 mat(3,0) = cplx(15, 3);
5104 mat(3,1) = cplx(12, 0);
5105
5106 HT herm;
5107 init( herm );
5108
5109 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
5110
5111 try {
5112 sm += mat;
5113
5114 std::ostringstream oss;
5115 oss << " Test: " << test_ << "\n"
5116 << " Error: Assignment of invalid matrix succeeded\n"
5117 << " Details:\n"
5118 << " Result:\n" << herm << "\n";
5119 throw std::runtime_error( oss.str() );
5120 }
5121 catch( std::invalid_argument& ) {}
5122 }
5123 }
5124
5125 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
5126 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
5127 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
5128 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
5129 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
5130 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11, 1) (19, 0) )
5131 {
5132 test_ = "Sparse matrix addition assignment test 11";
5133
5134 {
5135 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
5136 mat(0,0) = cplx(12,-1);
5137 mat(0,1) = cplx(11, 2);
5138 mat(0,2) = cplx(13, 0);
5139 mat(0,3) = cplx(15, 1);
5140 mat(1,0) = cplx(15,-2);
5141 mat(1,1) = cplx(14, 0);
5142 mat(1,2) = cplx(15, 1);
5143 mat(1,3) = cplx(12, 0);
5144
5145 HT herm;
5146 init( herm );
5147
5148 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
5149
5150 try {
5151 sm += mat;
5152
5153 std::ostringstream oss;
5154 oss << " Test: " << test_ << "\n"
5155 << " Error: Assignment of invalid matrix succeeded\n"
5156 << " Details:\n"
5157 << " Result:\n" << herm << "\n";
5158 throw std::runtime_error( oss.str() );
5159 }
5160 catch( std::invalid_argument& ) {}
5161 }
5162
5163 {
5164 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
5165 mat(0,0) = cplx(12, 1);
5166 mat(0,1) = cplx(15, 2);
5167 mat(1,0) = cplx(11,-2);
5168 mat(1,1) = cplx(14, 0);
5169 mat(2,0) = cplx(13, 0);
5170 mat(2,1) = cplx(15, 1);
5171 mat(3,0) = cplx(15, 1);
5172 mat(3,1) = cplx(12, 0);
5173
5174 HT herm;
5175 init( herm );
5176
5177 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
5178
5179 try {
5180 sm += mat;
5181
5182 std::ostringstream oss;
5183 oss << " Test: " << test_ << "\n"
5184 << " Error: Assignment of invalid matrix succeeded\n"
5185 << " Details:\n"
5186 << " Result:\n" << herm << "\n";
5187 throw std::runtime_error( oss.str() );
5188 }
5189 catch( std::invalid_argument& ) {}
5190 }
5191 }
5192
5193 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
5194 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
5195 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
5196 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11,-1) (19, 0) (14, 4) ( 0, 0) )
5197 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
5198 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
5199 {
5200 test_ = "Sparse matrix addition assignment test 12";
5201
5202 {
5203 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
5204 mat(0,0) = cplx( 5, 4);
5205 mat(0,1) = cplx(18,-3);
5206 mat(0,2) = cplx(11, 0);
5207 mat(0,3) = cplx(10,-2);
5208 mat(1,0) = cplx(15,-1);
5209 mat(1,1) = cplx(14, 0);
5210 mat(1,2) = cplx(10, 0);
5211 mat(1,3) = cplx(14, 0);
5212 mat(2,0) = cplx(14, 3);
5213 mat(2,1) = cplx(12, 4);
5214 mat(2,2) = cplx(12, 1);
5215 mat(2,3) = cplx( 7,-3);
5216
5217 HT herm;
5218 init( herm );
5219
5220 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
5221
5222 try {
5223 sm += mat;
5224
5225 std::ostringstream oss;
5226 oss << " Test: " << test_ << "\n"
5227 << " Error: Assignment of invalid matrix succeeded\n"
5228 << " Details:\n"
5229 << " Result:\n" << herm << "\n";
5230 throw std::runtime_error( oss.str() );
5231 }
5232 catch( std::invalid_argument& ) {}
5233 }
5234
5235 {
5236 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
5237 mat(0,0) = cplx( 5,-4);
5238 mat(0,1) = cplx(15, 1);
5239 mat(0,2) = cplx(14,-3);
5240 mat(1,0) = cplx(18, 3);
5241 mat(1,1) = cplx(14, 0);
5242 mat(1,2) = cplx(12,-4);
5243 mat(2,0) = cplx(11, 0);
5244 mat(2,1) = cplx(10,-2);
5245 mat(2,2) = cplx(12,-1);
5246 mat(3,0) = cplx(10, 0);
5247 mat(3,1) = cplx(14, 0);
5248 mat(3,2) = cplx( 7, 3);
5249
5250 HT herm;
5251 init( herm );
5252
5253 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
5254
5255 try {
5256 sm += mat;
5257
5258 std::ostringstream oss;
5259 oss << " Test: " << test_ << "\n"
5260 << " Error: Assignment of invalid matrix succeeded\n"
5261 << " Details:\n"
5262 << " Result:\n" << herm << "\n";
5263 throw std::runtime_error( oss.str() );
5264 }
5265 catch( std::invalid_argument& ) {}
5266 }
5267 }
5268
5269 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
5270 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 1) (11,-1) (19,-2) (-1,2) ( 8,-2) )
5271 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
5272 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
5273 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
5274 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
5275 {
5276 test_ = "Sparse matrix addition assignment test 13";
5277
5278 {
5279 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
5280 mat(0,0) = cplx(11, 0);
5281 mat(0,1) = cplx(22, 0);
5282 mat(0,2) = cplx( 7,-5);
5283 mat(0,3) = cplx(17,-4);
5284 mat(1,0) = cplx(22, 0);
5285 mat(1,1) = cplx(15, 1);
5286 mat(1,2) = cplx(11,-1);
5287 mat(1,3) = cplx(19,-2);
5288
5289 HT herm;
5290 init( herm );
5291
5292 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
5293
5294 try {
5295 sm += mat;
5296
5297 std::ostringstream oss;
5298 oss << " Test: " << test_ << "\n"
5299 << " Error: Assignment of invalid matrix succeeded\n"
5300 << " Details:\n"
5301 << " Result:\n" << herm << "\n";
5302 throw std::runtime_error( oss.str() );
5303 }
5304 catch( std::invalid_argument& ) {}
5305 }
5306
5307 {
5308 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
5309 mat(0,0) = cplx(11,0);
5310 mat(0,1) = cplx(22,0);
5311 mat(1,0) = cplx(22,0);
5312 mat(1,1) = cplx(15,1);
5313 mat(2,0) = cplx( 7,5);
5314 mat(2,1) = cplx(11,1);
5315 mat(3,0) = cplx(17,4);
5316 mat(3,1) = cplx(19,2);
5317
5318 HT herm;
5319 init( herm );
5320
5321 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
5322
5323 try {
5324 sm += mat;
5325
5326 std::ostringstream oss;
5327 oss << " Test: " << test_ << "\n"
5328 << " Error: Assignment of invalid matrix succeeded\n"
5329 << " Details:\n"
5330 << " Result:\n" << herm << "\n";
5331 throw std::runtime_error( oss.str() );
5332 }
5333 catch( std::invalid_argument& ) {}
5334 }
5335 }
5336
5337 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
5338 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
5339 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
5340 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 1) (19, 1) ( 0, 0) )
5341 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
5342 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
5343 {
5344 test_ = "Sparse matrix addition assignment test 14";
5345
5346 {
5347 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
5348 mat(0,0) = cplx(12,-1);
5349 mat(0,1) = cplx(15, 0);
5350 mat(0,2) = cplx(13, 1);
5351 mat(0,3) = cplx(15,-3);
5352 mat(1,0) = cplx(13,-2);
5353 mat(1,1) = cplx(13,-1);
5354 mat(1,2) = cplx( 6, 1);
5355 mat(1,3) = cplx(12, 0);
5356
5357 HT herm;
5358 init( herm );
5359
5360 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
5361
5362 try {
5363 sm += mat;
5364
5365 std::ostringstream oss;
5366 oss << " Test: " << test_ << "\n"
5367 << " Error: Assignment of invalid matrix succeeded\n"
5368 << " Details:\n"
5369 << " Result:\n" << herm << "\n";
5370 throw std::runtime_error( oss.str() );
5371 }
5372 catch( std::invalid_argument& ) {}
5373 }
5374
5375 {
5376 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
5377 mat(0,0) = cplx(12, 1);
5378 mat(0,1) = cplx(13, 2);
5379 mat(1,0) = cplx(15, 0);
5380 mat(1,1) = cplx(13, 1);
5381 mat(2,0) = cplx(13,-1);
5382 mat(2,1) = cplx( 6, 1);
5383 mat(3,0) = cplx(15, 3);
5384 mat(3,1) = cplx(12, 0);
5385
5386 HT herm;
5387 init( herm );
5388
5389 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
5390
5391 try {
5392 sm += mat;
5393
5394 std::ostringstream oss;
5395 oss << " Test: " << test_ << "\n"
5396 << " Error: Assignment of invalid matrix succeeded\n"
5397 << " Details:\n"
5398 << " Result:\n" << herm << "\n";
5399 throw std::runtime_error( oss.str() );
5400 }
5401 catch( std::invalid_argument& ) {}
5402 }
5403 }
5404
5405 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
5406 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
5407 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
5408 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
5409 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
5410 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 1) )
5411 {
5412 test_ = "Sparse matrix addition assignment test 15";
5413
5414 {
5415 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
5416 mat(0,0) = cplx(12,-1);
5417 mat(0,1) = cplx(11, 2);
5418 mat(0,2) = cplx(13, 0);
5419 mat(0,3) = cplx(15, 1);
5420 mat(1,0) = cplx(15,-2);
5421 mat(1,1) = cplx(14, 0);
5422 mat(1,2) = cplx(15,-1);
5423 mat(1,3) = cplx(12, 1);
5424
5425 HT herm;
5426 init( herm );
5427
5428 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
5429
5430 try {
5431 sm += mat;
5432
5433 std::ostringstream oss;
5434 oss << " Test: " << test_ << "\n"
5435 << " Error: Assignment of invalid matrix succeeded\n"
5436 << " Details:\n"
5437 << " Result:\n" << herm << "\n";
5438 throw std::runtime_error( oss.str() );
5439 }
5440 catch( std::invalid_argument& ) {}
5441 }
5442
5443 {
5444 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
5445 mat(0,0) = cplx(12, 1);
5446 mat(0,1) = cplx(15, 2);
5447 mat(1,0) = cplx(11,-2);
5448 mat(1,1) = cplx(14, 0);
5449 mat(2,0) = cplx(13, 0);
5450 mat(2,1) = cplx(15, 1);
5451 mat(3,0) = cplx(15,-1);
5452 mat(3,1) = cplx(12, 1);
5453
5454 HT herm;
5455 init( herm );
5456
5457 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
5458
5459 try {
5460 sm += mat;
5461
5462 std::ostringstream oss;
5463 oss << " Test: " << test_ << "\n"
5464 << " Error: Assignment of invalid matrix succeeded\n"
5465 << " Details:\n"
5466 << " Result:\n" << herm << "\n";
5467 throw std::runtime_error( oss.str() );
5468 }
5469 catch( std::invalid_argument& ) {}
5470 }
5471 }
5472
5473 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
5474 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
5475 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
5476 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 1) (14, 4) ( 0, 0) )
5477 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
5478 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
5479 {
5480 test_ = "Sparse matrix addition assignment test 16";
5481
5482 {
5483 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
5484 mat(0,0) = cplx( 5, 4);
5485 mat(0,1) = cplx(18,-3);
5486 mat(0,2) = cplx(11, 0);
5487 mat(0,3) = cplx(10,-2);
5488 mat(1,0) = cplx(15,-1);
5489 mat(1,1) = cplx(14, 0);
5490 mat(1,2) = cplx(10, 2);
5491 mat(1,3) = cplx(14, 1);
5492 mat(2,0) = cplx(14, 3);
5493 mat(2,1) = cplx(12, 4);
5494 mat(2,2) = cplx(12, 1);
5495 mat(2,3) = cplx( 7,-3);
5496
5497 HT herm;
5498 init( herm );
5499
5500 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
5501
5502 try {
5503 sm += mat;
5504
5505 std::ostringstream oss;
5506 oss << " Test: " << test_ << "\n"
5507 << " Error: Assignment of invalid matrix succeeded\n"
5508 << " Details:\n"
5509 << " Result:\n" << herm << "\n";
5510 throw std::runtime_error( oss.str() );
5511 }
5512 catch( std::invalid_argument& ) {}
5513 }
5514
5515 {
5516 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
5517 mat(0,0) = cplx( 5,-4);
5518 mat(0,1) = cplx(15, 1);
5519 mat(0,2) = cplx(14,-3);
5520 mat(1,0) = cplx(18, 3);
5521 mat(1,1) = cplx(14, 1);
5522 mat(1,2) = cplx(12,-4);
5523 mat(2,0) = cplx(11, 0);
5524 mat(2,1) = cplx(10,-2);
5525 mat(2,2) = cplx(12,-1);
5526 mat(3,0) = cplx(10, 2);
5527 mat(3,1) = cplx(14, 1);
5528 mat(3,2) = cplx( 7, 3);
5529
5530 HT herm;
5531 init( herm );
5532
5533 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
5534
5535 try {
5536 sm += mat;
5537
5538 std::ostringstream oss;
5539 oss << " Test: " << test_ << "\n"
5540 << " Error: Assignment of invalid matrix succeeded\n"
5541 << " Details:\n"
5542 << " Result:\n" << herm << "\n";
5543 throw std::runtime_error( oss.str() );
5544 }
5545 catch( std::invalid_argument& ) {}
5546 }
5547 }
5548 }
5549 //*************************************************************************************************
5550
5551
5552 //*************************************************************************************************
5553 /*!\brief Test of the subtraction assignment to a submatrix of a HermitianMatrix.
5554 //
5555 // \return void
5556 // \exception std::runtime_error Error detected.
5557 //
5558 // This function performs a test of the subtraction assignment to a submatrix of a HermitianMatrix.
5559 // In case an error is detected, a \a std::runtime_error exception is thrown.
5560 */
5561 template< typename HT > // Type of the Hermitian matrix
testSubAssign()5562 void SubmatrixComplexTest::testSubAssign()
5563 {
5564 //=====================================================================================
5565 // Dense matrix subtraction assignment
5566 //=====================================================================================
5567
5568 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
5569 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
5570 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
5571 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
5572 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
5573 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
5574 {
5575 test_ = "Dense matrix subtraction assignment test 1";
5576
5577 {
5578 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
5579 mat(0,0) = cplx(-11,0);
5580 mat(0,1) = cplx(-22,0);
5581 mat(0,2) = cplx( -7,5);
5582 mat(0,3) = cplx(-17,4);
5583 mat(1,0) = cplx(-22,0);
5584 mat(1,1) = cplx(-15,0);
5585 mat(1,2) = cplx(-11,1);
5586 mat(1,3) = cplx(-19,2);
5587
5588 HT herm;
5589 init( herm );
5590
5591 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
5592 sm -= mat;
5593
5594 checkRows ( herm, 6UL );
5595 checkColumns ( herm, 6UL );
5596 checkNonZeros( herm, 30UL );
5597
5598 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) || sm(0,2) != cplx(14,-2) || sm(0,3) != cplx(15,-3) ||
5599 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,-2) ) {
5600 std::ostringstream oss;
5601 oss << " Test: " << test_ << "\n"
5602 << " Error: Assignment to submatrix failed\n"
5603 << " Details:\n"
5604 << " Result:\n" << sm << "\n"
5605 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) )\n"
5606 "( (18,1) (17, 0) (11,-1) (19,-2) )\n";
5607 throw std::runtime_error( oss.str() );
5608 }
5609
5610 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
5611 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
5612 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
5613 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
5614 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
5615 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
5616 std::ostringstream oss;
5617 oss << " Test: " << test_ << "\n"
5618 << " Error: Assignment to submatrix failed\n"
5619 << " Details:\n"
5620 << " Result:\n" << herm << "\n"
5621 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
5622 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
5623 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
5624 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
5625 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
5626 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
5627 throw std::runtime_error( oss.str() );
5628 }
5629 }
5630
5631 {
5632 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
5633 mat(0,0) = cplx(-11, 0);
5634 mat(0,1) = cplx(-22, 0);
5635 mat(1,0) = cplx(-22, 0);
5636 mat(1,1) = cplx(-15, 0);
5637 mat(2,0) = cplx( -7,-5);
5638 mat(2,1) = cplx(-11,-1);
5639 mat(3,0) = cplx(-17,-4);
5640 mat(3,1) = cplx(-19,-2);
5641
5642 HT herm;
5643 init( herm );
5644
5645 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
5646 sm -= mat;
5647
5648 checkRows ( herm, 6UL );
5649 checkColumns ( herm, 6UL );
5650 checkNonZeros( herm, 30UL );
5651
5652 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) ||
5653 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) ||
5654 sm(2,0) != cplx(14,2) || sm(2,1) != cplx(11, 1) ||
5655 sm(3,0) != cplx(15,3) || sm(3,1) != cplx(19, 2) ) {
5656 std::ostringstream oss;
5657 oss << " Test: " << test_ << "\n"
5658 << " Error: Assignment to submatrix failed\n"
5659 << " Details:\n"
5660 << " Result:\n" << sm << "\n"
5661 << " Expected result:\n( (12,0) (18,-1) )\n"
5662 "( (18,1) (17, 0) )\n"
5663 "( (14,2) (11, 1) )\n"
5664 "( (15,3) (19, 2) )\n";
5665 throw std::runtime_error( oss.str() );
5666 }
5667
5668 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
5669 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
5670 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
5671 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
5672 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
5673 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
5674 std::ostringstream oss;
5675 oss << " Test: " << test_ << "\n"
5676 << " Error: Assignment to submatrix failed\n"
5677 << " Details:\n"
5678 << " Result:\n" << herm << "\n"
5679 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
5680 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
5681 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
5682 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
5683 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
5684 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
5685 throw std::runtime_error( oss.str() );
5686 }
5687 }
5688 }
5689
5690 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
5691 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
5692 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
5693 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )
5694 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
5695 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
5696 {
5697 test_ = "Dense matrix subtraction assignment test 2";
5698
5699 {
5700 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
5701 mat(0,0) = cplx(-12, 1);
5702 mat(0,1) = cplx(-15, 0);
5703 mat(0,2) = cplx(-13,-1);
5704 mat(0,3) = cplx(-15, 3);
5705 mat(1,0) = cplx(-13, 2);
5706 mat(1,1) = cplx(-13, 1);
5707 mat(1,2) = cplx( -6, 0);
5708 mat(1,3) = cplx(-12, 0);
5709
5710 HT herm;
5711 init( herm );
5712
5713 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
5714 sm -= mat;
5715
5716 checkRows ( herm, 6UL );
5717 checkColumns ( herm, 6UL );
5718 checkNonZeros( herm, 32UL );
5719
5720 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18, 0) || sm(0,2) != cplx(14,2) || sm(0,3) != cplx(15,-3) ||
5721 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,-2) || sm(1,2) != cplx(11,0) || sm(1,3) != cplx(19, 1) ) {
5722 std::ostringstream oss;
5723 oss << " Test: " << test_ << "\n"
5724 << " Error: Assignment to submatrix failed\n"
5725 << " Details:\n"
5726 << " Result:\n" << sm << "\n"
5727 << " Expected result:\n( (12,-1) (18, 0) (14,2) (15,-3) )\n"
5728 "( (13,-2) (14,-2) (11,0) (19, 1) )\n";
5729 throw std::runtime_error( oss.str() );
5730 }
5731
5732 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
5733 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
5734 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
5735 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
5736 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
5737 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
5738 std::ostringstream oss;
5739 oss << " Test: " << test_ << "\n"
5740 << " Error: Assignment to submatrix failed\n"
5741 << " Details:\n"
5742 << " Result:\n" << herm << "\n"
5743 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
5744 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
5745 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
5746 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
5747 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
5748 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
5749 throw std::runtime_error( oss.str() );
5750 }
5751 }
5752
5753 {
5754 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
5755 mat(0,0) = cplx(-12,-1);
5756 mat(0,1) = cplx(-13,-2);
5757 mat(1,0) = cplx(-15, 0);
5758 mat(1,1) = cplx(-13,-1);
5759 mat(2,0) = cplx(-13, 1);
5760 mat(2,1) = cplx( -6, 0);
5761 mat(3,0) = cplx(-15,-3);
5762 mat(3,1) = cplx(-12, 0);
5763
5764 HT herm;
5765 init( herm );
5766
5767 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
5768 sm -= mat;
5769
5770 checkRows ( herm, 6UL );
5771 checkColumns ( herm, 6UL );
5772 checkNonZeros( herm, 32UL );
5773
5774 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13, 2) ||
5775 sm(1,0) != cplx(18, 0) || sm(1,1) != cplx(14, 2) ||
5776 sm(2,0) != cplx(14,-2) || sm(2,1) != cplx(11, 0) ||
5777 sm(3,0) != cplx(15, 3) || sm(3,1) != cplx(19,-1) ) {
5778 std::ostringstream oss;
5779 oss << " Test: " << test_ << "\n"
5780 << " Error: Assignment to submatrix failed\n"
5781 << " Details:\n"
5782 << " Result:\n" << sm << "\n"
5783 << " Expected result:\n( (12, 1) (13, 2) )\n"
5784 "( (18, 0) (14, 2) )\n"
5785 "( (14,-2) (11, 0) )\n"
5786 "( (15, 3) (19,-1) )\n";
5787 throw std::runtime_error( oss.str() );
5788 }
5789
5790 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
5791 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
5792 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
5793 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
5794 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
5795 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
5796 std::ostringstream oss;
5797 oss << " Test: " << test_ << "\n"
5798 << " Error: Assignment to submatrix failed\n"
5799 << " Details:\n"
5800 << " Result:\n" << herm << "\n"
5801 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
5802 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
5803 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
5804 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
5805 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
5806 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
5807 throw std::runtime_error( oss.str() );
5808 }
5809 }
5810 }
5811
5812 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
5813 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
5814 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
5815 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
5816 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
5817 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )
5818 {
5819 test_ = "Dense matrix subtraction assignment test 3";
5820
5821 {
5822 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
5823 mat(0,0) = cplx(-12, 1);
5824 mat(0,1) = cplx(-11,-2);
5825 mat(0,2) = cplx(-13, 0);
5826 mat(0,3) = cplx(-15,-1);
5827 mat(1,0) = cplx(-15, 2);
5828 mat(1,1) = cplx(-14, 0);
5829 mat(1,2) = cplx(-15, 1);
5830 mat(1,3) = cplx(-12, 0);
5831
5832 HT herm;
5833 init( herm );
5834
5835 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
5836 sm -= mat;
5837
5838 checkRows ( herm, 6UL );
5839 checkColumns ( herm, 6UL );
5840 checkNonZeros( herm, 30UL );
5841
5842 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18,1) || sm(0,2) != cplx(14, 0) || sm(0,3) != cplx(11,1) ||
5843 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,0) ) {
5844 std::ostringstream oss;
5845 oss << " Test: " << test_ << "\n"
5846 << " Error: Assignment to submatrix failed\n"
5847 << " Details:\n"
5848 << " Result:\n" << sm << "\n"
5849 << " Expected result:\n( (12,-1) (18,1) (14, 0) (11,1) )\n"
5850 "( (13,-2) (14,0) (11,-1) (19,0) )\n";
5851 throw std::runtime_error( oss.str() );
5852 }
5853
5854 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
5855 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
5856 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
5857 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
5858 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
5859 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
5860 std::ostringstream oss;
5861 oss << " Test: " << test_ << "\n"
5862 << " Error: Assignment to submatrix failed\n"
5863 << " Details:\n"
5864 << " Result:\n" << herm << "\n"
5865 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
5866 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
5867 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
5868 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
5869 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
5870 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
5871 throw std::runtime_error( oss.str() );
5872 }
5873 }
5874
5875 {
5876 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
5877 mat(0,0) = cplx(-12,-1);
5878 mat(0,1) = cplx(-15,-2);
5879 mat(1,0) = cplx(-11, 2);
5880 mat(1,1) = cplx(-14, 0);
5881 mat(2,0) = cplx(-13, 0);
5882 mat(2,1) = cplx(-15,-1);
5883 mat(3,0) = cplx(-15, 1);
5884 mat(3,1) = cplx(-12, 0);
5885
5886 HT herm;
5887 init( herm );
5888
5889 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
5890 sm -= mat;
5891
5892 checkRows ( herm, 6UL );
5893 checkColumns ( herm, 6UL );
5894 checkNonZeros( herm, 30UL );
5895
5896 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13,2) ||
5897 sm(1,0) != cplx(18,-1) || sm(1,1) != cplx(14,0) ||
5898 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,1) ||
5899 sm(3,0) != cplx(11,-1) || sm(3,1) != cplx(19,0) ) {
5900 std::ostringstream oss;
5901 oss << " Test: " << test_ << "\n"
5902 << " Error: Assignment to submatrix failed\n"
5903 << " Details:\n"
5904 << " Result:\n" << sm << "\n"
5905 << " Expected result:\n( (12, 1) (13,2) )\n"
5906 "( (18,-1) (14,0) )\n"
5907 "( (14, 0) (11,1) )\n"
5908 "( (11,-1) (19,0) )\n";
5909 throw std::runtime_error( oss.str() );
5910 }
5911
5912 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
5913 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
5914 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
5915 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
5916 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
5917 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
5918 std::ostringstream oss;
5919 oss << " Test: " << test_ << "\n"
5920 << " Error: Assignment to submatrix failed\n"
5921 << " Details:\n"
5922 << " Result:\n" << herm << "\n"
5923 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
5924 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
5925 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
5926 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
5927 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
5928 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
5929 throw std::runtime_error( oss.str() );
5930 }
5931 }
5932 }
5933
5934 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
5935 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
5936 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
5937 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )
5938 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
5939 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
5940 {
5941 test_ = "Dense matrix subtraction assignment test 4";
5942
5943 {
5944 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
5945 mat(0,0) = cplx( -5,-4);
5946 mat(0,1) = cplx(-18, 3);
5947 mat(0,2) = cplx(-11, 0);
5948 mat(0,3) = cplx(-10, 2);
5949 mat(1,0) = cplx(-15, 1);
5950 mat(1,1) = cplx(-14, 0);
5951 mat(1,2) = cplx(-10,-2);
5952 mat(1,3) = cplx(-14, 0);
5953 mat(2,0) = cplx(-14,-3);
5954 mat(2,1) = cplx(-12,-4);
5955 mat(2,2) = cplx(-12,-1);
5956 mat(2,3) = cplx( -7, 3);
5957
5958 HT herm;
5959 init( herm );
5960
5961 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
5962 sm -= mat;
5963
5964 checkRows ( herm, 6UL );
5965 checkColumns ( herm, 6UL );
5966 checkNonZeros( herm, 32UL );
5967
5968 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(18,-3) || sm(0,2) != cplx(14,0) || sm(0,3) != cplx(11,-1) ||
5969 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,1) || sm(1,3) != cplx(19, 0) ||
5970 sm(2,0) != cplx(19, 3) || sm(2,1) != cplx(11, 2) || sm(2,2) != cplx(12,1) || sm(2,3) != cplx(14,-4) ) {
5971 std::ostringstream oss;
5972 oss << " Test: " << test_ << "\n"
5973 << " Error: Assignment to submatrix failed\n"
5974 << " Details:\n"
5975 << " Result:\n" << sm << "\n"
5976 << " Expected result:\n( (12, 1) (18,-3) (14, 0) (11,-1) )\n"
5977 "( (13,-2) (14, 0) (11, 1) (19, 0) )\n"
5978 "( (19, 3) (11, 2) (12, 1) (14,-4) )\n";
5979 throw std::runtime_error( oss.str() );
5980 }
5981
5982 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
5983 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
5984 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
5985 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
5986 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
5987 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
5988 std::ostringstream oss;
5989 oss << " Test: " << test_ << "\n"
5990 << " Error: Assignment to submatrix failed\n"
5991 << " Details:\n"
5992 << " Result:\n" << herm << "\n"
5993 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
5994 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
5995 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
5996 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
5997 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
5998 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
5999 throw std::runtime_error( oss.str() );
6000 }
6001 }
6002
6003 {
6004 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
6005 mat(0,0) = cplx( -5, 4);
6006 mat(0,1) = cplx(-15,-1);
6007 mat(0,2) = cplx(-14, 3);
6008 mat(1,0) = cplx(-18,-3);
6009 mat(1,1) = cplx(-14, 0);
6010 mat(1,2) = cplx(-12, 4);
6011 mat(2,0) = cplx(-11, 0);
6012 mat(2,1) = cplx(-10, 2);
6013 mat(2,2) = cplx(-12, 1);
6014 mat(3,0) = cplx(-10,-2);
6015 mat(3,1) = cplx(-14, 0);
6016 mat(3,2) = cplx( -7,-3);
6017
6018 HT herm;
6019 init( herm );
6020
6021 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
6022 sm -= mat;
6023
6024 checkRows ( herm, 6UL );
6025 checkColumns ( herm, 6UL );
6026 checkNonZeros( herm, 32UL );
6027
6028 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(13, 2) || sm(0,2) != cplx(19,-3) ||
6029 sm(1,0) != cplx(18, 3) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,-2) ||
6030 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,-1) || sm(2,2) != cplx(12,-1) ||
6031 sm(3,0) != cplx(11, 1) || sm(3,1) != cplx(19, 0) || sm(3,2) != cplx(14, 4) ) {
6032 std::ostringstream oss;
6033 oss << " Test: " << test_ << "\n"
6034 << " Error: Assignment to submatrix failed\n"
6035 << " Details:\n"
6036 << " Result:\n" << sm << "\n"
6037 << " Expected result:\n( (12,-1) (13, 2) (19,-3) )\n"
6038 "( (18, 3) (14, 0) (11,-2) )\n"
6039 "( (14, 0) (11,-1) (12,-1) )\n"
6040 "( (11, 1) (19, 0) (14, 4) )\n";
6041 throw std::runtime_error( oss.str() );
6042 }
6043
6044 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
6045 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
6046 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
6047 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
6048 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
6049 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
6050 std::ostringstream oss;
6051 oss << " Test: " << test_ << "\n"
6052 << " Error: Assignment to submatrix failed\n"
6053 << " Details:\n"
6054 << " Result:\n" << herm << "\n"
6055 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
6056 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
6057 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
6058 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
6059 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
6060 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
6061 throw std::runtime_error( oss.str() );
6062 }
6063 }
6064 }
6065
6066 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
6067 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (22,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
6068 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
6069 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
6070 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
6071 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
6072 {
6073 test_ = "Dense matrix subtraction assignment test 5";
6074
6075 {
6076 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
6077 mat(0,0) = cplx(-11,0);
6078 mat(0,1) = cplx(-22,0);
6079 mat(0,2) = cplx( -7,5);
6080 mat(0,3) = cplx(-17,4);
6081 mat(1,0) = cplx(-26,0);
6082 mat(1,1) = cplx(-15,0);
6083 mat(1,2) = cplx(-11,1);
6084 mat(1,3) = cplx(-19,2);
6085
6086 HT herm;
6087 init( herm );
6088
6089 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
6090
6091 try {
6092 sm -= mat;
6093
6094 std::ostringstream oss;
6095 oss << " Test: " << test_ << "\n"
6096 << " Error: Assignment of invalid matrix succeeded\n"
6097 << " Details:\n"
6098 << " Result:\n" << herm << "\n";
6099 throw std::runtime_error( oss.str() );
6100 }
6101 catch( std::invalid_argument& ) {}
6102 }
6103
6104 {
6105 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
6106 mat(0,0) = cplx(-11, 0);
6107 mat(0,1) = cplx(-22, 0);
6108 mat(1,0) = cplx(-26, 0);
6109 mat(1,1) = cplx(-15, 0);
6110 mat(2,0) = cplx( -7,-5);
6111 mat(2,1) = cplx(-11,-1);
6112 mat(3,0) = cplx(-17,-4);
6113 mat(3,1) = cplx(-19,-2);
6114
6115 HT herm;
6116 init( herm );
6117
6118 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
6119
6120 try {
6121 sm -= mat;
6122
6123 std::ostringstream oss;
6124 oss << " Test: " << test_ << "\n"
6125 << " Error: Assignment of invalid matrix succeeded\n"
6126 << " Details:\n"
6127 << " Result:\n" << herm << "\n";
6128 throw std::runtime_error( oss.str() );
6129 }
6130 catch( std::invalid_argument& ) {}
6131 }
6132 }
6133
6134 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
6135 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
6136 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
6137 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (22,-2) (11, 0) (19, 1) ( 0, 0) )
6138 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
6139 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
6140 {
6141 test_ = "Dense matrix subtraction assignment test 6";
6142
6143 {
6144 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
6145 mat(0,0) = cplx(-12, 1);
6146 mat(0,1) = cplx(-15, 0);
6147 mat(0,2) = cplx(-13,-1);
6148 mat(0,3) = cplx(-15, 3);
6149 mat(1,0) = cplx(-13, 2);
6150 mat(1,1) = cplx(-21, 1);
6151 mat(1,2) = cplx( -6, 0);
6152 mat(1,3) = cplx(-12, 0);
6153
6154 HT herm;
6155 init( herm );
6156
6157 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
6158
6159 try {
6160 sm -= mat;
6161
6162 std::ostringstream oss;
6163 oss << " Test: " << test_ << "\n"
6164 << " Error: Assignment of invalid matrix succeeded\n"
6165 << " Details:\n"
6166 << " Result:\n" << herm << "\n";
6167 throw std::runtime_error( oss.str() );
6168 }
6169 catch( std::invalid_argument& ) {}
6170 }
6171
6172 {
6173 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
6174 mat(0,0) = cplx(-12,-1);
6175 mat(0,1) = cplx(-13,-2);
6176 mat(1,0) = cplx(-15, 0);
6177 mat(1,1) = cplx(-13,-1);
6178 mat(2,0) = cplx(-21, 1);
6179 mat(2,1) = cplx( -6, 0);
6180 mat(3,0) = cplx(-15,-3);
6181 mat(3,1) = cplx(-12, 0);
6182
6183 HT herm;
6184 init( herm );
6185
6186 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
6187
6188 try {
6189 sm -= mat;
6190
6191 std::ostringstream oss;
6192 oss << " Test: " << test_ << "\n"
6193 << " Error: Assignment of invalid matrix succeeded\n"
6194 << " Details:\n"
6195 << " Result:\n" << herm << "\n";
6196 throw std::runtime_error( oss.str() );
6197 }
6198 catch( std::invalid_argument& ) {}
6199 }
6200 }
6201
6202 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
6203 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
6204 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
6205 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
6206 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
6207 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (22,-1) (19, 0) )
6208 {
6209 test_ = "Dense matrix subtraction assignment test 7";
6210
6211 {
6212 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
6213 mat(0,0) = cplx(-12, 1);
6214 mat(0,1) = cplx(-11,-2);
6215 mat(0,2) = cplx(-13, 0);
6216 mat(0,3) = cplx(-15,-1);
6217 mat(1,0) = cplx(-15, 2);
6218 mat(1,1) = cplx(-14, 0);
6219 mat(1,2) = cplx(-26, 1);
6220 mat(1,3) = cplx(-12, 0);
6221
6222 HT herm;
6223 init( herm );
6224
6225 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
6226
6227 try {
6228 sm -= mat;
6229
6230 std::ostringstream oss;
6231 oss << " Test: " << test_ << "\n"
6232 << " Error: Assignment of invalid matrix succeeded\n"
6233 << " Details:\n"
6234 << " Result:\n" << herm << "\n";
6235 throw std::runtime_error( oss.str() );
6236 }
6237 catch( std::invalid_argument& ) {}
6238 }
6239
6240 {
6241 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
6242 mat(0,0) = cplx(-12,-1);
6243 mat(0,1) = cplx(-15,-2);
6244 mat(1,0) = cplx(-11, 2);
6245 mat(1,1) = cplx(-14, 0);
6246 mat(2,0) = cplx(-13, 0);
6247 mat(2,1) = cplx(-15,-1);
6248 mat(3,0) = cplx(-26, 1);
6249 mat(3,1) = cplx(-12, 0);
6250
6251 HT herm;
6252 init( herm );
6253
6254 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
6255
6256 try {
6257 sm -= mat;
6258
6259 std::ostringstream oss;
6260 oss << " Test: " << test_ << "\n"
6261 << " Error: Assignment of invalid matrix succeeded\n"
6262 << " Details:\n"
6263 << " Result:\n" << herm << "\n";
6264 throw std::runtime_error( oss.str() );
6265 }
6266 catch( std::invalid_argument& ) {}
6267 }
6268 }
6269
6270 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
6271 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
6272 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
6273 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (22, 1) (19, 0) (14, 4) ( 0, 0) )
6274 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
6275 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
6276 {
6277 test_ = "Dense matrix subtraction assignment test 8";
6278
6279 {
6280 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
6281 mat(0,0) = cplx( -5,-4);
6282 mat(0,1) = cplx(-18, 3);
6283 mat(0,2) = cplx(-11, 0);
6284 mat(0,3) = cplx(-10, 2);
6285 mat(1,0) = cplx(-15, 1);
6286 mat(1,1) = cplx(-14, 0);
6287 mat(1,2) = cplx(-21,-2);
6288 mat(1,3) = cplx(-14, 0);
6289 mat(2,0) = cplx(-14,-3);
6290 mat(2,1) = cplx(-12,-4);
6291 mat(2,2) = cplx(-12,-1);
6292 mat(2,3) = cplx( -7, 3);
6293
6294 HT herm;
6295 init( herm );
6296
6297 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
6298
6299 try {
6300 sm -= mat;
6301
6302 std::ostringstream oss;
6303 oss << " Test: " << test_ << "\n"
6304 << " Error: Assignment of invalid matrix succeeded\n"
6305 << " Details:\n"
6306 << " Result:\n" << herm << "\n";
6307 throw std::runtime_error( oss.str() );
6308 }
6309 catch( std::invalid_argument& ) {}
6310 }
6311
6312 {
6313 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
6314 mat(0,0) = cplx( -5, 4);
6315 mat(0,1) = cplx(-15,-1);
6316 mat(0,2) = cplx(-14, 3);
6317 mat(1,0) = cplx(-18,-3);
6318 mat(1,1) = cplx(-14, 0);
6319 mat(1,2) = cplx(-12, 4);
6320 mat(2,0) = cplx(-11, 0);
6321 mat(2,1) = cplx(-10, 2);
6322 mat(2,2) = cplx(-12, 1);
6323 mat(3,0) = cplx(-21,-2);
6324 mat(3,1) = cplx(-14, 0);
6325 mat(3,2) = cplx( -7,-3);
6326
6327 HT herm;
6328 init( herm );
6329
6330 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
6331
6332 try {
6333 sm -= mat;
6334
6335 std::ostringstream oss;
6336 oss << " Test: " << test_ << "\n"
6337 << " Error: Assignment of invalid matrix succeeded\n"
6338 << " Details:\n"
6339 << " Result:\n" << herm << "\n";
6340 throw std::runtime_error( oss.str() );
6341 }
6342 catch( std::invalid_argument& ) {}
6343 }
6344 }
6345
6346 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12, 0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
6347 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,-1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
6348 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14, 2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
6349 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15, 3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
6350 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
6351 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
6352 {
6353 test_ = "Dense matrix subtraction assignment test 9";
6354
6355 {
6356 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
6357 mat(0,0) = cplx(-11,0);
6358 mat(0,1) = cplx(-22,0);
6359 mat(0,2) = cplx( -7,5);
6360 mat(0,3) = cplx(-17,4);
6361 mat(1,0) = cplx(-22,2);
6362 mat(1,1) = cplx(-15,0);
6363 mat(1,2) = cplx(-11,1);
6364 mat(1,3) = cplx(-19,2);
6365
6366 HT herm;
6367 init( herm );
6368
6369 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
6370
6371 try {
6372 sm -= mat;
6373
6374 std::ostringstream oss;
6375 oss << " Test: " << test_ << "\n"
6376 << " Error: Assignment of invalid matrix succeeded\n"
6377 << " Details:\n"
6378 << " Result:\n" << herm << "\n";
6379 throw std::runtime_error( oss.str() );
6380 }
6381 catch( std::invalid_argument& ) {}
6382 }
6383
6384 {
6385 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
6386 mat(0,0) = cplx(-11, 0);
6387 mat(0,1) = cplx(-22, 0);
6388 mat(1,0) = cplx(-22, 2);
6389 mat(1,1) = cplx(-15, 0);
6390 mat(2,0) = cplx( -7,-5);
6391 mat(2,1) = cplx(-11,-1);
6392 mat(3,0) = cplx(-17,-4);
6393 mat(3,1) = cplx(-19,-2);
6394
6395 HT herm;
6396 init( herm );
6397
6398 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
6399
6400 try {
6401 sm -= mat;
6402
6403 std::ostringstream oss;
6404 oss << " Test: " << test_ << "\n"
6405 << " Error: Assignment of invalid matrix succeeded\n"
6406 << " Details:\n"
6407 << " Result:\n" << herm << "\n";
6408 throw std::runtime_error( oss.str() );
6409 }
6410 catch( std::invalid_argument& ) {}
6411 }
6412 }
6413
6414 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7,3) (-2, 1) ( 5, 0) ( 0, 0) )
6415 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12,1) (13, 2) (-1, 2) ( 8,-2) )
6416 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18,0) (14, 2) (15,-3) (-2, 0) )
6417 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,2) (11, 0) (19, 1) ( 0, 0) )
6418 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15,3) (19,-1) ( 1, 0) (-4, 0) )
6419 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2,0) ( 0, 0) (-4, 0) ( 7, 0) )
6420 {
6421 test_ = "Dense matrix subtraction assignment test 10";
6422
6423 {
6424 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
6425 mat(0,0) = cplx(-12, 1);
6426 mat(0,1) = cplx(-15, 0);
6427 mat(0,2) = cplx(-13,-1);
6428 mat(0,3) = cplx(-15, 3);
6429 mat(1,0) = cplx(-13, 2);
6430 mat(1,1) = cplx(-13, 3);
6431 mat(1,2) = cplx( -6, 0);
6432 mat(1,3) = cplx(-12, 0);
6433
6434 HT herm;
6435 init( herm );
6436
6437 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
6438
6439 try {
6440 sm -= mat;
6441
6442 std::ostringstream oss;
6443 oss << " Test: " << test_ << "\n"
6444 << " Error: Assignment of invalid matrix succeeded\n"
6445 << " Details:\n"
6446 << " Result:\n" << herm << "\n";
6447 throw std::runtime_error( oss.str() );
6448 }
6449 catch( std::invalid_argument& ) {}
6450 }
6451
6452 {
6453 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
6454 mat(0,0) = cplx(-12,-1);
6455 mat(0,1) = cplx(-13,-2);
6456 mat(1,0) = cplx(-15, 0);
6457 mat(1,1) = cplx(-13,-1);
6458 mat(2,0) = cplx(-13, 3);
6459 mat(2,1) = cplx( -6, 0);
6460 mat(3,0) = cplx(-15,-3);
6461 mat(3,1) = cplx(-12, 0);
6462
6463 HT herm;
6464 init( herm );
6465
6466 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
6467
6468 try {
6469 sm -= mat;
6470
6471 std::ostringstream oss;
6472 oss << " Test: " << test_ << "\n"
6473 << " Error: Assignment of invalid matrix succeeded\n"
6474 << " Details:\n"
6475 << " Result:\n" << herm << "\n";
6476 throw std::runtime_error( oss.str() );
6477 }
6478 catch( std::invalid_argument& ) {}
6479 }
6480 }
6481
6482 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
6483 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
6484 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
6485 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
6486 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
6487 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11, 1) (19, 0) )
6488 {
6489 test_ = "Dense matrix subtraction assignment test 11";
6490
6491 {
6492 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
6493 mat(0,0) = cplx(-12, 1);
6494 mat(0,1) = cplx(-11,-2);
6495 mat(0,2) = cplx(-13, 0);
6496 mat(0,3) = cplx(-15,-1);
6497 mat(1,0) = cplx(-15, 2);
6498 mat(1,1) = cplx(-14, 0);
6499 mat(1,2) = cplx(-15,-1);
6500 mat(1,3) = cplx(-12, 0);
6501
6502 HT herm;
6503 init( herm );
6504
6505 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
6506
6507 try {
6508 sm -= mat;
6509
6510 std::ostringstream oss;
6511 oss << " Test: " << test_ << "\n"
6512 << " Error: Assignment of invalid matrix succeeded\n"
6513 << " Details:\n"
6514 << " Result:\n" << herm << "\n";
6515 throw std::runtime_error( oss.str() );
6516 }
6517 catch( std::invalid_argument& ) {}
6518 }
6519
6520 {
6521 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
6522 mat(0,0) = cplx(-12,-1);
6523 mat(0,1) = cplx(-15,-2);
6524 mat(1,0) = cplx(-11, 2);
6525 mat(1,1) = cplx(-14, 0);
6526 mat(2,0) = cplx(-13, 0);
6527 mat(2,1) = cplx(-15,-1);
6528 mat(3,0) = cplx(-15,-1);
6529 mat(3,1) = cplx(-12, 0);
6530
6531 HT herm;
6532 init( herm );
6533
6534 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
6535
6536 try {
6537 sm -= mat;
6538
6539 std::ostringstream oss;
6540 oss << " Test: " << test_ << "\n"
6541 << " Error: Assignment of invalid matrix succeeded\n"
6542 << " Details:\n"
6543 << " Result:\n" << herm << "\n";
6544 throw std::runtime_error( oss.str() );
6545 }
6546 catch( std::invalid_argument& ) {}
6547 }
6548 }
6549
6550 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
6551 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
6552 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
6553 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11,-1) (19, 0) (14, 4) ( 0, 0) )
6554 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
6555 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
6556 {
6557 test_ = "Dense matrix subtraction assignment test 12";
6558
6559 {
6560 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
6561 mat(0,0) = cplx( -5,-4);
6562 mat(0,1) = cplx(-18, 3);
6563 mat(0,2) = cplx(-11, 0);
6564 mat(0,3) = cplx(-10, 2);
6565 mat(1,0) = cplx(-15, 1);
6566 mat(1,1) = cplx(-14, 0);
6567 mat(1,2) = cplx(-10, 0);
6568 mat(1,3) = cplx(-14, 0);
6569 mat(2,0) = cplx(-14,-3);
6570 mat(2,1) = cplx(-12,-4);
6571 mat(2,2) = cplx(-12,-1);
6572 mat(2,3) = cplx( -7, 3);
6573
6574 HT herm;
6575 init( herm );
6576
6577 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
6578
6579 try {
6580 sm -= mat;
6581
6582 std::ostringstream oss;
6583 oss << " Test: " << test_ << "\n"
6584 << " Error: Assignment of invalid matrix succeeded\n"
6585 << " Details:\n"
6586 << " Result:\n" << herm << "\n";
6587 throw std::runtime_error( oss.str() );
6588 }
6589 catch( std::invalid_argument& ) {}
6590 }
6591
6592 {
6593 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
6594 mat(0,0) = cplx( -5, 4);
6595 mat(0,1) = cplx(-15,-1);
6596 mat(0,2) = cplx(-14, 3);
6597 mat(1,0) = cplx(-18,-3);
6598 mat(1,1) = cplx(-14, 0);
6599 mat(1,2) = cplx(-12, 4);
6600 mat(2,0) = cplx(-11, 0);
6601 mat(2,1) = cplx(-10, 2);
6602 mat(2,2) = cplx(-12, 1);
6603 mat(3,0) = cplx(-10, 0);
6604 mat(3,1) = cplx(-14, 0);
6605 mat(3,2) = cplx( -7,-3);
6606
6607 HT herm;
6608 init( herm );
6609
6610 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
6611
6612 try {
6613 sm -= mat;
6614
6615 std::ostringstream oss;
6616 oss << " Test: " << test_ << "\n"
6617 << " Error: Assignment of invalid matrix succeeded\n"
6618 << " Details:\n"
6619 << " Result:\n" << herm << "\n";
6620 throw std::runtime_error( oss.str() );
6621 }
6622 catch( std::invalid_argument& ) {}
6623 }
6624 }
6625
6626 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
6627 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 1) (11,-1) (19,-2) (-1,2) ( 8,-2) )
6628 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
6629 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
6630 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
6631 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
6632 {
6633 test_ = "Dense matrix subtraction assignment test 13";
6634
6635 {
6636 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
6637 mat(0,0) = cplx(-11, 0);
6638 mat(0,1) = cplx(-22, 0);
6639 mat(0,2) = cplx( -7, 5);
6640 mat(0,3) = cplx(-17, 4);
6641 mat(1,0) = cplx(-22, 0);
6642 mat(1,1) = cplx(-15,-1);
6643 mat(1,2) = cplx(-11, 1);
6644 mat(1,3) = cplx(-19, 2);
6645
6646 HT herm;
6647 init( herm );
6648
6649 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
6650
6651 try {
6652 sm -= mat;
6653
6654 std::ostringstream oss;
6655 oss << " Test: " << test_ << "\n"
6656 << " Error: Assignment of invalid matrix succeeded\n"
6657 << " Details:\n"
6658 << " Result:\n" << herm << "\n";
6659 throw std::runtime_error( oss.str() );
6660 }
6661 catch( std::invalid_argument& ) {}
6662 }
6663
6664 {
6665 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
6666 mat(0,0) = cplx(-11, 0);
6667 mat(0,1) = cplx(-22, 0);
6668 mat(1,0) = cplx(-22, 0);
6669 mat(1,1) = cplx(-15,-1);
6670 mat(2,0) = cplx( -7,-5);
6671 mat(2,1) = cplx(-11,-1);
6672 mat(3,0) = cplx(-17,-4);
6673 mat(3,1) = cplx(-19,-2);
6674
6675 HT herm;
6676 init( herm );
6677
6678 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
6679
6680 try {
6681 sm -= mat;
6682
6683 std::ostringstream oss;
6684 oss << " Test: " << test_ << "\n"
6685 << " Error: Assignment of invalid matrix succeeded\n"
6686 << " Details:\n"
6687 << " Result:\n" << herm << "\n";
6688 throw std::runtime_error( oss.str() );
6689 }
6690 catch( std::invalid_argument& ) {}
6691 }
6692 }
6693
6694 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
6695 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
6696 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
6697 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 1) (19, 1) ( 0, 0) )
6698 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
6699 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
6700 {
6701 test_ = "Dense matrix subtraction assignment test 14";
6702
6703 {
6704 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
6705 mat(0,0) = cplx(-12, 1);
6706 mat(0,1) = cplx(-15, 0);
6707 mat(0,2) = cplx(-13,-1);
6708 mat(0,3) = cplx(-15, 3);
6709 mat(1,0) = cplx(-13, 2);
6710 mat(1,1) = cplx(-13, 1);
6711 mat(1,2) = cplx( -6,-1);
6712 mat(1,3) = cplx(-12, 0);
6713
6714 HT herm;
6715 init( herm );
6716
6717 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
6718
6719 try {
6720 sm -= mat;
6721
6722 std::ostringstream oss;
6723 oss << " Test: " << test_ << "\n"
6724 << " Error: Assignment of invalid matrix succeeded\n"
6725 << " Details:\n"
6726 << " Result:\n" << herm << "\n";
6727 throw std::runtime_error( oss.str() );
6728 }
6729 catch( std::invalid_argument& ) {}
6730 }
6731
6732 {
6733 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
6734 mat(0,0) = cplx(-12,-1);
6735 mat(0,1) = cplx(-13,-2);
6736 mat(1,0) = cplx(-15, 0);
6737 mat(1,1) = cplx(-13,-1);
6738 mat(2,0) = cplx(-13, 1);
6739 mat(2,1) = cplx( -6,-1);
6740 mat(3,0) = cplx(-15,-3);
6741 mat(3,1) = cplx(-12, 0);
6742
6743 HT herm;
6744 init( herm );
6745
6746 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
6747
6748 try {
6749 sm -= mat;
6750
6751 std::ostringstream oss;
6752 oss << " Test: " << test_ << "\n"
6753 << " Error: Assignment of invalid matrix succeeded\n"
6754 << " Details:\n"
6755 << " Result:\n" << herm << "\n";
6756 throw std::runtime_error( oss.str() );
6757 }
6758 catch( std::invalid_argument& ) {}
6759 }
6760 }
6761
6762 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
6763 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
6764 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
6765 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
6766 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
6767 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 1) )
6768 {
6769 test_ = "Dense matrix subtraction assignment test 15";
6770
6771 {
6772 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
6773 mat(0,0) = cplx(-12, 1);
6774 mat(0,1) = cplx(-11,-2);
6775 mat(0,2) = cplx(-13, 0);
6776 mat(0,3) = cplx(-15,-1);
6777 mat(1,0) = cplx(-15, 2);
6778 mat(1,1) = cplx(-14, 0);
6779 mat(1,2) = cplx(-15, 1);
6780 mat(1,3) = cplx(-12,-1);
6781
6782 HT herm;
6783 init( herm );
6784
6785 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
6786
6787 try {
6788 sm -= mat;
6789
6790 std::ostringstream oss;
6791 oss << " Test: " << test_ << "\n"
6792 << " Error: Assignment of invalid matrix succeeded\n"
6793 << " Details:\n"
6794 << " Result:\n" << herm << "\n";
6795 throw std::runtime_error( oss.str() );
6796 }
6797 catch( std::invalid_argument& ) {}
6798 }
6799
6800 {
6801 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
6802 mat(0,0) = cplx(-12,-1);
6803 mat(0,1) = cplx(-15,-2);
6804 mat(1,0) = cplx(-11, 2);
6805 mat(1,1) = cplx(-14, 0);
6806 mat(2,0) = cplx(-13, 0);
6807 mat(2,1) = cplx(-15,-1);
6808 mat(3,0) = cplx(-15, 1);
6809 mat(3,1) = cplx(-12,-1);
6810
6811 HT herm;
6812 init( herm );
6813
6814 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
6815
6816 try {
6817 sm -= mat;
6818
6819 std::ostringstream oss;
6820 oss << " Test: " << test_ << "\n"
6821 << " Error: Assignment of invalid matrix succeeded\n"
6822 << " Details:\n"
6823 << " Result:\n" << herm << "\n";
6824 throw std::runtime_error( oss.str() );
6825 }
6826 catch( std::invalid_argument& ) {}
6827 }
6828 }
6829
6830 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
6831 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
6832 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
6833 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 1) (14, 4) ( 0, 0) )
6834 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
6835 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
6836 {
6837 test_ = "Dense matrix subtraction assignment test 16";
6838
6839 {
6840 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
6841 mat(0,0) = cplx( -5,-4);
6842 mat(0,1) = cplx(-18, 3);
6843 mat(0,2) = cplx(-11, 0);
6844 mat(0,3) = cplx(-10, 2);
6845 mat(1,0) = cplx(-15, 1);
6846 mat(1,1) = cplx(-14, 0);
6847 mat(1,2) = cplx(-10,-2);
6848 mat(1,3) = cplx(-14,-1);
6849 mat(2,0) = cplx(-14,-3);
6850 mat(2,1) = cplx(-12,-4);
6851 mat(2,2) = cplx(-12,-1);
6852 mat(2,3) = cplx( -7, 3);
6853
6854 HT herm;
6855 init( herm );
6856
6857 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
6858
6859 try {
6860 sm -= mat;
6861
6862 std::ostringstream oss;
6863 oss << " Test: " << test_ << "\n"
6864 << " Error: Assignment of invalid matrix succeeded\n"
6865 << " Details:\n"
6866 << " Result:\n" << herm << "\n";
6867 throw std::runtime_error( oss.str() );
6868 }
6869 catch( std::invalid_argument& ) {}
6870 }
6871
6872 {
6873 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
6874 mat(0,0) = cplx( -5, 4);
6875 mat(0,1) = cplx(-15,-1);
6876 mat(0,2) = cplx(-14, 3);
6877 mat(1,0) = cplx(-18,-3);
6878 mat(1,1) = cplx(-14,-1);
6879 mat(1,2) = cplx(-12, 4);
6880 mat(2,0) = cplx(-11, 0);
6881 mat(2,1) = cplx(-10, 2);
6882 mat(2,2) = cplx(-12, 1);
6883 mat(3,0) = cplx(-10,-2);
6884 mat(3,1) = cplx(-14,-1);
6885 mat(3,2) = cplx( -7,-3);
6886
6887 HT herm;
6888 init( herm );
6889
6890 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
6891
6892 try {
6893 sm -= mat;
6894
6895 std::ostringstream oss;
6896 oss << " Test: " << test_ << "\n"
6897 << " Error: Assignment of invalid matrix succeeded\n"
6898 << " Details:\n"
6899 << " Result:\n" << herm << "\n";
6900 throw std::runtime_error( oss.str() );
6901 }
6902 catch( std::invalid_argument& ) {}
6903 }
6904 }
6905
6906
6907 //=====================================================================================
6908 // Sparse matrix subtraction assignment
6909 //=====================================================================================
6910
6911 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
6912 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
6913 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
6914 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
6915 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
6916 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
6917 {
6918 test_ = "Sparse matrix subtraction assignment test 1";
6919
6920 {
6921 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
6922 mat(0,0) = cplx(-11,0);
6923 mat(0,1) = cplx(-22,0);
6924 mat(0,2) = cplx( -7,5);
6925 mat(0,3) = cplx(-17,4);
6926 mat(1,0) = cplx(-22,0);
6927 mat(1,1) = cplx(-15,0);
6928 mat(1,2) = cplx(-11,1);
6929 mat(1,3) = cplx(-19,2);
6930
6931 HT herm;
6932 init( herm );
6933
6934 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
6935 sm -= mat;
6936
6937 checkRows ( herm, 6UL );
6938 checkColumns ( herm, 6UL );
6939 checkNonZeros( herm, 30UL );
6940
6941 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) || sm(0,2) != cplx(14,-2) || sm(0,3) != cplx(15,-3) ||
6942 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,-2) ) {
6943 std::ostringstream oss;
6944 oss << " Test: " << test_ << "\n"
6945 << " Error: Assignment to submatrix failed\n"
6946 << " Details:\n"
6947 << " Result:\n" << sm << "\n"
6948 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) )\n"
6949 "( (18,1) (17, 0) (11,-1) (19,-2) )\n";
6950 throw std::runtime_error( oss.str() );
6951 }
6952
6953 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
6954 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
6955 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
6956 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
6957 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
6958 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
6959 std::ostringstream oss;
6960 oss << " Test: " << test_ << "\n"
6961 << " Error: Assignment to submatrix failed\n"
6962 << " Details:\n"
6963 << " Result:\n" << herm << "\n"
6964 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
6965 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
6966 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
6967 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
6968 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
6969 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
6970 throw std::runtime_error( oss.str() );
6971 }
6972 }
6973
6974 {
6975 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
6976 mat(0,0) = cplx(-11, 0);
6977 mat(0,1) = cplx(-22, 0);
6978 mat(1,0) = cplx(-22, 0);
6979 mat(1,1) = cplx(-15, 0);
6980 mat(2,0) = cplx( -7,-5);
6981 mat(2,1) = cplx(-11,-1);
6982 mat(3,0) = cplx(-17,-4);
6983 mat(3,1) = cplx(-19,-2);
6984
6985 HT herm;
6986 init( herm );
6987
6988 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
6989 sm -= mat;
6990
6991 checkRows ( herm, 6UL );
6992 checkColumns ( herm, 6UL );
6993 checkNonZeros( herm, 30UL );
6994
6995 if( sm(0,0) != cplx(12,0) || sm(0,1) != cplx(18,-1) ||
6996 sm(1,0) != cplx(18,1) || sm(1,1) != cplx(17, 0) ||
6997 sm(2,0) != cplx(14,2) || sm(2,1) != cplx(11, 1) ||
6998 sm(3,0) != cplx(15,3) || sm(3,1) != cplx(19, 2) ) {
6999 std::ostringstream oss;
7000 oss << " Test: " << test_ << "\n"
7001 << " Error: Assignment to submatrix failed\n"
7002 << " Details:\n"
7003 << " Result:\n" << sm << "\n"
7004 << " Expected result:\n( (12,0) (18,-1) )\n"
7005 "( (18,1) (17, 0) )\n"
7006 "( (14,2) (11, 1) )\n"
7007 "( (15,3) (19, 2) )\n";
7008 throw std::runtime_error( oss.str() );
7009 }
7010
7011 if( herm(0,0) != cplx(12,0) || herm(0,1) != cplx(18,-1) || herm(0,2) != cplx(14,-2) || herm(0,3) != cplx(15,-3) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
7012 herm(1,0) != cplx(18,1) || herm(1,1) != cplx(17, 0) || herm(1,2) != cplx(11,-1) || herm(1,3) != cplx(19,-2) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
7013 herm(2,0) != cplx(14,2) || herm(2,1) != cplx(11, 1) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
7014 herm(3,0) != cplx(15,3) || herm(3,1) != cplx(19, 2) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
7015 herm(4,0) != cplx( 5,0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
7016 herm(5,0) != cplx( 0,0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
7017 std::ostringstream oss;
7018 oss << " Test: " << test_ << "\n"
7019 << " Error: Assignment to submatrix failed\n"
7020 << " Details:\n"
7021 << " Result:\n" << herm << "\n"
7022 << " Expected result:\n( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )\n"
7023 "( (18,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )\n"
7024 "( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
7025 "( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
7026 "( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
7027 "( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
7028 throw std::runtime_error( oss.str() );
7029 }
7030 }
7031 }
7032
7033 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
7034 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
7035 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
7036 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )
7037 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
7038 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
7039 {
7040 test_ = "Sparse matrix subtraction assignment test 2";
7041
7042 {
7043 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
7044 mat(0,0) = cplx(-12, 1);
7045 mat(0,1) = cplx(-15, 0);
7046 mat(0,2) = cplx(-13,-1);
7047 mat(0,3) = cplx(-15, 3);
7048 mat(1,0) = cplx(-13, 2);
7049 mat(1,1) = cplx(-13, 1);
7050 mat(1,2) = cplx( -6, 0);
7051 mat(1,3) = cplx(-12, 0);
7052
7053 HT herm;
7054 init( herm );
7055
7056 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
7057 sm -= mat;
7058
7059 checkRows ( herm, 6UL );
7060 checkColumns ( herm, 6UL );
7061 checkNonZeros( herm, 32UL );
7062
7063 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18, 0) || sm(0,2) != cplx(14,2) || sm(0,3) != cplx(15,-3) ||
7064 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,-2) || sm(1,2) != cplx(11,0) || sm(1,3) != cplx(19, 1) ) {
7065 std::ostringstream oss;
7066 oss << " Test: " << test_ << "\n"
7067 << " Error: Assignment to submatrix failed\n"
7068 << " Details:\n"
7069 << " Result:\n" << sm << "\n"
7070 << " Expected result:\n( (12,-1) (18, 0) (14,2) (15,-3) )\n"
7071 "( (13,-2) (14,-2) (11,0) (19, 1) )\n";
7072 throw std::runtime_error( oss.str() );
7073 }
7074
7075 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
7076 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
7077 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
7078 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
7079 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
7080 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
7081 std::ostringstream oss;
7082 oss << " Test: " << test_ << "\n"
7083 << " Error: Assignment to submatrix failed\n"
7084 << " Details:\n"
7085 << " Result:\n" << herm << "\n"
7086 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
7087 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
7088 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
7089 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
7090 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
7091 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
7092 throw std::runtime_error( oss.str() );
7093 }
7094 }
7095
7096 {
7097 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
7098 mat(0,0) = cplx(-12,-1);
7099 mat(0,1) = cplx(-13,-2);
7100 mat(1,0) = cplx(-15, 0);
7101 mat(1,1) = cplx(-13,-1);
7102 mat(2,0) = cplx(-13, 1);
7103 mat(2,1) = cplx( -6, 0);
7104 mat(3,0) = cplx(-15,-3);
7105 mat(3,1) = cplx(-12, 0);
7106
7107 HT herm;
7108 init( herm );
7109
7110 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
7111 sm -= mat;
7112
7113 checkRows ( herm, 6UL );
7114 checkColumns ( herm, 6UL );
7115 checkNonZeros( herm, 32UL );
7116
7117 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13, 2) ||
7118 sm(1,0) != cplx(18, 0) || sm(1,1) != cplx(14, 2) ||
7119 sm(2,0) != cplx(14,-2) || sm(2,1) != cplx(11, 0) ||
7120 sm(3,0) != cplx(15, 3) || sm(3,1) != cplx(19,-1) ) {
7121 std::ostringstream oss;
7122 oss << " Test: " << test_ << "\n"
7123 << " Error: Assignment to submatrix failed\n"
7124 << " Details:\n"
7125 << " Result:\n" << sm << "\n"
7126 << " Expected result:\n( (12, 1) (13, 2) )\n"
7127 "( (18, 0) (14, 2) )\n"
7128 "( (14,-2) (11, 0) )\n"
7129 "( (15, 3) (19,-1) )\n";
7130 throw std::runtime_error( oss.str() );
7131 }
7132
7133 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
7134 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(12, 1) || herm(1,3) != cplx(13, 2) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
7135 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx(12,-1) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14, 2) || herm(2,4) != cplx(15,-3) || herm(2,5) != cplx(-2, 0) ||
7136 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx(13,-2) || herm(3,2) != cplx(14,-2) || herm(3,3) != cplx(11, 0) || herm(3,4) != cplx(19, 1) || herm(3,5) != cplx( 0, 0) ||
7137 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(15, 3) || herm(4,3) != cplx(19,-1) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
7138 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
7139 std::ostringstream oss;
7140 oss << " Test: " << test_ << "\n"
7141 << " Error: Assignment to submatrix failed\n"
7142 << " Details:\n"
7143 << " Result:\n" << herm << "\n"
7144 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
7145 "( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )\n"
7146 "( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )\n"
7147 "( (-2,-1) (13,-2) (14,-2) (11, 0) (19, 1) ( 0, 0) )\n"
7148 "( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )\n"
7149 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
7150 throw std::runtime_error( oss.str() );
7151 }
7152 }
7153 }
7154
7155 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
7156 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
7157 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
7158 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
7159 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
7160 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )
7161 {
7162 test_ = "Sparse matrix subtraction assignment test 3";
7163
7164 {
7165 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
7166 mat(0,0) = cplx(-12, 1);
7167 mat(0,1) = cplx(-11,-2);
7168 mat(0,2) = cplx(-13, 0);
7169 mat(0,3) = cplx(-15,-1);
7170 mat(1,0) = cplx(-15, 2);
7171 mat(1,1) = cplx(-14, 0);
7172 mat(1,2) = cplx(-15, 1);
7173 mat(1,3) = cplx(-12, 0);
7174
7175 HT herm;
7176 init( herm );
7177
7178 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
7179 sm -= mat;
7180
7181 checkRows ( herm, 6UL );
7182 checkColumns ( herm, 6UL );
7183 checkNonZeros( herm, 30UL );
7184
7185 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(18,1) || sm(0,2) != cplx(14, 0) || sm(0,3) != cplx(11,1) ||
7186 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14,0) || sm(1,2) != cplx(11,-1) || sm(1,3) != cplx(19,0) ) {
7187 std::ostringstream oss;
7188 oss << " Test: " << test_ << "\n"
7189 << " Error: Assignment to submatrix failed\n"
7190 << " Details:\n"
7191 << " Result:\n" << sm << "\n"
7192 << " Expected result:\n( (12,-1) (18,1) (14, 0) (11,1) )\n"
7193 "( (13,-2) (14,0) (11,-1) (19,0) )\n";
7194 throw std::runtime_error( oss.str() );
7195 }
7196
7197 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
7198 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
7199 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
7200 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
7201 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
7202 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
7203 std::ostringstream oss;
7204 oss << " Test: " << test_ << "\n"
7205 << " Error: Assignment to submatrix failed\n"
7206 << " Details:\n"
7207 << " Result:\n" << herm << "\n"
7208 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
7209 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
7210 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
7211 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
7212 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
7213 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
7214 throw std::runtime_error( oss.str() );
7215 }
7216 }
7217
7218 {
7219 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
7220 mat(0,0) = cplx(-12,-1);
7221 mat(0,1) = cplx(-15,-2);
7222 mat(1,0) = cplx(-11, 2);
7223 mat(1,1) = cplx(-14, 0);
7224 mat(2,0) = cplx(-13, 0);
7225 mat(2,1) = cplx(-15,-1);
7226 mat(3,0) = cplx(-15, 1);
7227 mat(3,1) = cplx(-12, 0);
7228
7229 HT herm;
7230 init( herm );
7231
7232 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
7233 sm -= mat;
7234
7235 checkRows ( herm, 6UL );
7236 checkColumns ( herm, 6UL );
7237 checkNonZeros( herm, 30UL );
7238
7239 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(13,2) ||
7240 sm(1,0) != cplx(18,-1) || sm(1,1) != cplx(14,0) ||
7241 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,1) ||
7242 sm(3,0) != cplx(11,-1) || sm(3,1) != cplx(19,0) ) {
7243 std::ostringstream oss;
7244 oss << " Test: " << test_ << "\n"
7245 << " Error: Assignment to submatrix failed\n"
7246 << " Details:\n"
7247 << " Result:\n" << sm << "\n"
7248 << " Expected result:\n( (12, 1) (13,2) )\n"
7249 "( (18,-1) (14,0) )\n"
7250 "( (14, 0) (11,1) )\n"
7251 "( (11,-1) (19,0) )\n";
7252 throw std::runtime_error( oss.str() );
7253 }
7254
7255 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2,1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
7256 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0,0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
7257 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1,1) || herm(2,4) != cplx(12, 1) || herm(2,5) != cplx(13, 2) ||
7258 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5,0) || herm(3,4) != cplx(18,-1) || herm(3,5) != cplx(14, 0) ||
7259 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx(12,-1) || herm(4,3) != cplx(18,1) || herm(4,4) != cplx(14, 0) || herm(4,5) != cplx(11, 1) ||
7260 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(13,-2) || herm(5,3) != cplx(14,0) || herm(5,4) != cplx(11,-1) || herm(5,5) != cplx(19, 0) ) {
7261 std::ostringstream oss;
7262 oss << " Test: " << test_ << "\n"
7263 << " Error: Assignment to submatrix failed\n"
7264 << " Details:\n"
7265 << " Result:\n" << herm << "\n"
7266 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )\n"
7267 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )\n"
7268 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )\n"
7269 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )\n"
7270 "( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )\n"
7271 "( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 0) )\n";
7272 throw std::runtime_error( oss.str() );
7273 }
7274 }
7275 }
7276
7277 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
7278 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
7279 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
7280 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )
7281 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
7282 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
7283 {
7284 test_ = "Sparse matrix subtraction assignment test 4";
7285
7286 {
7287 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
7288 mat(0,0) = cplx( -5,-4);
7289 mat(0,1) = cplx(-18, 3);
7290 mat(0,2) = cplx(-11, 0);
7291 mat(0,3) = cplx(-10, 2);
7292 mat(1,0) = cplx(-15, 1);
7293 mat(1,1) = cplx(-14, 0);
7294 mat(1,2) = cplx(-10,-2);
7295 mat(1,3) = cplx(-14, 0);
7296 mat(2,0) = cplx(-14,-3);
7297 mat(2,1) = cplx(-12,-4);
7298 mat(2,2) = cplx(-12,-1);
7299 mat(2,3) = cplx( -7, 3);
7300
7301 HT herm;
7302 init( herm );
7303
7304 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
7305 sm -= mat;
7306
7307 checkRows ( herm, 6UL );
7308 checkColumns ( herm, 6UL );
7309 checkNonZeros( herm, 32UL );
7310
7311 if( sm(0,0) != cplx(12, 1) || sm(0,1) != cplx(18,-3) || sm(0,2) != cplx(14,0) || sm(0,3) != cplx(11,-1) ||
7312 sm(1,0) != cplx(13,-2) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,1) || sm(1,3) != cplx(19, 0) ||
7313 sm(2,0) != cplx(19, 3) || sm(2,1) != cplx(11, 2) || sm(2,2) != cplx(12,1) || sm(2,3) != cplx(14,-4) ) {
7314 std::ostringstream oss;
7315 oss << " Test: " << test_ << "\n"
7316 << " Error: Assignment to submatrix failed\n"
7317 << " Details:\n"
7318 << " Result:\n" << sm << "\n"
7319 << " Expected result:\n( (12, 1) (18,-3) (14, 0) (11,-1) )\n"
7320 "( (13,-2) (14, 0) (11, 1) (19, 0) )\n"
7321 "( (19, 3) (11, 2) (12, 1) (14,-4) )\n";
7322 throw std::runtime_error( oss.str() );
7323 }
7324
7325 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
7326 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
7327 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
7328 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
7329 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
7330 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
7331 std::ostringstream oss;
7332 oss << " Test: " << test_ << "\n"
7333 << " Error: Assignment to submatrix failed\n"
7334 << " Details:\n"
7335 << " Result:\n" << herm << "\n"
7336 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
7337 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
7338 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
7339 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
7340 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
7341 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
7342 throw std::runtime_error( oss.str() );
7343 }
7344 }
7345
7346 {
7347 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
7348 mat(0,0) = cplx( -5, 4);
7349 mat(0,1) = cplx(-15,-1);
7350 mat(0,2) = cplx(-14, 3);
7351 mat(1,0) = cplx(-18,-3);
7352 mat(1,1) = cplx(-14, 0);
7353 mat(1,2) = cplx(-12, 4);
7354 mat(2,0) = cplx(-11, 0);
7355 mat(2,1) = cplx(-10, 2);
7356 mat(2,2) = cplx(-12, 1);
7357 mat(3,0) = cplx(-10,-2);
7358 mat(3,1) = cplx(-14, 0);
7359 mat(3,2) = cplx( -7,-3);
7360
7361 HT herm;
7362 init( herm );
7363
7364 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
7365 sm -= mat;
7366
7367 checkRows ( herm, 6UL );
7368 checkColumns ( herm, 6UL );
7369 checkNonZeros( herm, 32UL );
7370
7371 if( sm(0,0) != cplx(12,-1) || sm(0,1) != cplx(13, 2) || sm(0,2) != cplx(19,-3) ||
7372 sm(1,0) != cplx(18, 3) || sm(1,1) != cplx(14, 0) || sm(1,2) != cplx(11,-2) ||
7373 sm(2,0) != cplx(14, 0) || sm(2,1) != cplx(11,-1) || sm(2,2) != cplx(12,-1) ||
7374 sm(3,0) != cplx(11, 1) || sm(3,1) != cplx(19, 0) || sm(3,2) != cplx(14, 4) ) {
7375 std::ostringstream oss;
7376 oss << " Test: " << test_ << "\n"
7377 << " Error: Assignment to submatrix failed\n"
7378 << " Details:\n"
7379 << " Result:\n" << sm << "\n"
7380 << " Expected result:\n( (12,-1) (13, 2) (19,-3) )\n"
7381 "( (18, 3) (14, 0) (11,-2) )\n"
7382 "( (14, 0) (11,-1) (12,-1) )\n"
7383 "( (11, 1) (19, 0) (14, 4) )\n";
7384 throw std::runtime_error( oss.str() );
7385 }
7386
7387 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(12,-1) || herm(0,3) != cplx(13, 2) || herm(0,4) != cplx(19,-3) || herm(0,5) != cplx( 0, 0) ||
7388 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx(18, 3) || herm(1,3) != cplx(14, 0) || herm(1,4) != cplx(11,-2) || herm(1,5) != cplx( 8,-2) ||
7389 herm(2,0) != cplx(12, 1) || herm(2,1) != cplx(18,-3) || herm(2,2) != cplx(14, 0) || herm(2,3) != cplx(11,-1) || herm(2,4) != cplx(12,-1) || herm(2,5) != cplx(-2, 0) ||
7390 herm(3,0) != cplx(13,-2) || herm(3,1) != cplx(14, 0) || herm(3,2) != cplx(11, 1) || herm(3,3) != cplx(19, 0) || herm(3,4) != cplx(14, 4) || herm(3,5) != cplx( 0, 0) ||
7391 herm(4,0) != cplx(19, 3) || herm(4,1) != cplx(11, 2) || herm(4,2) != cplx(12, 1) || herm(4,3) != cplx(14,-4) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
7392 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
7393 std::ostringstream oss;
7394 oss << " Test: " << test_ << "\n"
7395 << " Error: Assignment to submatrix failed\n"
7396 << " Details:\n"
7397 << " Result:\n" << herm << "\n"
7398 << " Expected result:\n( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )\n"
7399 "( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )\n"
7400 "( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )\n"
7401 "( (13,-2) (14, 0) (11, 1) (19, 0) (14, 4) ( 0, 0) )\n"
7402 "( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )\n"
7403 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
7404 throw std::runtime_error( oss.str() );
7405 }
7406 }
7407 }
7408
7409 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
7410 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (22,1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
7411 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
7412 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
7413 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
7414 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
7415 {
7416 test_ = "Sparse matrix subtraction assignment test 5";
7417
7418 {
7419 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
7420 mat(0,0) = cplx(-11,0);
7421 mat(0,1) = cplx(-22,0);
7422 mat(0,2) = cplx( -7,5);
7423 mat(0,3) = cplx(-17,4);
7424 mat(1,0) = cplx(-26,0);
7425 mat(1,1) = cplx(-15,0);
7426 mat(1,2) = cplx(-11,1);
7427 mat(1,3) = cplx(-19,2);
7428
7429 HT herm;
7430 init( herm );
7431
7432 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
7433
7434 try {
7435 sm -= mat;
7436
7437 std::ostringstream oss;
7438 oss << " Test: " << test_ << "\n"
7439 << " Error: Assignment of invalid matrix succeeded\n"
7440 << " Details:\n"
7441 << " Result:\n" << herm << "\n";
7442 throw std::runtime_error( oss.str() );
7443 }
7444 catch( std::invalid_argument& ) {}
7445 }
7446
7447 {
7448 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
7449 mat(0,0) = cplx(-11, 0);
7450 mat(0,1) = cplx(-22, 0);
7451 mat(1,0) = cplx(-26, 0);
7452 mat(1,1) = cplx(-15, 0);
7453 mat(2,0) = cplx( -7,-5);
7454 mat(2,1) = cplx(-11,-1);
7455 mat(3,0) = cplx(-17,-4);
7456 mat(3,1) = cplx(-19,-2);
7457
7458 HT herm;
7459 init( herm );
7460
7461 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
7462
7463 try {
7464 sm -= mat;
7465
7466 std::ostringstream oss;
7467 oss << " Test: " << test_ << "\n"
7468 << " Error: Assignment of invalid matrix succeeded\n"
7469 << " Details:\n"
7470 << " Result:\n" << herm << "\n";
7471 throw std::runtime_error( oss.str() );
7472 }
7473 catch( std::invalid_argument& ) {}
7474 }
7475 }
7476
7477 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
7478 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
7479 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
7480 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (22,-2) (11, 0) (19, 1) ( 0, 0) )
7481 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
7482 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
7483 {
7484 test_ = "Sparse matrix subtraction assignment test 6";
7485
7486 {
7487 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
7488 mat(0,0) = cplx(-12, 1);
7489 mat(0,1) = cplx(-15, 0);
7490 mat(0,2) = cplx(-13,-1);
7491 mat(0,3) = cplx(-15, 3);
7492 mat(1,0) = cplx(-13, 2);
7493 mat(1,1) = cplx(-21, 1);
7494 mat(1,2) = cplx( -6, 0);
7495 mat(1,3) = cplx(-12, 0);
7496
7497 HT herm;
7498 init( herm );
7499
7500 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
7501
7502 try {
7503 sm -= mat;
7504
7505 std::ostringstream oss;
7506 oss << " Test: " << test_ << "\n"
7507 << " Error: Assignment of invalid matrix succeeded\n"
7508 << " Details:\n"
7509 << " Result:\n" << herm << "\n";
7510 throw std::runtime_error( oss.str() );
7511 }
7512 catch( std::invalid_argument& ) {}
7513 }
7514
7515 {
7516 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
7517 mat(0,0) = cplx(-12,-1);
7518 mat(0,1) = cplx(-13,-2);
7519 mat(1,0) = cplx(-15, 0);
7520 mat(1,1) = cplx(-13,-1);
7521 mat(2,0) = cplx(-21, 1);
7522 mat(2,1) = cplx( -6, 0);
7523 mat(3,0) = cplx(-15,-3);
7524 mat(3,1) = cplx(-12, 0);
7525
7526 HT herm;
7527 init( herm );
7528
7529 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
7530
7531 try {
7532 sm -= mat;
7533
7534 std::ostringstream oss;
7535 oss << " Test: " << test_ << "\n"
7536 << " Error: Assignment of invalid matrix succeeded\n"
7537 << " Details:\n"
7538 << " Result:\n" << herm << "\n";
7539 throw std::runtime_error( oss.str() );
7540 }
7541 catch( std::invalid_argument& ) {}
7542 }
7543 }
7544
7545 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
7546 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
7547 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
7548 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
7549 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
7550 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (22,-1) (19, 0) )
7551 {
7552 test_ = "Sparse matrix subtraction assignment test 7";
7553
7554 {
7555 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
7556 mat(0,0) = cplx(-12, 1);
7557 mat(0,1) = cplx(-11,-2);
7558 mat(0,2) = cplx(-13, 0);
7559 mat(0,3) = cplx(-15,-1);
7560 mat(1,0) = cplx(-15, 2);
7561 mat(1,1) = cplx(-14, 0);
7562 mat(1,2) = cplx(-26, 1);
7563 mat(1,3) = cplx(-12, 0);
7564
7565 HT herm;
7566 init( herm );
7567
7568 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
7569
7570 try {
7571 sm -= mat;
7572
7573 std::ostringstream oss;
7574 oss << " Test: " << test_ << "\n"
7575 << " Error: Assignment of invalid matrix succeeded\n"
7576 << " Details:\n"
7577 << " Result:\n" << herm << "\n";
7578 throw std::runtime_error( oss.str() );
7579 }
7580 catch( std::invalid_argument& ) {}
7581 }
7582
7583 {
7584 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
7585 mat(0,0) = cplx(-12,-1);
7586 mat(0,1) = cplx(-15,-2);
7587 mat(1,0) = cplx(-11, 2);
7588 mat(1,1) = cplx(-14, 0);
7589 mat(2,0) = cplx(-13, 0);
7590 mat(2,1) = cplx(-15,-1);
7591 mat(3,0) = cplx(-26, 1);
7592 mat(3,1) = cplx(-12, 0);
7593
7594 HT herm;
7595 init( herm );
7596
7597 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
7598
7599 try {
7600 sm -= mat;
7601
7602 std::ostringstream oss;
7603 oss << " Test: " << test_ << "\n"
7604 << " Error: Assignment of invalid matrix succeeded\n"
7605 << " Details:\n"
7606 << " Result:\n" << herm << "\n";
7607 throw std::runtime_error( oss.str() );
7608 }
7609 catch( std::invalid_argument& ) {}
7610 }
7611 }
7612
7613 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
7614 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
7615 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
7616 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (22, 1) (19, 0) (14, 4) ( 0, 0) )
7617 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
7618 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
7619 {
7620 test_ = "Sparse matrix subtraction assignment test 8";
7621
7622 {
7623 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
7624 mat(0,0) = cplx( -5,-4);
7625 mat(0,1) = cplx(-18, 3);
7626 mat(0,2) = cplx(-11, 0);
7627 mat(0,3) = cplx(-10, 2);
7628 mat(1,0) = cplx(-15, 1);
7629 mat(1,1) = cplx(-14, 0);
7630 mat(1,2) = cplx(-21,-2);
7631 mat(1,3) = cplx(-14, 0);
7632 mat(2,0) = cplx(-14,-3);
7633 mat(2,1) = cplx(-12,-4);
7634 mat(2,2) = cplx(-12,-1);
7635 mat(2,3) = cplx( -7, 3);
7636
7637 HT herm;
7638 init( herm );
7639
7640 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
7641
7642 try {
7643 sm -= mat;
7644
7645 std::ostringstream oss;
7646 oss << " Test: " << test_ << "\n"
7647 << " Error: Assignment of invalid matrix succeeded\n"
7648 << " Details:\n"
7649 << " Result:\n" << herm << "\n";
7650 throw std::runtime_error( oss.str() );
7651 }
7652 catch( std::invalid_argument& ) {}
7653 }
7654
7655 {
7656 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
7657 mat(0,0) = cplx( -5, 4);
7658 mat(0,1) = cplx(-15,-1);
7659 mat(0,2) = cplx(-14, 3);
7660 mat(1,0) = cplx(-18,-3);
7661 mat(1,1) = cplx(-14, 0);
7662 mat(1,2) = cplx(-12, 4);
7663 mat(2,0) = cplx(-11, 0);
7664 mat(2,1) = cplx(-10, 2);
7665 mat(2,2) = cplx(-12, 1);
7666 mat(3,0) = cplx(-21,-2);
7667 mat(3,1) = cplx(-14, 0);
7668 mat(3,2) = cplx( -7,-3);
7669
7670 HT herm;
7671 init( herm );
7672
7673 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
7674
7675 try {
7676 sm -= mat;
7677
7678 std::ostringstream oss;
7679 oss << " Test: " << test_ << "\n"
7680 << " Error: Assignment of invalid matrix succeeded\n"
7681 << " Details:\n"
7682 << " Result:\n" << herm << "\n";
7683 throw std::runtime_error( oss.str() );
7684 }
7685 catch( std::invalid_argument& ) {}
7686 }
7687 }
7688
7689 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12, 0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
7690 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,-1) (17, 0) (11,-1) (19,-2) (-1,2) ( 8,-2) )
7691 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14, 2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
7692 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15, 3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
7693 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
7694 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
7695 {
7696 test_ = "Sparse matrix subtraction assignment test 9";
7697
7698 {
7699 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
7700 mat(0,0) = cplx(-11,0);
7701 mat(0,1) = cplx(-22,0);
7702 mat(0,2) = cplx( -7,5);
7703 mat(0,3) = cplx(-17,4);
7704 mat(1,0) = cplx(-22,2);
7705 mat(1,1) = cplx(-15,0);
7706 mat(1,2) = cplx(-11,1);
7707 mat(1,3) = cplx(-19,2);
7708
7709 HT herm;
7710 init( herm );
7711
7712 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
7713
7714 try {
7715 sm -= mat;
7716
7717 std::ostringstream oss;
7718 oss << " Test: " << test_ << "\n"
7719 << " Error: Assignment of invalid matrix succeeded\n"
7720 << " Details:\n"
7721 << " Result:\n" << herm << "\n";
7722 throw std::runtime_error( oss.str() );
7723 }
7724 catch( std::invalid_argument& ) {}
7725 }
7726
7727 {
7728 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
7729 mat(0,0) = cplx(-11, 0);
7730 mat(0,1) = cplx(-22, 0);
7731 mat(1,0) = cplx(-22, 2);
7732 mat(1,1) = cplx(-15, 0);
7733 mat(2,0) = cplx( -7,-5);
7734 mat(2,1) = cplx(-11,-1);
7735 mat(3,0) = cplx(-17,-4);
7736 mat(3,1) = cplx(-19,-2);
7737
7738 HT herm;
7739 init( herm );
7740
7741 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
7742
7743 try {
7744 sm -= mat;
7745
7746 std::ostringstream oss;
7747 oss << " Test: " << test_ << "\n"
7748 << " Error: Assignment of invalid matrix succeeded\n"
7749 << " Details:\n"
7750 << " Result:\n" << herm << "\n";
7751 throw std::runtime_error( oss.str() );
7752 }
7753 catch( std::invalid_argument& ) {}
7754 }
7755 }
7756
7757 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7,3) (-2, 1) ( 5, 0) ( 0, 0) )
7758 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12,1) (13, 2) (-1, 2) ( 8,-2) )
7759 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18,0) (14, 2) (15,-3) (-2, 0) )
7760 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,2) (11, 0) (19, 1) ( 0, 0) )
7761 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15,3) (19,-1) ( 1, 0) (-4, 0) )
7762 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2,0) ( 0, 0) (-4, 0) ( 7, 0) )
7763 {
7764 test_ = "Sparse matrix subtraction assignment test 10";
7765
7766 {
7767 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
7768 mat(0,0) = cplx(-12, 1);
7769 mat(0,1) = cplx(-15, 0);
7770 mat(0,2) = cplx(-13,-1);
7771 mat(0,3) = cplx(-15, 3);
7772 mat(1,0) = cplx(-13, 2);
7773 mat(1,1) = cplx(-13, 3);
7774 mat(1,2) = cplx( -6, 0);
7775 mat(1,3) = cplx(-12, 0);
7776
7777 HT herm;
7778 init( herm );
7779
7780 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
7781
7782 try {
7783 sm -= mat;
7784
7785 std::ostringstream oss;
7786 oss << " Test: " << test_ << "\n"
7787 << " Error: Assignment of invalid matrix succeeded\n"
7788 << " Details:\n"
7789 << " Result:\n" << herm << "\n";
7790 throw std::runtime_error( oss.str() );
7791 }
7792 catch( std::invalid_argument& ) {}
7793 }
7794
7795 {
7796 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
7797 mat(0,0) = cplx(-12,-1);
7798 mat(0,1) = cplx(-13,-2);
7799 mat(1,0) = cplx(-15, 0);
7800 mat(1,1) = cplx(-13,-1);
7801 mat(2,0) = cplx(-13, 3);
7802 mat(2,1) = cplx( -6, 0);
7803 mat(3,0) = cplx(-15,-3);
7804 mat(3,1) = cplx(-12, 0);
7805
7806 HT herm;
7807 init( herm );
7808
7809 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
7810
7811 try {
7812 sm -= mat;
7813
7814 std::ostringstream oss;
7815 oss << " Test: " << test_ << "\n"
7816 << " Error: Assignment of invalid matrix succeeded\n"
7817 << " Details:\n"
7818 << " Result:\n" << herm << "\n";
7819 throw std::runtime_error( oss.str() );
7820 }
7821 catch( std::invalid_argument& ) {}
7822 }
7823 }
7824
7825 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
7826 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
7827 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
7828 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
7829 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
7830 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11, 1) (19, 0) )
7831 {
7832 test_ = "Sparse matrix subtraction assignment test 11";
7833
7834 {
7835 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
7836 mat(0,0) = cplx(-12, 1);
7837 mat(0,1) = cplx(-11,-2);
7838 mat(0,2) = cplx(-13, 0);
7839 mat(0,3) = cplx(-15,-1);
7840 mat(1,0) = cplx(-15, 2);
7841 mat(1,1) = cplx(-14, 0);
7842 mat(1,2) = cplx(-15,-1);
7843 mat(1,3) = cplx(-12, 0);
7844
7845 HT herm;
7846 init( herm );
7847
7848 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
7849
7850 try {
7851 sm -= mat;
7852
7853 std::ostringstream oss;
7854 oss << " Test: " << test_ << "\n"
7855 << " Error: Assignment of invalid matrix succeeded\n"
7856 << " Details:\n"
7857 << " Result:\n" << herm << "\n";
7858 throw std::runtime_error( oss.str() );
7859 }
7860 catch( std::invalid_argument& ) {}
7861 }
7862
7863 {
7864 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
7865 mat(0,0) = cplx(-12,-1);
7866 mat(0,1) = cplx(-15,-2);
7867 mat(1,0) = cplx(-11, 2);
7868 mat(1,1) = cplx(-14, 0);
7869 mat(2,0) = cplx(-13, 0);
7870 mat(2,1) = cplx(-15,-1);
7871 mat(3,0) = cplx(-15,-1);
7872 mat(3,1) = cplx(-12, 0);
7873
7874 HT herm;
7875 init( herm );
7876
7877 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
7878
7879 try {
7880 sm -= mat;
7881
7882 std::ostringstream oss;
7883 oss << " Test: " << test_ << "\n"
7884 << " Error: Assignment of invalid matrix succeeded\n"
7885 << " Details:\n"
7886 << " Result:\n" << herm << "\n";
7887 throw std::runtime_error( oss.str() );
7888 }
7889 catch( std::invalid_argument& ) {}
7890 }
7891 }
7892
7893 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
7894 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
7895 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
7896 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11,-1) (19, 0) (14, 4) ( 0, 0) )
7897 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
7898 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
7899 {
7900 test_ = "Sparse matrix subtraction assignment test 12";
7901
7902 {
7903 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
7904 mat(0,0) = cplx( -5,-4);
7905 mat(0,1) = cplx(-18, 3);
7906 mat(0,2) = cplx(-11, 0);
7907 mat(0,3) = cplx(-10, 2);
7908 mat(1,0) = cplx(-15, 1);
7909 mat(1,1) = cplx(-14, 0);
7910 mat(1,2) = cplx(-10, 0);
7911 mat(1,3) = cplx(-14, 0);
7912 mat(2,0) = cplx(-14,-3);
7913 mat(2,1) = cplx(-12,-4);
7914 mat(2,2) = cplx(-12,-1);
7915 mat(2,3) = cplx( -7, 3);
7916
7917 HT herm;
7918 init( herm );
7919
7920 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
7921
7922 try {
7923 sm -= mat;
7924
7925 std::ostringstream oss;
7926 oss << " Test: " << test_ << "\n"
7927 << " Error: Assignment of invalid matrix succeeded\n"
7928 << " Details:\n"
7929 << " Result:\n" << herm << "\n";
7930 throw std::runtime_error( oss.str() );
7931 }
7932 catch( std::invalid_argument& ) {}
7933 }
7934
7935 {
7936 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
7937 mat(0,0) = cplx( -5, 4);
7938 mat(0,1) = cplx(-15,-1);
7939 mat(0,2) = cplx(-14, 3);
7940 mat(1,0) = cplx(-18,-3);
7941 mat(1,1) = cplx(-14, 0);
7942 mat(1,2) = cplx(-12, 4);
7943 mat(2,0) = cplx(-11, 0);
7944 mat(2,1) = cplx(-10, 2);
7945 mat(2,2) = cplx(-12, 1);
7946 mat(3,0) = cplx(-10, 0);
7947 mat(3,1) = cplx(-14, 0);
7948 mat(3,2) = cplx( -7,-3);
7949
7950 HT herm;
7951 init( herm );
7952
7953 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
7954
7955 try {
7956 sm -= mat;
7957
7958 std::ostringstream oss;
7959 oss << " Test: " << test_ << "\n"
7960 << " Error: Assignment of invalid matrix succeeded\n"
7961 << " Details:\n"
7962 << " Result:\n" << herm << "\n";
7963 throw std::runtime_error( oss.str() );
7964 }
7965 catch( std::invalid_argument& ) {}
7966 }
7967 }
7968
7969 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (12,0) (18,-1) (14,-2) (15,-3) ( 5,0) ( 0, 0) )
7970 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (18,1) (17, 1) (11,-1) (19,-2) (-1,2) ( 8,-2) )
7971 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,2) (11, 1) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
7972 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (15,3) (19, 2) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
7973 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5,0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
7974 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0,0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
7975 {
7976 test_ = "Sparse matrix subtraction assignment test 13";
7977
7978 {
7979 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
7980 mat(0,0) = cplx(-11, 0);
7981 mat(0,1) = cplx(-22, 0);
7982 mat(0,2) = cplx( -7, 5);
7983 mat(0,3) = cplx(-17, 4);
7984 mat(1,0) = cplx(-22, 0);
7985 mat(1,1) = cplx(-15,-1);
7986 mat(1,2) = cplx(-11, 1);
7987 mat(1,3) = cplx(-19, 2);
7988
7989 HT herm;
7990 init( herm );
7991
7992 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
7993
7994 try {
7995 sm -= mat;
7996
7997 std::ostringstream oss;
7998 oss << " Test: " << test_ << "\n"
7999 << " Error: Assignment of invalid matrix succeeded\n"
8000 << " Details:\n"
8001 << " Result:\n" << herm << "\n";
8002 throw std::runtime_error( oss.str() );
8003 }
8004 catch( std::invalid_argument& ) {}
8005 }
8006
8007 {
8008 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
8009 mat(0,0) = cplx(-11, 0);
8010 mat(0,1) = cplx(-22, 0);
8011 mat(1,0) = cplx(-22, 0);
8012 mat(1,1) = cplx(-15,-1);
8013 mat(2,0) = cplx( -7,-5);
8014 mat(2,1) = cplx(-11,-1);
8015 mat(3,0) = cplx(-17,-4);
8016 mat(3,1) = cplx(-19,-2);
8017
8018 HT herm;
8019 init( herm );
8020
8021 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
8022
8023 try {
8024 sm -= mat;
8025
8026 std::ostringstream oss;
8027 oss << " Test: " << test_ << "\n"
8028 << " Error: Assignment of invalid matrix succeeded\n"
8029 << " Details:\n"
8030 << " Result:\n" << herm << "\n";
8031 throw std::runtime_error( oss.str() );
8032 }
8033 catch( std::invalid_argument& ) {}
8034 }
8035 }
8036
8037 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
8038 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (12, 1) (13, 2) (-1, 2) ( 8,-2) )
8039 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) (12,-1) (18, 0) (14, 2) (15,-3) (-2, 0) )
8040 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) (13,-2) (14,-2) (11, 1) (19, 1) ( 0, 0) )
8041 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (15, 3) (19,-1) ( 1, 0) (-4, 0) )
8042 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
8043 {
8044 test_ = "Sparse matrix subtraction assignment test 14";
8045
8046 {
8047 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
8048 mat(0,0) = cplx(-12, 1);
8049 mat(0,1) = cplx(-15, 0);
8050 mat(0,2) = cplx(-13,-1);
8051 mat(0,3) = cplx(-15, 3);
8052 mat(1,0) = cplx(-13, 2);
8053 mat(1,1) = cplx(-13, 1);
8054 mat(1,2) = cplx( -6,-1);
8055 mat(1,3) = cplx(-12, 0);
8056
8057 HT herm;
8058 init( herm );
8059
8060 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
8061
8062 try {
8063 sm -= mat;
8064
8065 std::ostringstream oss;
8066 oss << " Test: " << test_ << "\n"
8067 << " Error: Assignment of invalid matrix succeeded\n"
8068 << " Details:\n"
8069 << " Result:\n" << herm << "\n";
8070 throw std::runtime_error( oss.str() );
8071 }
8072 catch( std::invalid_argument& ) {}
8073 }
8074
8075 {
8076 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
8077 mat(0,0) = cplx(-12,-1);
8078 mat(0,1) = cplx(-13,-2);
8079 mat(1,0) = cplx(-15, 0);
8080 mat(1,1) = cplx(-13,-1);
8081 mat(2,0) = cplx(-13, 1);
8082 mat(2,1) = cplx( -6,-1);
8083 mat(3,0) = cplx(-15,-3);
8084 mat(3,1) = cplx(-12, 0);
8085
8086 HT herm;
8087 init( herm );
8088
8089 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
8090
8091 try {
8092 sm -= mat;
8093
8094 std::ostringstream oss;
8095 oss << " Test: " << test_ << "\n"
8096 << " Error: Assignment of invalid matrix succeeded\n"
8097 << " Details:\n"
8098 << " Result:\n" << herm << "\n";
8099 throw std::runtime_error( oss.str() );
8100 }
8101 catch( std::invalid_argument& ) {}
8102 }
8103 }
8104
8105 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2,1) ( 5, 0) ( 0, 0) )
8106 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0,0) (-1, 2) ( 8,-2) )
8107 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1,1) (12, 1) (13, 2) )
8108 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5,0) (18,-1) (14, 0) )
8109 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) (12,-1) (18,1) (14, 0) (11, 1) )
8110 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (13,-2) (14,0) (11,-1) (19, 1) )
8111 {
8112 test_ = "Sparse matrix subtraction assignment test 15";
8113
8114 {
8115 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
8116 mat(0,0) = cplx(-12, 1);
8117 mat(0,1) = cplx(-11,-2);
8118 mat(0,2) = cplx(-13, 0);
8119 mat(0,3) = cplx(-15,-1);
8120 mat(1,0) = cplx(-15, 2);
8121 mat(1,1) = cplx(-14, 0);
8122 mat(1,2) = cplx(-15, 1);
8123 mat(1,3) = cplx(-12,-1);
8124
8125 HT herm;
8126 init( herm );
8127
8128 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
8129
8130 try {
8131 sm -= mat;
8132
8133 std::ostringstream oss;
8134 oss << " Test: " << test_ << "\n"
8135 << " Error: Assignment of invalid matrix succeeded\n"
8136 << " Details:\n"
8137 << " Result:\n" << herm << "\n";
8138 throw std::runtime_error( oss.str() );
8139 }
8140 catch( std::invalid_argument& ) {}
8141 }
8142
8143 {
8144 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
8145 mat(0,0) = cplx(-12,-1);
8146 mat(0,1) = cplx(-15,-2);
8147 mat(1,0) = cplx(-11, 2);
8148 mat(1,1) = cplx(-14, 0);
8149 mat(2,0) = cplx(-13, 0);
8150 mat(2,1) = cplx(-15,-1);
8151 mat(3,0) = cplx(-15, 1);
8152 mat(3,1) = cplx(-12,-1);
8153
8154 HT herm;
8155 init( herm );
8156
8157 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
8158
8159 try {
8160 sm -= mat;
8161
8162 std::ostringstream oss;
8163 oss << " Test: " << test_ << "\n"
8164 << " Error: Assignment of invalid matrix succeeded\n"
8165 << " Details:\n"
8166 << " Result:\n" << herm << "\n";
8167 throw std::runtime_error( oss.str() );
8168 }
8169 catch( std::invalid_argument& ) {}
8170 }
8171 }
8172
8173 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (12,-1) (13, 2) (19,-3) ( 0, 0) )
8174 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) (18, 3) (14, 0) (11,-2) ( 8,-2) )
8175 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (12, 1) (18,-3) (14, 0) (11,-1) (12,-1) (-2, 0) )
8176 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (13,-2) (14, 0) (11, 1) (19, 1) (14, 4) ( 0, 0) )
8177 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (19, 3) (11, 2) (12, 1) (14,-4) ( 1, 0) (-4, 0) )
8178 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
8179 {
8180 test_ = "Sparse matrix subtraction assignment test 16";
8181
8182 {
8183 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
8184 mat(0,0) = cplx( -5,-4);
8185 mat(0,1) = cplx(-18, 3);
8186 mat(0,2) = cplx(-11, 0);
8187 mat(0,3) = cplx(-10, 2);
8188 mat(1,0) = cplx(-15, 1);
8189 mat(1,1) = cplx(-14, 0);
8190 mat(1,2) = cplx(-10,-2);
8191 mat(1,3) = cplx(-14,-1);
8192 mat(2,0) = cplx(-14,-3);
8193 mat(2,1) = cplx(-12,-4);
8194 mat(2,2) = cplx(-12,-1);
8195 mat(2,3) = cplx( -7, 3);
8196
8197 HT herm;
8198 init( herm );
8199
8200 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
8201
8202 try {
8203 sm -= mat;
8204
8205 std::ostringstream oss;
8206 oss << " Test: " << test_ << "\n"
8207 << " Error: Assignment of invalid matrix succeeded\n"
8208 << " Details:\n"
8209 << " Result:\n" << herm << "\n";
8210 throw std::runtime_error( oss.str() );
8211 }
8212 catch( std::invalid_argument& ) {}
8213 }
8214
8215 {
8216 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
8217 mat(0,0) = cplx( -5, 4);
8218 mat(0,1) = cplx(-15,-1);
8219 mat(0,2) = cplx(-14, 3);
8220 mat(1,0) = cplx(-18,-3);
8221 mat(1,1) = cplx(-14,-1);
8222 mat(1,2) = cplx(-12, 4);
8223 mat(2,0) = cplx(-11, 0);
8224 mat(2,1) = cplx(-10, 2);
8225 mat(2,2) = cplx(-12, 1);
8226 mat(3,0) = cplx(-10,-2);
8227 mat(3,1) = cplx(-14,-1);
8228 mat(3,2) = cplx( -7,-3);
8229
8230 HT herm;
8231 init( herm );
8232
8233 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
8234
8235 try {
8236 sm -= mat;
8237
8238 std::ostringstream oss;
8239 oss << " Test: " << test_ << "\n"
8240 << " Error: Assignment of invalid matrix succeeded\n"
8241 << " Details:\n"
8242 << " Result:\n" << herm << "\n";
8243 throw std::runtime_error( oss.str() );
8244 }
8245 catch( std::invalid_argument& ) {}
8246 }
8247 }
8248 }
8249 //*************************************************************************************************
8250
8251
8252 //*************************************************************************************************
8253 /*!\brief Test of the Schur product assignment to a submatrix of a HermitianMatrix.
8254 //
8255 // \return void
8256 // \exception std::runtime_error Error detected.
8257 //
8258 // This function performs a test of the Schur product assignment to a submatrix of a HermitianMatrix.
8259 // In case an error is detected, a \a std::runtime_error exception is thrown.
8260 */
8261 template< typename HT > // Type of the Hermitian matrix
testSchurAssign()8262 void SubmatrixComplexTest::testSchurAssign()
8263 {
8264 //=====================================================================================
8265 // Dense matrix Schur product assignment
8266 //=====================================================================================
8267
8268 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (11, 0) (20, 5) (28,12) (16,-8) ( 5,0) ( 0, 0) )
8269 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (20, -5) (12, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
8270 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (28,-12) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
8271 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (16, 8) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
8272 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
8273 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
8274 {
8275 test_ = "Dense matrix Schur product assignment test 1";
8276
8277 {
8278 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
8279 mat(0,0) = cplx(11, 0);
8280 mat(0,1) = cplx(-5, 0);
8281 mat(0,2) = cplx( 4, 0);
8282 mat(0,3) = cplx(-8, 0);
8283 mat(1,0) = cplx(-5, 0);
8284 mat(1,1) = cplx( 6, 0);
8285 mat(1,2) = cplx(99,99);
8286 mat(1,3) = cplx(99,99);
8287
8288 HT herm;
8289 init( herm );
8290
8291 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
8292 sm %= mat;
8293
8294 checkRows ( herm, 6UL );
8295 checkColumns ( herm, 6UL );
8296 checkNonZeros( herm, 26UL );
8297
8298 if( sm(0,0) != cplx(11, 0) || sm(0,1) != cplx(20,5) || sm(0,2) != cplx(28,12) || sm(0,3) != cplx(16,-8) ||
8299 sm(1,0) != cplx(20,-5) || sm(1,1) != cplx(12,0) || sm(1,2) != cplx( 0, 0) || sm(1,3) != cplx( 0, 0) ) {
8300 std::ostringstream oss;
8301 oss << " Test: " << test_ << "\n"
8302 << " Error: Assignment to submatrix failed\n"
8303 << " Details:\n"
8304 << " Result:\n" << sm << "\n"
8305 << " Expected result:\n( (11, 0) (20,5) (28,12) (16,-8) )\n"
8306 "( (20,-5) (12,0) ( 0, 0) ( 0, 0) )\n";
8307 throw std::runtime_error( oss.str() );
8308 }
8309
8310 if( herm(0,0) != cplx(11, 0) || herm(0,1) != cplx(20, 5) || herm(0,2) != cplx(28,12) || herm(0,3) != cplx(16,-8) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
8311 herm(1,0) != cplx(20, -5) || herm(1,1) != cplx(12, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
8312 herm(2,0) != cplx(28,-12) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
8313 herm(3,0) != cplx(16, 8) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
8314 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
8315 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
8316 std::ostringstream oss;
8317 oss << " Test: " << test_ << "\n"
8318 << " Error: Assignment to submatrix failed\n"
8319 << " Details:\n"
8320 << " Result:\n" << herm << "\n"
8321 << " Expected result:\n( (11, 0) (20, 5) (28,12) (16,-8) ( 5,0) ( 0, 0) )\n"
8322 "( (20, -5) (12, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )\n"
8323 "( (28,-12) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
8324 "( (16, 8) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
8325 "( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
8326 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
8327 throw std::runtime_error( oss.str() );
8328 }
8329 }
8330
8331 {
8332 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
8333 mat(0,0) = cplx(11, 0);
8334 mat(0,1) = cplx(-5, 0);
8335 mat(1,0) = cplx(-5, 0);
8336 mat(1,1) = cplx( 6, 0);
8337 mat(2,0) = cplx( 4, 0);
8338 mat(2,1) = cplx(99,99);
8339 mat(3,0) = cplx(-8, 0);
8340 mat(3,1) = cplx(99,99);
8341
8342 HT herm;
8343 init( herm );
8344
8345 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
8346 sm %= mat;
8347
8348 checkRows ( herm, 6UL );
8349 checkColumns ( herm, 6UL );
8350 checkNonZeros( herm, 26UL );
8351
8352 if( sm(0,0) != cplx(11, 0) || sm(0,1) != cplx(20,5) ||
8353 sm(1,0) != cplx(20, -5) || sm(1,1) != cplx(12,0) ||
8354 sm(2,0) != cplx(28,-12) || sm(2,1) != cplx( 0,0) ||
8355 sm(3,0) != cplx(16, 8) || sm(3,1) != cplx( 0,0) ) {
8356 std::ostringstream oss;
8357 oss << " Test: " << test_ << "\n"
8358 << " Error: Assignment to submatrix failed\n"
8359 << " Details:\n"
8360 << " Result:\n" << sm << "\n"
8361 << " Expected result:\n( (11, 0) (20,5) )\n"
8362 "( (20, -5) (12,0) )\n"
8363 "( (28,-12) ( 0,0) )\n"
8364 "( (16, 8) ( 0,0) )\n";
8365 throw std::runtime_error( oss.str() );
8366 }
8367
8368 if( herm(0,0) != cplx(11, 0) || herm(0,1) != cplx(20, 5) || herm(0,2) != cplx(28,12) || herm(0,3) != cplx(16,-8) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
8369 herm(1,0) != cplx(20, -5) || herm(1,1) != cplx(12, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
8370 herm(2,0) != cplx(28,-12) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
8371 herm(3,0) != cplx(16, 8) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
8372 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
8373 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
8374 std::ostringstream oss;
8375 oss << " Test: " << test_ << "\n"
8376 << " Error: Assignment to submatrix failed\n"
8377 << " Details:\n"
8378 << " Result:\n" << herm << "\n"
8379 << " Expected result:\n( (11, 0) (20, 5) (28,12) (16,-8) ( 5,0) ( 0, 0) )\n"
8380 "( (20, -5) (12, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )\n"
8381 "( (28,-12) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
8382 "( (16, 8) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
8383 "( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
8384 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
8385 throw std::runtime_error( oss.str() );
8386 }
8387 }
8388 }
8389
8390 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
8391 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )
8392 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) (18, 0) (14,14) ( 0, 0) (-2, 0) )
8393 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) (14,-14) (20, 0) (21, 3) ( 0, 0) )
8394 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) ( 1, 0) (-4, 0) )
8395 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
8396 {
8397 test_ = "Dense matrix Schur product assignment test 2";
8398
8399 {
8400 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
8401 mat(0,0) = cplx(99,99);
8402 mat(0,1) = cplx( 6, 0);
8403 mat(0,2) = cplx(14, 0);
8404 mat(0,3) = cplx(99,99);
8405 mat(1,0) = cplx(99,99);
8406 mat(1,1) = cplx(14, 0);
8407 mat(1,2) = cplx( 4, 0);
8408 mat(1,3) = cplx( 3, 0);
8409
8410 HT herm;
8411 init( herm );
8412
8413 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
8414 sm %= mat;
8415
8416 checkRows ( herm, 6UL );
8417 checkColumns ( herm, 6UL );
8418 checkNonZeros( herm, 26UL );
8419
8420 if( sm(0,0) != cplx(0,0) || sm(0,1) != cplx(18, 0) || sm(0,2) != cplx(14,14) || sm(0,3) != cplx( 0,0) ||
8421 sm(1,0) != cplx(0,0) || sm(1,1) != cplx(14,-14) || sm(1,2) != cplx(20, 0) || sm(1,3) != cplx(21,3) ) {
8422 std::ostringstream oss;
8423 oss << " Test: " << test_ << "\n"
8424 << " Error: Assignment to submatrix failed\n"
8425 << " Details:\n"
8426 << " Result:\n" << sm << "\n"
8427 << " Expected result:\n( (0,0) (18, 0) (14,14) ( 0,0) )\n"
8428 "( (0,0) (14,-14) (20, 0) (21,3) )\n";
8429 throw std::runtime_error( oss.str() );
8430 }
8431
8432 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
8433 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
8434 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14,14) || herm(2,4) != cplx( 0, 0) || herm(2,5) != cplx(-2, 0) ||
8435 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx(14,-14) || herm(3,3) != cplx(20, 0) || herm(3,4) != cplx(21, 3) || herm(3,5) != cplx( 0, 0) ||
8436 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(21,-3) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
8437 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
8438 std::ostringstream oss;
8439 oss << " Test: " << test_ << "\n"
8440 << " Error: Assignment to submatrix failed\n"
8441 << " Details:\n"
8442 << " Result:\n" << herm << "\n"
8443 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
8444 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )\n"
8445 "( ( 7,-3) ( 0, 0) (18, 0) (14,14) ( 0, 0) (-2, 0) )\n"
8446 "( (-2,-1) ( 0, 0) (14,-14) (20, 0) (21, 3) ( 0, 0) )\n"
8447 "( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) ( 1, 0) (-4, 0) )\n"
8448 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
8449 throw std::runtime_error( oss.str() );
8450 }
8451 }
8452
8453 {
8454 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
8455 mat(0,0) = cplx(99,99);
8456 mat(0,1) = cplx(99,99);
8457 mat(1,0) = cplx( 6, 0);
8458 mat(1,1) = cplx(14, 0);
8459 mat(2,0) = cplx(14, 0);
8460 mat(2,1) = cplx( 4, 0);
8461 mat(3,0) = cplx(99,99);
8462 mat(3,1) = cplx( 3, 0);
8463
8464 HT herm;
8465 init( herm );
8466
8467 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
8468 sm %= mat;
8469
8470 checkRows ( herm, 6UL );
8471 checkColumns ( herm, 6UL );
8472 checkNonZeros( herm, 26UL );
8473
8474 if( sm(0,0) != cplx( 0, 0) || sm(0,1) != cplx( 0, 0) ||
8475 sm(1,0) != cplx(18, 0) || sm(1,1) != cplx(14,14) ||
8476 sm(2,0) != cplx(14,-14) || sm(2,1) != cplx(20, 0) ||
8477 sm(3,0) != cplx( 0, 0) || sm(3,1) != cplx(21,-3) ) {
8478 std::ostringstream oss;
8479 oss << " Test: " << test_ << "\n"
8480 << " Error: Assignment to submatrix failed\n"
8481 << " Details:\n"
8482 << " Result:\n" << sm << "\n"
8483 << " Expected result:\n( ( 0, 0) ( 0, 0) )\n"
8484 "( (18, 0) (14,14) )\n"
8485 "( (14,-14) (20, 0) )\n"
8486 "( ( 0, 0) (21,-3) )\n";
8487 throw std::runtime_error( oss.str() );
8488 }
8489
8490 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
8491 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
8492 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14,14) || herm(2,4) != cplx( 0, 0) || herm(2,5) != cplx(-2, 0) ||
8493 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx(14,-14) || herm(3,3) != cplx(20, 0) || herm(3,4) != cplx(21, 3) || herm(3,5) != cplx( 0, 0) ||
8494 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(21,-3) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
8495 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
8496 std::ostringstream oss;
8497 oss << " Test: " << test_ << "\n"
8498 << " Error: Assignment to submatrix failed\n"
8499 << " Details:\n"
8500 << " Result:\n" << herm << "\n"
8501 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
8502 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )\n"
8503 "( ( 7,-3) ( 0, 0) (18, 0) (14,14) ( 0, 0) (-2, 0) )\n"
8504 "( (-2,-1) ( 0, 0) (14,-14) (20, 0) (21, 3) ( 0, 0) )\n"
8505 "( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) ( 1, 0) (-4, 0) )\n"
8506 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
8507 throw std::runtime_error( oss.str() );
8508 }
8509 }
8510 }
8511
8512 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) )
8513 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
8514 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (16, 0) )
8515 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) (21,3) ( 0, 0) )
8516 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) (14,0) (20, 0) )
8517 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (16, 0) ( 0, 0) (20,0) (28, 0) )
8518 {
8519 test_ = "Dense matrix Schur product assignment test 3";
8520
8521 {
8522 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
8523 mat(0,0) = cplx(99,99);
8524 mat(0,1) = cplx( 3, 0);
8525 mat(0,2) = cplx(14, 0);
8526 mat(0,3) = cplx(-5, 0);
8527 mat(1,0) = cplx(-8, 0);
8528 mat(1,1) = cplx(99,99);
8529 mat(1,2) = cplx(-5, 0);
8530 mat(1,3) = cplx( 4, 0);
8531
8532 HT herm;
8533 init( herm );
8534
8535 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
8536 sm %= mat;
8537
8538 checkRows ( herm, 6UL );
8539 checkColumns ( herm, 6UL );
8540 checkNonZeros( herm, 26UL );
8541
8542 if( sm(0,0) != cplx( 0,0) || sm(0,1) != cplx(21,-3) || sm(0,2) != cplx(14,0) || sm(0,3) != cplx(20,0) ||
8543 sm(1,0) != cplx(16,0) || sm(1,1) != cplx( 0, 0) || sm(1,2) != cplx(20,0) || sm(1,3) != cplx(28,0) ) {
8544 std::ostringstream oss;
8545 oss << " Test: " << test_ << "\n"
8546 << " Error: Assignment to submatrix failed\n"
8547 << " Details:\n"
8548 << " Result:\n" << sm << "\n"
8549 << " Expected result:\n( ( 0,0) (21,-3) (14,0) (20,0) )\n"
8550 "( (16,0) ( 0, 0) (20,0) (28,0) )\n";
8551 throw std::runtime_error( oss.str() );
8552 }
8553
8554 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
8555 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
8556 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(16, 0) ||
8557 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx(21,3) || herm(3,5) != cplx( 0, 0) ||
8558 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(21,-3) || herm(4,4) != cplx(14,0) || herm(4,5) != cplx(20, 0) ||
8559 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(16, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(20,0) || herm(5,5) != cplx(28, 0) ) {
8560 std::ostringstream oss;
8561 oss << " Test: " << test_ << "\n"
8562 << " Error: Assignment to submatrix failed\n"
8563 << " Details:\n"
8564 << " Result:\n" << herm << "\n"
8565 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
8566 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )\n"
8567 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0, 0) (16, 0) )\n"
8568 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) (21, 3) ( 0, 0) )\n"
8569 "( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) (14, 0) (20, 0) )\n"
8570 "( ( 0, 0) ( 8, 2) (16, 0) ( 0, 0) (20, 0) (28, 0) )\n";
8571 throw std::runtime_error( oss.str() );
8572 }
8573 }
8574
8575 {
8576 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
8577 mat(0,0) = cplx(99,99);
8578 mat(0,1) = cplx(-8, 0);
8579 mat(1,0) = cplx( 3, 0);
8580 mat(1,1) = cplx(99,99);
8581 mat(2,0) = cplx(14, 0);
8582 mat(2,1) = cplx(-5, 0);
8583 mat(3,0) = cplx(-5, 0);
8584 mat(3,1) = cplx( 4, 0);
8585
8586 HT herm;
8587 init( herm );
8588
8589 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
8590 sm %= mat;
8591
8592 checkRows ( herm, 6UL );
8593 checkColumns ( herm, 6UL );
8594 checkNonZeros( herm, 26UL );
8595
8596 if( sm(0,0) != cplx( 0,0) || sm(0,1) != cplx(16,0) ||
8597 sm(1,0) != cplx(21,3) || sm(1,1) != cplx( 0,0) ||
8598 sm(2,0) != cplx(14,0) || sm(2,1) != cplx(20,0) ||
8599 sm(3,0) != cplx(20,0) || sm(3,1) != cplx(28,0) ) {
8600 std::ostringstream oss;
8601 oss << " Test: " << test_ << "\n"
8602 << " Error: Assignment to submatrix failed\n"
8603 << " Details:\n"
8604 << " Result:\n" << sm << "\n"
8605 << " Expected result:\n( ( 0,0) (16,0) )\n"
8606 "( (21,3) ( 0,0) )\n"
8607 "( (14,0) (20,0) )\n"
8608 "( (20,0) (28,0) )\n";
8609 throw std::runtime_error( oss.str() );
8610 }
8611
8612 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
8613 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
8614 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(16, 0) ||
8615 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx(21,3) || herm(3,5) != cplx( 0, 0) ||
8616 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(21,-3) || herm(4,4) != cplx(14,0) || herm(4,5) != cplx(20, 0) ||
8617 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(16, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(20,0) || herm(5,5) != cplx(28, 0) ) {
8618 std::ostringstream oss;
8619 oss << " Test: " << test_ << "\n"
8620 << " Error: Assignment to submatrix failed\n"
8621 << " Details:\n"
8622 << " Result:\n" << herm << "\n"
8623 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
8624 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )\n"
8625 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0, 0) (16, 0) )\n"
8626 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) (21, 3) ( 0, 0) )\n"
8627 "( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) (14, 0) (20, 0) )\n"
8628 "( ( 0, 0) ( 8, 2) (16, 0) ( 0, 0) (20, 0) (28, 0) )\n";
8629 throw std::runtime_error( oss.str() );
8630 }
8631 }
8632 }
8633
8634 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (14, 6) (18,-9) (25, 0) ( 0, 0) )
8635 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) ( 7,14) ( 8,-2) )
8636 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,-6) ( 0, 0) (18, 0) (11,11) ( 0, 0) (-2, 0) )
8637 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (18, 9) ( 0, 0) (11,-11) (20, 0) (14, 2) ( 0, 0) )
8638 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (25, 0) ( 7,14) ( 0, 0) (14,-2) ( 1, 0) (-4, 0) )
8639 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
8640 {
8641 test_ = "Dense matrix Schur product assignment test 4";
8642
8643 {
8644 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
8645 mat(0,0) = cplx( 2, 0);
8646 mat(0,1) = cplx(99,99);
8647 mat(0,2) = cplx( 6, 0);
8648 mat(0,3) = cplx(11, 0);
8649 mat(1,0) = cplx(-9, 0);
8650 mat(1,1) = cplx(99,99);
8651 mat(1,2) = cplx(11, 0);
8652 mat(1,3) = cplx( 4, 0);
8653 mat(2,0) = cplx( 5, 0);
8654 mat(2,1) = cplx(-7, 0);
8655 mat(2,2) = cplx(99,99);
8656 mat(2,3) = cplx( 2, 0);
8657
8658 HT herm;
8659 init( herm );
8660
8661 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
8662 sm %= mat;
8663
8664 checkRows ( herm, 6UL );
8665 checkColumns ( herm, 6UL );
8666 checkNonZeros( herm, 26UL );
8667
8668 if( sm(0,0) != cplx(14,-6) || sm(0,1) != cplx(0, 0) || sm(0,2) != cplx(18, 0) || sm(0,3) != cplx(11,11) ||
8669 sm(1,0) != cplx(18, 9) || sm(1,1) != cplx(0, 0) || sm(1,2) != cplx(11,-11) || sm(1,3) != cplx(20, 0) ||
8670 sm(2,0) != cplx(25, 0) || sm(2,1) != cplx(7,14) || sm(2,2) != cplx( 0, 0) || sm(2,3) != cplx(14,-2) ) {
8671 std::ostringstream oss;
8672 oss << " Test: " << test_ << "\n"
8673 << " Error: Assignment to submatrix failed\n"
8674 << " Details:\n"
8675 << " Result:\n" << sm << "\n"
8676 << " Expected result:\n( (14,-6) (0, 0) (18, 0) (11,11) )\n"
8677 "( (18, 9) (0, 0) (11,-11) (20, 0) )\n"
8678 "( (25, 0) (7,14) ( 0, 0) (14,-2) )\n";
8679 throw std::runtime_error( oss.str() );
8680 }
8681
8682 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(14, 6) || herm(0,3) != cplx(18,-9) || herm(0,4) != cplx(25, 0) || herm(0,5) != cplx( 0, 0) ||
8683 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx( 7,-14) || herm(1,5) != cplx( 8,-2) ||
8684 herm(2,0) != cplx(14,-6) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(11,11) || herm(2,4) != cplx( 0, 0) || herm(2,5) != cplx(-2, 0) ||
8685 herm(3,0) != cplx(18, 9) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx(11,-11) || herm(3,3) != cplx(20, 0) || herm(3,4) != cplx(14, 2) || herm(3,5) != cplx( 0, 0) ||
8686 herm(4,0) != cplx(25, 0) || herm(4,1) != cplx( 7,14) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(14,-2) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
8687 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
8688 std::ostringstream oss;
8689 oss << " Test: " << test_ << "\n"
8690 << " Error: Assignment to submatrix failed\n"
8691 << " Details:\n"
8692 << " Result:\n" << herm << "\n"
8693 << " Expected result:\n( ( 1, 0) (-4,-1) (14, 6) (18,-9) (25, 0) ( 0, 0) )\n"
8694 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) ( 7,-14) ( 8,-2) )\n"
8695 "( (14,-6) ( 0, 0) (18, 0) (11,11) ( 0, 0) (-2, 0) )\n"
8696 "( (18, 9) ( 0, 0) (11,-11) (20, 0) (14, 2) ( 0, 0) )\n"
8697 "( (25, 0) ( 7,14) ( 0, 0) (14,-2) ( 1, 0) (-4, 0) )\n"
8698 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
8699 throw std::runtime_error( oss.str() );
8700 }
8701 }
8702
8703 {
8704 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
8705 mat(0,0) = cplx( 2, 0);
8706 mat(0,1) = cplx(-9, 0);
8707 mat(0,2) = cplx( 5, 0);
8708 mat(1,0) = cplx(99,99);
8709 mat(1,1) = cplx(99,99);
8710 mat(1,2) = cplx(-7, 0);
8711 mat(2,0) = cplx( 6, 0);
8712 mat(2,1) = cplx(11, 0);
8713 mat(2,2) = cplx(99,99);
8714 mat(3,0) = cplx(11, 0);
8715 mat(3,1) = cplx( 4, 0);
8716 mat(3,2) = cplx( 2, 0);
8717
8718 HT herm;
8719 init( herm );
8720
8721 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
8722 sm %= mat;
8723
8724 checkRows ( herm, 6UL );
8725 checkColumns ( herm, 6UL );
8726 checkNonZeros( herm, 26UL );
8727
8728 if( sm(0,0) != cplx(14, 6) || sm(0,1) != cplx(18,-9) || sm(0,2) != cplx(25, 0) ||
8729 sm(1,0) != cplx( 0, 0) || sm(1,1) != cplx( 0, 0) || sm(1,2) != cplx( 7,-14) ||
8730 sm(2,0) != cplx(18, 0) || sm(2,1) != cplx(11,11) || sm(2,2) != cplx( 0, 0) ||
8731 sm(3,0) != cplx(11,-11) || sm(3,1) != cplx(20, 0) || sm(3,2) != cplx(14, 2) ) {
8732 std::ostringstream oss;
8733 oss << " Test: " << test_ << "\n"
8734 << " Error: Assignment to submatrix failed\n"
8735 << " Details:\n"
8736 << " Result:\n" << sm << "\n"
8737 << " Expected result:\n( (14, 6) (18,-9) (25, 0) )\n"
8738 "( ( 0, 0) ( 0, 0) ( 7,-14) )\n"
8739 "( (18, 0) (11,11) ( 0, 0) )\n"
8740 "( (11,-11) (20, 0) (14, 2) )\n";
8741 throw std::runtime_error( oss.str() );
8742 }
8743
8744 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(14, 6) || herm(0,3) != cplx(18,-9) || herm(0,4) != cplx(25, 0) || herm(0,5) != cplx( 0, 0) ||
8745 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx( 7,-14) || herm(1,5) != cplx( 8,-2) ||
8746 herm(2,0) != cplx(14,-6) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(11,11) || herm(2,4) != cplx( 0, 0) || herm(2,5) != cplx(-2, 0) ||
8747 herm(3,0) != cplx(18, 9) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx(11,-11) || herm(3,3) != cplx(20, 0) || herm(3,4) != cplx(14, 2) || herm(3,5) != cplx( 0, 0) ||
8748 herm(4,0) != cplx(25, 0) || herm(4,1) != cplx( 7,14) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(14,-2) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
8749 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
8750 std::ostringstream oss;
8751 oss << " Test: " << test_ << "\n"
8752 << " Error: Assignment to submatrix failed\n"
8753 << " Details:\n"
8754 << " Result:\n" << herm << "\n"
8755 << " Expected result:\n( ( 1, 0) (-4,-1) (14, 6) (18,-9) (25, 0) ( 0, 0) )\n"
8756 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) ( 7,-14) ( 8,-2) )\n"
8757 "( (14,-6) ( 0, 0) (18, 0) (11,11) ( 0, 0) (-2, 0) )\n"
8758 "( (18, 9) ( 0, 0) (11,-11) (20, 0) (14, 2) ( 0, 0) )\n"
8759 "( (25, 0) ( 7,14) ( 0, 0) (14,-2) ( 1, 0) (-4, 0) )\n"
8760 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
8761 throw std::runtime_error( oss.str() );
8762 }
8763 }
8764 }
8765
8766 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (11, 0) (20, 5) (28,12) (16,-8) ( 5,0) ( 0, 0) )
8767 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (24, -6) (12, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
8768 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (28,-12) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
8769 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (16, 8) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
8770 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
8771 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
8772 {
8773 test_ = "Dense matrix Schur product assignment test 5";
8774
8775 {
8776 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
8777 mat(0,0) = cplx(11, 0);
8778 mat(0,1) = cplx(-5, 0);
8779 mat(0,2) = cplx( 4, 0);
8780 mat(0,3) = cplx(-8, 0);
8781 mat(1,0) = cplx(-6, 0);
8782 mat(1,1) = cplx( 6, 0);
8783 mat(1,2) = cplx(99,99);
8784 mat(1,3) = cplx(99,99);
8785
8786 HT herm;
8787 init( herm );
8788
8789 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
8790
8791 try {
8792 sm %= mat;
8793
8794 std::ostringstream oss;
8795 oss << " Test: " << test_ << "\n"
8796 << " Error: Assignment of invalid matrix succeeded\n"
8797 << " Details:\n"
8798 << " Result:\n" << herm << "\n";
8799 throw std::runtime_error( oss.str() );
8800 }
8801 catch( std::invalid_argument& ) {}
8802 }
8803
8804 {
8805 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
8806 mat(0,0) = cplx(11, 0);
8807 mat(0,1) = cplx(-6, 0);
8808 mat(1,0) = cplx(-5, 0);
8809 mat(1,1) = cplx( 6, 0);
8810 mat(2,0) = cplx( 4, 0);
8811 mat(2,1) = cplx(99,99);
8812 mat(3,0) = cplx(-8, 0);
8813 mat(3,1) = cplx(99,99);
8814
8815 HT herm;
8816 init( herm );
8817
8818 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
8819
8820 try {
8821 sm %= mat;
8822
8823 std::ostringstream oss;
8824 oss << " Test: " << test_ << "\n"
8825 << " Error: Assignment of invalid matrix succeeded\n"
8826 << " Details:\n"
8827 << " Result:\n" << herm << "\n";
8828 throw std::runtime_error( oss.str() );
8829 }
8830 catch( std::invalid_argument& ) {}
8831 }
8832 }
8833
8834 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
8835 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )
8836 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) (18, 0) (14,14) ( 0, 0) (-2, 0) )
8837 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) (22,-22) (20, 0) (21, 3) ( 0, 0) )
8838 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) ( 1, 0) (-4, 0) )
8839 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
8840 {
8841 test_ = "Dense matrix Schur product assignment test 6";
8842
8843 {
8844 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
8845 mat(0,0) = cplx(99,99);
8846 mat(0,1) = cplx( 6, 0);
8847 mat(0,2) = cplx(14, 0);
8848 mat(0,3) = cplx(99,99);
8849 mat(1,0) = cplx(99,99);
8850 mat(1,1) = cplx(22, 0);
8851 mat(1,2) = cplx( 4, 0);
8852 mat(1,3) = cplx( 3, 0);
8853
8854 HT herm;
8855 init( herm );
8856
8857 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
8858
8859 try {
8860 sm %= mat;
8861
8862 std::ostringstream oss;
8863 oss << " Test: " << test_ << "\n"
8864 << " Error: Assignment of invalid matrix succeeded\n"
8865 << " Details:\n"
8866 << " Result:\n" << herm << "\n";
8867 throw std::runtime_error( oss.str() );
8868 }
8869 catch( std::invalid_argument& ) {}
8870 }
8871
8872 {
8873 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
8874 mat(0,0) = cplx(99,99);
8875 mat(0,1) = cplx(99,99);
8876 mat(1,0) = cplx( 6, 0);
8877 mat(1,1) = cplx(22, 0);
8878 mat(2,0) = cplx(14, 0);
8879 mat(2,1) = cplx( 4, 0);
8880 mat(3,0) = cplx(99,99);
8881 mat(3,1) = cplx( 3, 0);
8882
8883 HT herm;
8884 init( herm );
8885
8886 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
8887
8888 try {
8889 sm %= mat;
8890
8891 std::ostringstream oss;
8892 oss << " Test: " << test_ << "\n"
8893 << " Error: Assignment of invalid matrix succeeded\n"
8894 << " Details:\n"
8895 << " Result:\n" << herm << "\n";
8896 throw std::runtime_error( oss.str() );
8897 }
8898 catch( std::invalid_argument& ) {}
8899 }
8900 }
8901
8902 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) )
8903 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
8904 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (16, 0) )
8905 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) (21,3) ( 0, 0) )
8906 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) (14,0) (20, 0) )
8907 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (16, 0) ( 0, 0) (24,0) (28, 0) )
8908 {
8909 test_ = "Dense matrix Schur product assignment test 7";
8910
8911 {
8912 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
8913 mat(0,0) = cplx(99,99);
8914 mat(0,1) = cplx( 3, 0);
8915 mat(0,2) = cplx(14, 0);
8916 mat(0,3) = cplx(-5, 0);
8917 mat(1,0) = cplx(-8, 0);
8918 mat(1,1) = cplx(99,99);
8919 mat(1,2) = cplx(-6, 0);
8920 mat(1,3) = cplx( 4, 0);
8921
8922 HT herm;
8923 init( herm );
8924
8925 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
8926
8927 try {
8928 sm %= mat;
8929
8930 std::ostringstream oss;
8931 oss << " Test: " << test_ << "\n"
8932 << " Error: Assignment of invalid matrix succeeded\n"
8933 << " Details:\n"
8934 << " Result:\n" << herm << "\n";
8935 throw std::runtime_error( oss.str() );
8936 }
8937 catch( std::invalid_argument& ) {}
8938 }
8939
8940 {
8941 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
8942 mat(0,0) = cplx(99,99);
8943 mat(0,1) = cplx(-8, 0);
8944 mat(1,0) = cplx( 3, 0);
8945 mat(1,1) = cplx(99,99);
8946 mat(2,0) = cplx(14, 0);
8947 mat(2,1) = cplx(-6, 0);
8948 mat(3,0) = cplx(-5, 0);
8949 mat(3,1) = cplx( 4, 0);
8950
8951 HT herm;
8952 init( herm );
8953
8954 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
8955
8956 try {
8957 sm %= mat;
8958
8959 std::ostringstream oss;
8960 oss << " Test: " << test_ << "\n"
8961 << " Error: Assignment of invalid matrix succeeded\n"
8962 << " Details:\n"
8963 << " Result:\n" << herm << "\n";
8964 throw std::runtime_error( oss.str() );
8965 }
8966 catch( std::invalid_argument& ) {}
8967 }
8968 }
8969
8970 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (14, 6) (18,-9) (25, 0) ( 0, 0) )
8971 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) ( 7,14) ( 8,-2) )
8972 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,-6) ( 0, 0) (18, 0) (11,11) ( 0, 0) (-2, 0) )
8973 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (18, 9) ( 0, 0) (22,-22) (20, 0) (14, 2) ( 0, 0) )
8974 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (25, 0) ( 7,14) ( 0, 0) (14,-2) ( 1, 0) (-4, 0) )
8975 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
8976 {
8977 test_ = "Dense matrix Schur product assignment test 8";
8978
8979 {
8980 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
8981 mat(0,0) = cplx( 2, 0);
8982 mat(0,1) = cplx(99,99);
8983 mat(0,2) = cplx( 6, 0);
8984 mat(0,3) = cplx(11, 0);
8985 mat(1,0) = cplx(-9, 0);
8986 mat(1,1) = cplx(99,99);
8987 mat(1,2) = cplx(22, 0);
8988 mat(1,3) = cplx( 4, 0);
8989 mat(2,0) = cplx( 5, 0);
8990 mat(2,1) = cplx(-7, 0);
8991 mat(2,2) = cplx(99,99);
8992 mat(2,3) = cplx( 2, 0);
8993
8994 HT herm;
8995 init( herm );
8996
8997 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
8998
8999 try {
9000 sm %= mat;
9001
9002 std::ostringstream oss;
9003 oss << " Test: " << test_ << "\n"
9004 << " Error: Assignment of invalid matrix succeeded\n"
9005 << " Details:\n"
9006 << " Result:\n" << herm << "\n";
9007 throw std::runtime_error( oss.str() );
9008 }
9009 catch( std::invalid_argument& ) {}
9010 }
9011
9012 {
9013 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
9014 mat(0,0) = cplx( 2, 0);
9015 mat(0,1) = cplx(-9, 0);
9016 mat(0,2) = cplx( 5, 0);
9017 mat(1,0) = cplx(99,99);
9018 mat(1,1) = cplx(99,99);
9019 mat(1,2) = cplx(-7, 0);
9020 mat(2,0) = cplx( 6, 0);
9021 mat(2,1) = cplx(22, 0);
9022 mat(2,2) = cplx(99,99);
9023 mat(3,0) = cplx(11, 0);
9024 mat(3,1) = cplx( 4, 0);
9025 mat(3,2) = cplx( 2, 0);
9026
9027 HT herm;
9028 init( herm );
9029
9030 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
9031
9032 try {
9033 sm %= mat;
9034
9035 std::ostringstream oss;
9036 oss << " Test: " << test_ << "\n"
9037 << " Error: Assignment of invalid matrix succeeded\n"
9038 << " Details:\n"
9039 << " Result:\n" << herm << "\n";
9040 throw std::runtime_error( oss.str() );
9041 }
9042 catch( std::invalid_argument& ) {}
9043 }
9044 }
9045
9046 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (11, 0) (20, 5) (28,12) (16,-8) ( 5,0) ( 0, 0) )
9047 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (20, -5) (12, 4) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
9048 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (28,-12) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
9049 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (16, 8) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
9050 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
9051 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
9052 {
9053 test_ = "Dense matrix Schur product assignment test 9";
9054
9055 {
9056 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
9057 mat(0,0) = cplx(11, 0);
9058 mat(0,1) = cplx(-5, 0);
9059 mat(0,2) = cplx( 4, 0);
9060 mat(0,3) = cplx(-8, 0);
9061 mat(1,0) = cplx(-5, 0);
9062 mat(1,1) = cplx( 6, 2);
9063 mat(1,2) = cplx(99,99);
9064 mat(1,3) = cplx(99,99);
9065
9066 HT herm;
9067 init( herm );
9068
9069 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
9070
9071 try {
9072 sm %= mat;
9073
9074 std::ostringstream oss;
9075 oss << " Test: " << test_ << "\n"
9076 << " Error: Assignment of invalid matrix succeeded\n"
9077 << " Details:\n"
9078 << " Result:\n" << herm << "\n";
9079 throw std::runtime_error( oss.str() );
9080 }
9081 catch( std::invalid_argument& ) {}
9082 }
9083
9084 {
9085 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
9086 mat(0,0) = cplx(11, 0);
9087 mat(0,1) = cplx(-5, 0);
9088 mat(1,0) = cplx(-5, 0);
9089 mat(1,1) = cplx( 6, 2);
9090 mat(2,0) = cplx( 4, 0);
9091 mat(2,1) = cplx(99,99);
9092 mat(3,0) = cplx(-8, 0);
9093 mat(3,1) = cplx(99,99);
9094
9095 HT herm;
9096 init( herm );
9097
9098 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
9099
9100 try {
9101 sm %= mat;
9102
9103 std::ostringstream oss;
9104 oss << " Test: " << test_ << "\n"
9105 << " Error: Assignment of invalid matrix succeeded\n"
9106 << " Details:\n"
9107 << " Result:\n" << herm << "\n";
9108 throw std::runtime_error( oss.str() );
9109 }
9110 catch( std::invalid_argument& ) {}
9111 }
9112 }
9113
9114 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
9115 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )
9116 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) (18, 0) (14,14) ( 0, 0) (-2, 0) )
9117 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) (14,-14) (20, 5) (21, 3) ( 0, 0) )
9118 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) ( 1, 0) (-4, 0) )
9119 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
9120 {
9121 test_ = "Dense matrix Schur product assignment test 10";
9122
9123 {
9124 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
9125 mat(0,0) = cplx(99,99);
9126 mat(0,1) = cplx( 6, 0);
9127 mat(0,2) = cplx(14, 0);
9128 mat(0,3) = cplx(99,99);
9129 mat(1,0) = cplx(99,99);
9130 mat(1,1) = cplx(14, 0);
9131 mat(1,2) = cplx( 4, 1);
9132 mat(1,3) = cplx( 3, 0);
9133
9134 HT herm;
9135 init( herm );
9136
9137 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
9138
9139 try {
9140 sm %= mat;
9141
9142 std::ostringstream oss;
9143 oss << " Test: " << test_ << "\n"
9144 << " Error: Assignment of invalid matrix succeeded\n"
9145 << " Details:\n"
9146 << " Result:\n" << herm << "\n";
9147 throw std::runtime_error( oss.str() );
9148 }
9149 catch( std::invalid_argument& ) {}
9150 }
9151
9152 {
9153 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
9154 mat(0,0) = cplx(99,99);
9155 mat(0,1) = cplx(99,99);
9156 mat(1,0) = cplx( 6, 0);
9157 mat(1,1) = cplx(14, 0);
9158 mat(2,0) = cplx(14, 0);
9159 mat(2,1) = cplx( 4, 1);
9160 mat(3,0) = cplx(99,99);
9161 mat(3,1) = cplx( 3, 0);
9162
9163 HT herm;
9164 init( herm );
9165
9166 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
9167
9168 try {
9169 sm %= mat;
9170
9171 std::ostringstream oss;
9172 oss << " Test: " << test_ << "\n"
9173 << " Error: Assignment of invalid matrix succeeded\n"
9174 << " Details:\n"
9175 << " Result:\n" << herm << "\n";
9176 throw std::runtime_error( oss.str() );
9177 }
9178 catch( std::invalid_argument& ) {}
9179 }
9180 }
9181
9182 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) )
9183 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
9184 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (16, 0) )
9185 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) (21,3) ( 0, 0) )
9186 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) (14,0) (20, 0) )
9187 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (16, 0) ( 0, 0) (20,0) (28, 7) )
9188 {
9189 test_ = "Dense matrix Schur product assignment test 11";
9190
9191 {
9192 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL );
9193 mat(0,0) = cplx(99,99);
9194 mat(0,1) = cplx( 3, 0);
9195 mat(0,2) = cplx(14, 0);
9196 mat(0,3) = cplx(-5, 0);
9197 mat(1,0) = cplx(-8, 0);
9198 mat(1,1) = cplx(99,99);
9199 mat(1,2) = cplx(-5, 0);
9200 mat(1,3) = cplx( 4, 1);
9201
9202 HT herm;
9203 init( herm );
9204
9205 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
9206
9207 try {
9208 sm %= mat;
9209
9210 std::ostringstream oss;
9211 oss << " Test: " << test_ << "\n"
9212 << " Error: Assignment of invalid matrix succeeded\n"
9213 << " Details:\n"
9214 << " Result:\n" << herm << "\n";
9215 throw std::runtime_error( oss.str() );
9216 }
9217 catch( std::invalid_argument& ) {}
9218 }
9219
9220 {
9221 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL );
9222 mat(0,0) = cplx(99,99);
9223 mat(0,1) = cplx(-8, 0);
9224 mat(1,0) = cplx( 3, 0);
9225 mat(1,1) = cplx(99,99);
9226 mat(2,0) = cplx(14, 0);
9227 mat(2,1) = cplx(-5, 0);
9228 mat(3,0) = cplx(-5, 0);
9229 mat(3,1) = cplx( 4, 1);
9230
9231 HT herm;
9232 init( herm );
9233
9234 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
9235
9236 try {
9237 sm %= mat;
9238
9239 std::ostringstream oss;
9240 oss << " Test: " << test_ << "\n"
9241 << " Error: Assignment of invalid matrix succeeded\n"
9242 << " Details:\n"
9243 << " Result:\n" << herm << "\n";
9244 throw std::runtime_error( oss.str() );
9245 }
9246 catch( std::invalid_argument& ) {}
9247 }
9248 }
9249
9250 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (14, 6) (18,-9) (25, 0) ( 0, 0) )
9251 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) ( 7,14) ( 8,-2) )
9252 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,-6) ( 0, 0) (18, 0) (11,11) ( 0, 0) (-2, 0) )
9253 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (18, 9) ( 0, 0) (11,-11) (20, 5) (14, 2) ( 0, 0) )
9254 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (25, 0) ( 7,14) ( 0, 0) (14,-2) ( 1, 0) (-4, 0) )
9255 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
9256 {
9257 test_ = "Dense matrix Schur product assignment test 12";
9258
9259 {
9260 blaze::DynamicMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL );
9261 mat(0,0) = cplx( 2, 0);
9262 mat(0,1) = cplx(99,99);
9263 mat(0,2) = cplx( 6, 0);
9264 mat(0,3) = cplx(11, 0);
9265 mat(1,0) = cplx(-9, 0);
9266 mat(1,1) = cplx(99,99);
9267 mat(1,2) = cplx(11, 0);
9268 mat(1,3) = cplx( 4, 1);
9269 mat(2,0) = cplx( 5, 0);
9270 mat(2,1) = cplx(-7, 0);
9271 mat(2,2) = cplx(99,99);
9272 mat(2,3) = cplx( 2, 0);
9273
9274 HT herm;
9275 init( herm );
9276
9277 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
9278
9279 try {
9280 sm %= mat;
9281
9282 std::ostringstream oss;
9283 oss << " Test: " << test_ << "\n"
9284 << " Error: Assignment of invalid matrix succeeded\n"
9285 << " Details:\n"
9286 << " Result:\n" << herm << "\n";
9287 throw std::runtime_error( oss.str() );
9288 }
9289 catch( std::invalid_argument& ) {}
9290 }
9291
9292 {
9293 blaze::DynamicMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL );
9294 mat(0,0) = cplx( 2, 0);
9295 mat(0,1) = cplx(-9, 0);
9296 mat(0,2) = cplx( 5, 0);
9297 mat(1,0) = cplx(99,99);
9298 mat(1,1) = cplx(99,99);
9299 mat(1,2) = cplx(-7, 0);
9300 mat(2,0) = cplx( 6, 0);
9301 mat(2,1) = cplx(11, 0);
9302 mat(2,2) = cplx(99,99);
9303 mat(3,0) = cplx(11, 0);
9304 mat(3,1) = cplx( 4, 1);
9305 mat(3,2) = cplx( 2, 0);
9306
9307 HT herm;
9308 init( herm );
9309
9310 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
9311
9312 try {
9313 sm %= mat;
9314
9315 std::ostringstream oss;
9316 oss << " Test: " << test_ << "\n"
9317 << " Error: Assignment of invalid matrix succeeded\n"
9318 << " Details:\n"
9319 << " Result:\n" << herm << "\n";
9320 throw std::runtime_error( oss.str() );
9321 }
9322 catch( std::invalid_argument& ) {}
9323 }
9324 }
9325
9326
9327 //=====================================================================================
9328 // Sparse matrix Schur product assignment
9329 //=====================================================================================
9330
9331 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (11, 0) (20, 5) (28,12) (16,-8) ( 5,0) ( 0, 0) )
9332 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (20, -5) (12, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
9333 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (28,-12) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
9334 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (16, 8) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
9335 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
9336 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
9337 {
9338 test_ = "Sparse matrix Schur product assignment test 1";
9339
9340 {
9341 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
9342 mat(0,0) = cplx(11, 0);
9343 mat(0,1) = cplx(-5, 0);
9344 mat(0,2) = cplx( 4, 0);
9345 mat(0,3) = cplx(-8, 0);
9346 mat(1,0) = cplx(-5, 0);
9347 mat(1,1) = cplx( 6, 0);
9348 mat(1,2) = cplx(99,99);
9349 mat(1,3) = cplx(99,99);
9350
9351 HT herm;
9352 init( herm );
9353
9354 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
9355 sm %= mat;
9356
9357 checkRows ( herm, 6UL );
9358 checkColumns ( herm, 6UL );
9359 checkNonZeros( herm, 26UL );
9360
9361 if( sm(0,0) != cplx(11, 0) || sm(0,1) != cplx(20,5) || sm(0,2) != cplx(28,12) || sm(0,3) != cplx(16,-8) ||
9362 sm(1,0) != cplx(20,-5) || sm(1,1) != cplx(12,0) || sm(1,2) != cplx( 0, 0) || sm(1,3) != cplx( 0, 0) ) {
9363 std::ostringstream oss;
9364 oss << " Test: " << test_ << "\n"
9365 << " Error: Assignment to submatrix failed\n"
9366 << " Details:\n"
9367 << " Result:\n" << sm << "\n"
9368 << " Expected result:\n( (11, 0) (20,5) (28,12) (16,-8) )\n"
9369 "( (20,-5) (12,0) ( 0, 0) ( 0, 0) )\n";
9370 throw std::runtime_error( oss.str() );
9371 }
9372
9373 if( herm(0,0) != cplx(11, 0) || herm(0,1) != cplx(20, 5) || herm(0,2) != cplx(28,12) || herm(0,3) != cplx(16,-8) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
9374 herm(1,0) != cplx(20, -5) || herm(1,1) != cplx(12, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
9375 herm(2,0) != cplx(28,-12) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
9376 herm(3,0) != cplx(16, 8) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
9377 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
9378 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
9379 std::ostringstream oss;
9380 oss << " Test: " << test_ << "\n"
9381 << " Error: Assignment to submatrix failed\n"
9382 << " Details:\n"
9383 << " Result:\n" << herm << "\n"
9384 << " Expected result:\n( (11, 0) (20, 5) (28,12) (16,-8) ( 5,0) ( 0, 0) )\n"
9385 "( (20, -5) (12, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )\n"
9386 "( (28,-12) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
9387 "( (16, 8) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
9388 "( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
9389 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
9390 throw std::runtime_error( oss.str() );
9391 }
9392 }
9393
9394 {
9395 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
9396 mat(0,0) = cplx(11, 0);
9397 mat(0,1) = cplx(-5, 0);
9398 mat(1,0) = cplx(-5, 0);
9399 mat(1,1) = cplx( 6, 0);
9400 mat(2,0) = cplx( 4, 0);
9401 mat(2,1) = cplx(99,99);
9402 mat(3,0) = cplx(-8, 0);
9403 mat(3,1) = cplx(99,99);
9404
9405 HT herm;
9406 init( herm );
9407
9408 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
9409 sm %= mat;
9410
9411 checkRows ( herm, 6UL );
9412 checkColumns ( herm, 6UL );
9413 checkNonZeros( herm, 26UL );
9414
9415 if( sm(0,0) != cplx(11, 0) || sm(0,1) != cplx(20,5) ||
9416 sm(1,0) != cplx(20, -5) || sm(1,1) != cplx(12,0) ||
9417 sm(2,0) != cplx(28,-12) || sm(2,1) != cplx( 0,0) ||
9418 sm(3,0) != cplx(16, 8) || sm(3,1) != cplx( 0,0) ) {
9419 std::ostringstream oss;
9420 oss << " Test: " << test_ << "\n"
9421 << " Error: Assignment to submatrix failed\n"
9422 << " Details:\n"
9423 << " Result:\n" << sm << "\n"
9424 << " Expected result:\n( (11, 0) (20,5) )\n"
9425 "( (20, -5) (12,0) )\n"
9426 "( (28,-12) ( 0,0) )\n"
9427 "( (16, 8) ( 0,0) )\n";
9428 throw std::runtime_error( oss.str() );
9429 }
9430
9431 if( herm(0,0) != cplx(11, 0) || herm(0,1) != cplx(20, 5) || herm(0,2) != cplx(28,12) || herm(0,3) != cplx(16,-8) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
9432 herm(1,0) != cplx(20, -5) || herm(1,1) != cplx(12, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
9433 herm(2,0) != cplx(28,-12) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(-2, 0) ||
9434 herm(3,0) != cplx(16, 8) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx( 7,1) || herm(3,5) != cplx( 0, 0) ||
9435 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx( 7,-1) || herm(4,4) != cplx( 1,0) || herm(4,5) != cplx(-4, 0) ||
9436 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4,0) || herm(5,5) != cplx( 7, 0) ) {
9437 std::ostringstream oss;
9438 oss << " Test: " << test_ << "\n"
9439 << " Error: Assignment to submatrix failed\n"
9440 << " Details:\n"
9441 << " Result:\n" << herm << "\n"
9442 << " Expected result:\n( (11, 0) (20, 5) (28,12) (16,-8) ( 5,0) ( 0, 0) )\n"
9443 "( (20, -5) (12, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )\n"
9444 "( (28,-12) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )\n"
9445 "( (16, 8) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )\n"
9446 "( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )\n"
9447 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )\n";
9448 throw std::runtime_error( oss.str() );
9449 }
9450 }
9451 }
9452
9453 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
9454 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )
9455 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) (18, 0) (14,14) ( 0, 0) (-2, 0) )
9456 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) (14,-14) (20, 0) (21, 3) ( 0, 0) )
9457 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) ( 1, 0) (-4, 0) )
9458 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
9459 {
9460 test_ = "Sparse matrix Schur product assignment test 2";
9461
9462 {
9463 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
9464 mat(0,0) = cplx(99,99);
9465 mat(0,1) = cplx( 6, 0);
9466 mat(0,2) = cplx(14, 0);
9467 mat(0,3) = cplx(99,99);
9468 mat(1,0) = cplx(99,99);
9469 mat(1,1) = cplx(14, 0);
9470 mat(1,2) = cplx( 4, 0);
9471 mat(1,3) = cplx( 3, 0);
9472
9473 HT herm;
9474 init( herm );
9475
9476 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
9477 sm %= mat;
9478
9479 checkRows ( herm, 6UL );
9480 checkColumns ( herm, 6UL );
9481 checkNonZeros( herm, 26UL );
9482
9483 if( sm(0,0) != cplx(0,0) || sm(0,1) != cplx(18, 0) || sm(0,2) != cplx(14,14) || sm(0,3) != cplx( 0,0) ||
9484 sm(1,0) != cplx(0,0) || sm(1,1) != cplx(14,-14) || sm(1,2) != cplx(20, 0) || sm(1,3) != cplx(21,3) ) {
9485 std::ostringstream oss;
9486 oss << " Test: " << test_ << "\n"
9487 << " Error: Assignment to submatrix failed\n"
9488 << " Details:\n"
9489 << " Result:\n" << sm << "\n"
9490 << " Expected result:\n( (0,0) (18, 0) (14,14) ( 0,0) )\n"
9491 "( (0,0) (14,-14) (20, 0) (21,3) )\n";
9492 throw std::runtime_error( oss.str() );
9493 }
9494
9495 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
9496 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
9497 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14,14) || herm(2,4) != cplx( 0, 0) || herm(2,5) != cplx(-2, 0) ||
9498 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx(14,-14) || herm(3,3) != cplx(20, 0) || herm(3,4) != cplx(21, 3) || herm(3,5) != cplx( 0, 0) ||
9499 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(21,-3) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
9500 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
9501 std::ostringstream oss;
9502 oss << " Test: " << test_ << "\n"
9503 << " Error: Assignment to submatrix failed\n"
9504 << " Details:\n"
9505 << " Result:\n" << herm << "\n"
9506 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
9507 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )\n"
9508 "( ( 7,-3) ( 0, 0) (18, 0) (14,14) ( 0, 0) (-2, 0) )\n"
9509 "( (-2,-1) ( 0, 0) (14,-14) (20, 0) (21, 3) ( 0, 0) )\n"
9510 "( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) ( 1, 0) (-4, 0) )\n"
9511 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
9512 throw std::runtime_error( oss.str() );
9513 }
9514 }
9515
9516 {
9517 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
9518 mat(0,0) = cplx(99,99);
9519 mat(0,1) = cplx(99,99);
9520 mat(1,0) = cplx( 6, 0);
9521 mat(1,1) = cplx(14, 0);
9522 mat(2,0) = cplx(14, 0);
9523 mat(2,1) = cplx( 4, 0);
9524 mat(3,0) = cplx(99,99);
9525 mat(3,1) = cplx( 3, 0);
9526
9527 HT herm;
9528 init( herm );
9529
9530 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
9531 sm %= mat;
9532
9533 checkRows ( herm, 6UL );
9534 checkColumns ( herm, 6UL );
9535 checkNonZeros( herm, 26UL );
9536
9537 if( sm(0,0) != cplx( 0, 0) || sm(0,1) != cplx( 0, 0) ||
9538 sm(1,0) != cplx(18, 0) || sm(1,1) != cplx(14,14) ||
9539 sm(2,0) != cplx(14,-14) || sm(2,1) != cplx(20, 0) ||
9540 sm(3,0) != cplx( 0, 0) || sm(3,1) != cplx(21,-3) ) {
9541 std::ostringstream oss;
9542 oss << " Test: " << test_ << "\n"
9543 << " Error: Assignment to submatrix failed\n"
9544 << " Details:\n"
9545 << " Result:\n" << sm << "\n"
9546 << " Expected result:\n( ( 0, 0) ( 0, 0) )\n"
9547 "( (18, 0) (14,14) )\n"
9548 "( (14,-14) (20, 0) )\n"
9549 "( ( 0, 0) (21,-3) )\n";
9550 throw std::runtime_error( oss.str() );
9551 }
9552
9553 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5, 0) || herm(0,5) != cplx( 0, 0) ||
9554 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1, 2) || herm(1,5) != cplx( 8,-2) ||
9555 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(14,14) || herm(2,4) != cplx( 0, 0) || herm(2,5) != cplx(-2, 0) ||
9556 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx(14,-14) || herm(3,3) != cplx(20, 0) || herm(3,4) != cplx(21, 3) || herm(3,5) != cplx( 0, 0) ||
9557 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(21,-3) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
9558 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
9559 std::ostringstream oss;
9560 oss << " Test: " << test_ << "\n"
9561 << " Error: Assignment to submatrix failed\n"
9562 << " Details:\n"
9563 << " Result:\n" << herm << "\n"
9564 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
9565 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )\n"
9566 "( ( 7,-3) ( 0, 0) (18, 0) (14,14) ( 0, 0) (-2, 0) )\n"
9567 "( (-2,-1) ( 0, 0) (14,-14) (20, 0) (21, 3) ( 0, 0) )\n"
9568 "( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) ( 1, 0) (-4, 0) )\n"
9569 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
9570 throw std::runtime_error( oss.str() );
9571 }
9572 }
9573 }
9574
9575 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) )
9576 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
9577 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (16, 0) )
9578 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) (21,3) ( 0, 0) )
9579 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) (14,0) (20, 0) )
9580 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (16, 0) ( 0, 0) (20,0) (28, 0) )
9581 {
9582 test_ = "Sparse matrix Schur product assignment test 3";
9583
9584 {
9585 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
9586 mat(0,0) = cplx(99,99);
9587 mat(0,1) = cplx( 3, 0);
9588 mat(0,2) = cplx(14, 0);
9589 mat(0,3) = cplx(-5, 0);
9590 mat(1,0) = cplx(-8, 0);
9591 mat(1,1) = cplx(99,99);
9592 mat(1,2) = cplx(-5, 0);
9593 mat(1,3) = cplx( 4, 0);
9594
9595 HT herm;
9596 init( herm );
9597
9598 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
9599 sm %= mat;
9600
9601 checkRows ( herm, 6UL );
9602 checkColumns ( herm, 6UL );
9603 checkNonZeros( herm, 26UL );
9604
9605 if( sm(0,0) != cplx( 0,0) || sm(0,1) != cplx(21,-3) || sm(0,2) != cplx(14,0) || sm(0,3) != cplx(20,0) ||
9606 sm(1,0) != cplx(16,0) || sm(1,1) != cplx( 0, 0) || sm(1,2) != cplx(20,0) || sm(1,3) != cplx(28,0) ) {
9607 std::ostringstream oss;
9608 oss << " Test: " << test_ << "\n"
9609 << " Error: Assignment to submatrix failed\n"
9610 << " Details:\n"
9611 << " Result:\n" << sm << "\n"
9612 << " Expected result:\n( ( 0,0) (21,-3) (14,0) (20,0) )\n"
9613 "( (16,0) ( 0, 0) (20,0) (28,0) )\n";
9614 throw std::runtime_error( oss.str() );
9615 }
9616
9617 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
9618 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
9619 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(16, 0) ||
9620 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx(21,3) || herm(3,5) != cplx( 0, 0) ||
9621 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(21,-3) || herm(4,4) != cplx(14,0) || herm(4,5) != cplx(20, 0) ||
9622 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(16, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(20,0) || herm(5,5) != cplx(28, 0) ) {
9623 std::ostringstream oss;
9624 oss << " Test: " << test_ << "\n"
9625 << " Error: Assignment to submatrix failed\n"
9626 << " Details:\n"
9627 << " Result:\n" << herm << "\n"
9628 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
9629 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )\n"
9630 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0, 0) (16, 0) )\n"
9631 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) (21, 3) ( 0, 0) )\n"
9632 "( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) (14, 0) (20, 0) )\n"
9633 "( ( 0, 0) ( 8, 2) (16, 0) ( 0, 0) (20, 0) (28, 0) )\n";
9634 throw std::runtime_error( oss.str() );
9635 }
9636 }
9637
9638 {
9639 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
9640 mat(0,0) = cplx(99,99);
9641 mat(0,1) = cplx(-8, 0);
9642 mat(1,0) = cplx( 3, 0);
9643 mat(1,1) = cplx(99,99);
9644 mat(2,0) = cplx(14, 0);
9645 mat(2,1) = cplx(-5, 0);
9646 mat(3,0) = cplx(-5, 0);
9647 mat(3,1) = cplx( 4, 0);
9648
9649 HT herm;
9650 init( herm );
9651
9652 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
9653 sm %= mat;
9654
9655 checkRows ( herm, 6UL );
9656 checkColumns ( herm, 6UL );
9657 checkNonZeros( herm, 26UL );
9658
9659 if( sm(0,0) != cplx( 0,0) || sm(0,1) != cplx(16,0) ||
9660 sm(1,0) != cplx(21,3) || sm(1,1) != cplx( 0,0) ||
9661 sm(2,0) != cplx(14,0) || sm(2,1) != cplx(20,0) ||
9662 sm(3,0) != cplx(20,0) || sm(3,1) != cplx(28,0) ) {
9663 std::ostringstream oss;
9664 oss << " Test: " << test_ << "\n"
9665 << " Error: Assignment to submatrix failed\n"
9666 << " Details:\n"
9667 << " Result:\n" << sm << "\n"
9668 << " Expected result:\n( ( 0,0) (16,0) )\n"
9669 "( (21,3) ( 0,0) )\n"
9670 "( (14,0) (20,0) )\n"
9671 "( (20,0) (28,0) )\n";
9672 throw std::runtime_error( oss.str() );
9673 }
9674
9675 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx( 7, 3) || herm(0,3) != cplx(-2, 1) || herm(0,4) != cplx( 5,0) || herm(0,5) != cplx( 0, 0) ||
9676 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx(-1,2) || herm(1,5) != cplx( 8,-2) ||
9677 herm(2,0) != cplx( 7,-3) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx( 3, 0) || herm(2,3) != cplx( 1, 1) || herm(2,4) != cplx( 0,0) || herm(2,5) != cplx(16, 0) ||
9678 herm(3,0) != cplx(-2,-1) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx( 1,-1) || herm(3,3) != cplx( 5, 0) || herm(3,4) != cplx(21,3) || herm(3,5) != cplx( 0, 0) ||
9679 herm(4,0) != cplx( 5, 0) || herm(4,1) != cplx(-1,-2) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(21,-3) || herm(4,4) != cplx(14,0) || herm(4,5) != cplx(20, 0) ||
9680 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(16, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(20,0) || herm(5,5) != cplx(28, 0) ) {
9681 std::ostringstream oss;
9682 oss << " Test: " << test_ << "\n"
9683 << " Error: Assignment to submatrix failed\n"
9684 << " Details:\n"
9685 << " Result:\n" << herm << "\n"
9686 << " Expected result:\n( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )\n"
9687 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )\n"
9688 "( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0, 0) (16, 0) )\n"
9689 "( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) (21, 3) ( 0, 0) )\n"
9690 "( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) (14, 0) (20, 0) )\n"
9691 "( ( 0, 0) ( 8, 2) (16, 0) ( 0, 0) (20, 0) (28, 0) )\n";
9692 throw std::runtime_error( oss.str() );
9693 }
9694 }
9695 }
9696
9697 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (14, 6) (18,-9) (25, 0) ( 0, 0) )
9698 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) ( 7,14) ( 8,-2) )
9699 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,-6) ( 0, 0) (18, 0) (11,11) ( 0, 0) (-2, 0) )
9700 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (18, 9) ( 0, 0) (11,-11) (20, 0) (14, 2) ( 0, 0) )
9701 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (25, 0) ( 7,14) ( 0, 0) (14,-2) ( 1, 0) (-4, 0) )
9702 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
9703 {
9704 test_ = "Sparse matrix Schur product assignment test 4";
9705
9706 {
9707 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
9708 mat(0,0) = cplx( 2, 0);
9709 mat(0,1) = cplx(99,99);
9710 mat(0,2) = cplx( 6, 0);
9711 mat(0,3) = cplx(11, 0);
9712 mat(1,0) = cplx(-9, 0);
9713 mat(1,1) = cplx(99,99);
9714 mat(1,2) = cplx(11, 0);
9715 mat(1,3) = cplx( 4, 0);
9716 mat(2,0) = cplx( 5, 0);
9717 mat(2,1) = cplx(-7, 0);
9718 mat(2,2) = cplx(99,99);
9719 mat(2,3) = cplx( 2, 0);
9720
9721 HT herm;
9722 init( herm );
9723
9724 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
9725 sm %= mat;
9726
9727 checkRows ( herm, 6UL );
9728 checkColumns ( herm, 6UL );
9729 checkNonZeros( herm, 26UL );
9730
9731 if( sm(0,0) != cplx(14,-6) || sm(0,1) != cplx(0, 0) || sm(0,2) != cplx(18, 0) || sm(0,3) != cplx(11,11) ||
9732 sm(1,0) != cplx(18, 9) || sm(1,1) != cplx(0, 0) || sm(1,2) != cplx(11,-11) || sm(1,3) != cplx(20, 0) ||
9733 sm(2,0) != cplx(25, 0) || sm(2,1) != cplx(7,14) || sm(2,2) != cplx( 0, 0) || sm(2,3) != cplx(14,-2) ) {
9734 std::ostringstream oss;
9735 oss << " Test: " << test_ << "\n"
9736 << " Error: Assignment to submatrix failed\n"
9737 << " Details:\n"
9738 << " Result:\n" << sm << "\n"
9739 << " Expected result:\n( (14,-6) (0, 0) (18, 0) (11,11) )\n"
9740 "( (18, 9) (0, 0) (11,-11) (20, 0) )\n"
9741 "( (25, 0) (7,14) ( 0, 0) (14,-2) )\n";
9742 throw std::runtime_error( oss.str() );
9743 }
9744
9745 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(14, 6) || herm(0,3) != cplx(18,-9) || herm(0,4) != cplx(25, 0) || herm(0,5) != cplx( 0, 0) ||
9746 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx( 7,-14) || herm(1,5) != cplx( 8,-2) ||
9747 herm(2,0) != cplx(14,-6) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(11,11) || herm(2,4) != cplx( 0, 0) || herm(2,5) != cplx(-2, 0) ||
9748 herm(3,0) != cplx(18, 9) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx(11,-11) || herm(3,3) != cplx(20, 0) || herm(3,4) != cplx(14, 2) || herm(3,5) != cplx( 0, 0) ||
9749 herm(4,0) != cplx(25, 0) || herm(4,1) != cplx( 7,14) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(14,-2) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
9750 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
9751 std::ostringstream oss;
9752 oss << " Test: " << test_ << "\n"
9753 << " Error: Assignment to submatrix failed\n"
9754 << " Details:\n"
9755 << " Result:\n" << herm << "\n"
9756 << " Expected result:\n( ( 1, 0) (-4,-1) (14, 6) (18,-9) (25, 0) ( 0, 0) )\n"
9757 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) ( 7,-14) ( 8,-2) )\n"
9758 "( (14,-6) ( 0, 0) (18, 0) (11,11) ( 0, 0) (-2, 0) )\n"
9759 "( (18, 9) ( 0, 0) (11,-11) (20, 0) (14, 2) ( 0, 0) )\n"
9760 "( (25, 0) ( 7,14) ( 0, 0) (14,-2) ( 1, 0) (-4, 0) )\n"
9761 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
9762 throw std::runtime_error( oss.str() );
9763 }
9764 }
9765
9766 {
9767 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
9768 mat(0,0) = cplx( 2, 0);
9769 mat(0,1) = cplx(-9, 0);
9770 mat(0,2) = cplx( 5, 0);
9771 mat(1,0) = cplx(99,99);
9772 mat(1,1) = cplx(99,99);
9773 mat(1,2) = cplx(-7, 0);
9774 mat(2,0) = cplx( 6, 0);
9775 mat(2,1) = cplx(11, 0);
9776 mat(2,2) = cplx(99,99);
9777 mat(3,0) = cplx(11, 0);
9778 mat(3,1) = cplx( 4, 0);
9779 mat(3,2) = cplx( 2, 0);
9780
9781 HT herm;
9782 init( herm );
9783
9784 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
9785 sm %= mat;
9786
9787 checkRows ( herm, 6UL );
9788 checkColumns ( herm, 6UL );
9789 checkNonZeros( herm, 26UL );
9790
9791 if( sm(0,0) != cplx(14, 6) || sm(0,1) != cplx(18,-9) || sm(0,2) != cplx(25, 0) ||
9792 sm(1,0) != cplx( 0, 0) || sm(1,1) != cplx( 0, 0) || sm(1,2) != cplx( 7,-14) ||
9793 sm(2,0) != cplx(18, 0) || sm(2,1) != cplx(11,11) || sm(2,2) != cplx( 0, 0) ||
9794 sm(3,0) != cplx(11,-11) || sm(3,1) != cplx(20, 0) || sm(3,2) != cplx(14, 2) ) {
9795 std::ostringstream oss;
9796 oss << " Test: " << test_ << "\n"
9797 << " Error: Assignment to submatrix failed\n"
9798 << " Details:\n"
9799 << " Result:\n" << sm << "\n"
9800 << " Expected result:\n( (14, 6) (18,-9) (25, 0) )\n"
9801 "( ( 0, 0) ( 0, 0) ( 7,-14) )\n"
9802 "( (18, 0) (11,11) ( 0, 0) )\n"
9803 "( (11,-11) (20, 0) (14, 2) )\n";
9804 throw std::runtime_error( oss.str() );
9805 }
9806
9807 if( herm(0,0) != cplx( 1, 0) || herm(0,1) != cplx(-4,-1) || herm(0,2) != cplx(14, 6) || herm(0,3) != cplx(18,-9) || herm(0,4) != cplx(25, 0) || herm(0,5) != cplx( 0, 0) ||
9808 herm(1,0) != cplx(-4, 1) || herm(1,1) != cplx( 2, 0) || herm(1,2) != cplx( 0, 0) || herm(1,3) != cplx( 0, 0) || herm(1,4) != cplx( 7,-14) || herm(1,5) != cplx( 8,-2) ||
9809 herm(2,0) != cplx(14,-6) || herm(2,1) != cplx( 0, 0) || herm(2,2) != cplx(18, 0) || herm(2,3) != cplx(11,11) || herm(2,4) != cplx( 0, 0) || herm(2,5) != cplx(-2, 0) ||
9810 herm(3,0) != cplx(18, 9) || herm(3,1) != cplx( 0, 0) || herm(3,2) != cplx(11,-11) || herm(3,3) != cplx(20, 0) || herm(3,4) != cplx(14, 2) || herm(3,5) != cplx( 0, 0) ||
9811 herm(4,0) != cplx(25, 0) || herm(4,1) != cplx( 7,14) || herm(4,2) != cplx( 0, 0) || herm(4,3) != cplx(14,-2) || herm(4,4) != cplx( 1, 0) || herm(4,5) != cplx(-4, 0) ||
9812 herm(5,0) != cplx( 0, 0) || herm(5,1) != cplx( 8, 2) || herm(5,2) != cplx(-2, 0) || herm(5,3) != cplx( 0, 0) || herm(5,4) != cplx(-4, 0) || herm(5,5) != cplx( 7, 0) ) {
9813 std::ostringstream oss;
9814 oss << " Test: " << test_ << "\n"
9815 << " Error: Assignment to submatrix failed\n"
9816 << " Details:\n"
9817 << " Result:\n" << herm << "\n"
9818 << " Expected result:\n( ( 1, 0) (-4,-1) (14, 6) (18,-9) (25, 0) ( 0, 0) )\n"
9819 "( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) ( 7,-14) ( 8,-2) )\n"
9820 "( (14,-6) ( 0, 0) (18, 0) (11,11) ( 0, 0) (-2, 0) )\n"
9821 "( (18, 9) ( 0, 0) (11,-11) (20, 0) (14, 2) ( 0, 0) )\n"
9822 "( (25, 0) ( 7,14) ( 0, 0) (14,-2) ( 1, 0) (-4, 0) )\n"
9823 "( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )\n";
9824 throw std::runtime_error( oss.str() );
9825 }
9826 }
9827 }
9828
9829 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (11, 0) (20, 5) (28,12) (16,-8) ( 5,0) ( 0, 0) )
9830 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (24, -6) (12, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
9831 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (28,-12) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
9832 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (16, 8) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
9833 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
9834 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
9835 {
9836 test_ = "Sparse matrix Schur product assignment test 5";
9837
9838 {
9839 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
9840 mat(0,0) = cplx(11, 0);
9841 mat(0,1) = cplx(-5, 0);
9842 mat(0,2) = cplx( 4, 0);
9843 mat(0,3) = cplx(-8, 0);
9844 mat(1,0) = cplx(-6, 0);
9845 mat(1,1) = cplx( 6, 0);
9846 mat(1,2) = cplx(99,99);
9847 mat(1,3) = cplx(99,99);
9848
9849 HT herm;
9850 init( herm );
9851
9852 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
9853
9854 try {
9855 sm %= mat;
9856
9857 std::ostringstream oss;
9858 oss << " Test: " << test_ << "\n"
9859 << " Error: Assignment of invalid matrix succeeded\n"
9860 << " Details:\n"
9861 << " Result:\n" << herm << "\n";
9862 throw std::runtime_error( oss.str() );
9863 }
9864 catch( std::invalid_argument& ) {}
9865 }
9866
9867 {
9868 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
9869 mat(0,0) = cplx(11, 0);
9870 mat(0,1) = cplx(-6, 0);
9871 mat(1,0) = cplx(-5, 0);
9872 mat(1,1) = cplx( 6, 0);
9873 mat(2,0) = cplx( 4, 0);
9874 mat(2,1) = cplx(99,99);
9875 mat(3,0) = cplx(-8, 0);
9876 mat(3,1) = cplx(99,99);
9877
9878 HT herm;
9879 init( herm );
9880
9881 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
9882
9883 try {
9884 sm %= mat;
9885
9886 std::ostringstream oss;
9887 oss << " Test: " << test_ << "\n"
9888 << " Error: Assignment of invalid matrix succeeded\n"
9889 << " Details:\n"
9890 << " Result:\n" << herm << "\n";
9891 throw std::runtime_error( oss.str() );
9892 }
9893 catch( std::invalid_argument& ) {}
9894 }
9895 }
9896
9897 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
9898 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )
9899 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) (18, 0) (14,14) ( 0, 0) (-2, 0) )
9900 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) (22,-22) (20, 0) (21, 3) ( 0, 0) )
9901 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) ( 1, 0) (-4, 0) )
9902 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
9903 {
9904 test_ = "Sparse matrix Schur product assignment test 6";
9905
9906 {
9907 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
9908 mat(0,0) = cplx(99,99);
9909 mat(0,1) = cplx( 6, 0);
9910 mat(0,2) = cplx(14, 0);
9911 mat(0,3) = cplx(99,99);
9912 mat(1,0) = cplx(99,99);
9913 mat(1,1) = cplx(22, 0);
9914 mat(1,2) = cplx( 4, 0);
9915 mat(1,3) = cplx( 3, 0);
9916
9917 HT herm;
9918 init( herm );
9919
9920 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
9921
9922 try {
9923 sm %= mat;
9924
9925 std::ostringstream oss;
9926 oss << " Test: " << test_ << "\n"
9927 << " Error: Assignment of invalid matrix succeeded\n"
9928 << " Details:\n"
9929 << " Result:\n" << herm << "\n";
9930 throw std::runtime_error( oss.str() );
9931 }
9932 catch( std::invalid_argument& ) {}
9933 }
9934
9935 {
9936 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
9937 mat(0,0) = cplx(99,99);
9938 mat(0,1) = cplx(99,99);
9939 mat(1,0) = cplx( 6, 0);
9940 mat(1,1) = cplx(22, 0);
9941 mat(2,0) = cplx(14, 0);
9942 mat(2,1) = cplx( 4, 0);
9943 mat(3,0) = cplx(99,99);
9944 mat(3,1) = cplx( 3, 0);
9945
9946 HT herm;
9947 init( herm );
9948
9949 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
9950
9951 try {
9952 sm %= mat;
9953
9954 std::ostringstream oss;
9955 oss << " Test: " << test_ << "\n"
9956 << " Error: Assignment of invalid matrix succeeded\n"
9957 << " Details:\n"
9958 << " Result:\n" << herm << "\n";
9959 throw std::runtime_error( oss.str() );
9960 }
9961 catch( std::invalid_argument& ) {}
9962 }
9963 }
9964
9965 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) )
9966 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
9967 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (16, 0) )
9968 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) (21,3) ( 0, 0) )
9969 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) (14,0) (20, 0) )
9970 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (16, 0) ( 0, 0) (24,0) (28, 0) )
9971 {
9972 test_ = "Sparse matrix Schur product assignment test 7";
9973
9974 {
9975 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
9976 mat(0,0) = cplx(99,99);
9977 mat(0,1) = cplx( 3, 0);
9978 mat(0,2) = cplx(14, 0);
9979 mat(0,3) = cplx(-5, 0);
9980 mat(1,0) = cplx(-8, 0);
9981 mat(1,1) = cplx(99,99);
9982 mat(1,2) = cplx(-6, 0);
9983 mat(1,3) = cplx( 4, 0);
9984
9985 HT herm;
9986 init( herm );
9987
9988 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
9989
9990 try {
9991 sm %= mat;
9992
9993 std::ostringstream oss;
9994 oss << " Test: " << test_ << "\n"
9995 << " Error: Assignment of invalid matrix succeeded\n"
9996 << " Details:\n"
9997 << " Result:\n" << herm << "\n";
9998 throw std::runtime_error( oss.str() );
9999 }
10000 catch( std::invalid_argument& ) {}
10001 }
10002
10003 {
10004 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
10005 mat(0,0) = cplx(99,99);
10006 mat(0,1) = cplx(-8, 0);
10007 mat(1,0) = cplx( 3, 0);
10008 mat(1,1) = cplx(99,99);
10009 mat(2,0) = cplx(14, 0);
10010 mat(2,1) = cplx(-6, 0);
10011 mat(3,0) = cplx(-5, 0);
10012 mat(3,1) = cplx( 4, 0);
10013
10014 HT herm;
10015 init( herm );
10016
10017 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
10018
10019 try {
10020 sm %= mat;
10021
10022 std::ostringstream oss;
10023 oss << " Test: " << test_ << "\n"
10024 << " Error: Assignment of invalid matrix succeeded\n"
10025 << " Details:\n"
10026 << " Result:\n" << herm << "\n";
10027 throw std::runtime_error( oss.str() );
10028 }
10029 catch( std::invalid_argument& ) {}
10030 }
10031 }
10032
10033 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (14, 6) (18,-9) (25, 0) ( 0, 0) )
10034 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) ( 7,14) ( 8,-2) )
10035 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,-6) ( 0, 0) (18, 0) (11,11) ( 0, 0) (-2, 0) )
10036 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (18, 9) ( 0, 0) (22,-22) (20, 0) (14, 2) ( 0, 0) )
10037 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (25, 0) ( 7,14) ( 0, 0) (14,-2) ( 1, 0) (-4, 0) )
10038 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
10039 {
10040 test_ = "Sparse matrix Schur product assignment test 8";
10041
10042 {
10043 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
10044 mat(0,0) = cplx( 2, 0);
10045 mat(0,1) = cplx(99,99);
10046 mat(0,2) = cplx( 6, 0);
10047 mat(0,3) = cplx(11, 0);
10048 mat(1,0) = cplx(-9, 0);
10049 mat(1,1) = cplx(99,99);
10050 mat(1,2) = cplx(22, 0);
10051 mat(1,3) = cplx( 4, 0);
10052 mat(2,0) = cplx( 5, 0);
10053 mat(2,1) = cplx(-7, 0);
10054 mat(2,2) = cplx(99,99);
10055 mat(2,3) = cplx( 2, 0);
10056
10057 HT herm;
10058 init( herm );
10059
10060 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
10061
10062 try {
10063 sm %= mat;
10064
10065 std::ostringstream oss;
10066 oss << " Test: " << test_ << "\n"
10067 << " Error: Assignment of invalid matrix succeeded\n"
10068 << " Details:\n"
10069 << " Result:\n" << herm << "\n";
10070 throw std::runtime_error( oss.str() );
10071 }
10072 catch( std::invalid_argument& ) {}
10073 }
10074
10075 {
10076 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
10077 mat(0,0) = cplx( 2, 0);
10078 mat(0,1) = cplx(-9, 0);
10079 mat(0,2) = cplx( 5, 0);
10080 mat(1,0) = cplx(99,99);
10081 mat(1,1) = cplx(99,99);
10082 mat(1,2) = cplx(-7, 0);
10083 mat(2,0) = cplx( 6, 0);
10084 mat(2,1) = cplx(22, 0);
10085 mat(2,2) = cplx(99,99);
10086 mat(3,0) = cplx(11, 0);
10087 mat(3,1) = cplx( 4, 0);
10088 mat(3,2) = cplx( 2, 0);
10089
10090 HT herm;
10091 init( herm );
10092
10093 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
10094
10095 try {
10096 sm %= mat;
10097
10098 std::ostringstream oss;
10099 oss << " Test: " << test_ << "\n"
10100 << " Error: Assignment of invalid matrix succeeded\n"
10101 << " Details:\n"
10102 << " Result:\n" << herm << "\n";
10103 throw std::runtime_error( oss.str() );
10104 }
10105 catch( std::invalid_argument& ) {}
10106 }
10107 }
10108
10109 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( (11, 0) (20, 5) (28,12) (16,-8) ( 5,0) ( 0, 0) )
10110 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (20, -5) (12, 4) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
10111 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (28,-12) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) )
10112 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (16, 8) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) )
10113 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) )
10114 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) )
10115 {
10116 test_ = "Sparse matrix Schur product assignment test 9";
10117
10118 {
10119 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
10120 mat(0,0) = cplx(11, 0);
10121 mat(0,1) = cplx(-5, 0);
10122 mat(0,2) = cplx( 4, 0);
10123 mat(0,3) = cplx(-8, 0);
10124 mat(1,0) = cplx(-5, 0);
10125 mat(1,1) = cplx( 6, 2);
10126 mat(1,2) = cplx(99,99);
10127 mat(1,3) = cplx(99,99);
10128
10129 HT herm;
10130 init( herm );
10131
10132 auto sm = submatrix( herm, 0UL, 0UL, 2UL, 4UL );
10133
10134 try {
10135 sm %= mat;
10136
10137 std::ostringstream oss;
10138 oss << " Test: " << test_ << "\n"
10139 << " Error: Assignment of invalid matrix succeeded\n"
10140 << " Details:\n"
10141 << " Result:\n" << herm << "\n";
10142 throw std::runtime_error( oss.str() );
10143 }
10144 catch( std::invalid_argument& ) {}
10145 }
10146
10147 {
10148 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
10149 mat(0,0) = cplx(11, 0);
10150 mat(0,1) = cplx(-5, 0);
10151 mat(1,0) = cplx(-5, 0);
10152 mat(1,1) = cplx( 6, 2);
10153 mat(2,0) = cplx( 4, 0);
10154 mat(2,1) = cplx(99,99);
10155 mat(3,0) = cplx(-8, 0);
10156 mat(3,1) = cplx(99,99);
10157
10158 HT herm;
10159 init( herm );
10160
10161 auto sm = submatrix( herm, 0UL, 0UL, 4UL, 2UL );
10162
10163 try {
10164 sm %= mat;
10165
10166 std::ostringstream oss;
10167 oss << " Test: " << test_ << "\n"
10168 << " Error: Assignment of invalid matrix succeeded\n"
10169 << " Details:\n"
10170 << " Result:\n" << herm << "\n";
10171 throw std::runtime_error( oss.str() );
10172 }
10173 catch( std::invalid_argument& ) {}
10174 }
10175 }
10176
10177 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5, 0) ( 0, 0) )
10178 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1, 2) ( 8,-2) )
10179 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) (18, 0) (14,14) ( 0, 0) (-2, 0) )
10180 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) (14,-14) (20, 5) (21, 3) ( 0, 0) )
10181 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) ( 1, 0) (-4, 0) )
10182 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
10183 {
10184 test_ = "Sparse matrix Schur product assignment test 10";
10185
10186 {
10187 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
10188 mat(0,0) = cplx(99,99);
10189 mat(0,1) = cplx( 6, 0);
10190 mat(0,2) = cplx(14, 0);
10191 mat(0,3) = cplx(99,99);
10192 mat(1,0) = cplx(99,99);
10193 mat(1,1) = cplx(14, 0);
10194 mat(1,2) = cplx( 4, 1);
10195 mat(1,3) = cplx( 3, 0);
10196
10197 HT herm;
10198 init( herm );
10199
10200 auto sm = submatrix( herm, 2UL, 1UL, 2UL, 4UL );
10201
10202 try {
10203 sm %= mat;
10204
10205 std::ostringstream oss;
10206 oss << " Test: " << test_ << "\n"
10207 << " Error: Assignment of invalid matrix succeeded\n"
10208 << " Details:\n"
10209 << " Result:\n" << herm << "\n";
10210 throw std::runtime_error( oss.str() );
10211 }
10212 catch( std::invalid_argument& ) {}
10213 }
10214
10215 {
10216 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
10217 mat(0,0) = cplx(99,99);
10218 mat(0,1) = cplx(99,99);
10219 mat(1,0) = cplx( 6, 0);
10220 mat(1,1) = cplx(14, 0);
10221 mat(2,0) = cplx(14, 0);
10222 mat(2,1) = cplx( 4, 1);
10223 mat(3,0) = cplx(99,99);
10224 mat(3,1) = cplx( 3, 0);
10225
10226 HT herm;
10227 init( herm );
10228
10229 auto sm = submatrix( herm, 1UL, 2UL, 4UL, 2UL );
10230
10231 try {
10232 sm %= mat;
10233
10234 std::ostringstream oss;
10235 oss << " Test: " << test_ << "\n"
10236 << " Error: Assignment of invalid matrix succeeded\n"
10237 << " Details:\n"
10238 << " Result:\n" << herm << "\n";
10239 throw std::runtime_error( oss.str() );
10240 }
10241 catch( std::invalid_argument& ) {}
10242 }
10243 }
10244
10245 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) )
10246 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) )
10247 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (16, 0) )
10248 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) (21,3) ( 0, 0) )
10249 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( ( 5, 0) (-1,-2) ( 0, 0) (21,-3) (14,0) (20, 0) )
10250 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (16, 0) ( 0, 0) (20,0) (28, 7) )
10251 {
10252 test_ = "Sparse matrix Schur product assignment test 11";
10253
10254 {
10255 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 2UL, 4UL, 8UL );
10256 mat(0,0) = cplx(99,99);
10257 mat(0,1) = cplx( 3, 0);
10258 mat(0,2) = cplx(14, 0);
10259 mat(0,3) = cplx(-5, 0);
10260 mat(1,0) = cplx(-8, 0);
10261 mat(1,1) = cplx(99,99);
10262 mat(1,2) = cplx(-5, 0);
10263 mat(1,3) = cplx( 4, 1);
10264
10265 HT herm;
10266 init( herm );
10267
10268 auto sm = submatrix( herm, 4UL, 2UL, 2UL, 4UL );
10269
10270 try {
10271 sm %= mat;
10272
10273 std::ostringstream oss;
10274 oss << " Test: " << test_ << "\n"
10275 << " Error: Assignment of invalid matrix succeeded\n"
10276 << " Details:\n"
10277 << " Result:\n" << herm << "\n";
10278 throw std::runtime_error( oss.str() );
10279 }
10280 catch( std::invalid_argument& ) {}
10281 }
10282
10283 {
10284 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 2UL, 8UL );
10285 mat(0,0) = cplx(99,99);
10286 mat(0,1) = cplx(-8, 0);
10287 mat(1,0) = cplx( 3, 0);
10288 mat(1,1) = cplx(99,99);
10289 mat(2,0) = cplx(14, 0);
10290 mat(2,1) = cplx(-5, 0);
10291 mat(3,0) = cplx(-5, 0);
10292 mat(3,1) = cplx( 4, 1);
10293
10294 HT herm;
10295 init( herm );
10296
10297 auto sm = submatrix( herm, 2UL, 4UL, 4UL, 2UL );
10298
10299 try {
10300 sm %= mat;
10301
10302 std::ostringstream oss;
10303 oss << " Test: " << test_ << "\n"
10304 << " Error: Assignment of invalid matrix succeeded\n"
10305 << " Details:\n"
10306 << " Result:\n" << herm << "\n";
10307 throw std::runtime_error( oss.str() );
10308 }
10309 catch( std::invalid_argument& ) {}
10310 }
10311 }
10312
10313 // ( ( 1, 0) (-4,-1) ( 7, 3) (-2, 1) ( 5,0) ( 0, 0) ) ( ( 1, 0) (-4,-1) (14, 6) (18,-9) (25, 0) ( 0, 0) )
10314 // ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) (-1,2) ( 8,-2) ) ( (-4, 1) ( 2, 0) ( 0, 0) ( 0, 0) ( 7,14) ( 8,-2) )
10315 // ( ( 7,-3) ( 0, 0) ( 3, 0) ( 1, 1) ( 0,0) (-2, 0) ) => ( (14,-6) ( 0, 0) (18, 0) (11,11) ( 0, 0) (-2, 0) )
10316 // ( (-2,-1) ( 0, 0) ( 1,-1) ( 5, 0) ( 7,1) ( 0, 0) ) ( (18, 9) ( 0, 0) (11,-11) (20, 5) (14, 2) ( 0, 0) )
10317 // ( ( 5, 0) (-1,-2) ( 0, 0) ( 7,-1) ( 1,0) (-4, 0) ) ( (25, 0) ( 7,14) ( 0, 0) (14,-2) ( 1, 0) (-4, 0) )
10318 // ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4,0) ( 7, 0) ) ( ( 0, 0) ( 8, 2) (-2, 0) ( 0, 0) (-4, 0) ( 7, 0) )
10319 {
10320 test_ = "Sparse matrix Schur product assignment test 12";
10321
10322 {
10323 blaze::CompressedMatrix<cplx,blaze::rowMajor> mat( 3UL, 4UL, 12UL );
10324 mat(0,0) = cplx( 2, 0);
10325 mat(0,1) = cplx(99,99);
10326 mat(0,2) = cplx( 6, 0);
10327 mat(0,3) = cplx(11, 0);
10328 mat(1,0) = cplx(-9, 0);
10329 mat(1,1) = cplx(99,99);
10330 mat(1,2) = cplx(11, 0);
10331 mat(1,3) = cplx( 4, 1);
10332 mat(2,0) = cplx( 5, 0);
10333 mat(2,1) = cplx(-7, 0);
10334 mat(2,2) = cplx(99,99);
10335 mat(2,3) = cplx( 2, 0);
10336
10337 HT herm;
10338 init( herm );
10339
10340 auto sm = submatrix( herm, 2UL, 0UL, 3UL, 4UL );
10341
10342 try {
10343 sm %= mat;
10344
10345 std::ostringstream oss;
10346 oss << " Test: " << test_ << "\n"
10347 << " Error: Assignment of invalid matrix succeeded\n"
10348 << " Details:\n"
10349 << " Result:\n" << herm << "\n";
10350 throw std::runtime_error( oss.str() );
10351 }
10352 catch( std::invalid_argument& ) {}
10353 }
10354
10355 {
10356 blaze::CompressedMatrix<cplx,blaze::columnMajor> mat( 4UL, 3UL, 12UL );
10357 mat(0,0) = cplx( 2, 0);
10358 mat(0,1) = cplx(-9, 0);
10359 mat(0,2) = cplx( 5, 0);
10360 mat(1,0) = cplx(99,99);
10361 mat(1,1) = cplx(99,99);
10362 mat(1,2) = cplx(-7, 0);
10363 mat(2,0) = cplx( 6, 0);
10364 mat(2,1) = cplx(11, 0);
10365 mat(2,2) = cplx(99,99);
10366 mat(3,0) = cplx(11, 0);
10367 mat(3,1) = cplx( 4, 1);
10368 mat(3,2) = cplx( 2, 0);
10369
10370 HT herm;
10371 init( herm );
10372
10373 auto sm = submatrix( herm, 0UL, 2UL, 4UL, 3UL );
10374
10375 try {
10376 sm %= mat;
10377
10378 std::ostringstream oss;
10379 oss << " Test: " << test_ << "\n"
10380 << " Error: Assignment of invalid matrix succeeded\n"
10381 << " Details:\n"
10382 << " Result:\n" << herm << "\n";
10383 throw std::runtime_error( oss.str() );
10384 }
10385 catch( std::invalid_argument& ) {}
10386 }
10387 }
10388 }
10389 //*************************************************************************************************
10390
10391
10392 //*************************************************************************************************
10393 /*!\brief Checking the number of rows of the given matrix.
10394 //
10395 // \param matrix The matrix to be checked.
10396 // \param expectedRows The expected number of rows of the matrix.
10397 // \return void
10398 // \exception std::runtime_error Error detected.
10399 //
10400 // This function checks the number of rows of the given matrix. In case the actual number of
10401 // rows does not correspond to the given expected number of rows, a \a std::runtime_error
10402 // exception is thrown.
10403 */
10404 template< typename Type > // Type of the matrix
checkRows(const Type & matrix,size_t expectedRows)10405 void SubmatrixComplexTest::checkRows( const Type& matrix, size_t expectedRows ) const
10406 {
10407 if( matrix.rows() != expectedRows ) {
10408 std::ostringstream oss;
10409 oss << " Test: " << test_ << "\n"
10410 << " Error: Invalid number of rows detected\n"
10411 << " Details:\n"
10412 << " Number of rows : " << matrix.rows() << "\n"
10413 << " Expected number of rows: " << expectedRows << "\n";
10414 throw std::runtime_error( oss.str() );
10415 }
10416 }
10417 //*************************************************************************************************
10418
10419
10420 //*************************************************************************************************
10421 /*!\brief Checking the number of columns of the given matrix.
10422 //
10423 // \param matrix The matrix to be checked.
10424 // \param expectedColumns The expected number of columns of the matrix.
10425 // \return void
10426 // \exception std::runtime_error Error detected.
10427 //
10428 // This function checks the number of columns of the given matrix. In case the actual number of
10429 // columns does not correspond to the given expected number of columns, a \a std::runtime_error
10430 // exception is thrown.
10431 */
10432 template< typename Type > // Type of the matrix
checkColumns(const Type & matrix,size_t expectedColumns)10433 void SubmatrixComplexTest::checkColumns( const Type& matrix, size_t expectedColumns ) const
10434 {
10435 if( matrix.columns() != expectedColumns ) {
10436 std::ostringstream oss;
10437 oss << " Test: " << test_ << "\n"
10438 << " Error: Invalid number of columns detected\n"
10439 << " Details:\n"
10440 << " Number of columns : " << matrix.columns() << "\n"
10441 << " Expected number of columns: " << expectedColumns << "\n";
10442 throw std::runtime_error( oss.str() );
10443 }
10444 }
10445 //*************************************************************************************************
10446
10447
10448 //*************************************************************************************************
10449 /*!\brief Checking the number of non-zero elements of the given matrix.
10450 //
10451 // \param matrix The matrix to be checked.
10452 // \param expectedNonZeros The expected number of non-zero elements of the matrix.
10453 // \return void
10454 // \exception std::runtime_error Error detected.
10455 //
10456 // This function checks the number of non-zero elements of the given matrix. In case the
10457 // actual number of non-zero elements does not correspond to the given expected number,
10458 // a \a std::runtime_error exception is thrown.
10459 */
10460 template< typename Type > // Type of the matrix
checkNonZeros(const Type & matrix,size_t expectedNonZeros)10461 void SubmatrixComplexTest::checkNonZeros( const Type& matrix, size_t expectedNonZeros ) const
10462 {
10463 if( nonZeros( matrix ) != expectedNonZeros ) {
10464 std::ostringstream oss;
10465 oss << " Test: " << test_ << "\n"
10466 << " Error: Invalid number of non-zero elements\n"
10467 << " Details:\n"
10468 << " Number of non-zeros : " << nonZeros( matrix ) << "\n"
10469 << " Expected number of non-zeros: " << expectedNonZeros << "\n";
10470 throw std::runtime_error( oss.str() );
10471 }
10472
10473 if( capacity( matrix ) < nonZeros( matrix ) ) {
10474 std::ostringstream oss;
10475 oss << " Test: " << test_ << "\n"
10476 << " Error: Invalid capacity detected\n"
10477 << " Details:\n"
10478 << " Number of non-zeros: " << nonZeros( matrix ) << "\n"
10479 << " Capacity : " << capacity( matrix ) << "\n";
10480 throw std::runtime_error( oss.str() );
10481 }
10482 }
10483 //*************************************************************************************************
10484
10485
10486
10487
10488 //=================================================================================================
10489 //
10490 // UTILITY FUNCTIONS
10491 //
10492 //=================================================================================================
10493
10494 //*************************************************************************************************
10495 /*!\brief Initializing the given Hermitian matrix.
10496 //
10497 // \return void
10498 //
10499 // This function is called before each test case to initialize the given Hermitian matrix.
10500 */
10501 template< typename HT >
init(HT & herm)10502 void SubmatrixComplexTest::init( HT& herm )
10503 {
10504 herm.resize( 6UL );
10505 herm(0,0) = cplx( 1, 0);
10506 herm(0,1) = cplx(-4,-1);
10507 herm(0,2) = cplx( 7, 3);
10508 herm(0,3) = cplx(-2, 1);
10509 herm(0,4) = cplx( 5, 0);
10510 herm(1,1) = cplx( 2, 0);
10511 herm(1,4) = cplx(-1, 2);
10512 herm(1,5) = cplx( 8,-2);
10513 herm(2,2) = cplx( 3, 0);
10514 herm(2,3) = cplx( 1, 1);
10515 herm(2,5) = cplx(-2, 0);
10516 herm(3,3) = cplx( 5, 0);
10517 herm(3,4) = cplx( 7, 1);
10518 herm(4,4) = cplx( 1, 0);
10519 herm(4,5) = cplx(-4, 0);
10520 herm(5,5) = cplx( 7, 0);
10521 }
10522 //*************************************************************************************************
10523
10524
10525
10526
10527 //=================================================================================================
10528 //
10529 // GLOBAL TEST FUNCTIONS
10530 //
10531 //=================================================================================================
10532
10533 //*************************************************************************************************
10534 /*!\brief Testing the assignment to a submatrix of a HermitianMatrix.
10535 //
10536 // \return void
10537 */
runTest()10538 void runTest()
10539 {
10540 SubmatrixComplexTest();
10541 }
10542 //*************************************************************************************************
10543
10544
10545
10546
10547 //=================================================================================================
10548 //
10549 // MACRO DEFINITIONS
10550 //
10551 //=================================================================================================
10552
10553 //*************************************************************************************************
10554 /*! \cond BLAZE_INTERNAL */
10555 /*!\brief Macro for the execution of the HermitianMatrix submatrix complex test.
10556 */
10557 #define RUN_HERMITIANMATRIX_SUBMATRIXCOMPLEX_TEST \
10558 blazetest::mathtest::adaptors::hermitianmatrix::runTest()
10559 /*! \endcond */
10560 //*************************************************************************************************
10561
10562 } // namespace hermitianmatrix
10563
10564 } // namespace adaptors
10565
10566 } // namespace mathtest
10567
10568 } // namespace blazetest
10569
10570 #endif
10571