145
145
@testset " Matrix square root" begin
146
146
asq = sqrt (a)
147
147
@test asq* asq ≈ a
148
+ @test sqrt (transpose (a))* sqrt (transpose (a)) ≈ transpose (a)
149
+ @test sqrt (adjoint (a))* sqrt (adjoint (a)) ≈ adjoint (a)
148
150
asym = a + a' # symmetric indefinite
149
151
asymsq = sqrt (asym)
150
152
@test asymsq* asymsq ≈ asym
153
+ @test sqrt (transpose (asym))* sqrt (transpose (asym)) ≈ transpose (asym)
154
+ @test sqrt (adjoint (asym))* sqrt (adjoint (asym)) ≈ adjoint (asym)
151
155
if eltype (a) <: Real # real square root
152
156
apos = a * a
153
157
@test sqrt (apos)^ 2 ≈ apos
447
451
183.765138646367 183.765138646366 163.679601723179 ;
448
452
71.797032399996 91.8825693231832 111.968106246371 ]' )
449
453
@test exp (A1) ≈ eA1
454
+ @test exp (adjoint (A1)) ≈ adjoint (eA1)
455
+ @test exp (transpose (A1)) ≈ transpose (eA1)
456
+ for f in (sin, cos, sinh, cosh, tanh, tan)
457
+ @test f (adjoint (A1)) ≈ f (copy (adjoint (A1)))
458
+ end
450
459
451
460
A2 = convert (Matrix{elty},
452
461
[29.87942128909879 0.7815750847907159 - 2.289519314033932 ;
@@ -457,20 +466,28 @@ end
457
466
- 18231880972009252.0 60605228702221920.0 101291842930249760.0 ;
458
467
- 30475770808580480.0 101291842930249728.0 169294411240851968.0 ])
459
468
@test exp (A2) ≈ eA2
469
+ @test exp (adjoint (A2)) ≈ adjoint (eA2)
470
+ @test exp (transpose (A2)) ≈ transpose (eA2)
460
471
461
472
A3 = convert (Matrix{elty}, [- 131 19 18 ;- 390 56 54 ;- 387 57 52 ])
462
473
eA3 = convert (Matrix{elty}, [- 1.50964415879218 - 5.6325707998812 - 4.934938326092 ;
463
474
0.367879439109187 1.47151775849686 1.10363831732856 ;
464
475
0.135335281175235 0.406005843524598 0.541341126763207 ]' )
465
476
@test exp (A3) ≈ eA3
477
+ @test exp (adjoint (A3)) ≈ adjoint (eA3)
478
+ @test exp (transpose (A3)) ≈ transpose (eA3)
466
479
467
480
A4 = convert (Matrix{elty}, [0.25 0.25 ; 0 0 ])
468
481
eA4 = convert (Matrix{elty}, [1.2840254166877416 0.2840254166877415 ; 0 1 ])
469
482
@test exp (A4) ≈ eA4
483
+ @test exp (adjoint (A4)) ≈ adjoint (eA4)
484
+ @test exp (transpose (A4)) ≈ transpose (eA4)
470
485
471
486
A5 = convert (Matrix{elty}, [0 0.02 ; 0 0 ])
472
487
eA5 = convert (Matrix{elty}, [1 0.02 ; 0 1 ])
473
488
@test exp (A5) ≈ eA5
489
+ @test exp (adjoint (A5)) ≈ adjoint (eA5)
490
+ @test exp (transpose (A5)) ≈ transpose (eA5)
474
491
475
492
# Hessenberg
476
493
@test hessenberg (A1). H ≈ convert (Matrix{elty},
@@ -496,15 +513,23 @@ end
496
513
1 / 4 1 / 5 1 / 6 1 / 7 ;
497
514
1 / 5 1 / 6 1 / 7 1 / 8 ])
498
515
@test exp (log (A4)) ≈ A4
516
+ @test exp (log (transpose (A4))) ≈ transpose (A4)
517
+ @test exp (log (adjoint (A4))) ≈ adjoint (A4)
499
518
500
519
A5 = convert (Matrix{elty}, [1 1 0 1 ; 0 1 1 0 ; 0 0 1 1 ; 1 0 0 1 ])
501
520
@test exp (log (A5)) ≈ A5
521
+ @test exp (log (transpose (A5))) ≈ transpose (A5)
522
+ @test exp (log (adjoint (A5))) ≈ adjoint (A5)
502
523
503
524
A6 = convert (Matrix{elty}, [- 5 2 0 0 ; 1 / 2 - 7 3 0 ; 0 1 / 3 - 9 4 ; 0 0 1 / 4 - 11 ])
504
525
@test exp (log (A6)) ≈ A6
526
+ @test exp (log (transpose (A6))) ≈ transpose (A6)
527
+ @test exp (log (adjoint (A6))) ≈ adjoint (A6)
505
528
506
529
A7 = convert (Matrix{elty}, [1 0 0 1e-8 ; 0 1 0 0 ; 0 0 1 0 ; 0 0 0 1 ])
507
530
@test exp (log (A7)) ≈ A7
531
+ @test exp (log (transpose (A7))) ≈ transpose (A7)
532
+ @test exp (log (adjoint (A7))) ≈ adjoint (A7)
508
533
end
509
534
510
535
@testset " Integer promotion tests" begin
0 commit comments