alpar@1
|
1 |
/* glplib.h (miscellaneous library routines) */
|
alpar@1
|
2 |
|
alpar@1
|
3 |
/***********************************************************************
|
alpar@1
|
4 |
* This code is part of GLPK (GNU Linear Programming Kit).
|
alpar@1
|
5 |
*
|
alpar@1
|
6 |
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
alpar@1
|
7 |
* 2009, 2010 Andrew Makhorin, Department for Applied Informatics,
|
alpar@1
|
8 |
* Moscow Aviation Institute, Moscow, Russia. All rights reserved.
|
alpar@1
|
9 |
* E-mail: <mao@gnu.org>.
|
alpar@1
|
10 |
*
|
alpar@1
|
11 |
* GLPK is free software: you can redistribute it and/or modify it
|
alpar@1
|
12 |
* under the terms of the GNU General Public License as published by
|
alpar@1
|
13 |
* the Free Software Foundation, either version 3 of the License, or
|
alpar@1
|
14 |
* (at your option) any later version.
|
alpar@1
|
15 |
*
|
alpar@1
|
16 |
* GLPK is distributed in the hope that it will be useful, but WITHOUT
|
alpar@1
|
17 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
alpar@1
|
18 |
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
alpar@1
|
19 |
* License for more details.
|
alpar@1
|
20 |
*
|
alpar@1
|
21 |
* You should have received a copy of the GNU General Public License
|
alpar@1
|
22 |
* along with GLPK. If not, see <http://www.gnu.org/licenses/>.
|
alpar@1
|
23 |
***********************************************************************/
|
alpar@1
|
24 |
|
alpar@1
|
25 |
#ifndef GLPLIB_H
|
alpar@1
|
26 |
#define GLPLIB_H
|
alpar@1
|
27 |
|
alpar@1
|
28 |
#define bigmul _glp_lib_bigmul
|
alpar@1
|
29 |
void bigmul(int n, int m, unsigned short x[], unsigned short y[]);
|
alpar@1
|
30 |
/* multiply unsigned integer numbers of arbitrary precision */
|
alpar@1
|
31 |
|
alpar@1
|
32 |
#define bigdiv _glp_lib_bigdiv
|
alpar@1
|
33 |
void bigdiv(int n, int m, unsigned short x[], unsigned short y[]);
|
alpar@1
|
34 |
/* divide unsigned integer numbers of arbitrary precision */
|
alpar@1
|
35 |
|
alpar@1
|
36 |
#ifndef GLP_LONG_DEFINED
|
alpar@1
|
37 |
#define GLP_LONG_DEFINED
|
alpar@1
|
38 |
typedef struct { int lo, hi; } glp_long;
|
alpar@1
|
39 |
/* long integer data type */
|
alpar@1
|
40 |
#endif
|
alpar@1
|
41 |
|
alpar@1
|
42 |
typedef struct { glp_long quot, rem; } glp_ldiv;
|
alpar@1
|
43 |
/* result of long integer division */
|
alpar@1
|
44 |
|
alpar@1
|
45 |
#define xlset _glp_lib_xlset
|
alpar@1
|
46 |
glp_long xlset(int x);
|
alpar@1
|
47 |
/* expand integer to long integer */
|
alpar@1
|
48 |
|
alpar@1
|
49 |
#define xlneg _glp_lib_xlneg
|
alpar@1
|
50 |
glp_long xlneg(glp_long x);
|
alpar@1
|
51 |
/* negate long integer */
|
alpar@1
|
52 |
|
alpar@1
|
53 |
#define xladd _glp_lib_xladd
|
alpar@1
|
54 |
glp_long xladd(glp_long x, glp_long y);
|
alpar@1
|
55 |
/* add long integers */
|
alpar@1
|
56 |
|
alpar@1
|
57 |
#define xlsub _glp_lib_xlsub
|
alpar@1
|
58 |
glp_long xlsub(glp_long x, glp_long y);
|
alpar@1
|
59 |
/* subtract long integers */
|
alpar@1
|
60 |
|
alpar@1
|
61 |
#define xlcmp _glp_lib_xlcmp
|
alpar@1
|
62 |
int xlcmp(glp_long x, glp_long y);
|
alpar@1
|
63 |
/* compare long integers */
|
alpar@1
|
64 |
|
alpar@1
|
65 |
#define xlmul _glp_lib_xlmul
|
alpar@1
|
66 |
glp_long xlmul(glp_long x, glp_long y);
|
alpar@1
|
67 |
/* multiply long integers */
|
alpar@1
|
68 |
|
alpar@1
|
69 |
#define xldiv _glp_lib_xldiv
|
alpar@1
|
70 |
glp_ldiv xldiv(glp_long x, glp_long y);
|
alpar@1
|
71 |
/* divide long integers */
|
alpar@1
|
72 |
|
alpar@1
|
73 |
#define xltod _glp_lib_xltod
|
alpar@1
|
74 |
double xltod(glp_long x);
|
alpar@1
|
75 |
/* convert long integer to double */
|
alpar@1
|
76 |
|
alpar@1
|
77 |
#define xltoa _glp_lib_xltoa
|
alpar@1
|
78 |
char *xltoa(glp_long x, char *s);
|
alpar@1
|
79 |
/* convert long integer to character string */
|
alpar@1
|
80 |
|
alpar@1
|
81 |
#define str2int _glp_lib_str2int
|
alpar@1
|
82 |
int str2int(const char *str, int *val);
|
alpar@1
|
83 |
/* convert character string to value of int type */
|
alpar@1
|
84 |
|
alpar@1
|
85 |
#define str2num _glp_lib_str2num
|
alpar@1
|
86 |
int str2num(const char *str, double *val);
|
alpar@1
|
87 |
/* convert character string to value of double type */
|
alpar@1
|
88 |
|
alpar@1
|
89 |
#define strspx _glp_lib_strspx
|
alpar@1
|
90 |
char *strspx(char *str);
|
alpar@1
|
91 |
/* remove all spaces from character string */
|
alpar@1
|
92 |
|
alpar@1
|
93 |
#define strtrim _glp_lib_strtrim
|
alpar@1
|
94 |
char *strtrim(char *str);
|
alpar@1
|
95 |
/* remove trailing spaces from character string */
|
alpar@1
|
96 |
|
alpar@1
|
97 |
#define strrev _glp_lib_strrev
|
alpar@1
|
98 |
char *strrev(char *s);
|
alpar@1
|
99 |
/* reverse character string */
|
alpar@1
|
100 |
|
alpar@1
|
101 |
#define gcd _glp_lib_gcd
|
alpar@1
|
102 |
int gcd(int x, int y);
|
alpar@1
|
103 |
/* find greatest common divisor of two integers */
|
alpar@1
|
104 |
|
alpar@1
|
105 |
#define gcdn _glp_lib_gcdn
|
alpar@1
|
106 |
int gcdn(int n, int x[]);
|
alpar@1
|
107 |
/* find greatest common divisor of n integers */
|
alpar@1
|
108 |
|
alpar@1
|
109 |
#define lcm _glp_lib_lcm
|
alpar@1
|
110 |
int lcm(int x, int y);
|
alpar@1
|
111 |
/* find least common multiple of two integers */
|
alpar@1
|
112 |
|
alpar@1
|
113 |
#define lcmn _glp_lib_lcmn
|
alpar@1
|
114 |
int lcmn(int n, int x[]);
|
alpar@1
|
115 |
/* find least common multiple of n integers */
|
alpar@1
|
116 |
|
alpar@1
|
117 |
#define round2n _glp_lib_round2n
|
alpar@1
|
118 |
double round2n(double x);
|
alpar@1
|
119 |
/* round floating-point number to nearest power of two */
|
alpar@1
|
120 |
|
alpar@1
|
121 |
#define fp2rat _glp_lib_fp2rat
|
alpar@1
|
122 |
int fp2rat(double x, double eps, double *p, double *q);
|
alpar@1
|
123 |
/* convert floating-point number to rational number */
|
alpar@1
|
124 |
|
alpar@1
|
125 |
#define jday _glp_lib_jday
|
alpar@1
|
126 |
int jday(int d, int m, int y);
|
alpar@1
|
127 |
/* convert calendar date to Julian day number */
|
alpar@1
|
128 |
|
alpar@1
|
129 |
#define jdate _glp_lib_jdate
|
alpar@1
|
130 |
int jdate(int j, int *d, int *m, int *y);
|
alpar@1
|
131 |
/* convert Julian day number to calendar date */
|
alpar@1
|
132 |
|
alpar@1
|
133 |
#endif
|
alpar@1
|
134 |
|
alpar@1
|
135 |
/* eof */
|