general_1d_transport: One-dimensional optimal transport for measures with more...

View source: R/transport_plan.R

general_1d_transportR Documentation

One-dimensional optimal transport for measures with more general mass

Description

One-dimensional optimal transport for measures with more general mass

Usage

general_1d_transport(
  X,
  Y,
  a = NULL,
  b = NULL,
  method = c("hilbert", "univariate")
)

Arguments

X

Data for sample one. Should be a vector if method is "univariate" or a matrix if method is "hilbert"

Y

Data for sample two Should be a vector if method is "univariate" or a matrix if method is "hilbert"

a

Empirical measure for sample one.

b

Empirical measure for sample two.

method

One of "hilbert" or "univariate"

Value

An optimal transportation plan as a list with slots "from", "to", and "mass"

Examples

set.seed(23423)
n <- 100
d <- 10
x <- matrix(stats::rnorm((n + 11)*d), n + 11 , d)
y <- matrix(stats::rnorm(n*d), n, d)

trans <- general_1d_transport(t(x), t(y))

approxOT documentation built on May 29, 2024, 3:12 a.m.