gklib.c
Go to the documentation of this file.
1 
12 #include "metislib.h"
13 
14 
15 /*************************************************************************/
17 /*************************************************************************/
20 
21 /*************************************************************************/
23 /*************************************************************************/
26 GK_MKALLOC(ikv, ikv_t)
27 GK_MKALLOC(rkv, rkv_t)
28 
29 /*************************************************************************/
31 /*************************************************************************/
32 #define key_gt(a, b) ((a) > (b))
33 GK_MKPQUEUE(ipq, ipq_t, ikv_t, idx_t, idx_t, ikvmalloc, IDX_MAX, key_gt)
34 GK_MKPQUEUE(rpq, rpq_t, rkv_t, real_t, idx_t, rkvmalloc, REAL_MAX, key_gt)
35 #undef key_gt
36 
37 /*************************************************************************/
39 /*************************************************************************/
41 
42 /*************************************************************************/
44 /*************************************************************************/
46 
47 /*************************************************************************/
49 /*************************************************************************/
50 void isorti(size_t n, idx_t *base)
51 {
52 #define i_lt(a, b) ((*a) < (*b))
53  GK_MKQSORT(idx_t, base, n, i_lt);
54 #undef i_lt
55 }
56 
57 void isortd(size_t n, idx_t *base)
58 {
59 #define i_gt(a, b) ((*a) > (*b))
60  GK_MKQSORT(idx_t, base, n, i_gt);
61 #undef i_gt
62 }
63 
64 void rsorti(size_t n, real_t *base)
65 {
66 #define r_lt(a, b) ((*a) < (*b))
67  GK_MKQSORT(real_t, base, n, r_lt);
68 #undef r_lt
69 }
70 
71 void rsortd(size_t n, real_t *base)
72 {
73 #define r_gt(a, b) ((*a) > (*b))
74  GK_MKQSORT(real_t, base, n, r_gt);
75 #undef r_gt
76 }
77 
78 void ikvsorti(size_t n, ikv_t *base)
79 {
80 #define ikey_lt(a, b) ((a)->key < (b)->key)
81  GK_MKQSORT(ikv_t, base, n, ikey_lt);
82 #undef ikey_lt
83 }
84 
85 /* Sorts based both on key and val */
86 void ikvsortii(size_t n, ikv_t *base)
87 {
88 #define ikeyval_lt(a, b) ((a)->key < (b)->key || ((a)->key == (b)->key && (a)->val < (b)->val))
89  GK_MKQSORT(ikv_t, base, n, ikeyval_lt);
90 #undef ikeyval_lt
91 }
92 
93 void ikvsortd(size_t n, ikv_t *base)
94 {
95 #define ikey_gt(a, b) ((a)->key > (b)->key)
96  GK_MKQSORT(ikv_t, base, n, ikey_gt);
97 #undef ikey_gt
98 }
99 
100 void rkvsorti(size_t n, rkv_t *base)
101 {
102 #define rkey_lt(a, b) ((a)->key < (b)->key)
103  GK_MKQSORT(rkv_t, base, n, rkey_lt);
104 #undef rkey_lt
105 }
106 
107 void rkvsortd(size_t n, rkv_t *base)
108 {
109 #define rkey_gt(a, b) ((a)->key > (b)->key)
110  GK_MKQSORT(rkv_t, base, n, rkey_gt);
111 #undef rkey_gt
112 }
113 
114 void uvwsorti(size_t n, uvw_t *base)
115 {
116 #define uvwkey_lt(a, b) ((a)->u < (b)->u || ((a)->u == (b)->u && (a)->v < (b)->v))
117  GK_MKQSORT(uvw_t, base, n, uvwkey_lt);
118 #undef uvwkey_lt
119 }
120 
void isorti(size_t n, idx_t *base)
Definition: gklib.c:50
#define GK_MKBLAS(PRFX, TYPE, OUTTYPE)
Definition: gk_mkblas.h:14
#define ikvmalloc
Definition: gklib_rename.h:35
void rkvsorti(size_t n, rkv_t *base)
Definition: gklib.c:100
#define GK_MKPQUEUE(FPRFX, PQT, KVT, KT, VT, KVMALLOC, KMAX, KEY_LT)
Definition: gk_mkpqueue.h:15
void rsorti(size_t n, real_t *base)
Definition: gklib.c:64
#define key_gt(a, b)
Definition: gklib.c:32
#define GK_MKALLOC(PRFX, TYPE)
Definition: gk_mkmemory.h:14
int n
#define i_lt(a, b)
#define ikey_gt(a, b)
void ikvsorti(size_t n, ikv_t *base)
Definition: gklib.c:78
void rkvsortd(size_t n, rkv_t *base)
Definition: gklib.c:107
#define REAL_MAX
#define r_gt(a, b)
#define ikeyval_lt(a, b)
void uvwsorti(size_t n, uvw_t *base)
Definition: gklib.c:114
#define r_lt(a, b)
int32_t idx_t
void ikvsortii(size_t n, ikv_t *base)
Definition: gklib.c:86
#define GK_MKARRAY2CSR(PRFX, TYPE)
Definition: gk_mkutils.h:14
#define rkey_lt(a, b)
float real_t
#define IDX_MAX
#define rkvmalloc
Definition: gklib_rename.h:87
#define GK_MKRANDOM(FPRFX, RNGT, VALT)
Definition: gk_mkrandom.h:23
#define uvwkey_lt(a, b)
#define rkey_gt(a, b)
void rsortd(size_t n, real_t *base)
Definition: gklib.c:71
Annotation indicating that a class derives from another given type.
Definition: attr.h:61
#define GK_MKQSORT(GKQSORT_TYPE, GKQSORT_BASE, GKQSORT_NELT, GKQSORT_LT)
Definition: gk_mksort.h:120
void ikvsortd(size_t n, ikv_t *base)
Definition: gklib.c:93
#define ikey_lt(a, b)
void isortd(size_t n, idx_t *base)
Definition: gklib.c:57
#define i_gt(a, b)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:18