src/glplib.h
changeset 1 c445c931472f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/glplib.h	Mon Dec 06 13:09:21 2010 +0100
     1.3 @@ -0,0 +1,135 @@
     1.4 +/* glplib.h (miscellaneous library routines) */
     1.5 +
     1.6 +/***********************************************************************
     1.7 +*  This code is part of GLPK (GNU Linear Programming Kit).
     1.8 +*
     1.9 +*  Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
    1.10 +*  2009, 2010 Andrew Makhorin, Department for Applied Informatics,
    1.11 +*  Moscow Aviation Institute, Moscow, Russia. All rights reserved.
    1.12 +*  E-mail: <mao@gnu.org>.
    1.13 +*
    1.14 +*  GLPK is free software: you can redistribute it and/or modify it
    1.15 +*  under the terms of the GNU General Public License as published by
    1.16 +*  the Free Software Foundation, either version 3 of the License, or
    1.17 +*  (at your option) any later version.
    1.18 +*
    1.19 +*  GLPK is distributed in the hope that it will be useful, but WITHOUT
    1.20 +*  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    1.21 +*  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
    1.22 +*  License for more details.
    1.23 +*
    1.24 +*  You should have received a copy of the GNU General Public License
    1.25 +*  along with GLPK. If not, see <http://www.gnu.org/licenses/>.
    1.26 +***********************************************************************/
    1.27 +
    1.28 +#ifndef GLPLIB_H
    1.29 +#define GLPLIB_H
    1.30 +
    1.31 +#define bigmul _glp_lib_bigmul
    1.32 +void bigmul(int n, int m, unsigned short x[], unsigned short y[]);
    1.33 +/* multiply unsigned integer numbers of arbitrary precision */
    1.34 +
    1.35 +#define bigdiv _glp_lib_bigdiv
    1.36 +void bigdiv(int n, int m, unsigned short x[], unsigned short y[]);
    1.37 +/* divide unsigned integer numbers of arbitrary precision */
    1.38 +
    1.39 +#ifndef GLP_LONG_DEFINED
    1.40 +#define GLP_LONG_DEFINED
    1.41 +typedef struct { int lo, hi; } glp_long;
    1.42 +/* long integer data type */
    1.43 +#endif
    1.44 +
    1.45 +typedef struct { glp_long quot, rem; } glp_ldiv;
    1.46 +/* result of long integer division */
    1.47 +
    1.48 +#define xlset _glp_lib_xlset
    1.49 +glp_long xlset(int x);
    1.50 +/* expand integer to long integer */
    1.51 +
    1.52 +#define xlneg _glp_lib_xlneg
    1.53 +glp_long xlneg(glp_long x);
    1.54 +/* negate long integer */
    1.55 +
    1.56 +#define xladd _glp_lib_xladd
    1.57 +glp_long xladd(glp_long x, glp_long y);
    1.58 +/* add long integers */
    1.59 +
    1.60 +#define xlsub _glp_lib_xlsub
    1.61 +glp_long xlsub(glp_long x, glp_long y);
    1.62 +/* subtract long integers */
    1.63 +
    1.64 +#define xlcmp _glp_lib_xlcmp
    1.65 +int xlcmp(glp_long x, glp_long y);
    1.66 +/* compare long integers */
    1.67 +
    1.68 +#define xlmul _glp_lib_xlmul
    1.69 +glp_long xlmul(glp_long x, glp_long y);
    1.70 +/* multiply long integers */
    1.71 +
    1.72 +#define xldiv _glp_lib_xldiv
    1.73 +glp_ldiv xldiv(glp_long x, glp_long y);
    1.74 +/* divide long integers */
    1.75 +
    1.76 +#define xltod _glp_lib_xltod
    1.77 +double xltod(glp_long x);
    1.78 +/* convert long integer to double */
    1.79 +
    1.80 +#define xltoa _glp_lib_xltoa
    1.81 +char *xltoa(glp_long x, char *s);
    1.82 +/* convert long integer to character string */
    1.83 +
    1.84 +#define str2int _glp_lib_str2int
    1.85 +int str2int(const char *str, int *val);
    1.86 +/* convert character string to value of int type */
    1.87 +
    1.88 +#define str2num _glp_lib_str2num
    1.89 +int str2num(const char *str, double *val);
    1.90 +/* convert character string to value of double type */
    1.91 +
    1.92 +#define strspx _glp_lib_strspx
    1.93 +char *strspx(char *str);
    1.94 +/* remove all spaces from character string */
    1.95 +
    1.96 +#define strtrim _glp_lib_strtrim
    1.97 +char *strtrim(char *str);
    1.98 +/* remove trailing spaces from character string */
    1.99 +
   1.100 +#define strrev _glp_lib_strrev
   1.101 +char *strrev(char *s);
   1.102 +/* reverse character string */
   1.103 +
   1.104 +#define gcd _glp_lib_gcd
   1.105 +int gcd(int x, int y);
   1.106 +/* find greatest common divisor of two integers */
   1.107 +
   1.108 +#define gcdn _glp_lib_gcdn
   1.109 +int gcdn(int n, int x[]);
   1.110 +/* find greatest common divisor of n integers */
   1.111 +
   1.112 +#define lcm _glp_lib_lcm
   1.113 +int lcm(int x, int y);
   1.114 +/* find least common multiple of two integers */
   1.115 +
   1.116 +#define lcmn _glp_lib_lcmn
   1.117 +int lcmn(int n, int x[]);
   1.118 +/* find least common multiple of n integers */
   1.119 +
   1.120 +#define round2n _glp_lib_round2n
   1.121 +double round2n(double x);
   1.122 +/* round floating-point number to nearest power of two */
   1.123 +
   1.124 +#define fp2rat _glp_lib_fp2rat
   1.125 +int fp2rat(double x, double eps, double *p, double *q);
   1.126 +/* convert floating-point number to rational number */
   1.127 +
   1.128 +#define jday _glp_lib_jday
   1.129 +int jday(int d, int m, int y);
   1.130 +/* convert calendar date to Julian day number */
   1.131 +
   1.132 +#define jdate _glp_lib_jdate
   1.133 +int jdate(int j, int *d, int *m, int *y);
   1.134 +/* convert Julian day number to calendar date */
   1.135 +
   1.136 +#endif
   1.137 +
   1.138 +/* eof */