You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After return-position-impl-trait-in-trait feature gets into the stable, I would like to change the System trait to have the following API (some details omitted):
traitSystem:Problem{fnresiduals<'a>(&self,x:&'a Vector) -> implIterator<Item = Self::Field> + 'a;fneval(&self,x:&Vector,fx:&mutVector){// default impl, fill fx using self.residuals(x)}fnnorm(&self,x:&Vector) -> Self::Field{// default impl, sqrt of sum of self.residuals(x)}}
The main advantage is that by having residuals iterator the main interface, default implementation of norm can use that instead of eval and thus avoiding the need of allocating a temporary vector for fx. I believe that creating an iterator of residuals will not be more struggle than evaluating the system directly to fx. The iterator approach is already successfully used in the testing module.
The text was updated successfully, but these errors were encountered:
After return-position-impl-trait-in-trait feature gets into the stable, I would like to change the
System
trait to have the following API (some details omitted):The main advantage is that by having
residuals
iterator the main interface, default implementation ofnorm
can use that instead ofeval
and thus avoiding the need of allocating a temporary vector forfx
. I believe that creating an iterator of residuals will not be more struggle than evaluating the system directly tofx
. The iterator approach is already successfully used in thetesting
module.The text was updated successfully, but these errors were encountered: