Dist m4ri 0.16.1
Computing distance of a classical or quantum CSS code
Loading...
Searching...
No Matches
sort.h File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
Include dependency graph for sort.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TIM_SORT_RUN_T
struct  TEMP_STORAGE_T

Macros

#define SORT_CMP(x, y)
#define SORT_SAFE_CPY   0
#define TIM_SORT_STACK_SIZE   128
#define SORT_SWAP(x, y)
#define SORT_COMMON_H
#define MAX(x, y)
#define MIN(x, y)
#define __has_builtin(x)
#define CLZ   clzll
#define SORT_CONCAT(x, y)
#define SORT_MAKE_STR1(x, y)
#define SORT_MAKE_STR(x)
#define SMALL_SORT_BND   16
#define SMALL_SORT   BITONIC_SORT
#define SMALL_STABLE_SORT   BINARY_INSERTION_SORT
#define SORT_TYPE_CPY   SORT_MAKE_STR(sort_type_cpy)
#define SORT_TYPE_MOVE   SORT_MAKE_STR(sort_type_move)
#define SORT_NEW_BUFFER   SORT_MAKE_STR(sort_new_buffer)
#define SORT_DELETE_BUFFER   SORT_MAKE_STR(sort_delete_buffer)
#define BITONIC_SORT   SORT_MAKE_STR(bitonic_sort)
#define BINARY_INSERTION_FIND   SORT_MAKE_STR(binary_insertion_find)
#define BINARY_INSERTION_SORT_START   SORT_MAKE_STR(binary_insertion_sort_start)
#define BINARY_INSERTION_SORT   SORT_MAKE_STR(binary_insertion_sort)
#define REVERSE_ELEMENTS   SORT_MAKE_STR(reverse_elements)
#define COUNT_RUN   SORT_MAKE_STR(count_run)
#define CHECK_INVARIANT   SORT_MAKE_STR(check_invariant)
#define TIM_SORT   SORT_MAKE_STR(tim_sort)
#define TIM_SORT_RESIZE   SORT_MAKE_STR(tim_sort_resize)
#define TIM_SORT_MERGE   SORT_MAKE_STR(tim_sort_merge)
#define TIM_SORT_COLLAPSE   SORT_MAKE_STR(tim_sort_collapse)
#define HEAP_SORT   SORT_MAKE_STR(heap_sort)
#define MEDIAN   SORT_MAKE_STR(median)
#define QUICK_SORT   SORT_MAKE_STR(quick_sort)
#define MERGE_SORT   SORT_MAKE_STR(merge_sort)
#define MERGE_SORT_RECURSIVE   SORT_MAKE_STR(merge_sort_recursive)
#define MERGE_SORT_IN_PLACE   SORT_MAKE_STR(merge_sort_in_place)
#define MERGE_SORT_IN_PLACE_RMERGE   SORT_MAKE_STR(merge_sort_in_place_rmerge)
#define MERGE_SORT_IN_PLACE_BACKMERGE   SORT_MAKE_STR(merge_sort_in_place_backmerge)
#define MERGE_SORT_IN_PLACE_FRONTMERGE   SORT_MAKE_STR(merge_sort_in_place_frontmerge)
#define MERGE_SORT_IN_PLACE_ASWAP   SORT_MAKE_STR(merge_sort_in_place_aswap)
#define SHELL_SORT   SORT_MAKE_STR(shell_sort)
#define QUICK_SORT_PARTITION   SORT_MAKE_STR(quick_sort_partition)
#define QUICK_SORT_RECURSIVE   SORT_MAKE_STR(quick_sort_recursive)
#define HEAP_SIFT_DOWN   SORT_MAKE_STR(heap_sift_down)
#define HEAPIFY   SORT_MAKE_STR(heapify)
#define TIM_SORT_RUN_T   SORT_MAKE_STR(tim_sort_run_t)
#define TEMP_STORAGE_T   SORT_MAKE_STR(temp_storage_t)
#define PUSH_NEXT   SORT_MAKE_STR(push_next)
#define SORT_CSWAP(x, y)
#define BITONIC_SORT_2   SORT_MAKE_STR(bitonic_sort_2)
#define BITONIC_SORT_3   SORT_MAKE_STR(bitonic_sort_3)
#define BITONIC_SORT_4   SORT_MAKE_STR(bitonic_sort_4)
#define BITONIC_SORT_5   SORT_MAKE_STR(bitonic_sort_5)
#define BITONIC_SORT_6   SORT_MAKE_STR(bitonic_sort_6)
#define BITONIC_SORT_7   SORT_MAKE_STR(bitonic_sort_7)
#define BITONIC_SORT_8   SORT_MAKE_STR(bitonic_sort_8)
#define BITONIC_SORT_9   SORT_MAKE_STR(bitonic_sort_9)
#define BITONIC_SORT_10   SORT_MAKE_STR(bitonic_sort_10)
#define BITONIC_SORT_11   SORT_MAKE_STR(bitonic_sort_11)
#define BITONIC_SORT_12   SORT_MAKE_STR(bitonic_sort_12)
#define BITONIC_SORT_13   SORT_MAKE_STR(bitonic_sort_13)
#define BITONIC_SORT_14   SORT_MAKE_STR(bitonic_sort_14)
#define BITONIC_SORT_15   SORT_MAKE_STR(bitonic_sort_15)
#define BITONIC_SORT_16   SORT_MAKE_STR(bitonic_sort_16)
#define SORT_TYPE_CPY(dst, src, size)
#define SORT_TYPE_MOVE(dst, src, size)

Functions

SORT_DEF void SHELL_SORT (SORT_TYPE *dst, const size_t size)
SORT_DEF void BINARY_INSERTION_SORT (SORT_TYPE *dst, const size_t size)
SORT_DEF void HEAP_SORT (SORT_TYPE *dst, const size_t size)
SORT_DEF void QUICK_SORT (SORT_TYPE *dst, const size_t size)
SORT_DEF void MERGE_SORT (SORT_TYPE *dst, const size_t size)
SORT_DEF void MERGE_SORT_IN_PLACE (SORT_TYPE *dst, const size_t size)
SORT_DEF void TIM_SORT (SORT_TYPE *dst, const size_t size)
SORT_DEF void BITONIC_SORT (SORT_TYPE *dst, const size_t size)
SORT_DEF SORT_TYPE * SORT_NEW_BUFFER (size_t size)
SORT_DEF void SORT_DELETE_BUFFER (SORT_TYPE *pointer)
SORT_DEF void MERGE_SORT_IN_PLACE_ASWAP (SORT_TYPE *dst1, SORT_TYPE *dst2, size_t len)
SORT_DEF void MERGE_SORT_IN_PLACE_FRONTMERGE (SORT_TYPE *dst1, size_t l1, SORT_TYPE *dst2, size_t l2)
SORT_DEF size_t MERGE_SORT_IN_PLACE_BACKMERGE (SORT_TYPE *dst1, size_t l1, SORT_TYPE *dst2, size_t l2)
SORT_DEF void MERGE_SORT_IN_PLACE_RMERGE (SORT_TYPE *dst, size_t len, size_t lp, size_t r)
SORT_DEF void MERGE_SORT_RECURSIVE (SORT_TYPE *newdst, SORT_TYPE *dst, const size_t size)

Macro Definition Documentation

◆ __has_builtin

#define __has_builtin ( x)
Value:
0

Definition at line 69 of file sort.h.

◆ BINARY_INSERTION_FIND

#define BINARY_INSERTION_FIND   SORT_MAKE_STR(binary_insertion_find)

Definition at line 169 of file sort.h.

◆ BINARY_INSERTION_SORT

#define BINARY_INSERTION_SORT   SORT_MAKE_STR(binary_insertion_sort)

Definition at line 171 of file sort.h.

Referenced by BITONIC_SORT().

◆ BINARY_INSERTION_SORT_START

#define BINARY_INSERTION_SORT_START   SORT_MAKE_STR(binary_insertion_sort_start)

Definition at line 170 of file sort.h.

Referenced by BINARY_INSERTION_SORT().

◆ BITONIC_SORT

#define BITONIC_SORT   SORT_MAKE_STR(bitonic_sort)

Definition at line 168 of file sort.h.

◆ BITONIC_SORT_10

#define BITONIC_SORT_10   SORT_MAKE_STR(bitonic_sort_10)

Definition at line 359 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_11

#define BITONIC_SORT_11   SORT_MAKE_STR(bitonic_sort_11)

Definition at line 393 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_12

#define BITONIC_SORT_12   SORT_MAKE_STR(bitonic_sort_12)

Definition at line 433 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_13

#define BITONIC_SORT_13   SORT_MAKE_STR(bitonic_sort_13)

Definition at line 477 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_14

#define BITONIC_SORT_14   SORT_MAKE_STR(bitonic_sort_14)

Definition at line 527 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_15

#define BITONIC_SORT_15   SORT_MAKE_STR(bitonic_sort_15)

Definition at line 583 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_16

#define BITONIC_SORT_16   SORT_MAKE_STR(bitonic_sort_16)

Definition at line 644 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_2

#define BITONIC_SORT_2   SORT_MAKE_STR(bitonic_sort_2)

Definition at line 229 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_3

#define BITONIC_SORT_3   SORT_MAKE_STR(bitonic_sort_3)

Definition at line 235 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_4

#define BITONIC_SORT_4   SORT_MAKE_STR(bitonic_sort_4)

Definition at line 243 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_5

#define BITONIC_SORT_5   SORT_MAKE_STR(bitonic_sort_5)

Definition at line 253 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_6

#define BITONIC_SORT_6   SORT_MAKE_STR(bitonic_sort_6)

Definition at line 267 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_7

#define BITONIC_SORT_7   SORT_MAKE_STR(bitonic_sort_7)

Definition at line 284 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_8

#define BITONIC_SORT_8   SORT_MAKE_STR(bitonic_sort_8)

Definition at line 305 of file sort.h.

Referenced by BITONIC_SORT().

◆ BITONIC_SORT_9

#define BITONIC_SORT_9   SORT_MAKE_STR(bitonic_sort_9)

Definition at line 329 of file sort.h.

Referenced by BITONIC_SORT().

◆ CHECK_INVARIANT

#define CHECK_INVARIANT   SORT_MAKE_STR(check_invariant)

Definition at line 174 of file sort.h.

Referenced by TIM_SORT().

◆ CLZ

#define CLZ   clzll

Definition at line 119 of file sort.h.

◆ COUNT_RUN

#define COUNT_RUN   SORT_MAKE_STR(count_run)

Definition at line 173 of file sort.h.

◆ HEAP_SIFT_DOWN

#define HEAP_SIFT_DOWN   SORT_MAKE_STR(heap_sift_down)

Definition at line 192 of file sort.h.

Referenced by HEAP_SORT().

◆ HEAP_SORT

#define HEAP_SORT   SORT_MAKE_STR(heap_sort)

Definition at line 179 of file sort.h.

◆ HEAPIFY

#define HEAPIFY   SORT_MAKE_STR(heapify)

Definition at line 193 of file sort.h.

Referenced by HEAP_SORT().

◆ MAX

#define MAX ( x,
y )
Value:
(((x) > (y) ? (x) : (y)))

Definition at line 54 of file sort.h.

Referenced by csr_init(), and csr_transpose().

◆ MEDIAN

#define MEDIAN   SORT_MAKE_STR(median)

Definition at line 180 of file sort.h.

◆ MERGE_SORT

#define MERGE_SORT   SORT_MAKE_STR(merge_sort)

Definition at line 182 of file sort.h.

◆ MERGE_SORT_IN_PLACE

#define MERGE_SORT_IN_PLACE   SORT_MAKE_STR(merge_sort_in_place)

Definition at line 184 of file sort.h.

Referenced by MERGE_SORT_IN_PLACE().

◆ MERGE_SORT_IN_PLACE_ASWAP

#define MERGE_SORT_IN_PLACE_ASWAP   SORT_MAKE_STR(merge_sort_in_place_aswap)

◆ MERGE_SORT_IN_PLACE_BACKMERGE

#define MERGE_SORT_IN_PLACE_BACKMERGE   SORT_MAKE_STR(merge_sort_in_place_backmerge)

Definition at line 186 of file sort.h.

Referenced by MERGE_SORT_IN_PLACE(), and MERGE_SORT_IN_PLACE_RMERGE().

◆ MERGE_SORT_IN_PLACE_FRONTMERGE

#define MERGE_SORT_IN_PLACE_FRONTMERGE   SORT_MAKE_STR(merge_sort_in_place_frontmerge)

Definition at line 187 of file sort.h.

Referenced by MERGE_SORT_IN_PLACE().

◆ MERGE_SORT_IN_PLACE_RMERGE

#define MERGE_SORT_IN_PLACE_RMERGE   SORT_MAKE_STR(merge_sort_in_place_rmerge)

Definition at line 185 of file sort.h.

Referenced by MERGE_SORT_IN_PLACE().

◆ MERGE_SORT_RECURSIVE

#define MERGE_SORT_RECURSIVE   SORT_MAKE_STR(merge_sort_recursive)

Definition at line 183 of file sort.h.

Referenced by MERGE_SORT(), and MERGE_SORT_RECURSIVE().

◆ MIN

#define MIN ( x,
y )
Value:
(((x) < (y) ? (x) : (y)))

Definition at line 58 of file sort.h.

◆ PUSH_NEXT

#define PUSH_NEXT   SORT_MAKE_STR(push_next)

Definition at line 196 of file sort.h.

Referenced by TIM_SORT().

◆ QUICK_SORT

#define QUICK_SORT   SORT_MAKE_STR(quick_sort)

Definition at line 181 of file sort.h.

◆ QUICK_SORT_PARTITION

#define QUICK_SORT_PARTITION   SORT_MAKE_STR(quick_sort_partition)

Definition at line 190 of file sort.h.

◆ QUICK_SORT_RECURSIVE

#define QUICK_SORT_RECURSIVE   SORT_MAKE_STR(quick_sort_recursive)

Definition at line 191 of file sort.h.

Referenced by QUICK_SORT().

◆ REVERSE_ELEMENTS

#define REVERSE_ELEMENTS   SORT_MAKE_STR(reverse_elements)

Definition at line 172 of file sort.h.

◆ SHELL_SORT

#define SHELL_SORT   SORT_MAKE_STR(shell_sort)

Definition at line 189 of file sort.h.

◆ SMALL_SORT

#define SMALL_SORT   BITONIC_SORT

Definition at line 157 of file sort.h.

Referenced by MERGE_SORT_IN_PLACE().

◆ SMALL_SORT_BND

#define SMALL_SORT_BND   16

Definition at line 154 of file sort.h.

Referenced by MERGE_SORT(), MERGE_SORT_IN_PLACE(), and MERGE_SORT_RECURSIVE().

◆ SMALL_STABLE_SORT

#define SMALL_STABLE_SORT   BINARY_INSERTION_SORT

Definition at line 161 of file sort.h.

Referenced by MERGE_SORT(), MERGE_SORT_RECURSIVE(), and TIM_SORT().

◆ SORT_CMP

#define SORT_CMP ( x,
y )
Value:
((x) < (y) ? -1 : ((y) < (x) ? 1 : 0))

Definition at line 19 of file sort.h.

Referenced by MERGE_SORT_IN_PLACE(), MERGE_SORT_IN_PLACE_BACKMERGE(), MERGE_SORT_IN_PLACE_FRONTMERGE(), MERGE_SORT_IN_PLACE_RMERGE(), MERGE_SORT_RECURSIVE(), and SHELL_SORT().

◆ SORT_COMMON_H

#define SORT_COMMON_H

Definition at line 51 of file sort.h.

◆ SORT_CONCAT

#define SORT_CONCAT ( x,
y )
Value:
x ## _ ## y

Definition at line 149 of file sort.h.

◆ SORT_CSWAP

#define SORT_CSWAP ( x,
y )
Value:
{ if(SORT_CMP((x),(y)) > 0) {SORT_SWAP((x),(y));}}
#define SORT_SWAP(x, y)
Definition sort.h:46
#define SORT_CMP(x, y)
Definition sort.h:19

Definition at line 205 of file sort.h.

◆ SORT_DELETE_BUFFER

#define SORT_DELETE_BUFFER   SORT_MAKE_STR(sort_delete_buffer)

Definition at line 167 of file sort.h.

Referenced by MERGE_SORT().

◆ SORT_MAKE_STR

#define SORT_MAKE_STR ( x)
Value:
#define SORT_MAKE_STR1(x, y)
Definition sort.h:150
#define SORT_NAME
Definition util_m4ri.c:565

Definition at line 151 of file sort.h.

◆ SORT_MAKE_STR1

#define SORT_MAKE_STR1 ( x,
y )
Value:
#define SORT_CONCAT(x, y)
Definition sort.h:149

Definition at line 150 of file sort.h.

◆ SORT_NEW_BUFFER

#define SORT_NEW_BUFFER   SORT_MAKE_STR(sort_new_buffer)

Definition at line 166 of file sort.h.

Referenced by MERGE_SORT().

◆ SORT_SAFE_CPY

#define SORT_SAFE_CPY   0

Definition at line 38 of file sort.h.

◆ SORT_SWAP

#define SORT_SWAP ( x,
y )
Value:
{SORT_TYPE _sort_swap_temp = (x); (x) = (y); (y) = _sort_swap_temp;}
#define SORT_TYPE
Definition util_m4ri.c:566

Definition at line 46 of file sort.h.

Referenced by HEAP_SORT(), MERGE_SORT_IN_PLACE(), MERGE_SORT_IN_PLACE_ASWAP(), MERGE_SORT_IN_PLACE_BACKMERGE(), and MERGE_SORT_IN_PLACE_FRONTMERGE().

◆ SORT_TYPE_CPY [1/2]

#define SORT_TYPE_CPY ( dst,
src,
size )
Value:
memcpy((dst), (src), (size) * sizeof(SORT_TYPE))

Definition at line 164 of file sort.h.

◆ SORT_TYPE_CPY [2/2]

#define SORT_TYPE_CPY   SORT_MAKE_STR(sort_type_cpy)

Definition at line 164 of file sort.h.

Referenced by MERGE_SORT_RECURSIVE().

◆ SORT_TYPE_MOVE [1/2]

#define SORT_TYPE_MOVE ( dst,
src,
size )
Value:
memmove((dst), (src), (size) * sizeof(SORT_TYPE))

Definition at line 165 of file sort.h.

◆ SORT_TYPE_MOVE [2/2]

#define SORT_TYPE_MOVE   SORT_MAKE_STR(sort_type_move)

Definition at line 165 of file sort.h.

◆ TEMP_STORAGE_T

#define TEMP_STORAGE_T   SORT_MAKE_STR(temp_storage_t)

Definition at line 195 of file sort.h.

Referenced by TIM_SORT().

◆ TIM_SORT

#define TIM_SORT   SORT_MAKE_STR(tim_sort)

Definition at line 175 of file sort.h.

◆ TIM_SORT_COLLAPSE

#define TIM_SORT_COLLAPSE   SORT_MAKE_STR(tim_sort_collapse)

Definition at line 178 of file sort.h.

Referenced by TIM_SORT().

◆ TIM_SORT_MERGE

#define TIM_SORT_MERGE   SORT_MAKE_STR(tim_sort_merge)

Definition at line 177 of file sort.h.

◆ TIM_SORT_RESIZE

#define TIM_SORT_RESIZE   SORT_MAKE_STR(tim_sort_resize)

Definition at line 176 of file sort.h.

◆ TIM_SORT_RUN_T

#define TIM_SORT_RUN_T   SORT_MAKE_STR(tim_sort_run_t)

Definition at line 194 of file sort.h.

Referenced by TIM_SORT().

◆ TIM_SORT_STACK_SIZE

#define TIM_SORT_STACK_SIZE   128

Definition at line 42 of file sort.h.

Referenced by TIM_SORT().

Function Documentation

◆ BINARY_INSERTION_SORT()

SORT_DEF void BINARY_INSERTION_SORT ( SORT_TYPE * dst,
const size_t size )

Definition at line 939 of file sort.h.

References BINARY_INSERTION_SORT_START, SORT_DEF, and SORT_TYPE.

◆ BITONIC_SORT()

◆ HEAP_SORT()

SORT_DEF void HEAP_SORT ( SORT_TYPE * dst,
const size_t size )

Definition at line 1759 of file sort.h.

References HEAP_SIFT_DOWN, HEAPIFY, SORT_DEF, SORT_SWAP, and SORT_TYPE.

◆ MERGE_SORT()

SORT_DEF void MERGE_SORT ( SORT_TYPE * dst,
const size_t size )

◆ MERGE_SORT_IN_PLACE()

◆ MERGE_SORT_IN_PLACE_ASWAP()

SORT_DEF void MERGE_SORT_IN_PLACE_ASWAP ( SORT_TYPE * dst1,
SORT_TYPE * dst2,
size_t len )

Definition at line 949 of file sort.h.

References SORT_DEF, SORT_SWAP, and SORT_TYPE.

◆ MERGE_SORT_IN_PLACE_BACKMERGE()

SORT_DEF size_t MERGE_SORT_IN_PLACE_BACKMERGE ( SORT_TYPE * dst1,
size_t l1,
SORT_TYPE * dst2,
size_t l2 )

Definition at line 989 of file sort.h.

References MERGE_SORT_IN_PLACE_ASWAP, SORT_CMP, SORT_DEF, SORT_SWAP, and SORT_TYPE.

◆ MERGE_SORT_IN_PLACE_FRONTMERGE()

SORT_DEF void MERGE_SORT_IN_PLACE_FRONTMERGE ( SORT_TYPE * dst1,
size_t l1,
SORT_TYPE * dst2,
size_t l2 )

Definition at line 957 of file sort.h.

References MERGE_SORT_IN_PLACE_ASWAP, SORT_CMP, SORT_DEF, SORT_SWAP, and SORT_TYPE.

◆ MERGE_SORT_IN_PLACE_RMERGE()

SORT_DEF void MERGE_SORT_IN_PLACE_RMERGE ( SORT_TYPE * dst,
size_t len,
size_t lp,
size_t r )

◆ MERGE_SORT_RECURSIVE()

SORT_DEF void MERGE_SORT_RECURSIVE ( SORT_TYPE * newdst,
SORT_TYPE * dst,
const size_t size )

◆ QUICK_SORT()

void QUICK_SORT ( SORT_TYPE * dst,
const size_t size )

Definition at line 1392 of file sort.h.

References QUICK_SORT_RECURSIVE, and SORT_TYPE.

◆ SHELL_SORT()

SORT_DEF void SHELL_SORT ( SORT_TYPE * dst,
const size_t size )

Definition at line 832 of file sort.h.

References SORT_CMP, SORT_DEF, and SORT_TYPE.

◆ SORT_DELETE_BUFFER()

SORT_DEF void SORT_DELETE_BUFFER ( SORT_TYPE * pointer)

Definition at line 820 of file sort.h.

References SORT_DEF, and SORT_TYPE.

◆ SORT_NEW_BUFFER()

SORT_DEF SORT_TYPE * SORT_NEW_BUFFER ( size_t size)

Definition at line 812 of file sort.h.

References SORT_DEF, and SORT_TYPE.

◆ TIM_SORT()