Skip to content

Commit a23caa0

Browse files
committed
Fix #11747 by defining showarray instead of show for FactorComponent
1 parent 6b5b7d8 commit a23caa0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

base/sparse/cholmod.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module CHOLMOD
44

5-
import Base: (*), convert, copy, eltype, getindex, show, size,
5+
import Base: (*), convert, copy, eltype, getindex, show, showarray, size,
66
linearindexing, LinearFast, LinearSlow
77

88
import Base.LinAlg: (\), A_mul_Bc, A_mul_Bt, Ac_ldiv_B, Ac_mul_B, At_ldiv_B, At_mul_B,
@@ -973,7 +973,8 @@ function show(io::IO, F::Factor)
973973
showfactor(io, F)
974974
end
975975

976-
function show(io::IO, FC::FactorComponent)
976+
# FactorComponent is a subtype of AbstractArray and we therefore define showarray instead of show
977+
function showarray(io::IO, FC::FactorComponent; kargs...)
977978
println(io, typeof(FC))
978979
showfactor(io, Factor(FC))
979980
end
@@ -1011,7 +1012,6 @@ function size(F::Factor, i::Integer)
10111012
return 1
10121013
end
10131014

1014-
10151015
linearindexing(::Dense) = LinearFast()
10161016

10171017
size(FC::FactorComponent, i::Integer) = size(FC.F, i)

test/sparsedir/cholmod.jl

+4-1
Original file line numberDiff line numberDiff line change
@@ -588,5 +588,8 @@ Dp = spdiagm(dp)
588588
@test_throws CHOLMOD.CHOLMODException Fs[:DUPt]
589589
@test_throws CHOLMOD.CHOLMODException Fs[:PLD]
590590

591-
# Issue 11745
591+
# Issue 11745 - row and column pointers were not sorted in sparse(Factor)
592592
sparse(cholfact(sparse(Float64[ 10 1 1 1; 1 10 0 0; 1 0 10 0; 1 0 0 10]))); gc()
593+
594+
# Issue 11747 - Wrong show method defined for FactorComponent
595+
Base.writemime(IOBuffer(), MIME"text/plain"(), cholfact(sparse(Float64[ 10 1 1 1; 1 10 0 0; 1 0 10 0; 1 0 0 10]))[:L])

0 commit comments

Comments
 (0)