JuliaDiff / JuliaDiff/ChainRulesCore.jl

ProjectTo(Adjoint{<:SparseMatrixCSC})(::Matrix) does not preserve sparsity

Open
#447 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug ProjectTo
Dominant language
Julia
Stars
267
Forks
66
PR merge metrics
No merged PRs in 30d

Description

Consider:

julia> x = sprand(3,3, 0.2)
3×3 SparseMatrixCSC{Float64, Int64} with 4 stored entries:
 0.289391   ⋅        0.43614
  ⋅        0.427879   ⋅ 
  ⋅         ⋅        0.332239

julia> xt = x'
3×3 adjoint(::SparseMatrixCSC{Float64, Int64}) with eltype Float64:
 0.289391  0.0       0.0
 0.0       0.427879  0.0
 0.43614   0.0       0.332239

julia> ProjectTo(xt)(ones(3,3))
3×3 Matrix{Float64}:
 1.0  1.0  1.0
 1.0  1.0  1.0
 1.0  1.0  1.0

cc @jieli-matrix

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 by reproducing the Julia REPL example for ProjectTo(Adjoint{<:SparseMatrixCSC})(::Matrix) and inspect the resulting type and stored entries. Done means applying ProjectTo to a dense matrix preserves the sparse structure shown by the adjoint target; no repository files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.