ITensor / ITensor/BlockSparseArrays.jl

[ENHANCEMENT] `Base.map!` needs refactor

Open
#112 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

#src/blocksparsearrayinterface/map.jl
@interface interface::AbstractBlockSparseArrayInterface function Base.map!(
  f, a_dest::AbstractArray, a_srcs::AbstractArray...
)

Base.map! is not compatible with the design of KroneckerMatrix.

  • line 27, indexing a SparseArraysBase.SparseMatrixDOK{KroneckerMatrix fails as it tries to call Base.similar(::Type{KroneckerMatrix{...}}, dims::Tuple{Int,Int}) which cannot be defined (there is not enough information in type + size to init a KroneckerMatrix).
  • line 39, it calls iszero on a SubArray{Float64, 2, KroneckerMatrix}. iszero is defined for a KroneckerMatrix, but the wrapper type prevents the dispatch and the fall back option errors on getindex

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/map.jl and inspect the Base.map! interface around lines 27 and 39. Reproduce the failures involving SparseMatrixDOK{KroneckerMatrix}, Base.similar, and iszero on a SubArray. Done means Base.map! works with KroneckerMatrix without requiring unavailable type-and-size initialization or failing through the wrapper type.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.