bridge/class-master/depend/pari/src/basemath/arith1.c
/* Chinese Remainder Theorem.  x and y must have the same type (integermod,
 * polymod, or polynomial/vector/matrix recursively constructed with these
 * as coefficients). Creates (with the same type) a z in the same residue
 * class as x and the same residue class as y, if it is possible.
 *
 * We also allow (during recursion) two identical objects even if they are
 * not integermod or polymod. For example:
 *
 * ? x = [1, Mod(5, 11), Mod(X + Mod(2, 7), X^2 + 1)];
 * ? y = [1, Mod(7, 17), Mod(X + Mod(0, 3), X^2 + 1)];
 * ? chinese(x, y)
 * %3 = [1, Mod(16, 187), Mod(X + mod(9, 21), X^2 + 1)] */
Chinese Remainder Theorem.  x and y must have the same type (integermod,
polymod, or polynomial/vector/matrix recursively constructed with these
as coefficients). Creates (with the same type) a z in the same residue
class as x and the same residue class as y, if it is possible.

We also allow (during recursion) two identical objects even if they are
not integermod or polymod. For example.


Chinese Remainder Theorem . x and y must have the same type ( integermod polymod or polynomial / vector / matrix recursively constructed with these as coefficients ) . Creates ( with the same type ) a z in the same residue class as x and the same residue class as y if it is possible . We also allow ( during recursion ) two identical objects even if they are not integermod or polymod . For example .
static GEN
gen_chinese(GEN x, GEN(*f)(GEN,GEN))
{
  GEN z = gassoc_proto(f,x,NULL);
  if (z == gen_1) retmkintmod(gen_0,gen_1);
  return z;
}
static GEN gen_chinese ( GEN x , GEN ( * f ) ( GEN , GEN ) ) { GEN z = gassoc_proto ( f , x , NULL ) ; if ( z == gen_1 ) retmkintmod ( gen_0 , gen_1 ) ; return z ; }
Chinese Remainder Theorem.
Chinese Remainder Theorem .