void test_standard_container ( void ) { int n,fail,*d; double *c; fail = syscon_read_system(); fail = syscon_write_system(); fail = syscon_number_of_polynomials(&n); test_symbol_table(); printf("\nThe dimension of the system : %d\n",n); { LIST *p[n]; int i; test_retrievals(n,p); fail = syscon_clear_system(); for(i=0; i<n; i++) { printf("The terms in polynomial %d : \n", i+1); write_monomial_list(p[i],n); } test_additions(n,p); } }
void ada_read_sys(PolySys& sys) { int fail; std::cout << "testing reading and writing a system" << std::endl; //fail = syscon_read_system(); std::cout << "the system is .." << std::endl; fail = syscon_write_system(); // Get variable names int s_dim = 80; char *s = (char*) calloc(80,sizeof(char)); fail = syscon_string_of_symbols(&s_dim, s); string* x_names; var_name(s, s_dim, x_names); int dim = 4; int i = 1; double c[2]; int d[dim]; int n_eq = 0; fail = syscon_number_of_polynomials(&n_eq); sys.n_eq = n_eq; sys.dim = dim; sys.eq_space = new PolyEq[n_eq]; sys.pos_var = x_names; PolyEq* tmp_eq = sys.eq_space; for(int i=1; i<n_eq+1; i++){ int nt; fail = syscon_number_of_terms(i,&nt); //std::cout << " #terms in polynomial " << i << " : " << nt << std::endl; tmp_eq->n_mon = nt; tmp_eq->dim = dim; for(int j=1; j<=nt; j++) { fail = syscon_retrieve_term(i,j,dim,d,c); //std::cout << c[0] << " " << c[1] << std::endl; //for (int k=0; k<n; k++) std::cout << " " << d[k]; //std::cout << std::endl; bool constant_term = true; for (int k=0; k<dim; k++){ if(d[k]!=0){ constant_term = false; } } if(constant_term==true){ tmp_eq->n_mon--; tmp_eq->constant += CT(c[0],c[1]); //std::cout << "constant " << c[0] \ << " " << c[1] << std::endl; } else{
void test_deflate ( void ) { int fail,dim,len; printf("\nRunning deflation ...\n"); fail = read_standard_start_system(); fail = copy_start_system_to_container(); fail = copy_start_solutions_to_container(); fail = syscon_number_of_polynomials(&dim); printf("The system container has %d polynomials.\n",dim); fail = solcon_number_of_solutions(&len); printf("The solution container has size %d.\n",len); fail = standard_deflate(); printf("The solutions after deflation :\n"); fail = solcon_write_solutions(); }
void test_standard_Newton_step ( void ) { int fail,dim,len; printf("\nRunning Newton step with standard arithmetic ...\n"); fail = syscon_read_system(); fail = syscon_number_of_polynomials(&dim); printf("The system container has %d polynomials.\n",dim); fail = solcon_read_solutions(); fail = solcon_number_of_solutions(&len); printf("The solution container has size %d.\n",len); fail = solcon_dimension_of_solutions(&dim); printf("The solutions in the container have dimension %d.\n",dim); fail = standard_Newton_step(); printf("The solutions after the Newton step :\n"); fail = solcon_write_solutions(); }