version 1.4, 2017/02/22 04:53:13 |
version 1.6, 2020/08/26 06:03:31 |
Line 19 GEN cmo_int32_to_GEN(cmo_int32 *c) |
|
Line 19 GEN cmo_int32_to_GEN(cmo_int32 *c) |
|
return z; |
return z; |
} |
} |
|
|
|
GEN cmo_string_to_GEN(cmo_string *c) |
|
{ |
|
GEN z; |
|
int l; |
|
|
|
l = strlen(c->s); |
|
z = cgetg(l+1,t_STR); |
|
strcpy(GSTR(z),c->s); |
|
return z; |
|
} |
|
|
GEN cmo_zz_to_GEN(cmo_zz *c) |
GEN cmo_zz_to_GEN(cmo_zz *c) |
{ |
{ |
mpz_ptr mpz; |
mpz_ptr mpz; |
Line 106 GEN cmo_up_to_GEN(cmo_polynomial_in_one_variable *c) |
|
Line 117 GEN cmo_up_to_GEN(cmo_polynomial_in_one_variable *c) |
|
z = cgetg(d+3,t_POL); |
z = cgetg(d+3,t_POL); |
setsigne(z,1); |
setsigne(z,1); |
setvarn(z,c->var); |
setvarn(z,c->var); |
setlgef(z,d+3); |
setlg(z,d+3); |
for ( i = 2; i <= d+2; i++ ) |
for ( i = 2; i <= d+2; i++ ) |
z[i] = (long)gen_0; |
z[i] = (long)gen_0; |
for ( cell = c->head->next; cell != c->head; cell = cell->next ) { |
for ( cell = c->head->next; cell != c->head; cell = cell->next ) { |
Line 142 GEN cmo_rp_to_GEN(cmo_recursive_polynomial *c) |
|
Line 153 GEN cmo_rp_to_GEN(cmo_recursive_polynomial *c) |
|
} |
} |
} |
} |
|
|
|
cmo_zz *GEN_to_cmo_string(GEN z) |
|
{ |
|
cmo_string *c; |
|
|
|
c = new_cmo_string(GSTR(z)); |
|
return (cmo_zz *)c; |
|
} |
|
|
cmo_zz *GEN_to_cmo_zz(GEN z) |
cmo_zz *GEN_to_cmo_zz(GEN z) |
{ |
{ |
cmo_zz *c; |
cmo_zz *c; |
|
|
c = new_cmo_zz(); |
c = new_cmo_zz(); |
mpz_import(c->mpz,lgef(z)-2,1,sizeof(long),0,0,&z[2]); |
mpz_import(c->mpz,lg(z)-2,1,sizeof(long),0,0,&z[2]); |
if ( signe(z) < 0 ) |
if ( signe(z) < 0 ) |
mpz_neg(c->mpz,c->mpz); |
mpz_neg(c->mpz,c->mpz); |
return c; |
return c; |
Line 161 cmo_qq *GEN_to_cmo_qq(GEN z) |
|
Line 180 cmo_qq *GEN_to_cmo_qq(GEN z) |
|
num = (GEN)z[1]; |
num = (GEN)z[1]; |
den = (GEN)z[2]; |
den = (GEN)z[2]; |
c = new_cmo_qq(); |
c = new_cmo_qq(); |
mpz_import(mpq_numref(c->mpq),lgef(num)-2,1,sizeof(long),0,0,&num[2]); |
mpz_import(mpq_numref(c->mpq),lg(num)-2,1,sizeof(long),0,0,&num[2]); |
mpz_import(mpq_denref(c->mpq),lgef(den)-2,1,sizeof(long),0,0,&den[2]); |
mpz_import(mpq_denref(c->mpq),lg(den)-2,1,sizeof(long),0,0,&den[2]); |
if ( signe(num)*signe(den) < 0 ) |
if ( signe(num)*signe(den) < 0 ) |
mpz_neg(mpq_numref(c->mpq),mpq_numref(c->mpq)); |
mpz_neg(mpq_numref(c->mpq),mpq_numref(c->mpq)); |
return c; |
return c; |
Line 266 GEN cmo_to_GEN(cmo *c) |
|
Line 285 GEN cmo_to_GEN(cmo *c) |
|
return cmo_rp_to_GEN((cmo_recursive_polynomial *)c); |
return cmo_rp_to_GEN((cmo_recursive_polynomial *)c); |
case CMO_POLYNOMIAL_IN_ONE_VARIABLE: |
case CMO_POLYNOMIAL_IN_ONE_VARIABLE: |
return cmo_up_to_GEN((cmo_polynomial_in_one_variable *)c); |
return cmo_up_to_GEN((cmo_polynomial_in_one_variable *)c); |
|
case CMO_STRING: |
|
return cmo_string_to_GEN((cmo_string *)c); |
default: |
default: |
return 0; |
return 0; |
} |
} |
Line 292 cmo *GEN_to_cmo(GEN z) |
|
Line 313 cmo *GEN_to_cmo(GEN z) |
|
return (cmo *)GEN_to_cmo_list(z); |
return (cmo *)GEN_to_cmo_list(z); |
case t_MAT: /* matrix */ |
case t_MAT: /* matrix */ |
return (cmo *)GEN_to_cmo_list(shallowtrans(z)); |
return (cmo *)GEN_to_cmo_list(shallowtrans(z)); |
|
case t_STR: /* string */ |
|
return (cmo *)GEN_to_cmo_string(z); |
default: |
default: |
sprintf(buf,"GEN_to_cmo : unsupported type=%d",(int)typ(z)); |
sprintf(buf,"GEN_to_cmo : unsupported type=%d",(int)typ(z)); |
return (cmo *)make_error2(buf); |
return (cmo *)make_error2(buf); |