Skip to main content

UserTerm

Trait UserTerm 

Source
pub trait UserTerm: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn rows(&self) -> usize;
    fn eval(&self, systems: &[&System]) -> Result<Vec<Vec<f64>>>;

    // Provided method
    fn grad(&self, _s: &System, _params: &[Param]) -> Result<Option<Vec<f64>>> { ... }
}
Expand description

利用者が定義する項(OpticStudio の UDOP 相当)。Python の関数などを包む

Required Methods§

Source

fn name(&self) -> &str

名前(表示用)

Source

fn rows(&self) -> usize

残差の数(系によらず一定)

Source

fn eval(&self, systems: &[&System]) -> Result<Vec<Vec<f64>>>

系の並びの残差をまとめて求める(系ごとに rows 個)。差分のヤコビアンでは、ずらした系をすべて 1 回で渡す

Provided Methods§

Source

fn grad(&self, _s: &System, _params: &[Param]) -> Result<Option<Vec<f64>>>

残差の偏微分(行優先 [残差][params])。None なら差分にする

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§