Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sparsity of the jacobian of a program #9

Merged
merged 1 commit into from
Jun 1, 2019

Conversation

shashi
Copy link
Contributor

@shashi shashi commented Jun 1, 2019

Given a program, enhances it to compute the sparsity of the Jacobian of that program by tracking which input indices are used in which output indices.

See examples at the end of the file.

If there are no branch cuts in the given function which result in different sparsity patterns, the sparsity can be computed once and reused, if not, we will need to run it on inputs that will take all the branch cuts and find the union of them. I'm looking for test cases with branch cuts that are not just max and min. :)

It's possible that something like ConcolicFuzzer's approach may figure out inputs that will take all branches.

Thanks to @vchuravy for teaching me some Cassette and compilation stuff!

TODO:

  • test coverage
  • branch cuts
  • benchmark compilation speed, try to improve. Using broadcast takes a long time!
  • integrate the API with the rest of the DiffEq ecosystem.

@ChrisRackauckas
Copy link
Member

Looks good. I'll merge it as is, refactor a bit, and open an issue to track developments. I prefer shorter 1-purpose PRs so they don't go stale, so this can keep getting improvements.

@ChrisRackauckas ChrisRackauckas merged commit 6fdb20f into JuliaDiff:master Jun 1, 2019
@ChrisRackauckas ChrisRackauckas mentioned this pull request Jun 1, 2019
4 tasks

val = Cassette.overdub(ctx,
f!,
tag(Y, ctx, Output()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it vec(Y) here?

Copy link
Contributor Author

@shashi shashi Jun 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I use LinearIndices where needed, I feel like we shouldn't change the argument to f! itself.

@shashi shashi deleted the s/program-sparsity branch June 1, 2019 17:37
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.

None yet

2 participants