diff options
author | arolet <antoine.rolet@gmail.com> | 2017-07-14 15:18:57 +0900 |
---|---|---|
committer | arolet <antoine.rolet@gmail.com> | 2017-07-14 15:18:57 +0900 |
commit | cd9909cff342bb46c4233a0ead348dabebe9efdf (patch) | |
tree | 25a3592a99b00e89050c9e9545f9ccab1880d63c /test | |
parent | 55a38f8253e5831105d2c329f4d8ed77686d1330 (diff) |
Added a test for single process EMD
The multiprocess one does not seem to work on windows
Diffstat (limited to 'test')
-rw-r--r-- | test/test_emd.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test_emd.py b/test/test_emd.py new file mode 100644 index 0000000..3729d5d --- /dev/null +++ b/test/test_emd.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- + +import numpy as np +import pylab as pl +import ot + +from ot.datasets import get_1D_gauss as gauss +reload(ot.lp) + +#%% parameters + +n=5000 # nb bins + +# bin positions +x=np.arange(n,dtype=np.float64) + +# Gaussian distributions +a=gauss(n,m=20,s=5) # m= mean, s= std + +b=gauss(n,m=30,s=10) + +# loss matrix +M=ot.dist(x.reshape((n,1)),x.reshape((n,1))) +#M/=M.max() + +#%% + +print('Computing {} EMD '.format(1)) + +# emd loss 1 proc +ot.tic() +emd_loss4 = ot.emd(a,b,M) +ot.toc('1 proc : {} s') + |