| 1641 | } |
| 1642 | |
| 1643 | idhdl rDefault(const char *s) |
| 1644 | { |
| 1645 | idhdl tmp=NULL; |
| 1646 | |
| 1647 | if (s!=NULL) tmp = enterid(s, myynest, RING_CMD, &IDROOT); |
| 1648 | if (tmp==NULL) return NULL; |
| 1649 | |
| 1650 | if (sLastPrinted.RingDependend()) |
| 1651 | { |
| 1652 | sLastPrinted.CleanUp(); |
| 1653 | } |
| 1654 | |
| 1655 | ring r = IDRING(tmp) = (ring) omAlloc0Bin(sip_sring_bin); |
| 1656 | |
| 1657 | #ifndef TEST_ZN_AS_ZP |
| 1658 | r->cf = nInitChar(n_Zp, (void*)32003); // r->cf->ch = 32003; |
| 1659 | #else |
| 1660 | mpz_t modBase; |
| 1661 | mpz_init_set_ui(modBase, (long)32003); |
| 1662 | ZnmInfo info; |
| 1663 | info.base= modBase; |
| 1664 | info.exp= 1; |
| 1665 | r->cf=nInitChar(n_Zn,(void*) &info); |
| 1666 | r->cf->is_field=1; |
| 1667 | r->cf->is_domain=1; |
| 1668 | r->cf->has_simple_Inverse=1; |
| 1669 | #endif |
| 1670 | r->N = 3; |
| 1671 | /*r->P = 0; Alloc0 in idhdl::set, ipid.cc*/ |
| 1672 | /*names*/ |
| 1673 | r->names = (char **) omAlloc0(3 * sizeof(char_ptr)); |
| 1674 | r->names[0] = omStrDup("x"); |
| 1675 | r->names[1] = omStrDup("y"); |
| 1676 | r->names[2] = omStrDup("z"); |
| 1677 | /*weights: entries for 3 blocks: NULL*/ |
| 1678 | r->wvhdl = (int **)omAlloc0(3 * sizeof(int_ptr)); |
| 1679 | /*order: dp,C,0*/ |
| 1680 | r->order = (rRingOrder_t *) omAlloc(3 * sizeof(rRingOrder_t *)); |
| 1681 | r->block0 = (int *)omAlloc0(3 * sizeof(int *)); |
| 1682 | r->block1 = (int *)omAlloc0(3 * sizeof(int *)); |
| 1683 | /* ringorder dp for the first block: var 1..3 */ |
| 1684 | r->order[0] = ringorder_dp; |
| 1685 | r->block0[0] = 1; |
| 1686 | r->block1[0] = 3; |
| 1687 | /* ringorder C for the second block: no vars */ |
| 1688 | r->order[1] = ringorder_C; |
| 1689 | /* the last block: everything is 0 */ |
| 1690 | r->order[2] = (rRingOrder_t)0; |
| 1691 | |
| 1692 | /* complete ring intializations */ |
| 1693 | rComplete(r); |
| 1694 | rSetHdl(tmp); |
| 1695 | return currRingHdl; |
| 1696 | } |
| 1697 | |
| 1698 | static idhdl rSimpleFindHdl(const ring r, const idhdl root, const idhdl n); |
| 1699 | idhdl rFindHdl(ring r, idhdl n) |