Skip to content

Commit 9e16472

Browse files
committed
Reenable truncated CUDA tests
1 parent e6ada1c commit 9e16472

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

test/cuda/factorizations.jl

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -229,17 +229,17 @@ for V in spacelist
229229
@test isisometric(N)
230230
@test norm(N' * t) 0 atol = 100 * eps(norm(t))
231231

232-
#N = @constinferred left_null(t; trunc = (; atol = 100 * eps(norm(t))))
233-
#@test isisometric(N)
234-
#@test norm(N' * t) ≈ 0 atol = 100 * eps(norm(t))
232+
N = @constinferred left_null(t; trunc = (; atol = 100 * eps(norm(t))))
233+
@test isisometric(N)
234+
@test norm(N' * t) 0 atol = 100 * eps(norm(t))
235235

236236
Nᴴ = @constinferred right_null(t; alg = :svd)
237237
@test isisometric(Nᴴ; side = :right)
238238
@test norm(t * Nᴴ') 0 atol = 100 * eps(norm(t))
239239

240-
#Nᴴ = @constinferred right_null(t; trunc = (; atol = 100 * eps(norm(t))))
241-
#@test isisometric(Nᴴ; side = :right)
242-
#@test norm(t * Nᴴ') ≈ 0 atol = 100 * eps(norm(t))
240+
Nᴴ = @constinferred right_null(t; trunc = (; atol = 100 * eps(norm(t))))
241+
@test isisometric(Nᴴ; side = :right)
242+
@test norm(t * Nᴴ') 0 atol = 100 * eps(norm(t))
243243
end
244244

245245
# empty tensor
@@ -258,15 +258,15 @@ for V in spacelist
258258
end
259259
end
260260

261-
#=@testset "truncated SVD" begin
261+
@testset "truncated SVD" begin
262262
for T in eltypes,
263263
t in (
264264
CUDA.randn(T, W, W),
265-
#CUDA.randn(T, W, W)',
265+
CUDA.randn(T, W, W)',
266266
CUDA.randn(T, W, V4),
267267
CUDA.randn(T, V4, W),
268-
#CUDA.randn(T, W, V4)',
269-
#CUDA.randn(T, V4, W)',
268+
CUDA.randn(T, W, V4)',
269+
CUDA.randn(T, V4, W)',
270270
DiagonalTensorMap(CUDA.randn(T, reduceddim(V1)), V1),
271271
)
272272

@@ -327,7 +327,7 @@ for V in spacelist
327327
@test minimum(diagview(S5)) >= λ
328328
@test dim(domain(S5)) nvals
329329
end
330-
end=# # TODO
330+
end
331331

332332
@testset "Eigenvalue decomposition" begin
333333
for T in eltypes,
@@ -349,10 +349,10 @@ for V in spacelist
349349
@test @constinferred isposdef(vdv)
350350
t isa DiagonalTensorMap || @test !isposdef(t) # unlikely for non-hermitian map
351351

352-
#=nvals = round(Int, dim(domain(t)) / 2)
352+
nvals = round(Int, dim(domain(t)) / 2)
353353
d, v = @constinferred eig_trunc(t; trunc = truncrank(nvals))
354354
@test t * v v * d
355-
@test dim(domain(d)) ≤ nvals=#
355+
@test dim(domain(d)) nvals
356356

357357
t2 = @constinferred project_hermitian(t)
358358
D, V = eigen(t2)
@@ -380,10 +380,9 @@ for V in spacelist
380380
@test isposdef(t2 - λ * one(t) + 0.1 * one(t2))
381381
@test !isposdef(t2 - λ * one(t) - 0.1 * one(t2))
382382

383-
# TODO
384-
#=d, v = @constinferred eigh_trunc(t2; trunc = truncrank(nvals))
383+
d, v = @constinferred eigh_trunc(t2; trunc = truncrank(nvals))
385384
@test t2 * v v * d
386-
@test dim(domain(d)) ≤ nvals=#
385+
@test dim(domain(d)) nvals
387386
end
388387
end
389388

test/cuda/tensors.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,14 @@ for V in spacelist
258258
end
259259
end
260260
end
261-
@timedtestset "Tensor conversion" begin # TODO adjoint conversion methods don't work yet
261+
@timedtestset "Tensor conversion" begin
262262
W = V1 V2
263263
t = @constinferred CUDA.randn(W W)
264-
#@test typeof(convert(TensorMap, t')) == typeof(t) # TODO Adjoint not supported yet
264+
@test typeof(convert(TensorMap, t')) == typeof(t)
265265
tc = complex(t)
266266
@test convert(typeof(tc), t) == tc
267267
@test typeof(convert(typeof(tc), t)) == typeof(tc)
268-
# @test typeof(convert(typeof(tc), t')) == typeof(tc) # TODO Adjoint not supported yet
268+
@test typeof(convert(typeof(tc), t')) == typeof(tc)
269269
@test Base.promote_typeof(t, tc) == typeof(tc)
270270
@test Base.promote_typeof(tc, t) == typeof(tc + t)
271271
end

0 commit comments

Comments
 (0)