int main() { int i; for (i = 0; i < 256; i++) chartest[i].c = i; chartest[0].c = 0; /* chartest-done */ Fun1(foo1); Fun2(foo2); Fun3(foo3); Fun4(foo4); Fun5(foo5); Fun6(foo6); Fun7(foo7); Fun8(foo8); Fun9(foo9); Fun10(foo10); Fun11(foo11); Fun12(foo12); Fun13(foo13); Fun14(foo14); Fun15(foo15); Fun16(foo16); Fun17(foo17); Fun18(foo18); /* An (almost-)infinite loop that first clears all the variables and then calls each function. This "hack" is to make testing random functions easier - "advance funN" is guaranteed to have always been preceded by a global variable clearing zed call. We don't let this run forever in case gdb crashes while testing, we don't want to be left eating all cpu on the user's system. */ for (i = 0; i < 1000000; ++i) { zed (); L1 = fun1(); L2 = fun2(); L3 = fun3(); L4 = fun4(); L5 = fun5(); L6 = fun6(); L7 = fun7(); L8 = fun8(); L9 = fun9(); L10 = fun10(); L11 = fun11(); L12 = fun12(); L13 = fun13(); L14 = fun14(); L15 = fun15(); L16 = fun16(); L17 = fun17(); L18 = fun18(); } return 0; }
int main() { int i; Fun(foo); /* An infinite loop that first clears all the variables and then calls the function. This "hack" is to make re-testing easier - "advance fun" is guaranteed to have always been preceded by a global variable clearing zed call. */ zed (); while (1) { L = fun (); zed (); } return 0; }
void foobar() { // CHECK: call nonnull %struct._ZN6PR66481DE* @_ZN6PR66483zedENS_1BE zed(foo); }
void foobar() { // CHECK: call %"struct.PR6648::D"* @_ZN6PR66483zedENS_1BE zed(foo); }
void *h() { return zed(); }
SwaptionPseudoDerivative::SwaptionPseudoDerivative(boost::shared_ptr<MarketModel> inputModel, Size startIndex, Size endIndex) { std::vector<Real> subRateTimes(inputModel->evolution().rateTimes().begin()+startIndex, inputModel->evolution().rateTimes().begin()+endIndex+1); std::vector<Real> subForwards(inputModel->initialRates().begin()+startIndex,inputModel->initialRates().begin()+endIndex); LMMCurveState cs(subRateTimes); cs.setOnForwardRates(subForwards); Matrix zed(SwapForwardMappings::coterminalSwapZedMatrix(cs,inputModel->displacements()[0])); Size factors = inputModel->numberOfFactors(); //first compute variance and implied vol variance_=0.0; Size index=0; while (index < inputModel->evolution().numberOfSteps() && inputModel->evolution().firstAliveRate()[index] <= startIndex) { const Matrix& thisPseudo = inputModel->pseudoRoot(index); Real thisVariance_ =0.0; for (Size j=startIndex; j < endIndex; ++j) for (Size k=startIndex; k < endIndex; ++k) for (Size f=0; f < factors; ++f) thisVariance_+= zed[0][j-startIndex]*thisPseudo[j][f]*thisPseudo[k][f]*zed[0][k-startIndex]; variance_ += thisVariance_; ++index; } Size stopIndex = index; expiry_ = subRateTimes[0]; impliedVolatility_ = std::sqrt(variance_/expiry_); Real scale = 0.5*(1.0/expiry_)/impliedVolatility_; Size numberRates = inputModel->evolution().numberOfRates(); Matrix thisDerivative(numberRates, factors,0.0); Matrix nullDerivative(numberRates, factors,0.0); index =0; while (index < stopIndex) { const Matrix& thisPseudo = inputModel->pseudoRoot(index); for (Size rate=startIndex; rate<endIndex; ++rate) { Size zIndex = rate -startIndex; for (Size f =0; f < factors; ++f) { Real sum=0.0; for (Size rate2 = startIndex; rate2<endIndex; ++rate2) { Size zIndex2 = rate2-startIndex; sum += zed[0][zIndex2] * thisPseudo[rate2][f]; } sum *= 2.0*zed[0][zIndex]; thisDerivative[rate][f] =sum; } } varianceDerivatives_.push_back(thisDerivative); for ( Size rate=startIndex; rate<endIndex; ++rate) for (Size f =0; f < factors; ++f) thisDerivative[rate][f] *= scale; volatilityDerivatives_.push_back(thisDerivative); ++index; } for (; index < inputModel->evolution().numberOfSteps(); ++index) { varianceDerivatives_.push_back(nullDerivative); volatilityDerivatives_.push_back(nullDerivative); } }
void User::updatePosition(double &x, double &y, double &z) { //Update the position _position.x = x; _position.y = y; _position.z = z; //Get the projection center and surfaces cv::Point3f projectionCenter = _projection.getCenter(); std::vector<Plane3d> planes = _projection.getPlanes(); GeometryUtils gUtils; //Compute the projection plane normal cv::Point3f normal = gUtils.normalizeVector(_position - projectionCenter); //This vector will store the projection of the projected surfaces //onto the plane orthogonal to the user's point of view std::vector<Plane3d> projectedPlanes; //The plane orthogonal to the user's point of view UserPlane userPlane(projectionCenter, normal); //Iterate over projected surfaces //to find the corresponding intersections std::vector<Plane3d>::iterator ii; for (ii = planes.begin(); ii != planes.end(); ii++) { //Get the points of the current surface std::vector<cv::Point3f> points = (*ii).getPoints(); //Find the intersections std::vector<cv::Point3f> intersections = this->findIntersections(points, userPlane); //Create a plane out of the intersections and add it to the list Plane3d projectedPlane(intersections); projectedPlanes.push_back(projectedPlane); } //************************************************************************ //Rotate the obtained intersections to align them to the orthogonal plane //************************************************************************ //Normalize the plane normal (equivalent to the user's position from //the projection center) cv::Vec3f normalized = gUtils.normalizeVector(normal); //Get the rotation axis cv::Vec3f zed(0, 0, -1); cv::Vec3f axis = gUtils.crossProduct(normalized, zed); cv::Point3f normalAxis = gUtils.normalizeVector(axis); double angle = std::acos(normalized[0] * zed[0] + normalized[1] * zed[1] + normalized[2] * zed[2]); //Rotate all intersections to align them with the plane for (ii = projectedPlanes.begin(); ii != projectedPlanes.end(); ii++) { //Get the points of the current surface std::vector<cv::Point3f> points = (*ii).getPoints(); std::vector<cv::Point3f>::iterator jj; std::vector<cv::Point3f> rotatedPoints; for (jj = points.begin(); jj != points.end(); jj++) { cv::Point3f p = *jj; p = p - projectionCenter; cv::Point3f rotated = gUtils.rotateAroundAxis(p, normalAxis, -angle); rotatedPoints.push_back(rotated); } Plane3d plane(rotatedPoints); _projectedPlanes.push_back(plane); } }
void baz() { SMLoc a; zed(a); }