void pac::calcNoiseSP (nr_double_t) { nr_double_t r = getPropertyDouble ("Z"); nr_double_t T = getPropertyDouble ("Temp"); nr_double_t f = kelvin (T) * 4.0 * r * z0 / sqr (2.0 * z0 + r) / T0; setN (NODE_1, NODE_1, +f); setN (NODE_2, NODE_2, +f); setN (NODE_1, NODE_2, -f); setN (NODE_2, NODE_1, -f); }
void pac::calcNoiseAC (nr_double_t) { nr_double_t r = getPropertyDouble ("Z"); nr_double_t T = getPropertyDouble ("Temp"); nr_double_t f = kelvin (T) / T0 * 4.0 / r; setN (NODE_1, NODE_1, +f); setN (NODE_2, NODE_2, +f); setN (NODE_1, NODE_2, -f); setN (NODE_2, NODE_1, -f); }
void bondwire::calcNoiseSP (nr_double_t) { // calculate noise correlation matrix nr_double_t T = getPropertyDouble ("Temp"); nr_double_t f = kelvin (T) * 4.0 * R * z0 / norm (4.0 * z0 + R) / T0; setN (NODE_1, NODE_1, +f); setN (NODE_2, NODE_2, +f); setN (NODE_1, NODE_2, -f); setN (NODE_2, NODE_1, -f); }
void bondwire::calcNoiseAC (nr_double_t) { // calculate noise current correlation matrix nr_double_t y = 1 / R; nr_double_t T = getPropertyDouble ("Temp"); nr_double_t f = kelvin (T) / T0 * 4.0 * y; setN (NODE_1, NODE_1, +f); setN (NODE_2, NODE_2, +f); setN (NODE_1, NODE_2, -f); setN (NODE_2, NODE_1, -f); }
void resistor::calcNoiseSP (nr_double_t) { // calculate noise correlation matrix nr_double_t r = getScaledProperty ("R"); nr_double_t T = getPropertyDouble ("Temp"); nr_double_t f = kelvin (T) * 4.0 * r * z0 / sqr (2.0 * z0 + r) / T0; setN (NODE_1, NODE_1, +f); setN (NODE_2, NODE_2, +f); setN (NODE_1, NODE_2, -f); setN (NODE_2, NODE_1, -f); }
void inoise::calcNoiseAC (nr_double_t frequency) { nr_double_t i = getPropertyDouble ("i"); nr_double_t e = getPropertyDouble ("e"); nr_double_t c = getPropertyDouble ("c"); nr_double_t a = getPropertyDouble ("a"); nr_double_t ipsd = i / (a + c * pow (frequency, e)) / kB / T0; setN (NODE_1, NODE_1, +ipsd); setN (NODE_2, NODE_2, +ipsd); setN (NODE_1, NODE_2, -ipsd); setN (NODE_2, NODE_1, -ipsd); }
void amplifier::calcNoiseAC (nr_double_t) { nr_double_t g = getPropertyDouble ("G"); nr_double_t z2 = getPropertyDouble ("Z2"); nr_double_t NF = getPropertyDouble ("NF"); setN (NODE_1, NODE_1, 0); setN (NODE_2, NODE_2, 4 * sqr (g) * (NF - 1) / z2); setN (NODE_1, NODE_2, 0); setN (NODE_2, NODE_1, 0); }
void amplifier::calcNoiseSP (nr_double_t) { nr_double_t g = getPropertyDouble ("G"); nr_double_t z2 = getPropertyDouble ("Z2"); nr_double_t NF = getPropertyDouble ("NF"); setN (NODE_1, NODE_1, 0); setN (NODE_2, NODE_2, 4 * z0 * z2 * sqr (g) * (NF - 1) / sqr (z2 + z0)); setN (NODE_1, NODE_2, 0); setN (NODE_2, NODE_1, 0); }
void resistor::calcNoiseAC (nr_double_t) { // calculate noise current correlation matrix nr_double_t r = getScaledProperty ("R"); if (r > 0.0 || r < 0.0) { nr_double_t T = getPropertyDouble ("Temp"); nr_double_t f = kelvin (T) / T0 * 4.0 / r; setN (NODE_1, NODE_1, +f); setN (NODE_2, NODE_2, +f); setN (NODE_1, NODE_2, -f); setN (NODE_2, NODE_1, -f); } }
void isolator::calcNoiseAC (nr_double_t) { nr_double_t T = getPropertyDouble ("Temp"); nr_double_t z1 = getPropertyDouble ("Z1"); nr_double_t z2 = getPropertyDouble ("Z2"); nr_double_t f = 4 * kelvin (T) / T0; setN (NODE_1, NODE_1, +f / z1); setN (NODE_1, NODE_2, 0); setN (NODE_2, NODE_1, -f * 2 / sqrt (z1 * z2)); setN (NODE_2, NODE_2, +f / z2); }
void isolator::calcNoiseSP (nr_double_t) { nr_double_t T = getPropertyDouble ("Temp"); nr_double_t z1 = getPropertyDouble ("Z1"); nr_double_t z2 = getPropertyDouble ("Z2"); nr_double_t r = (z0 - z1) / (z0 + z2); nr_double_t f = 4 * z0 / sqr (z1 + z0) * kelvin (T) / T0; setN (NODE_1, NODE_1, f * z1); setN (NODE_1, NODE_2, f * sqrt (z1 * z2) * r); setN (NODE_2, NODE_1, f * sqrt (z1 * z2) * r); setN (NODE_2, NODE_2, f * z2 * r * r); }
void tline::calcNoiseSP (nr_double_t) { nr_double_t T = getPropertyDouble ("Temp"); nr_double_t l = getPropertyDouble ("L"); nr_double_t z = getPropertyDouble ("Z"); nr_double_t a = getPropertyDouble ("Alpha"); a = log (a) / 2; a = exp (a * l); nr_double_t r = (z - z0) / (z + z0); nr_double_t f = (a - 1) * (r * r - 1) / sqr (a - r * r) * kelvin (T) / T0; nr_double_t n11 = -f * (r * r + a); nr_double_t n21 = +f * 2 * r * sqrt (a); setN (NODE_1, NODE_1, n11); setN (NODE_2, NODE_2, n11); setN (NODE_1, NODE_2, n21); setN (NODE_2, NODE_1, n21); }
void tline::calcNoiseAC (nr_double_t) { nr_double_t T = getPropertyDouble ("Temp"); nr_double_t l = getPropertyDouble ("L"); nr_double_t z = getPropertyDouble ("Z"); nr_double_t a = getPropertyDouble ("Alpha"); a = log (a) / 2; if (a * l != 0.0) { a = exp (a * l); nr_double_t f = 4.0 * kelvin (T) / T0 / z / (a - 1); nr_double_t n11 = +f * (a + 1); nr_double_t n21 = -f * 2 * sqrt (a); setN (NODE_1, NODE_1, n11); setN (NODE_2, NODE_2, n11); setN (NODE_1, NODE_2, n21); setN (NODE_2, NODE_1, n21); } }
// PROTECTED FUNCTIONS: // -------------------- void OCP::setupGrid( double tStart, double tEnd, int N ){ grid.init( tStart, tEnd, N ); objective.init ( grid ); constraint.init( grid ); setN( grid.getNumIntervals() ); }
void Z80gb::setFlags(short z, short n, short h, short c) { if(z >= 0) { if(z) setZF(); else unsetZF(); } if(n >= 0) { if(n) setN(); else unsetN(); } if(h >= 0) { if(h) setH(); else unsetH(); } if(c >= 0) { if(c) setCY(); else unsetCY(); } }
bool RSAPrivateKey::deserialise(ByteString& serialised) { ByteString dP = ByteString::chainDeserialise(serialised); ByteString dQ = ByteString::chainDeserialise(serialised); ByteString dPQ = ByteString::chainDeserialise(serialised); ByteString dDP1 = ByteString::chainDeserialise(serialised); ByteString dDQ1 = ByteString::chainDeserialise(serialised); ByteString dD = ByteString::chainDeserialise(serialised); ByteString dN = ByteString::chainDeserialise(serialised); ByteString dE = ByteString::chainDeserialise(serialised); if ((dD.size() == 0) || (dN.size() == 0) || (dE.size() == 0)) { return false; } setP(dP); setQ(dQ); setPQ(dPQ); setDP1(dDP1); setDQ1(dDQ1); setD(dD); setN(dN); setE(dE); return true; }
void OCP::setupGrid( const Vector& times ){ grid.init( times ); objective.init ( grid ); constraint.init( grid ); setN( grid.getNumIntervals() ); }
void Rule::setDimensions(N dim) { if (dim.z == 1) _nSize = 8; else _nSize = 26; setN(); }
OCP::OCP( const Grid &grid_ ) :MultiObjectiveFunctionality(){ if( grid_.getNumPoints() <= 1 ) ACADOERROR( RET_INVALID_ARGUMENTS ); grid = grid_; objective.init ( grid ); constraint.init( grid ); setN( grid.getNumIntervals() ); }
void GKeyPair::generateKeyPair(unsigned int uintCount, const unsigned int* pRawCryptographicBytes1, const unsigned int* pRawCryptographicBytes2, const unsigned int* pRawCryptographicBytes3) { // Make places to put the data GBigInt* pOutPublicKey = new GBigInt(); GBigInt* pOutPrivateKey = new GBigInt(); GBigInt* pOutN = new GBigInt(); // Find two primes GBigInt p; GBigInt q; int n; for(n = (int)uintCount - 1; n >= 0; n--) p.setUInt(n, pRawCryptographicBytes1[n]); for(n = uintCount - 1; n >= 0; n--) q.setUInt(n, pRawCryptographicBytes2[n]); p.setBit(0, true); q.setBit(0, true); int nTries = 0; while(!p.isPrime()) { p.increment(); p.increment(); nTries++; } nTries = 0; while(!q.isPrime()) { q.increment(); q.increment(); nTries++; } // Calculate N (the product of the two primes) pOutN->multiply(&p, &q); // Calculate prod ((p - 1) * (q - 1)) p.decrement(); q.decrement(); GBigInt prod; prod.multiply(&p, &q); // Calculate public and private keys pOutPublicKey->selectPublicKey(pRawCryptographicBytes3, uintCount, &prod); pOutPrivateKey->calculatePrivateKey(pOutPublicKey, &prod); // Fill in "this" GKeyPair object setPublicKey(pOutPublicKey); setPrivateKey(pOutPrivateKey); setN(pOutN); }
// Set from OpenSSL representation void OSSLRSAPrivateKey::setFromOSSL(const RSA* inRSA) { if (inRSA->p) { ByteString inP = OSSL::bn2ByteString(inRSA->p); setP(inP); } if (inRSA->q) { ByteString inQ = OSSL::bn2ByteString(inRSA->q); setQ(inQ); } if (inRSA->dmp1) { ByteString inDP1 = OSSL::bn2ByteString(inRSA->dmp1); setDP1(inDP1); } if (inRSA->dmq1) { ByteString inDQ1 = OSSL::bn2ByteString(inRSA->dmq1); setDQ1(inDQ1); } if (inRSA->iqmp) { ByteString inPQ = OSSL::bn2ByteString(inRSA->iqmp); setPQ(inPQ); } if (inRSA->d) { ByteString inD = OSSL::bn2ByteString(inRSA->d); setD(inD); } if (inRSA->n) { ByteString inN = OSSL::bn2ByteString(inRSA->n); setN(inN); } if (inRSA->e) { ByteString inE = OSSL::bn2ByteString(inRSA->e); setE(inE); } }
// Set from Botan representation void BotanRSAPrivateKey::setFromBotan(const Botan::RSA_PrivateKey* rsa) { ByteString p = BotanUtil::bigInt2ByteString(rsa->get_p()); setP(p); ByteString q = BotanUtil::bigInt2ByteString(rsa->get_q()); setQ(q); ByteString dp1 = BotanUtil::bigInt2ByteString(rsa->get_d1()); setDP1(dp1); ByteString dq1 = BotanUtil::bigInt2ByteString(rsa->get_d2()); setDQ1(dq1); ByteString pq = BotanUtil::bigInt2ByteString(rsa->get_c()); setPQ(pq); ByteString d = BotanUtil::bigInt2ByteString(rsa->get_d()); setD(d); ByteString n = BotanUtil::bigInt2ByteString(rsa->get_n()); setN(n); ByteString e = BotanUtil::bigInt2ByteString(rsa->get_e()); setE(e); }
// Set from Botan representation void BotanRSAPrivateKey::setFromBotan(const Botan::RSA_PrivateKey* inRSA) { ByteString inP = BotanUtil::bigInt2ByteString(inRSA->get_p()); setP(inP); ByteString inQ = BotanUtil::bigInt2ByteString(inRSA->get_q()); setQ(inQ); ByteString inDP1 = BotanUtil::bigInt2ByteString(inRSA->get_d1()); setDP1(inDP1); ByteString inDQ1 = BotanUtil::bigInt2ByteString(inRSA->get_d2()); setDQ1(inDQ1); ByteString inPQ = BotanUtil::bigInt2ByteString(inRSA->get_c()); setPQ(inPQ); ByteString inD = BotanUtil::bigInt2ByteString(inRSA->get_d()); setD(inD); ByteString inN = BotanUtil::bigInt2ByteString(inRSA->get_n()); setN(inN); ByteString inE = BotanUtil::bigInt2ByteString(inRSA->get_e()); setE(inE); }
BEGIN_NAMESPACE_ACADO // // PUBLIC MEMBER FUNCTIONS: // SIMexport::SIMexport( const uint simIntervals, const double totalTime ) : ExportModule( ) { setN(simIntervals); T = totalTime; integrator = 0; timingSteps = 100; _initStates = String( "initStates.txt" ); _controls = String( "controls.txt" ); _results = String( "results.txt" ); _ref = String( "ref.txt" ); referenceProvided = BT_FALSE; PRINT_DETAILS = BT_TRUE; setStatus( BS_NOT_INITIALIZED ); }
void solveMaze() { //Reset maze to 0 initializeMaze(&maze); //We Know at the starting point, there's something behind us setN(&maze[0][0], 1); mouse.direction.x = 0; mouse.direction.y = -1; mouse.x = 0; mouse.y = 0; //Disable the mouse for now enableDrive(0); turnOnTimers(0, 0); int areWeSearching = UserInterfaceIntro(); //Does the user want to skip the search phase and load a maze from EEPROM if(areWeSearching) { /* SEARCH MAZE */ for(int i = 0; i < 10; i++) { turnOnLeds(7); _delay_ms(10); turnOnLeds(0); _delay_ms(90); } //Init Mouse enableDrive(1); turnOnTimers(1, 1); setDirection(0, 0); //Update Sensors updateSensors(); updateSensors(); updateWalls(); //Go Forward first block mouse.IR_LONG_CHECK_LEFT = 2; mouse.IR_LONG_CHECK_RIGHT = 2; straight(480, 0, mouse.maxVelocity, mouse.maxVelocity, mouse.acceleration, mouse.deceleration); mouse.x += mouse.direction.x; mouse.y -= mouse.direction.y; /* SEARCH */ InitialSearchRun(); //Search is Complete! updateWalls(); /* TURN AROUND */ mouse.rightMotor.stepCount = mouse.leftMotor.stepCount = 0; StopFromSpeedHalf(); mouse.rightMotor.stepCount = mouse.leftMotor.stepCount = 0; moveBackwards(); //Save Maze to EEPROM saveCurrentMaze(); writeMemByte(MOUSE_DIRECTION, firstTurn); mouse.rightMotor.stepCount = mouse.leftMotor.stepCount = 0; moveForwardHalf(); //Current Mouse Direction int dirx = mouse.direction.x; int diry = mouse.direction.y; //Reverse and go back mouse.direction.x = -dirx; mouse.direction.y = -diry; //Set Position to next block mouse.x += mouse.direction.x; mouse.y -= mouse.direction.y; /* RETURN SEARCH*/ ReturnSearchRun(); //Turn Around mouse.rightMotor.stepCount = mouse.leftMotor.stepCount = 0; StopFromSpeedHalf(); mouse.rightMotor.stepCount = mouse.leftMotor.stepCount = 0; moveBackwards(); //Save Maze to EEPROM saveCurrentMaze(); writeMemByte(MOUSE_DIRECTION, firstTurn); /* PICK UP AND PLACE MOUSE */ enableDrive(0); waitForButtonPressed(); } /* FAST RUN */ FastRun(); //Completed Search run, go back and search some more turnAroundInPlace(); floodFill(maze, firstTurn, mouse.x, mouse.y); /* RETURN */ ReturnSearchRun(); //Turn Around mouse.rightMotor.stepCount = mouse.leftMotor.stepCount = 0; StopFromSpeedHalf(); mouse.rightMotor.stepCount = mouse.leftMotor.stepCount = 0; moveBackwards(); //Save Maze to EEPROM saveCurrentMaze(); writeMemByte(MOUSE_DIRECTION, firstTurn); stopMouse(); while(!isButtonPushed(1)); printMaze(maze); }
Polinom:: Polinom(int n) : arr(NULL) { setN(n+1); arr = new int[this->n]; }
Polinom:: Polinom() : arr(NULL) { arr = new int[1]; setN(1); arr[0] = -2; }
void Polinom:: setPolinom(const int* arr, int n) { setN(n); setArr(arr); }
// Set from OpenSSL representation void OSSLRSAPublicKey::setFromOSSL(const RSA* rsa) { if (rsa->n) { ByteString n = OSSL::bn2ByteString(rsa->n); setN(n); } if (rsa->e) { ByteString e = OSSL::bn2ByteString(rsa->e); setE(e); } }