这篇教程C++ Forward函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Forward函数的典型用法代码示例。如果您正苦于以下问题:C++ Forward函数的具体用法?C++ Forward怎么用?C++ Forward使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Forward函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: whileToken LexicalAnalysis::GetKeywordOrIdentifier(string& _string){ while (IsAlphaOrUnderline(*m_bufferMoved)) { _string += *m_bufferMoved; if (!Forward()) return ERROR; } while (IsAlphaOrNumberOrUnderline(*m_bufferMoved)) { _string += *m_bufferMoved; if (!Forward()) return ERROR; } for (int i = 0; i < m_keywordLen; ++i) { if (_string == m_keyword[i]) { //the word is a keyword return (Token)i; } } //the word is an id return ID;}
开发者ID:NinjaRhyme,项目名称:LexicalAnalysis,代码行数:26,
示例2: ResetParametervoid FFN<LayerTypes, OutputLayerType, InitializationRuleType, PerformanceFunction>::Predict(arma::mat& predictors, arma::mat& responses){ deterministic = true; arma::mat responsesTemp; ResetParameter(network); Forward(arma::mat(predictors.colptr(0), predictors.n_rows, 1, false, true), network); OutputPrediction(responsesTemp, network); responses = arma::mat(responsesTemp.n_elem, predictors.n_cols); responses.col(0) = responsesTemp.col(0); for (size_t i = 1; i < predictors.n_cols; i++) { Forward(arma::mat(predictors.colptr(i), predictors.n_rows, 1, false, true), network); responsesTemp = arma::mat(responses.colptr(i), responses.n_rows, 1, false, true); OutputPrediction(responsesTemp, network); responses.col(i) = responsesTemp.col(0); }}
开发者ID:GYengera,项目名称:mlpack,代码行数:26,
示例3: WdeWriteSymInfovoid WdeWriteSymInfo( WdeInfoStruct *is, bool same_as_last, char *s ){ bool dirty; OBJPTR obj; if( is->res_info->hash_table != NULL ) { dirty = WdeIsHashTableTouched( is->res_info->hash_table ); if( dirty && (obj = GetMainObject()) != NULL ) { Forward( obj, RESOLVE_SYMBOL, NULL, NULL ); Forward( obj, RESOLVE_HELPSYMBOL, NULL, NULL ); /* JPK */ } if( !same_as_last || dirty ) { WdeAddSymbolsToComboBox( is->res_info->hash_table, WdeInfoWindow, IDB_INFO_IDSTR ); WdeUntouchHashTable( is->res_info->hash_table ); } } else { if( !same_as_last ) { SendDlgItemMessage( WdeInfoWindow, IDB_INFO_IDSTR, CB_RESETCONTENT, 0, 0 ); } } if( s != NULL ) { WdeSetComboWithStr( s, WdeInfoWindow, IDB_INFO_IDSTR ); }}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:26,
示例4: RedIsolationPickupAutonomousvoid RedIsolationPickupAutonomous(){ SensorValue[Gyroscope] = 0; StartTask(KeepArmInPosition); armPosition = minArm; Intake(127); Forward(45, 125, "none"); StopMoving(); Backward(127, 90, "none"); Intake(0); StopMoving(); TurnLeftDegrees(40); armPosition = midGoalHeight; wait10Msec(70); Intake(127); Forward(100, 60, "none"); StopMoving(); armPosition = midGoalHeight - 100; wait10Msec(50); StopTask(KeepArmInPosition); StopArm(); StartTask(StayInPosition); wait10Msec(500); Intake(0); wait10Msec(1000); StopTask(StayInPosition);}
开发者ID:joseph-zhong,项目名称:Robotics,代码行数:34,
示例5: GoStart//Go to the startvoid GoStart(void){ int count=0; //turn left twice LeftTurn(); LeftTurn(); //go back 8 squares while(count<8) { //increment counters count++; Forward(); } //reset current count back to zero count=0; //turn left LeftTurn(); //go forward 3 squares you are at start while(count<2) { //increment counters count++; Forward(); } motor[motorB]=0; motor[motorC]=0; wait1Msec(1000);}
开发者ID:c15314356,项目名称:Robotics_Project,代码行数:29,
示例6: DomainVector ADFun<Base>::ForOne(const Vector &x, size_t j){ size_t j1; size_t n = Domain(); size_t m = Range(); // check Vector is Simple Vector class with Base type elements CheckSimpleVector<Base, Vector>(); CPPAD_ASSERT_KNOWN( x.size() == n, "ForOne: Length of x not equal domain dimension for f" ); CPPAD_ASSERT_KNOWN( j < n, "ForOne: the index j is not less than domain dimension for f" ); // point at which we are evaluating the second partials Forward(0, x); // direction in which are are taking the derivative Vector dx(n); for(j1 = 0; j1 < n; j1++) dx[j1] = Base(0); dx[j] = Base(1); // dimension the return value Vector dy(m); // compute the return value dy = Forward(1, dx); return dy;}
开发者ID:iagomosqueira,项目名称:FLasher,代码行数:35,
示例7: DomainVector ADFun<Base>::Hessian(const Vector &x, size_t i){ size_t j; size_t k; size_t l; size_t n = Domain(); size_t m = Range(); // check Vector is Simple Vector class with Base type elements CheckSimpleVector<Base, Vector>(); CppADUsageError( x.size() == n, "Hessian: length of x not equal domain dimension for f" ); CppADUsageError( i < m, "Hessian: index i is not less than range dimension for f" ); // point at which we are evaluating the Hessian Forward(0, x); // define the return value Vector hes(n * n); // direction vector for calls to forward Vector u(n); for(j = 0; j < n; j++) u[j] = Base(0); // direction vector for calls to reverse Vector w(m); for(l = 0; l < m; l++) w[l] = Base(0); w[i] = Base(1); // location for return values from Reverse Vector ddw(n * 2); // loop over forward direstions for(j = 0; j < n; j++) { // evaluate partials of entire function w.r.t. j-th coordinate u[j] = Base(1); Forward(1, u); u[j] = Base(0); // evaluate derivative of partial corresponding to F_i ddw = Reverse(2, w); // return desired components for(k = 0; k < n; k++) hes[k * n + j] = ddw[k * 2 + 1]; } return hes;}
开发者ID:cran,项目名称:RMC,代码行数:57,
示例8: RedInteractionCurvyAutonomousvoid RedInteractionCurvyAutonomous(){ Intake(127); Forward(127, 40, "none"); Intake(0); VariableMove(20, 127, 80); SensorValue[Gyroscope] = 0; Forward(127, 80, "none"); StopMoving(); StartTask(StayInPosition); wait10Msec(1500); StopTask(StayInPosition);}
开发者ID:joseph-zhong,项目名称:Robotics,代码行数:13,
示例9: BSFtypeMoveList *MyPositionalGain(typePos *Position, typeMoveList *List, int av){ uint64 empty = ~Position->OccupiedBW, U, T; int to, sq; typeMoveList *sm, *p, *q; int move; sm = List; for (U = ForwardShift(BitboardMyP & SecondSixthRanks) & empty; U; BitClear(sq, U)) { to = BSF(U); if (OnThirdRank(to) && Position->sq[Forward(to)] == 0) AddGain(List, (Backward(to) << 6) | Forward(to), EnumMyP, Forward(to)); AddGain(List, (Backward(to) << 6) | to, EnumMyP, to); } for (U = BitboardMyN; U; BitClear(sq, U)) { sq = BSF(U); T = AttN[sq] & empty; AddGainTo(T, EnumMyN); } for (U = BitboardMyBL; U; BitClear(sq, U)) { sq = BSF(U); T = AttB(sq) & empty; AddGainTo(T, EnumMyBL); } for (U = BitboardMyBD; U; BitClear(sq, U)) { sq = BSF(U); T = AttB(sq) & empty; AddGainTo(T, EnumMyBD); } for (U = BitboardMyR; U; BitClear(sq, U)) { sq = BSF(U); T = AttR(sq) & empty; AddGainTo(T, EnumMyR); } for (U = BitboardMyQ; U; BitClear(sq, U)) { sq = BSF(U); T = AttQ(sq) & empty; AddGainTo(T, EnumMyQ); } sq = MyKingSq; T = AttK[sq] & empty &(~OppAttacked); AddGainTo(T, EnumMyK); List->move = 0; Sort; return List;}
开发者ID:ZirconiumX,项目名称:Firenzina,代码行数:51,
示例10: DomainVector ADFun<Base>::Hessian(const Vector &x, const Vector &w){ size_t j; size_t k; size_t n = Domain(); // check Vector is Simple Vector class with Base type elements CheckSimpleVector<Base, Vector>(); CPPAD_ASSERT_KNOWN( size_t(x.size()) == n, "Hessian: length of x not equal domain dimension for f" ); CPPAD_ASSERT_KNOWN( size_t(w.size()) == Range(), "Hessian: length of w not equal range dimension for f" ); // point at which we are evaluating the Hessian Forward(0, x); // define the return value Vector hes(n * n); // direction vector for calls to forward Vector u(n); for(j = 0; j < n; j++) u[j] = Base(0); // location for return values from Reverse Vector ddw(n * 2); // loop over forward directions for(j = 0; j < n; j++) { // evaluate partials of entire function w.r.t. j-th coordinate u[j] = Base(1); Forward(1, u); u[j] = Base(0); // evaluate derivative of partial corresponding to F_i ddw = Reverse(2, w); // return desired components for(k = 0; k < n; k++) hes[k * n + j] = ddw[k * 2 + 1]; } return hes;}
开发者ID:barak,项目名称:CppAD-1,代码行数:50,
示例11: WdeSOPvoid WdeSOP( OBJPTR obj, OBJPTR parent ){ LIST *ilist, *tlist, *clist; WdeResInfo *info; RECT orect; OBJPTR sib; OBJ_ID id; bool clear; POINT origin; info = WdeGetCurrentRes(); if( info == NULL ) { return; } GetClientRect( info->edit_win, &orect ); GetOffset( &origin ); OffsetRect( &orect, origin.x, origin.y ); if( parent == NULL ) { GetObjectParent( obj, &parent ); if( parent == NULL ) { return; } } Forward( parent, GET_SUBOBJ_LIST, &tlist, NULL ); if( tlist != NULL && WdeFindObjectsInRect( &orect, &ilist, tlist ) && ilist != NULL ) { clist = NULL; tlist = NULL; for( ; ilist != NULL; ilist = ListConsume( ilist ) ) { sib = ListElement( ilist ); if( (Forward( sib, IS_OBJECT_CLEAR, &clear, NULL ) && clear) || (Forward( sib, IDENTIFY, &id, NULL ) && id == DIALOG_OBJ) ) { WdeInsertObject( &clist, sib ); } else { WdeInsertObject( &tlist, sib ); } } if( clist != NULL ) { WdeListConcat( &tlist, clist, 0 ); ListFree( clist ); } if( tlist != NULL ) { WdeReorderObjectWindows( tlist ); ListFree( tlist ); } }}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:50,
示例12: ForwardBackwardAdv Dtype ForwardBackwardAdv(const vector<Blob<Dtype>* > & bottom) { Dtype loss; Forward(bottom, &loss); Backward(); BackwardAdv(); return loss; }
开发者ID:taehoonlee,项目名称:caffe,代码行数:7,
示例13: DomainVector ADFun<Base>::Jacobian(const Vector &x){ size_t i; size_t n = Domain(); size_t m = Range(); CPPAD_ASSERT_KNOWN( size_t(x.size()) == n, "Jacobian: length of x not equal domain dimension for F" ); // point at which we are evaluating the Jacobian Forward(0, x); // work factor for forward mode size_t workForward = n; // work factor for reverse mode size_t workReverse = 0; for(i = 0; i < m; i++) { if( ! Parameter(i) ) ++workReverse; } // choose the method with the least work Vector jac( n * m ); if( workForward <= workReverse ) JacobianFor(*this, x, jac); else JacobianRev(*this, x, jac); return jac;}
开发者ID:iagomosqueira,项目名称:FLasher,代码行数:31,
示例14: DBGERRbool Transceiver::Onward(IMFrame & frame){ if ((frame.Header.DestinationId==myId) || (myId==0)) { return false; //this frame is for me } else { if (!Connected()) { DBGERR("&NOTCNT"); return true; } if (frame.Header.ReceiverId==myId) { if (frame.Forward()) Forward(frame); else { Backward(frame); } } else { DBGERR("&NOTMY"); } return true; }}
开发者ID:Slyb00ts,项目名称:imwave,代码行数:28,
示例15: WdeSetDialogModebool WdeSetDialogMode( WORD id ){ OBJPTR obj; WdeOrderMode mode; switch( id ) { case IDM_SET_ORDER: mode = WdeSetOrder; break; case IDM_SET_TABS: mode = WdeSetTabs; break; case IDM_SET_GROUPS: mode = WdeSetGroups; break; } if( (obj = WdeGetCurrentDialog()) != NULL ) { if( Forward( obj, SET_ORDER_MODE, &mode, NULL ) ) { return( TRUE ); } } return( FALSE );}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:25,
示例16: switchvoid FileViewList::mousePressEvent(QMouseEvent* e) { switch (e->button()) { case Qt::XButton1: emit Back(); break; case Qt::XButton2: emit Forward(); break; // enqueue to playlist with middleClick case Qt::MidButton: { QListView::mousePressEvent(e); // we need to update the menu selection menu_selection_ = selectionModel()->selection(); MimeData* data = new MimeData; data->setUrls(UrlListFromSelection()); data->enqueue_now_ = true; emit AddToPlaylist(data); break; } default: QListView::mousePressEvent(e); break; }}
开发者ID:Atrament666,项目名称:Clementine,代码行数:26,
示例17: ForwardBackward Dtype ForwardBackward(const vector<Blob<Dtype>* > & bottom) { Dtype loss; Forward(bottom, &loss); //LOG(INFO)<<"Forward done"; Backward(); return loss; }
开发者ID:Xiaomi2008,项目名称:Caffe_3D_FF,代码行数:7,
示例18: ReadDatavoid Net::Classify(const mxArray *mx_data, mxArray *&mx_pred) { //mexPrintMsg("Start classification..."); ReadData(mx_data); size_t test_num = data_.size1(); labels_.resize(test_num, layers_.back()->length_); labels_.reorder(true, false); size_t numbatches = DIVUP(test_num, params_.batchsize_); size_t offset = 0; Mat data_batch, pred_batch; for (size_t batch = 0; batch < numbatches; ++batch) { size_t batchsize = MIN(test_num - offset, params_.batchsize_); data_batch.resize(batchsize, data_.size2()); SubSet(data_, data_batch, offset, true); InitActiv(data_batch); Forward(pred_batch, 0); SubSet(labels_, pred_batch, offset, false); offset += batchsize; if (params_.verbose_ == 2) { mexPrintInt("Batch", (int) batch + 1); } } labels_.reorder(kMatlabOrder, true); mx_pred = mexSetMatrix(labels_); //mexPrintMsg("Classification finished");}
开发者ID:Geekrick88,项目名称:ConvNet,代码行数:26,
示例19: Expectationstatic double Expectation(DdNode **nodes_ex, int lenNodes) { int i; double rootProb, CLL = 0; for (i = 0; i < lenNodes; i++) { if (!Cudd_IsConstant(nodes_ex[i])) { nodesB = init_table(boolVars_ex[i]); nodesF = init_table(boolVars_ex[i]); Forward(nodes_ex[i], i); rootProb = GetOutsideExpe(nodes_ex[i], example_prob[i], i); if (rootProb <= 0.0) CLL = CLL + LOGZERO * example_prob[i]; else CLL = CLL + log(rootProb) * example_prob[i]; nodes_probs_ex[i] = rootProb; destroy_table(nodesB, boolVars_ex[i]); destroy_table(nodesF, boolVars_ex[i]); } else if (nodes_ex[i] == Cudd_ReadLogicZero(mgr_ex[i])) { CLL = CLL + LOGZERO * example_prob[i]; nodes_probs_ex[i] = 0.0; } else nodes_probs_ex[i] = 1.0; } return CLL;}
开发者ID:gokhansolak,项目名称:yap-6.3,代码行数:28,
示例20: firstvoid first(){ switch(condition) { case 0: lineTracking(); switch(sensor.middle_sensor) { case 0b00001111: case 0b00011111: case 0b00111111: case 0b01111111: case 0b00011110: case 0b00111110: condition = 1; break; } break; case 1: wheels.stop(); RightTurn(); break; case 2: CheckStop(); break; case 3: Forward(); break; case 4: BackToLine(); break; case 5: LeftTurn(); break; case 6: lineTracking(); if(sensor.front_sensor == 0b00111100 || sensor.front_sensor == 0b00011100 || sensor.front_sensor == 0b00111000) { wheels.forward(0,0); condition = 6; } break; }}
开发者ID:mayyuen318,项目名称:may,代码行数:35,
示例21: DomainVector ADFun<Base>::RevOne(const Vector &x, size_t i){ size_t i1; size_t n = Domain(); size_t m = Range(); // check Vector is Simple Vector class with Base type elements CheckSimpleVector<Base, Vector>(); CppADUsageError( x.size() == n, "RevOne: Length of x not equal domain dimension for f" ); CppADUsageError( i < m, "RevOne: the index i is not less than range dimension for f" ); // point at which we are evaluating the derivative Forward(0, x); // component which are are taking the derivative of Vector w(m); for(i1 = 0; i1 < m; i1++) w[i1] = 0.; w[i] = Base(1); // dimension the return value Vector dw(n); // compute the return value dw = Reverse(1, w); return dw;}
开发者ID:cran,项目名称:RMC,代码行数:35,
示例22: returnWdeDialogBoxInfo *WdeGetItemDBI( WdeResDlgItem *ditem ){ WdeDialogBoxInfo *dbi; WResID *name; if( ditem == NULL ) { return( FALSE ); } if( ditem->object != NULL ) { Forward( ditem->object, GET_OBJECT_INFO, NULL, &name ); if( name != NULL ) { name = WdeCopyWResID( name ); if( name != NULL ) { if( ditem->dialog_name != NULL ) { WRMemFree( ditem->dialog_name ); } ditem->dialog_name = name; } } dbi = WdeDBIFromObject( ditem->object ); if( dbi != NULL ) { if( ditem->dialog_info != NULL ) { WdeFreeDialogBoxInfo( ditem->dialog_info ); } ditem->dialog_info = dbi; } else { return( FALSE ); } } else { dbi = ditem->dialog_info; } return( dbi );}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:35,
示例23: GetAbsOriginvoid CASWEnvSpark::CreateSpark( void ){ CUtlReference<CNewParticleEffect> pEffect = CNewParticleEffect::CreateOrAggregate( NULL, "asw_env_sparks", GetAbsOrigin(), NULL ); if ( pEffect ) { pEffect->SetControlPoint( 0, GetAbsOrigin() ); pEffect->SetControlPointOrientation( 0, Forward(), -Left(), Up() ); pEffect->SetControlPoint( 2, Vector( GetRenderColorR(), GetRenderColorG(), GetRenderColorB() ) ); float flMagnitude = m_flMagnitude/100; float flElecReduction = 1.0f; float flCollide = (m_flPercentCollide/100); float flAmtElectrical = 0; if ( m_bElectrical ) { flAmtElectrical = flMagnitude; flElecReduction = 0.6; } pEffect->SetControlPoint( 3, Vector( ((1.0f-flCollide)* flMagnitude)*flElecReduction, (flCollide*flMagnitude)*flElecReduction, flMagnitude ) ); pEffect->SetControlPoint( 4, Vector( flAmtElectrical, 0, 0 ) ); //Msg( "Spark - Magnitude = %f/n", flMagnitude ); } if ( m_bPlaySound ) { EmitSound( "DoSpark" ); }}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:28,
示例24: mexGetNumelvoid Net::Classify(const mxArray *mx_data, Mat &pred) { //mexPrintMsg("Start classification..."); size_t mapnum = 1; if (mexIsCell(mx_data)) { mapnum = mexGetNumel(mx_data); } mexAssert(mapnum == layers_.front()->outputmaps_, "Data must have the same number of cells as outputmaps on the first layer"); std::vector< std::vector<Mat> > data(mapnum); for (size_t i = 0; i < mapnum; ++i) { const mxArray *mx_cell; if (mexIsCell(mx_data)) { mx_cell = mxGetCell(mx_data, i); } else { mx_cell = mx_data; } std::vector<size_t> data_dim = mexGetDimensions(mx_cell); mexAssert(data_dim.size() == 3, "The data array must have 3 dimensions"); mexAssert(data_dim[0] == layers_.front()->mapsize_[0] && data_dim[1] == layers_.front()->mapsize_[1], "Data and the first layer must have equal sizes"); mexGetMatrix3D(mx_cell, data[i]); } Forward(data, pred, false); //mexPrintMsg("Classification finished");}
开发者ID:andylulu,项目名称:ConvNet,代码行数:28,
示例25: jfolovoid jfolo(unsigned char count){ unsigned char junction_count=0; unsigned char timer=0; Forward(); // set motor move forward // sending display to lcd takes long time // junction reading and display less frequent. // use timer variable to count 20, then read once. while(junction_count<count){ //second junction timer++; if(timer>50){ timer=0; //clear timer motor(0,0); //slow down for lcd display do{ junction_count=LSA08_GetJunction(); //check junction count }while(ERR_FLAG||(junction_count>10)); //checking no uart error lcd_goto(0); lcd_putchar('J'); lcd_num(junction_count,3); } line_follow(); //PID line follow } Brake(); __delay_ms(200); }
开发者ID:CytronTechnologies,项目名称:Cytron_LSA08,代码行数:33,
示例26: pwm_init/*motor functions*/void pwm_init(void){ // Setting PWM frequency PR2 = 254; //setting of PWM frequency for a FOSC of 20MHZ T2CKPS1 = 0; T2CKPS0 = 1; // Timer 2 prescale = 4. CCPR1L = 0; // Duty cycle = 0; CCPR2L = 0; TMR2ON = 1; // Turn on Timer 2. //configuration for CCP1CON P1M1 = 0; //CCP1, P1A as single output P1M0 = 0; DC1B1 = 0; // 2 LSB of 10 PWM, make it 00 DC1B0 = 0; CCP1M3 = 1; // Configure CCP1 module to operate in PWM mode. CCP1M2 = 1; CCP1M1 = 0; CCP1M0 = 0; //configuration for CCP2CON CCP2X = 0; // 2 LSB of 10 PWM, make it 00 CCP2Y = 0; CCP2M3 = 1; // Configure CCP1 module to operate in PWM mode. CCP2M2 = 1; CCP2M1 = 0; CCP2M0 = 0; //motor foward Forward();}
开发者ID:CytronTechnologies,项目名称:Cytron_LSA08,代码行数:36,
注:本文中的Forward函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FoundTarget函数代码示例 C++ FormatVersion函数代码示例 |