Skip to content

Conversation

@mtfishman
Copy link
Member

@mtfishman mtfishman commented Jun 13, 2025

This PR creates a small KroneckerArraysBlockSparseArraysExt package extension for helping with compatibility between BlockSparseArrays.jl and KroneckerArrays.jl, specifically making it easier to work with block sparse arrays that have Kronecker arrays as blocks.

The goal is for both packages to be generic enough and featureful enough that working with block sparse arrays that have Kronecker arrays as blocks "just works", but of course that requires careful designing of each package to make that happen. A number of operations already work thanks to recent PRs I've made to both packages, I've started adding tests in this PR tracking which operations work and which ones are currently broken (marked with @test_broken).

Right now the package extension just defines a convenient constructor for making axes of block sparse arrays that have Kronecker arrays as blocks, namely it overloads the blockrange constructor for making a block unit range with Cartesian product blocks which enables writing code like the following:

using BlockArrays: Block
using BlockSparseArrays: blockrange, blocksparse
using KroneckerArrays: , ×

r = blockrange([2 × 2, 3 × 3])
d = Dict(
  Block(1, 1) => randn(2, 2)  randn(2, 2),
  Block(2, 2) => randn(3, 3)  randn(3, 3),
)
a = blocksparse(d, (r, r))

@codecov
Copy link

codecov bot commented Jun 13, 2025

Codecov Report

Attention: Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 79.18%. Comparing base (a6336d1) to head (c21f3ac).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/KroneckerArrays.jl 50.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #16      +/-   ##
==========================================
+ Coverage   74.62%   79.18%   +4.55%     
==========================================
  Files           1        2       +1     
  Lines         532      538       +6     
==========================================
+ Hits          397      426      +29     
+ Misses        135      112      -23     
Flag Coverage Δ
docs 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mtfishman mtfishman merged commit b62416f into main Jun 13, 2025
13 of 14 checks passed
@mtfishman mtfishman deleted the mf/blocksparsearraysext branch June 13, 2025 17:58
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