Skip to content

Commit 2055750

Browse files
committed
remove unnecessary size arguments
1 parent 247dc93 commit 2055750

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/common/gauge.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ function gaugefix!(V::AbstractMatrix)
1717
return V
1818
end
1919

20-
function gaugefix!(::typeof(svd_full!), U, Vᴴ, m::Int, n::Int)
20+
function gaugefix!(::typeof(svd_full!), U, Vᴴ)
21+
m, n = size(U, 1), size(Vᴴ, 2)
2122
for j in 1:max(m, n)
2223
if j <= min(m, n)
2324
u = view(U, :, j)
@@ -38,7 +39,7 @@ function gaugefix!(::typeof(svd_full!), U, Vᴴ, m::Int, n::Int)
3839
return (U, Vᴴ)
3940
end
4041

41-
function gaugefix!(::typeof(svd_compact!), U, Vᴴ, m::Int, n::Int)
42+
function gaugefix!(::typeof(svd_compact!), U, Vᴴ)
4243
for j in 1:size(U, 2)
4344
u = view(U, :, j)
4445
v = view(Vᴴ, j, :)
@@ -49,7 +50,8 @@ function gaugefix!(::typeof(svd_compact!), U, Vᴴ, m::Int, n::Int)
4950
return (U, Vᴴ)
5051
end
5152

52-
function gaugefix!(::typeof(svd_trunc!), U, Vᴴ, m::Int, n::Int)
53+
function gaugefix!(::typeof(svd_trunc!), U, Vᴴ)
54+
m, n = size(U, 1), size(Vᴴ, 2)
5355
for j in 1:min(m, n)
5456
u = view(U, :, j)
5557
v = view(Vᴴ, j, :)

src/implementations/svd.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function svd_full!(A::AbstractMatrix, USVᴴ, alg::LAPACK_SVDAlgorithm)
144144
S[i, 1] = zero(eltype(S))
145145
end
146146

147-
dogaugefix && gaugefix!(svd_full!, U, Vᴴ, m, n)
147+
dogaugefix && gaugefix!(svd_full!, U, Vᴴ)
148148

149149
return USVᴴ
150150
end
@@ -174,7 +174,7 @@ function svd_compact!(A::AbstractMatrix, USVᴴ, alg::LAPACK_SVDAlgorithm)
174174
throw(ArgumentError("Unsupported SVD algorithm"))
175175
end
176176

177-
dogaugefix && gaugefix!(svd_compact!, U, Vᴴ, size(A)...)
177+
dogaugefix && gaugefix!(svd_compact!, U, Vᴴ)
178178

179179
return USVᴴ
180180
end
@@ -352,7 +352,7 @@ function svd_full!(A::AbstractMatrix, USVᴴ, alg::GPU_SVDAlgorithm)
352352
diagview(S) .= view(S, 1:minmn, 1)
353353
view(S, 2:minmn, 1) .= zero(eltype(S))
354354

355-
dogaugefix && gaugefix!(svd_full!, U, Vᴴ, m, n)
355+
dogaugefix && gaugefix!(svd_full!, U, Vᴴ)
356356

357357
return USVᴴ
358358
end
@@ -363,7 +363,7 @@ function svd_trunc!(A::AbstractMatrix, USVᴴ, alg::TruncatedAlgorithm{<:GPU_Ran
363363
_gpu_Xgesvdr!(A, S.diag, U, Vᴴ; alg.alg.kwargs...)
364364

365365
dogaugefix = get(alg.alg.kwargs, :gaugefix, true)::Bool
366-
dogaugefix && gaugefix!(svd_trunc!, U, S, Vᴴ, size(A)...)
366+
dogaugefix && gaugefix!(svd_trunc!, U, Vᴴ)
367367

368368
# TODO: make sure that truncation is based on maxrank, otherwise this might be wrong
369369
USVᴴtrunc, ind = truncate(svd_trunc!, (U, S, Vᴴ), alg.trunc)
@@ -391,7 +391,7 @@ function svd_compact!(A::AbstractMatrix, USVᴴ, alg::GPU_SVDAlgorithm)
391391
throw(ArgumentError("Unsupported SVD algorithm"))
392392
end
393393

394-
dogaugefix && gaugefix!(svd_compact!, U, Vᴴ, size(A)...)
394+
dogaugefix && gaugefix!(svd_compact!, U, Vᴴ)
395395

396396
return USVᴴ
397397
end

0 commit comments

Comments
 (0)