void sort_v(t_numbr **a, t_numbr **b) { display(a, b); while ((list_check_a(a)) != 0) { if ((*a)->data >= (last_node(a))->data) { cmd_ra(a); display(a, b); } if ((*a)->data > (*a)->next->data) { cmd_sa(a); display(a, b); } if ((*a)->data <= (last_node(a))->data && ((*a)->data <= (*a)->next->data)) { cmd_pb(a, b); display(a, b); sort_b(a, b); } } while ((*b) != NULL) { cmd_pa(a, b); display(a, b); } }
float mapper(struct preprocessing *preproc, struct mapping_algorithm *algorithm, struct cost_function *cfunction, struct platform_resources *platform, struct waveform_resources *waveform, struct mapping_result *result) { int i, j; // loop indices float cost; // mapping cost float m[Mmax]; // t-mapping: trellis organization int nodes[Nmax][Mmax]; // 2D-array of N*M nodes that can be traspassed in the trellis //int (*ptr_nodes)[Mmax]; int count; // integer counter /* primero compruebas que las variables de entrada sean correctas */ /*if (...) return -1; */ // COPIES /* number of processors and tasks */ N = platform->nof_processors; // number of platform's processors M = waveform->nof_tasks; // number of application's tasks/SDR functions/processes // INITIALIZATIONS //ptr_nodes = nodes; // trellis organization: 'trellis nodes' (2D-array) numbered to be accessible by a single number or dimension count = 0; for (i=0; i<M; i++) for (j=0; j<N; j++) nodes[j][i] = count++; /* cost function parameters */ q1 = cfunction->q; q2 = (float)1-q1; mhop = cfunction->mhop; /* application and platform resources and parameters */ for (i=0; i<M; i++) m[i] = waveform->c[i]; /** IGM: fill force idx vector */ for (i=0; i<M; i++) force_idx[i] = waveform->force[i]; for (i=0; i<M; i++) for (j=0; j<M; j++) b[i][j] = waveform->b[i][j]; for (i=0; i<N; i++) P[i] = platform->C[i]; for (i=0; i<N; i++) for (j=0; j<N; j++) L[i][j] = platform->B[i][j]; arch = platform->arch; resource_trans(); /* preprocessing */ switch (preproc->ord) { case no_ord: for (i=0; i<M; i++) m_sort[i] = m[i]; break; case c_ord: sort_d(m); break; case b_ord: sort_b(m); break; default: for (i=0; i<M; i++) m_sort[i] = m[i]; } cost = tw_mapping(nodes, algorithm->w); for (i=0;i<M;i++) { result->P_m[i]=final_map[i]; } return cost; }