Skip to content

Commit 89ca5ee

Browse files
authored
Merge pull request #115 from JuliaLinearAlgebra/an/morecoverage
Some more test coverage to svd.jl
2 parents 61a9188 + dfe080a commit 89ca5ee

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

src/svd.jl

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ function Base.getproperty(F::BidiagonalFactorization, s::Symbol)
392392
τl,
393393
)
394394
elseif s === :rightQ
395+
# FIXME! Can I get the LQPackedQ versino going to avoid the copy?
395396
# return transpose(LinearAlgebra.LQPackedQ(R, τr)) # FixMe! check that this shouldn't be adjoint
396397
LinearAlgebra.QRPackedQ(copy(transpose(R)), τr)
397398
else
@@ -502,30 +503,32 @@ function rmul!(A::AbstractMatrix, adjQ::AdjointQtype{<:Any,<:LinearAlgebra.Hesse
502503
return A
503504
end
504505

505-
function rmul!(A::AbstractMatrix, Q::LinearAlgebra.LQPackedQ)
506-
507-
m, n = size(A)
508-
509-
if n != size(Q, 1)
510-
throw(DimensionMismatch(""))
511-
end
512-
513-
for i = 1:m
514-
for l = length(Q.τ):-1:1
515-
τl = Q.τ[l]
516-
= view(Q.factors, l, (l+1):n)
517-
aᵀ = transpose(view(A, i, (l+1):n))
518-
aᵀv = A[i, l]
519-
if length(ṽ) > 0
520-
aᵀv += aᵀ *
521-
end
522-
A[i, l] -= aᵀv * τl
523-
aᵀ .-= aᵀv .* τl .*'
524-
end
525-
end
526-
527-
return A
528-
end
506+
# FIXME! Commented out for now because we currently don't produce
507+
# any LQPackedQ matrices.
508+
# function rmul!(A::AbstractMatrix, Q::LinearAlgebra.LQPackedQ)
509+
510+
# m, n = size(A)
511+
512+
# if n != size(Q, 1)
513+
# throw(DimensionMismatch(""))
514+
# end
515+
516+
# for i = 1:m
517+
# for l = length(Q.τ):-1:1
518+
# τl = Q.τ[l]
519+
# ṽ = view(Q.factors, l, (l+1):n)
520+
# aᵀ = transpose(view(A, i, (l+1):n))
521+
# aᵀv = A[i, l]
522+
# if length(ṽ) > 0
523+
# aᵀv += aᵀ * ṽ
524+
# end
525+
# A[i, l] -= aᵀv * τl
526+
# aᵀ .-= aᵀv .* τl .* ṽ'
527+
# end
528+
# end
529+
530+
# return A
531+
# end
529532

530533
# Overload LinearAlgebra methods
531534

test/svd.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,10 @@ using Test, GenericLinearAlgebra, LinearAlgebra, Quaternions, DoubleFloats
235235
F = GenericLinearAlgebra._svd!(copy(B))
236236
@test diag(F.U' * B * F.Vt') F.S rtol = 5e-15
237237
end
238+
239+
@testset "HessenbergQ multiplicatin" begin
240+
A = randn(10, 10)
241+
BF = GenericLinearAlgebra.bidiagonalize!(copy(A))
242+
@test BF.rightQ'*Matrix(I, size(A)...)*BF.rightQ I
243+
end
238244
end

0 commit comments

Comments
 (0)