pub struct WasmSinkhorn { /* private fields */ }Expand description
Sinkhorn optimal transport solver for WASM
Implementations§
Source§impl WasmSinkhorn
impl WasmSinkhorn
Sourcepub fn new(regularization: f64, max_iterations: usize) -> Self
pub fn new(regularization: f64, max_iterations: usize) -> Self
Create a new Sinkhorn solver
@param regularization - Entropy regularization (0.01-0.1 typical) @param max_iterations - Maximum iterations (100-1000 typical)
Sourcepub fn distance(
&self,
source: &[f64],
target: &[f64],
dim: usize,
) -> Result<f64, JsError>
pub fn distance( &self, source: &[f64], target: &[f64], dim: usize, ) -> Result<f64, JsError>
Compute transport cost between point clouds
Sourcepub fn solve_transport(
&self,
cost_matrix: &[f64],
source_weights: &[f64],
target_weights: &[f64],
n: usize,
m: usize,
) -> Result<TransportResult, JsError>
pub fn solve_transport( &self, cost_matrix: &[f64], source_weights: &[f64], target_weights: &[f64], n: usize, m: usize, ) -> Result<TransportResult, JsError>
Solve optimal transport and return transport plan
Trait Implementations§
Source§impl From<WasmSinkhorn> for JsValue
impl From<WasmSinkhorn> for JsValue
Source§fn from(value: WasmSinkhorn) -> Self
fn from(value: WasmSinkhorn) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for WasmSinkhorn
impl FromWasmAbi for WasmSinkhorn
Source§impl IntoWasmAbi for WasmSinkhorn
impl IntoWasmAbi for WasmSinkhorn
Source§impl LongRefFromWasmAbi for WasmSinkhorn
impl LongRefFromWasmAbi for WasmSinkhorn
Source§impl OptionFromWasmAbi for WasmSinkhorn
impl OptionFromWasmAbi for WasmSinkhorn
Source§impl OptionIntoWasmAbi for WasmSinkhorn
impl OptionIntoWasmAbi for WasmSinkhorn
Source§impl RefFromWasmAbi for WasmSinkhorn
impl RefFromWasmAbi for WasmSinkhorn
Source§type Anchor = RcRef<WasmSinkhorn>
type Anchor = RcRef<WasmSinkhorn>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for WasmSinkhorn
impl RefMutFromWasmAbi for WasmSinkhorn
Source§impl TryFromJsValue for WasmSinkhorn
impl TryFromJsValue for WasmSinkhorn
Source§impl VectorFromWasmAbi for WasmSinkhorn
impl VectorFromWasmAbi for WasmSinkhorn
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[WasmSinkhorn]>
Source§impl VectorIntoWasmAbi for WasmSinkhorn
impl VectorIntoWasmAbi for WasmSinkhorn
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[WasmSinkhorn]>) -> Self::Abi
Source§impl WasmDescribeVector for WasmSinkhorn
impl WasmDescribeVector for WasmSinkhorn
impl SupportsConstructor for WasmSinkhorn
impl SupportsInstanceProperty for WasmSinkhorn
impl SupportsStaticProperty for WasmSinkhorn
Auto Trait Implementations§
impl Freeze for WasmSinkhorn
impl RefUnwindSafe for WasmSinkhorn
impl Send for WasmSinkhorn
impl Sync for WasmSinkhorn
impl Unpin for WasmSinkhorn
impl UnwindSafe for WasmSinkhorn
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
Mutably borrows from an owned value. Read more
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.