-
-
Notifications
You must be signed in to change notification settings - Fork 81
Sparse representation of stoichiometric matrices
functions and matrices in complex-based functions
#387
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
Conversation
adding SparseArrays dependency for sparse representations of `stoich` matrices
updating `stoichmat` functions and complex network functions for sparse representation
updating tests for sparse representation of `stoichmat` and complexesmat functions
update project.toml for sparsearrays
add using SparseArrays
stoichiometric matrices
functions and matrices in complex-based functions
I think |
@yewalenikhil65 have a deadline today for a report I need to submit -- I'll review both your PRs this weekend. (And yes, the conservation law methods should get a sparse version at some point too, but we can save that for a separate PR just to keep this easier to review.) |
No problem! |
@yewalenikhil65 take a look and let me know your thoughts on the changes. Mainly I made |
I also should have made all matrices have columns = reactions now. |
This looks nice, exactly how i imagined.. Thanks! Anyway, i will get back to fixing PR In ReactionNetworkImporters after you release new Catalyst version |
- Set sparse=true for a sparse matrix representation | ||
""" | ||
function prodstoichmat(::Type{SparseMatrixCSC{Int}}, rn::ReactionSystem; smap=speciesmap(rn)) | ||
function prodstoichmat(::Type{SparseMatrixCSC{Int,Int}}, rn::ReactionSystem; smap=speciesmap(rn)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it good idea to be using SparseMatrixCSC{Int,Int}
entries ? i also remember some conversation thread in Catalyst issues to leave scope for non-integer stoichiometries later probablt in furture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now it's fine. When we get generalized stoichiometry we'll have to think about what to do here. We don't want it to be type Any
, so we may need some extra preprocessing to figure out the type, or we just error and don't allow these functions when there is symbolic stoichiometry.
I don't think this should be a big cost relative to computing the SNF, so using the transpose shouldn't be an issue. I think what @YingboMa was maybe suggesting is that we should implement and use the Bareiss method instead of SNF for finding the nullspace basis. |
from #386 (comment)
example. We use a second function argument of type
Bool
to switchsparsity
on or off. Default is dense representation as earlier, i.e.sparsity=false