Skip to content

Commit fc6947c

Browse files
committed
Fix a batched SVD TODO
1 parent 60ca964 commit fc6947c

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎ext/MatrixAlgebraKitCUDAExt/yacusolver.jl‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,8 @@ for (bname, fname, elty, relty) in
500500
throw(DimensionMismatch("size mismatch between A and S"))
501501

502502
# these MUST be "full" sized
503-
# TODO: check if U and Vᴴ already have the correct size to avoid
504-
# some allocations
505-
Ṽ = similar(Vᴴ, (n, n, batch_size))
506-
Ũ = similar(U, (m, m, batch_size))
503+
Ṽ = ifelse(size(Vᴴ) == (n, n, batch_size), Vᴴ, similar(Vᴴ, (n, n, batch_size)))
504+
Ũ = ifelse(size(U) == (m, m, batch_size), U, similar(U, (m, m, batch_size))
507505
lda = max(1, stride(A, 2))
508506
ldu = max(1, stride(Ũ, 2))
509507
ldv = max(1, stride(Ṽ, 2))

0 commit comments

Comments
 (0)