Changeset 0484dc1 for python


Ignore:
Timestamp:
Mar 1, 2006, 4:15:54 AM (19 years ago)
Author:
Paul Brossier <piem@altern.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
300adc3
Parents:
dcc8d90
Message:

use a copy for the median
use a copy for the median

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/aubio/median.py

    rdcc8d90 r0484dc1  
    2828
    2929def short_find(a, rank):
    30     a.sort()
    31     return a[rank - 1]
     30    """ find the rank-th value in sorted a """
     31    # copy to b before sorting
     32    b = a[:]
     33    b.sort()
     34    return b[rank - 1]
    3235
    33 # Find the rank'th-smallest value in a, in worst-case linear time.
    3436def percental(a, rank):
     37    """ Find the rank'th-smallest value in a, in worst-case linear time. """
    3538    n = len(a)
    3639    assert 1 <= rank <= n
Note: See TracChangeset for help on using the changeset viewer.