这篇教程C++ tanh函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tanh函数的典型用法代码示例。如果您正苦于以下问题:C++ tanh函数的具体用法?C++ tanh怎么用?C++ tanh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tanh函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: waveshaper_tanhinline auto waveshaper_tanh(E1&& input, double saturation){ return tanh(saturation * input) * (coth(saturation));}
开发者ID:kfrlib,项目名称:kfr,代码行数:4,
示例2: math_tanhstatic int math_tanh (lua_State *L) { lua_pushnumber(L, tanh(luaL_checknumber(L, 1))); return 1;}
开发者ID:dadosutter,项目名称:elua,代码行数:4,
示例3: tanhllong doubletanhl(long double x){ return tanh((double) x);}
开发者ID:aosm,项目名称:gcc3,代码行数:5,
示例4: DT_FTIMEReal DT_FTIME() {// return 0.0; return rT*(1-pow(tanh(rT*TIME),2));}
开发者ID:Zhonghua,项目名称:hermes-dev,代码行数:4,
示例5: disp1intPY_Macro2D::update(void){ Domain *theDomain=this->getDomain(); Tt = theDomain->getCurrentTime(); double dt = Tt - Ct; // determine the strain const Vector &disp1 = theNodes[0]->getTrialDisp(); const Vector &disp2 = theNodes[1]->getTrialDisp(); double Ru = disp1(1); // pore water pressure // Use displacements to find the total strain in the element TU = 0.0; for (int i=0; i<2; i++) { TU -= (disp2(i)-disp1(i)) * trans(0,i); } // Find the change in strain double dU = TU - CU; // Declare the other variables required double dz, f, f_, Tzold, Tznew; dz = K/py*(1-(tanh(a*abs(Cz))/tanh(a))*(b+g*signum(dU*Cz)))*dU; Tz = Cz+dz; // Pore Pressure Generation Model Tforce = py*Tz*CS; Ttangent = K*(1-(tanh(a*fabs(Tz))/tanh(a))*(b+g*signum(dU*Tz)))*TS; TW = CW; double dSb = 0.0; if (fabs(Tz) <= 0.67*m2/m1) { TW = CW+fabs(Tforce*dU)/py/(py/K); dSb = exp(-1*pow(TW/w1,1.4))*1.4*pow(TW/w1,0.4)*fabs(Tforce*dU)/py/(py/K)/w1; } double Sff = 1-Ru; double dSd = beta/(0.01+0.99*fabs(Sff-CS0))*pow(CS,p1) *dt/(1+beta/(0.01+0.99*fabs(Sff-CS0))*pow(CS,p1) *dt)*(Sff-CS); TS0 = CS0 - dSb + dSd; if (fabs(Tz) <= 0.67*m2/m1) { TS = TS0; } else { double alp = 0.67*m2/m1; TS = TS0*(1+alp*alp)/(fabs(Tz)*alp+pow((Tz*alp)*(Tz*alp)+(1-Tz*Tz)*(1+alp*alp),0.5)); } // Compute force and tangent// Tforce = py*Tz*TS;// Ttangent = K*(1-(tanh(a*fabs(Tz))/tanh(a))*(b+g*signum(dU*Tz)))*TS; return 0;}
开发者ID:DBorello,项目名称:OpenSees,代码行数:62,
示例6: mainPetscInt main(PetscInt argc,char **args){ typedef enum {RANDOM, CONSTANT, TANH, NUM_FUNCS} FuncType; const char *funcNames[NUM_FUNCS] = {"random", "constant", "tanh"}; Mat A, AA; PetscMPIInt size; PetscInt N,i, stencil=1,dof=3; PetscInt dim[3] = {10,10,10}, ndim = 3; Vec coords,x,y,z,xx, yy, zz; Vec xxsplit[DOF], yysplit[DOF], zzsplit[DOF]; PetscReal h[3]; PetscScalar s; PetscRandom rdm; PetscReal norm, enorm; PetscInt func; FuncType function = TANH; DM da, da1, coordsda; PetscBool view_x = PETSC_FALSE, view_y = PETSC_FALSE, view_z = PETSC_FALSE; PetscErrorCode ierr; ierr = PetscInitialize(&argc,&args,(char *)0,help);CHKERRQ(ierr);#if !defined(PETSC_USE_COMPLEX) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_SUP, "This example requires complex numbers");#endif ierr = MPI_Comm_size(PETSC_COMM_WORLD, &size);CHKERRQ(ierr); if (size != 1) SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_SUP, "This is a uniprocessor example only!"); ierr = PetscOptionsBegin(PETSC_COMM_WORLD, PETSC_NULL, "USFFT Options", "ex27");CHKERRQ(ierr); ierr = PetscOptionsEList("-function", "Function type", "ex27", funcNames, NUM_FUNCS, funcNames[function], &func, PETSC_NULL);CHKERRQ(ierr); function = (FuncType) func; ierr = PetscOptionsEnd();CHKERRQ(ierr); ierr = PetscOptionsGetBool(PETSC_NULL,"-view_x",&view_x,PETSC_NULL);CHKERRQ(ierr); ierr = PetscOptionsGetBool(PETSC_NULL,"-view_y",&view_y,PETSC_NULL);CHKERRQ(ierr); ierr = PetscOptionsGetBool(PETSC_NULL,"-view_z",&view_z,PETSC_NULL);CHKERRQ(ierr); ierr = PetscOptionsGetIntArray(PETSC_NULL,"-dim",dim,&ndim,PETSC_NULL);CHKERRQ(ierr); // DMDA with the correct fiber dimension ierr = DMDACreate3d(PETSC_COMM_SELF,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR, dim[0], dim[1], dim[2], PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, dof, stencil, PETSC_NULL, PETSC_NULL, PETSC_NULL, &da); CHKERRQ(ierr); // DMDA with fiber dimension 1 for split fields ierr = DMDACreate3d(PETSC_COMM_SELF,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_BOUNDARY_NONE,DMDA_STENCIL_STAR, dim[0], dim[1], dim[2], PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE, 1, stencil, PETSC_NULL, PETSC_NULL, PETSC_NULL, &da1); CHKERRQ(ierr); // Coordinates ierr = DMDAGetCoordinateDA(da, &coordsda); ierr = DMGetGlobalVector(coordsda, &coords);CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) coords, "Grid coordinates");CHKERRQ(ierr); for(i = 0, N = 1; i < 3; i++) { h[i] = 1.0/dim[i]; PetscScalar *a; ierr = VecGetArray(coords, &a);CHKERRQ(ierr); PetscInt j,k,n = 0; for(i = 0; i < 3; ++i) { for(j = 0; j < dim[i]; ++j){ for(k = 0; k < 3; ++k) { a[n] = j*h[i]; // coordinate along the j-th point in the i-th dimension ++n; } } } ierr = VecRestoreArray(coords, &a);CHKERRQ(ierr); } ierr = DMDASetCoordinates(da, coords);CHKERRQ(ierr); ierr = VecDestroy(&coords);CHKERRQ(ierr); // Work vectors ierr = DMGetGlobalVector(da, &x);CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) x, "Real space vector");CHKERRQ(ierr); ierr = DMGetGlobalVector(da, &xx);CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) xx, "Real space vector");CHKERRQ(ierr); ierr = DMGetGlobalVector(da, &y);CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) y, "USFFT frequency space vector");CHKERRQ(ierr); ierr = DMGetGlobalVector(da, &yy);CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) yy, "FFTW frequency space vector");CHKERRQ(ierr); ierr = DMGetGlobalVector(da, &z);CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) z, "USFFT reconstructed vector");CHKERRQ(ierr); ierr = DMGetGlobalVector(da, &zz);CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) zz, "FFTW reconstructed vector");CHKERRQ(ierr); // Split vectors for FFTW for(int ii = 0; ii < 3; ++ii) { ierr = DMGetGlobalVector(da1, &xxsplit[ii]);CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) xxsplit[ii], "Real space split vector");CHKERRQ(ierr); ierr = DMGetGlobalVector(da1, &yysplit[ii]);CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) yysplit[ii], "FFTW frequency space split vector");CHKERRQ(ierr); ierr = DMGetGlobalVector(da1, &zzsplit[ii]);CHKERRQ(ierr); ierr = PetscObjectSetName((PetscObject) zzsplit[ii], "FFTW reconstructed split vector");CHKERRQ(ierr); } ierr = PetscPrintf(PETSC_COMM_SELF, "%3-D: USFFT on vector of ");CHKERRQ(ierr);//.........这里部分代码省略.........
开发者ID:Kun-Qu,项目名称:petsc,代码行数:101,
示例7: v //----------------------------------------------------------------------- void FunCmplxTanH::Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int) { cmplx_type v(a_pArg[0]->GetFloat(), a_pArg[0]->GetImag()); *ret = tanh(v); }
开发者ID:ArashPartow,项目名称:math-parser-benchmark-project,代码行数:6,
示例8: HHVM_FUNCTIONdouble HHVM_FUNCTION(tanh, double arg) { return tanh(arg); }
开发者ID:DerPapst,项目名称:hhvm,代码行数:1,
示例9: evaluate_expr//.........这里部分代码省略......... { stack[bottom] = 1.0; } else { stack[bottom] = 0.0; } break; case 99: stack[bottom] = -stack[bottom]; break; case 101: stack[bottom] = sin(stack[bottom]); break; case 102: stack[bottom] = cos(stack[bottom]); break; case 103: stack[bottom] = tan(stack[bottom]); break; case 104: stack[bottom] = exp(stack[bottom]); break; case 105: stack[bottom] = log(stack[bottom]); break; case 106: stack[bottom] = sinh(stack[bottom]); break; case 107: stack[bottom] = cosh(stack[bottom]); break; case 108: stack[bottom] = tanh(stack[bottom]); break; case 109: if (block->ng > 0) { nzcr = nzcr + 1; } if (flag == 9) { if (stack[bottom] > 0) { i = (int)floor(stack[bottom]); } else { i = (int)ceil(stack[bottom]); } if (i == 0) { block->g[nzcr] = (stack[bottom] - 1) * (stack[bottom] + 1); } else if (i > 0) { block->g[nzcr] = (stack[bottom] - i - 1.) * (stack[bottom] - i); } else { block->g[nzcr] = (stack[bottom] - i) * (stack[bottom] - i + 1); } if (i % 2) { block->g[nzcr] = -block->g[nzcr];
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:67,
示例10: cothinline T coth( T n ){ return 1 / tanh( n );}
开发者ID:ecell,项目名称:ecell3,代码行数:4,
示例11: test_trigvoid test_trig( void ){ printf( "Testing trigonometric functions.../n" ); VERIFY( CompDbl( sin( PI ), 0.0 ) ); VERIFY( CompDbl( sin( 0.0 ), 0.0 ) ); VERIFY( CompDbl( sin( -PI ), 0.0 ) ); VERIFY( CompDbl( sin( PI / 2 ), 1.0 ) ); VERIFY( CompDbl( sin(- PI / 2 ), -1.0 ) ); VERIFY( CompDbl( cos( PI ), -1.0 ) ); VERIFY( CompDbl( cos( 0.0 ), 1.0 ) ); VERIFY( CompDbl( cos( -PI ), -1.0 ) ); VERIFY( CompDbl( cos( PI / 2 ), 0.0 ) ); VERIFY( CompDbl( cos(- PI / 2 ), 0.0 ) ); VERIFY( CompDbl( tan( PI ), 0.0 ) ); VERIFY( CompDbl( tan( 0.0 ), 0.0 ) ); VERIFY( CompDbl( tan( -PI ), 0.0 ) ); VERIFY( CompDbl( tan( PI / 4 ), 1.0 ) ); VERIFY( CompDbl( asin( 1.0 ), PI / 2 ) ); VERIFY( CompDbl( asin( 0.0 ), 0.0 ) ); VERIFY( CompDbl( asin( -1.0 ), -PI / 2 ) ); VERIFY( CompDbl( acos( 1.0 ), 0.0 ) ); VERIFY( CompDbl( acos( 0.0 ), PI / 2 ) ); VERIFY( CompDbl( acos( -1.0 ), PI ) ); VERIFY( CompDbl( atan( 1.0 ), PI / 4 ) ); VERIFY( CompDbl( atan( 0.0 ), 0.0 ) ); VERIFY( CompDbl( atan( -1.0 ), -PI / 4 ) ); VERIFY( CompDbl( atan( DBL_MAX ), PI / 2 ) ); VERIFY( CompDbl( atan( -DBL_MAX ), -PI / 2 ) ); VERIFY( CompDbl( atan2( 2.0, 2.0 ), PI / 4 ) ); VERIFY( CompDbl( atan2( 1.0, -1.0 ), 3 * PI / 4 ) ); VERIFY( CompDbl( atan2( -1.0, -1.0 ), -3 * PI / 4 ) ); VERIFY( CompDbl( atan2( -3.0, 3.0 ), -PI / 4 ) ); VERIFY( CompDbl( atan2( 0.0, 1.0 ), 0.0 ) ); VERIFY( CompDbl( atan2( 1.0, 0.0 ), PI / 2 ) ); VERIFY( CompDbl( atan2( -DBL_MAX, 1.0 ), -PI / 2 ) ); VERIFY( CompDbl( atan2( DBL_MAX, 1.0 ), PI / 2 ) ); VERIFY( CompDbl( atan2( 1.0, DBL_MAX ), 0.0 ) ); VERIFY( CompDbl( atan2( -1.0, DBL_MAX ), 0.0 ) ); VERIFY( CompDbl( hypot( 3.0, 4.0 ), 5.0 ) ); VERIFY( CompDbl( sinh( 1.0 ), 1.1752011936 ) ); VERIFY( CompDbl( sinh( 0.0 ), 0.0 ) ); VERIFY( CompDbl( cosh( 1.0 ), 1.5430806348 ) ); VERIFY( CompDbl( cosh( 0.0 ), 1.0 ) ); VERIFY( CompDbl( tanh( 1.0 ), 0.7615941560 ) ); VERIFY( CompDbl( tanh( 0.0 ), 0.0 ) );#ifdef __WATCOMC__ /* Not in Microsoft libs. */ VERIFY( CompDbl( asinh( 1.1752011936 ), 1.0 ) ); VERIFY( CompDbl( asinh( 0.0 ), 0.0 ) ); VERIFY( CompDbl( acosh( 1.5430806348 ), 1.0 ) ); VERIFY( CompDbl( acosh( 1.0 ), 0.0 ) ); VERIFY( CompDbl( atanh( 0.7615941560 ), 1.0 ) ); VERIFY( CompDbl( atanh( 0.0 ), 0.0 ) );#endif /* Note: sinh(1) = 1.175201193643802 sinh(0) = 0.000000000000000 cosh(1) = 1.543080634815244 cosh(0) = 1.000000000000000 tanh(1) = 0.761594155955765 tanh(0) = 0.000000000000000 */}
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:63,
示例12: mathvoidmath (double d, int *ex, double *dp){ acos (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 8 } */ acosh (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 10 } */ asin (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 12 } */ asinh (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 14 } */ atan (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 16 } */ atanh (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 18 } */ atan2 (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 20 } */ cbrt (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 22 } */ ceil (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 24 } */ copysign (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 26 } */ cos (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 28 } */ cosh (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 30 } */ erf (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 32 } */ erfc (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 34 } */ exp (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 36 } */ exp2 (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 38 } */ expm1 (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 40 } */ fabs (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 42 } */ fdim (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 44 } */ floor (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 46 } */ fma (d, d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 48 } */ fmax (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 50 } */ fmin (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 52 } */ fmod (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 54 } */ frexp (d, ex); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 56 } */ hypot (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 58 } */ /* We don't generate the warning for ilogb. */ ilogb (d); ldexp (d, *ex); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 62 } */ lgamma (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 64 } */ llrint (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 66 } */ llround (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 68 } */ log (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 70 } */ log10 (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 72 } */ log1p (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 74 } */ log2 (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 76 } */ logb (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 78 } */ lrint (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 80 } */ lround (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 82 } */ modf (d, dp); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 84 } */ nan (""); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 86 } */ nearbyint (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 88 } */ nextafter (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 90 } */ nexttoward (d, 20.0L); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 92 } */ pow (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 94 } */ remainder (d, d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 96 } */ remquo (d, d, ex); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 98 } */ rint (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 100 } */ round (d); /* { dg-warning "incompatible implicit" } */ /* { dg-message "include ..math.h.." "" { target *-*-* } 102 } */ scalbln (d, 100L); /* { dg-warning "incompatible implicit" } *///.........这里部分代码省略.........
开发者ID:0day-ci,项目名称:gcc,代码行数:101,
示例13: HFETApzLoadintHFETApzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s){ HFETAmodel *model = (HFETAmodel*)inModel; HFETAinstance *here; double gm; double gds; double xds; double ggs; double xgs; double ggd; double xgd; double ggspp; double ggdpp; double f; double m; for( ; model != NULL; model = model->HFETAnextModel ) { for( here = model->HFETAinstances; here != NULL; here = here->HFETAnextInstance) { if (here->HFETAowner != ARCHme) continue; gm = *(ckt->CKTstate0 + here->HFETAgm); gds = *(ckt->CKTstate0 + here->HFETAgds); xds = CDS*ckt->CKTomega; ggs = *(ckt->CKTstate0 + here->HFETAggs); xgs = *(ckt->CKTstate0 + here->HFETAqgs); ggd = *(ckt->CKTstate0 + here->HFETAggd); xgd = *(ckt->CKTstate0 + here->HFETAqgd); ggspp = *(ckt->CKTstate0 + here->HFETAggspp); ggdpp = *(ckt->CKTstate0 + here->HFETAggdpp); if(model->HFETAkappaGiven && here->HFETAdelf != 0.0) { f = ckt->CKTomega/2/M_PI; gds = gds*(1+0.5*model->HFETAkappa*(1+tanh((f-here->HFETAfgds)/here->HFETAdelf))); } m = here->HFETAm; *(here->HFETAdrainDrainPtr) += m * (model->HFETAdrainConduct); *(here->HFETAsourceSourcePtr) += m * (model->HFETAsourceConduct); *(here->HFETAgatePrimeGatePrimePtr) += m * (ggd+ggs+ggspp+ggdpp+model->HFETAgateConduct); *(here->HFETAdrainPrimeDrainPrimePtr) += m * (gds+ggd+model->HFETAdrainConduct+model->HFETAgf); *(here->HFETAsourcePrimeSourcePrimePtr) += m * (gds+gm+ggs+model->HFETAsourceConduct+model->HFETAgi); *(here->HFETAsourcePrmPrmSourcePrmPrmPtr) += m * (model->HFETAgi+ggspp); *(here->HFETAdrainPrmPrmDrainPrmPrmPtr) += m * (model->HFETAgf+ggdpp); *(here->HFETAdrainDrainPrimePtr) -= m * (model->HFETAdrainConduct); *(here->HFETAdrainPrimeDrainPtr) -= m * (model->HFETAdrainConduct); *(here->HFETAsourceSourcePrimePtr) -= m * (model->HFETAsourceConduct); *(here->HFETAsourcePrimeSourcePtr) -= m * (model->HFETAsourceConduct); *(here->HFETAgatePrimeDrainPrimePtr) -= m * (ggd); *(here->HFETAdrainPrimeGatePrimePtr) += m * (gm-ggd); *(here->HFETAgatePrimeSourcePrimePtr) -= m * (ggs); *(here->HFETAsourcePrimeGatePrimePtr) += m * (-ggs-gm); *(here->HFETAdrainPrimeSourcePrimePtr) += m * (-gds-gm); *(here->HFETAsourcePrimeDrainPrimePtr) -= m * (gds); *(here->HFETAsourcePrimeSourcePrmPrmPtr) -= m * (model->HFETAgi); *(here->HFETAsourcePrmPrmSourcePrimePtr) -= m * (model->HFETAgi); *(here->HFETAgatePrimeSourcePrmPrmPtr) -= m * (ggspp); *(here->HFETAsourcePrmPrmGatePrimePtr) -= m * (ggspp); *(here->HFETAdrainPrimeDrainPrmPrmPtr) -= m * (model->HFETAgf); *(here->HFETAdrainPrmPrmDrainPrimePtr) -= m * (model->HFETAgf); *(here->HFETAgatePrimeDrainPrmPrmPtr) -= m * (ggdpp); *(here->HFETAdrainPrmPrmGatePrimePtr) -= m * (ggdpp); *(here->HFETAgateGatePtr) += m * (model->HFETAgateConduct); *(here->HFETAgateGatePrimePtr) -= m * (model->HFETAgateConduct); *(here->HFETAgatePrimeGatePtr) -= m * (model->HFETAgateConduct); *(here->HFETAgatePrimeGatePrimePtr) += m * ((xgd+xgs) * s->real); *(here->HFETAgatePrimeGatePrimePtr+1) += m * ((xgd+xgs) * s->imag); *(here->HFETAdrainPrmPrmDrainPrmPrmPtr) += m * (xgd * s->real); *(here->HFETAdrainPrmPrmDrainPrmPrmPtr+1) += m * (xgd * s->imag); *(here->HFETAsourcePrmPrmSourcePrmPrmPtr) += m * (xgs * s->real); *(here->HFETAsourcePrmPrmSourcePrmPrmPtr+1) += m * (xgs * s->imag); *(here->HFETAgatePrimeDrainPrmPrmPtr) -= m * (xgd * s->real); *(here->HFETAgatePrimeDrainPrmPrmPtr+1) -= m * (xgd * s->imag); *(here->HFETAgatePrimeSourcePrmPrmPtr) -= m * (xgs * s->real); *(here->HFETAgatePrimeSourcePrmPrmPtr+1) -= m * (xgs * s->imag); *(here->HFETAdrainPrmPrmGatePrimePtr) -= m * (xgd * s->real); *(here->HFETAdrainPrmPrmGatePrimePtr+1) -= m * (xgd * s->imag); *(here->HFETAsourcePrmPrmGatePrimePtr) -= m * (xgs * s->real); *(here->HFETAsourcePrmPrmGatePrimePtr+1) -= m * (xgs * s->imag); *(here->HFETAdrainPrimeDrainPrimePtr) += m * (xds * s->real); *(here->HFETAdrainPrimeDrainPrimePtr+1) += m * (xds * s->imag); *(here->HFETAsourcePrimeSourcePrimePtr) += m * (xds * s->real); *(here->HFETAsourcePrimeSourcePrimePtr+1) += m * (xds * s->imag); *(here->HFETAdrainPrimeSourcePrimePtr) -= m * (xds * s->real); *(here->HFETAdrainPrimeSourcePrimePtr+1) -= m * (xds * s->imag); *(here->HFETAsourcePrimeDrainPrimePtr) -= m * (xds * s->real); *(here->HFETAsourcePrimeDrainPrimePtr+1) -= m * (xds * s->imag); } } return(OK);}
开发者ID:aesop972,项目名称:ngspice-gss,代码行数:96,
示例14: eval//.........这里部分代码省略......... p = p->getCdr(); } return ret; } case ENODE_ID_POW: { if (e->getArity() != 2) { throw runtime_error("GSL eval: pow not implemented"); } double const arg1 = eval(e->get1st(), values, params, value_lookup, param_lookup); double const arg2 = eval(e->get2nd(), values, params, value_lookup, param_lookup); return pow(arg1, arg2); } case ENODE_ID_ATAN2: { double const arg1 = eval(e->get1st(), values, params, value_lookup, param_lookup); double const arg2 = eval(e->get2nd(), values, params, value_lookup, param_lookup); return atan2(arg1, arg2); } case ENODE_ID_UMINUS: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return -arg; } case ENODE_ID_SIN: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return sin(arg); } case ENODE_ID_COS: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return cos(arg); } case ENODE_ID_TAN: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return tan(arg); } case ENODE_ID_SQRT: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return sqrt(arg); } case ENODE_ID_SAFESQRT: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); assert(arg >= 0); return sqrt(arg); } case ENODE_ID_EXP: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return exp(arg); } case ENODE_ID_LOG: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return log(arg); } case ENODE_ID_ASIN: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return asin(arg); } case ENODE_ID_ACOS: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return acos(arg); } case ENODE_ID_ATAN: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return atan(arg); } case ENODE_ID_SINH: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return sinh(arg); } case ENODE_ID_COSH: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return cosh(arg); } case ENODE_ID_TANH: { assert(e->getArity() == 1); double const arg = eval(e->get1st(), values, params, value_lookup, param_lookup); return tanh(arg); } default: return eval(e->getCar(), values, params, value_lookup, param_lookup); } } else if (e->isList()) { throw runtime_error("GSL eval: list"); } else if (e->isDef()) { throw runtime_error("GSL eval: def"); } else if (e->isEnil()) { throw runtime_error("GSL eval: enil"); } throw runtime_error("GSL eval: unknown");}
开发者ID:scungao,项目名称:dreal-next,代码行数:101,
示例15: LibTanhvoid LibTanh(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs){ ReturnValue->Val->FP = tanh(Param[0]->Val->FP);}
开发者ID:lieff,项目名称:lvg,代码行数:4,
示例16: tanhfloat TanhFunction::value(float x){ return tanh(steepness*x);}
开发者ID:andudu,项目名称:neurino,代码行数:4,
示例17: domathvoiddomath (void){#ifndef NO_DOUBLE double f1; double f2; int i1; f1 = acos (0.0); fprintf( stdout, "acos : %f/n", f1); f1 = acosh (0.0); fprintf( stdout, "acosh : %f/n", f1); f1 = asin (1.0); fprintf( stdout, "asin : %f/n", f1); f1 = asinh (1.0); fprintf( stdout, "asinh : %f/n", f1); f1 = atan (M_PI_4); fprintf( stdout, "atan : %f/n", f1); f1 = atan2 (2.3, 2.3); fprintf( stdout, "atan2 : %f/n", f1); f1 = atanh (1.0); fprintf( stdout, "atanh : %f/n", f1); f1 = cbrt (27.0); fprintf( stdout, "cbrt : %f/n", f1); f1 = ceil (3.5); fprintf( stdout, "ceil : %f/n", f1); f1 = copysign (3.5, -2.5); fprintf( stdout, "copysign : %f/n", f1); f1 = cos (M_PI_2); fprintf( stdout, "cos : %f/n", f1); f1 = cosh (M_PI_2); fprintf( stdout, "cosh : %f/n", f1); f1 = erf (42.0); fprintf( stdout, "erf : %f/n", f1); f1 = erfc (42.0); fprintf( stdout, "erfc : %f/n", f1); f1 = exp (0.42); fprintf( stdout, "exp : %f/n", f1); f1 = exp2 (0.42); fprintf( stdout, "exp2 : %f/n", f1); f1 = expm1 (0.00042); fprintf( stdout, "expm1 : %f/n", f1); f1 = fabs (-1.123); fprintf( stdout, "fabs : %f/n", f1); f1 = fdim (1.123, 2.123); fprintf( stdout, "fdim : %f/n", f1); f1 = floor (0.5); fprintf( stdout, "floor : %f/n", f1); f1 = floor (-0.5); fprintf( stdout, "floor : %f/n", f1); f1 = fma (2.1, 2.2, 3.01); fprintf( stdout, "fma : %f/n", f1); f1 = fmax (-0.42, 0.42); fprintf( stdout, "fmax : %f/n", f1); f1 = fmin (-0.42, 0.42); fprintf( stdout, "fmin : %f/n", f1); f1 = fmod (42.0, 3.0); fprintf( stdout, "fmod : %f/n", f1); /* no type-specific variant */ i1 = fpclassify(1.0); fprintf( stdout, "fpclassify : %d/n", i1); f1 = frexp (42.0, &i1); fprintf( stdout, "frexp : %f/n", f1); f1 = hypot (42.0, 42.0); fprintf( stdout, "hypot : %f/n", f1); i1 = ilogb (42.0); fprintf( stdout, "ilogb : %d/n", i1); /* no type-specific variant */ i1 = isfinite(3.0); fprintf( stdout, "isfinite : %d/n", i1);//.........这里部分代码省略.........
开发者ID:FullMentalPanic,项目名称:RTEMS_NEW_TOOL_CHAIN,代码行数:101,
示例18: occaCuda_fastTanh__device__ inline double occaCuda_fastTanh(const double x){ return tanh(x); }
开发者ID:FlorianKummer,项目名称:OCCA2,代码行数:1,
示例19: intvoid Sound::Sound::Calc (){ _balance = int (127 * tanh (float(X) / 200) + 128); _volume = 50000 * Volume / (X*X + Y*Y + 50000);}
开发者ID:divVerent,项目名称:rebounce2,代码行数:5,
示例20: tanh_Constante* Reel::tanh_(){ _reel=tanh(_reel); return this;}
开发者ID:martinni,项目名称:Calculatrice,代码行数:4,
示例21: T_FTIMEReal T_FTIME() {// return 1.0; return 1+tanh(rT*TIME);}
开发者ID:Zhonghua,项目名称:hermes-dev,代码行数:4,
示例22: double_precision_math_functions__device__ void double_precision_math_functions() { int iX; double fX, fY; acos(1.0); acosh(1.0); asin(0.0); asinh(0.0); atan(0.0); atan2(0.0, 1.0); atanh(0.0); cbrt(0.0); ceil(0.0); copysign(1.0, -2.0); cos(0.0); cosh(0.0); cospi(0.0); cyl_bessel_i0(0.0); cyl_bessel_i1(0.0); erf(0.0); erfc(0.0); erfcinv(2.0); erfcx(0.0); erfinv(1.0); exp(0.0); exp10(0.0); exp2(0.0); expm1(0.0); fabs(1.0); fdim(1.0, 0.0); floor(0.0); fma(1.0, 2.0, 3.0); fmax(0.0, 0.0); fmin(0.0, 0.0); fmod(0.0, 1.0); frexp(0.0, &iX); hypot(1.0, 0.0); ilogb(1.0); isfinite(0.0); isinf(0.0); isnan(0.0); j0(0.0); j1(0.0); jn(-1.0, 1.0); ldexp(0.0, 0); lgamma(1.0); llrint(0.0); llround(0.0); log(1.0); log10(1.0); log1p(-1.0); log2(1.0); logb(1.0); lrint(0.0); lround(0.0); modf(0.0, &fX); nan("1"); nearbyint(0.0); nextafter(0.0, 0.0); fX = 1.0; norm(1, &fX); norm3d(1.0, 0.0, 0.0); norm4d(1.0, 0.0, 0.0, 0.0); normcdf(0.0); normcdfinv(1.0); pow(1.0, 0.0); rcbrt(1.0); remainder(2.0, 1.0); remquo(1.0, 2.0, &iX); rhypot(0.0, 1.0); rint(1.0); fX = 1.0; rnorm(1, &fX); rnorm3d(0.0, 0.0, 1.0); rnorm4d(0.0, 0.0, 0.0, 1.0); round(0.0); rsqrt(1.0); scalbln(0.0, 1); scalbn(0.0, 1); signbit(1.0); sin(0.0); sincos(0.0, &fX, &fY); sincospi(0.0, &fX, &fY); sinh(0.0); sinpi(0.0); sqrt(0.0); tan(0.0); tanh(0.0); tgamma(2.0); trunc(0.0); y0(1.0); y1(1.0); yn(1, 1.0);}
开发者ID:ssahasra,项目名称:HIP,代码行数:94,
示例23: c_dd_tanh void c_dd_tanh(const double *a, double *b) { dd_real bb; bb = tanh(dd_real(a)); TO_DOUBLE_PTR(bb, b); }
开发者ID:aoki-t,项目名称:libqd,代码行数:5,
示例24: grAddSmokevoid grAddSmoke(tCarElt *car, double t){ int i = 0; tgrSmoke * tmp; sgVec3 vtx; ssgVertexArray *shd_vtx ; tgrCarInstrument *curInst; tdble val; int index; if (!grSmokeMaxNumber) { return; } for (i = 0; i < 4; i++) { if (car->pub.speed > 0.03f) { // 0.03 -> sqrt(0.001) if (smokeManager->number < grSmokeMaxNumber) { if ((t - timeSmoke[car->index*4+i]) < grSmokeDeltaT) { continue; } else { timeSmoke[car->index*4+i] = t; } sgVec3 cur_clr; tdble init_speed; tdble threshold = 0.1f; tdble smoke_life_coefficient = 30.0f; tdble smoke_speed_coefficient = 0.0f; cur_clr[0] = 0.8f; cur_clr[1] = 0.8f; cur_clr[2] = 0.8f; init_speed = 0.01f; if (car->priv.wheel[i].seg) { // sanity check const char* surface = car->priv.wheel[i].seg->surface->material; if (strstr(surface, "sand")) { cur_clr[0] = 0.8f; cur_clr[1] = 0.7f + urandom()*0.1f; cur_clr[2] = 0.4f + urandom()*0.2f; init_speed = 0.5f; threshold = 0.05f; smoke_life_coefficient = 12.5f; smoke_speed_coefficient = 0.25f; } else if (strstr(surface, "dirt")) { cur_clr[0] = 0.7f + urandom()*0.1f; cur_clr[1] = 0.6f + urandom()*0.1f; cur_clr[2] = 0.5f + urandom()*0.1f; init_speed = 0.45f; threshold=0.0f; smoke_life_coefficient = 10.0f; smoke_speed_coefficient = 0.5f; } else if (strstr(surface,"mud")) { cur_clr[0] = 0.65f; cur_clr[1] = 0.4f + urandom()*0.2f; cur_clr[2] = 0.3f + urandom()*0.2f; init_speed = 0.4f; threshold = 0.2f; smoke_speed_coefficient = 0.05f; } else if (strstr(surface,"gravel")) { cur_clr[0] = 0.6f; cur_clr[1] = 0.6f; cur_clr[2] = 0.6f; init_speed = 0.35f; smoke_life_coefficient = 20.0f; smoke_speed_coefficient = 0.1f; } else if (strstr(surface,"grass")) { cur_clr[0] = 0.4f + urandom()*0.2f; cur_clr[1] = 0.5f + urandom()*0.1f; cur_clr[2] = 0.3f + urandom()*0.1f; init_speed = 0.3f; smoke_life_coefficient = 25.0f; } else { cur_clr[0] = 0.8f; cur_clr[1] = 0.8f; cur_clr[2] = 0.8f; init_speed = 0.01f; } } smoke_life_coefficient = smoke_life_coefficient * (1.0f - urandom()*urandom()); tdble spd_fx=tanh(0.001f*car->_reaction[i])*smoke_speed_coefficient*car->pub.speed; if (car->_skid[i] + 0.025f*urandom()*spd_fx>urandom() + threshold) {// instead of 0.3, to randomize float init_speed_z = 0.1f; float stretch_factor = 0.5f; tdble sinCarYaw = sin(car->_yaw); tdble cosCarYaw = cos(car->_yaw); shd_vtx = new ssgVertexArray(1); //shd_clr = new ssgColourArray(1); tmp = (tgrSmoke *) malloc(sizeof(tgrSmoke)); vtx[0] = car->priv.wheel[i].relPos.x; vtx[1] = car->priv.wheel[i].relPos.y; vtx[2] = car->priv.wheel[i].relPos.z-car->_wheelRadius(i)*1.0f+ 0.5f * SMOKE_INIT_SIZE; tdble stretchX = 0.1f * (spd_fx + stretch_factor * fabs(car->_speed_X)); tdble stretchY = 0.1f * (spd_fx + stretch_factor * fabs(car->_speed_Y)); vtx[0] -= 0.05f*car->_speed_x;//.........这里部分代码省略.........
开发者ID:COHRINT,项目名称:cuTORCS,代码行数:101,
示例25: math_tanhstatic VALUEmath_tanh(VALUE obj, VALUE x){ Need_Float(x); return DBL2NUM(tanh(RFLOAT_VALUE(x)));}
开发者ID:senthilnayagam,项目名称:pure-math.rb,代码行数:6,
示例26: kernel_sigmoid double kernel_sigmoid(int i, int j) const { return tanh(gamma*dot(x[i],x[j])+coef0); }
开发者ID:CPernet,项目名称:CanlabCore,代码行数:4,
示例27: tanhffloattanhf(float x){ return (float) tanh(x);}
开发者ID:aosm,项目名称:gcc3,代码行数:5,
示例28: tanhldouble tanhl( double x ) { return (double)tanh((double) x);}
开发者ID:X0rg,项目名称:darling,代码行数:3,
示例29: ifvoid ExprCopy::visit(const ExprTanh& e) { if (unary_copy(e,tanh )) clone.insert(e,&tanh (EXPR)); }
开发者ID:dvinc,项目名称:ibex-lib,代码行数:1,
示例30: tanhdouble ReadMLP1::ActivationFnc(double x) const{ // hyperbolic tan return tanh(x);}
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:5,
注:本文中的tanh函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tap_queue_packet函数代码示例 C++ tanf函数代码示例 |