Skip to content

Memory allocation on every step? #29

@mazaja

Description

@mazaja

Hello,

Assuming that I understand correctly what is happening here, then every time the residuals and the jacobian need to be calculated a new array is allocated and returned. Is this true? Is there any optimisation that is happening that avoids allocation?

Assuming this is true, would it be possible to expose a second trait that accepts preallocated arrays? So for example, instead of having

fn residuals(&self) -> Option<OVector<f64, U4>>

to have

fn residuals(&self, residual: &mut OVector<f64, U4>) -> bool

or

fn residuals(&self) -> &mut Option<OVector<f64, U4>>

In the former case the array can be preallocated by the solver and in the latter it can be preallocated by the problem. Similarly of course for the 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