summaryrefslogtreecommitdiff
path: root/numpy/lib/benchmarks/bench_arraysetops.py
diff options
context:
space:
mode:
authorrgommers <ralf.gommers@googlemail.com>2011-03-07 09:12:50 +0800
committerrgommers <ralf.gommers@googlemail.com>2011-03-11 12:27:02 +0800
commit44ae46c70d0b9cb4909bfafe1e4dbef3cd90f5b9 (patch)
tree9c833c7eba8b72c3306218d2a86e3c184290dee4 /numpy/lib/benchmarks/bench_arraysetops.py
parentf791984cf1d8aedaeaf4fa36db539744d88de051 (diff)
downloadnumpy-44ae46c70d0b9cb4909bfafe1e4dbef3cd90f5b9.tar.gz
DEP: remove unique1d, setmember1d and intersect1d_nu.
Diffstat (limited to 'numpy/lib/benchmarks/bench_arraysetops.py')
-rw-r--r--numpy/lib/benchmarks/bench_arraysetops.py65
1 files changed, 0 insertions, 65 deletions
diff --git a/numpy/lib/benchmarks/bench_arraysetops.py b/numpy/lib/benchmarks/bench_arraysetops.py
deleted file mode 100644
index 2c77fb758..000000000
--- a/numpy/lib/benchmarks/bench_arraysetops.py
+++ /dev/null
@@ -1,65 +0,0 @@
-import numpy as np
-import time
-from numpy.lib.arraysetops import *
-
-def bench_unique1d( plot_results = False ):
- exponents = np.linspace( 2, 7, 9 )
- ratios = []
- nItems = []
- dt1s = []
- dt2s = []
- for ii in exponents:
-
- nItem = 10 ** ii
- print 'using %d items:' % nItem
- a = np.fix( nItem / 10 * np.random.random( nItem ) )
-
- print 'unique:'
- tt = time.clock()
- b = np.unique( a )
- dt1 = time.clock() - tt
- print dt1
-
- print 'unique1d:'
- tt = time.clock()
- c = unique1d( a )
- dt2 = time.clock() - tt
- print dt2
-
-
- if dt1 < 1e-8:
- ratio = 'ND'
- else:
- ratio = dt2 / dt1
- print 'ratio:', ratio
- print 'nUnique: %d == %d\n' % (len( b ), len( c ))
-
- nItems.append( nItem )
- ratios.append( ratio )
- dt1s.append( dt1 )
- dt2s.append( dt2 )
-
- assert np.alltrue( b == c )
-
- print nItems
- print dt1s
- print dt2s
- print ratios
-
- if plot_results:
- import pylab
-
- def plotMe( fig, fun, nItems, dt1s, dt2s ):
- pylab.figure( fig )
- fun( nItems, dt1s, 'g-o', linewidth = 2, markersize = 8 )
- fun( nItems, dt2s, 'b-x', linewidth = 2, markersize = 8 )
- pylab.legend( ('unique', 'unique1d' ) )
- pylab.xlabel( 'nItem' )
- pylab.ylabel( 'time [s]' )
-
- plotMe( 1, pylab.loglog, nItems, dt1s, dt2s )
- plotMe( 2, pylab.plot, nItems, dt1s, dt2s )
- pylab.show()
-
-if __name__ == '__main__':
- bench_unique1d( plot_results = True )