Simple Simple::parseFile( const QString &filename, bool *ok ) { QFile file( filename ); if ( !file.open( QIODevice::ReadOnly ) ) { qCritical() << "Unable to open file '" << filename << "'"; if ( ok ) *ok = false; return Simple(); } QString errorMsg; int errorLine, errorCol; QDomDocument doc; if ( !doc.setContent( &file, false, &errorMsg, &errorLine, &errorCol ) ) { qCritical() << errorMsg << " at " << errorLine << "," << errorCol; if ( ok ) *ok = false; return Simple(); } qDebug() << "CONTENT:" << doc.toString(); bool documentOk; Simple c = parseElement( doc.documentElement(), &documentOk ); if ( ok ) { *ok = documentOk; } return c; }
void MainWindow::on_actionNewWindow_triggered() { myDialog *dialog = new myDialog(this); dialog->show(); str *n = new str; QObject::connect(dialog,SIGNAL(Simple(QString)),n,SLOT(Simple(QString))); QObject::connect(dialog,SIGNAL(Invers(QString)),n,SLOT(Inversia(QString))); QObject::connect(dialog,SIGNAL(Register(QString)),n,SLOT(Register(QString))); QObject::connect(dialog,SIGNAL(RegisterAndInvers(QString)),n,SLOT(All(QString))); }
simplest::Simple simplest::Simple::create() { if(instanceCount() == 0) return Simple(); Simple result = popFreeSimple(); if(!result.isValid()) { if(getUsed() >= instanceCount()) reallocInstances(instanceCount() << 1); result = Simple(getUsed()); setUsed(getUsed() + 1); } result.reset(); result.onCreate(); return result; }
int main() { double x=0.5; printf("The simple way:\n"); Simple(1,x); printf("The Steffense way:\n"); Steffensen(1,x); return 0; }
int main () { int a = ONE + TWO; // Break here #undef MACRO_2 #undef FOUR return Simple().Method(); }
//简单迭代法函数 void Simple(int i,double x) { double a; a=NumOfFunction(x); printf("第%d次:%fl\n",i,a); if(fabs(a-x)>=pow(10,-5)) { Simple(i+1,a); } }
namespace streflop { // MSVC chokes on these constants, // TODO: we need another way to specify them. (hardcode the bitpattern?) #ifndef _MSC_VER // Constants const Simple SimplePositiveInfinity = Simple(1.0f) / Simple(0.0f); const Simple SimpleNegativeInfinity = Simple(-1.0f) / Simple(0.0f); // TODO: non-signaling version const Simple SimpleNaN = SimplePositiveInfinity + SimpleNegativeInfinity; const Double DoublePositiveInfinity = Double(1.0f) / Double(0.0f); const Double DoubleNegativeInfinity = Double(-1.0f) / Double(0.0f); // TODO: non-signaling version const Double DoubleNaN = DoublePositiveInfinity + DoubleNegativeInfinity; // Extended are not always available #ifdef Extended const Extended ExtendedPositiveInfinity = Extended(1.0f) / Extended(0.0f); const Extended ExtendedNegativeInfinity = Extended(-1.0f) / Extended(0.0f); // TODO: non-signaling version const Extended ExtendedNaN = ExtendedPositiveInfinity + ExtendedNegativeInfinity; #endif #endif // _MSC_VER // Default environment. Initalized to 0, and really set on first access #if defined(STREFLOP_X87) fenv_t FE_DFL_ENV = 0; #elif defined(STREFLOP_SSE) fenv_t FE_DFL_ENV = {0,0}; #elif defined(STREFLOP_SOFT) fenv_t FE_DFL_ENV = {42,0,0}; #else #error STREFLOP: Invalid combination or unknown FPU type. #endif }
void CHelloTraceFn::PreProcessedFn(TInt aDbgParam) { OstTraceExt2( TRACE_FLOW, CHELLOTRACEFN_PREPROCESSEDFN_ENTRY_1, "CHelloTraceFn::PreProcessedFn: > CHelloTraceFn::PreProcessedFn;aDbgParam=%d;this=%x", (TInt) aDbgParam, (TUint) this); #else void CHelloTraceFn::PreProcessedFn() { OstTrace1( TRACE_FLOW, CHELLOTRACEFN_PREPROCESSEDFN_ENTRY_2, "CHelloTraceFn::PreProcessedFn: > CHelloTraceFn::PreProcessedFn;this=%x", (TUint) this); #endif Simple(); OstTrace1( TRACE_FLOW, CHELLOTRACEFN_PREPROCESSEDFN_EXIT, "CHelloTraceFn::PreProcessedFn: < CHelloTraceFn::PreProcessedFn;this=%x", (TUint) this); }
simplest::Simple simplest::Simple::popFreeSimple() { Simple result = getFirstFreeSimple(); if(result.isValid()) { result.removeFreeSimpleHandler(); setFirstFreeSimple(result.getNextSimpleFreeSimple()); result.setNextSimpleFreeSimple(Simple()); setNumFreeSimples(getNumFreeSimples() - 1); } return result; }
namespace streflop { // Constants const Simple SimpleZero(0.0f); const Simple SimplePositiveInfinity = Simple(1.0f) / SimpleZero; const Simple SimpleNegativeInfinity = Simple(-1.0f) / SimpleZero; // TODO: non-signaling version const Simple SimpleNaN = SimplePositiveInfinity + SimpleNegativeInfinity; const Double DoubleZero(0.0f); const Double DoublePositiveInfinity = Double(1.0f) / DoubleZero; const Double DoubleNegativeInfinity = Double(-1.0f) / DoubleZero; // TODO: non-signaling version const Double DoubleNaN = DoublePositiveInfinity + DoubleNegativeInfinity; // Extended are not always available #ifdef Extended const Extended ExtendedZero(0.0f); const Extended ExtendedPositiveInfinity = Extended(1.0f) / ExtendedZero; const Extended ExtendedNegativeInfinity = Extended(-1.0f) / ExtendedZero; // TODO: non-signaling version const Extended ExtendedNaN = ExtendedPositiveInfinity + ExtendedNegativeInfinity; #endif // Default environment. Initialized to 0, and really set on first access #if defined(STREFLOP_X87) fenv_t FE_DFL_ENV = 0; #elif defined(STREFLOP_SSE) fenv_t FE_DFL_ENV = {0,0}; #elif defined(STREFLOP_SOFT) fenv_t FE_DFL_ENV = {42,0,0}; #else #error STREFLOP: Invalid combination or unknown FPU type. #endif }
Simple Simple::parseElement( const QDomElement &element, bool *ok ) { if ( element.tagName() != "simple" ) { qCritical() << "Expected 'simple', got '" <<element.tagName() << "'."; if ( ok ) *ok = false; return Simple(); } Simple result = Simple(); QDomNode n; for( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { QDomElement e = n.toElement(); if ( e.tagName() == "food" ) { bool ok; Food o = Food::parseElement( e, &ok ); if ( ok ) result.addFood( o ); } } if ( ok ) *ok = true; return result; }
Bool simplest::Simple::removeFreeSimple(const Simple & child) { if( !child.isExists() ) return false; Simple prev; Simple current; for(current = getFirstFreeSimple(); current.isValid() && current != child; current = current.getNextSimpleFreeSimple()) prev = current; if(!current.isValid()) { return false; //! data corrupted } current.removeFreeSimpleHandler(); if(prev.isValid()) prev.setNextSimpleFreeSimple(current.getNextSimpleFreeSimple()); else setFirstFreeSimple(current.getNextSimpleFreeSimple()); current.setNextSimpleFreeSimple(Simple()); setNumFreeSimples(getNumFreeSimples() - 1); return true; }
DRIVER_ERROR Header400::Send() // Sends 400-style header to printer. { DRIVER_ERROR err; err = thePrinter->Send((const BYTE*)Reset,sizeof(Reset)); ERRCHECK; err = Modes(); // Set media source, type, size and quality modes. ERRCHECK; err = Margins(); // set margins ERRCHECK; err = Simple(); // set color mode and resolution ERRCHECK; err = Graphics(); // start raster graphics and set compression mode return err; }
static int EndDocument(void *UserData) { Simple("endDocument"); return 0; }
static int StartDocument(void *UserData) { Simple("startDocument"); return 0; }
static int EndCDATA(void *UserData) { Simple("endCDATA"); return 0; }
int main (int argc, char *argv[]) { if (argc > 1) { /* Help */ if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "-H") || !strcmp(argv[1], "--help") || !strcmp(argv[1], "--Help")) { Help (); return 0; } /* run tests */ if(strcmp(argv[1], "test")==0) { /* To enable a test, please modify the file LTE-Sim/src/TESTS/test.h */ Test (); } /* Run simple scenario */ if (strcmp(argv[1], "Simple")==0) { Simple (); } /*Mouan*/ /* if (strcmp(argv[1], "mouan")==0) { int nbCells = atoi(argv[2]); double radius = atof(argv[3]); int nbUE = atoi(argv[4]); int nbVoIP = atoi(argv[5]); int nbVideo = atoi(argv[6]); int nbBE = atoi(argv[7]); int nbCBR = atoi(argv[8]); int sched_type = atoi(argv[9]); int frame_struct = atoi(argv[10]); int speed = atoi(argv[11]); double maxDelay = atof(argv[12]); int video_bit_rate = atoi(argv[13]); int seed; if (argc==14) seed = atoi(argv[13]); else seed = -1; MouanCell (nbCells, radius, nbUE, nbVoIP, nbVideo, nbBE, nbCBR, sched_type, frame_struct, speed, maxDelay, video_bit_rate, seed); }*/ /* Run more complex scenarios */ if (strcmp(argv[1], "SingleCell")==0) { double radius = atof(argv[2]); int nbUE = atoi(argv[3]); int nbVoIP = atoi(argv[4]); int nbVideo = atoi(argv[5]); int nbBE = atoi(argv[6]); int nbCBR = atoi(argv[7]); int sched_type = atoi(argv[8]); int frame_struct = atoi(argv[9]); int speed = atoi(argv[10]); double maxDelay = atof(argv[11]); int video_bit_rate = atoi(argv[12]); int seed; if (argc==14) seed = atoi(argv[13]); else seed = -1; SingleCellWithoutInterference (radius, nbUE, nbVoIP, nbVideo, nbBE, nbCBR, sched_type, frame_struct, speed, maxDelay, video_bit_rate, seed); } if (strcmp(argv[1], "SingleCellWithI")==0) { int nbCells = atoi(argv[2]); double radius = atof(argv[3]); int nbUE = atoi(argv[4]); int nbVoIP = atoi(argv[5]); int nbVideo = atoi(argv[6]); int nbBE = atoi(argv[7]); int nbCBR = atoi(argv[8]); int sched_type = atoi(argv[9]); int frame_struct = atoi(argv[10]); int speed = atoi(argv[11]); double maxDelay = atof(argv[12]); int video_bit_rate = atoi(argv[13]); int seed; if (argc==14) seed = atoi(argv[13]); else seed = -1; SingleCellWithInterference (nbCells, radius, nbUE, nbVoIP, nbVideo, nbBE, nbCBR, sched_type, frame_struct, speed, maxDelay, video_bit_rate, seed); } if (strcmp(argv[1], "MultiCell")==0) { int nbCells = atoi(argv[2]); double radius = atof(argv[3]); int nbUE = atoi(argv[4]); int nbVoIP = atoi(argv[5]); int nbVideo = atoi(argv[6]); int nbBE = atoi(argv[7]); int nbCBR = atoi(argv[8]); int sched_type = atoi(argv[9]); int frame_struct = atoi(argv[10]); int speed = atoi(argv[11]); double maxDelay = atof(argv[12]); int video_bit_rate = atoi(argv[13]); int seed; if (argc==14) seed = atoi(argv[13]); else seed = -1; MultiCell (nbCells, radius, nbUE, nbVoIP, nbVideo, nbBE, nbCBR, sched_type, frame_struct, speed, maxDelay, video_bit_rate, seed); } if (strcmp(argv[1], "SingleCellWithFemto")==0) { int nbBuilding = atoi(argv[2]); int buildingType = atoi(argv[3]); double activityRatio = atof(argv[4]); double radius = atof(argv[5]); int nbUE = atoi(argv[6]); int nbFemtoUE = atoi(argv[7]); int nbVoIP = atoi(argv[8]); int nbVideo = atoi(argv[9]); int nbBE = atoi(argv[10]); int nbCBR = atoi(argv[11]); int sched_type = atoi(argv[12]); int frame_struct = atoi(argv[13]); int speed = atoi(argv[14]); int accessPolicy = atoi(argv[15]); double maxDelay = atof(argv[16]); int video_bit_rate = atoi(argv[17]); int seed; if (argc==14) seed = atoi(argv[13]); else seed = -1; SingleCellWithFemto ( nbBuilding, buildingType, activityRatio, radius, nbUE, nbFemtoUE, nbVoIP, nbVideo, nbBE, nbCBR, sched_type, frame_struct, speed, accessPolicy, maxDelay, video_bit_rate, seed); } if (strcmp(argv[1], "SingleCellWithStreets")==0) { int nbStreets = atoi(argv[2]); double radius = atof(argv[3]); int nbUE = atoi(argv[4]); int nbFemtoUE = atoi(argv[5]); int nbVoIP = atoi(argv[6]); int nbVideo = atoi(argv[7]); int nbBE = atoi(argv[8]); int nbCBR = atoi(argv[9]); int sched_type = atoi(argv[10]); int frame_struct = atoi(argv[11]); int speed = atoi(argv[12]); double maxDelay = atof(argv[13]); int video_bit_rate = atoi(argv[14]); int seed; if (argc==14) seed = atoi(argv[13]); else seed = -1; SingleCellWithStreets ( radius, nbStreets, nbUE, nbFemtoUE, nbVoIP, nbVideo, nbBE, nbCBR, sched_type, frame_struct, speed, maxDelay, video_bit_rate, seed); } /* other dedicated simulations */ if (strcmp(argv[1], "test-amc-mapping")==0) { int cells = atoi(argv[2]); double radius = atof(argv[3]); int speed = atoi(argv[4]); int bandwidth = atoi(argv[5]); int cluster = atoi(argv[6]); TestAmcMapping (cells, radius, speed, bandwidth, cluster); } if (strcmp(argv[1], "test-mobility-model")==0) { double radius = atof(argv[2]); int nbUE = atoi(argv[3]); int model = atoi(argv[4]); int speed = atoi(argv[5]); double duration = atoi(argv[6]); TestMobilityModels(radius, nbUE, model, speed, duration); } if (strcmp(argv[1], "scalability-test-macro-with-femto")==0) { double radius = atof(argv[2]); int nbBuildings = atoi(argv[3]); int nbUE = atoi(argv[4]); ScalabilityTestMacroWithFemto (radius, nbBuildings, nbUE); } if (strcmp(argv[1], "test-sinr-urban")==0) { int streets = atoi(argv[2]); int henb = atoi(argv[3]); int reuse = atoi(argv[4]); TestSinrUrban (streets, henb, reuse); } if (strcmp(argv[1], "test-throughput-urban")==0) { int streets = atoi(argv[2]); int henb = atoi(argv[3]); int reuse = atoi(argv[4]); int nbUEs = atoi(argv[5]); double activityFactor = atoi(argv[6]); TestThroughputUrban (streets, henb, reuse, nbUEs, activityFactor); } if (strcmp(argv[1], "test-throughput-macro-with-femto")==0) { double radius = atof(argv[2]); int nbBuildings = atoi(argv[3]); int nbUE_macro = atoi(argv[4]); TestThroughputMacroWithFemto (radius, nbBuildings, nbUE_macro); } if (strcmp(argv[1], "test-sinr-femto")==0) { double riuso = atof(argv[2]); double activityFactor = atof(argv[3]); TestSinrFemto (riuso, activityFactor); } if (strcmp(argv[1], "test-throughput-building")==0) { double riuso = atof(argv[2]); double activityFactor = atof(argv[3]); int nbUE_femto = atof(argv[4]); TestThroughputBuilding (riuso, activityFactor, nbUE_femto); } if (strcmp(argv[1], "MultiCellSinrPlot")==0) { int nbCells = atoi(argv[2]); double radius = atof(argv[3]); int nbUE = atoi(argv[4]); int sched_type = atoi(argv[5]); int frame_struct = atoi(argv[6]); int speed = atoi(argv[7]); int model = atoi(argv[8]); int seed; if (argc==14) seed = atoi(argv[13]); else seed = -1; MultiCellSinrPlot (nbCells, radius, nbUE, sched_type, frame_struct, speed, model, seed); } if (strcmp(argv[1], "testfme")==0) { TestUplinkFME (); } } }
HessenbergSchurInfo MultiBulge ( Matrix<F>& H, Matrix<Complex<Base<F>>>& w, Matrix<F>& Z, const HessenbergSchurCtrl& ctrl ) { DEBUG_CSE typedef Base<F> Real; const Real zero(0); const Int n = H.Height(); Int winBeg = ( ctrl.winBeg==END ? n : ctrl.winBeg ); Int winEnd = ( ctrl.winEnd==END ? n : ctrl.winEnd ); const Int winSize = winEnd - winBeg; const Int minMultiBulgeSize = Max( ctrl.minMultiBulgeSize, 4 ); HessenbergSchurInfo info; if( winSize < minMultiBulgeSize ) { return Simple( H, w, Z, ctrl ); } w.Resize( n, 1 ); Matrix<F> U, W, WAccum; auto ctrlShifts( ctrl ); ctrlShifts.winBeg = 0; ctrlShifts.winEnd = END; ctrlShifts.fullTriangle = false; Int numIterSinceDeflation = 0; const Int numStaleIterBeforeExceptional = 5; // Cf. LAPACK's DLAQR0 for this choice const Int maxIter = Max(30,2*numStaleIterBeforeExceptional) * Max(10,winSize); Int iterBegLast=-1, winEndLast=-1; while( winBeg < winEnd ) { if( info.numIterations >= maxIter ) { if( ctrl.demandConverged ) RuntimeError("MultiBulge QR iteration did not converge"); else break; } auto winInd = IR(winBeg,winEnd); // Detect an irreducible Hessenberg window, [iterBeg,winEnd) // --------------------------------------------------------- const Int iterOffset = DetectSmallSubdiagonal( H(winInd,winInd) ); const Int iterBeg = winBeg + iterOffset; const Int iterWinSize = winEnd-iterBeg; if( iterOffset > 0 ) H(iterBeg,iterBeg-1) = zero; if( iterWinSize == 1 ) { w(iterBeg) = H(iterBeg,iterBeg); --winEnd; numIterSinceDeflation = 0; continue; } else if( iterWinSize == 2 ) { multibulge::TwoByTwo( H, w, Z, iterBeg, ctrl ); winEnd -= 2; numIterSinceDeflation = 0; continue; } else if( iterWinSize < minMultiBulgeSize ) { // The window is small enough to switch to the simple scheme auto ctrlSub( ctrl ); ctrlSub.winBeg = iterBeg; ctrlSub.winEnd = winEnd; Simple( H, w, Z, ctrlSub ); winEnd = iterBeg; continue; } const Int numShiftsRec = ctrl.numShifts( n, iterWinSize ); if( ctrl.progress ) { Output("Iter. ",info.numIterations,": "); Output(" window is [",iterBeg,",",winEnd,")"); Output(" recommending ",numShiftsRec," shifts"); } const Int shiftBeg = multibulge::ComputeShifts ( H, w, iterBeg, winBeg, winEnd, numShiftsRec, numIterSinceDeflation, numStaleIterBeforeExceptional, ctrlShifts ); auto shiftInd = IR(shiftBeg,winEnd); auto wShifts = w(shiftInd,ALL); // Perform a small-bulge sweep auto ctrlSweep( ctrl ); ctrlSweep.winBeg = iterBeg; ctrlSweep.winEnd = winEnd; multibulge::Sweep( H, wShifts, Z, U, W, WAccum, ctrlSweep ); ++info.numIterations; if( iterBeg == iterBegLast && winEnd == winEndLast ) ++numIterSinceDeflation; iterBegLast = iterBeg; winEndLast = winEnd; } info.numUnconverged = winEnd-winBeg; return info; }
void DirTest (void) { Simple(); TreeTest(); // SeekTest(); }
Void simplest::Simple::init() { setFirstFreeSimple(Simple()); setNumFreeSimples(0); setUsed(0); reallocInstances(INITIAL_OBJECT_RESERVE); }
void CHelloTraceFn::OutputsParams(TInt aParam, TFnEnum aEnumParam) { OstTraceFunctionEntryExt( CHELLOTRACEFN_OUTPUTSPARAMS_ENTRY, this ); Simple(); OstTraceFunctionExit1( CHELLOTRACEFN_OUTPUTSPARAMS_EXIT, this ); }
RicoPtr RicoMultiply::Simple(RicoPtr x, RicoPtr y) { vRicoPtr v; v.push_back(x); v.push_back(y); return Simple(v); }
Void simplest::Simple::reset() const { setExists(true); setNextSimpleFreeSimple(Simple()); }
void RwTest (void) { Simple(); rdseek(); wtseek(); }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { const char *location1 = "MyLocation 1"; LB_server lb_server (argc, argv); if (lb_server.start_orb_and_poa () == -1) return 1; if (lb_server.create_basic_object_group () == -1) return 1; if (lb_server.create_simple_object_group () == -1) return 1; Basic *basic_servant1; Basic *basic_servant2; Simple *simple_servant1; Simple *simple_servant2; ACE_NEW_RETURN (basic_servant1, Basic (lb_server.get_basic_object_group (), lb_server.load_manager (), lb_server.orb (), 1, location1), 1); PortableServer::ServantBase_var basic_owner_transfer1(basic_servant1); ACE_NEW_RETURN (simple_servant1, Simple (lb_server.get_simple_object_group (), lb_server.load_manager (), lb_server.orb (), 1, location1), 1); PortableServer::ServantBase_var simple_owner_transfer1(simple_servant1); if (lb_server.register_basic_servant (basic_servant1, location1) == -1) { (void) lb_server.destroy(); return 1; } if (lb_server.register_simple_servant (simple_servant1, location1) == -1) { (void) lb_server.destroy(); return 1; } if (lb_server.remove_basic_member() == -1) { return 1; } if (lb_server.remove_simple_member() == -1) { return 1; } ACE_NEW_RETURN (basic_servant2, Basic (lb_server.get_basic_object_group (), lb_server.load_manager (), lb_server.orb (), 2, location1), 1); PortableServer::ServantBase_var basic_owner_transfer2(basic_servant2); ACE_NEW_RETURN (simple_servant2, Simple (lb_server.get_simple_object_group (), lb_server.load_manager (), lb_server.orb (), 2, location1), 1); PortableServer::ServantBase_var simple_owner_transfer2(simple_servant2); if (lb_server.register_basic_servant (basic_servant2, location1) == -1) { (void) lb_server.destroy(); return 1; } if (lb_server.register_simple_servant (simple_servant2, location1) == -1) { (void) lb_server.destroy(); return 1; } if (lb_server.remove_basic_member() == -1) { return 1; } if (lb_server.remove_simple_member() == -1) { return 1; } //lb_server.orb ()->shutdown (0); ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); if (lb_server.destroy () == -1) return 1; } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("lb_server exception"); return 1; } return 0; }
static int EndDTD(void *UserData) { Simple("endDTD"); return 0; }
simplest::Simple simplest::Simple::getFirstFreeSimple() { return Simple(staticData().FirstFreeSimple); }
static int StartCDATA(void *UserData) { Simple("startCDATA"); return 0; }