Skip to content

Add accum method for symmetric sparse matrices.#1609

Open
samuelsonric wants to merge 1 commit intoFluxML:masterfrom
samuelsonric:master
Open

Add accum method for symmetric sparse matrices.#1609
samuelsonric wants to merge 1 commit intoFluxML:masterfrom
samuelsonric:master

Conversation

@samuelsonric
Copy link
Copy Markdown

This PR adds special accum methods for Symmetric (and Hermitian)-wrapped sparse matrices. Currently, the function computes a dense matric.

julia> using Zygote, LinearAlgebra, SparseArrays

julia> A = Hermitian(sprand(100, 100, .1));

julia> Zygote.accum(A, A) |> typeof
Matrix{Float64}

With this change, the functon will preserve the sparsity of the inputs.

julia> Zygote.accum(A, A) |> typeof
Hermitian{Float64, SparseMatrixCSC{Float64, Int64}}

PR Checklist

  • [ X ] Tests are added
  • [ X ] Documentation, if applicable

@samuelsonric
Copy link
Copy Markdown
Author

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.

1 participant