Skip to content

Optimize computation of sensitivity matrix #78

@santisoler

Description

@santisoler

Currently, the sensitivity matrix are computed using the np.sum(matrix**2, axis=0). This forces Numpy to first compute the matrix**2, which can be costly in terms of memory if matrix is large (as it usually is). Moreover, the matrix is usually computed as weights @ jacobian, another costly operation in terms of memory.

The alternative would be to always use np.einsum for it.

  • Without weights:
    np.einsum("ij,ij->j", jacobian, jacobian)
  • With weights:
    np.einsum("i,ij,ij->j", weights, jacobian, jacobian)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions