int main() { slong n, i, m, prec = 60; flint_rand_t state; flint_printf("symplectic basis..."); fflush(stdout); flint_randinit(state); for (n = 3; n < 10; n++) { for (i = 0; i < 5; i++) { acb_ptr x; tree_t tree; x = _acb_vec_init(n); acb_vec_set_random(x, n, state, prec, 4); tree_init(tree, n - 1); spanning_tree(tree, x, n, INT_DE); for (m = 2; m < 7; m++) { sec_t c; homol_t alpha, beta; sec_init(&c, m, n); tree_ydata_init(tree, x, n, m, prec); alpha = flint_malloc(c.g * sizeof(loop_t)); beta = flint_malloc(c.g * sizeof(loop_t)); symplectic_basis(alpha, beta, tree, c); homol_clear(alpha, c.g); homol_clear(beta, c.g); tree_ydata_clear(tree); sec_clear(c); } tree_clear(tree); _acb_vec_clear(x, n); } } flint_randclear(state); flint_cleanup(); printf("PASS\n"); return 0; }
nodelist_t *layout_block(Agraph_t * g, block_t * sn, double min_dist) { Agnode_t *n; Agraph_t *copyG, *tree, *subg; nodelist_t *longest_path; nodelistitem_t *item; int N, k; double theta, radius, largest_node; largest_node = 0; subg = sn->sub_graph; block_graph(g, sn); /* add induced edges */ copyG = remove_pair_edges(subg); tree = spanning_tree(copyG); longest_path = find_longest_path(tree); place_residual_nodes(subg, longest_path); /* at this point, longest_path is a list of all nodes in the block */ /* apply crossing reduction algorithms here */ longest_path = reduce_edge_crossings(longest_path, subg); N = sizeNodelist(longest_path); largest_node = largest_nodesize(longest_path); /* N*(min_dist+largest_node) is roughly circumference of required circle */ if (N == 1) radius = 0; else radius = (N * (min_dist + largest_node)) / (2 * PI); for (item = longest_path->first; item; item = item->next) { n = item->curr; if (ISPARENT(n)) { /* QUESTION: Why is only one parent realigned? */ realignNodelist(longest_path, item); break; } } k = 0; for (item = longest_path->first; item; item = item->next) { n = item->curr; POSITION(n) = k; PSI(n) = 0.0; theta = k * ((2.0 * PI) / N); ND_pos(n)[0] = radius * cos(theta); ND_pos(n)[1] = radius * sin(theta); k++; } if (N == 1) sn->radius = largest_node / 2; else sn->radius = radius; sn->rad0 = sn->radius; /* initialize parent pos */ sn->parent_pos = -1; agclose(copyG); return longest_path; }