Skip to content
Discussion options

You must be logged in to vote

I believe that the difference here is that the dense JVP is perturbing every element of the array, while the sparse JVP is perturbing only defined elements in the array. In your example, mA_dot has 16 elements for the dense version, and 4 elements for the sparse version. When you eventually sum those, the results will be different.

This is by design: otherwise, taking the grad of a sparse matrix would require instantiating a dense matrix of the same size, which is problematic in many applications.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
5 replies
@DoTulip
Comment options

@DoTulip
Comment options

@jakevdp
Comment options

@DoTulip
Comment options

@jakevdp
Comment options

Answer selected by DoTulip
Comment options

You must be logged in to vote
2 replies
@jakevdp
Comment options

@SNMS95
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants