WrapFullJit
- class corsort.wrap_full_jit.JitCorsortBorda(compute_history=False, record_states=False)[source]
Corsort “Borda”. Cf.
WrapFullJit
.Examples
>>> sort = JitCorsortBorda()
- class corsort.wrap_full_jit.JitCorsortDeltaMaxDelta(compute_history=False, record_states=False)[source]
Corsort with delta core scorer, max-knowledge tie-break, and delta output scorer. Cf.
WrapFullJit
.Examples
>>> sort = JitCorsortDeltaMaxDelta()
- class corsort.wrap_full_jit.JitCorsortDeltaMaxRho(compute_history=False, record_states=False)[source]
Corsort with delta core scorer, max-knowledge tie-break, and rho output scorer. Cf.
WrapFullJit
.Examples
>>> sort = JitCorsortDeltaMaxRho()
- class corsort.wrap_full_jit.JitCorsortDeltaSumDelta(compute_history=False, record_states=False)[source]
Corsort with delta core scorer, sum-knowledge tie-break, and delta output scorer. Cf.
WrapFullJit
.Examples
>>> sort = JitCorsortDeltaSumDelta()
- class corsort.wrap_full_jit.JitCorsortDeltaSumRho(compute_history=False, record_states=False)[source]
Corsort with delta core scorer, sum-knowledge tie-break, and rho output scorer. Cf.
WrapFullJit
.Examples
>>> sort = JitCorsortDeltaSumRho()
- class corsort.wrap_full_jit.JitCorsortRhoMaxDelta(compute_history=False, record_states=False)[source]
Corsort with rho core scorer, max-knowledge tie-break, and delta output scorer. Cf.
WrapFullJit
.Examples
>>> sort = JitCorsortRhoMaxDelta()
- class corsort.wrap_full_jit.JitCorsortRhoMaxRho(compute_history=False, record_states=False)[source]
Corsort with rho core scorer, max-knowledge tie-break, and rho output scorer. Cf.
WrapFullJit
.Examples
>>> sort = JitCorsortRhoMaxRho()
- class corsort.wrap_full_jit.JitCorsortRhoSumDelta(compute_history=False, record_states=False)[source]
Corsort with rho core scorer, sum-knowledge tie-break, and delta output scorer. Cf.
WrapFullJit
.Examples
>>> sort = JitCorsortRhoSumDelta()
- class corsort.wrap_full_jit.JitCorsortRhoSumRho(compute_history=False, record_states=False)[source]
Corsort with rho core scorer, sum-knowledge tie-break, and rho output scorer. Cf.
WrapFullJit
.Examples
>>> sort = JitCorsortRhoSumRho()
- class corsort.wrap_full_jit.JitHeapsort(compute_history=False, record_states=False)[source]
Heapsort. Cf.
WrapFullJit
.Examples
>>> sort = JitHeapsort()
- class corsort.wrap_full_jit.WrapFullJit(jit_sort, compute_history=False, record_states=False)[source]
Delegate everything (sort and scores) to a jit function.
- Parameters:
- history_comparisons_
History of the pairwise comparisons. Tuple (i, j) means that items of indices i and j were compared, and that perm[i] < perm[j].
Examples
>>> corsort = WrapFullJit(jit_sort=jit_corsort_borda, compute_history=True, record_states=True) >>> corsort.__name__ 'corsort_borda' >>> np.random.seed(22) >>> n = 15 >>> p = np.random.permutation(n) >>> corsort(p).n_comparisons_ 43 >>> entropy_bound(n) 40.24212... >>> corsort.history_distances_ [76, 64, 76, 74, 74, 72, 62, 62, 54, 48, 48, 48, 44, 46, 44, 44, 44, 36, 36, 26, 22, 18, 18, 16, 14, 18, 14, 12, 10, 12, 8, 6, 6, 10, 8, 6, 8, 6, 6, 4, 4, 0, 2, 0] >>> corsort.history_comparisons_ [(0, 1), (3, 2), (3, 0), (0, 4), (4, 1), (2, 4), (2, 0), (0, 5), (7, 6), (7, 0), (3, 7), (0, 8), (8, 5), (5, 1), (8, 6), (2, 7), (9, 10), (8, 10), (11, 8), (11, 7), (13, 12), (8, 12), (12, 10), (6, 12), (4, 6), (12, 1), (10, 1), (13, 0), (2, 13), (11, 2), (11, 3), (7, 13), (9, 0), (2, 9), (4, 8), (5, 12), (6, 5), (7, 9), (13, 9), (14, 0), (2, 14), (13, 14), (14, 9)] >>> corsort.history_comparisons_values_ [(7, 14), (1, 2), (1, 7), (7, 8), (8, 14), (2, 8), (2, 7), (7, 11), (3, 10), (3, 7), (1, 3), (7, 9), (9, 11), (11, 14), (9, 10), (2, 3), (6, 13), (9, 13), (0, 9), (0, 3), (4, 12), (9, 12), (12, 13), (10, 12), (8, 10), (12, 14), (13, 14), (4, 7), (2, 4), (0, 2), (0, 1), (3, 4), (6, 7), (2, 6), (8, 9), (11, 12), (10, 11), (3, 6), (4, 6), (5, 7), (2, 5), (4, 5), (5, 6)]
>>> p = np.array([2, 1, 3, 0]) >>> corsort(p).history_states_ [[2, 1, 3, 0], [1, 3, 0, 2], [1, 0, 2, 3], [1, 0, 2, 3], [1, 0, 2, 3], [0, 1, 2, 3]]