@@ -25,34 +25,11 @@ using LinearAlgebra: LinearAlgebra
2525# should go.
2626@derive AnyAbstractSparseArray AbstractArrayOps
2727
28- # This type alias is a temporary workaround since `@derive`
29- # doesn't parse the `@MIME_str` macro properly at the moment.
30- const MIMEtextplain = MIME " text/plain"
31- @derive (T= AnyAbstractSparseArray,) begin
32- Base. show (:: IO , :: MIMEtextplain , :: T )
33- end
34-
35- # Wraps a sparse array but replaces the unstored values.
36- # This is used in printing in order to customize printing
37- # of zero/unstored values.
38- struct ReplacedUnstoredSparseArray{T,N,F,Parent<: AbstractArray{T,N} } < :
39- AbstractSparseArray{T,N}
40- parent:: Parent
41- getunstoredindex:: F
42- end
43- Base. parent (a:: ReplacedUnstoredSparseArray ) = a. parent
44- Base. size (a:: ReplacedUnstoredSparseArray ) = size (parent (a))
45- function isstored (a:: ReplacedUnstoredSparseArray , I:: Int... )
46- return isstored (parent (a), I... )
47- end
48- function getstoredindex (a:: ReplacedUnstoredSparseArray , I:: Int... )
49- return getstoredindex (parent (a), I... )
50- end
51- function getunstoredindex (a:: ReplacedUnstoredSparseArray , I:: Int... )
52- return a. getunstoredindex (a, I... )
28+ function Base. replace_in_print_matrix (
29+ A:: AnyAbstractSparseArray{<:Any,2} , i:: Integer , j:: Integer , s:: AbstractString
30+ )
31+ return isstored (A, CartesianIndex (i, j)) ? s : Base. replace_with_centered_mark (s)
5332end
54- eachstoredindex (a:: ReplacedUnstoredSparseArray ) = eachstoredindex (parent (a))
55- @derive ReplacedUnstoredSparseArray AbstractArrayOps
5633
5734# Special-purpose constructors
5835# ----------------------------
0 commit comments