|
Loading...
Searching...
No Matches
Go to the documentation of this file.
58#ifndef SOPLEX_NO_CONFIG_HEADER
59#include "soplex/config.h"
62#ifdef SOPLEX_WITH_BOOST
63#include "boost/multiprecision/number.hpp"
64#ifdef SOPLEX_WITH_FLOAT128
65#include <boost/multiprecision/float128.hpp>
68#ifdef SOPLEX_WITH_MPFR
70#include <boost/multiprecision/mpfr.hpp>
72#include "boost/multiprecision/debug_adaptor.hpp"
75#ifdef SOPLEX_WITH_CPPMPF
76#include <boost/multiprecision/cpp_dec_float.hpp>
80#include <boost/multiprecision/gmp.hpp>
82#include <boost/multiprecision/cpp_int.hpp>
93#define SOPLEX_VERSION 604
94#define SOPLEX_SUBVERSION 0
95#define SOPLEX_APIVERSION 13
96#define SOPLEX_COPYRIGHT "Copyright (c) 1996-2023 Zuse Institute Berlin (ZIB)"
113#if defined (NDEBUG) && defined (WITH_WARNINGS)
114#define ASSERT_WARN( prefix, expr ) \
119 << " failed assertion on line " << __LINE__ \
120 << " in file " << __FILE__ << ": " \
125#define ASSERT_WARN( prefix, expr ) ( assert( expr ) )
141#ifdef DISABLE_VERBOSITY
142#define DO_WITH_TMP_VERBOSITY( verbosity, spxout, do_something ) {}
143#define DO_WITH_ERR_VERBOSITY( do_something ) {}
145#define DO_WITH_TMP_VERBOSITY( verbosity, spxout, do_something ) \
147 if( &spxout != NULL ) \
149 if( verbosity <= spxout.getVerbosity() ) \
151 const SPxOut::Verbosity old_verbosity = spxout.getVerbosity(); \
152 spxout.setVerbosity( verbosity ); \
154 spxout.setVerbosity( old_verbosity ); \
158#define DO_WITH_ERR_VERBOSITY( do_something ) { do_something; }
162#define MSG_ERROR(x) { DO_WITH_ERR_VERBOSITY( x ) }
164#define MSG_WARNING(spxout, x) { DO_WITH_TMP_VERBOSITY( SPxOut::WARNING, spxout, x ) }
166#define MSG_INFO1(spxout, x) { DO_WITH_TMP_VERBOSITY( SPxOut::INFO1, spxout, x ) }
168#define MSG_INFO2(spxout, x) { DO_WITH_TMP_VERBOSITY( SPxOut::INFO2, spxout, x ) }
170#define MSG_INFO3(spxout, x) { DO_WITH_TMP_VERBOSITY( SPxOut::INFO3, spxout, x ) }
172extern bool msginconsistent( const char* name, const char* file, int line);
174#define MSGinconsistent(name) msginconsistent(name, __FILE__, __LINE__)
176#if defined(SOPLEX_DEBUG)
178#define MSG_DEBUG(x) { x; }
189#if !defined(THREADLOCAL)
190#if defined(_MSC_VER) && _MSC_VER < 1900
193#define THREADLOCAL thread_local
203#ifdef WITH_LONG_DOUBLE
206typedef long double Real;
210#define REAL_FORMAT "Lf"
213#ifndef DEFAULT_BND_VIOL
214#define DEFAULT_BND_VIOL 1e-12L
217#ifndef DEFAULT_EPS_ZERO
218#define DEFAULT_EPS_ZERO 1e-28L
221#ifndef DEFAULT_EPS_FACTOR
222#define DEFAULT_EPS_FACTOR 1e-30L
225#ifndef DEFAULT_EPS_UPDATE
226#define DEFAULT_EPS_UPDATE 1e-26L
228#ifndef DEFAULT_EPS_PIVOT
229#define DEFAULT_EPS_PIVOT 1e-20L
232#define DEFAULT_INFINITY 1e100L
243#define REAL_FORMAT "f"
246#ifndef DEFAULT_BND_VIOL
247#define DEFAULT_BND_VIOL 1e-1f
250#ifndef DEFAULT_EPS_ZERO
251#define DEFAULT_EPS_ZERO 1e-7f
253#ifndef DEFAULT_EPS_FACTOR
254#define DEFAULT_EPS_FACTOR 1e-7f
256#ifndef DEFAULT_EPS_UPDATE
257#define DEFAULT_EPS_UPDATE 1e-6f
259#ifndef DEFAULT_EPS_PIVOT
260#define DEFAULT_EPS_PIVOT 1e-6f
262#define DEFAULT_INFINITY 1e35f
270#define REAL_FORMAT "lf"
273#ifndef DEFAULT_BND_VIOL
274#define DEFAULT_BND_VIOL 1e-6
277#ifndef DEFAULT_EPS_ZERO
278#define DEFAULT_EPS_ZERO 1e-16
280#ifndef DEFAULT_EPS_FACTOR
281#define DEFAULT_EPS_FACTOR 1e-20
283#ifndef DEFAULT_EPS_UPDATE
284#define DEFAULT_EPS_UPDATE 1e-16
286#ifndef DEFAULT_EPS_PIVOT
287#define DEFAULT_EPS_PIVOT 1e-10
289#define DEFAULT_INFINITY 1e100
294#define MAXIMUM(x,y) ((x)>(y) ? (x) : (y))
295#define MINIMUM(x,y) ((x)<(y) ? (x) : (y))
297#define SPX_MAXSTRLEN 1024
355#ifdef WITH_LONG_DOUBLE
357inline Real spxNextafter(Real x, Real y)
359 return nextafterl(x, y);
417#if defined(_WIN32) || defined(_WIN64)
424 if( n < 0 || ( size_t) n >= len)
430 MSG_ERROR(std::cerr << "vsnprintf returned " << n << " while reading: " << s << std::endl;)
441#ifdef SOPLEX_WITH_BOOST
443using namespace boost::multiprecision;
445#ifdef SOPLEX_WITH_GMP
446template<boost::multiprecision::expression_ template_option eto>
447inline number<gmp_rational, eto> ldexp(number<gmp_rational, eto>, int exp)
450 return number<gmp_rational>();
453template<boost::multiprecision::expression_ template_option eto>
454inline number<gmp_rational, eto> frexp(number<gmp_rational, eto>, int* exp)
457 return number<gmp_rational>();
460inline cpp_rational ldexp(cpp_rational r, int exp)
463 return cpp_rational();
466inline cpp_rational frexp(cpp_rational, int* exp)
469 return cpp_rational();
474template < typename T, boost::multiprecision::expression_ template_option eto>
475boost::multiprecision::number<T, eto> spxFrexp(boost::multiprecision::number<T, eto> y, int* exp)
477 return frexp(y, exp);
481template < typename T, boost::multiprecision::expression_ template_option eto>
482boost::multiprecision::number<T> spxLdexp(boost::multiprecision::number<T, eto> x, int exp)
484 return ldexp(x, exp);
488template < typename T, expression_ template_option ep>
489number<T, ep> spxSqrt(number<T, ep> a)
495template < typename T, expression_ template_option eto>
517template < typename T, expression_ template_option et>
518inline number<T, et> maxAbs(
519 number<T, et> a, number<T, et> b)
521 const auto absa = spxAbs(a);
522 const auto absb = spxAbs(b);
524 return absa > absb ? absa : absb;
527template < typename T, expression_ template_option et>
528inline number<T, et> relDiff(number<T, et> a,
531 return (a - b) / ( maxAbs(a, b) > 1.0 ? maxAbs(a, b) : 1.0);
539#include "spxdefines.hpp"
Safe arrays of data objects.
static THREADLOCAL Real s_epsilon_update epsilon for factorization update
static THREADLOCAL Real s_epsilon_factorization epsilon for factorization
static Real epsilonFactorization()
static void setEpsilonUpdate(Real eps)
static Real epsilonPivot()
static void setEpsilonFactorization(Real eps)
static THREADLOCAL Real s_epsilon default allowed additive zero: 1.0 + EPS_ZERO == 1.0
static void setEpsilon(Real eps)
static void setEpsilonPivot(Real eps)
static THREADLOCAL Real s_epsilon_pivot epsilon for pivot zero tolerance in factorization
static Real epsilonUpdate()
Everything should be within this namespace.
Real spxNextafter(Real x, Real y)
Real spxSqrt(Real a) returns square root
Real relDiff(Real a, Real b) returns (a-b) / max(|a|,|b|,1.0)
int spxSnprintf(char *t, size_t len, const char *s,...) safe version of snprintf
Real maxAbs(Real a, Real b) returns max(|a|,|b|)
#define THREADLOCAL SOPLEX_DEBUG.
#define MSG_ERROR(x) Prints out message x if the verbosity level is at least SPxOut::ERROR.
|