## Define two dataset
X = stats::rnorm(2000)
Y = stats::rnorm(2000 , mean = 5 )
bw = base::c(0.1)
muX = SBCK::SparseHist( X , bw )
muY = SBCK::SparseHist( Y , bw )
## Find solution
ot = OTNetworkSimplex$new()
ot$fit( muX , muY )
print( sum(ot$plan) ) ## Must be equal to 1
print( ot$success ) ## If solve is success
print( sqrt(sum(ot$plan * ot$C)) ) ## Cost of plan
Run the code above in your browser using DataLab