1 // SPDX-License-Identifier: Apache-2.0 2 // 3 // Copyright 2015 Conrad Sanderson (http://conradsanderson.id.au) 4 // Copyright 2015 National ICT Australia (NICTA) 5 // 6 // Licensed under the Apache License, Version 2.0 (the "License"); 7 // you may not use this file except in compliance with the License. 8 // You may obtain a copy of the License at 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 // ------------------------------------------------------------------------ 17 18 19 #include <armadillo> 20 #include <complex> 21 #include "catch.hpp" 22 23 using namespace arma; 24 using namespace std; 25 26 27 28 TEST_CASE("fn_hess_non_square") 29 { 30 mat A(5, 6, fill::ones); 31 mat U, H; 32 REQUIRE_THROWS( hess(U, H, A) ); 33 } 34 35 36 /***************** tests for real matrix ****************/ 37 38 TEST_CASE("fn_hess_empty") 39 { 40 mat A(1, 1); 41 A.reset(); 42 mat U, H, H1, H2; 43 44 hess(U, H, A); 45 H1 = hess(A); 46 hess(H2, A); 47 48 REQUIRE( U.is_empty() == true ); 49 REQUIRE( H.is_empty() == true ); 50 REQUIRE( H1.is_empty() == true ); 51 REQUIRE( H2.is_empty() == true ); 52 } 53 54 55 56 TEST_CASE("fn_hess_1") 57 { 58 mat A(1, 1); 59 A(0, 0) = 0.061198; 60 mat U, H, H1, H2; 61 62 hess(U, H, A); 63 H1 = hess(A); 64 hess(H2, A); 65 66 REQUIRE( U(0, 0) == Approx(1.0) ); 67 REQUIRE( H(0, 0) == Approx(0.061198) ); 68 REQUIRE( H1(0, 0) == Approx(0.061198) ); 69 REQUIRE( H2(0, 0) == Approx(0.061198) ); 70 } 71 72 73 74 TEST_CASE("fn_hess_2") 75 { 76 mat A = 77 "\ 78 0.061198 0.201990;\ 79 0.437242 0.058956;\ 80 "; 81 mat U, H, H1, H2; 82 83 hess(U, H, A); 84 H1 = hess(A); 85 hess(H2, A); 86 87 REQUIRE( U(0, 0) == Approx(1.0) ); 88 REQUIRE( U(0, 1) == Approx(0.0).margin(0.001) ); 89 REQUIRE( U(1, 0) == Approx(0.0).margin(0.001) ); 90 REQUIRE( U(1, 1) == Approx(1.0) ); 91 92 REQUIRE( H(0, 0) == Approx(0.061198) ); 93 REQUIRE( H(0, 1) == Approx(0.201990) ); 94 REQUIRE( H(1, 0) == Approx(0.437242) ); 95 REQUIRE( H(1, 1) == Approx(0.058956) ); 96 97 REQUIRE( H1(0, 0) == Approx(0.061198) ); 98 REQUIRE( H1(0, 1) == Approx(0.201990) ); 99 REQUIRE( H1(1, 0) == Approx(0.437242) ); 100 REQUIRE( H1(1, 1) == Approx(0.058956) ); 101 102 REQUIRE( H2(0, 0) == Approx(0.061198) ); 103 REQUIRE( H2(0, 1) == Approx(0.201990) ); 104 REQUIRE( H2(1, 0) == Approx(0.437242) ); 105 REQUIRE( H2(1, 1) == Approx(0.058956) ); 106 } 107 108 109 110 TEST_CASE("fn_hess_3") 111 { 112 mat A = 113 "\ 114 0.061198 0.201990 0.019678;\ 115 0.437242 0.058956 -0.149362;\ 116 -0.492474 -0.031309 0.314156;\ 117 "; 118 mat U, H, H1, H2; 119 120 hess(U, H, A); 121 H1 = hess(A); 122 hess(H2, A); 123 124 REQUIRE( U(0, 0) == Approx(1.0) ); 125 REQUIRE( U(0, 1) == Approx(0.0).margin(0.001) ); 126 REQUIRE( U(0, 2) == Approx(0.0).margin(0.001) ); 127 128 REQUIRE( U(1, 0) == Approx( 0.0) ); 129 REQUIRE( U(1, 1) == Approx(-0.663928864062532) ); 130 REQUIRE( U(1, 2) == Approx( 0.747795736457915) ); 131 132 REQUIRE( U(2, 0) == Approx( 0.0) ); 133 REQUIRE( U(2, 1) == Approx( 0.747795736457915) ); 134 REQUIRE( U(2, 2) == Approx( 0.663928864062532) ); 135 136 137 REQUIRE( H(0, 0) == Approx( 0.061198000000000) ); 138 REQUIRE( H(0, 1) == Approx(-0.119391866749972) ); 139 REQUIRE( H(0, 2) == Approx( 0.164112052994157) ); 140 141 REQUIRE( H(1, 0) == Approx(-0.658567541896805) ); 142 REQUIRE( H(1, 1) == Approx( 0.291363559380149) ); 143 REQUIRE( H(1, 2) == Approx( 0.175033560375766) ); 144 145 REQUIRE( H(2, 0) == Approx( 0.0) ); 146 REQUIRE( H(2, 1) == Approx( 0.056980560375766) ); 147 REQUIRE( H(2, 2) == Approx( 0.081748440619851) ); 148 149 150 REQUIRE( H1(0, 0) == Approx( 0.061198000000000) ); 151 REQUIRE( H1(0, 1) == Approx(-0.119391866749972) ); 152 REQUIRE( H1(0, 2) == Approx( 0.164112052994157) ); 153 154 REQUIRE( H1(1, 0) == Approx(-0.658567541896805) ); 155 REQUIRE( H1(1, 1) == Approx( 0.291363559380149) ); 156 REQUIRE( H1(1, 2) == Approx( 0.175033560375766) ); 157 158 REQUIRE( H1(2, 0) == Approx( 0.0) ); 159 REQUIRE( H1(2, 1) == Approx( 0.056980560375766) ); 160 REQUIRE( H1(2, 2) == Approx( 0.081748440619851) ); 161 162 163 REQUIRE( H2(0, 0) == Approx( 0.061198000000000) ); 164 REQUIRE( H2(0, 1) == Approx(-0.119391866749972) ); 165 REQUIRE( H2(0, 2) == Approx( 0.164112052994157) ); 166 167 REQUIRE( H2(1, 0) == Approx(-0.658567541896805) ); 168 REQUIRE( H2(1, 1) == Approx( 0.291363559380149) ); 169 REQUIRE( H2(1, 2) == Approx( 0.175033560375766) ); 170 171 REQUIRE( H2(2, 0) == Approx( 0.0) ); 172 REQUIRE( H2(2, 1) == Approx( 0.056980560375766) ); 173 REQUIRE( H2(2, 2) == Approx( 0.081748440619851) ); 174 } 175 176 177 178 179 TEST_CASE("fn_hess_4") 180 { 181 mat A = 182 "\ 183 0.061198 0.201990 0.019678 -0.493936;\ 184 0.437242 0.058956 -0.149362 -0.045465;\ 185 -0.492474 -0.031309 0.314156 0.419733;\ 186 0.336352 0.411541 0.458476 -0.393139;\ 187 "; 188 mat U, H, H1, H2; 189 190 hess(U, H, A); 191 H1 = hess(A); 192 hess(H2, A); 193 194 REQUIRE( U(0, 0) == Approx(1.0) ); 195 REQUIRE( U(0, 1) == Approx(0.0).margin(0.001) ); 196 REQUIRE( U(0, 2) == Approx(0.0).margin(0.001) ); 197 REQUIRE( U(0, 3) == Approx(0.0).margin(0.001) ); 198 199 REQUIRE( U(1, 0) == Approx( 0.0) ); 200 REQUIRE( U(1, 1) == Approx(-0.591275924818639) ); 201 REQUIRE( U(1, 2) == Approx(-0.462981984254642) ); 202 REQUIRE( U(1, 3) == Approx( 0.660333599770220) ); 203 204 REQUIRE( U(2, 0) == Approx( 0.0) ); 205 REQUIRE( U(2, 1) == Approx( 0.665965345962041) ); 206 REQUIRE( U(2, 2) == Approx( 0.181491258046004) ); 207 REQUIRE( U(2, 3) == Approx( 0.723568297557693) ); 208 209 REQUIRE( U(3, 0) == Approx( 0.0) ); 210 REQUIRE( U(3, 1) == Approx(-0.454843861899358) ); 211 REQUIRE( U(3, 2) == Approx( 0.867587808529208) ); 212 REQUIRE( U(3, 3) == Approx( 0.201018545870685) ); 213 214 215 REQUIRE( H(0, 0) == Approx( 0.061198000000000) ); 216 REQUIRE( H(0, 1) == Approx( 0.118336799794845) ); 217 REQUIRE( H(0, 2) == Approx(-0.518479197817449) ); 218 REQUIRE( H(0, 3) == Approx( 0.048328864303744) ); 219 220 REQUIRE( H(1, 0) == Approx(-0.739488928344434) ); 221 REQUIRE( H(1, 1) == Approx(-0.017815019577445) ); 222 REQUIRE( H(1, 2) == Approx( 0.549585804168668) ); 223 REQUIRE( H(1, 3) == Approx( 0.001541438669749) ); 224 225 REQUIRE( H(2, 0) == Approx( 0.0) ); 226 REQUIRE( H(2, 1) == Approx( 0.268224897826587) ); 227 REQUIRE( H(2, 2) == Approx(-0.266514530817371) ); 228 REQUIRE( H(2, 3) == Approx( 0.544078897369960) ); 229 230 REQUIRE( H(3, 0) == Approx( 0.0) ); 231 REQUIRE( H(3, 1) == Approx( 0.0) ); 232 REQUIRE( H(3, 2) == Approx( 0.163125252889179) ); 233 REQUIRE( H(3, 3) == Approx( 0.264302550394816) ); 234 235 236 REQUIRE( H1(0, 0) == Approx( 0.061198000000000) ); 237 REQUIRE( H1(0, 1) == Approx( 0.118336799794845) ); 238 REQUIRE( H1(0, 2) == Approx(-0.518479197817449) ); 239 REQUIRE( H1(0, 3) == Approx( 0.048328864303744) ); 240 241 REQUIRE( H1(1, 0) == Approx(-0.739488928344434) ); 242 REQUIRE( H1(1, 1) == Approx(-0.017815019577445) ); 243 REQUIRE( H1(1, 2) == Approx( 0.549585804168668) ); 244 REQUIRE( H1(1, 3) == Approx( 0.001541438669749) ); 245 246 REQUIRE( H1(2, 0) == Approx( 0.0) ); 247 REQUIRE( H1(2, 1) == Approx( 0.268224897826587) ); 248 REQUIRE( H1(2, 2) == Approx(-0.266514530817371) ); 249 REQUIRE( H1(2, 3) == Approx( 0.544078897369960) ); 250 251 REQUIRE( H1(3, 0) == Approx( 0.0) ); 252 REQUIRE( H1(3, 1) == Approx( 0.0) ); 253 REQUIRE( H1(3, 2) == Approx( 0.163125252889179) ); 254 REQUIRE( H1(3, 3) == Approx( 0.264302550394816) ); 255 256 257 REQUIRE( H2(0, 0) == Approx( 0.061198000000000) ); 258 REQUIRE( H2(0, 1) == Approx( 0.118336799794845) ); 259 REQUIRE( H2(0, 2) == Approx(-0.518479197817449) ); 260 REQUIRE( H2(0, 3) == Approx( 0.048328864303744) ); 261 262 REQUIRE( H2(1, 0) == Approx(-0.739488928344434) ); 263 REQUIRE( H2(1, 1) == Approx(-0.017815019577445) ); 264 REQUIRE( H2(1, 2) == Approx( 0.549585804168668) ); 265 REQUIRE( H2(1, 3) == Approx( 0.001541438669749) ); 266 267 REQUIRE( H2(2, 0) == Approx( 0.0) ); 268 REQUIRE( H2(2, 1) == Approx( 0.268224897826587) ); 269 REQUIRE( H2(2, 2) == Approx(-0.266514530817371) ); 270 REQUIRE( H2(2, 3) == Approx( 0.544078897369960) ); 271 272 REQUIRE( H2(3, 0) == Approx( 0.0) ); 273 REQUIRE( H2(3, 1) == Approx( 0.0) ); 274 REQUIRE( H2(3, 2) == Approx( 0.163125252889179) ); 275 REQUIRE( H2(3, 3) == Approx( 0.264302550394816) ); 276 } 277 278 279 280 /***************** tests for complex matrix ****************/ 281 282 TEST_CASE("fn_hess_cx_empty") 283 { 284 cx_mat A(1, 1); 285 A.reset(); 286 cx_mat U, H, H1, H2; 287 288 hess(U, H, A); 289 H1 = hess(A); 290 hess(H2, A); 291 292 REQUIRE( U.is_empty() == true ); 293 REQUIRE( H.is_empty() == true ); 294 REQUIRE( H1.is_empty() == true ); 295 REQUIRE( H2.is_empty() == true ); 296 } 297 298 299 300 TEST_CASE("fn_hess_cx_1") 301 { 302 cx_mat A(1, 1); 303 A(0, 0) = complex<double>(0.061198, 1.012234); 304 cx_mat U, H, H1, H2; 305 306 hess(U, H, A); 307 H1 = hess(A); 308 hess(H2, A); 309 310 REQUIRE( U(0, 0).real() == Approx(1.0) ); 311 REQUIRE( U(0, 0).imag() == Approx(0.0).margin(0.001) ); 312 313 REQUIRE( H(0, 0).real() == Approx(0.061198) ); 314 REQUIRE( H(0, 0).imag() == Approx(1.012234) ); 315 316 REQUIRE( H1(0, 0).real() == Approx(0.061198) ); 317 REQUIRE( H1(0, 0).imag() == Approx(1.012234) ); 318 319 REQUIRE( H2(0, 0).real() == Approx(0.061198) ); 320 REQUIRE( H2(0, 0).imag() == Approx(1.012234) ); 321 } 322 323 324 325 TEST_CASE("fn_hess_cx_2") 326 { 327 mat B = 328 "\ 329 0.061198 0.201990;\ 330 0.437242 0.058956;\ 331 "; 332 cx_mat A(B, B*B); 333 cx_mat U, H, H1, H2; 334 335 hess(U, H, A); 336 H1 = hess(A); 337 hess(H2, A); 338 339 REQUIRE( U(0, 0).real() == Approx(1.0) ); 340 REQUIRE( U(0, 0).imag() == Approx(0.0).margin(0.001) ); 341 REQUIRE( U(0, 1).real() == Approx(0.0).margin(0.001) ); 342 REQUIRE( U(0, 1).imag() == Approx(0.0).margin(0.001) ); 343 REQUIRE( U(1, 0).real() == Approx(0.0).margin(0.001) ); 344 REQUIRE( U(1, 0).imag() == Approx(0.0).margin(0.001) ); 345 REQUIRE( U(1, 1).real() == Approx(1.0) ); 346 REQUIRE( U(1, 1).imag() == Approx(0.0).margin(0.001) ); 347 348 REQUIRE( H(0, 0).real() == Approx( 0.061198000000000) ); 349 REQUIRE( H(0, 0).imag() == Approx( 0.092063706784000) ); 350 REQUIRE( H(0, 1).real() == Approx( 0.201990000000000) ); 351 REQUIRE( H(0, 1).imag() == Approx( 0.024269906460000) ); 352 REQUIRE( H(1, 0).real() == Approx( 0.437242000000000) ); 353 REQUIRE( H(1, 0).imag() == Approx( 0.052536375268000) ); 354 REQUIRE( H(1, 1).real() == Approx( 0.058956000000000) ); 355 REQUIRE( H(1, 1).imag() == Approx( 0.091794321516000) ); 356 357 REQUIRE( H1(0, 0).real() == Approx( 0.061198000000000) ); 358 REQUIRE( H1(0, 0).imag() == Approx( 0.092063706784000) ); 359 REQUIRE( H1(0, 1).real() == Approx( 0.201990000000000) ); 360 REQUIRE( H1(0, 1).imag() == Approx( 0.024269906460000) ); 361 REQUIRE( H1(1, 0).real() == Approx( 0.437242000000000) ); 362 REQUIRE( H1(1, 0).imag() == Approx( 0.052536375268000) ); 363 REQUIRE( H1(1, 1).real() == Approx( 0.058956000000000) ); 364 REQUIRE( H1(1, 1).imag() == Approx( 0.091794321516000) ); 365 366 REQUIRE( H2(0, 0).real() == Approx( 0.061198000000000) ); 367 REQUIRE( H2(0, 0).imag() == Approx( 0.092063706784000) ); 368 REQUIRE( H2(0, 1).real() == Approx( 0.201990000000000) ); 369 REQUIRE( H2(0, 1).imag() == Approx( 0.024269906460000) ); 370 REQUIRE( H2(1, 0).real() == Approx( 0.437242000000000) ); 371 REQUIRE( H2(1, 0).imag() == Approx( 0.052536375268000) ); 372 REQUIRE( H2(1, 1).real() == Approx( 0.058956000000000) ); 373 REQUIRE( H2(1, 1).imag() == Approx( 0.091794321516000) ); 374 } 375 376 377 378 TEST_CASE("fn_hess_cx_3") 379 { 380 mat B = 381 "\ 382 0.061198 0.201990 0.019678;\ 383 0.437242 0.058956 -0.149362;\ 384 -0.492474 -0.031309 0.314156;\ 385 "; 386 cx_mat A(B, B*B); 387 cx_mat U, H, H1, H2; 388 389 hess(U, H, A); 390 H1 = hess(A); 391 hess(H2, A); 392 393 REQUIRE( U(0, 0).real() == Approx(1.0) ); 394 REQUIRE( U(0, 0).imag() == Approx(0.0).margin(0.001) ); 395 REQUIRE( U(0, 1).real() == Approx(0.0).margin(0.001) ); 396 REQUIRE( U(0, 1).imag() == Approx(0.0).margin(0.001) ); 397 REQUIRE( U(0, 2).real() == Approx(0.0).margin(0.001) ); 398 REQUIRE( U(0, 2).imag() == Approx(0.0).margin(0.001) ); 399 400 REQUIRE( U(1, 0).real() == Approx( 0.0) ); 401 REQUIRE( U(1, 0).imag() == Approx( 0.0) ); 402 REQUIRE( U(1, 1).real() == Approx(-0.625250908290361) ); 403 REQUIRE( U(1, 1).imag() == Approx(-0.180311900237219) ); 404 REQUIRE( U(1, 2).real() == Approx(-0.694923841863332) ); 405 REQUIRE( U(1, 2).imag() == Approx(-0.305989827159056) ); 406 407 REQUIRE( U(2, 0).real() == Approx( 0.0) ); 408 REQUIRE( U(2, 0).imag() == Approx( 0.0) ); 409 REQUIRE( U(2, 1).real() == Approx( 0.704232017531224) ); 410 REQUIRE( U(2, 1).imag() == Approx( 0.283912285396078) ); 411 REQUIRE( U(2, 2).real() == Approx(-0.565610163671470) ); 412 REQUIRE( U(2, 2).imag() == Approx(-0.321770449912063) ); 413 414 415 REQUIRE( H(0, 0).real() == Approx( 0.061198000000000) ); 416 REQUIRE( H(0, 0).imag() == Approx( 0.082372803412000) ); 417 REQUIRE( H(0, 1).real() == Approx(-0.101702999021493) ); 418 REQUIRE( H(0, 1).imag() == Approx(-0.061668749553784) ); 419 REQUIRE( H(0, 2).real() == Approx(-0.151590948501704) ); 420 REQUIRE( H(0, 2).imag() == Approx(-0.071689748472419) ); 421 422 REQUIRE( H(1, 0).real() == Approx(-0.699306461138236) ); 423 REQUIRE( H(1, 0).imag() == Approx( 0.0) ); 424 REQUIRE( H(1, 1).real() == Approx( 0.298129546829246) ); 425 REQUIRE( H(1, 1).imag() == Approx( 0.178624769103627) ); 426 REQUIRE( H(1, 2).real() == Approx(-0.165941859233838) ); 427 REQUIRE( H(1, 2).imag() == Approx( 0.014927427092653) ); 428 429 REQUIRE( H(2, 0).real() == Approx( 0.0) ); 430 REQUIRE( H(2, 0).imag() == Approx( 0.0) ); 431 REQUIRE( H(2, 1).real() == Approx(-0.061767777059231) ); 432 REQUIRE( H(2, 1).imag() == Approx( 0.0) ); 433 REQUIRE( H(2, 2).real() == Approx( 0.074982453170754) ); 434 REQUIRE( H(2, 2).imag() == Approx( 0.011525391092373) ); 435 436 437 REQUIRE( H1(0, 0).real() == Approx( 0.061198000000000) ); 438 REQUIRE( H1(0, 0).imag() == Approx( 0.082372803412000) ); 439 REQUIRE( H1(0, 1).real() == Approx(-0.101702999021493) ); 440 REQUIRE( H1(0, 1).imag() == Approx(-0.061668749553784) ); 441 REQUIRE( H1(0, 2).real() == Approx(-0.151590948501704) ); 442 REQUIRE( H1(0, 2).imag() == Approx(-0.071689748472419) ); 443 444 REQUIRE( H1(1, 0).real() == Approx(-0.699306461138236) ); 445 REQUIRE( H1(1, 0).imag() == Approx( 0.0) ); 446 REQUIRE( H1(1, 1).real() == Approx( 0.298129546829246) ); 447 REQUIRE( H1(1, 1).imag() == Approx( 0.178624769103627) ); 448 REQUIRE( H1(1, 2).real() == Approx(-0.165941859233838) ); 449 REQUIRE( H1(1, 2).imag() == Approx( 0.014927427092653) ); 450 451 REQUIRE( H1(2, 0).real() == Approx( 0.0) ); 452 REQUIRE( H1(2, 0).imag() == Approx( 0.0) ); 453 REQUIRE( H1(2, 1).real() == Approx(-0.061767777059231) ); 454 REQUIRE( H1(2, 1).imag() == Approx( 0.0) ); 455 REQUIRE( H1(2, 2).real() == Approx( 0.074982453170754) ); 456 REQUIRE( H1(2, 2).imag() == Approx( 0.011525391092373) ); 457 458 459 REQUIRE( H2(0, 0).real() == Approx( 0.061198000000000) ); 460 REQUIRE( H2(0, 0).imag() == Approx( 0.082372803412000) ); 461 REQUIRE( H2(0, 1).real() == Approx(-0.101702999021493) ); 462 REQUIRE( H2(0, 1).imag() == Approx(-0.061668749553784) ); 463 REQUIRE( H2(0, 2).real() == Approx(-0.151590948501704) ); 464 REQUIRE( H2(0, 2).imag() == Approx(-0.071689748472419) ); 465 466 REQUIRE( H2(1, 0).real() == Approx(-0.699306461138236) ); 467 REQUIRE( H2(1, 0).imag() == Approx( 0.0) ); 468 REQUIRE( H2(1, 1).real() == Approx( 0.298129546829246) ); 469 REQUIRE( H2(1, 1).imag() == Approx( 0.178624769103627) ); 470 REQUIRE( H2(1, 2).real() == Approx(-0.165941859233838) ); 471 REQUIRE( H2(1, 2).imag() == Approx( 0.014927427092653) ); 472 473 REQUIRE( H2(2, 0).real() == Approx( 0.0) ); 474 REQUIRE( H2(2, 0).imag() == Approx( 0.0) ); 475 REQUIRE( H2(2, 1).real() == Approx(-0.061767777059231) ); 476 REQUIRE( H2(2, 1).imag() == Approx( 0.0) ); 477 REQUIRE( H2(2, 2).real() == Approx( 0.074982453170754) ); 478 REQUIRE( H2(2, 2).imag() == Approx( 0.011525391092373) ); 479 } 480 481 482 483 484 TEST_CASE("fn_hess_cx_4") 485 { 486 mat B = 487 "\ 488 0.061198 0.201990 0.019678 -0.493936;\ 489 0.437242 0.058956 -0.149362 -0.045465;\ 490 -0.492474 -0.031309 0.314156 0.419733;\ 491 0.336352 0.411541 0.458476 -0.393139;\ 492 "; 493 cx_mat A(B, B*B); 494 cx_mat U, H, H1, H2; 495 496 hess(U, H, A*A); 497 H1 = hess(A*A); 498 hess(H2, A*A); 499 500 REQUIRE( U(0, 0).real() == Approx(1.0) ); 501 REQUIRE( U(0, 0).imag() == Approx(0.0).margin(0.001) ); 502 REQUIRE( U(0, 1).real() == Approx(0.0).margin(0.001) ); 503 REQUIRE( U(0, 1).imag() == Approx(0.0).margin(0.001) ); 504 REQUIRE( U(0, 2).real() == Approx(0.0).margin(0.001) ); 505 REQUIRE( U(0, 2).imag() == Approx(0.0).margin(0.001) ); 506 REQUIRE( U(0, 3).real() == Approx(0.0).margin(0.001) ); 507 REQUIRE( U(0, 3).imag() == Approx(0.0).margin(0.001) ); 508 509 REQUIRE( U(1, 0).real() == Approx( 0.0) ); 510 REQUIRE( U(1, 0).imag() == Approx( 0.0) ); 511 REQUIRE( U(1, 1).real() == Approx(-0.310409361344421) ); 512 REQUIRE( U(1, 1).imag() == Approx( 0.134965522927510) ); 513 REQUIRE( U(1, 2).real() == Approx( 0.368370931495079) ); 514 REQUIRE( U(1, 2).imag() == Approx( 0.620286967761253) ); 515 REQUIRE( U(1, 3).real() == Approx(-0.461565151978241) ); 516 REQUIRE( U(1, 3).imag() == Approx( 0.389788251419862) ); 517 518 REQUIRE( U(2, 0).real() == Approx( 0.0) ); 519 REQUIRE( U(2, 0).imag() == Approx( 0.0) ); 520 REQUIRE( U(2, 1).real() == Approx( 0.090510343531288) ); 521 REQUIRE( U(2, 1).imag() == Approx( 0.435448214446087) ); 522 REQUIRE( U(2, 2).real() == Approx(-0.629572243863963) ); 523 REQUIRE( U(2, 2).imag() == Approx( 0.277252591049466) ); 524 REQUIRE( U(2, 3).real() == Approx( 0.331725833624923) ); 525 REQUIRE( U(2, 3).imag() == Approx( 0.467889401534022) ); 526 527 REQUIRE( U(3, 0).real() == Approx( 0.0) ); 528 REQUIRE( U(3, 0).imag() == Approx( 0.0) ); 529 REQUIRE( U(3, 1).real() == Approx( 0.662749913792672) ); 530 REQUIRE( U(3, 1).imag() == Approx(-0.498383003349854) ); 531 REQUIRE( U(3, 2).real() == Approx(-0.073218600583049) ); 532 REQUIRE( U(3, 2).imag() == Approx(-0.030915392543373) ); 533 REQUIRE( U(3, 3).real() == Approx(-0.297561059397637) ); 534 REQUIRE( U(3, 3).imag() == Approx( 0.466387847936125) ); 535 536 537 REQUIRE( H(0, 0).real() == Approx(-0.059498334460944) ); 538 REQUIRE( H(0, 0).imag() == Approx( 0.187834910202221) ); 539 REQUIRE( H(0, 1).real() == Approx(-0.017930467829804) ); 540 REQUIRE( H(0, 1).imag() == Approx(-0.366928547670200) ); 541 REQUIRE( H(0, 2).real() == Approx(-0.021913405453089) ); 542 REQUIRE( H(0, 2).imag() == Approx(-0.128142818524165) ); 543 REQUIRE( H(0, 3).real() == Approx( 0.012590549436907) ); 544 REQUIRE( H(0, 3).imag() == Approx(-0.036787529849029) ); 545 546 REQUIRE( H(1, 0).real() == Approx(-0.212856818153491) ); 547 REQUIRE( H(1, 0).imag() == Approx( 0.0) ); 548 REQUIRE( H(1, 1).real() == Approx( 0.173480548915683) ); 549 REQUIRE( H(1, 1).imag() == Approx(-0.119570582029397) ); 550 REQUIRE( H(1, 2).real() == Approx(-0.098222486822866) ); 551 REQUIRE( H(1, 2).imag() == Approx(-0.073492477972392) ); 552 REQUIRE( H(1, 3).real() == Approx(-0.088126641335837) ); 553 REQUIRE( H(1, 3).imag() == Approx( 0.107905518898551) ); 554 555 REQUIRE( H(2, 0).real() == Approx( 0.0) ); 556 REQUIRE( H(2, 0).imag() == Approx( 0.0) ); 557 REQUIRE( H(2, 1).real() == Approx( 0.125544511009417) ); 558 REQUIRE( H(2, 1).imag() == Approx( 0.0) ); 559 REQUIRE( H(2, 2).real() == Approx( 0.374057080595739) ); 560 REQUIRE( H(2, 2).imag() == Approx( 0.061223114296791) ); 561 REQUIRE( H(2, 3).real() == Approx( 0.231175819260595) ); 562 REQUIRE( H(2, 3).imag() == Approx(-0.224564151240434) ); 563 564 REQUIRE( H(3, 0).real() == Approx( 0.0) ); 565 REQUIRE( H(3, 0).imag() == Approx( 0.0) ); 566 REQUIRE( H(3, 1).real() == Approx( 0.0) ); 567 REQUIRE( H(3, 1).imag() == Approx( 0.0) ); 568 REQUIRE( H(3, 2).real() == Approx(-0.238973358869022) ); 569 REQUIRE( H(3, 2).imag() == Approx( 0.0) ); 570 REQUIRE( H(3, 3).real() == Approx(-0.101771291133878) ); 571 REQUIRE( H(3, 3).imag() == Approx( 0.212030655387598) ); 572 573 574 REQUIRE( H1(0, 0).real() == Approx(-0.059498334460944) ); 575 REQUIRE( H1(0, 0).imag() == Approx( 0.187834910202221) ); 576 REQUIRE( H1(0, 1).real() == Approx(-0.017930467829804) ); 577 REQUIRE( H1(0, 1).imag() == Approx(-0.366928547670200) ); 578 REQUIRE( H1(0, 2).real() == Approx(-0.021913405453089) ); 579 REQUIRE( H1(0, 2).imag() == Approx(-0.128142818524165) ); 580 REQUIRE( H1(0, 3).real() == Approx( 0.012590549436907) ); 581 REQUIRE( H1(0, 3).imag() == Approx(-0.036787529849029) ); 582 583 REQUIRE( H1(1, 0).real() == Approx(-0.212856818153491) ); 584 REQUIRE( H1(1, 0).imag() == Approx( 0.0) ); 585 REQUIRE( H1(1, 1).real() == Approx( 0.173480548915683) ); 586 REQUIRE( H1(1, 1).imag() == Approx(-0.119570582029397) ); 587 REQUIRE( H1(1, 2).real() == Approx(-0.098222486822866) ); 588 REQUIRE( H1(1, 2).imag() == Approx(-0.073492477972392) ); 589 REQUIRE( H1(1, 3).real() == Approx(-0.088126641335837) ); 590 REQUIRE( H1(1, 3).imag() == Approx( 0.107905518898551) ); 591 592 REQUIRE( H1(2, 0).real() == Approx( 0.0) ); 593 REQUIRE( H1(2, 0).imag() == Approx( 0.0) ); 594 REQUIRE( H1(2, 1).real() == Approx( 0.125544511009417) ); 595 REQUIRE( H1(2, 1).imag() == Approx( 0.0) ); 596 REQUIRE( H1(2, 2).real() == Approx( 0.374057080595739) ); 597 REQUIRE( H1(2, 2).imag() == Approx( 0.061223114296791) ); 598 REQUIRE( H1(2, 3).real() == Approx( 0.231175819260595) ); 599 REQUIRE( H1(2, 3).imag() == Approx(-0.224564151240434) ); 600 601 REQUIRE( H1(3, 0).real() == Approx( 0.0) ); 602 REQUIRE( H1(3, 0).imag() == Approx( 0.0) ); 603 REQUIRE( H1(3, 1).real() == Approx( 0.0) ); 604 REQUIRE( H1(3, 1).imag() == Approx( 0.0) ); 605 REQUIRE( H1(3, 2).real() == Approx(-0.238973358869022) ); 606 REQUIRE( H1(3, 2).imag() == Approx( 0.0) ); 607 REQUIRE( H1(3, 3).real() == Approx(-0.101771291133878) ); 608 REQUIRE( H1(3, 3).imag() == Approx( 0.212030655387598) ); 609 610 611 REQUIRE( H2(0, 0).real() == Approx(-0.059498334460944) ); 612 REQUIRE( H2(0, 0).imag() == Approx( 0.187834910202221) ); 613 REQUIRE( H2(0, 1).real() == Approx(-0.017930467829804) ); 614 REQUIRE( H2(0, 1).imag() == Approx(-0.366928547670200) ); 615 REQUIRE( H2(0, 2).real() == Approx(-0.021913405453089) ); 616 REQUIRE( H2(0, 2).imag() == Approx(-0.128142818524165) ); 617 REQUIRE( H2(0, 3).real() == Approx( 0.012590549436907) ); 618 REQUIRE( H2(0, 3).imag() == Approx(-0.036787529849029) ); 619 620 REQUIRE( H2(1, 0).real() == Approx(-0.212856818153491) ); 621 REQUIRE( H2(1, 0).imag() == Approx( 0.0) ); 622 REQUIRE( H2(1, 1).real() == Approx( 0.173480548915683) ); 623 REQUIRE( H2(1, 1).imag() == Approx(-0.119570582029397) ); 624 REQUIRE( H2(1, 2).real() == Approx(-0.098222486822866) ); 625 REQUIRE( H2(1, 2).imag() == Approx(-0.073492477972392) ); 626 REQUIRE( H2(1, 3).real() == Approx(-0.088126641335837) ); 627 REQUIRE( H2(1, 3).imag() == Approx( 0.107905518898551) ); 628 629 REQUIRE( H2(2, 0).real() == Approx( 0.0) ); 630 REQUIRE( H2(2, 0).imag() == Approx( 0.0) ); 631 REQUIRE( H2(2, 1).real() == Approx( 0.125544511009417) ); 632 REQUIRE( H2(2, 1).imag() == Approx( 0.0) ); 633 REQUIRE( H2(2, 2).real() == Approx( 0.374057080595739) ); 634 REQUIRE( H2(2, 2).imag() == Approx( 0.061223114296791) ); 635 REQUIRE( H2(2, 3).real() == Approx( 0.231175819260595) ); 636 REQUIRE( H2(2, 3).imag() == Approx(-0.224564151240434) ); 637 638 REQUIRE( H2(3, 0).real() == Approx( 0.0) ); 639 REQUIRE( H2(3, 0).imag() == Approx( 0.0) ); 640 REQUIRE( H2(3, 1).real() == Approx( 0.0) ); 641 REQUIRE( H2(3, 1).imag() == Approx( 0.0) ); 642 REQUIRE( H2(3, 2).real() == Approx(-0.238973358869022) ); 643 REQUIRE( H2(3, 2).imag() == Approx( 0.0) ); 644 REQUIRE( H2(3, 3).real() == Approx(-0.101771291133878) ); 645 REQUIRE( H2(3, 3).imag() == Approx( 0.212030655387598) ); 646 } 647