void dgSolver::CalculateJointForces(const dgBodyCluster& cluster, dgBodyInfo* const bodyArray, dgJointInfo* const jointArray, dgFloat32 timestep) { m_cluster = &cluster; m_bodyArray = bodyArray; m_jointArray = jointArray; m_timestep = timestep; m_invTimestep = (timestep > dgFloat32(0.0f)) ? dgFloat32(1.0f) / timestep : dgFloat32(0.0f); m_invStepRK = dgFloat32 (0.25f); m_timestepRK = m_timestep * m_invStepRK; m_invTimestepRK = m_invTimestep * dgFloat32 (4.0f); m_threadCounts = m_world->GetThreadCount(); m_solverPasses = m_world->GetSolverIterations(); dgInt32 mask = -dgInt32(DG_SOA_WORD_GROUP_SIZE - 1); m_jointCount = ((m_cluster->m_jointCount + DG_SOA_WORD_GROUP_SIZE - 1) & mask) / DG_SOA_WORD_GROUP_SIZE; m_bodyProxyArray = dgAlloca(dgBodyProxy, cluster.m_bodyCount); m_bodyJacobiansPairs = dgAlloca(dgBodyJacobianPair, cluster.m_jointCount * 2); m_soaRowStart = dgAlloca(dgInt32, cluster.m_jointCount / DG_SOA_WORD_GROUP_SIZE + 1); InitWeights(); InitBodyArray(); InitJacobianMatrix(); CalculateForces(); }
bool LeeRoutePlannerImpl::EndAddPoints( void ) { bool bSuccess=false; m_width=abs(m_maxX-m_minX)+m_border*2; m_height=abs(m_maxY-m_minY)+m_border*2; assert(m_height>0); assert(m_width>0); bSuccess=m_width>0 && m_height>0; if ( bSuccess ) { grid_vertices_size_type i, numvertices; numvertices=grid_vertices_size_type((m_width+1) * (m_height+1)); for (i=0; i<numvertices; i++) add_vertex(m_graph); assert(numvertices==num_vertices(m_graph)); bSuccess=numvertices==num_vertices(m_graph); if ( bSuccess ) { AddAllEdges(); InitWeights(); m_bgrid=true; } } return bSuccess; }
__fastcall TNeyron::TNeyron(int cnt_inputs, vector<TNeyron*> &Layer) { w.resize(cnt_inputs); s.resize(cnt_inputs); sn.resize(cnt_inputs); InitWeights(); InitSinaps(Layer); }
FILTER *CreateFilter(uint64_t size, uint64_t drop, uint8_t type, double threshold){ FILTER *FIL = (FILTER *) Calloc(1, sizeof(FILTER)); FIL->size = size; FIL->drop = drop; FIL->type = type; FIL->threshold = threshold; FIL->weights = (ENTP *) Malloc((2*FIL->size+1) * sizeof(ENTP)); InitWeights(FIL); FIL->entries = NULL; FIL->bases = NULL; return FIL; }
int main() { fl_reading_personality = 0; fl_separate_books = 0; // opening book files can be defined in a personality description fl_elo_slider = 0; time_percentage = 100; use_book = 1; panel_style = 0; verbose = 1; hist_limit = 24576; hist_perc = 175; Timer.Init(); BB.Init(); Mask.Init(); Init(); InitWeights(); Param.Default(); Param.DynamicInit(); InitSearch(); #ifdef _WIN32 || _WIN64 // if we are on Windows search for books and settings in same directory as rodentII.exe MainBook.bookName = "books/rodent.bin"; GuideBook.bookName = "books/guide.bin"; ReadPersonality("basic.ini"); #elif __linux || __unix // if we are on Linux // first check, if compiler got told where books and settings are stored #ifdef BOOKPATH char path[255]; // space for complete path and filename char nameMainbook[20] = "/rodent.bin"; char nameGuidebook[20]= "/guide.bin"; char namePersonality[20]= "/basic.ini"; // process Mainbook strcpy(path, ""); // first clear strcpy(path, STR(BOOKPATH)); // copy path from c preprocessor here strcat(path, nameMainbook); // append bookname MainBook.bookName = path; // store it // process Guidebook strcpy(path, ""); strcpy(path, STR(BOOKPATH)); strcat(path, nameGuidebook); GuideBook.bookName = nameGuidebook; // process Personality file strcpy(path, ""); strcpy(path, STR(BOOKPATH)); strcat(path, namePersonality); ReadPersonality(path); #else // if no path was given than we assume that files are stored at /usr/share/rodentII MainBook.bookName = "/usr/share/rodentII/rodent.bin"; GuideBook.bookName = "/usr/share/rodentII/guide.bin"; ReadPersonality("/usr/share/rodentII/basic.ini"); #endif #else // a platform we have not tested yet. We assume that opening books and // settings are stored within the same directory. Similiar to Windows. printf("Platform unknown. We assume that opening books and settings are stored within RodentII path"); MainBook.bookName = "books/rodent.bin"; GuideBook.bookName = "books/guide.bin"; ReadPersonality("basic.ini"); #endif MainBook.OpenPolyglot(); GuideBook.OpenPolyglot(); UciLoop(); MainBook.ClosePolyglot(); GuideBook.ClosePolyglot(); return 0; }
Neuron::Neuron(unsigned int num_inputs) : num_inputs_(num_inputs), inputs_(NULL), weights_(NULL), weight_diffs_(NULL), activation_function_(NULL) { InitWeights(num_inputs); }