Changeset c81a40 in git for Singular/ipshell.cc
- Timestamp:
- Jul 16, 2008, 2:41:33 PM (16 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- c88c2ba361f5b914ed9b192a055274f0a74cdf04
- Parents:
- e3164c057b351ebc7de36b8955221b4cb648bdbe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ipshell.cc
re3164c rc81a40 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: ipshell.cc,v 1.18 6 2008-07-07 12:21:43wienand Exp $ */4 /* $Id: ipshell.cc,v 1.187 2008-07-16 12:41:32 wienand Exp $ */ 5 5 /* 6 6 * ABSTRACT: … … 1608 1608 } 1609 1609 1610 #ifdef HAVE_RINGS 1611 void rDecomposeRing(leftv h,const ring R) 1612 /* field is R or C */ 1613 { 1614 lists L=(lists)omAlloc0Bin(slists_bin); 1615 if (rField_is_Ring_Z(R)) L->Init(1); 1616 else L->Init(2); 1617 h->rtyp=LIST_CMD; 1618 h->data=(void *)L; 1619 // 0: char/ cf - ring 1620 // 1: list (module) 1621 // ---------------------------------------- 1622 // 0: char/ cf - ring 1623 L->m[0].rtyp=STRING_CMD; 1624 L->m[0].data=(void *)omStrDup("integer"); 1625 // ---------------------------------------- 1626 // 1: module 1627 if (rField_is_Ring_Z(R)) return; 1628 lists LL=(lists)omAlloc0Bin(slists_bin); 1629 LL->Init(2); 1630 LL->m[0].rtyp=BIGINT_CMD; 1631 LL->m[0].data=nlMapGMP((number) R->ringflaga); 1632 LL->m[1].rtyp=INT_CMD; 1633 LL->m[1].data=(void *) R->ringflagb; 1634 L->m[1].rtyp=LIST_CMD; 1635 L->m[1].data=(void *)LL; 1636 } 1637 #endif 1638 1639 1610 1640 lists rDecompose(const ring r) 1611 1641 { … … 1640 1670 rDecomposeC(&(L->m[0]),r); 1641 1671 } 1672 #ifdef HAVE_RINGS 1673 else if (rField_is_Ring(r)) 1674 { 1675 rDecomposeRing(&(L->m[0]),r); 1676 } 1677 #endif 1642 1678 else if (rIsExtension(r)) 1643 1679 { … … 4456 4492 #ifdef HAVE_RINGS 4457 4493 unsigned int ringtype = 0; 4458 unsigned long long ringflaga = 0; 4459 unsigned int ringflagb = 0; 4494 int_number ringflaga = (int_number) omAlloc(sizeof(MP_INT)); 4495 mpz_init_set_si(ringflaga, 0); 4496 unsigned int ringflagb = 1; 4460 4497 #endif 4461 4498 int float_len=0; … … 4501 4538 if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD)) 4502 4539 { 4503 ringflaga = (unsigned long long) pn->next->Data();4540 mpz_set_ui(ringflaga, (unsigned int) pn->next->Data()); 4504 4541 pn=pn->next; 4505 ringflagb = 1;4506 4542 if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD)) 4507 4543 { 4508 ringflagb = (unsigned int) (unsigned long)pn->next->Data();4544 ringflagb = (unsigned int) pn->next->Data(); 4509 4545 pn=pn->next; 4510 4546 } 4511 4547 while ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD)) 4512 4548 { 4513 ringflaga *= (unsigned long long) pn->next->Data();4549 mpz_mul_ui(ringflaga, ringflaga, (unsigned int) pn->next->Data()); 4514 4550 pn=pn->next; 4515 4551 } 4516 if (ringflaga < 2) 4517 { 4518 Werror("Wrong ground ring specification (module smallet than 2)"); 4519 goto rInitError; 4520 } 4521 if (ringflagb < 1) 4522 { 4523 Werror("Wrong ground ring specification (exponent smaller than 1"); 4524 goto rInitError; 4525 } 4526 if (ringflagb > 1) 4527 { 4528 ch = ringflagb; 4529 if ((ringflaga == 2) && (ringflagb + 2 <= 8*sizeof(NATNUMBER))) 4530 { 4531 ringtype = 1; // Use Z/2^ch 4532 } 4533 else 4534 { 4535 ringtype = 3; 4536 } 4537 } 4538 else 4539 { 4540 ringtype = 2; 4541 ch = ringflaga; 4542 } 4543 } 4544 else 4552 } 4553 if ((mpz_cmp_ui(ringflaga, 1) == 0) && (mpz_cmp_ui(ringflaga, 0) < 0)) 4554 { 4555 Werror("Wrong ground ring specification (module is 1)"); 4556 goto rInitError; 4557 } 4558 if (ringflagb < 1) 4559 { 4560 Werror("Wrong ground ring specification (exponent smaller than 1"); 4561 goto rInitError; 4562 } 4563 // module is 0 ---> integers 4564 if (mpz_cmp_ui(ringflaga, 0) == 0) 4545 4565 { 4546 4566 ch = 0; 4547 4567 ringtype = 4; 4568 } 4569 // we have an exponent 4570 else if (ringflagb > 1) 4571 { 4572 ch = ringflagb; 4573 if ((mpz_cmp_ui(ringflaga, 2) == 0) && (ringflagb + 2 <= 8*sizeof(NATNUMBER))) 4574 { 4575 ringtype = 1; // Use Z/2^ch 4576 } 4577 else 4578 { 4579 ringtype = 3; 4580 } 4581 } 4582 // just a module m > 1 4583 else 4584 { 4585 ringtype = 2; 4586 ch = mpz_get_ui(ringflaga); 4548 4587 } 4549 4588 }
Note: See TracChangeset
for help on using the changeset viewer.