void magnetic_field_estimator(vector v_B_o) { float time_in_years = 2015 + (float)seconds_since_pivot / SECONDS_IN_YEAR; vector v_temp, v_r_lla, v_B_ned, v_B_eci; eci2ecef(v_r, v_temp); ecef2lla(v_temp, v_r_lla);// LLA is need ///* Save LLA vector for use in communications check routine copy_vector(v_r_lla, v_sat);// why is this required when ,lat long alt coming from GPS igrf(v_r_lla, time_in_years, 8, v_B_ned);// need to check at the end ned2ecef(v_B_ned, v_r_lla, v_temp); ecef2eci(v_temp, v_B_eci); eci2orbit(v_r, v_v, v_B_eci, v_B_o); scalar_into_vector(v_B_o, 1e-9); // igrf gives in nT int8_t sen,sen1; int16_t st; /*for (int i=0;i<3;i=i+1) { //sen = ((int8_t)((lambda))/2); st =(int16_t)(v_B_eci[i]/10); sen = (int8_t)st; sen1 = (int8_t)(st>>8); transmit_UART0(sen); transmit_UART0(sen1); }*/ }
void no_horizontall_wall_move(int krp, int x, int y, int nc, int nm) { int zx, zy; double vx, vy, wt; VECTOR wally; double part1, part2; PARTICLE *p; p = &(camera[krp][x][y][nc][nm]); zx = ((p->v.x) > 0)?1:-1; zy = 0; copy_vector(&p->v, &wally); wally.y *= (-1.0); vx = fabs(p->v.x); vy = fabs(p->v.y); wt = p->weight / (SIZEX * SIZEY); part1 = (SIZEX - vx * dtp_var[krp]) * (SIZEY - vy * dtp_var[krp]) * wt; part2 = vx * dtp_var[krp] * (SIZEY - vy * dtp_var[krp]) * wt; p->weight = part1; move_particle_to_buf(p, &(buf[x+zx][y][nm]), &(p->v), part2); }
void horizontall_wall_move(int krp, int x, int y, int nc, int nm) { int zx, zy; double vx, vy, wt; VECTOR wally; double part1, part2, part3, part4; PARTICLE *p; p = &(camera[krp][x][y][nc][nm]); zx = ((p->v.x) > 0)?1:-1; zy = 0; copy_vector(&p->v, &wally); wally.y *= (-1.0); // wally.x *= Procrustes; // wally.z *= Procrustes; vx = fabs(p->v.x); vy = fabs(p->v.y); wt = p->weight / (SIZEX * SIZEY); part1 = (SIZEX - vx * dtp_var[krp]) * (SIZEY - vy * dtp_var[krp]) * wt; part2 = vx * dtp_var[krp] * (SIZEY - vy * dtp_var[krp]) * wt; part3 = (SIZEX - vx * dtp_var[krp]) * vy * dtp_var[krp] * wt; part4 = vx * dtp_var[krp] * vy * dtp_var[krp] * wt; p->weight = part1; //p->reflect_field = 0; move_particle_to_buf(p, &(buf[x+zx][y][nm]), &(p->v), part2); move_particle_to_buf(p, &(buf[x][y+zy][nm]), &wally, part3); move_particle_to_buf(p, &(buf[x+zx][y+zy][nm]), &wally, part4); }
/// Copy vector from builtin backend. static boost::shared_ptr<vector> copy_vector( boost::shared_ptr< typename builtin<value_type>::vector > x, const params &prm ) { return copy_vector(*x, prm); }
const std::vector <shared_ptr <component> > text::getChildComponents() { std::vector <shared_ptr <component> > list; copy_vector(m_words, list); return (list); }
const std::vector <ref <component> > body::getChildComponents() { std::vector <ref <component> > list; copy_vector(m_parts, list); return (list); }
const std::vector <ref <component> > header::getChildComponents() { std::vector <ref <component> > list; copy_vector(m_fields, list); return (list); }
const std::vector <shared_ptr <component> > addressList::getChildComponents() { std::vector <shared_ptr <component> > list; copy_vector(m_list, list); return (list); }
/// Copy vector from builtin backend. static std::shared_ptr<vector> copy_vector( std::shared_ptr< typename builtin<real>::vector > x, const params &prm ) { return copy_vector(*x, prm); }
const std::vector <ref <component> > mailboxGroup::getChildComponents() { std::vector <ref <component> > list; copy_vector(m_list, list); return (list); }
void DrawModel( const PorousModel& model ) { const static FPoint radius( 0.5, 0.5, 0.5 ); static Point<long> pnt; static Point<ulong> sz; static FPoint center, p; GLfloat material[3]; COLORREF color; GLUquadric *q = gluNewQuadric(); sz = model.GetSize(); center.Init( 0.5f*sz.x, 0.5f*sz.y, 0.5f*sz.z ); double volume = double(sz.x)*sz.y*sz.z; int quality; if( volume < 1e6 ) quality = 10; else if ( volume < 1e9 ) quality = 5; else quality = 3; for( pnt.x = 0; pnt.x < long(sz.x); ++pnt.x ) for( pnt.y = 0; pnt.y < long(sz.y); ++pnt.y ) for( pnt.z = 0; pnt.z < long(sz.z); ++pnt.z ) if( model.GetCellColor( pnt, &color ) ) { material[0] = float(GetRValue(color))/0xFF; material[1] = float(GetGValue(color))/0xFF; material[2] = float(GetBValue(color))/0xFF; glMaterialfv( GL_FRONT, GL_DIFFUSE, material ); copy_vector( p, pnt ); p += radius; p -= center; glTranslatef( p.x, -p.z, -p.y ); gluSphere( q, 0.7, quality, quality ); glTranslatef( -p.x, p.z, p.y ); } //material[0] = material[1] = 1.0f; //material[2] = 0.0f; //glMaterialfv( GL_FRONT, GL_DIFFUSE, material ); //glTranslatef( -sz.x/5, sz.z/5, 0 ); //gluSphere( q, 1, 10, 10 ); //glTranslatef( sz.x/5, -sz.z/5, 0 ); //gluDeleteQuadric( q ); }
/* This function returns the unitary vector from * an input vector */ struct vector unitary_vector(struct vector v) { double aux=module(v); if(aux==1) return copy_vector(v); struct vector w=create_vector(v.dimension); unsigned int i; for (i = 0; i < v.dimension; i++) w.vec[i]=v.vec[i]/aux; return w; }
void x_move(int krp, int x, int y, int nc, int nm) { int zx; // double fvel = 446.11; // double dvel = 282.23; double vx; VECTOR newVX; double part1, part2, wt; PARTICLE *p, *b; p = &(camera[krp][x][y][nc][nm]); zx = ((p->v.x) > 0) ? (1) : (-1); copy_vector(&(p->v), &newVX); vx = fabs(p->v.x); wt = p->weight; part2 = (vx * dtp/SIZEX)*wt; part1 = (wt - part2); p->weight = part1; if (((KX - 1) == x) && (zx > 0)) { zx = 0; newVX.x *= (-1.0); rvelc(&(newVX.y),&(newVX.z), sqrt(2.0*K*temp[0]/mass[0])); } if ((0 == x) && (zx < 0)) { zx = 0; newVX.x = get_shock_wave(); rvelc(&(newVX.y),&(newVX.z), sqrt(2.0*K*temp[0]/mass[0])); } b = &(buf[(x+zx)][y][nm]); b->weight += part2; if (frand() < (part2 / (b->weight))) { copy_vector(&newVX, &(b->v)); b->mass = p->mass; b->diam = p->diam; b->rot_energy = p->rot_energy; } }
text* text::decodeAndUnfold(const parsingContext& ctx, const string& in, text* generateInExisting) { text* out = (generateInExisting != NULL) ? generateInExisting : new text(); out->removeAllWords(); const std::vector <ref <word> > words = word::parseMultiple(ctx, in, 0, in.length(), NULL); copy_vector(words, out->m_words); return (out); }
uint8_t cm_straight_probe(float target[], bool flags[]) { // trap zero feed rate condition if (fp_ZERO(cm.gm.feed_rate)) { return (STAT_GCODE_FEEDRATE_NOT_SPECIFIED); } // error if no axes specified if (!flags[AXIS_X] && !flags[AXIS_Y] && !flags[AXIS_Z]) { return (STAT_GCODE_AXIS_IS_MISSING); } // set probe move endpoint copy_vector(pb.target, target); // set probe move endpoint copy_vector(pb.flags, flags); // set axes involved on the move clear_vector(cm.probe_results); // clear the old probe position. // NOTE: relying on probe_result will not detect a probe to 0,0,0. cm.probe_state = PROBE_WAITING; // wait until planner queue empties before completing initialization pb.func = _probing_init; // bind probing initialization function return (STAT_OK); }
/* NB. This only copies the hash, NOT the structures or whatever * which might be pointed to by keys/values in the hash. Beware. */ hash copy_hash (pool pool, hash h) { hash new_h; int b, i; new_h = c2_pmalloc (pool, sizeof *new_h); new_h->pool = pool; new_h->key_size = h->key_size; new_h->value_size = h->value_size; new_h->buckets = copy_vector (pool, h->buckets); /* Copy the buckets. */ for (b = 0; b < vector_size (new_h->buckets); ++b) { vector v; vector_get (new_h->buckets, b, v); if (v) { v = copy_vector (pool, v); vector_replace (new_h->buckets, b, v); /* Copy the keys/values in this vector. */ for (i = 0; i < vector_size (v); ++i) { struct hash_bucket_entry entry; vector_get (v, i, entry); entry.key = pmemdup (pool, entry.key, h->key_size); entry.value = pmemdup (pool, entry.value, h->value_size); vector_replace (v, i, entry); } } } return new_h; }
void keyboard (unsigned char key, int x, int y) { vector *vec = camera_direction(-state.camera.pitch, state.camera.yaw, state.camera.roll); vector *move = malloc_vector(); copy_vector(move, vec); scale(vec, 10); rotate(move, 0, 90, 0); printf("pitch: %f, yaw: %f\n", state.camera.pitch, state.camera.yaw); switch(key) { case 'q': exit(0); break; case 'w': state.camera.x += vec->data[0]; state.camera.y += vec->data[1]; state.camera.z += vec->data[2]; break; case 'a': state.camera.x += 10*move->data[0]; state.camera.z += 10*move->data[2]; break; case 's': state.camera.x -= vec->data[0]; state.camera.y -= vec->data[1]; state.camera.z -= vec->data[2]; break; case 'd': state.camera.x -= 10*move->data[0]; state.camera.z -= 10*move->data[2]; break; case 'r': case 'R': if(state.filling) { glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); } else { glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); } state.filling = !state.filling; break; default: break; } free_vector(vec); printf("x: %f, y: %f, z: %f\n", state.camera.x, state.camera.y, state.camera.z); }
struct global_state *copy_global_state(struct global_state *gstate) /* Returns: A copy of global state gstate, which includes copying global variable and module state */ { struct global_state *newp; value tmp; GCPRO1(gstate); newp = (struct global_state *)allocate_record(type_vector, 8); GCPRO1(newp); tmp = copy_table(gstate->modules); newp->modules = tmp; tmp = copy_vector(gstate->mvars); newp->mvars = tmp; tmp = copy_vector(gstate->types); newp->types = tmp; tmp = copy_vector(gstate->names); newp->names = tmp; tmp = copy_table(gstate->global); newp->global = tmp; tmp = copy_table(gstate->gsymbols); newp->gsymbols = tmp; tmp = copy_env(gstate->environment); newp->environment = tmp; newp->machine = gstate->machine; GCPOP(2); return newp; }
int vector_normalize(Vector *v, int dimension) { Vector *cp = copy_vector(v); while (v->x > dimension) v->x -= dimension; while (v->x < 0) v->x += dimension; while (v->y > dimension) v->y -= dimension; while (v->y < 0) v->y += dimension; int result = (cp->x != v->x || cp->y != v->y); free(cp); return result; }
void verify_copy(const cl::Buffer &dev_vector, const std::vector<T> &host_vector) { const size_t n_elems = host_vector.size(); if (n_elems == 0) return; const size_t buffer_size = n_elems * sizeof (T); std::vector<T> copy_vector(n_elems); vcl::queue.enqueueReadBuffer(dev_vector, CL_TRUE, 0, buffer_size, copy_vector.data()); assert(std::memcmp(host_vector.data(), copy_vector.data(), buffer_size) == 0); }
inline void hexbright::find_down() { // currently, we're just averaging the last four data points. // Down is the strongest constant acceleration we experience // (assuming we're not dropped). Heuristics to only find down // under specific circumstances have been tried, but they only // tell us when down is less certain, not where it is... copy_vector(down_vector, vector(0)); // copy first vector to down double magnitudes = magnitude(vector(0)); for(int i=1; i<num_vectors; i++) { // go through, summing everything up int* vtmp = vector(i); sum_vectors(down_vector, down_vector, vtmp); magnitudes+=magnitude(vtmp); } normalize(down_vector, down_vector, magnitudes!=0 ? magnitudes : 1); }
stat_t cm_arc_cycle_callback() { if (arc.run_state == MOVE_OFF) { return (STAT_NOOP);} if (mp_get_planner_buffers_available() < PLANNER_BUFFER_HEADROOM) { return (STAT_EAGAIN);} arc.theta += arc.segment_theta; arc.gm.target[arc.plane_axis_0] = arc.center_0 + sin(arc.theta) * arc.radius; arc.gm.target[arc.plane_axis_1] = arc.center_1 + cos(arc.theta) * arc.radius; arc.gm.target[arc.linear_axis] += arc.segment_linear_travel; mp_aline(&arc.gm); // run the line copy_vector(arc.position, arc.gm.target); // update arc current position if (--arc.segment_count > 0) return (STAT_EAGAIN); arc.run_state = MOVE_OFF; return (STAT_OK); }
void text::parseImpl (const parsingContext& ctx, const string& buffer, const size_t position, const size_t end, size_t* newPosition) { removeAllWords(); size_t newPos; const std::vector <shared_ptr <word> > words = word::parseMultiple(ctx, buffer, position, end, &newPos); copy_vector(words, m_words); setParsedBounds(position, newPos); if (newPosition) *newPosition = newPos; }
void resolve_dependences(){ struct Lnode *payload_node = NULL; payload_gadget_t *payload_node_struct = NULL; /* Local state of pending inputs (previous iteration) */ unsigned char inputs_vector_state_LOCAL[14]; unsigned char looping = 1; int i; while(looping){ copy_vector(inputs_vector_state_LOCAL, inputs_vector_state, 14); clear_vector(inputs_vector_state, 14, 0); inputs_vector_state[7] = 1; inputs_vector_values[7] = 11; inputs_vector_refs[7] = 0; for(payload_node = payload->tail; payload_node != NULL; payload_node = payload_node->prev){ payload_node_struct = GETPOINTER(payload_node, payload_gadget_t); process_outputs(payload_node_struct->gadget, payload_node); process_inputs(payload_node_struct->gadget); for(i = 0; i < 14; i++){ if(inputs_vector_state[i] && inputs_vector_state_LOCAL[i]){ // Input not provided // if(payload_node != payload->head || !store_writes_r(i)){ // Fix it if(check_my_outputs(i)){ // Auxiliar gadget (which writes into i) writes also into another pending input // inputs_vector_refs[i] = payload_node; } else{ payload_node = write_auxiliar_gadget(i, payload_node); } } } } } looping = 0; for(i = 0; i < 14; i++){ if(inputs_vector_state[i] && !store_writes_r(i)){ write_auxiliar_gadget(i, payload_node); looping = 1; } } } }
void omega_estimation(quaternion q_B, vector v_w) { static quaternion q_B_old; quaternion dq, q; vector e, de, v_w_temp; static vector v_w_old = { 0.0, 0.0, 0.0 }; matrix m_temp; float n; uint8_t i, j; for(i = 0; i < 4; i++) { dq[i] = (q_B[i] - q_B_old[i]) / FRAME_TIME; q[i] = (q_B[i] + q_B_old[i]) / 2; } for(i = 0; i < 3; i++) { de[i] = dq[i]; e[i] = q[i]; } n = q[3]; matrix m_ex = { { 0, -2 * e[2], 2 * e[1] }, { 2 * e[2], 0, -2 * e[0] }, { -2 * e[1], 2 * e[0], 0 } }; matrix m_I = { { 2 * n, 0, 0 }, { 0, 2 * n, 0 }, { 0, 0, 2 * n } }; for(i = 0; i< 3; i++) { for(j = 0; j < 3; j++) m_temp[j][i] = m_I[i][j] - m_ex[i][j] + ((2 * e[i] * e[j]) / n); } vector_into_matrix(de, m_temp, v_w_temp); for(i = 0; i < 3; i++) v_w[i] = A_F * v_w_temp[i] + (1 - A_F) * v_w_old[i]; copy_quaternion(q_B, q_B_old); copy_vector(v_w, v_w_old); }
void magnetic_field_estimator(vector v_B_o) { float time_in_years = 2010 + (float)seconds_since_pivot / SECONDS_IN_YEAR; vector v_temp, v_r_lla, v_B_ned, v_B_eci; eci2ecef(v_r, v_temp); ecef2lla(v_temp, v_r_lla); ///* Save LLA vector for use in communications check routine copy_vector(v_r_lla, v_sat); igrf(v_r_lla, time_in_years, 8, v_B_ned); ned2ecef(v_B_ned, v_r_lla, v_temp); ecef2eci(v_temp, v_B_eci); eci2orbit(v_r, v_v, v_B_eci, v_B_o); scalar_into_vector(v_B_o, 1e-9); }
/* This function transforms a set of vectors into * an orthonormal set: an orthonormal base */ struct vector * gram_schmidt(struct vector *v, unsigned int n) { struct vector *w; w=malloc(n*sizeof(struct vector)); w[0]=unitary_vector(v[0]); unsigned int i,j; struct vector aux; for (i = 1; i < n; i++) { w[i]=copy_vector(v[i]); for (j = 0; j < i; j++) { aux=projection_along(w[j],v[i]) w[i]=vector_subtraction(w[i],aux); } w[i]=unitary_vector(w[i]); } return w; }
void sgp_orbit_propagator(void) { vector v_g; vector v_v_old; float delta_t = ((float)FRAME_TIME) / 10; uint8_t i, j; for(i = 0; i < 10; i++) { sgp_get_acceleration(v_g); copy_vector(v_v, v_v_old); for(j = 0; j < 3; j++) v_v[j] += v_g[j] * delta_t; for(j = 0; j < 3; j++) v_r[j] += ((v_v[j] + v_v_old[j]) / 2) * delta_t; } }
void sgp_orbit_propagator(void) { vector v_g; vector v_v_old; float delta_t = ((float)FRAME_TIME) / 10; uint8_t i, j; for(i = 0; i < 10; i++) { sgp_get_acceleration(v_g); copy_vector(v_v, v_v_old); for(j = 0; j < 3; j++) v_v[j] += v_g[j] * delta_t; for(j = 0; j < 3; j++) v_r[j] += ((v_v[j] + v_v_old[j]) / 2) * delta_t;// this is also different from controls } /*uint16_t send[3]; for (int i=0;i<3;i++) { if(send[i]<0) send[i]=(uint16_t)(-1*(v_v[i])); else send[i]=(uint16_t)(1*(v_v[i])); } uint8_t a,b; for (int i=0;i<3;i++) { a = (uint8_t)send[i]; b = (uint8_t)(send[i]>>8); transmit_UART0(a); transmit_UART0(b); }*/ }
int main(int argc, char* argv[]) { // The file to create the online version of the code printf("Runs with F1 loss in the loss-augmented objective .. only positive data .. with weighting of Fscores .. no regions file"); // double *w; /* weight vector */ double C, epsilon, Cdash; LEARN_PARM learn_parm; KERNEL_PARM kernel_parm; char trainfile[1024]; char modelfile[1024]; int MAX_ITER; SAMPLE sample; STRUCT_LEARN_PARM sparm; STRUCTMODEL sm; /* read input parameters */ my_read_input_parameters(argc, argv, trainfile, modelfile, &learn_parm, &kernel_parm, &sparm); epsilon = learn_parm.eps; C = learn_parm.svm_c; Cdash = learn_parm.Cdash; MAX_ITER = learn_parm.maxiter; /* read in examples */ //strcpy(trainfile, "dataset/reidel_trainSVM.small.data"); sample = read_struct_examples(trainfile,&sparm); /* initialization */ init_struct_model(sample,&sm,&sparm,&learn_parm,&kernel_parm); // (OnlineSVM : Commenting 'w' as they are replaced by 'w_iters' // w = create_nvector(sm.sizePsi); // clear_nvector(w, sm.sizePsi); // sm.w = w; /* establish link to w, as long as w does not change pointer */ double *zeroes = create_nvector(sm.sizePsi); clear_nvector(zeroes, sm.sizePsi); // printf("Addr. of w (init) %x\t%x\n",w,sm.w); time_t time_start_full, time_end_full; int eid,totalEpochs=learn_parm.totalEpochs; int chunkid, numChunks=learn_parm.numChunks; double primal_obj_sum, primal_obj; char chunk_trainfile[1024]; SAMPLE * chunk_dataset = (SAMPLE *) malloc(sizeof(SAMPLE)*numChunks); /** * If we have ‘k’ instances and do ‘n’ epochs, after processing each chunk we update the weight. * Since we do ‘k’ updates, we will have ‘k’ weight vectors after each epoch. * After ‘n’ epochs, we will have ‘k*n’ weight vectors. */ // -------------------------------------------------------------------------------------------------------------------------------- double ***w_iters = (double**) malloc(totalEpochs*sizeof(double**)); // printf("--2: After 1st malloc -- %x; sz = %d\n", w_iters, totalEpochs*sizeof(double**)); for(eid = 0; eid < totalEpochs; eid++){ w_iters[eid] = (double*) malloc(numChunks*sizeof(double*)); // printf("2.5... id = %d, .. allocated ... %x; sz = %d\n",eid, w_iters[eid],numChunks*sizeof(double*)); } printf("--3: After 2nd malloc \n"); for(eid = 0; eid < totalEpochs; eid++){ for(chunkid = 0; chunkid < numChunks; chunkid++){ w_iters[eid][chunkid] = create_nvector(sm.sizePsi); // printf("Confirming memory location : %x\n",w_iters[eid][chunkid]); clear_nvector(w_iters[eid][chunkid], sm.sizePsi); } } sm.w_iters = w_iters; printf("(ONLINE SVM) Completed the memory alloc for the parameters\n"); // -------------------------------------------------------------------------------------------------------------------------------- /** * Having divided the dataset (X,Y) into set of 'k' chunks / sub-datasets (X_1,Y_1) ... (X_k, Y_k) * Do the following do while routine for one set of datapoints (sub-datasets) */ // -------------------------------------------------------------------------------------------------------------------------------- printf("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Changed .... Calling Java to split dataset\n"); char *cmd = malloc(1000); strcpy(cmd,"java -Xmx1G -cp java/bin:java/lib/* " " javaHelpers.splitDataset "); strcat(cmd, trainfile); strcat(cmd, " "); char numChunks_str[10]; sprintf(numChunks_str, "%d", numChunks); strcat(cmd, numChunks_str); strcat(cmd, " "); printf("Executing cmd : %s\n", cmd);fflush(stdout); system(cmd); // -------------------------------------------------------------------------------------------------------------------------------- for(chunkid = 0; chunkid < numChunks; chunkid++) { memset(chunk_trainfile, 0, 1024); strcat(chunk_trainfile,trainfile); strcat(chunk_trainfile,".chunks/chunk."); // NOTE: Name hard-coded according to the convention used to create chunked files char chunkid_str[10];sprintf(chunkid_str, "%d", chunkid); strcat(chunk_trainfile,chunkid_str); printf("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Changed .... Reading chunked dataset\n"); printf("Chunk trainfile : %s\n",chunk_trainfile); chunk_dataset[chunkid] = read_struct_examples_chunk(chunk_trainfile); } time(&time_start_full); for(eid = 0; eid < totalEpochs; eid++) { printf("(ONLINE LEARNING) : EPOCH %d\n",eid); primal_obj_sum = 0.0; for(chunkid = 0; chunkid < numChunks; chunkid++) // NOTE: Chunkid starts from 1 and goes upto numChumks { int sz = sample.n / numChunks; int datasetStartIdx = (chunkid) * sz; int chunkSz = (numChunks-1 == chunkid) ? (sample.n - ((numChunks-1)*sz) ) : (sz); primal_obj = optimizeMultiVariatePerfMeasure(chunk_dataset[chunkid], datasetStartIdx, chunkSz, &sm, &sparm, C, Cdash, epsilon, MAX_ITER, &learn_parm, trainfile, w_iters, eid, chunkid, numChunks, zeroes); printf("(ONLINE LEARNING) : FINISHED PROCESSING CHUNK (PSEUDO-DATAPOINT) %d of %d\n",chunkid+1, numChunks); primal_obj_sum += primal_obj; printf("(OnlineSVM) : Processed pseudo-datapoint -- primal objective sum: %.4f\n", primal_obj_sum); } // After the completion of one epoch, warm start the 2nd epoch with the values of the // weight vectors seen at the end of the last chunk in previous epoch if(eid + 1 < totalEpochs){ //init w_iters[eid+1][0] to w_iters[eid][numChunks-1] copy_vector(w_iters[eid+1][0], w_iters[eid][numChunks-1], sm.sizePsi); printf("(ONLINE LEARNING) : WARM START ACROSS EPOCHS ..... DONE....\n"); } printf("(OnlineSVM) : EPOCH COMPLETE -- primal objective: %.4f\n", primal_obj); printf("(ONLINE LEARNING) : EPOCH %d DONE! .....\n",eid); } time(&time_end_full); char msg[20]; sprintf(msg,"(ONLINE LEARNING) : Total Time Taken : "); print_time(time_start_full, time_end_full, msg); printf("(ONLINE LEARNING) Reached here\n"); /* write structural model */ write_struct_model_online(modelfile, &sm, &sparm, totalEpochs, numChunks); // skip testing for the moment printf("(ONLINE LEARNING) Complete dumping\n"); /* free memory */ //TODO: Need to change this ... free_struct_sample(sample); free_struct_model(sm, &sparm); return(0); }