ITensor / ITensor/BlockSparseArrays.jl

[ENHANCEMENT] Store the broadcast style of the blocks in `BlockSparseArrayStyle`

Open
#60 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Julia
Stars
3
Forks
3
Avg merge
14m
Merged PRs (30d)
3

Description

Store the broadcast style of the blocks in BlockSparseArrayStyle. This would help with generic code, for example if a block sparse array has GPU blocks, BlockSparseArrayStyle could keep track of that by storing the block style as the corresponding GPU array broadcasting style. Then, we can more accurately determine the destination type of a broadcast expression from all of the arguments that were input.

This is analogous to how ArrayLayouts.MemoryLayout definitions for BlockArrays.jlBlockedArray store information about the memory layout of the blocks: https://github.com/JuliaArrays/BlockArrays.jl/blob/v1.4.0/src/blocklinalg.jl#L82-L83

Currently, we determine the output type just based on the first argument: https://github.com/ITensor/BlockSparseArrays.jl/blob/6211e57343f0ef4eeef396a96def9d034baad491/src/blocksparsearrayinterface/broadcast.jl#L37 which is not ideal and could make some mistakes (like making a destination with sparse blocks that should have dense blocks).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/blocksparsearrayinterface/broadcast.jl, especially the output-type logic around line 37, and compare it with the BlockArrays.jl blocklinalg.jl memory-layout definitions at lines 82-83. Implement storage of the blocks' broadcast style in BlockSparseArrayStyle, then ensure broadcast destination types are determined from all input arguments rather than only the first.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.