-
Notifications
You must be signed in to change notification settings - Fork 0
/
General.h
74 lines (57 loc) · 1.88 KB
/
General.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
// Mode is: -*- C++ -*-
// --- General.h --- Created: Sun Sep 21 16:10:50 1997
//
// Time-stamp: <October 27, 1997 17:13:27 [email protected]>
// Update Count: 10
//
// RCS: $Id$ $Locker$ $Log$
// = FILENAME
// General.h
// = LIBRARY
//
// = AUTHOR
// Paolo Frasconi ([email protected])
// = COPYRIGHT
// Copyright (C) 1997 Paolo Frasconi
#ifndef GENERAL_H
#define GENERAL_H
#define Float double
#include <fstream>
#include <iostream>
#include <cstdio>
#include <cstdlib>
//#include <values.h>
#ifdef WANT_ERRNO
#include <errno.h>
#define FAULT(s) { std::cerr << "Error: in function " << __PRETTY_FUNCTION__ \
<< ", file " << __FILE__ << " line " << __LINE__ << ": " << s << "\n" \
<< "errno= " << errno << " (" << strerror(errno) << ")\n"; abort();}
#else
#define FAULT(s) { std::cerr << "Error: in function " << __PRETTY_FUNCTION__ \
<< ", file " << __FILE__ << " line " << __LINE__ << ": " << s << "\n" \
; abort();}
#endif
#include <string.h>
// Customization
#define CPP_COMMAND "./cpp -P -undef "
#define GZCAT_COMMAND "./zcat"
// end customization
extern int debugLevel;
#ifndef __GNUG__
#define __PRETTY_FUNCTION__ "unknown()"
#endif
#define WARN(level, s) {if (debugLevel>=level) {cerr << "Warning: in function " << __PRETTY_FUNCTION__ << ", file " << __FILE__ << " line " << __LINE__ << ": " << s << "\n";}}
#define MESSAGE(s) {cerr << "Notice: in " << __PRETTY_FUNCTION__ << ": " << s << "\n";}
#define DEBUG(level, s) {if (debugLevel >= level) {cerr << s << "\n";}}
#ifdef CHECKING
#define CHECK(condition, errorMsg) if ((condition)) {FAULT(errorMsg);}
#else
#define CHECK(condition, errorMsg) ;
#endif
#define UNKNOWN_REAL_VAL MINFLOAT
#define UNKNOWN_NOMINAL_VAL MINFLOAT
#define UNKNOWN_VAL MINFLOAT
int argmax(const Float* x, int n);
void meanvar(Float* v, int n, Float& mean, Float& std);
void printvec(const Float* x, int n);
#endif // GENERAL_H