pub struct Problem {
pub configs: Vec<System>,
pub vars: Vec<Var>,
pub terms: Vec<Term>,
pub jac: JacMode,
pub fd_rel: f64,
pub fd_rel_noisy: f64,
pub analytic_min: usize,
pub stopped_as_vignetted: bool,
}Expand description
最適化の問題
Fields§
§configs: Vec<System>構成(多重構成・ズームの各状態)。1 つなら単一の系
vars: Vec<Var>§terms: Vec<Term>§jac: JacMode§fd_rel: f64差分の刻みの相対値(刻み = rel × max(|値|, 種類ごとの目安))
fd_rel_noisy: f64回転対称でない系の波面の項の差分の刻みの相対値。射出瞳を実光線の外挿で求める(OpticStudio と同じ)ので 評価関数に 1e-8 程度の揺れがあり、小さい刻みでは差分が揺れに負ける
analytic_min: usizeJacMode::Auto で解析的に求める列の最少の数(項ごと。これより少なければ中心差分)。
既定 16 は、11 面の系のスポットで解析的と中心差分の時間が並ぶ列の数。0 なら常に解析的
stopped_as_vignetted: bool瞳の光線を並べる項(スポット・波面・重心)で、追跡が止まった光線(全反射・面に届かない)を、けられた光線と
同じく除く(既定 false: 項が評価できない誤り)。除いた数は Problem::ray_counts
Implementations§
Source§impl Problem
impl Problem
pub fn new(configs: Vec<System>) -> Problem
Sourcepub fn with_configs(&self, configs: Vec<System>) -> Problem
pub fn with_configs(&self, configs: Vec<System>) -> Problem
構成だけ configs に替えた問題(今の構成は写さない)
Sourcepub fn add_var(&mut self, spec: &str) -> Result<&mut Var>
pub fn add_var(&mut self, spec: &str) -> Result<&mut Var>
文字列で変数を足す(System::param の書き方。最初の構成で解釈する)
Sourcepub fn add_default(
&mut self,
kind: DefaultMerit,
rings: usize,
reference: RmsRef,
)
pub fn add_default( &mut self, kind: DefaultMerit, rings: usize, reference: RmsRef, )
既定の評価関数: 構成ごと・定義済みの視野ごとに、重みのある全波長の RMS の項を足す(重みは視野の重み、 重み 0 の視野は除く)
Sourcepub fn n_residuals(&self) -> usize
pub fn n_residuals(&self) -> usize
残差の数
Sourcepub fn term_values(&self, x: &[f64]) -> Result<Vec<TermValue>>
pub fn term_values(&self, x: &[f64]) -> Result<Vec<TermValue>>
項ごとの値: 目標のある項は量そのもの(TermValue::Quantity)、ない項は残差の √Σr²(TermValue::Rms。
スポット・波面の項では RMS そのもの)
Sourcepub fn merit_and_terms(&self, x: &[f64]) -> Result<(f64, Vec<TermValue>)>
pub fn merit_and_terms(&self, x: &[f64]) -> Result<(f64, Vec<TermValue>)>
Self::merit と Self::term_values(系を 1 回作り、項を 1 回ずつ評価する。値はそれぞれと同じ)
Sourcepub fn term_values_contrib(
&self,
x: &[f64],
) -> Result<(Vec<TermValue>, Vec<f64>)>
pub fn term_values_contrib( &self, x: &[f64], ) -> Result<(Vec<TermValue>, Vec<f64>)>
Self::term_values と、項ごとの評価関数への寄与 [%](重みを掛けた残差の 2 乗の和の、全体に対する割合。
OpticStudio の評価関数エディタの % Contrib と同じ。全体が 0 なら 0)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Problem
impl !UnwindSafe for Problem
impl Freeze for Problem
impl Send for Problem
impl Sync for Problem
impl Unpin for Problem
impl UnsafeUnpin for Problem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more