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))
54 #undef i_lt
55 }
56 
57 void isortd(size_t n, idx_t *base)
58 {
59 #define i_gt(a, b) ((*a) > (*b))
61 #undef i_gt
62 }
63 
64 void rsorti(size_t n, real_t *base)
65 {
66 #define r_lt(a, b) ((*a) < (*b))
68 #undef r_lt
69 }
70 
71 void rsortd(size_t n, real_t *base)
72 {
73 #define r_gt(a, b) ((*a) > (*b))
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))
118 #undef uvwkey_lt
119 }
120 
ikvsortd
void ikvsortd(size_t n, ikv_t *base)
Definition: gklib.c:93
base
Annotation indicating that a class derives from another given type.
Definition: attr.h:64
key_gt
#define key_gt(a, b)
Definition: gklib.c:32
rkvsortd
void rkvsortd(size_t n, rkv_t *base)
Definition: gklib.c:107
ikeyval_lt
#define ikeyval_lt(a, b)
GK_MKQSORT
#define GK_MKQSORT(GKQSORT_TYPE, GKQSORT_BASE, GKQSORT_NELT, GKQSORT_LT)
Definition: gk_mksort.h:120
ikey_lt
#define ikey_lt(a, b)
ikvmalloc
#define ikvmalloc
Definition: gklib_rename.h:35
GK_MKALLOC
#define GK_MKALLOC(PRFX, TYPE)
Definition: gk_mkmemory.h:14
r_lt
#define r_lt(a, b)
rkey_lt
#define rkey_lt(a, b)
ikvsorti
void ikvsorti(size_t n, ikv_t *base)
Definition: gklib.c:78
rkvsorti
void rkvsorti(size_t n, rkv_t *base)
Definition: gklib.c:100
rsortd
void rsortd(size_t n, real_t *base)
Definition: gklib.c:71
n
int n
Definition: BiCGSTAB_simple.cpp:1
i_gt
#define i_gt(a, b)
r_gt
#define r_gt(a, b)
GK_MKBLAS
#define GK_MKBLAS(PRFX, TYPE, OUTTYPE)
Definition: gk_mkblas.h:14
ikvsortii
void ikvsortii(size_t n, ikv_t *base)
Definition: gklib.c:86
GK_MKRANDOM
#define GK_MKRANDOM(FPRFX, RNGT, VALT)
Definition: gk_mkrandom.h:23
GK_MKPQUEUE
#define GK_MKPQUEUE(FPRFX, PQT, KVT, KT, VT, KVMALLOC, KMAX, KEY_LT)
Definition: gk_mkpqueue.h:15
ikey_gt
#define ikey_gt(a, b)
rsorti
void rsorti(size_t n, real_t *base)
Definition: gklib.c:64
rkey_gt
#define rkey_gt(a, b)
GK_MKARRAY2CSR
#define GK_MKARRAY2CSR(PRFX, TYPE)
Definition: gk_mkutils.h:14
uvwkey_lt
#define uvwkey_lt(a, b)
rkvmalloc
#define rkvmalloc
Definition: gklib_rename.h:87
isortd
void isortd(size_t n, idx_t *base)
Definition: gklib.c:57
isorti
void isorti(size_t n, idx_t *base)
Definition: gklib.c:50
uvw_t
Definition: gklib_defs.h:18
real_t
float real_t
Definition: include/metis.h:132
REAL_MAX
#define REAL_MAX
Definition: include/metis.h:136
metislib.h
IDX_MAX
#define IDX_MAX
Definition: include/metis.h:103
i_lt
#define i_lt(a, b)
uvwsorti
void uvwsorti(size_t n, uvw_t *base)
Definition: gklib.c:114
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
idx_t
int32_t idx_t
Definition: include/metis.h:101


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:22