Skip to content

Commit 6fddde3

Browse files
authored
Fix a batched SVD TODO (#325)
* Fix a batched SVD TODO * Allocate for V
1 parent 60ca964 commit 6fddde3

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+
Ṽ = similar(Vᴴ, (n, n, batch_size)) # gesvdj computes V, *not* Vᴴ
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)