Skip to content

Commit

Permalink
Fix #11747 by defining showarray instead of show for FactorComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Jun 18, 2015
1 parent 6b5b7d8 commit a23caa0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions base/sparse/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module CHOLMOD

import Base: (*), convert, copy, eltype, getindex, show, size,
import Base: (*), convert, copy, eltype, getindex, show, showarray, size,
linearindexing, LinearFast, LinearSlow

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

function show(io::IO, FC::FactorComponent)
# FactorComponent is a subtype of AbstractArray and we therefore define showarray instead of show
function showarray(io::IO, FC::FactorComponent; kargs...)
println(io, typeof(FC))
showfactor(io, Factor(FC))
end
Expand Down Expand Up @@ -1011,7 +1012,6 @@ function size(F::Factor, i::Integer)
return 1
end


linearindexing(::Dense) = LinearFast()

size(FC::FactorComponent, i::Integer) = size(FC.F, i)
Expand Down
5 changes: 4 additions & 1 deletion test/sparsedir/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -588,5 +588,8 @@ Dp = spdiagm(dp)
@test_throws CHOLMOD.CHOLMODException Fs[:DUPt]
@test_throws CHOLMOD.CHOLMODException Fs[:PLD]

# Issue 11745
# Issue 11745 - row and column pointers were not sorted in sparse(Factor)
sparse(cholfact(sparse(Float64[ 10 1 1 1; 1 10 0 0; 1 0 10 0; 1 0 0 10]))); gc()

# Issue 11747 - Wrong show method defined for FactorComponent
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])

1 comment on commit a23caa0

@tkelman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't hurt to check the return values of these 2 tests, would it?

Please sign in to comment.