Skip to content

Commit a406175

Browse files
authored
Zeros prints like sparse matrix (#76)
* Zeros prints like sparse matrix * Add test * Int64 -> $Int
1 parent 58e0667 commit a406175

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

Project.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "FillArrays"
22
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
3-
version = "0.7.3"
3+
version = "0.7.4"
44

55
[deps]
66
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -12,6 +12,7 @@ julia = "1"
1212

1313
[extras]
1414
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
15+
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
1516

1617
[targets]
17-
test = ["Test"]
18+
test = ["Test","Base64"]

src/FillArrays.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,4 +458,10 @@ count(f, x::AbstractFill) = f(getindex_value(x)) ? length(x) : 0
458458
include("fillalgebra.jl")
459459
include("fillbroadcast.jl")
460460

461+
##
462+
# print
463+
##
464+
Base.replace_in_print_matrix(::Zeros, ::Integer, ::Integer, s::AbstractString) =
465+
Base.replace_with_centered_mark(s)
466+
461467
end # module

test/runtests.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using FillArrays, LinearAlgebra, SparseArrays, Random, Test
1+
using FillArrays, LinearAlgebra, SparseArrays, Random, Base64, Test
22
import FillArrays: AbstractFill, RectDiagonal
33

44
@testset "fill array constructors and convert" begin
@@ -874,3 +874,7 @@ end
874874
@test adjoint(A)*fillmat adjoint(A)*Array(fillmat)
875875
end
876876
end
877+
878+
@testset "print" begin
879+
@test stringmime("text/plain", Zeros(3)) == "3-element Zeros{Float64,1,Tuple{Base.OneTo{$Int}}}:\n\n\n"
880+
end

0 commit comments

Comments
 (0)