Ignore:
Timestamp:
Jan 6, 2019 2:43:06 PM (4 months ago)
Author:
unxusr
Message:

formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/CoinAbcCommon.hpp

    r2235 r2385  
    3131#endif
    3232#ifndef ABC_PARALLEL
    33 #ifdef HAS_CILK 
     33#ifdef HAS_CILK
    3434#define ABC_PARALLEL 2
    3535#else
     
    3737#endif
    3838#endif
    39 #if ABC_PARALLEL==2
     39#if ABC_PARALLEL == 2
    4040//#define EARLY_FACTORIZE
    4141#ifndef FAKE_CILK
     
    5454#define SLACK_VALUE 1
    5555#define ABC_INSTRUMENT 1 //2
    56 #if ABC_INSTRUMENT!=2
     56#if ABC_INSTRUMENT != 2
    5757// Below so can do deterministic B&B
    58 #define instrument_start(name,x)
     58#define instrument_start(name, x)
    5959#define instrument_add(x)
    6060#define instrument_end()
    6161// one off
    62 #define instrument_do(name,x)
     62#define instrument_do(name, x)
    6363// as end but multiply by factor
    6464#define instrument_end_and_adjust(x)
    6565#else
    66 void instrument_start(const char * type,int numberRowsEtc);
     66void instrument_start(const char *type, int numberRowsEtc);
    6767void instrument_add(int count);
    68 void instrument_do(const char * type,double count);
     68void instrument_do(const char *type, double count);
    6969void instrument_end();
    7070void instrument_end_and_adjust(double factor);
     
    7676#define ABC_INTEL
    7777#endif
    78 #if COIN_BIG_DOUBLE==1
     78#if COIN_BIG_DOUBLE == 1
    7979#undef USE_TEST_ZERO
    8080#undef USE_TEST_REALLY_ZERO
     
    8888#ifdef USE_TEST_ZERO
    8989#if __BYTE_ORDER == __LITTLE_ENDIAN
    90 #define TEST_DOUBLE_NONZERO(x) ((reinterpret_cast<int *>(&x))[1]!=0)
    91 #else
    92 #define TEST_DOUBLE_NONZERO(x) ((reinterpret_cast<int *>(&x))[0]!=0)
     90#define TEST_DOUBLE_NONZERO(x) ((reinterpret_cast< int * >(&x))[1] != 0)
     91#else
     92#define TEST_DOUBLE_NONZERO(x) ((reinterpret_cast< int * >(&x))[0] != 0)
    9393#endif
    9494#else
     
    105105#ifdef USE_TEST_REALLY_ZERO
    106106#if __BYTE_ORDER == __LITTLE_ENDIAN
    107 #define TEST_DOUBLE_REALLY_NONZERO(x) ((reinterpret_cast<int *>(&x))[1]!=0)
    108 #else
    109 #define TEST_DOUBLE_REALLY_NONZERO(x) ((reinterpret_cast<int *>(&x))[0]!=0)
     107#define TEST_DOUBLE_REALLY_NONZERO(x) ((reinterpret_cast< int * >(&x))[1] != 0)
     108#else
     109#define TEST_DOUBLE_REALLY_NONZERO(x) ((reinterpret_cast< int * >(&x))[0] != 0)
    110110#endif
    111111#else
     
    114114#ifdef USE_TEST_ZERO_REGISTER
    115115#if __BYTE_ORDER == __LITTLE_ENDIAN
    116 #define TEST_DOUBLE_NONZERO_REGISTER(x) ((reinterpret_cast<int *>(&x))[1]!=0)
    117 #else
    118 #define TEST_DOUBLE_NONZERO_REGISTER(x) ((reinterpret_cast<int *>(&x))[0]!=0)
     116#define TEST_DOUBLE_NONZERO_REGISTER(x) ((reinterpret_cast< int * >(&x))[1] != 0)
     117#else
     118#define TEST_DOUBLE_NONZERO_REGISTER(x) ((reinterpret_cast< int * >(&x))[0] != 0)
    119119#endif
    120120#else
     
    127127#ifdef USE_TEST_LESS_TOLERANCE
    128128#if __BYTE_ORDER == __LITTLE_ENDIAN
    129 #define TEST_LESS_THAN_TOLERANCE(x) ((reinterpret_cast<int *>(&x))[1]&0x7ff00000<0x3d400000)
    130 #define TEST_LESS_THAN_UPDATE_TOLERANCE(x) ((reinterpret_cast<int *>(&x))[1]&0x7ff00000<0x3d400000)
    131 #else
    132 #define TEST_LESS_THAN_TOLERANCE(x) ((reinterpret_cast<int *>(&x))[0]&0x7ff00000<0x3d400000)
    133 #define TEST_LESS_THAN_UPDATE_TOLERANCE(x) ((reinterpret_cast<int *>(&x))[0]&0x7ff00000<0x3d400000)
    134 #endif
    135 #else
    136 #define TEST_LESS_THAN_TOLERANCE(x) (fabs(x)<pow(0.5,43))
    137 #define TEST_LESS_THAN_UPDATE_TOLERANCE(x) (fabs(x)<pow(0.5,43))
     129#define TEST_LESS_THAN_TOLERANCE(x) ((reinterpret_cast< int * >(&x))[1] & 0x7ff00000 < 0x3d400000)
     130#define TEST_LESS_THAN_UPDATE_TOLERANCE(x) ((reinterpret_cast< int * >(&x))[1] & 0x7ff00000 < 0x3d400000)
     131#else
     132#define TEST_LESS_THAN_TOLERANCE(x) ((reinterpret_cast< int * >(&x))[0] & 0x7ff00000 < 0x3d400000)
     133#define TEST_LESS_THAN_UPDATE_TOLERANCE(x) ((reinterpret_cast< int * >(&x))[0] & 0x7ff00000 < 0x3d400000)
     134#endif
     135#else
     136#define TEST_LESS_THAN_TOLERANCE(x) (fabs(x) < pow(0.5, 43))
     137#define TEST_LESS_THAN_UPDATE_TOLERANCE(x) (fabs(x) < pow(0.5, 43))
    138138#endif
    139139#ifdef USE_TEST_LESS_TOLERANCE_REGISTER
    140140#if __BYTE_ORDER == __LITTLE_ENDIAN
    141 #define TEST_LESS_THAN_TOLERANCE_REGISTER(x) ((reinterpret_cast<int *>(&x))[1]&0x7ff00000<0x3d400000)
    142 #else
    143 #define TEST_LESS_THAN_TOLERANCE_REGISTER(x) ((reinterpret_cast<int *>(&x))[0]&0x7ff00000<0x3d400000)
    144 #endif
    145 #else
    146 #define TEST_LESS_THAN_TOLERANCE_REGISTER(x) (fabs(x)<pow(0.5,43))
    147 #endif
    148 #else
    149 #define TEST_LESS_THAN_TOLERANCE(x) (fabs(x)<zeroTolerance_)
    150 #define TEST_LESS_THAN_TOLERANCE_REGISTER(x) (fabs(x)<zeroTolerance_)
    151 #endif
    152 #if COIN_BIG_DOUBLE!=1
     141#define TEST_LESS_THAN_TOLERANCE_REGISTER(x) ((reinterpret_cast< int * >(&x))[1] & 0x7ff00000 < 0x3d400000)
     142#else
     143#define TEST_LESS_THAN_TOLERANCE_REGISTER(x) ((reinterpret_cast< int * >(&x))[0] & 0x7ff00000 < 0x3d400000)
     144#endif
     145#else
     146#define TEST_LESS_THAN_TOLERANCE_REGISTER(x) (fabs(x) < pow(0.5, 43))
     147#endif
     148#else
     149#define TEST_LESS_THAN_TOLERANCE(x) (fabs(x) < zeroTolerance_)
     150#define TEST_LESS_THAN_TOLERANCE_REGISTER(x) (fabs(x) < zeroTolerance_)
     151#endif
     152#if COIN_BIG_DOUBLE != 1
    153153typedef unsigned int CoinExponent;
    154154#if __BYTE_ORDER == __LITTLE_ENDIAN
    155 #define ABC_EXPONENT(x) ((reinterpret_cast<int *>(&x))[1]&0x7ff00000)
    156 #else
    157 #define ABC_EXPONENT(x) ((reinterpret_cast<int *>(&x))[0]&0x7ff00000)
    158 #endif
    159 #define TEST_EXPONENT_LESS_THAN_TOLERANCE(x) (x<0x3d400000)
    160 #define TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(x) (x<0x3d400000)
     155#define ABC_EXPONENT(x) ((reinterpret_cast< int * >(&x))[1] & 0x7ff00000)
     156#else
     157#define ABC_EXPONENT(x) ((reinterpret_cast< int * >(&x))[0] & 0x7ff00000)
     158#endif
     159#define TEST_EXPONENT_LESS_THAN_TOLERANCE(x) (x < 0x3d400000)
     160#define TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(x) (x < 0x3d400000)
    161161#define TEST_EXPONENT_NON_ZERO(x) (x)
    162162#else
    163 typedef long double  CoinExponent;
     163typedef long double CoinExponent;
    164164#define ABC_EXPONENT(x) (x)
    165 #define TEST_EXPONENT_LESS_THAN_TOLERANCE(x) (fabs(x)<pow(0.5,43))
    166 #define TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(x) (fabs(x)<pow(0.5,43))
     165#define TEST_EXPONENT_LESS_THAN_TOLERANCE(x) (fabs(x) < pow(0.5, 43))
     166#define TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(x) (fabs(x) < pow(0.5, 43))
    167167#define TEST_EXPONENT_NON_ZERO(x) (x)
    168168#endif
     
    176176#define COINFACTORIZATION_MASK_PER_INT 0x1f
    177177#endif
    178 #if ABC_USE_HOMEGROWN_LAPACK==1
     178#if ABC_USE_HOMEGROWN_LAPACK == 1
    179179#define ABC_USE_LAPACK
    180180#endif
    181181#ifdef ABC_USE_LAPACK
    182 #define F77_FUNC(x,y) x##_
     182#define F77_FUNC(x, y) x##_
    183183#define ABC_DENSE_CODE 1
    184184/* Type of Fortran integer translated into C */
     
    188188typedef const int cipfint;
    189189#endif
    190 enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102 };
    191 enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113,
    192                       AtlasConj=114};
     190enum CBLAS_ORDER { CblasRowMajor = 101,
     191  CblasColMajor = 102 };
     192enum CBLAS_TRANSPOSE { CblasNoTrans = 111,
     193  CblasTrans = 112,
     194  CblasConjTrans = 113,
     195  AtlasConj = 114 };
    193196//#define CLAPACK
    194197// using simple lapack interface
    195 extern "C"
    196 {
    197   /** LAPACK Fortran subroutine DGETRS. */
    198   void F77_FUNC(dgetrs,DGETRS)(char *trans, cipfint *n,
    199                                cipfint *nrhs, const CoinSimplexDouble *A, cipfint *ldA,
    200                                cipfint * ipiv, CoinSimplexDouble *B, cipfint *ldB, ipfint *info,
    201                                int trans_len);
    202   /** LAPACK Fortran subroutine DGETRF. */
    203   void F77_FUNC(dgetrf,DGETRF)(ipfint * m, ipfint *n,
    204                                CoinSimplexDouble *A, ipfint *ldA,
    205                                ipfint * ipiv, ipfint *info);
    206   int clapack_dgetrf(const enum CBLAS_ORDER Order, const int M, const int N,
    207                      double *A, const int lda, int *ipiv);
    208   int clapack_dgetrs
    209   (const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE Trans,
    210    const int N, const int NRHS, const double *A, const int lda,
    211    const int *ipiv, double *B, const int ldb);
     198extern "C" {
     199/** LAPACK Fortran subroutine DGETRS. */
     200void F77_FUNC(dgetrs, DGETRS)(char *trans, cipfint *n,
     201  cipfint *nrhs, const CoinSimplexDouble *A, cipfint *ldA,
     202  cipfint *ipiv, CoinSimplexDouble *B, cipfint *ldB, ipfint *info,
     203  int trans_len);
     204/** LAPACK Fortran subroutine DGETRF. */
     205void F77_FUNC(dgetrf, DGETRF)(ipfint *m, ipfint *n,
     206  CoinSimplexDouble *A, ipfint *ldA,
     207  ipfint *ipiv, ipfint *info);
     208int clapack_dgetrf(const enum CBLAS_ORDER Order, const int M, const int N,
     209  double *A, const int lda, int *ipiv);
     210int clapack_dgetrs(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE Trans,
     211  const int N, const int NRHS, const double *A, const int lda,
     212  const int *ipiv, double *B, const int ldb);
    212213}
    213214#else // use home grown
     
    224225#endif
    225226typedef unsigned char CoinCheckZero;
    226 template <class T> inline void
    227 CoinAbcMemset0(register T* to, const int size)
     227template < class T >
     228inline void
     229CoinAbcMemset0(register T *to, const int size)
    228230{
    229231#ifndef NDEBUG
     
    231233  if (size < 0)
    232234    throw CoinError("trying to fill negative number of entries",
    233                     "CoinAbcMemset0", "");
    234 #endif
    235   std::memset(to,0,size*sizeof(T));
     235      "CoinAbcMemset0", "");
     236#endif
     237  std::memset(to, 0, size * sizeof(T));
    236238}
    237 template <class T> inline void
    238 CoinAbcMemcpy(register T* to, register const T* from, const int size )
     239template < class T >
     240inline void
     241CoinAbcMemcpy(register T *to, register const T *from, const int size)
    239242{
    240243#ifndef NDEBUG
     
    242245  if (size < 0)
    243246    throw CoinError("trying to copy negative number of entries",
    244                     "CoinAbcMemcpy", "");
    245  
    246 #endif
    247   std::memcpy(to,from,size*sizeof(T));
     247      "CoinAbcMemcpy", "");
     248
     249#endif
     250  std::memcpy(to, from, size * sizeof(T));
    248251}
    249252class ClpSimplex;
    250253class AbcSimplex;
    251 class AbcTolerancesEtc  {
    252  
     254class AbcTolerancesEtc {
     255
    253256public:
    254  
    255  
    256  
    257257  ///@name Constructors and destructors
    258258  //@{
    259259  /// Default Constructor
    260260  AbcTolerancesEtc();
    261  
     261
    262262  /// Useful Constructors
    263   AbcTolerancesEtc(const ClpSimplex * model);
    264   AbcTolerancesEtc(const AbcSimplex * model);
    265  
     263  AbcTolerancesEtc(const ClpSimplex *model);
     264  AbcTolerancesEtc(const AbcSimplex *model);
     265
    266266  /// Copy constructor
    267267  AbcTolerancesEtc(const AbcTolerancesEtc &);
    268  
     268
    269269  /// Assignment operator
    270   AbcTolerancesEtc & operator=(const AbcTolerancesEtc& rhs);
    271  
     270  AbcTolerancesEtc &operator=(const AbcTolerancesEtc &rhs);
     271
    272272  /// Destructor
    273   ~AbcTolerancesEtc ();
     273  ~AbcTolerancesEtc();
    274274  //@}
    275  
    276  
     275
    277276  //---------------------------------------------------------------------------
    278  
     277
    279278public:
    280279  ///@name Public member data
     
    330329};
    331330#endif
     331
     332/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
     333*/
Note: See TracChangeset for help on using the changeset viewer.