-
Notifications
You must be signed in to change notification settings - Fork 6
/
sdpa_tool.h
94 lines (74 loc) · 2.55 KB
/
sdpa_tool.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* -------------------------------------------------------------
This file is a component of SDPA
Copyright (C) 2004 SDPA Project
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------- */
/*--------------------------------------------------
rsdpa_tool.h
$Id: rsdpa_tool.h,v 1.2 2004/09/01 06:34:12 makoto Exp $
--------------------------------------------------*/
#ifndef __sdpa_tool_h__
#define __sdpa_tool_h__
#include <sdpa_right.h>
#include <iostream>
#include <sys/time.h>
#include <string>
#include <gmpxx.h>
namespace sdpa {
#if 1
#define rMessage(message) \
cout << message << " :: line " << __LINE__ \
<< " in " << __FILE__ << endl
#else
#define rMessage(message)
#endif
#define rError(message) \
cout << message << " :: line " << __LINE__ \
<< " in " << __FILE__ << endl; \
exit(false)
#if 0
#define rNewCheck() rMessage("new invoked");
#else
#define rNewCheck() ;
#endif
#define REVERSE_PRIMAL_DUAL 1
// These are constant. Do NOT change
extern int IZERO ; // = 0;
extern int IONE ; // = 1;
extern int IMONE ; // = -1;
extern mpf_class MZERO; // = 0.0;
extern mpf_class MONE ; // = 1.0;
extern mpf_class MMONE; // = -1.0;
class Time
{
public:
static double rGetUseTime();
static void rSetTimeVal(struct timeval & targetVal);
static double rGetRealTime(const struct timeval & start,
const struct timeval & end);
};
#if 1 // count time with process time
#define TimeStart(START__) \
static double START__; START__ = Time::rGetUseTime()
#define TimeEnd(END__) \
static double END__; END__ = Time::rGetUseTime()
#define TimeCal(START__,END__) (END__ - START__)
#else // count time with real time
#define TimeStart(START__) \
static struct timeval START__; Time::rSetTimeVal(START__)
#define TimeEnd(END__) \
static struct timeval END__; Time::rSetTimeVal(END__)
#define TimeCal(START__,END__) Time::rGetRealTime(START__,END__)
#endif
}
#endif // __sdpa_tool_h__