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

Proposal: Allow user to calculate non-diagonalized results #102

Open
marc-vdm opened this issue Jul 17, 2024 · 1 comment
Open

Proposal: Allow user to calculate non-diagonalized results #102

marc-vdm opened this issue Jul 17, 2024 · 1 comment

Comments

@marc-vdm
Copy link
Contributor

Current situation
BW diagonalizes the Inventory and Characterized results.
This is great to get access to all direct biosphere contributions from all activities.

e.g. here, here, here and here

Proposal
I suggest we keep this the default, but allow optional arguments (e.g. disaggregate_activities for lca.lci and disaggregate_biosphere for lca.lcia) that can be set to False to not dis-aggregate results.

This will increase calculation speed when active as the matrix multiplications will be with smaller matrices, though not by substantial amounts.

Why
While this effect is not substantial -especially for a single calculation-, it can help speed up repeat calculations where the dis-aggregated results are not needed, e.g. Monte-Carlo or Graph-Traversal could make use of this.

@cmutel
Copy link
Member

cmutel commented Sep 2, 2024

It will be hard to remove the diagonalization during matrix construction, as the input data doesn't have row and column indices. You would really be fighting against the code, and I don't think that's worth doing (and I don't want to add to the already high complexity). But I can see doing the following:

  • Limit to pypardiso, and use its underlying code to skip the matrix identity checks
  • Set a flag on Monte Carlo to drop pypardiso cached results
    (These two steps could be applied to the main LCA class, actually)
  • Don't diagonalize the supply array
  • Don't create matrices for characterized_inventory
    I think @marc-vdm you would need to start this though...

One thing we would need to profile carefully before changing is whether we want to switch to numpy array multiplication instead of sparse matrix stuff. My guess is that it would make sense for the characterization array, but not for the biosphere (big increase in memory usage to build as a dense array).

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

No branches or pull requests

2 participants