CGeneticStrategyCLv2::CGeneticStrategyCLv2(const boost::filesystem::path& source, CAntCommonPtr<COUNTERS_TYPE> pAntCommon, CLabResultMulti<COUNTERS_TYPE, INPUT_TYPE>* res, CAntFitnesPtr fitnes, const std::vector< std::string >& strings, Tools::Logger& logger) :CGeneticStrategyCommon(pAntCommon, res, fitnes, strings, logger), mapsBuffer(0), buffer(0) { logger << "[INIT] Initializing CGeneticStrategyCLv2.\n"; m_pRandom = CRandomPtr( new CRandomImpl() ); setFromStrings( strings, m_pRandom ); stateSize = 16;//1 << statesCount; initMemory(); try { logger << "[INIT] Trying to get specified device.\n"; context = cl::Context( deviceType, 0 ); devices = context.getInfo<CL_CONTEXT_DEVICES>(); queue = cl::CommandQueue( context, devices[0] ); deviceInfo.setDeviceInfo(devices[0]()); std::string options; countRanges( options ); createProgram( source, options ); initCLBuffers(); logger << "[SUCCES] CGeneticStrategyCLv2 created.\n"; }catch ( cl::Error& error ) { Tools::throwDetailedFailed( "Failed to create CGeneticStrategyCLv2", streamsdk::getOpenCLErrorCodeStr( error.err() ), &logger ); }catch ( std::runtime_error& err ) { throw std::runtime_error( std::string( "Failed to create GeneticStrategy: " ).append( err.what() )); } }
void init_memory(void) { // デバッグ出力は、OutputDebugString を使う //hmd_set_debug_out_mode(HMD_DEBUG_OUT_ODS); // デバッグ出力は、標準出力を使う hmd_set_debug_out_mode(HMD_DEBUG_OUT_STD); // メインメモリ初期化 mainMem = HMD_ALLOC(mainMemSize); HMD_ASSERT(mainMem != NULL); initMemory(mainMem, mainMemSize); // デバッグメモリ初期化 if (bReadDebugInfos) { if (debugMemSize == 0) debugMemSize = 4 * 1024 * 1024; } if (debugMemSize > 0) { debugMem = HMD_ALLOC(debugMemSize); if (debugMem == NULL) debugMemSize = 0; else initializeDebug(debugMem, debugMemSize); } }
void MotionCore::init() { if (type_ == CORE_INIT) { FrameInfoBlock *frame_info; memory_.getBlockByName(frame_info,"frame_info"); if (frame_info->source == MEMORY_SIM) { std::cout << "MOTION CORE: SIM" << std::endl; type_ = CORE_SIM; } else if (frame_info->source == MEMORY_ROBOT) { std::cout << "MOTION CORE: ROBOT" << std::endl; type_ = CORE_ROBOT; } else { std::cerr << "Unknown memory type when init vision core" << std::endl; exit(1); } } inst_ = this; setMemoryVariables(); initMemory(); initModules(); fps_time_ = frame_info_->seconds_since_start; time_motion_started_ = frame_info_->seconds_since_start; }
void RAM::notify(OEComponent *sender, int notification, void *data) { if (powerState == CONTROLBUS_POWERSTATE_OFF) initMemory(); powerState = *((ControlBusPowerState *)data); }
bool RAM::init() { if ((size != getNextPowerOf2(size)) || (!size)) { logMessage("invalid value for size"); return false; } if (controlBus) controlBus->postMessage(this, CONTROLBUS_GET_POWERSTATE, &powerState); if (!powerOnPattern.size()) powerOnPattern.resize(1); else powerOnPattern.resize((size_t) getNextPowerOf2((int) powerOnPattern.size())); size_t oldSize = data.size(); data.resize((size_t) size); if (oldSize == 0) initMemory(); datap = &data.front(); mask = size - 1; return true; }
Vacuum::Vacuum(World world, int X, int Y) { x = X; y = Y; int worldX = world.rowCount(); int worldY = world.colCount(); initMemory(worldX, worldY); }
// Constructors Vacuum::Vacuum(World world) { x = 0; y = 0; int worldX = world.rowCount(); int worldY = world.colCount(); initMemory(worldX, worldY); }
Projection_GPU::Projection_GPU(int width, int height, const cv::Mat intrinsic){ this->width = width; this->height = height; //dim = new ApplyRigidTransform(); dim = new DimensionConvertor(); dim->setCameraParameters(intrinsic, width, height); initMemory(); initNormalized3D(); }
void TestNewString(CuTest *tc) { char * myString; initMemory(); CuAssertIntEquals(tc, 0, getNumStrings()); myString = newString(10); CuAssertIntEquals(tc, 1, getNumStrings()); CuAssertTrue(tc, (myString[0] == NULL)); }
static void gitMain (const git_uint8 * game, git_uint32 gameSize, git_uint32 cacheSize, git_uint32 undoSize) { git_uint32 version; enum IOMode ioMode = IO_NULL; init_accel (); // Initialise the Glk dispatch layer. git_init_dispatch(); // Set various globals. gPeephole = 1; gDebug = 0; // Load the gamefile into memory // and initialise undo records. initMemory (game, gameSize); initUndo (undoSize); // Check that we're compatible with the // glulx spec version that the game uses. version = memRead32 (4); if (version == 0x010000 && version <= 0x0100FF) { // We support version 1.0.0 even though it's // officially obsolete. The only significant // difference is the lack of I/O modes. In 1.0, // all output goes directly to the Glk library. ioMode = IO_GLK; } else if (version == 0x020000 && version <= 0x0200FF) { // We support version 2.0, which most people currently use. } else if (version >= 0x030000 && version <= 0x0300FF) { // We support version 3.0, which adds Unicode functionality. } else if (version >= 0x030100 && version <= 0x0301FF) { // We support version 3.1, which adds some memory-management opcodes. } else { fatalError ("Can't run this game, because it uses a newer version " "of the gamefile format than Git understands. You should check " "whether a newer version of Git is available."); } // Call the top-level function. startProgram (cacheSize, ioMode); // Shut everything down cleanly. shutdownUndo(); shutdownMemory(); }
int _init(int n, size_t size) { if (checkInitParameters(n, size) != TRUE) return -1; initManagerParams(n, size); initMemory(); initPageTable(); initSwap(); return 0; }
/** * Constructor. */ QuantIterPlier::QuantIterPlier(QuantPlierParams &plierParams) : QuantPlierBase(plierParams) { initMemory(); setupSelfDoc(*this); m_Type = getDocName(); // this is bogus -- we dont know how much we need! // Initialize memory buffers. // allocMemory(100, 50); setUsePrecompFeatureEffects(false); }
// Anything that needs to be initiated should go here void BNS() { // Start Heap initMemory(); // Start random number generation srand(nSysTime); // Output version number writeDebugStreamLine("*** Loaded BNSLib V0.15.0 for RobotC 4.27 ***"); }
void init() { initMemory(); //Init backgrounds // Main 3D init3DSettings(); // Main Map: mapEngine = new MapEngine(1, 4, 1); // Main Console: consoleInit(&main_console,3,BgType_ExRotation, BgSize_ER_256x256, 31, 0, true, false); bg3 = main_console.bgId; bgSetCenter(bg3, 254, 0); bgSetRotate(bg3, -8192); // Sub Console: consoleInit(&sub_console,3,BgType_ExRotation, BgSize_ER_256x256, 31, 1, false, false); bg3Sub = sub_console.bgId; bgSetCenter(bg3Sub, 254, 0); bgSetRotate(bg3Sub, -8192); // Sub Image: bg2Sub = bgInitSub(2, BgType_Bmp8, BgSize_B8_256x256, 4,0); dmaCopy(leftmenuBitmap, bgGetGfxPtr(bg2Sub), 256*192); dmaCopy(leftmenuPal, BG_PALETTE_SUB, leftmenuPalLen); // Init Sprites oamInit(&oamMain, SpriteMapping_1D_128, false); // Set the priorities bgSetPriority(0,1); bgSetPriority(1,2); bgSetPriority(2,3); bgSetPriority(3,0); bgSetPriority(bg3Sub, 2); bgSetPriority(bg2Sub, 3); //Init font font.gfx = (u16*)fontTiles; font.pal = (u16*)fontPal; font.numChars = 95; font.numColors = fontPalLen / 2; font.bpp = 8; font.asciiOffset = 32; font.convertSingleColor = false; consoleSetFont(&main_console, &font); consoleSetFont(&sub_console, &font); consoleSelect(&main_console); iprintf("\x1b[2J"); iprintf("Arkham Tower v0.01"); consoleSelect(&sub_console); iprintf("\x1b[2J"); }
void main(void) { initFileTable(); initProcess(0,0); initMemory(); APIRET rc; PVOID pv; rc = DosAllocSharedMem(&pv, "\\SHAREMEM\\Ivan", 8192, PAG_COMMIT|PAG_READ|PAG_WRITE); if(rc==0) rc = DosFreeMem(pv); printf("rc=%d\n",rc); }
void initWicBasics(int argc, char *argv[], float dummy) { dummy = dummy; /* Dummy argument to include floating point routines */ initMemory(); initWicResources(argv[0]); initDebug(); g_commentList = createSLList(); g_dirList = createSLList(); g_logList = createSLList(); g_currPos = NULL; getCmdLineOptions(argc, argv); initHashTable(); initOutputSystem(); }
void Problem::setInit() { sourceY = 0; memX = 0; memY = 0; smSwitch = false; pushShift = false; pushEnter = false; myInput = NULL; setSource(); initSource(); initMemory(); }
void memsweep_domain(int domainId) { char* ptr = NULL; size_t size = numa_info.nodes[domainId].totalMemory * 1024ULL * memoryFraction / 100ULL; printf("Sweeping domain %d: Using %g MB of %g MB\n", domainId, size / (1024.0 * 1024.0), numa_info.nodes[domainId].totalMemory/ 1024.0); ptr = (char*) allocateOnNode(size, domainId); initMemory(size, ptr, domainId); cleanupCache(ptr); munmap(ptr, size); }
Projection_GPU::Projection_GPU(int width, int height, const cv::Mat intrinsic){ this->width = width; this->height = height; //�œ_����focal_length Fx = (float)intrinsic.at<double>(0, 0); Fy = (float)intrinsic.at<double>(1, 1); //�摜���S Cx = (int)intrinsic.at<double>(0, 2); Cy = (int)intrinsic.at<double>(1, 2); initMemory(); initNormalized3D(); SpatialFilter_Host = new float[WindowSize*WindowSize]; cudaMalloc(&SpatialFilter_Device, sizeof(float)*WindowSize*WindowSize); calcSpatialFilter(); }
void init (void) { setSignals(); initscr(); cbreak(); noecho(); nonl(); idlok(stdscr, TRUE); keypad(stdscr, TRUE); initStack(); initMemory(); srand48(37); }
int main(int argc, char** argv) { //srand(getpid()); //srand48(getpid()); srand(0); srand48(0); properties props = TrainParameters(&argc, &argv); if (argc != 3) { printInstructions(); return 4; } char * data_file = argv[1]; char * data_model = argv[2]; svm_dataset dataset = readTrainFile(data_file); printf("\nDataset Loaded from file: %s\n\nTraining samples: %d\nNumber of features: %d\n\n",data_file, dataset.l,dataset.maxdim); struct timeval tiempo1, tiempo2; omp_set_num_threads(props.Threads); printf("Running IRWLS\n"); gettimeofday(&tiempo1, NULL); initMemory(props.Threads,(props.MaxSize+1)); double * W = trainFULL(dataset,props); gettimeofday(&tiempo2, NULL); printf("\nWeights calculated in %ld\n\n",((tiempo2.tv_sec-tiempo1.tv_sec)*1000+(tiempo2.tv_usec-tiempo1.tv_usec)/1000)); model modelo = calculateModel(props, dataset, W); printf("Saving model in file: %s\n\n",data_model); FILE *Out = fopen(data_model, "w+"); storeModel(&modelo, Out); fclose(Out); return 0; }
void SuperpixelSegmentation::SetParametor(int rows, int cols){ //number of clusters ClusterNum.x = cols; ClusterNum.y = rows; //grid(window) size Window_Size.x = width/cols; Window_Size.y = height/rows; //Init GPU memory initMemory(); //Random colors for(int i=0; i<ClusterNum.x*ClusterNum.y; i++){ int3 tmp; tmp.x = rand()%255; tmp.y = rand()%255; tmp.z = rand()%255; RandomColors[i] = tmp; } }
CodeSection *initCodeSection(SymbolTablePtr symbolTable) { CodeSection *codeSection; int i; codeSection = (CodeSection *)malloc(sizeof(CodeSection)); codeSection->symbolTable = symbolTable; codeSection->memory = initMemory(); codeSection->codeBaseAddress = BASE_ADDRESS; codeSection->memoryType = (MemoryType *)malloc(sizeof(MemoryType) * MAX_MEMORY_SIZE); codeSection->externalSymbols = initList(NodeType_SymbolLocation); for (i = 0; i < MAX_MEMORY_SIZE; i++) { codeSection->memoryType[i] = MemoryType_Unknown; } return codeSection; }
void TestAddAndRemoveStrings(CuTest *tc) { char string1[] = "top expert\0"; char string2[] = "talented sans fellow\0"; char string3[] = "hotel california\0"; char *strPtr1, *strPtr2, *strPtr3; initMemory(); strPtr1 = newString(strlen(string1)); CuAssertIntEquals(tc, 1, getNumStrings()); strcpy(strPtr1, string1); strPtr2 = newString(strlen(string2)); CuAssertIntEquals(tc, 2, getNumStrings()); strcpy(strPtr2, string2); strPtr3 = newString(strlen(string3)); CuAssertIntEquals(tc, 3, getNumStrings()); strcpy(strPtr3, string3); CuAssertIntEquals(tc, 3, getNumStrings()); CuAssertStrEquals(tc, string1, string1); }
void main(void) { deInitClock(); deInitGPIO(); CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_HSI); CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_16); initDigitalControls(); initAnalogControls(); GPIO_Init(GPIOF, GPIO_Pin_0, GPIO_Mode_In_FL_IT); EXTI_SetPinSensitivity(EXTI_Pin_0, EXTI_Trigger_Rising); enableInterrupts(); initMemory(); while (1) { halt(); } }
void A4MemoryBank::consumeImage(IplImage *aimage, int resizeFactor) { CvSize currentSize = cvGetSize(aimage); currentSize.width -= currentSize.width%resizeFactor; currentSize.height -= currentSize.height%resizeFactor; if(currentSize.height != mainSize.height || currentSize.width != mainSize.width) initMemory(currentSize, resizeFactor); //TODO: make this part more efficient if(aimage->width%resizeFactor != 0 || aimage->height%resizeFactor != 0) { printf("DEBUG: Image formated to be divisable by %d\n", resizeFactor); IplImage *tmpRed = cvCreateImage(cvSize(aimage->width, aimage->height), IPL_DEPTH_8U, 1); IplImage *tmpGreen = cvCreateImage(cvSize(aimage->width, aimage->height), IPL_DEPTH_8U, 1); IplImage *tmpBlue = cvCreateImage(cvSize(aimage->width, aimage->height), IPL_DEPTH_8U, 1); cvSplit(aimage, tmpRed, tmpGreen, tmpBlue, NULL); cvResize(tmpRed, redChannel); cvResize(tmpGreen, greenChannel); cvResize(tmpBlue, blueChannel); cvReleaseImage(&tmpRed); cvReleaseImage(&tmpGreen); cvReleaseImage(&tmpBlue); } else { cvSplit(aimage, redChannel, greenChannel, blueChannel, NULL); //FIXME: aimage -> image (rgb) } cvResize(redChannel, redChannelResized); cvResize(greenChannel, greenChannelResized); cvResize(blueChannel, blueChannelResized); //TODO: move it in separate processor cvSmooth(redChannelResized, redChannelResized, CV_MEDIAN, 3); cvSmooth(greenChannelResized, greenChannelResized, CV_MEDIAN, 3); cvSmooth(blueChannelResized, blueChannelResized, CV_MEDIAN, 3); }
void NormalAdaptiveSuperpixel::SetParametor(int rows, int cols, cv::Mat_<double> intrinsic){ //number of clusters ClusterNum.x = cols; ClusterNum.y = rows; //grid(window) size Window_Size.x = width/cols; Window_Size.y = height/rows; //Init GPU memory initMemory(); //Random colors for(int i=0; i<ClusterNum.x*ClusterNum.y; i++){ int3 tmp; tmp.x = rand()%255; tmp.y = rand()%255; tmp.z = rand()%255; RandomColors[i] = tmp; } ////////////////////////////////Virtual////////////////////////////////////////// //set intrinsic mat cv::Mat_<float> intr; intrinsic.convertTo(intr, CV_32F); Intrinsic_Device.upload(intr); }
int init (int argc, char *argv[]) { if (BlockSize > MAX_BLOCK_SIZE) { return myError("Block size too big"); } NumRows = BlockSize / u8S_PER_ROW; setSignals(); initscr(); cbreak(); noecho(); nonl(); intrflush(stdscr, FALSE); //idlok(stdscr, TRUE); keypad(stdscr, TRUE); initStack(); initMemory(); Initialized = TRUE; return 0; }
int main(){ char string[] = "istore 12 32"; char *ptr; ptr = strtok(string, delimiter); while(ptr != NULL) { printf("Abschnitt gefunden: %s\n", ptr); ptr = strtok(NULL, delimiter); } FILE *fp; int i, temp; fp = fopen("test.ovm", "r"); if(fp == NULL) { printf("Datei konnte nicht geöffnet werden.\n"); }else { while((temp = fgetc(fp))!=EOF) { printf("%c ", temp); } fclose(fp); } printf("\n"); stackT s1; memoryT m1; initStack(&s1, 10); initMemory(&m1, 10); push(&s1, 'Z'); set(&m1, 'L', 2); while(!emptyStack(&s1)){ printf("%c", pop(&s1)); } printf("%c", get(&m1, 2)); return 0; }
// --- MAIN --- int main() { char choice; int device_id; int aux_int; short int aux_sint; unsigned char aux_uchar; float pid_control[3]; short int offsets[NUM_OF_SENSORS]; assert(open_port()); printMainMenu(); scanf("%c", &choice); printf("choice: %c\n", choice); switch(choice) { case 'g': get_or_set = choice; break; case 's': get_or_set = choice; break; case 'm': initMemory(); break; case 'c': calibrate(); break; default: break; } if (get_or_set == 'g' || get_or_set == 's') { printParamMenu(); scanf(" %c", &choice); if (get_or_set == 's') { switch(choice) { // Set new ID case 'i': printf("Choose a new ID: "); scanf("%d", &device_id); commSetParam(&comm_settings_t, BROADCAST_ID, PARAM_ID, &device_id, 1); usleep(100000); commStoreDefaultParams(&comm_settings_t, BROADCAST_ID); usleep(500000); break; // Set new PID parameters case 'k': printf("Set the new values for the PID controller:\nK_p: "); scanf("%f", pid_control); printf("K_i: "); scanf("%f", pid_control + 1); printf("K_d: "); scanf("%f", pid_control + 2); commSetParam(&comm_settings_t, BROADCAST_ID, PARAM_PID_CONTROL, pid_control, 3); usleep(100000); commStoreDefaultParams(&comm_settings_t, BROADCAST_ID); usleep(500000); break; // Set startup activation flag case 'a': printf("Do you want the motor to be ON [1] or OFF [0] at startup?: "); scanf("%d", &aux_int); if (aux_int == 0) { aux_uchar = 0; commSetParam(&comm_settings_t, BROADCAST_ID, PARAM_STARTUP_ACTIVATION, &aux_uchar, 1); } else { aux_uchar = 3; commSetParam(&comm_settings_t, BROADCAST_ID, PARAM_STARTUP_ACTIVATION, &aux_uchar, 1); } commStoreDefaultParams(&comm_settings_t, BROADCAST_ID); break; case 'm': break; case 's': break; case 'o': printf("Set the new offsets:\n"); printf("Offset 1: "); scanf("%hd", &aux_sint); offsets[0] = aux_sint; printf("Offset 2: "); scanf("%hd", &aux_sint); offsets[1] = aux_sint; printf("Offset 3: "); scanf("%hd", &aux_sint); offsets[2] = aux_sint; commSetParam(&comm_settings_t, BROADCAST_ID, PARAM_MEASUREMENT_OFFSET, offsets, NUM_OF_SENSORS); usleep(100000); commStoreDefaultParams(&comm_settings_t, BROADCAST_ID); usleep(1000000); break; case 'u': break; case 'f': break; case 'l': break; } } else { switch(choice) { case 'i': break; case 'k': break; case 'a': break; case 'm': break; case 's': break; case 'o': break; case 'u': break; case 'f': break; case 'l': break; } } } return 1; }