ruby-cbc 0.1.9 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/Rakefile +0 -2
- data/lib/ruby-cbc.rb +1 -1
- data/lib/ruby-cbc/problem.rb +6 -8
- data/lib/ruby-cbc/version.rb +1 -1
- data/ruby-cbc.gemspec +3 -2
- metadata +17 -287
- data/ext/ruby-cbc/cbc.i +0 -15
- data/ext/ruby-cbc/cbc_wrap.c +0 -4618
- data/ext/ruby-cbc/extconf.rb +0 -60
- data/ext/ruby-cbc/install/bin/cbc +0 -0
- data/ext/ruby-cbc/install/bin/clp +0 -0
- data/ext/ruby-cbc/install/include/coin/CbcBranchActual.hpp +0 -24
- data/ext/ruby-cbc/install/include/coin/CbcBranchAllDifferent.hpp +0 -62
- data/ext/ruby-cbc/install/include/coin/CbcBranchBase.hpp +0 -78
- data/ext/ruby-cbc/install/include/coin/CbcBranchCut.hpp +0 -183
- data/ext/ruby-cbc/install/include/coin/CbcBranchDecision.hpp +0 -129
- data/ext/ruby-cbc/install/include/coin/CbcBranchDefaultDecision.hpp +0 -100
- data/ext/ruby-cbc/install/include/coin/CbcBranchDynamic.hpp +0 -206
- data/ext/ruby-cbc/install/include/coin/CbcBranchLotsize.hpp +0 -242
- data/ext/ruby-cbc/install/include/coin/CbcBranchToFixLots.hpp +0 -94
- data/ext/ruby-cbc/install/include/coin/CbcBranchingObject.hpp +0 -236
- data/ext/ruby-cbc/install/include/coin/CbcClique.hpp +0 -303
- data/ext/ruby-cbc/install/include/coin/CbcCompare.hpp +0 -39
- data/ext/ruby-cbc/install/include/coin/CbcCompareActual.hpp +0 -14
- data/ext/ruby-cbc/install/include/coin/CbcCompareBase.hpp +0 -142
- data/ext/ruby-cbc/install/include/coin/CbcCompareDefault.hpp +0 -120
- data/ext/ruby-cbc/install/include/coin/CbcCompareDepth.hpp +0 -47
- data/ext/ruby-cbc/install/include/coin/CbcCompareEstimate.hpp +0 -48
- data/ext/ruby-cbc/install/include/coin/CbcCompareObjective.hpp +0 -49
- data/ext/ruby-cbc/install/include/coin/CbcConfig.h +0 -14
- data/ext/ruby-cbc/install/include/coin/CbcConsequence.hpp +0 -49
- data/ext/ruby-cbc/install/include/coin/CbcCountRowCut.hpp +0 -168
- data/ext/ruby-cbc/install/include/coin/CbcCutGenerator.hpp +0 -482
- data/ext/ruby-cbc/install/include/coin/CbcCutModifier.hpp +0 -57
- data/ext/ruby-cbc/install/include/coin/CbcCutSubsetModifier.hpp +0 -66
- data/ext/ruby-cbc/install/include/coin/CbcDummyBranchingObject.hpp +0 -83
- data/ext/ruby-cbc/install/include/coin/CbcEventHandler.hpp +0 -245
- data/ext/ruby-cbc/install/include/coin/CbcFathom.hpp +0 -137
- data/ext/ruby-cbc/install/include/coin/CbcFathomDynamicProgramming.hpp +0 -169
- data/ext/ruby-cbc/install/include/coin/CbcFeasibilityBase.hpp +0 -56
- data/ext/ruby-cbc/install/include/coin/CbcFixVariable.hpp +0 -67
- data/ext/ruby-cbc/install/include/coin/CbcFollowOn.hpp +0 -207
- data/ext/ruby-cbc/install/include/coin/CbcFullNodeInfo.hpp +0 -161
- data/ext/ruby-cbc/install/include/coin/CbcGeneral.hpp +0 -60
- data/ext/ruby-cbc/install/include/coin/CbcGeneralDepth.hpp +0 -279
- data/ext/ruby-cbc/install/include/coin/CbcHeuristic.hpp +0 -682
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDINS.hpp +0 -96
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDW.hpp +0 -309
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDive.hpp +0 -192
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveCoefficient.hpp +0 -52
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveFractional.hpp +0 -52
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveGuided.hpp +0 -55
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveLineSearch.hpp +0 -52
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDivePseudoCost.hpp +0 -60
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicDiveVectorLength.hpp +0 -52
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicFPump.hpp +0 -340
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicGreedy.hpp +0 -280
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicLocal.hpp +0 -271
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicPivotAndFix.hpp +0 -58
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicRENS.hpp +0 -77
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicRINS.hpp +0 -102
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicRandRound.hpp +0 -58
- data/ext/ruby-cbc/install/include/coin/CbcHeuristicVND.hpp +0 -94
- data/ext/ruby-cbc/install/include/coin/CbcLinked.hpp +0 -1406
- data/ext/ruby-cbc/install/include/coin/CbcMessage.hpp +0 -94
- data/ext/ruby-cbc/install/include/coin/CbcMipStartIO.hpp +0 -26
- data/ext/ruby-cbc/install/include/coin/CbcModel.hpp +0 -2952
- data/ext/ruby-cbc/install/include/coin/CbcNWay.hpp +0 -166
- data/ext/ruby-cbc/install/include/coin/CbcNode.hpp +0 -351
- data/ext/ruby-cbc/install/include/coin/CbcNodeInfo.hpp +0 -349
- data/ext/ruby-cbc/install/include/coin/CbcObject.hpp +0 -272
- data/ext/ruby-cbc/install/include/coin/CbcObjectUpdateData.hpp +0 -64
- data/ext/ruby-cbc/install/include/coin/CbcOrClpParam.cpp +0 -4134
- data/ext/ruby-cbc/install/include/coin/CbcOrClpParam.hpp +0 -532
- data/ext/ruby-cbc/install/include/coin/CbcParam.hpp +0 -324
- data/ext/ruby-cbc/install/include/coin/CbcPartialNodeInfo.hpp +0 -110
- data/ext/ruby-cbc/install/include/coin/CbcSOS.hpp +0 -279
- data/ext/ruby-cbc/install/include/coin/CbcSimpleInteger.hpp +0 -286
- data/ext/ruby-cbc/install/include/coin/CbcSimpleIntegerDynamicPseudoCost.hpp +0 -564
- data/ext/ruby-cbc/install/include/coin/CbcSimpleIntegerPseudoCost.hpp +0 -114
- data/ext/ruby-cbc/install/include/coin/CbcSolver.hpp +0 -447
- data/ext/ruby-cbc/install/include/coin/CbcStrategy.hpp +0 -258
- data/ext/ruby-cbc/install/include/coin/CbcSubProblem.hpp +0 -83
- data/ext/ruby-cbc/install/include/coin/CbcTree.hpp +0 -490
- data/ext/ruby-cbc/install/include/coin/CbcTreeLocal.hpp +0 -372
- data/ext/ruby-cbc/install/include/coin/Cbc_C_Interface.h +0 -381
- data/ext/ruby-cbc/install/include/coin/Cgl012cut.hpp +0 -464
- data/ext/ruby-cbc/install/include/coin/CglAllDifferent.hpp +0 -115
- data/ext/ruby-cbc/install/include/coin/CglClique.hpp +0 -308
- data/ext/ruby-cbc/install/include/coin/CglConfig.h +0 -19
- data/ext/ruby-cbc/install/include/coin/CglCutGenerator.hpp +0 -121
- data/ext/ruby-cbc/install/include/coin/CglDuplicateRow.hpp +0 -189
- data/ext/ruby-cbc/install/include/coin/CglFlowCover.hpp +0 -371
- data/ext/ruby-cbc/install/include/coin/CglGMI.hpp +0 -364
- data/ext/ruby-cbc/install/include/coin/CglGMIParam.hpp +0 -313
- data/ext/ruby-cbc/install/include/coin/CglGomory.hpp +0 -204
- data/ext/ruby-cbc/install/include/coin/CglKnapsackCover.hpp +0 -310
- data/ext/ruby-cbc/install/include/coin/CglLandP.hpp +0 -306
- data/ext/ruby-cbc/install/include/coin/CglLandPValidator.hpp +0 -130
- data/ext/ruby-cbc/install/include/coin/CglLiftAndProject.hpp +0 -104
- data/ext/ruby-cbc/install/include/coin/CglMessage.hpp +0 -50
- data/ext/ruby-cbc/install/include/coin/CglMixedIntegerRounding.hpp +0 -429
- data/ext/ruby-cbc/install/include/coin/CglMixedIntegerRounding2.hpp +0 -427
- data/ext/ruby-cbc/install/include/coin/CglOddHole.hpp +0 -160
- data/ext/ruby-cbc/install/include/coin/CglParam.hpp +0 -93
- data/ext/ruby-cbc/install/include/coin/CglPreProcess.hpp +0 -492
- data/ext/ruby-cbc/install/include/coin/CglProbing.hpp +0 -543
- data/ext/ruby-cbc/install/include/coin/CglRedSplit.hpp +0 -448
- data/ext/ruby-cbc/install/include/coin/CglRedSplit2.hpp +0 -494
- data/ext/ruby-cbc/install/include/coin/CglRedSplit2Param.hpp +0 -495
- data/ext/ruby-cbc/install/include/coin/CglRedSplitParam.hpp +0 -272
- data/ext/ruby-cbc/install/include/coin/CglResidualCapacity.hpp +0 -240
- data/ext/ruby-cbc/install/include/coin/CglSimpleRounding.hpp +0 -174
- data/ext/ruby-cbc/install/include/coin/CglStored.hpp +0 -125
- data/ext/ruby-cbc/install/include/coin/CglTreeInfo.hpp +0 -180
- data/ext/ruby-cbc/install/include/coin/CglTwomir.hpp +0 -565
- data/ext/ruby-cbc/install/include/coin/CglZeroHalf.hpp +0 -133
- data/ext/ruby-cbc/install/include/coin/ClpAmplObjective.hpp +0 -113
- data/ext/ruby-cbc/install/include/coin/ClpCholeskyBase.hpp +0 -294
- data/ext/ruby-cbc/install/include/coin/ClpCholeskyDense.hpp +0 -162
- data/ext/ruby-cbc/install/include/coin/ClpConfig.h +0 -17
- data/ext/ruby-cbc/install/include/coin/ClpConstraint.hpp +0 -125
- data/ext/ruby-cbc/install/include/coin/ClpConstraintAmpl.hpp +0 -108
- data/ext/ruby-cbc/install/include/coin/ClpConstraintLinear.hpp +0 -110
- data/ext/ruby-cbc/install/include/coin/ClpConstraintQuadratic.hpp +0 -119
- data/ext/ruby-cbc/install/include/coin/ClpDualRowDantzig.hpp +0 -71
- data/ext/ruby-cbc/install/include/coin/ClpDualRowPivot.hpp +0 -129
- data/ext/ruby-cbc/install/include/coin/ClpDualRowSteepest.hpp +0 -153
- data/ext/ruby-cbc/install/include/coin/ClpDummyMatrix.hpp +0 -183
- data/ext/ruby-cbc/install/include/coin/ClpDynamicExampleMatrix.hpp +0 -186
- data/ext/ruby-cbc/install/include/coin/ClpDynamicMatrix.hpp +0 -381
- data/ext/ruby-cbc/install/include/coin/ClpEventHandler.hpp +0 -187
- data/ext/ruby-cbc/install/include/coin/ClpFactorization.hpp +0 -432
- data/ext/ruby-cbc/install/include/coin/ClpGubDynamicMatrix.hpp +0 -247
- data/ext/ruby-cbc/install/include/coin/ClpGubMatrix.hpp +0 -358
- data/ext/ruby-cbc/install/include/coin/ClpInterior.hpp +0 -570
- data/ext/ruby-cbc/install/include/coin/ClpLinearObjective.hpp +0 -103
- data/ext/ruby-cbc/install/include/coin/ClpMatrixBase.hpp +0 -524
- data/ext/ruby-cbc/install/include/coin/ClpMessage.hpp +0 -131
- data/ext/ruby-cbc/install/include/coin/ClpModel.hpp +0 -1307
- data/ext/ruby-cbc/install/include/coin/ClpNetworkMatrix.hpp +0 -229
- data/ext/ruby-cbc/install/include/coin/ClpNode.hpp +0 -349
- data/ext/ruby-cbc/install/include/coin/ClpNonLinearCost.hpp +0 -401
- data/ext/ruby-cbc/install/include/coin/ClpObjective.hpp +0 -134
- data/ext/ruby-cbc/install/include/coin/ClpPackedMatrix.hpp +0 -638
- data/ext/ruby-cbc/install/include/coin/ClpParameters.hpp +0 -126
- data/ext/ruby-cbc/install/include/coin/ClpPdcoBase.hpp +0 -103
- data/ext/ruby-cbc/install/include/coin/ClpPlusMinusOneMatrix.hpp +0 -290
- data/ext/ruby-cbc/install/include/coin/ClpPresolve.hpp +0 -299
- data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnDantzig.hpp +0 -72
- data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnPivot.hpp +0 -155
- data/ext/ruby-cbc/install/include/coin/ClpPrimalColumnSteepest.hpp +0 -247
- data/ext/ruby-cbc/install/include/coin/ClpQuadraticObjective.hpp +0 -155
- data/ext/ruby-cbc/install/include/coin/ClpSimplex.hpp +0 -1797
- data/ext/ruby-cbc/install/include/coin/ClpSimplexDual.hpp +0 -300
- data/ext/ruby-cbc/install/include/coin/ClpSimplexNonlinear.hpp +0 -117
- data/ext/ruby-cbc/install/include/coin/ClpSimplexOther.hpp +0 -277
- data/ext/ruby-cbc/install/include/coin/ClpSimplexPrimal.hpp +0 -244
- data/ext/ruby-cbc/install/include/coin/ClpSolve.hpp +0 -446
- data/ext/ruby-cbc/install/include/coin/Clp_C_Interface.h +0 -525
- data/ext/ruby-cbc/install/include/coin/CoinAlloc.hpp +0 -176
- data/ext/ruby-cbc/install/include/coin/CoinBuild.hpp +0 -149
- data/ext/ruby-cbc/install/include/coin/CoinDenseFactorization.hpp +0 -419
- data/ext/ruby-cbc/install/include/coin/CoinDenseVector.hpp +0 -383
- data/ext/ruby-cbc/install/include/coin/CoinDistance.hpp +0 -48
- data/ext/ruby-cbc/install/include/coin/CoinError.hpp +0 -257
- data/ext/ruby-cbc/install/include/coin/CoinFactorization.hpp +0 -2044
- data/ext/ruby-cbc/install/include/coin/CoinFileIO.hpp +0 -166
- data/ext/ruby-cbc/install/include/coin/CoinFinite.hpp +0 -34
- data/ext/ruby-cbc/install/include/coin/CoinFloatEqual.hpp +0 -177
- data/ext/ruby-cbc/install/include/coin/CoinHelperFunctions.hpp +0 -1111
- data/ext/ruby-cbc/install/include/coin/CoinIndexedVector.hpp +0 -1164
- data/ext/ruby-cbc/install/include/coin/CoinLpIO.hpp +0 -805
- data/ext/ruby-cbc/install/include/coin/CoinMessage.hpp +0 -96
- data/ext/ruby-cbc/install/include/coin/CoinMessageHandler.hpp +0 -666
- data/ext/ruby-cbc/install/include/coin/CoinModel.hpp +0 -1054
- data/ext/ruby-cbc/install/include/coin/CoinModelUseful.hpp +0 -441
- data/ext/ruby-cbc/install/include/coin/CoinMpsIO.hpp +0 -1056
- data/ext/ruby-cbc/install/include/coin/CoinOslFactorization.hpp +0 -280
- data/ext/ruby-cbc/install/include/coin/CoinPackedMatrix.hpp +0 -947
- data/ext/ruby-cbc/install/include/coin/CoinPackedVector.hpp +0 -657
- data/ext/ruby-cbc/install/include/coin/CoinPackedVectorBase.hpp +0 -269
- data/ext/ruby-cbc/install/include/coin/CoinParam.hpp +0 -644
- data/ext/ruby-cbc/install/include/coin/CoinPragma.hpp +0 -26
- data/ext/ruby-cbc/install/include/coin/CoinPresolveDoubleton.hpp +0 -73
- data/ext/ruby-cbc/install/include/coin/CoinPresolveDual.hpp +0 -85
- data/ext/ruby-cbc/install/include/coin/CoinPresolveDupcol.hpp +0 -226
- data/ext/ruby-cbc/install/include/coin/CoinPresolveEmpty.hpp +0 -116
- data/ext/ruby-cbc/install/include/coin/CoinPresolveFixed.hpp +0 -181
- data/ext/ruby-cbc/install/include/coin/CoinPresolveForcing.hpp +0 -61
- data/ext/ruby-cbc/install/include/coin/CoinPresolveImpliedFree.hpp +0 -60
- data/ext/ruby-cbc/install/include/coin/CoinPresolveIsolated.hpp +0 -51
- data/ext/ruby-cbc/install/include/coin/CoinPresolveMatrix.hpp +0 -1842
- data/ext/ruby-cbc/install/include/coin/CoinPresolveMonitor.hpp +0 -105
- data/ext/ruby-cbc/install/include/coin/CoinPresolvePsdebug.hpp +0 -166
- data/ext/ruby-cbc/install/include/coin/CoinPresolveSingleton.hpp +0 -112
- data/ext/ruby-cbc/install/include/coin/CoinPresolveSubst.hpp +0 -101
- data/ext/ruby-cbc/install/include/coin/CoinPresolveTighten.hpp +0 -55
- data/ext/ruby-cbc/install/include/coin/CoinPresolveTripleton.hpp +0 -66
- data/ext/ruby-cbc/install/include/coin/CoinPresolveUseless.hpp +0 -63
- data/ext/ruby-cbc/install/include/coin/CoinPresolveZeros.hpp +0 -60
- data/ext/ruby-cbc/install/include/coin/CoinRational.hpp +0 -44
- data/ext/ruby-cbc/install/include/coin/CoinSearchTree.hpp +0 -465
- data/ext/ruby-cbc/install/include/coin/CoinShallowPackedVector.hpp +0 -148
- data/ext/ruby-cbc/install/include/coin/CoinSignal.hpp +0 -117
- data/ext/ruby-cbc/install/include/coin/CoinSimpFactorization.hpp +0 -431
- data/ext/ruby-cbc/install/include/coin/CoinSmartPtr.hpp +0 -528
- data/ext/ruby-cbc/install/include/coin/CoinSnapshot.hpp +0 -476
- data/ext/ruby-cbc/install/include/coin/CoinSort.hpp +0 -678
- data/ext/ruby-cbc/install/include/coin/CoinStructuredModel.hpp +0 -247
- data/ext/ruby-cbc/install/include/coin/CoinTime.hpp +0 -310
- data/ext/ruby-cbc/install/include/coin/CoinTypes.hpp +0 -64
- data/ext/ruby-cbc/install/include/coin/CoinUtility.hpp +0 -19
- data/ext/ruby-cbc/install/include/coin/CoinUtilsConfig.h +0 -34
- data/ext/ruby-cbc/install/include/coin/CoinWarmStart.hpp +0 -58
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartBasis.hpp +0 -456
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartDual.hpp +0 -166
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartPrimalDual.hpp +0 -211
- data/ext/ruby-cbc/install/include/coin/CoinWarmStartVector.hpp +0 -488
- data/ext/ruby-cbc/install/include/coin/Coin_C_defines.h +0 -115
- data/ext/ruby-cbc/install/include/coin/Idiot.hpp +0 -298
- data/ext/ruby-cbc/install/include/coin/OsiAuxInfo.hpp +0 -206
- data/ext/ruby-cbc/install/include/coin/OsiBranchingObject.hpp +0 -1005
- data/ext/ruby-cbc/install/include/coin/OsiCbcSolverInterface.hpp +0 -764
- data/ext/ruby-cbc/install/include/coin/OsiChooseVariable.hpp +0 -534
- data/ext/ruby-cbc/install/include/coin/OsiClpSolverInterface.hpp +0 -1509
- data/ext/ruby-cbc/install/include/coin/OsiColCut.hpp +0 -324
- data/ext/ruby-cbc/install/include/coin/OsiCollections.hpp +0 -35
- data/ext/ruby-cbc/install/include/coin/OsiConfig.h +0 -19
- data/ext/ruby-cbc/install/include/coin/OsiCut.hpp +0 -245
- data/ext/ruby-cbc/install/include/coin/OsiCuts.hpp +0 -474
- data/ext/ruby-cbc/install/include/coin/OsiPresolve.hpp +0 -252
- data/ext/ruby-cbc/install/include/coin/OsiRowCut.hpp +0 -331
- data/ext/ruby-cbc/install/include/coin/OsiRowCutDebugger.hpp +0 -187
- data/ext/ruby-cbc/install/include/coin/OsiSolverBranch.hpp +0 -152
- data/ext/ruby-cbc/install/include/coin/OsiSolverInterface.hpp +0 -2143
- data/ext/ruby-cbc/install/include/coin/OsiSolverParameters.hpp +0 -142
- data/ext/ruby-cbc/install/include/coin/OsiUnitTests.hpp +0 -374
- data/ext/ruby-cbc/install/lib/libCbc.la +0 -35
- data/ext/ruby-cbc/install/lib/libCbc.so +0 -0
- data/ext/ruby-cbc/install/lib/libCbc.so.3 +0 -0
- data/ext/ruby-cbc/install/lib/libCbc.so.3.9.7 +0 -0
- data/ext/ruby-cbc/install/lib/libCbcSolver.la +0 -35
- data/ext/ruby-cbc/install/lib/libCbcSolver.so +0 -0
- data/ext/ruby-cbc/install/lib/libCbcSolver.so.3 +0 -0
- data/ext/ruby-cbc/install/lib/libCbcSolver.so.3.9.7 +0 -0
- data/ext/ruby-cbc/install/lib/libCgl.la +0 -35
- data/ext/ruby-cbc/install/lib/libCgl.so +0 -0
- data/ext/ruby-cbc/install/lib/libCgl.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libCgl.so.1.9.7 +0 -0
- data/ext/ruby-cbc/install/lib/libClp.la +0 -35
- data/ext/ruby-cbc/install/lib/libClp.so +0 -0
- data/ext/ruby-cbc/install/lib/libClp.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libClp.so.1.13.9 +0 -0
- data/ext/ruby-cbc/install/lib/libClpSolver.la +0 -35
- data/ext/ruby-cbc/install/lib/libClpSolver.so +0 -0
- data/ext/ruby-cbc/install/lib/libClpSolver.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libClpSolver.so.1.13.9 +0 -0
- data/ext/ruby-cbc/install/lib/libCoinUtils.la +0 -35
- data/ext/ruby-cbc/install/lib/libCoinUtils.so +0 -0
- data/ext/ruby-cbc/install/lib/libCoinUtils.so.3 +0 -0
- data/ext/ruby-cbc/install/lib/libCoinUtils.so.3.10.11 +0 -0
- data/ext/ruby-cbc/install/lib/libOsi.la +0 -35
- data/ext/ruby-cbc/install/lib/libOsi.so +0 -0
- data/ext/ruby-cbc/install/lib/libOsi.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libOsi.so.1.12.6 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCbc.la +0 -35
- data/ext/ruby-cbc/install/lib/libOsiCbc.so +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCbc.so.3 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCbc.so.3.9.7 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiClp.la +0 -35
- data/ext/ruby-cbc/install/lib/libOsiClp.so +0 -0
- data/ext/ruby-cbc/install/lib/libOsiClp.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiClp.so.1.13.9 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCommonTests.la +0 -35
- data/ext/ruby-cbc/install/lib/libOsiCommonTests.so +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCommonTests.so.1 +0 -0
- data/ext/ruby-cbc/install/lib/libOsiCommonTests.so.1.12.6 +0 -0
- data/ext/ruby-cbc/install/lib/pkgconfig/cbc.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/cgl.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/clp.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/coindatamiplib3.pc +0 -9
- data/ext/ruby-cbc/install/lib/pkgconfig/coindatasample.pc +0 -9
- data/ext/ruby-cbc/install/lib/pkgconfig/coinutils.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/osi-cbc.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/osi-clp.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/osi-unittests.pc +0 -12
- data/ext/ruby-cbc/install/lib/pkgconfig/osi.pc +0 -12
@@ -1,166 +0,0 @@
|
|
1
|
-
/* $Id: CoinFileIO.hpp 1439 2011-06-13 16:31:21Z stefan $ */
|
2
|
-
// Copyright (C) 2005, COIN-OR. All Rights Reserved.
|
3
|
-
// This code is licensed under the terms of the Eclipse Public License (EPL).
|
4
|
-
|
5
|
-
#ifndef CoinFileIO_H
|
6
|
-
#define CoinFileIO_H
|
7
|
-
|
8
|
-
#include <string>
|
9
|
-
|
10
|
-
/// Base class for FileIO classes.
|
11
|
-
class CoinFileIOBase
|
12
|
-
{
|
13
|
-
public:
|
14
|
-
/// Constructor.
|
15
|
-
/// @param fileName The name of the file used by this object.
|
16
|
-
CoinFileIOBase (const std::string &fileName);
|
17
|
-
|
18
|
-
/// Destructor.
|
19
|
-
~CoinFileIOBase ();
|
20
|
-
|
21
|
-
/// Return the name of the file used by this object.
|
22
|
-
const char *getFileName () const;
|
23
|
-
|
24
|
-
/// Return the method of reading being used
|
25
|
-
inline std::string getReadType () const
|
26
|
-
{ return readType_.c_str();}
|
27
|
-
protected:
|
28
|
-
std::string readType_;
|
29
|
-
private:
|
30
|
-
CoinFileIOBase ();
|
31
|
-
CoinFileIOBase (const CoinFileIOBase &);
|
32
|
-
|
33
|
-
std::string fileName_;
|
34
|
-
};
|
35
|
-
|
36
|
-
/// Abstract base class for file input classes.
|
37
|
-
class CoinFileInput: public CoinFileIOBase
|
38
|
-
{
|
39
|
-
public:
|
40
|
-
/// indicates whether CoinFileInput supports gzip'ed files
|
41
|
-
static bool haveGzipSupport();
|
42
|
-
/// indicates whether CoinFileInput supports bzip2'ed files
|
43
|
-
static bool haveBzip2Support();
|
44
|
-
|
45
|
-
/// Factory method, that creates a CoinFileInput (more precisely
|
46
|
-
/// a subclass of it) for the file specified. This method reads the
|
47
|
-
/// first few bytes of the file and determines if this is a compressed
|
48
|
-
/// or a plain file and returns the correct subclass to handle it.
|
49
|
-
/// If the file does not exist or uses a compression not compiled in
|
50
|
-
/// an exception is thrown.
|
51
|
-
/// @param fileName The file that should be read.
|
52
|
-
static CoinFileInput *create (const std::string &fileName);
|
53
|
-
|
54
|
-
/// Constructor (don't use this, use the create method instead).
|
55
|
-
/// @param fileName The name of the file used by this object.
|
56
|
-
CoinFileInput (const std::string &fileName);
|
57
|
-
|
58
|
-
/// Destructor.
|
59
|
-
virtual ~CoinFileInput ();
|
60
|
-
|
61
|
-
/// Read a block of data from the file, similar to fread.
|
62
|
-
/// @param buffer Address of a buffer to store the data into.
|
63
|
-
/// @param size Number of bytes to read (buffer should be large enough).
|
64
|
-
/// @return Number of bytes read.
|
65
|
-
virtual int read (void *buffer, int size) = 0;
|
66
|
-
|
67
|
-
/// Reads up to (size-1) characters an stores them into the buffer,
|
68
|
-
/// similar to fgets.
|
69
|
-
/// Reading ends, when EOF or a newline occurs or (size-1) characters have
|
70
|
-
/// been read. The resulting string is terminated with '\0'. If reading
|
71
|
-
/// ends due to an encoutered newline, the '\n' is put into the buffer,
|
72
|
-
/// before the '\0' is appended.
|
73
|
-
/// @param buffer The buffer to put the string into.
|
74
|
-
/// @param size The size of the buffer in characters.
|
75
|
-
/// @return buffer on success, or 0 if no characters have been read.
|
76
|
-
virtual char *gets (char *buffer, int size) = 0;
|
77
|
-
};
|
78
|
-
|
79
|
-
/// Abstract base class for file output classes.
|
80
|
-
class CoinFileOutput: public CoinFileIOBase
|
81
|
-
{
|
82
|
-
public:
|
83
|
-
|
84
|
-
/// The compression method.
|
85
|
-
enum Compression {
|
86
|
-
COMPRESS_NONE = 0, ///< No compression.
|
87
|
-
COMPRESS_GZIP = 1, ///< gzip compression.
|
88
|
-
COMPRESS_BZIP2 = 2 ///< bzip2 compression.
|
89
|
-
};
|
90
|
-
|
91
|
-
/// Returns whether the specified compression method is supported
|
92
|
-
/// (i.e. was compiled into COIN).
|
93
|
-
static bool compressionSupported (Compression compression);
|
94
|
-
|
95
|
-
/// Factory method, that creates a CoinFileOutput (more precisely
|
96
|
-
/// a subclass of it) for the file specified. If the compression method
|
97
|
-
/// is not supported an exception is thrown (so use compressionSupported
|
98
|
-
/// first, if this is a problem). The reason for not providing direct
|
99
|
-
/// access to the subclasses (and using such a method instead) is that
|
100
|
-
/// depending on the build configuration some of the classes are not
|
101
|
-
/// available (or functional). This way we can handle all required ifdefs
|
102
|
-
/// here instead of polluting other files.
|
103
|
-
/// @param fileName The file that should be read.
|
104
|
-
/// @param compression Compression method used.
|
105
|
-
static CoinFileOutput *create (const std::string &fileName,
|
106
|
-
Compression compression);
|
107
|
-
|
108
|
-
/// Constructor (don't use this, use the create method instead).
|
109
|
-
/// @param fileName The name of the file used by this object.
|
110
|
-
CoinFileOutput (const std::string &fileName);
|
111
|
-
|
112
|
-
/// Destructor.
|
113
|
-
virtual ~CoinFileOutput ();
|
114
|
-
|
115
|
-
/// Write a block of data to the file, similar to fwrite.
|
116
|
-
/// @param buffer Address of a buffer containing the data to be written.
|
117
|
-
/// @param size Number of bytes to write.
|
118
|
-
/// @return Number of bytes written.
|
119
|
-
virtual int write (const void * buffer, int size) = 0;
|
120
|
-
|
121
|
-
/// Write a string to the file (like fputs).
|
122
|
-
/// Just as with fputs no trailing newline is inserted!
|
123
|
-
/// The terminating '\0' is not written to the file.
|
124
|
-
/// The default implementation determines the length of the string
|
125
|
-
/// and calls write on it.
|
126
|
-
/// @param s The zero terminated string to be written.
|
127
|
-
/// @return true on success, false on error.
|
128
|
-
virtual bool puts (const char *s);
|
129
|
-
|
130
|
-
/// Convenience method: just a 'puts(s.c_str())'.
|
131
|
-
inline bool puts (const std::string &s)
|
132
|
-
{
|
133
|
-
return puts (s.c_str ());
|
134
|
-
}
|
135
|
-
};
|
136
|
-
|
137
|
-
/*! \relates CoinFileInput
|
138
|
-
\brief Test if the given string looks like an absolute file path
|
139
|
-
|
140
|
-
The criteria are:
|
141
|
-
- unix: string begins with `/'
|
142
|
-
- windows: string begins with `\' or with `drv:' (drive specifier)
|
143
|
-
*/
|
144
|
-
bool fileAbsPath (const std::string &path) ;
|
145
|
-
|
146
|
-
/*! \relates CoinFileInput
|
147
|
-
\brief Test if the file is readable, using likely versions of the file
|
148
|
-
name, and return the name that worked.
|
149
|
-
|
150
|
-
The file name is constructed from \p name using the following rules:
|
151
|
-
<ul>
|
152
|
-
<li> An absolute path is not modified.
|
153
|
-
<li> If the name begins with `~', an attempt is made to replace `~'
|
154
|
-
with the value of the environment variable HOME.
|
155
|
-
<li> If a default prefix (\p dfltPrefix) is provided, it is
|
156
|
-
prepended to the name.
|
157
|
-
</ul>
|
158
|
-
If the constructed file name cannot be opened, and CoinUtils was built
|
159
|
-
with support for compressed files, fileCoinReadable will try any
|
160
|
-
standard extensions for supported compressed files.
|
161
|
-
|
162
|
-
The value returned in \p name is the file name that actually worked.
|
163
|
-
*/
|
164
|
-
bool fileCoinReadable(std::string &name,
|
165
|
-
const std::string &dfltPrefix = std::string(""));
|
166
|
-
#endif
|
@@ -1,34 +0,0 @@
|
|
1
|
-
/* $Id: CoinFinite.hpp 1762 2014-12-29 20:37:12Z tkr $ */
|
2
|
-
// Copyright (C) 2002, International Business Machines
|
3
|
-
// Corporation and others. All Rights Reserved.
|
4
|
-
// This code is licensed under the terms of the Eclipse Public License (EPL).
|
5
|
-
|
6
|
-
/* Defines COIN_DBL_MAX and relatives and provides CoinFinite and CoinIsnan. */
|
7
|
-
|
8
|
-
#ifndef CoinFinite_H
|
9
|
-
#define CoinFinite_H
|
10
|
-
|
11
|
-
#include <limits>
|
12
|
-
|
13
|
-
//=============================================================================
|
14
|
-
// Smallest positive double value and Plus infinity (double and int)
|
15
|
-
|
16
|
-
#if 1
|
17
|
-
const double COIN_DBL_MIN = (std::numeric_limits<double>::min)();
|
18
|
-
const double COIN_DBL_MAX = (std::numeric_limits<double>::max)();
|
19
|
-
const int COIN_INT_MAX = (std::numeric_limits<int>::max)();
|
20
|
-
const double COIN_INT_MAX_AS_DOUBLE = (std::numeric_limits<int>::max)();
|
21
|
-
#else
|
22
|
-
#define COIN_DBL_MIN (std::numeric_limits<double>::min())
|
23
|
-
#define COIN_DBL_MAX (std::numeric_limits<double>::max())
|
24
|
-
#define COIN_INT_MAX (std::numeric_limits<int>::max())
|
25
|
-
#define COIN_INT_MAX_AS_DOUBLE (std::numeric_limits<int>::max())
|
26
|
-
#endif
|
27
|
-
|
28
|
-
/** checks if a double value is finite (not infinity and not NaN) */
|
29
|
-
extern bool CoinFinite(double val);
|
30
|
-
|
31
|
-
/** checks if a double value is not a number */
|
32
|
-
extern bool CoinIsnan(double val);
|
33
|
-
|
34
|
-
#endif
|
@@ -1,177 +0,0 @@
|
|
1
|
-
/* $Id: CoinFloatEqual.hpp 1416 2011-04-17 09:57:29Z stefan $ */
|
2
|
-
// Copyright (C) 2000, International Business Machines
|
3
|
-
// Corporation and others. All Rights Reserved.
|
4
|
-
// This code is licensed under the terms of the Eclipse Public License (EPL).
|
5
|
-
|
6
|
-
#ifndef CoinFloatEqual_H
|
7
|
-
#define CoinFloatEqual_H
|
8
|
-
|
9
|
-
#include <algorithm>
|
10
|
-
#include <cmath>
|
11
|
-
|
12
|
-
#include "CoinFinite.hpp"
|
13
|
-
|
14
|
-
/*! \file CoinFloatEqual.hpp
|
15
|
-
\brief Function objects for testing equality of real numbers.
|
16
|
-
|
17
|
-
Two objects are provided; one tests for equality to an absolute tolerance,
|
18
|
-
one to a scaled tolerance. The tests will handle IEEE floating point, but
|
19
|
-
note that infinity == infinity. Mathematicians are rolling in their graves,
|
20
|
-
but this matches the behaviour for the common practice of using
|
21
|
-
<code>DBL_MAX</code> (<code>numeric_limits<double>::max()</code>, or similar
|
22
|
-
large finite number) as infinity.
|
23
|
-
|
24
|
-
<p>
|
25
|
-
Example usage:
|
26
|
-
@verbatim
|
27
|
-
double d1 = 3.14159 ;
|
28
|
-
double d2 = d1 ;
|
29
|
-
double d3 = d1+.0001 ;
|
30
|
-
|
31
|
-
CoinAbsFltEq eq1 ;
|
32
|
-
CoinAbsFltEq eq2(.001) ;
|
33
|
-
|
34
|
-
assert( eq1(d1,d2) ) ;
|
35
|
-
assert( !eq1(d1,d3) ) ;
|
36
|
-
assert( eq2(d1,d3) ) ;
|
37
|
-
@endverbatim
|
38
|
-
CoinRelFltEq follows the same pattern. */
|
39
|
-
|
40
|
-
/*! \brief Equality to an absolute tolerance
|
41
|
-
|
42
|
-
Operands are considered equal if their difference is within an epsilon ;
|
43
|
-
the test does not consider the relative magnitude of the operands.
|
44
|
-
*/
|
45
|
-
|
46
|
-
class CoinAbsFltEq
|
47
|
-
{
|
48
|
-
public:
|
49
|
-
|
50
|
-
//! Compare function
|
51
|
-
|
52
|
-
inline bool operator() (const double f1, const double f2) const
|
53
|
-
|
54
|
-
{ if (CoinIsnan(f1) || CoinIsnan(f2)) return false ;
|
55
|
-
if (f1 == f2) return true ;
|
56
|
-
return (fabs(f1-f2) < epsilon_) ; }
|
57
|
-
|
58
|
-
/*! \name Constructors and destructors */
|
59
|
-
//@{
|
60
|
-
|
61
|
-
/*! \brief Default constructor
|
62
|
-
|
63
|
-
Default tolerance is 1.0e-10.
|
64
|
-
*/
|
65
|
-
|
66
|
-
CoinAbsFltEq () : epsilon_(1.e-10) {}
|
67
|
-
|
68
|
-
//! Alternate constructor with epsilon as a parameter
|
69
|
-
|
70
|
-
CoinAbsFltEq (const double epsilon) : epsilon_(epsilon) {}
|
71
|
-
|
72
|
-
//! Destructor
|
73
|
-
|
74
|
-
virtual ~CoinAbsFltEq () {}
|
75
|
-
|
76
|
-
//! Copy constructor
|
77
|
-
|
78
|
-
CoinAbsFltEq (const CoinAbsFltEq& src) : epsilon_(src.epsilon_) {}
|
79
|
-
|
80
|
-
//! Assignment
|
81
|
-
|
82
|
-
CoinAbsFltEq& operator= (const CoinAbsFltEq& rhs)
|
83
|
-
|
84
|
-
{ if (this != &rhs) epsilon_ = rhs.epsilon_ ;
|
85
|
-
return (*this) ; }
|
86
|
-
|
87
|
-
//@}
|
88
|
-
|
89
|
-
private:
|
90
|
-
|
91
|
-
/*! \name Private member data */
|
92
|
-
//@{
|
93
|
-
|
94
|
-
//! Equality tolerance.
|
95
|
-
|
96
|
-
double epsilon_ ;
|
97
|
-
|
98
|
-
//@}
|
99
|
-
|
100
|
-
} ;
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
/*! \brief Equality to a scaled tolerance
|
105
|
-
|
106
|
-
Operands are considered equal if their difference is within a scaled
|
107
|
-
epsilon calculated as epsilon_*(1+CoinMax(|f1|,|f2|)).
|
108
|
-
*/
|
109
|
-
|
110
|
-
class CoinRelFltEq
|
111
|
-
{
|
112
|
-
public:
|
113
|
-
|
114
|
-
//! Compare function
|
115
|
-
|
116
|
-
inline bool operator() (const double f1, const double f2) const
|
117
|
-
|
118
|
-
{ if (CoinIsnan(f1) || CoinIsnan(f2)) return false ;
|
119
|
-
if (f1 == f2) return true ;
|
120
|
-
if (!CoinFinite(f1) || !CoinFinite(f2)) return false ;
|
121
|
-
|
122
|
-
double tol = (fabs(f1)>fabs(f2))?fabs(f1):fabs(f2) ;
|
123
|
-
|
124
|
-
return (fabs(f1-f2) <= epsilon_*(1+tol)) ; }
|
125
|
-
|
126
|
-
/*! \name Constructors and destructors */
|
127
|
-
//@{
|
128
|
-
|
129
|
-
#ifndef COIN_FLOAT
|
130
|
-
/*! Default constructor
|
131
|
-
|
132
|
-
Default tolerance is 1.0e-10.
|
133
|
-
*/
|
134
|
-
CoinRelFltEq () : epsilon_(1.e-10) {}
|
135
|
-
#else
|
136
|
-
/*! Default constructor
|
137
|
-
|
138
|
-
Default tolerance is 1.0e-6.
|
139
|
-
*/
|
140
|
-
CoinRelFltEq () : epsilon_(1.e-6) {} ; // as float
|
141
|
-
#endif
|
142
|
-
|
143
|
-
//! Alternate constructor with epsilon as a parameter
|
144
|
-
|
145
|
-
CoinRelFltEq (const double epsilon) : epsilon_(epsilon) {}
|
146
|
-
|
147
|
-
//! Destructor
|
148
|
-
|
149
|
-
virtual ~CoinRelFltEq () {}
|
150
|
-
|
151
|
-
//! Copy constructor
|
152
|
-
|
153
|
-
CoinRelFltEq (const CoinRelFltEq & src) : epsilon_(src.epsilon_) {}
|
154
|
-
|
155
|
-
//! Assignment
|
156
|
-
|
157
|
-
CoinRelFltEq& operator= (const CoinRelFltEq& rhs)
|
158
|
-
|
159
|
-
{ if (this != &rhs) epsilon_ = rhs.epsilon_ ;
|
160
|
-
return (*this) ; }
|
161
|
-
|
162
|
-
//@}
|
163
|
-
|
164
|
-
private:
|
165
|
-
|
166
|
-
/*! \name Private member data */
|
167
|
-
//@{
|
168
|
-
|
169
|
-
//! Base equality tolerance
|
170
|
-
|
171
|
-
double epsilon_ ;
|
172
|
-
|
173
|
-
//@}
|
174
|
-
|
175
|
-
} ;
|
176
|
-
|
177
|
-
#endif
|
@@ -1,1111 +0,0 @@
|
|
1
|
-
/* $Id: CoinHelperFunctions.hpp 1679 2013-12-05 11:27:45Z forrest $ */
|
2
|
-
// Copyright (C) 2000, International Business Machines
|
3
|
-
// Corporation and others. All Rights Reserved.
|
4
|
-
// This code is licensed under the terms of the Eclipse Public License (EPL).
|
5
|
-
|
6
|
-
#ifndef CoinHelperFunctions_H
|
7
|
-
#define CoinHelperFunctions_H
|
8
|
-
|
9
|
-
#include "CoinUtilsConfig.h"
|
10
|
-
|
11
|
-
#if defined(_MSC_VER)
|
12
|
-
# include <direct.h>
|
13
|
-
# include <cctype>
|
14
|
-
# define getcwd _getcwd
|
15
|
-
# include <cctype>
|
16
|
-
#else
|
17
|
-
# include <unistd.h>
|
18
|
-
#endif
|
19
|
-
//#define USE_MEMCPY
|
20
|
-
|
21
|
-
#include <cstdlib>
|
22
|
-
#include <cstdio>
|
23
|
-
#include <algorithm>
|
24
|
-
#include "CoinTypes.hpp"
|
25
|
-
#include "CoinError.hpp"
|
26
|
-
|
27
|
-
// Compilers can produce better code if they know about __restrict
|
28
|
-
#ifndef COIN_RESTRICT
|
29
|
-
#ifdef COIN_USE_RESTRICT
|
30
|
-
#define COIN_RESTRICT __restrict
|
31
|
-
#else
|
32
|
-
#define COIN_RESTRICT
|
33
|
-
#endif
|
34
|
-
#endif
|
35
|
-
|
36
|
-
//#############################################################################
|
37
|
-
|
38
|
-
/** This helper function copies an array to another location using Duff's
|
39
|
-
device (for a speedup of ~2). The arrays are given by pointers to their
|
40
|
-
first entries and by the size of the source array. Overlapping arrays are
|
41
|
-
handled correctly. */
|
42
|
-
|
43
|
-
template <class T> inline void
|
44
|
-
CoinCopyN(register const T* from, const int size, register T* to)
|
45
|
-
{
|
46
|
-
if (size == 0 || from == to)
|
47
|
-
return;
|
48
|
-
|
49
|
-
#ifndef NDEBUG
|
50
|
-
if (size < 0)
|
51
|
-
throw CoinError("trying to copy negative number of entries",
|
52
|
-
"CoinCopyN", "");
|
53
|
-
#endif
|
54
|
-
|
55
|
-
register int n = (size + 7) / 8;
|
56
|
-
if (to > from) {
|
57
|
-
register const T* downfrom = from + size;
|
58
|
-
register T* downto = to + size;
|
59
|
-
// Use Duff's device to copy
|
60
|
-
switch (size % 8) {
|
61
|
-
case 0: do{ *--downto = *--downfrom;
|
62
|
-
case 7: *--downto = *--downfrom;
|
63
|
-
case 6: *--downto = *--downfrom;
|
64
|
-
case 5: *--downto = *--downfrom;
|
65
|
-
case 4: *--downto = *--downfrom;
|
66
|
-
case 3: *--downto = *--downfrom;
|
67
|
-
case 2: *--downto = *--downfrom;
|
68
|
-
case 1: *--downto = *--downfrom;
|
69
|
-
}while(--n>0);
|
70
|
-
}
|
71
|
-
} else {
|
72
|
-
// Use Duff's device to copy
|
73
|
-
--from;
|
74
|
-
--to;
|
75
|
-
switch (size % 8) {
|
76
|
-
case 0: do{ *++to = *++from;
|
77
|
-
case 7: *++to = *++from;
|
78
|
-
case 6: *++to = *++from;
|
79
|
-
case 5: *++to = *++from;
|
80
|
-
case 4: *++to = *++from;
|
81
|
-
case 3: *++to = *++from;
|
82
|
-
case 2: *++to = *++from;
|
83
|
-
case 1: *++to = *++from;
|
84
|
-
}while(--n>0);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
}
|
88
|
-
|
89
|
-
//-----------------------------------------------------------------------------
|
90
|
-
|
91
|
-
/** This helper function copies an array to another location using Duff's
|
92
|
-
device (for a speedup of ~2). The source array is given by its first and
|
93
|
-
"after last" entry; the target array is given by its first entry.
|
94
|
-
Overlapping arrays are handled correctly.
|
95
|
-
|
96
|
-
All of the various CoinCopyN variants use an int for size. On 64-bit
|
97
|
-
architectures, the address diff last-first will be a 64-bit quantity.
|
98
|
-
Given that everything else uses an int, I'm going to choose to kick
|
99
|
-
the difference down to int. -- lh, 100823 --
|
100
|
-
*/
|
101
|
-
template <class T> inline void
|
102
|
-
CoinCopy(register const T* first, register const T* last, register T* to)
|
103
|
-
{
|
104
|
-
CoinCopyN(first, static_cast<int>(last-first), to);
|
105
|
-
}
|
106
|
-
|
107
|
-
//-----------------------------------------------------------------------------
|
108
|
-
|
109
|
-
/** This helper function copies an array to another location. The two arrays
|
110
|
-
must not overlap (otherwise an exception is thrown). For speed 8 entries
|
111
|
-
are copied at a time. The arrays are given by pointers to their first
|
112
|
-
entries and by the size of the source array.
|
113
|
-
|
114
|
-
Note JJF - the speed claim seems to be false on IA32 so I have added
|
115
|
-
CoinMemcpyN which can be used for atomic data */
|
116
|
-
template <class T> inline void
|
117
|
-
CoinDisjointCopyN(register const T* from, const int size, register T* to)
|
118
|
-
{
|
119
|
-
#ifndef _MSC_VER
|
120
|
-
if (size == 0 || from == to)
|
121
|
-
return;
|
122
|
-
|
123
|
-
#ifndef NDEBUG
|
124
|
-
if (size < 0)
|
125
|
-
throw CoinError("trying to copy negative number of entries",
|
126
|
-
"CoinDisjointCopyN", "");
|
127
|
-
#endif
|
128
|
-
|
129
|
-
#if 0
|
130
|
-
/* There is no point to do this test. If to and from are from different
|
131
|
-
blocks then dist is undefined, so this can crash correct code. It's
|
132
|
-
better to trust the user that the arrays are really disjoint. */
|
133
|
-
const long dist = to - from;
|
134
|
-
if (-size < dist && dist < size)
|
135
|
-
throw CoinError("overlapping arrays", "CoinDisjointCopyN", "");
|
136
|
-
#endif
|
137
|
-
|
138
|
-
for (register int n = size / 8; n > 0; --n, from += 8, to += 8) {
|
139
|
-
to[0] = from[0];
|
140
|
-
to[1] = from[1];
|
141
|
-
to[2] = from[2];
|
142
|
-
to[3] = from[3];
|
143
|
-
to[4] = from[4];
|
144
|
-
to[5] = from[5];
|
145
|
-
to[6] = from[6];
|
146
|
-
to[7] = from[7];
|
147
|
-
}
|
148
|
-
switch (size % 8) {
|
149
|
-
case 7: to[6] = from[6];
|
150
|
-
case 6: to[5] = from[5];
|
151
|
-
case 5: to[4] = from[4];
|
152
|
-
case 4: to[3] = from[3];
|
153
|
-
case 3: to[2] = from[2];
|
154
|
-
case 2: to[1] = from[1];
|
155
|
-
case 1: to[0] = from[0];
|
156
|
-
case 0: break;
|
157
|
-
}
|
158
|
-
#else
|
159
|
-
CoinCopyN(from, size, to);
|
160
|
-
#endif
|
161
|
-
}
|
162
|
-
|
163
|
-
//-----------------------------------------------------------------------------
|
164
|
-
|
165
|
-
/** This helper function copies an array to another location. The two arrays
|
166
|
-
must not overlap (otherwise an exception is thrown). For speed 8 entries
|
167
|
-
are copied at a time. The source array is given by its first and "after
|
168
|
-
last" entry; the target array is given by its first entry. */
|
169
|
-
template <class T> inline void
|
170
|
-
CoinDisjointCopy(register const T* first, register const T* last,
|
171
|
-
register T* to)
|
172
|
-
{
|
173
|
-
CoinDisjointCopyN(first, static_cast<int>(last - first), to);
|
174
|
-
}
|
175
|
-
|
176
|
-
//-----------------------------------------------------------------------------
|
177
|
-
|
178
|
-
/*! \brief Return an array of length \p size filled with input from \p array,
|
179
|
-
or null if \p array is null.
|
180
|
-
*/
|
181
|
-
|
182
|
-
template <class T> inline T*
|
183
|
-
CoinCopyOfArray( const T * array, const int size)
|
184
|
-
{
|
185
|
-
if (array) {
|
186
|
-
T * arrayNew = new T[size];
|
187
|
-
std::memcpy(arrayNew,array,size*sizeof(T));
|
188
|
-
return arrayNew;
|
189
|
-
} else {
|
190
|
-
return NULL;
|
191
|
-
}
|
192
|
-
}
|
193
|
-
|
194
|
-
|
195
|
-
/*! \brief Return an array of length \p size filled with first copySize from \p array,
|
196
|
-
or null if \p array is null.
|
197
|
-
*/
|
198
|
-
|
199
|
-
template <class T> inline T*
|
200
|
-
CoinCopyOfArrayPartial( const T * array, const int size,const int copySize)
|
201
|
-
{
|
202
|
-
if (array||size) {
|
203
|
-
T * arrayNew = new T[size];
|
204
|
-
assert (copySize<=size);
|
205
|
-
std::memcpy(arrayNew,array,copySize*sizeof(T));
|
206
|
-
return arrayNew;
|
207
|
-
} else {
|
208
|
-
return NULL;
|
209
|
-
}
|
210
|
-
}
|
211
|
-
|
212
|
-
/*! \brief Return an array of length \p size filled with input from \p array,
|
213
|
-
or filled with (scalar) \p value if \p array is null
|
214
|
-
*/
|
215
|
-
|
216
|
-
template <class T> inline T*
|
217
|
-
CoinCopyOfArray( const T * array, const int size, T value)
|
218
|
-
{
|
219
|
-
T * arrayNew = new T[size];
|
220
|
-
if (array) {
|
221
|
-
std::memcpy(arrayNew,array,size*sizeof(T));
|
222
|
-
} else {
|
223
|
-
int i;
|
224
|
-
for (i=0;i<size;i++)
|
225
|
-
arrayNew[i] = value;
|
226
|
-
}
|
227
|
-
return arrayNew;
|
228
|
-
}
|
229
|
-
|
230
|
-
|
231
|
-
/*! \brief Return an array of length \p size filled with input from \p array,
|
232
|
-
or filled with zero if \p array is null
|
233
|
-
*/
|
234
|
-
|
235
|
-
template <class T> inline T*
|
236
|
-
CoinCopyOfArrayOrZero( const T * array , const int size)
|
237
|
-
{
|
238
|
-
T * arrayNew = new T[size];
|
239
|
-
if (array) {
|
240
|
-
std::memcpy(arrayNew,array,size*sizeof(T));
|
241
|
-
} else {
|
242
|
-
std::memset(arrayNew,0,size*sizeof(T));
|
243
|
-
}
|
244
|
-
return arrayNew;
|
245
|
-
}
|
246
|
-
|
247
|
-
|
248
|
-
//-----------------------------------------------------------------------------
|
249
|
-
|
250
|
-
/** This helper function copies an array to another location. The two arrays
|
251
|
-
must not overlap (otherwise an exception is thrown). For speed 8 entries
|
252
|
-
are copied at a time. The arrays are given by pointers to their first
|
253
|
-
entries and by the size of the source array.
|
254
|
-
|
255
|
-
Note JJF - the speed claim seems to be false on IA32 so I have added
|
256
|
-
alternative coding if USE_MEMCPY defined*/
|
257
|
-
#ifndef COIN_USE_RESTRICT
|
258
|
-
template <class T> inline void
|
259
|
-
CoinMemcpyN(register const T* from, const int size, register T* to)
|
260
|
-
{
|
261
|
-
#ifndef _MSC_VER
|
262
|
-
#ifdef USE_MEMCPY
|
263
|
-
// Use memcpy - seems a lot faster on Intel with gcc
|
264
|
-
#ifndef NDEBUG
|
265
|
-
// Some debug so check
|
266
|
-
if (size < 0)
|
267
|
-
throw CoinError("trying to copy negative number of entries",
|
268
|
-
"CoinMemcpyN", "");
|
269
|
-
|
270
|
-
#if 0
|
271
|
-
/* There is no point to do this test. If to and from are from different
|
272
|
-
blocks then dist is undefined, so this can crash correct code. It's
|
273
|
-
better to trust the user that the arrays are really disjoint. */
|
274
|
-
const long dist = to - from;
|
275
|
-
if (-size < dist && dist < size)
|
276
|
-
throw CoinError("overlapping arrays", "CoinMemcpyN", "");
|
277
|
-
#endif
|
278
|
-
#endif
|
279
|
-
std::memcpy(to,from,size*sizeof(T));
|
280
|
-
#else
|
281
|
-
if (size == 0 || from == to)
|
282
|
-
return;
|
283
|
-
|
284
|
-
#ifndef NDEBUG
|
285
|
-
if (size < 0)
|
286
|
-
throw CoinError("trying to copy negative number of entries",
|
287
|
-
"CoinMemcpyN", "");
|
288
|
-
#endif
|
289
|
-
|
290
|
-
#if 0
|
291
|
-
/* There is no point to do this test. If to and from are from different
|
292
|
-
blocks then dist is undefined, so this can crash correct code. It's
|
293
|
-
better to trust the user that the arrays are really disjoint. */
|
294
|
-
const long dist = to - from;
|
295
|
-
if (-size < dist && dist < size)
|
296
|
-
throw CoinError("overlapping arrays", "CoinMemcpyN", "");
|
297
|
-
#endif
|
298
|
-
|
299
|
-
for (register int n = size / 8; n > 0; --n, from += 8, to += 8) {
|
300
|
-
to[0] = from[0];
|
301
|
-
to[1] = from[1];
|
302
|
-
to[2] = from[2];
|
303
|
-
to[3] = from[3];
|
304
|
-
to[4] = from[4];
|
305
|
-
to[5] = from[5];
|
306
|
-
to[6] = from[6];
|
307
|
-
to[7] = from[7];
|
308
|
-
}
|
309
|
-
switch (size % 8) {
|
310
|
-
case 7: to[6] = from[6];
|
311
|
-
case 6: to[5] = from[5];
|
312
|
-
case 5: to[4] = from[4];
|
313
|
-
case 4: to[3] = from[3];
|
314
|
-
case 3: to[2] = from[2];
|
315
|
-
case 2: to[1] = from[1];
|
316
|
-
case 1: to[0] = from[0];
|
317
|
-
case 0: break;
|
318
|
-
}
|
319
|
-
#endif
|
320
|
-
#else
|
321
|
-
CoinCopyN(from, size, to);
|
322
|
-
#endif
|
323
|
-
}
|
324
|
-
#else
|
325
|
-
template <class T> inline void
|
326
|
-
CoinMemcpyN(const T * COIN_RESTRICT from, int size, T* COIN_RESTRICT to)
|
327
|
-
{
|
328
|
-
#ifdef USE_MEMCPY
|
329
|
-
std::memcpy(to,from,size*sizeof(T));
|
330
|
-
#else
|
331
|
-
T * COIN_RESTRICT put = to;
|
332
|
-
const T * COIN_RESTRICT get = from;
|
333
|
-
for ( ; 0<size ; --size)
|
334
|
-
*put++ = *get++;
|
335
|
-
#endif
|
336
|
-
}
|
337
|
-
#endif
|
338
|
-
|
339
|
-
//-----------------------------------------------------------------------------
|
340
|
-
|
341
|
-
/** This helper function copies an array to another location. The two arrays
|
342
|
-
must not overlap (otherwise an exception is thrown). For speed 8 entries
|
343
|
-
are copied at a time. The source array is given by its first and "after
|
344
|
-
last" entry; the target array is given by its first entry. */
|
345
|
-
template <class T> inline void
|
346
|
-
CoinMemcpy(register const T* first, register const T* last,
|
347
|
-
register T* to)
|
348
|
-
{
|
349
|
-
CoinMemcpyN(first, static_cast<int>(last - first), to);
|
350
|
-
}
|
351
|
-
|
352
|
-
//#############################################################################
|
353
|
-
|
354
|
-
/** This helper function fills an array with a given value. For speed 8 entries
|
355
|
-
are filled at a time. The array is given by a pointer to its first entry
|
356
|
-
and its size.
|
357
|
-
|
358
|
-
Note JJF - the speed claim seems to be false on IA32 so I have added
|
359
|
-
CoinZero to allow for memset. */
|
360
|
-
template <class T> inline void
|
361
|
-
CoinFillN(register T* to, const int size, register const T value)
|
362
|
-
{
|
363
|
-
if (size == 0)
|
364
|
-
return;
|
365
|
-
|
366
|
-
#ifndef NDEBUG
|
367
|
-
if (size < 0)
|
368
|
-
throw CoinError("trying to fill negative number of entries",
|
369
|
-
"CoinFillN", "");
|
370
|
-
#endif
|
371
|
-
#if 1
|
372
|
-
for (register int n = size / 8; n > 0; --n, to += 8) {
|
373
|
-
to[0] = value;
|
374
|
-
to[1] = value;
|
375
|
-
to[2] = value;
|
376
|
-
to[3] = value;
|
377
|
-
to[4] = value;
|
378
|
-
to[5] = value;
|
379
|
-
to[6] = value;
|
380
|
-
to[7] = value;
|
381
|
-
}
|
382
|
-
switch (size % 8) {
|
383
|
-
case 7: to[6] = value;
|
384
|
-
case 6: to[5] = value;
|
385
|
-
case 5: to[4] = value;
|
386
|
-
case 4: to[3] = value;
|
387
|
-
case 3: to[2] = value;
|
388
|
-
case 2: to[1] = value;
|
389
|
-
case 1: to[0] = value;
|
390
|
-
case 0: break;
|
391
|
-
}
|
392
|
-
#else
|
393
|
-
// Use Duff's device to fill
|
394
|
-
register int n = (size + 7) / 8;
|
395
|
-
--to;
|
396
|
-
switch (size % 8) {
|
397
|
-
case 0: do{ *++to = value;
|
398
|
-
case 7: *++to = value;
|
399
|
-
case 6: *++to = value;
|
400
|
-
case 5: *++to = value;
|
401
|
-
case 4: *++to = value;
|
402
|
-
case 3: *++to = value;
|
403
|
-
case 2: *++to = value;
|
404
|
-
case 1: *++to = value;
|
405
|
-
}while(--n>0);
|
406
|
-
}
|
407
|
-
#endif
|
408
|
-
}
|
409
|
-
|
410
|
-
//-----------------------------------------------------------------------------
|
411
|
-
|
412
|
-
/** This helper function fills an array with a given value. For speed 8
|
413
|
-
entries are filled at a time. The array is given by its first and "after
|
414
|
-
last" entry. */
|
415
|
-
template <class T> inline void
|
416
|
-
CoinFill(register T* first, register T* last, const T value)
|
417
|
-
{
|
418
|
-
CoinFillN(first, last - first, value);
|
419
|
-
}
|
420
|
-
|
421
|
-
//#############################################################################
|
422
|
-
|
423
|
-
/** This helper function fills an array with zero. For speed 8 entries
|
424
|
-
are filled at a time. The array is given by a pointer to its first entry
|
425
|
-
and its size.
|
426
|
-
|
427
|
-
Note JJF - the speed claim seems to be false on IA32 so I have allowed
|
428
|
-
for memset as an alternative */
|
429
|
-
template <class T> inline void
|
430
|
-
CoinZeroN(register T* to, const int size)
|
431
|
-
{
|
432
|
-
#ifdef USE_MEMCPY
|
433
|
-
// Use memset - seems faster on Intel with gcc
|
434
|
-
#ifndef NDEBUG
|
435
|
-
// Some debug so check
|
436
|
-
if (size < 0)
|
437
|
-
throw CoinError("trying to fill negative number of entries",
|
438
|
-
"CoinZeroN", "");
|
439
|
-
#endif
|
440
|
-
memset(to,0,size*sizeof(T));
|
441
|
-
#else
|
442
|
-
if (size == 0)
|
443
|
-
return;
|
444
|
-
|
445
|
-
#ifndef NDEBUG
|
446
|
-
if (size < 0)
|
447
|
-
throw CoinError("trying to fill negative number of entries",
|
448
|
-
"CoinZeroN", "");
|
449
|
-
#endif
|
450
|
-
#if 1
|
451
|
-
for (register int n = size / 8; n > 0; --n, to += 8) {
|
452
|
-
to[0] = 0;
|
453
|
-
to[1] = 0;
|
454
|
-
to[2] = 0;
|
455
|
-
to[3] = 0;
|
456
|
-
to[4] = 0;
|
457
|
-
to[5] = 0;
|
458
|
-
to[6] = 0;
|
459
|
-
to[7] = 0;
|
460
|
-
}
|
461
|
-
switch (size % 8) {
|
462
|
-
case 7: to[6] = 0;
|
463
|
-
case 6: to[5] = 0;
|
464
|
-
case 5: to[4] = 0;
|
465
|
-
case 4: to[3] = 0;
|
466
|
-
case 3: to[2] = 0;
|
467
|
-
case 2: to[1] = 0;
|
468
|
-
case 1: to[0] = 0;
|
469
|
-
case 0: break;
|
470
|
-
}
|
471
|
-
#else
|
472
|
-
// Use Duff's device to fill
|
473
|
-
register int n = (size + 7) / 8;
|
474
|
-
--to;
|
475
|
-
switch (size % 8) {
|
476
|
-
case 0: do{ *++to = 0;
|
477
|
-
case 7: *++to = 0;
|
478
|
-
case 6: *++to = 0;
|
479
|
-
case 5: *++to = 0;
|
480
|
-
case 4: *++to = 0;
|
481
|
-
case 3: *++to = 0;
|
482
|
-
case 2: *++to = 0;
|
483
|
-
case 1: *++to = 0;
|
484
|
-
}while(--n>0);
|
485
|
-
}
|
486
|
-
#endif
|
487
|
-
#endif
|
488
|
-
}
|
489
|
-
/// This Debug helper function checks an array is all zero
|
490
|
-
inline void
|
491
|
-
CoinCheckDoubleZero(double * to, const int size)
|
492
|
-
{
|
493
|
-
int n=0;
|
494
|
-
for (int j=0;j<size;j++) {
|
495
|
-
if (to[j])
|
496
|
-
n++;
|
497
|
-
}
|
498
|
-
if (n) {
|
499
|
-
printf("array of length %d should be zero has %d nonzero\n",size,n);
|
500
|
-
}
|
501
|
-
}
|
502
|
-
/// This Debug helper function checks an array is all zero
|
503
|
-
inline void
|
504
|
-
CoinCheckIntZero(int * to, const int size)
|
505
|
-
{
|
506
|
-
int n=0;
|
507
|
-
for (int j=0;j<size;j++) {
|
508
|
-
if (to[j])
|
509
|
-
n++;
|
510
|
-
}
|
511
|
-
if (n) {
|
512
|
-
printf("array of length %d should be zero has %d nonzero\n",size,n);
|
513
|
-
}
|
514
|
-
}
|
515
|
-
|
516
|
-
//-----------------------------------------------------------------------------
|
517
|
-
|
518
|
-
/** This helper function fills an array with a given value. For speed 8
|
519
|
-
entries are filled at a time. The array is given by its first and "after
|
520
|
-
last" entry. */
|
521
|
-
template <class T> inline void
|
522
|
-
CoinZero(register T* first, register T* last)
|
523
|
-
{
|
524
|
-
CoinZeroN(first, last - first);
|
525
|
-
}
|
526
|
-
|
527
|
-
//#############################################################################
|
528
|
-
|
529
|
-
/** Returns strdup or NULL if original NULL */
|
530
|
-
inline char * CoinStrdup(const char * name)
|
531
|
-
{
|
532
|
-
char* dup = NULL;
|
533
|
-
if (name) {
|
534
|
-
const int len = static_cast<int>(strlen(name));
|
535
|
-
dup = static_cast<char*>(malloc(len+1));
|
536
|
-
CoinMemcpyN(name, len, dup);
|
537
|
-
dup[len] = 0;
|
538
|
-
}
|
539
|
-
return dup;
|
540
|
-
}
|
541
|
-
|
542
|
-
//#############################################################################
|
543
|
-
|
544
|
-
/** Return the larger (according to <code>operator<()</code> of the arguments.
|
545
|
-
This function was introduced because for some reason compiler tend to
|
546
|
-
handle the <code>max()</code> function differently. */
|
547
|
-
template <class T> inline T
|
548
|
-
CoinMax(register const T x1, register const T x2)
|
549
|
-
{
|
550
|
-
return (x1 > x2) ? x1 : x2;
|
551
|
-
}
|
552
|
-
|
553
|
-
//-----------------------------------------------------------------------------
|
554
|
-
|
555
|
-
/** Return the smaller (according to <code>operator<()</code> of the arguments.
|
556
|
-
This function was introduced because for some reason compiler tend to
|
557
|
-
handle the min() function differently. */
|
558
|
-
template <class T> inline T
|
559
|
-
CoinMin(register const T x1, register const T x2)
|
560
|
-
{
|
561
|
-
return (x1 < x2) ? x1 : x2;
|
562
|
-
}
|
563
|
-
|
564
|
-
//-----------------------------------------------------------------------------
|
565
|
-
|
566
|
-
/** Return the absolute value of the argument. This function was introduced
|
567
|
-
because for some reason compiler tend to handle the abs() function
|
568
|
-
differently. */
|
569
|
-
template <class T> inline T
|
570
|
-
CoinAbs(const T value)
|
571
|
-
{
|
572
|
-
return value<0 ? -value : value;
|
573
|
-
}
|
574
|
-
|
575
|
-
//#############################################################################
|
576
|
-
|
577
|
-
/** This helper function tests whether the entries of an array are sorted
|
578
|
-
according to operator<. The array is given by a pointer to its first entry
|
579
|
-
and by its size. */
|
580
|
-
template <class T> inline bool
|
581
|
-
CoinIsSorted(register const T* first, const int size)
|
582
|
-
{
|
583
|
-
if (size == 0)
|
584
|
-
return true;
|
585
|
-
|
586
|
-
#ifndef NDEBUG
|
587
|
-
if (size < 0)
|
588
|
-
throw CoinError("negative number of entries", "CoinIsSorted", "");
|
589
|
-
#endif
|
590
|
-
#if 1
|
591
|
-
// size1 is the number of comparisons to be made
|
592
|
-
const int size1 = size - 1;
|
593
|
-
for (register int n = size1 / 8; n > 0; --n, first += 8) {
|
594
|
-
if (first[8] < first[7]) return false;
|
595
|
-
if (first[7] < first[6]) return false;
|
596
|
-
if (first[6] < first[5]) return false;
|
597
|
-
if (first[5] < first[4]) return false;
|
598
|
-
if (first[4] < first[3]) return false;
|
599
|
-
if (first[3] < first[2]) return false;
|
600
|
-
if (first[2] < first[1]) return false;
|
601
|
-
if (first[1] < first[0]) return false;
|
602
|
-
}
|
603
|
-
|
604
|
-
switch (size1 % 8) {
|
605
|
-
case 7: if (first[7] < first[6]) return false;
|
606
|
-
case 6: if (first[6] < first[5]) return false;
|
607
|
-
case 5: if (first[5] < first[4]) return false;
|
608
|
-
case 4: if (first[4] < first[3]) return false;
|
609
|
-
case 3: if (first[3] < first[2]) return false;
|
610
|
-
case 2: if (first[2] < first[1]) return false;
|
611
|
-
case 1: if (first[1] < first[0]) return false;
|
612
|
-
case 0: break;
|
613
|
-
}
|
614
|
-
#else
|
615
|
-
register const T* next = first;
|
616
|
-
register const T* last = first + size;
|
617
|
-
for (++next; next != last; first = next, ++next)
|
618
|
-
if (*next < *first)
|
619
|
-
return false;
|
620
|
-
#endif
|
621
|
-
return true;
|
622
|
-
}
|
623
|
-
|
624
|
-
//-----------------------------------------------------------------------------
|
625
|
-
|
626
|
-
/** This helper function tests whether the entries of an array are sorted
|
627
|
-
according to operator<. The array is given by its first and "after
|
628
|
-
last" entry. */
|
629
|
-
template <class T> inline bool
|
630
|
-
CoinIsSorted(register const T* first, register const T* last)
|
631
|
-
{
|
632
|
-
return CoinIsSorted(first, static_cast<int>(last - first));
|
633
|
-
}
|
634
|
-
|
635
|
-
//#############################################################################
|
636
|
-
|
637
|
-
/** This helper function fills an array with the values init, init+1, init+2,
|
638
|
-
etc. For speed 8 entries are filled at a time. The array is given by a
|
639
|
-
pointer to its first entry and its size. */
|
640
|
-
template <class T> inline void
|
641
|
-
CoinIotaN(register T* first, const int size, register T init)
|
642
|
-
{
|
643
|
-
if (size == 0)
|
644
|
-
return;
|
645
|
-
|
646
|
-
#ifndef NDEBUG
|
647
|
-
if (size < 0)
|
648
|
-
throw CoinError("negative number of entries", "CoinIotaN", "");
|
649
|
-
#endif
|
650
|
-
#if 1
|
651
|
-
for (register int n = size / 8; n > 0; --n, first += 8, init += 8) {
|
652
|
-
first[0] = init;
|
653
|
-
first[1] = init + 1;
|
654
|
-
first[2] = init + 2;
|
655
|
-
first[3] = init + 3;
|
656
|
-
first[4] = init + 4;
|
657
|
-
first[5] = init + 5;
|
658
|
-
first[6] = init + 6;
|
659
|
-
first[7] = init + 7;
|
660
|
-
}
|
661
|
-
switch (size % 8) {
|
662
|
-
case 7: first[6] = init + 6;
|
663
|
-
case 6: first[5] = init + 5;
|
664
|
-
case 5: first[4] = init + 4;
|
665
|
-
case 4: first[3] = init + 3;
|
666
|
-
case 3: first[2] = init + 2;
|
667
|
-
case 2: first[1] = init + 1;
|
668
|
-
case 1: first[0] = init;
|
669
|
-
case 0: break;
|
670
|
-
}
|
671
|
-
#else
|
672
|
-
// Use Duff's device to fill
|
673
|
-
register int n = (size + 7) / 8;
|
674
|
-
--first;
|
675
|
-
--init;
|
676
|
-
switch (size % 8) {
|
677
|
-
case 0: do{ *++first = ++init;
|
678
|
-
case 7: *++first = ++init;
|
679
|
-
case 6: *++first = ++init;
|
680
|
-
case 5: *++first = ++init;
|
681
|
-
case 4: *++first = ++init;
|
682
|
-
case 3: *++first = ++init;
|
683
|
-
case 2: *++first = ++init;
|
684
|
-
case 1: *++first = ++init;
|
685
|
-
}while(--n>0);
|
686
|
-
}
|
687
|
-
#endif
|
688
|
-
}
|
689
|
-
|
690
|
-
//-----------------------------------------------------------------------------
|
691
|
-
|
692
|
-
/** This helper function fills an array with the values init, init+1, init+2,
|
693
|
-
etc. For speed 8 entries are filled at a time. The array is given by its
|
694
|
-
first and "after last" entry. */
|
695
|
-
template <class T> inline void
|
696
|
-
CoinIota(T* first, const T* last, T init)
|
697
|
-
{
|
698
|
-
CoinIotaN(first, last-first, init);
|
699
|
-
}
|
700
|
-
|
701
|
-
//#############################################################################
|
702
|
-
|
703
|
-
/** This helper function deletes certain entries from an array. The array is
|
704
|
-
given by pointers to its first and "after last" entry (first two
|
705
|
-
arguments). The positions of the entries to be deleted are given in the
|
706
|
-
integer array specified by the last two arguments (again, first and "after
|
707
|
-
last" entry). */
|
708
|
-
template <class T> inline T *
|
709
|
-
CoinDeleteEntriesFromArray(register T * arrayFirst, register T * arrayLast,
|
710
|
-
const int * firstDelPos, const int * lastDelPos)
|
711
|
-
{
|
712
|
-
int delNum = static_cast<int>(lastDelPos - firstDelPos);
|
713
|
-
if (delNum == 0)
|
714
|
-
return arrayLast;
|
715
|
-
|
716
|
-
if (delNum < 0)
|
717
|
-
throw CoinError("trying to delete negative number of entries",
|
718
|
-
"CoinDeleteEntriesFromArray", "");
|
719
|
-
|
720
|
-
int * delSortedPos = NULL;
|
721
|
-
if (! (CoinIsSorted(firstDelPos, lastDelPos) &&
|
722
|
-
std::adjacent_find(firstDelPos, lastDelPos) == lastDelPos)) {
|
723
|
-
// the positions of the to be deleted is either not sorted or not unique
|
724
|
-
delSortedPos = new int[delNum];
|
725
|
-
CoinDisjointCopy(firstDelPos, lastDelPos, delSortedPos);
|
726
|
-
std::sort(delSortedPos, delSortedPos + delNum);
|
727
|
-
delNum = static_cast<int>(std::unique(delSortedPos,
|
728
|
-
delSortedPos+delNum) - delSortedPos);
|
729
|
-
}
|
730
|
-
const int * delSorted = delSortedPos ? delSortedPos : firstDelPos;
|
731
|
-
|
732
|
-
const int last = delNum - 1;
|
733
|
-
int size = delSorted[0];
|
734
|
-
for (int i = 0; i < last; ++i) {
|
735
|
-
const int copyFirst = delSorted[i] + 1;
|
736
|
-
const int copyLast = delSorted[i+1];
|
737
|
-
CoinCopy(arrayFirst + copyFirst, arrayFirst + copyLast,
|
738
|
-
arrayFirst + size);
|
739
|
-
size += copyLast - copyFirst;
|
740
|
-
}
|
741
|
-
const int copyFirst = delSorted[last] + 1;
|
742
|
-
const int copyLast = static_cast<int>(arrayLast - arrayFirst);
|
743
|
-
CoinCopy(arrayFirst + copyFirst, arrayFirst + copyLast,
|
744
|
-
arrayFirst + size);
|
745
|
-
size += copyLast - copyFirst;
|
746
|
-
|
747
|
-
if (delSortedPos)
|
748
|
-
delete[] delSortedPos;
|
749
|
-
|
750
|
-
return arrayFirst + size;
|
751
|
-
}
|
752
|
-
|
753
|
-
//#############################################################################
|
754
|
-
|
755
|
-
#define COIN_OWN_RANDOM_32
|
756
|
-
|
757
|
-
#if defined COIN_OWN_RANDOM_32
|
758
|
-
/* Thanks to Stefano Gliozzi for providing an operating system
|
759
|
-
independent random number generator. */
|
760
|
-
|
761
|
-
/*! \brief Return a random number between 0 and 1
|
762
|
-
|
763
|
-
A platform-independent linear congruential generator. For a given seed, the
|
764
|
-
generated sequence is always the same regardless of the (32-bit)
|
765
|
-
architecture. This allows to build & test in different environments, getting
|
766
|
-
in most cases the same optimization path.
|
767
|
-
|
768
|
-
Set \p isSeed to true and supply an integer seed to set the seed
|
769
|
-
(vid. #CoinSeedRandom)
|
770
|
-
|
771
|
-
\todo Anyone want to volunteer an upgrade for 64-bit architectures?
|
772
|
-
*/
|
773
|
-
inline double CoinDrand48 (bool isSeed = false, unsigned int seed = 1)
|
774
|
-
{
|
775
|
-
static unsigned int last = 123456;
|
776
|
-
if (isSeed) {
|
777
|
-
last = seed;
|
778
|
-
} else {
|
779
|
-
last = 1664525*last+1013904223;
|
780
|
-
return ((static_cast<double> (last))/4294967296.0);
|
781
|
-
}
|
782
|
-
return (0.0);
|
783
|
-
}
|
784
|
-
|
785
|
-
/// Set the seed for the random number generator
|
786
|
-
inline void CoinSeedRandom(int iseed)
|
787
|
-
{
|
788
|
-
CoinDrand48(true, iseed);
|
789
|
-
}
|
790
|
-
|
791
|
-
#else // COIN_OWN_RANDOM_32
|
792
|
-
|
793
|
-
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN32__)
|
794
|
-
|
795
|
-
/// Return a random number between 0 and 1
|
796
|
-
inline double CoinDrand48() { return rand() / (double) RAND_MAX; }
|
797
|
-
/// Set the seed for the random number generator
|
798
|
-
inline void CoinSeedRandom(int iseed) { srand(iseed + 69822); }
|
799
|
-
|
800
|
-
#else
|
801
|
-
|
802
|
-
/// Return a random number between 0 and 1
|
803
|
-
inline double CoinDrand48() { return drand48(); }
|
804
|
-
/// Set the seed for the random number generator
|
805
|
-
inline void CoinSeedRandom(int iseed) { srand48(iseed + 69822); }
|
806
|
-
|
807
|
-
#endif
|
808
|
-
|
809
|
-
#endif // COIN_OWN_RANDOM_32
|
810
|
-
|
811
|
-
//#############################################################################
|
812
|
-
|
813
|
-
/** This function figures out whether file names should contain slashes or
|
814
|
-
backslashes as directory separator */
|
815
|
-
inline char CoinFindDirSeparator()
|
816
|
-
{
|
817
|
-
int size = 1000;
|
818
|
-
char* buf = 0;
|
819
|
-
while (true) {
|
820
|
-
buf = new char[size];
|
821
|
-
if (getcwd(buf, size))
|
822
|
-
break;
|
823
|
-
delete[] buf;
|
824
|
-
buf = 0;
|
825
|
-
size = 2*size;
|
826
|
-
}
|
827
|
-
// if first char is '/' then it's unix and the dirsep is '/'. otherwise we
|
828
|
-
// assume it's dos and the dirsep is '\'
|
829
|
-
char dirsep = buf[0] == '/' ? '/' : '\\';
|
830
|
-
delete[] buf;
|
831
|
-
return dirsep;
|
832
|
-
}
|
833
|
-
//#############################################################################
|
834
|
-
|
835
|
-
inline int CoinStrNCaseCmp(const char* s0, const char* s1,
|
836
|
-
const size_t len)
|
837
|
-
{
|
838
|
-
for (size_t i = 0; i < len; ++i) {
|
839
|
-
if (s0[i] == 0) {
|
840
|
-
return s1[i] == 0 ? 0 : -1;
|
841
|
-
}
|
842
|
-
if (s1[i] == 0) {
|
843
|
-
return 1;
|
844
|
-
}
|
845
|
-
const int c0 = std::tolower(s0[i]);
|
846
|
-
const int c1 = std::tolower(s1[i]);
|
847
|
-
if (c0 < c1)
|
848
|
-
return -1;
|
849
|
-
if (c0 > c1)
|
850
|
-
return 1;
|
851
|
-
}
|
852
|
-
return 0;
|
853
|
-
}
|
854
|
-
|
855
|
-
//#############################################################################
|
856
|
-
|
857
|
-
/// Swap the arguments.
|
858
|
-
template <class T> inline void CoinSwap (T &x, T &y)
|
859
|
-
{
|
860
|
-
T t = x;
|
861
|
-
x = y;
|
862
|
-
y = t;
|
863
|
-
}
|
864
|
-
|
865
|
-
//#############################################################################
|
866
|
-
|
867
|
-
/** This helper function copies an array to file
|
868
|
-
Returns 0 if OK, 1 if bad write.
|
869
|
-
*/
|
870
|
-
|
871
|
-
template <class T> inline int
|
872
|
-
CoinToFile( const T* array, CoinBigIndex size, FILE * fp)
|
873
|
-
{
|
874
|
-
CoinBigIndex numberWritten;
|
875
|
-
if (array&&size) {
|
876
|
-
numberWritten =
|
877
|
-
static_cast<CoinBigIndex>(fwrite(&size,sizeof(int),1,fp));
|
878
|
-
if (numberWritten!=1)
|
879
|
-
return 1;
|
880
|
-
numberWritten =
|
881
|
-
static_cast<CoinBigIndex>(fwrite(array,sizeof(T),size_t(size),fp));
|
882
|
-
if (numberWritten!=size)
|
883
|
-
return 1;
|
884
|
-
} else {
|
885
|
-
size = 0;
|
886
|
-
numberWritten =
|
887
|
-
static_cast<CoinBigIndex>(fwrite(&size,sizeof(int),1,fp));
|
888
|
-
if (numberWritten!=1)
|
889
|
-
return 1;
|
890
|
-
}
|
891
|
-
return 0;
|
892
|
-
}
|
893
|
-
|
894
|
-
//#############################################################################
|
895
|
-
|
896
|
-
/** This helper function copies an array from file and creates with new.
|
897
|
-
Passed in array is ignored i.e. not deleted.
|
898
|
-
But if NULL and size does not match and newSize 0 then leaves as NULL and 0
|
899
|
-
Returns 0 if OK, 1 if bad read, 2 if size did not match.
|
900
|
-
*/
|
901
|
-
|
902
|
-
template <class T> inline int
|
903
|
-
CoinFromFile( T* &array, CoinBigIndex size, FILE * fp, CoinBigIndex & newSize)
|
904
|
-
{
|
905
|
-
CoinBigIndex numberRead;
|
906
|
-
numberRead =
|
907
|
-
static_cast<CoinBigIndex>(fread(&newSize,sizeof(int),1,fp));
|
908
|
-
if (numberRead!=1)
|
909
|
-
return 1;
|
910
|
-
int returnCode=0;
|
911
|
-
if (size!=newSize&&(newSize||array))
|
912
|
-
returnCode=2;
|
913
|
-
if (newSize) {
|
914
|
-
array = new T [newSize];
|
915
|
-
numberRead =
|
916
|
-
static_cast<CoinBigIndex>(fread(array,sizeof(T),newSize,fp));
|
917
|
-
if (numberRead!=newSize)
|
918
|
-
returnCode=1;
|
919
|
-
} else {
|
920
|
-
array = NULL;
|
921
|
-
}
|
922
|
-
return returnCode;
|
923
|
-
}
|
924
|
-
|
925
|
-
//#############################################################################
|
926
|
-
|
927
|
-
/// Cube Root
|
928
|
-
#if 0
|
929
|
-
inline double CoinCbrt(double x)
|
930
|
-
{
|
931
|
-
#if defined(_MSC_VER)
|
932
|
-
return pow(x,(1./3.));
|
933
|
-
#else
|
934
|
-
return cbrt(x);
|
935
|
-
#endif
|
936
|
-
}
|
937
|
-
#endif
|
938
|
-
|
939
|
-
//-----------------------------------------------------------------------------
|
940
|
-
|
941
|
-
/// This helper returns "sizeof" as an int
|
942
|
-
#define CoinSizeofAsInt(type) (static_cast<int>(sizeof(type)))
|
943
|
-
/// This helper returns "strlen" as an int
|
944
|
-
inline int
|
945
|
-
CoinStrlenAsInt(const char * string)
|
946
|
-
{
|
947
|
-
return static_cast<int>(strlen(string));
|
948
|
-
}
|
949
|
-
|
950
|
-
/** Class for thread specific random numbers
|
951
|
-
*/
|
952
|
-
#if defined COIN_OWN_RANDOM_32
|
953
|
-
class CoinThreadRandom {
|
954
|
-
public:
|
955
|
-
/**@name Constructors, destructor */
|
956
|
-
|
957
|
-
//@{
|
958
|
-
/** Default constructor. */
|
959
|
-
CoinThreadRandom()
|
960
|
-
{ seed_=12345678;}
|
961
|
-
/** Constructor wih seed. */
|
962
|
-
CoinThreadRandom(int seed)
|
963
|
-
{
|
964
|
-
seed_ = seed;
|
965
|
-
}
|
966
|
-
/** Destructor */
|
967
|
-
~CoinThreadRandom() {}
|
968
|
-
// Copy
|
969
|
-
CoinThreadRandom(const CoinThreadRandom & rhs)
|
970
|
-
{ seed_ = rhs.seed_;}
|
971
|
-
// Assignment
|
972
|
-
CoinThreadRandom& operator=(const CoinThreadRandom & rhs)
|
973
|
-
{
|
974
|
-
if (this != &rhs) {
|
975
|
-
seed_ = rhs.seed_;
|
976
|
-
}
|
977
|
-
return *this;
|
978
|
-
}
|
979
|
-
|
980
|
-
//@}
|
981
|
-
|
982
|
-
/**@name Sets/gets */
|
983
|
-
|
984
|
-
//@{
|
985
|
-
/** Set seed. */
|
986
|
-
inline void setSeed(int seed)
|
987
|
-
{
|
988
|
-
seed_ = seed;
|
989
|
-
}
|
990
|
-
/** Get seed. */
|
991
|
-
inline unsigned int getSeed() const
|
992
|
-
{
|
993
|
-
return seed_;
|
994
|
-
}
|
995
|
-
/// return a random number
|
996
|
-
inline double randomDouble() const
|
997
|
-
{
|
998
|
-
double retVal;
|
999
|
-
seed_ = 1664525*(seed_)+1013904223;
|
1000
|
-
retVal = ((static_cast<double> (seed_))/4294967296.0);
|
1001
|
-
return retVal;
|
1002
|
-
}
|
1003
|
-
/// make more random (i.e. for startup)
|
1004
|
-
inline void randomize(int n=0)
|
1005
|
-
{
|
1006
|
-
if (!n)
|
1007
|
-
n=seed_ & 255;
|
1008
|
-
for (int i=0;i<n;i++)
|
1009
|
-
randomDouble();
|
1010
|
-
}
|
1011
|
-
//@}
|
1012
|
-
|
1013
|
-
|
1014
|
-
protected:
|
1015
|
-
/**@name Data members
|
1016
|
-
The data members are protected to allow access for derived classes. */
|
1017
|
-
//@{
|
1018
|
-
/// Current seed
|
1019
|
-
mutable unsigned int seed_;
|
1020
|
-
//@}
|
1021
|
-
};
|
1022
|
-
#else
|
1023
|
-
class CoinThreadRandom {
|
1024
|
-
public:
|
1025
|
-
/**@name Constructors, destructor */
|
1026
|
-
|
1027
|
-
//@{
|
1028
|
-
/** Default constructor. */
|
1029
|
-
CoinThreadRandom()
|
1030
|
-
{ seed_[0]=50000;seed_[1]=40000;seed_[2]=30000;}
|
1031
|
-
/** Constructor wih seed. */
|
1032
|
-
CoinThreadRandom(const unsigned short seed[3])
|
1033
|
-
{ memcpy(seed_,seed,3*sizeof(unsigned short));}
|
1034
|
-
/** Constructor wih seed. */
|
1035
|
-
CoinThreadRandom(int seed)
|
1036
|
-
{
|
1037
|
-
union { int i[2]; unsigned short int s[4];} put;
|
1038
|
-
put.i[0]=seed;
|
1039
|
-
put.i[1]=seed;
|
1040
|
-
memcpy(seed_,put.s,3*sizeof(unsigned short));
|
1041
|
-
}
|
1042
|
-
/** Destructor */
|
1043
|
-
~CoinThreadRandom() {}
|
1044
|
-
// Copy
|
1045
|
-
CoinThreadRandom(const CoinThreadRandom & rhs)
|
1046
|
-
{ memcpy(seed_,rhs.seed_,3*sizeof(unsigned short));}
|
1047
|
-
// Assignment
|
1048
|
-
CoinThreadRandom& operator=(const CoinThreadRandom & rhs)
|
1049
|
-
{
|
1050
|
-
if (this != &rhs) {
|
1051
|
-
memcpy(seed_,rhs.seed_,3*sizeof(unsigned short));
|
1052
|
-
}
|
1053
|
-
return *this;
|
1054
|
-
}
|
1055
|
-
|
1056
|
-
//@}
|
1057
|
-
|
1058
|
-
/**@name Sets/gets */
|
1059
|
-
|
1060
|
-
//@{
|
1061
|
-
/** Set seed. */
|
1062
|
-
inline void setSeed(const unsigned short seed[3])
|
1063
|
-
{ memcpy(seed_,seed,3*sizeof(unsigned short));}
|
1064
|
-
/** Set seed. */
|
1065
|
-
inline void setSeed(int seed)
|
1066
|
-
{
|
1067
|
-
union { int i[2]; unsigned short int s[4];} put;
|
1068
|
-
put.i[0]=seed;
|
1069
|
-
put.i[1]=seed;
|
1070
|
-
memcpy(seed_,put.s,3*sizeof(unsigned short));
|
1071
|
-
}
|
1072
|
-
/// return a random number
|
1073
|
-
inline double randomDouble() const
|
1074
|
-
{
|
1075
|
-
double retVal;
|
1076
|
-
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN32__)
|
1077
|
-
retVal=rand();
|
1078
|
-
retVal=retVal/(double) RAND_MAX;
|
1079
|
-
#else
|
1080
|
-
retVal = erand48(seed_);
|
1081
|
-
#endif
|
1082
|
-
return retVal;
|
1083
|
-
}
|
1084
|
-
/// make more random (i.e. for startup)
|
1085
|
-
inline void randomize(int n=0)
|
1086
|
-
{
|
1087
|
-
if (!n) {
|
1088
|
-
n=seed_[0]+seed_[1]+seed_[2];
|
1089
|
-
n &= 255;
|
1090
|
-
}
|
1091
|
-
for (int i=0;i<n;i++)
|
1092
|
-
randomDouble();
|
1093
|
-
}
|
1094
|
-
//@}
|
1095
|
-
|
1096
|
-
|
1097
|
-
protected:
|
1098
|
-
/**@name Data members
|
1099
|
-
The data members are protected to allow access for derived classes. */
|
1100
|
-
//@{
|
1101
|
-
/// Current seed
|
1102
|
-
mutable unsigned short seed_[3];
|
1103
|
-
//@}
|
1104
|
-
};
|
1105
|
-
#endif
|
1106
|
-
#ifndef COIN_DETAIL
|
1107
|
-
#define COIN_DETAIL_PRINT(s) {}
|
1108
|
-
#else
|
1109
|
-
#define COIN_DETAIL_PRINT(s) s
|
1110
|
-
#endif
|
1111
|
-
#endif
|