Пример #1
0
def test(arr, k):
    best_indexes = utils.argsort_best(arr, k, reverse=True)
    
    print 'Array = %s' % arr
    print 'Best indexes = %s' % best_indexes
    print 'Best elements = %s' % arr[best_indexes]
    print 'Number of indexes = %s' % len(best_indexes)
    print 'Best element = %s' % np.max(arr)
    print 'Took %.2f sec.' % utils.argsort_best.time_taken
    
    argsort(arr)
    print 'To be compared with full sorting takes %.2f sec.' % argsort.time_taken 
Пример #2
0
def test(arr, k):
    best_indexes = utils.argsort_best(arr, k, reverse=True)

    print 'Array = %s' % arr
    print 'Best indexes = %s' % best_indexes
    print 'Best elements = %s' % arr[best_indexes]
    print 'Number of indexes = %s' % len(best_indexes)
    print 'Best element = %s' % np.max(arr)
    print 'Took %.2f sec.' % utils.argsort_best.time_taken

    argsort(arr)
    print 'To be compared with full sorting takes %.2f sec.' % argsort.time_taken
Пример #3
0
def argsort_best(arr, best_k, reverse=False):
    return utils.argsort_best(arr, best_k, reverse)