pub trait PotentialFunction {
type Item: CommutativeGroup;
// Required methods
fn new(n: usize, cgroup: Self::Item) -> Self;
fn len(&self) -> usize;
fn relate(
&mut self,
u: usize,
v: usize,
w: <Self::Item as Magma>::Set,
) -> Result<bool, <Self::Item as Magma>::Set>;
fn diff(&self, u: usize, v: usize) -> Option<<Self::Item as Magma>::Set>;
fn repr_diff(&self, u: usize) -> (usize, <Self::Item as Magma>::Set);
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
ポテンシャル関数。
Required Associated Types§
Sourcetype Item: CommutativeGroup
type Item: CommutativeGroup
要素の型。
Required Methods§
Sourcefn relate(
&mut self,
u: usize,
v: usize,
w: <Self::Item as Magma>::Set,
) -> Result<bool, <Self::Item as Magma>::Set>
fn relate( &mut self, u: usize, v: usize, w: <Self::Item as Magma>::Set, ) -> Result<bool, <Self::Item as Magma>::Set>
ポテンシャルの差を定義する。
$\phi(x_u)-\phi(x_v) = w$ とする。
呼び出し前の定義と矛盾しない場合、呼び出し前に $\phi(x_u)-\phi(x_v)$ が未定義なら
Ok(true) を、そうでなければ Ok(false) を返す。
矛盾する場合、定義は変化せずに Err(e) を返す。ただし、e
は呼び出し前の $\phi(x_u) - \phi(x_v)$ を表す。
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.