Sandia Home Sandia Home
Main Page | Publications | Downloads | Configuration | Running the Code | Solver Parameters | FAQ | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

cddmp.h

Go to the documentation of this file.
00001 
00043 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00044 
00045 /* cddmp.h       (cddlib arithmetic operations using gmp)
00046    Copyright: Komei Fukuda 2000, fukuda@ifor.math.ethz.ch
00047    Version 0.94, Aug. 4, 2005
00048 */
00049 
00050 /* This program is free software; you can redistribute it and/or modify
00051    it under the terms of the GNU General Public License as published by
00052    the Free Software Foundation; either version 2 of the License, or
00053    (at your option) any later version.
00054 
00055    This program is distributed in the hope that it will be useful,
00056    but WITHOUT ANY WARRANTY; without even the implied warranty of
00057    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00058    GNU General Public License for more details.
00059 
00060    You should have received a copy of the GNU General Public License
00061    along with this program; if not, write to the Free Software
00062    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00063  */
00064 
00065 #ifndef  __CDDMP_H
00066 #define  __CDDMP_H
00067 #endif  /* __CDDMP_H */
00068 
00069 /**********************************/
00070 /*         MACROS                 */
00071 /* dependent on mp implementation */
00072 /**********************************/
00073 
00074 #if defined GMPRATIONAL
00075  #include "gmp.h"
00076  #define dd_ARITHMETIC "GMP rational"
00077  #define dd_init(a)              mpq_init(a)     
00078  #define dd_clear(a)             mpq_clear(a)     
00079  #define dd_set(a, b)            mpq_set(a,b)     
00080  #define dd_set_si(a, b)         ddd_mpq_set_si(a,b)  /* defined in cddgmp.c */
00081  #define dd_set_si2(a, b, c)     mpq_set_si(a,b,c)    /* gmp 3.1 or higher */
00082  #define dd_add(a, b, c)         mpq_add(a,b,c)
00083  #define dd_sub(a, b, c)         mpq_sub(a,b,c)
00084  #define dd_mul(a, b, c)         mpq_mul(a,b,c)
00085  #define dd_div(a, b, c)         mpq_div(a,b,c)
00086  #define dd_neg(a, b)            mpq_neg(a,b)
00087  #define dd_inv(a, b)            mpq_inv(a,b)
00088  #define dd_cmp(a, b)            mpq_cmp(a,b)  
00089     /* returns pos if a>b, 0 if a=b, negative if a<b */
00090  #define dd_sgn(a)               mpq_sgn(a)
00091     /* returns nonzero if equal.  much faster than mpq_cmp. */
00092  #define dd_get_d(a)             mpq_get_d(a)     
00093 #elif defined GMPFLOAT
00094  #include "gmp.h"
00095  #define dd_ARITHMETIC "GMP float"
00096  #define dd_init(a)              mpf_init(a)     
00097  #define dd_clear(a)             mpf_clear(a)     
00098  #define dd_set(a, b)            mpf_set(a,b)     
00099  #define dd_set_d(a, b)          mpf_set_d(a,b)     
00100  #define dd_set_si(a, b)         mpf_set_si(a,b)     
00101  #define dd_set_si2(a, b, c)     mpf_set_si(a,b,c)    /* gmp 3.1 or higher */
00102  #define dd_add(a, b, c)         mpf_add(a,b,c)
00103  #define dd_sub(a, b, c)         mpf_sub(a,b,c)
00104  #define dd_mul(a, b, c)         mpf_mul(a,b,c)
00105  #define dd_div(a, b, c)         mpf_div(a,b,c)
00106  #define dd_neg(a, b)            mpf_neg(a,b)
00107  #define dd_inv(a, b)            mpf_inv(a,b)
00108  #define dd_cmp(a, b)            mpf_cmp(a,b)  
00109     /* returns pos if a>b, 0 if a=b, negative if a<b */
00110  #define dd_sgn(a)               mpf_sgn(a)
00111  #define dd_get_d(a)             mpf_get_d(a)     
00112 #else /* built-in C double */
00113  #define dd_ARITHMETIC "C double"
00114  #define dd_CDOUBLE
00115  #define dd_init(a)              ddd_init(a)     
00116  #define dd_clear(a)             ddd_clear(a)     
00117  #define dd_set(a, b)            ddd_set(a,b)     
00118  #define dd_set_si(a, b)         ddd_set_si(a,b)     
00119  #define dd_set_si2(a, b, c)     ddd_set_si2(a,b,c)  
00120  #define dd_set_d(a, b)          ddd_set_d(a,b)     
00121  #define dd_add(a, b, c)         ddd_add(a,b,c)
00122  #define dd_sub(a, b, c)         ddd_sub(a,b,c)
00123  #define dd_mul(a, b, c)         ddd_mul(a,b,c)
00124  #define dd_div(a, b, c)         ddd_div(a,b,c)
00125  #define dd_neg(a, b)            ddd_neg(a,b)
00126  #define dd_inv(a, b)            ddd_inv(a,b)
00127  #define dd_cmp(a, b)            ddd_cmp(a,b)  
00128     /* returns pos if a>b, 0 if a=b, negative if a<b */
00129  #define dd_sgn(a)               ddd_sgn(a)
00130  #define dd_get_d(a)             ddd_get_d(a)     
00131 #endif
00132 
00133 
00134 #if defined GMPRATIONAL
00135  typedef mpq_t mytype;
00136 #elif defined GMPFLOAT
00137  typedef mpf_t mytype;
00138 #else /* built-in C double */
00139  typedef double mytype[1];
00140 #endif
00141 
00142 void ddd_mpq_set_si(mytype,signed long);
00143 void ddd_init(mytype);  
00144 void ddd_clear(mytype);
00145 void ddd_set(mytype,mytype);
00146 void ddd_set_d(mytype,double);
00147 void ddd_set_si(mytype,signed long);
00148 void ddd_set_si2(mytype,signed long, unsigned long);
00149 void ddd_add(mytype,mytype,mytype);
00150 void ddd_sub(mytype,mytype,mytype);
00151 void ddd_mul(mytype,mytype,mytype);
00152 void ddd_div(mytype,mytype,mytype);
00153 void ddd_neg(mytype,mytype);
00154 void ddd_inv(mytype,mytype);
00155 int ddd_cmp(mytype,mytype);
00156 int ddd_sgn(mytype);
00157 double ddd_get_d(mytype);
00158 void ddd_mpq_set_si(mytype,signed long);
00159 
00160 void dd_set_global_constants(void);
00161 
00162 /* end of  cddmp.h  */
00163 
00164 #endif

 

© Sandia Corporation | Site Contact | Privacy and Security

Generated on Fri Feb 16 10:33:35 2007 for APPSPACK 5.0.1 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2002