Macros
gk_macros.h File Reference

This file contains various macros. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ASSERT(expr)
 
#define ASSERT2   ASSERT
 
#define ASSERTP(expr, msg)
 
#define ASSERTP2   ASSERTP
 
#define gk_abs(x)   ((x) >= 0 ? (x) : -(x))
 
#define gk_clearcputimer(tmr)   (tmr = 0.0)
 
#define gk_clearwctimer(tmr)   (tmr = 0.0)
 
#define gk_getcputimer(tmr)   (tmr)
 
#define gk_getwctimer(tmr)   (tmr)
 
#define gk_max(a, b)   ((a) >= (b) ? (a) : (b))
 
#define gk_max3(a, b, c)   ((a) >= (b) && (a) >= (c) ? (a) : ((b) >= (a) && (b) >= (c) ? (b) : (c)))
 
#define gk_min(a, b)   ((a) >= (b) ? (b) : (a))
 
#define gk_sigcatch()   (setjmp(gk_jbufs[gk_cur_jbufs]))
 
#define gk_startcputimer(tmr)   (tmr -= gk_CPUSeconds())
 
#define gk_startwctimer(tmr)   (tmr -= gk_WClockSeconds())
 
#define gk_stopcputimer(tmr)   (tmr += gk_CPUSeconds())
 
#define gk_stopwctimer(tmr)   (tmr += gk_WClockSeconds())
 
#define gk_SWAP(a, b, tmp)   do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0)
 
#define GKASSERT(expr)
 
#define GKASSERTP(expr, msg)
 
#define GKCUASSERT(expr)
 
#define GKCUASSERTP(expr, msg)
 
#define GKSETJMP()   (setjmp(gk_return_to_entry))
 
#define IFSET(a, flag, cmd)   if ((a)&(flag)) (cmd);
 
#define INC_DEC(a, b, val)   do {(a) += (val); (b) -= (val);} while(0)
 
#define MAKECSR(i, n, a)
 
#define MALLOC_CHECK(ptr)   ;
 
#define ONEOVERRANDMAX   (1.0/(RAND_MAX+1.0))
 
#define RandomInRange(u)   ((int) (ONEOVERRANDMAX*(u)*rand()))
 
#define SHIFTCSR(i, n, a)
 
#define sign(a, b)   ((a >= 0 ? b : -b))
 

Detailed Description

This file contains various macros.

Date
Started 3/27/2007
Author
George
Version
$Id: gk_macros.h 10711 2011-08-31 22:23:04Z karypis $ 

Definition in file gk_macros.h.

Macro Definition Documentation

◆ ASSERT

#define ASSERT (   expr)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
assert(expr); \
}

Definition at line 124 of file gk_macros.h.

◆ ASSERT2

#define ASSERT2   ASSERT

Definition at line 145 of file gk_macros.h.

◆ ASSERTP

#define ASSERTP (   expr,
  msg 
)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
printf msg ; \
printf("\n"); \
assert(expr); \
}

Definition at line 131 of file gk_macros.h.

◆ ASSERTP2

#define ASSERTP2   ASSERTP

Definition at line 146 of file gk_macros.h.

◆ gk_abs

#define gk_abs (   x)    ((x) >= 0 ? (x) : -(x))

Definition at line 26 of file gk_macros.h.

◆ gk_clearcputimer

#define gk_clearcputimer (   tmr)    (tmr = 0.0)

Definition at line 32 of file gk_macros.h.

◆ gk_clearwctimer

#define gk_clearwctimer (   tmr)    (tmr = 0.0)

Definition at line 37 of file gk_macros.h.

◆ gk_getcputimer

#define gk_getcputimer (   tmr)    (tmr)

Definition at line 35 of file gk_macros.h.

◆ gk_getwctimer

#define gk_getwctimer (   tmr)    (tmr)

Definition at line 40 of file gk_macros.h.

◆ gk_max

#define gk_max (   a,
  b 
)    ((a) >= (b) ? (a) : (b))

Definition at line 16 of file gk_macros.h.

◆ gk_max3

#define gk_max3 (   a,
  b,
  c 
)    ((a) >= (b) && (a) >= (c) ? (a) : ((b) >= (a) && (b) >= (c) ? (b) : (c)))

Definition at line 18 of file gk_macros.h.

◆ gk_min

#define gk_min (   a,
  b 
)    ((a) >= (b) ? (b) : (a))

Definition at line 17 of file gk_macros.h.

◆ gk_sigcatch

#define gk_sigcatch ( )    (setjmp(gk_jbufs[gk_cur_jbufs]))

Definition at line 52 of file gk_macros.h.

◆ gk_startcputimer

#define gk_startcputimer (   tmr)    (tmr -= gk_CPUSeconds())

Definition at line 33 of file gk_macros.h.

◆ gk_startwctimer

#define gk_startwctimer (   tmr)    (tmr -= gk_WClockSeconds())

Definition at line 38 of file gk_macros.h.

◆ gk_stopcputimer

#define gk_stopcputimer (   tmr)    (tmr += gk_CPUSeconds())

Definition at line 34 of file gk_macros.h.

◆ gk_stopwctimer

#define gk_stopwctimer (   tmr)    (tmr += gk_WClockSeconds())

Definition at line 39 of file gk_macros.h.

◆ gk_SWAP

#define gk_SWAP (   a,
  b,
  tmp 
)    do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0)

Definition at line 19 of file gk_macros.h.

◆ GKASSERT

#define GKASSERT (   expr)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
abort(); \
}

Definition at line 90 of file gk_macros.h.

◆ GKASSERTP

#define GKASSERTP (   expr,
  msg 
)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
printf msg ; \
printf("\n"); \
abort(); \
}

Definition at line 97 of file gk_macros.h.

◆ GKCUASSERT

#define GKCUASSERT (   expr)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
}

Definition at line 106 of file gk_macros.h.

◆ GKCUASSERTP

#define GKCUASSERTP (   expr,
  msg 
)
Value:
if (!(expr)) { \
printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
__LINE__, __FILE__); \
printf msg ; \
printf("\n"); \
}

Definition at line 112 of file gk_macros.h.

◆ GKSETJMP

#define GKSETJMP ( )    (setjmp(gk_return_to_entry))

Definition at line 51 of file gk_macros.h.

◆ IFSET

#define IFSET (   a,
  flag,
  cmd 
)    if ((a)&(flag)) (cmd);

Definition at line 45 of file gk_macros.h.

◆ INC_DEC

#define INC_DEC (   a,
  b,
  val 
)    do {(a) += (val); (b) -= (val);} while(0)

Definition at line 20 of file gk_macros.h.

◆ MAKECSR

#define MAKECSR (   i,
  n,
  a 
)
Value:
do { \
for (i=1; i<n; i++) a[i] += a[i-1]; \
for (i=n; i>0; i--) a[i] = a[i-1]; \
a[0] = 0; \
} while(0)

Definition at line 73 of file gk_macros.h.

◆ MALLOC_CHECK

#define MALLOC_CHECK (   ptr)    ;

Definition at line 66 of file gk_macros.h.

◆ ONEOVERRANDMAX

#define ONEOVERRANDMAX   (1.0/(RAND_MAX+1.0))

Definition at line 23 of file gk_macros.h.

◆ RandomInRange

#define RandomInRange (   u)    ((int) (ONEOVERRANDMAX*(u)*rand()))

Definition at line 24 of file gk_macros.h.

◆ SHIFTCSR

#define SHIFTCSR (   i,
  n,
  a 
)
Value:
do { \
for (i=n; i>0; i--) a[i] = a[i-1]; \
a[0] = 0; \
} while(0)

Definition at line 80 of file gk_macros.h.

◆ sign

#define sign (   a,
  b 
)    ((a >= 0 ? b : -b))

Definition at line 21 of file gk_macros.h.

n
int n
Definition: BiCGSTAB_simple.cpp:1
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
pybind11.msg
msg
Definition: wrap/pybind11/pybind11/__init__.py:6


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:43:17