Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty printing for sparse arrays #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Sep 7, 2021

This PR makes the display of block-diagonals similar to that of diagonals, by replacing the zero elements with dots.

After this PR

julia> Diagonal(1:4)
4×4 Diagonal{Int64, UnitRange{Int64}}:
 1      
   2    
     3  
       4

julia> BlockDiagonal([Diagonal(1:2), Diagonal(3:4)])
4×4 BlockDiagonal{Int64, Diagonal{Int64, UnitRange{Int64}}}:
 1      
   2    
     3  
       4

This makes the structure easy to interpret

@codecov
Copy link

codecov bot commented Sep 7, 2021

Codecov Report

Merging #81 (5fd53c3) into master (368887a) will decrease coverage by 0.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #81      +/-   ##
==========================================
- Coverage   95.61%   95.48%   -0.13%     
==========================================
  Files           5        5              
  Lines         319      310       -9     
==========================================
- Hits          305      296       -9     
  Misses         14       14              
Impacted Files Coverage Δ
src/blockdiagonal.jl 85.50% <100.00%> (+0.65%) ⬆️
src/linalg.jl 94.52% <0.00%> (-0.22%) ⬇️
src/base_maths.jl 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 368887a...5fd53c3. Read the comment docs.

@mattiasvillani
Copy link

As I understand this, this would also automatically cover the case with a block diagonal matrix of banded matrices from BandedMatrices.jl, and similar packages for structured matrices, which would be very nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants