Skip to content

Commit 4478cfd

Browse files
committed
Turn off non-supported Schur tests and add polar for AMD
1 parent bfbc8fb commit 4478cfd

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

test/amd/polar.jl

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using MatrixAlgebraKit
2+
using Test
3+
using TestExtras
4+
using StableRNGs
5+
using LinearAlgebra: LinearAlgebra, I, isposdef
6+
using MatrixAlgebraKit: PolarViaSVD
7+
using AMDGPU
8+
9+
@testset "left_polar! for T = $T" for T in (Float32, Float64, ComplexF32, ComplexF64)
10+
rng = StableRNG(123)
11+
m = 54
12+
@testset "size ($m, $n)" for n in (37, m)
13+
k = min(m, n)
14+
svd_algs = (rocSOLVER_QRIteration(), rocSOLVER_Jacobi())
15+
@testset "algorithm $svd_alg" for svd_alg in svd_algs
16+
n < m && svd_alg isa rocSOLVER_QRIteration && continue
17+
A = ROCArray(randn(rng, T, m, n))
18+
alg = PolarViaSVD(svd_alg)
19+
W, P = left_polar(A; alg)
20+
@test W isa ROCMatrix{T} && size(W) == (m, n)
21+
@test P isa ROCMatrix{T} && size(P) == (n, n)
22+
@test W * P A
23+
@test isisometry(W)
24+
#@test isposdef(P)
25+
26+
Ac = similar(A)
27+
W2, P2 = @constinferred left_polar!(copy!(Ac, A), (W, P), alg)
28+
@test W2 === W
29+
@test P2 === P
30+
@test W * P A
31+
@test isisometry(W)
32+
#@test isposdef(P)
33+
end
34+
end
35+
end
36+
37+
@testset "right_polar! for T = $T" for T in (Float32, Float64, ComplexF32, ComplexF64)
38+
rng = StableRNG(123)
39+
n = 54
40+
@testset "size ($m, $n)" for m in (37, n)
41+
k = min(m, n)
42+
svd_algs = (rocSOLVER_QRIteration(), rocSOLVER_Jacobi())
43+
@testset "algorithm $svd_alg" for svd_alg in svd_algs
44+
n > m && svd_alg isa rocSOLVER_QRIteration && continue
45+
A = ROCArray(randn(rng, T, m, n))
46+
alg = PolarViaSVD(svd_alg)
47+
P, Wᴴ = right_polar(A; alg)
48+
@test Wᴴ isa ROCMatrix{T} && size(Wᴴ) == (m, n)
49+
@test P isa ROCMatrix{T} && size(P) == (m, m)
50+
@test P * Wᴴ A
51+
@test isisometry(Wᴴ; side=:right)
52+
#@test isposdef(P)
53+
54+
Ac = similar(A)
55+
P2, Wᴴ2 = @constinferred right_polar!(copy!(Ac, A), (P, Wᴴ), alg)
56+
@test P2 === P
57+
@test Wᴴ2 === Wᴴ
58+
@test P * Wᴴ A
59+
@test isisometry(Wᴴ; side=:right)
60+
#@test isposdef(P)
61+
end
62+
end
63+
end

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ if AMDGPU.functional()
9494
@safetestset "AMDGPU Hermitian Eigenvalue Decomposition" begin
9595
include("amd/eigh.jl")
9696
end
97-
@safetestset "AMDGPU Schur Decomposition" begin
97+
#=@safetestset "AMDGPU Schur Decomposition" begin
9898
include("amd/schur.jl")
99-
end
99+
end=# #TODO
100100
@safetestset "AMDGPU Polar Decomposition" begin
101101
include("amd/polar.jl")
102102
end

0 commit comments

Comments
 (0)