您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ y0函数代码示例

51自学网 2021-06-03 11:53:57
  C++
这篇教程C++ y0函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中y0函数的典型用法代码示例。如果您正苦于以下问题:C++ y0函数的具体用法?C++ y0怎么用?C++ y0使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了y0函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test3

void test3() {#ifdef MAKE_TEST3    std::cout << "Multidimensional test:" << std::endl;        // Construct data for the IVP    double T = 1;    // Many dimensions    int n = 5;        // Multidimensional rhs    Eigen::VectorXd y0(2*n);    for(int i = 0; i < n; ++i) {        y0(i)=(i+1.)/n;        y0(i+n)=-1;    }        // Multidimensional rhs    auto f = [n] (Eigen::VectorXd y) {        Eigen::VectorXd fy(2*n);                Eigen::VectorXd g(n);        g(0) = y(0)*(y(1)+y(0));        g(n-1) = y(n-1)*(y(n-1)+y(n-2));        for(int i = 1; i < n-1; ++i) {            g(i) = y(i)*(y(i-1)+y(i+1));        }                Eigen::SparseMatrix<double> C(n,n);        C.reserve(3);        for(int i = 0; i < n; ++i) {            C.insert(i,i) = 2;            if(i < n-1) C.insert(i,i+1) = -1;            if(i >= 1)  C.insert(i,i-1) = -1;        }        C.makeCompressed();        fy.head(n) = y.head(n);                Eigen::SparseLU< Eigen::SparseMatrix<double> >  solver;        solver.analyzePattern(C);        solver.compute(C);        fy.tail(n) = solver.solve(g);        return fy;    };        // Constructor:    ode45<Eigen::VectorXd> O(f);        // Setup options    O.options.do_statistics = true;        // Solve    auto sol = O.solve(y0, T);        // Print info    O.print();    std::cout << "T = " << sol.back().second << std::endl;    std::cout << "y(T) = " << std::endl << sol.back().first << std::endl;#endif}
开发者ID:bimmlerd,项目名称:nme,代码行数:60,


示例2: yn

doubleyn (int n, double x) {  int i, sign;  double a, b, tmp;    if (x <= 0)    return (dzero/dzero);	/* IEEE machines: invalid operation */  sign = 1;  if (n < 0)    {      n = -n;      if (n%2 == 1) 	sign = -1;    }  if (n == 0)     return y0(x);  if (n == 1)     return sign*y1(x);  a = y0(x);  b = y1(x);  for (i = 1; i<n; i++)    {      tmp = b;      b = (2.0*i / x) * b - a;      a = tmp;    }  return sign*b;}
开发者ID:fedser,项目名称:Plotutils,代码行数:31,


示例3: g

    KUKADU_SHARED_PTR<Dmp> GeneralDmpLearner::fitTrajectories() {        int dataPointsNum = joints.n_rows;        vec g(degFreedom);        vec y0(degFreedom);        vec dy0(degFreedom);        vec ddy0(degFreedom);        vector<vec> dmpCoeffs;        vector<vec> sampleYs;        vector<vec> fitYs;        vector<mat> designMatrices;        vec timeVec = joints.col(0);        mat all_y;        mat all_dy;        mat all_ddy;        // retrieve all columns for different degrees of freedom        vector<vec> trajectories;        for(int i = 1; i <= degFreedom; ++i) {            vec trajectory = joints.col(i);            trajectories.push_back(trajectory);            vec vec_dy = computeDiscreteDerivatives(timeVec, trajectory);            vec vec_ddy = computeDiscreteDerivatives(timeVec, vec_dy);            all_y = join_rows(all_y, trajectory);            all_dy = join_rows(all_dy, vec_dy);            all_ddy = join_rows(all_ddy, vec_ddy);        }        vector<trajectory_learner_internal> dmpResAll = fitTrajectory(timeVec, all_y, all_dy, all_ddy);        for(int i = 0; i < dmpResAll.size(); ++i) {            trajectory_learner_internal dmpRes = dmpResAll.at(i);            vec dmpCoeff = dmpRes.coeff;            vec fity = dmpRes.fity;            g(i) = (all_y.col(i))(dataPointsNum - 1);            y0(i) = all_y.col(i)(0);            dy0(i) = all_dy.col(i)(0);            ddy0(i) = all_ddy.col(i)(0);            dmpCoeffs.push_back(dmpCoeff);            fitYs.push_back(fity);            designMatrices.push_back(dmpRes.desMat);        }        for (int i = 0; i < all_y.n_cols; ++i) sampleYs.push_back(all_y.col(i));        return createDmpInstance(timeVec, sampleYs, fitYs, dmpCoeffs, dmpBase, designMatrices, tau, az, bz, ax);    }
开发者ID:ipa-nhg,项目名称:kukadu,代码行数:59,


示例4: yn

doubleyn(int n, double x){	int i, sign;	double a, b, temp;    /* Y(n,NaN), Y(n, x < 0) is NaN */	if (x <= 0 || isnan(x))		if (_IEEE && x < 0) return zero/zero;		else if (x < 0)     return (infnan(EDOM));		else if (_IEEE)     return -one/zero;		else		    return(infnan(-ERANGE));	else if (!finite(x)) return(0);	sign = 1;	if (n<0){		n = -n;		sign = 1 - ((n&1)<<2);	}	if (n == 0) return(y0(x));	if (n == 1) return(sign*y1(x));	if(_IEEE && x >= 8.148143905337944345e+090) { /* x > 2**302 */    /* (x >> n**2)     *	    Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)     *	    Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)     *	    Let s=sin(x), c=cos(x),     *		xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then     *     *		   n	sin(xn)*sqt2	cos(xn)*sqt2     *		----------------------------------     *		   0	 s-c		 c+s     *		   1	-s-c 		-c+s     *		   2	-s+c		-c-s     *		   3	 s+c		 c-s     */		switch (n&3) {		    case 0: temp =  sin(x)-cos(x); break;		    case 1: temp = -sin(x)-cos(x); break;		    case 2: temp = -sin(x)+cos(x); break;		    case 3: temp =  sin(x)+cos(x); break;		}		b = invsqrtpi*temp/sqrt(x);	} else {	    a = y0(x);	    b = y1(x);	/* quit if b is -inf */	    for (i = 1; i < n && !finite(b); i++){		temp = b;		b = ((double)(i+i)/x)*b - a;		a = temp;	    }	}	if (!_IEEE && !finite(b))		return (infnan(-sign * ERANGE));	return ((sign > 0) ? b : -b);}
开发者ID:mikekmv,项目名称:aeriebsd-src,代码行数:55,


示例5: pow

void OpenSMOKE_SolidRegression::ModelOdeRegression(int model, int ex, BzzVector &b, BzzVector &x, BzzVector &y){	int i;	for(i=1;i<=nCases;i++)		if(ex == indices[i])		{			cout << "Initialize " << i << "(" << ex << ")" << endl;			kOde[1] = b[1];			kOde[2] = b[2]/experiments[i].temperature;			kOde[3] = pow(experiments[i].pressureO2, b[3]);			o.Deinitialize();			BzzVector y0(1, initialconditions_y[i]);			o.SetInitialConditions(y0, initialconditions_x[i], BzzOdeModel_01);			o.SetMinimumConstraints(&yMin);			//break;		}	for(i=1;i<=nCases;i++)		if(ex == indices[i])		{			cout << "Calculating " << i << "(" << ex << ")" << endl;			for(int j=1;j<=experiments[i].nPoints;j++)			{				cout << indices[i]+j-1 << "/t" << experiments[i].x[j] << endl;				yy = o(experiments[i].x[j]);				YY.SetRow(indices[i]+j-1,yy); 			}			break;		}		YY.GetRow(ex, &y);}
开发者ID:acuoci,项目名称:OpenSMOKE,代码行数:34,


示例6: main

int main() {    double x = 1.0;    double y = 1.0;    int i = 1;    acosh(x);    asinh(x);    atanh(x);    cbrt(x);    expm1(x);    erf(x);    erfc(x);    isnan(x);    j0(x);    j1(x);    jn(i,x);    ilogb(x);    logb(x);    log1p(x);    rint(x);    y0(x);    y1(x);    yn(i,x);#   ifdef _THREAD_SAFE    gamma_r(x,&i);    lgamma_r(x,&i);#   else    gamma(x);    lgamma(x);#   endif    hypot(x,y);    nextafter(x,y);    remainder(x,y);    scalb(x,y);    return 0;}
开发者ID:DanielMiklody,项目名称:openmeeg,代码行数:35,


示例7: function

/** * returns the spherical Bessel function of the second kind * needed for continuum states /param l = order of the function (orbital angular momentum) /param rho = independent variable (rho = k * r) */double sphericalB::y(int l, double rho){  switch (l)    {    case 0:      return y0(rho);    case 1:      return y1(rho);    case 2:       return y2(rho);    case 3:       return y3(rho);    case 4:      return y4(rho);    case 5:      return y5(rho);    case 6:      return y6(rho);    case 7:      return y7(rho);    default:      cout << "no l>6 programed in sphericalB" << endl;      return 0.;    }}
开发者ID:BAS215,项目名称:dom_clean,代码行数:31,


示例8: print

void MyWidget::process(){    ui->plainTextEdit->clear();    variant = ui->comboBox->currentIndex();    print(QString("Variant %1").arg(variant));    print(QString("[%1; %2]").arg(x0(), 0, 'g', 5).arg(xFinish(), 0, 'g', 3));    //calc    qreal x = x0(), y = y0(), z = z0();    for (int i = 1; x < xFinish() || qFuzzyCompare(x, xFinish()); ++i)    {        qreal k1 = h() * f(x, y, z);        qreal q1 = h() * g(x, y, z);        qreal k2 = h() * f(x + h() / 2.0, y + k1 / 2.0, z + q1 / 2.0);        qreal q2 = h() * g(x + h() / 2.0, y + k1 / 2.0, z + q1 / 2.0);        qreal k3 = h() * f(x + h() / 2.0, y + k2 / 2.0, z + q2 / 2.0);        qreal q3 = h() * g(x + h() / 2.0, y + k2 / 2.0, z + q2 / 2.0);        qreal k4 = h() * f(x + h(), y + k3, z + q3);        qreal q4 = h() * g(x + h(), y + k3, z + q3);        print(QString("#%1").arg(i));        print(QString("y(%1) = %2").arg(x, 0, 'g', 5).arg(y, 0, 'g', 5));        print(QString("y_ex(%1) = %2").arg(x, 0, 'g',5).arg(yt(x), 0, 'g', 5));        print(QString("error(%1) = %2").arg(x, 0, 'g',5).arg(ypo(y, x), 0, 'g', 5));        x += h();        y += (k1 + 2.0 * k2 + 2.0 * k3 + k4) / 6.0;        z += (q1 + 2.0 * q2 + 2.0 * q3 + q4) / 6.0;    }}
开发者ID:gehirn,项目名称:lab3,代码行数:35,


示例9: y0

void cofdm_map::set_data(ivec x){cvec qv;bvec ce;int K = x.length();int i;	ce.set_length(K); ce.ones();	#if (DEBUG_LEVEL == 3)	cout << "***** cofdm_map::set_data *****" << endl;		cout << "K=" << K << endl;	cout << "ce=" << ce << endl;	cout << "x=" << x << endl;	cout << "data_carriers=" << data_carriers << endl;	#endif	if( K == data_carriers.length() ) {		qv = qammod.process(ce,x);		#if (DEBUG_LEVEL == 3)		cout << "qv=" << qv << endl;		#endif		for (i=0; i<K; i++) {			y0(data_carriers(i))=qv(i);		}	}	else {		throw sci_exception("cofdm_map::set_data - x.size() <> data_carriers.size()=", data_carriers.length());	}	#if (DEBUG_LEVEL == 3)	cout << "y0(piltos)  y0(zeros) migh have rubbish" << endl;	cout << "y0=" << y0 << endl;	cout << "+++++ cofdm_map::set_data +++++" << endl;		#endif}
开发者ID:maki63,项目名称:c_sci,代码行数:35,


示例10: TEST

TEST(generateExpression, integrate_ode) {  static const bool user_facing = true;  std::stringstream msgs;  stan::lang::integrate_ode so; // null ctor should work and not raise error  std::string integration_function_name = "bar";  std::string system_function_name = "foo";  stan::lang::variable y0("y0_var_name");  y0.set_type(stan::lang::bare_array_type(stan::lang::double_type()));  stan::lang::variable t0("t0_var_name");  t0.set_type(stan::lang::double_type());  stan::lang::variable ts("ts_var_name");  ts.set_type(stan::lang::bare_array_type(stan::lang::double_type()));  stan::lang::variable theta("theta_var_name");  theta.set_type(stan::lang::bare_array_type(stan::lang::double_type()));  stan::lang::variable x("x_var_name");  x.set_type(stan::lang::bare_array_type(stan::lang::double_type()));  stan::lang::variable x_int("x_int_var_name");  x.set_type(stan::lang::bare_array_type(stan::lang::int_type()));  stan::lang::integrate_ode so2(integration_function_name, system_function_name,                    y0, t0, ts, theta, x, x_int);  stan::lang::expression e1(so2);  generate_expression(e1, user_facing, msgs);  EXPECT_EQ(msgs.str(),            "bar(foo_functor__(), y0_var_name, t0_var_name, ts_var_name, "            "theta_var_name, x_var_name, x_int_var_name, pstream__)");}
开发者ID:stan-dev,项目名称:stan,代码行数:30,


示例11: usageExample

//..// Our verification program simply instantiate several 'MyGenericContainer'// templates with the two test types above, and checks that the allocator// slot is as expected://..    int usageExample()    {        bslma::TestAllocator ta0;        bslma::TestAllocator ta1;//..// With 'MyTestTypeWithNoBslmaAllocatorTraits', the slot should never be set.//..        MyTestTypeWithNoBslmaAllocatorTraits x;        allocSlot = &ta0;        MyGenericContainer<MyTestTypeWithNoBslmaAllocatorTraits> x0(x);        ASSERT(&ta0 == allocSlot);        allocSlot = &ta0;        MyGenericContainer<MyTestTypeWithNoBslmaAllocatorTraits> x1(x, &ta1);        ASSERT(&ta0 == allocSlot);//..// With 'MyTestTypeWithBslmaAllocatorTraits', the slot should be set to the// allocator argument, or to 0 if not specified://..        MyTestTypeWithBslmaAllocatorTraits y;        allocSlot = &ta0;        MyGenericContainer<MyTestTypeWithBslmaAllocatorTraits> y0(y);        ASSERT(0 == allocSlot);        allocSlot = &ta0;        MyGenericContainer<MyTestTypeWithBslmaAllocatorTraits> y1(y, &ta1);        ASSERT(&ta1 == allocSlot);        return 0;    }
开发者ID:StefPac,项目名称:bde,代码行数:37,


示例12: x0

void MainWindow::plot2(QCustomPlot *customPlot){  QVector<double> x0(pts), y0(pts);  update_w(w,1.0);  double y_inc = 1.0;   for (int i=0; i<pts; ++i)   {    x0[i] = (double)0.5*i/pts;    y0[i] = y_inc*(w[i]);  }  order = get_order();  ui->order->setText(QApplication::translate("MainWindow", std::to_string(order).c_str(), 0));  ui->ripple->setText(QApplication::translate("MainWindow", std::to_string(ripple()).c_str(), 0));  ui->fc->setText(QApplication::translate("MainWindow", std::to_string(fc()).c_str(), 0));    customPlot->graph()->setData(x0, y0);  customPlot->graph()->setLineStyle(QCPGraph::lsLine); //(QCPGraph::LineStyle)(rand()%5+1));  customPlot->graph()->setScatterStyle(QCPScatterStyle::ssNone); // (QCP::ScatterStyle)(rand()%9+1));  QPen graphPen;  //  graphPen.setColor(QColor(rand()%245+10, rand()%245+10, rand()%245+10));  //graphPen.setWidthF(rand()/(double)RAND_MAX*2+1);  graph_counter++;  graph_counter = graph_counter%9;  graphPen.setColor(QColor(Qt::GlobalColor(5+graph_counter)));  graphPen.setWidthF(2);  customPlot->graph()->setPen(graphPen);  customPlot->xAxis->setRange(0,0.5);  customPlot->yAxis->setRange(-90,10);  customPlot->legend->setVisible(true);  //  customPlot->setInteraction(QCustomPlot::iSelectPlottables);  customPlot->graph()->setName(QString(shape.c_str()));  customPlot->replot();}
开发者ID:GeneKong,项目名称:spuce,代码行数:34,


示例13: x0

void MainWindow::plot3(QCustomPlot *customPlot){  QVector<double> x0(pts), y0(pts);  update_w(w,1.0);  double y_inc = 1.0;   for (int i=0; i<pts; ++i)   {    x0[i] = (double)0.5*i/pts;    y0[i] = y_inc*(w[i]);  }  customPlot->graph()->setData(x0, y0);  customPlot->graph()->setLineStyle(QCPGraph::lsLine);   customPlot->graph()->setScatterStyle(QCPScatterStyle::ssNone); // (QCP::ScatterStyle)(rand()%9+1));  QPen graphPen;  graphPen.setColor(QColor(Qt::GlobalColor(5+graph_counter)));  graphPen.setWidthF(2);  customPlot->graph()->setPen(graphPen);  customPlot->xAxis->setRange(0,0.5);  customPlot->yAxis->setRange(-90,10);  customPlot->legend->setVisible(true);  //  customPlot->setInteraction(QCustomPlot::iSelectPlottables);  customPlot->graph()->setName(QString(shape.c_str()));  customPlot->replot();}
开发者ID:audiofilter,项目名称:spuc_filter,代码行数:25,


示例14: WarningIn

void Foam::equationReader::evalDimsY0DimCheck(    const equationReader * eqnReader,    const label index,    const label i,    const label storageOffset,    label& storeIndex,    dimensionSet& xDims,    dimensionSet sourceDims) const{    if    (        !xDims.dimensionless() && dimensionSet::debug    )    {        WarningIn("equationReader::evalDimsY0DimCheck")            << "Dimension error thrown for operation ["            << equationOperation::opName            (                operator[](index)[i].operation()            )            << "] in equation " << operator[](index).name()            << ", given by:" << token::NL << token::TAB            << operator[](index).rawText();    }    dimensionedScalar ds("temp", xDims, 1.0);    xDims.reset(y0(ds).dimensions());    operator[](index)[i].assignOpDimsFunction    (        &Foam::equationReader::evalDimsY0    );}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Breeder1.6-libraries-equationReaderExtension,代码行数:33,


示例15: main

int main() {    // Dimension of state space    unsigned int d = 2;        // Final time for model    double T = 10.;        // Initial value for model    Eigen::VectorXd y0(d);    y0 << 100, 5;        // Array of number of steps (for convergence study)    std::vector<unsigned int> N = {128, 256, 512, 1024, 2048, 4096, 8192, 16384};        // Exact value y(10) at final time T = 10 (approximated)    Eigen::VectorXd yex(d);    yex << 0.319465882659820, 9.730809352326228;        // Coefficients and handle for prey/predator model    double alpha1 = 3.;    double alpha2 = 2.;    double beta1 = 0.1;    double beta2 = 0.1;    // TODO: implement functor f for rhs of y(t)' = f(y(t))        // Constructor    TaylorIntegrator<Eigen::VectorXd> tint;        // Start convergence study    std::cout  << std::setw(15) << "N"  << std::setw(15) << "error" << std::setw(15) << "rate" << std::endl;    // TODO: tabulate error for each N}
开发者ID:bimmlerd,项目名称:nme,代码行数:33,


示例16: GECODE_ES_CHECK

 ExecStatus MultPlusDom<VA,VB,VC>::propagate(Space& home, const ModEventDelta& med) {   if (VA::me(med) != ME_INT_DOM) {     GECODE_ES_CHECK((prop_mult_plus_bnd<VA,VB,VC>(home,*this,x0,x1,x2)));     return home.ES_FIX_PARTIAL(*this,VA::med(ME_INT_DOM));   }   IntView y0(x0.varimp()), y1(x1.varimp()), y2(x2.varimp());   return prop_mult_dom<IntView>(home,*this,y0,y1,y2); }
开发者ID:Wushaowei001,项目名称:gecode-clone,代码行数:9,


示例17: if

Type Foam::interpolation2DTable<Type>::operator()(    const scalar valueX,    const scalar valueY) const{    // Considers all of the list in Y being equal    label nX = this->size();    const table& t = *this;    if (nX == 0)    {        WarningIn        (            "Type Foam::interpolation2DTable<Type>::operator()"            "("                "const scalar, "                "const scalar"            ") const"        )            << "cannot interpolate a zero-sized table - returning zero" << endl;        return pTraits<Type>::zero;    }    else if (nX == 1)    {        // only 1 column (in X) - interpolate to find Y value        return interpolateValue(t.first().second(), valueY);    }    else    {        // have 2-D data, interpolate        // find low and high indices in the X range that bound valueX        label x0i = Xi(lessOp<scalar>(), valueX, false);        label x1i = Xi(greaterOp<scalar>(), valueX, true);        if (x0i == x1i)        {            return interpolateValue(t[x0i].second(), valueY);        }        else        {            Type y0(interpolateValue(t[x0i].second(), valueY));            Type y1(interpolateValue(t[x1i].second(), valueY));            // gradient in X            scalar x0 = t[x0i].first();            scalar x1 = t[x1i].first();            Type mX = (y1 - y0)/(x1 - x0);            // interpolate            return y0 + mX*(valueX - x0);        }    }}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Breeder2.0-libraries-swak4Foam,代码行数:57,


示例18: Java_concolic_Bessel_bessely0

/* Our C definition of the function bessely0 declared in Bessel.java */JNIEXPORT jdouble JNICALLJava_concolic_Bessel_bessely0(JNIEnv *env, jobject obj, jdouble x){  double y;  /* Call the Y0(x) Bessel function from the     standard C mathematical library */  y = y0(x);  return y;}
开发者ID:BugwarsREU-JPFTeam,项目名称:jpf-symbc2,代码行数:12,


示例19: p1

void cofdm_map::set_pilots(bvec x){int K = x.length();complex<double> p1 ( PA , 0.0);complex<double> p0 (-PA , 0.0);int L = zero_carriers.length();complex<double> c0 (0.0 , 0.0);int i;	if( K == pilots_carriers.length() ) {		for (i=0; i<K; i++) {			y0(pilots_carriers(i))=x(i)?p1:p0;		}		for (i=0; i<L; i++) {			y0(zero_carriers(i))=c0;		}	}	else {		throw sci_exception("cofdm_map::set_pilots - x.size() <> pilots_carriers.size()=", pilots_carriers.length());	}	}
开发者ID:maki63,项目名称:c_sci,代码行数:21,


示例20: cv

cvec cofdm_sel::get_sel( ){cvec cv;int K = sel_carriers.length();int i;	cv.set_length(K);	for (i=0; i<K; i++) {		cv(i)= y0(sel_carriers(i));	}	return (cv);}
开发者ID:maki63,项目名称:c_sci,代码行数:12,


示例21: y0

void Foam::equationReader::evalScalarFieldY0(    const equationReader * eqnReader,    const label index,    const label i,    const label storageOffset,    label& storeIndex,    scalarField& x,    const scalarField& source) const{    y0(x, x);}
开发者ID:Marupio,项目名称:equationReader,代码行数:13,


示例22: y0

void FirstOrderNonLinearODErEx1::Main(int argc, char **argv){    FirstOrderNonLinearODErEx1 nnl;    unsigned int N = 100;    unsigned int M = nnl.count();    double h = 0.01;    nnl.setDimension(Dimension(h, 0, static_cast<int>(N)));    DoubleVector y0(M);    for (unsigned int r=0; r<M; r++)    {        y0[r] = nnl.x(PointNodeODE(0.0, 0), r+1);    }    std::vector<DoubleVector> x;    nnl.cauchyProblem(0.0, y0, x, OdeSolverMethod::RK4);    for (unsigned int m=0; m<M; m++)    {        for (unsigned int n=0; n<=N; n++)        {            if (n%(N/10)==0) printf("%14.10f ", x[n][m]);        }        puts("");    }    IPrinter::printSeperatorLine();    for (unsigned int m=0; m<M; m++)    {        for (unsigned int n=0; n<=N; n++)        {            if (n%(N/10)==0) printf("%14.10f ", nnl.x(n*h, m+1));        }        puts("");    }    IPrinter::printSeperatorLine();    double norm[] = {0.0, 0.0, 0.0};    for (unsigned int m=0; m<M; m++)    {        norm[m] = 0.0;        for (unsigned int n=0; n<=N; n++)        {            norm[m] += (x[n][m]-nnl.x(n*h, m+1))*(x[n][m]-nnl.x(n*h, m+1));        }        norm[m] = sqrt(norm[m]);    }    printf("Norms: %.10f %.10f %.10f/n", norm[0], norm[1], norm[2]);}
开发者ID:hvugar,项目名称:num_methods,代码行数:50,


示例23: x0

         Simple_OPBuf1<INT,INT> *         FoncATrou_OPB_Comp<Type>::dup_comp(){    return new           FoncATrou_OPB_Comp<Type>           (                _l,                x0(),                x1(),                y0(),                y1()           );}
开发者ID:rpankka,项目名称:micmac,代码行数:14,


示例24: pow

mp_int<A,T> pow(const mp_int<A,T>& x, const mp_int<A,T>& y){  if (y.size() == 1)    return pow(x, y[0]);  mp_int<A,T> y0(y);    y0.divide_by_2();    mp_int<A,T> y1(y0);  if (y.is_odd())    ++y1;  return pow(x, y0) * pow(x, y1);}
开发者ID:AlexanderToifl,项目名称:viennamesh-dev,代码行数:16,


示例25: lnoResiduals

  SEXP lnoResiduals(SEXP sp, SEXP excludeRadius){    if(!(isNumeric(excludeRadius) && LENGTH(excludeRadius) == 1))      Rf_error("Exclude radius must be a scalar");    if(R_ExternalPtrTag(sp) != install("covafillPointer"))      Rf_error("The pointer must be to a covafill object");    covafill<double>* ptr=(covafill<double>*)R_ExternalPtrAddr(sp);    double er = asDouble(excludeRadius);    MatrixXd x0 = ptr->coordinates;    vector y0 = ptr->observations;    vector res(y0.size());    for(int i = 0; i < x0.rows(); ++i)      res.row(i) = ptr->operator()((vector)x0.row(i),er) - y0(i);    return asSEXP(res);  }
开发者ID:calbertsen,项目名称:covafillr,代码行数:17,


示例26: QCPCurve

 void planner::graphInit(){     line=0;    // add two new graphs and set their look:    ui->plot->addGraph();    ui->plot->graph(0)->setPen(QPen(Qt::blue)); // line color blue for first graph    ui->plot->graph(0)->setBrush(QBrush(QColor(0, 0, 255, 20))); // first graph will be filled with translucent blue    ui->plot->addGraph();    ui->plot->graph(1)->setPen(QPen(Qt::green)); // line color red for second graph     fermatSpiral1 = new QCPCurve(ui->plot->xAxis, ui->plot->yAxis);     ui->plot->addPlottable(fermatSpiral1);     fermatSpiral1->setPen(QPen(Qt::red));     fermatSpiral1->setBrush(QBrush(QColor(255, 0, 0, 20)));     //viuslaize robot triangle instead of trajectory     trajectoryLine = new QCPCurve(ui->plot->xAxis, ui->plot->yAxis);     ui->plot->addPlottable(trajectoryLine);     trajectoryLine->setPen(QPen(Qt::black));     trajectoryLine->setBrush(QBrush(QColor(0, 0, 0, 20)));     // generate some points of data (y0 for first, y1 for second graph):    QVector<double> x(250), y0(250), y1(250);    for (int i=0; i<250; ++i)    {      x[i] = i;      y0[i] = qExp(-i/150.0)*qCos(i/10.0); // exponentially decaying cosine      y1[i] = qExp(-i/150.0);              // exponential envelope    }    ui->plot->xAxis2->setVisible(true);    ui->plot->xAxis2->setTickLabels(false);    ui->plot->yAxis2->setVisible(true);    ui->plot->yAxis2->setTickLabels(false);    // make left and bottom axes always transfer their ranges to right and top axes:    connect(ui->plot->xAxis, SIGNAL(rangeChanged(QCPRange)), ui->plot->xAxis2, SLOT(setRange(QCPRange)));    connect(ui->plot->yAxis, SIGNAL(rangeChanged(QCPRange)), ui->plot->yAxis2, SLOT(setRange(QCPRange)));    // pass data points to graphs:    ui->plot->graph(0)->setData(x, y0);    ui->plot->graph(1)->setData(x, y1);    ui->plot->graph(0)->rescaleAxes();    ui->plot->graph(1)->rescaleAxes(true);    ui->plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);}
开发者ID:RedwanNewaz,项目名称:jaistQuadPath,代码行数:43,


示例27: x

void MathPlot::setupTextureBrushDemo(QCustomPlot *customPlot){  // add two graphs with a textured fill:  customPlot->addGraph();  QPen redDotPen;  redDotPen.setStyle(Qt::DotLine);  redDotPen.setColor(QColor(170, 100, 100, 180));  redDotPen.setWidthF(2);  customPlot->graph(0)->setPen(redDotPen);  customPlot->graph(0)->setBrush(QBrush(QPixmap("://skin/images/balboa.jpg"))); // fill with texture of specified image  customPlot->addGraph();  customPlot->graph(1)->setPen(QPen(Qt::red));  // activate channel fill for graph 0 towards graph 1:  customPlot->graph(0)->setChannelFillGraph(customPlot->graph(1));  // generate data:  QVector<double> x(250);  QVector<double> y0(250), y1(250);  for (int i=0; i<250; ++i)  {    // just playing with numbers, not much to learn here    x[i] = 3*i/250.0;    y0[i] = 1+exp(-x[i]*x[i]*0.8)*(x[i]*x[i]+x[i]);    y1[i] = 1-exp(-x[i]*x[i]*0.4)*(x[i]*x[i])*0.1;  }  // pass data points to graphs:  customPlot->graph(0)->setData(x, y0);  customPlot->graph(1)->setData(x, y1);  // activate top and right axes, which are invisible by default:  customPlot->xAxis2->setVisible(true);  customPlot->yAxis2->setVisible(true);  // make tick labels invisible on top and right axis:  customPlot->xAxis2->setTickLabels(false);  customPlot->yAxis2->setTickLabels(false);  // set ranges:  customPlot->xAxis->setRange(0, 2.5);  customPlot->yAxis->setRange(0.9, 1.6);  // assign top/right axes same properties as bottom/left:  customPlot->axisRect()->setupFullAxesBox();}
开发者ID:zhoajianjun,项目名称:QT,代码行数:43,


示例28: x

void BasicGraph::Demo(){   QCustomPlot* customPlot = ui.basicGraph;   // add two new graphs and set their look:   customPlot->addGraph();   customPlot->graph(0)->setPen(QPen(Qt::blue)); // line color blue for first graph   customPlot->graph(0)->setBrush(QBrush(QColor(0, 0, 255, 20))); // first graph will be filled with translucent blue   customPlot->addGraph();   customPlot->graph(1)->setPen(QPen(Qt::red)); // line color red for second graph   // generate some points of data (y0 for first, y1 for second graph):   QVector<double> x(250), y0(250), y1(250);   for (int i = 0; i<250; ++i)   {      x[i] = i;      y0[i] = exp(-i / 150.0)*cos(i / 10.0); // exponentially decaying cosine      y1[i] = exp(-i / 150.0); // exponential envelope   }   // configure right and top axis to show ticks but no labels:   // (see QCPAxisRect::setupFullAxesBox for a quicker method to do this)   customPlot->xAxis2->setVisible(true);   customPlot->xAxis2->setTickLabels(false);   customPlot->yAxis2->setVisible(true);   customPlot->yAxis2->setTickLabels(false);   // make left and bottom axes always transfer their ranges to right and top axes:   connect(customPlot->xAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->xAxis2, SLOT(setRange(QCPRange)));   connect(customPlot->yAxis, SIGNAL(rangeChanged(QCPRange)), customPlot->yAxis2, SLOT(setRange(QCPRange)));   // pass data points to graphs:   customPlot->graph(0)->setData(x, y0);   customPlot->graph(1)->setData(x, y1);   // let the ranges scale themselves so graph 0 fits perfectly in the visible area:   customPlot->graph(0)->rescaleAxes();   // same thing for graph 1, but only enlarge ranges (in case graph 1 is smaller than graph 0):   customPlot->graph(1)->rescaleAxes(true);   // Note: we could have also just called customPlot->rescaleAxes(); instead   // Allow user to drag axis ranges with mouse, zoom with mouse wheel and select graphs by clicking:   customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);      ExternalReplot();}
开发者ID:jkane1628,项目名称:HtmControlCenter,代码行数:42,


示例29: x

void MainWindow::setupPlot(){  // The following plot setup is mostly taken from the plot demos:  ui->plot->addGraph();  ui->plot->graph()->setPen(QPen(Qt::blue));  ui->plot->graph()->setBrush(QBrush(QColor(0, 0, 255, 20)));  ui->plot->addGraph();  ui->plot->graph()->setPen(QPen(Qt::red));  QVector<double> x(500), y0(500), y1(500);  for (int i=0; i<500; ++i)  {    x[i] = (i/499.0-0.5)*10;    y0[i] = qExp(-x[i]*x[i]*0.25)*qSin(x[i]*5)*5;    y1[i] = qExp(-x[i]*x[i]*0.25)*5;  }  ui->plot->graph(0)->setData(x, y0);  ui->plot->graph(1)->setData(x, y1);  ui->plot->axisRect()->setupFullAxesBox(true);  ui->plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);}
开发者ID:alagoutte,项目名称:QCustomPlot,代码行数:20,


示例30: yn

_WMRTLINK double yn( int n, double x )/**************************/{    int     j;    double  by, bym, byp, tox;    if( x < 0.0 ) {        return __math1err( FP_FUNC_YN | M_DOMAIN | V_NEG_HUGEVAL, &x );    }    bym = y0( x );    if( n == 0 )        return( bym );    tox = PDIV( 2.0, x );    by = y1( x );    for( j = 1; j < n; j++ ) {        byp = j * tox * by - bym;        bym = by;        by = byp;    }    return( by );}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:21,



注:本文中的y0函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ y1函数代码示例
C++ y函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。