alpar@9: /* glplib.h (miscellaneous library routines) */ alpar@9: alpar@9: /*********************************************************************** alpar@9: * This code is part of GLPK (GNU Linear Programming Kit). alpar@9: * alpar@9: * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, alpar@9: * 2009, 2010, 2011 Andrew Makhorin, Department for Applied Informatics, alpar@9: * Moscow Aviation Institute, Moscow, Russia. All rights reserved. alpar@9: * E-mail: . alpar@9: * alpar@9: * GLPK is free software: you can redistribute it and/or modify it alpar@9: * under the terms of the GNU General Public License as published by alpar@9: * the Free Software Foundation, either version 3 of the License, or alpar@9: * (at your option) any later version. alpar@9: * alpar@9: * GLPK is distributed in the hope that it will be useful, but WITHOUT alpar@9: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY alpar@9: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public alpar@9: * License for more details. alpar@9: * alpar@9: * You should have received a copy of the GNU General Public License alpar@9: * along with GLPK. If not, see . alpar@9: ***********************************************************************/ alpar@9: alpar@9: #ifndef GLPLIB_H alpar@9: #define GLPLIB_H alpar@9: alpar@9: #define bigmul _glp_lib_bigmul alpar@9: void bigmul(int n, int m, unsigned short x[], unsigned short y[]); alpar@9: /* multiply unsigned integer numbers of arbitrary precision */ alpar@9: alpar@9: #define bigdiv _glp_lib_bigdiv alpar@9: void bigdiv(int n, int m, unsigned short x[], unsigned short y[]); alpar@9: /* divide unsigned integer numbers of arbitrary precision */ alpar@9: alpar@9: #ifndef GLP_LONG_DEFINED alpar@9: #define GLP_LONG_DEFINED alpar@9: typedef struct { int lo, hi; } glp_long; alpar@9: /* long integer data type */ alpar@9: #endif alpar@9: alpar@9: typedef struct { glp_long quot, rem; } glp_ldiv; alpar@9: /* result of long integer division */ alpar@9: alpar@9: #define xlset _glp_lib_xlset alpar@9: glp_long xlset(int x); alpar@9: /* expand integer to long integer */ alpar@9: alpar@9: #define xlneg _glp_lib_xlneg alpar@9: glp_long xlneg(glp_long x); alpar@9: /* negate long integer */ alpar@9: alpar@9: #define xladd _glp_lib_xladd alpar@9: glp_long xladd(glp_long x, glp_long y); alpar@9: /* add long integers */ alpar@9: alpar@9: #define xlsub _glp_lib_xlsub alpar@9: glp_long xlsub(glp_long x, glp_long y); alpar@9: /* subtract long integers */ alpar@9: alpar@9: #define xlcmp _glp_lib_xlcmp alpar@9: int xlcmp(glp_long x, glp_long y); alpar@9: /* compare long integers */ alpar@9: alpar@9: #define xlmul _glp_lib_xlmul alpar@9: glp_long xlmul(glp_long x, glp_long y); alpar@9: /* multiply long integers */ alpar@9: alpar@9: #define xldiv _glp_lib_xldiv alpar@9: glp_ldiv xldiv(glp_long x, glp_long y); alpar@9: /* divide long integers */ alpar@9: alpar@9: #define xltod _glp_lib_xltod alpar@9: double xltod(glp_long x); alpar@9: /* convert long integer to double */ alpar@9: alpar@9: #define xltoa _glp_lib_xltoa alpar@9: char *xltoa(glp_long x, char *s); alpar@9: /* convert long integer to character string */ alpar@9: alpar@9: #define str2int _glp_lib_str2int alpar@9: int str2int(const char *str, int *val); alpar@9: /* convert character string to value of int type */ alpar@9: alpar@9: #define str2num _glp_lib_str2num alpar@9: int str2num(const char *str, double *val); alpar@9: /* convert character string to value of double type */ alpar@9: alpar@9: #define strspx _glp_lib_strspx alpar@9: char *strspx(char *str); alpar@9: /* remove all spaces from character string */ alpar@9: alpar@9: #define strtrim _glp_lib_strtrim alpar@9: char *strtrim(char *str); alpar@9: /* remove trailing spaces from character string */ alpar@9: alpar@9: #define strrev _glp_lib_strrev alpar@9: char *strrev(char *s); alpar@9: /* reverse character string */ alpar@9: alpar@9: #define gcd _glp_lib_gcd alpar@9: int gcd(int x, int y); alpar@9: /* find greatest common divisor of two integers */ alpar@9: alpar@9: #define gcdn _glp_lib_gcdn alpar@9: int gcdn(int n, int x[]); alpar@9: /* find greatest common divisor of n integers */ alpar@9: alpar@9: #define lcm _glp_lib_lcm alpar@9: int lcm(int x, int y); alpar@9: /* find least common multiple of two integers */ alpar@9: alpar@9: #define lcmn _glp_lib_lcmn alpar@9: int lcmn(int n, int x[]); alpar@9: /* find least common multiple of n integers */ alpar@9: alpar@9: #define round2n _glp_lib_round2n alpar@9: double round2n(double x); alpar@9: /* round floating-point number to nearest power of two */ alpar@9: alpar@9: #define fp2rat _glp_lib_fp2rat alpar@9: int fp2rat(double x, double eps, double *p, double *q); alpar@9: /* convert floating-point number to rational number */ alpar@9: alpar@9: #define jday _glp_lib_jday alpar@9: int jday(int d, int m, int y); alpar@9: /* convert calendar date to Julian day number */ alpar@9: alpar@9: #define jdate _glp_lib_jdate alpar@9: int jdate(int j, int *d, int *m, int *y); alpar@9: /* convert Julian day number to calendar date */ alpar@9: alpar@9: #endif alpar@9: alpar@9: /* eof */