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