Changeset 985043 in git
- Timestamp:
- May 9, 2005, 3:58:54 PM (18 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
- Children:
- 9e0d84e07fb549d6dcaea4d7952cb9e3eba0b0f9
- Parents:
- d14343a61859db08e4e9a78b16211d1bbc44405e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
rd14343a r985043 1 /*****************************************1 e***************************************** 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.22 3 2005-05-04 14:09:45Singular Exp $ */4 /* $Id: extra.cc,v 1.224 2005-05-09 13:58:54 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 807 807 if (h->Typ()==MATRIX_CMD) 808 808 { 809 810 //currRing->nc->IsSkewConstant=NULL;811 } 812 else 813 { 814 815 if (nIsZero(nN)) 816 817 818 819 820 if (nIsOne(nN)) currRing->nc->type=nc_lie; 821 822 823 824 825 826 827 828 829 830 831 832 809 currRing->nc->type=nc_undef; /* to analyze later ! */ 810 // currRing->nc->IsSkewConstant=NULL; 811 } 812 else 813 { 814 nN=pGetCoeff(pN); // pN is not NULL anyway 815 if (nIsZero(nN)) 816 { 817 Werror("zero coefficients are not allowed"); 818 return TRUE; 819 } 820 if (nIsOne(nN)) currRing->nc->type=nc_lie; 821 else currRing->nc->type=nc_skew; 822 currRing->nc->IsSkewConstant=1; 823 /* create matrix C */ 824 C=mpNew(currRing->N,currRing->N); 825 for(i=1;i<currRing->N;i++) 826 { 827 for(j=i+1;j<=currRing->N;j++) 828 { 829 MATELEM(C,i,j) = nc_p_CopyPut(pN,currRing); 830 // MATELEM(C,i,j)=pCopy(pN); 831 } 832 } 833 833 } 834 834 pN=NULL; … … 862 862 if (pN==NULL) 863 863 { 864 if (currRing->nc->type==nc_lie) 865 866 867 868 } 869 else 870 { 871 if (currRing->nc->type==nc_skew) currRing->nc->type=nc_general; 864 if (currRing->nc->type==nc_lie) 865 { 866 currRing->nc->type=nc_skew; /* even commutative! */ 867 } 868 } 869 else 870 { 871 if (currRing->nc->type==nc_skew) currRing->nc->type=nc_general; 872 872 } /* end pN==NULL */ 873 873 if (h==NULL) … … 951 951 { 952 952 assume(pN!=NULL); 953 954 955 956 if (IsNonComm==0) 957 958 959 960 953 if ((tmpIsSkewConstant==1) && (nIsOne(pGetCoeff(pN)))) currRing->nc->type=nc_lie; 954 else currRing->nc->type=nc_general; 955 } 956 if (IsNonComm==0) 957 { 958 currRing->nc->type=nc_skew; /* could be also commutative */ 959 currRing->nc->IsSkewConstant=tmpIsSkewConstant; 960 } 961 961 } 962 962 currRing->nc->COM=COM; … … 1007 1007 h = h->next; 1008 1008 } 1009 if ((h!=NULL)) 1010 { 1011 1012 1013 1014 1015 1016 1017 1018 1009 if ((h!=NULL)) 1010 { 1011 idhdl w; 1012 if ((w=Rop->idroot->get(h->Name(),myynest))!=NULL) 1013 { 1014 poly p = (poly)IDDATA(w); 1015 res->data = pOppose(Rop,p); 1016 res->rtyp = POLY_CMD; 1017 return FALSE; 1018 } 1019 1019 } 1020 1020 else … … 1077 1077 { 1078 1078 if (h == NULL || h->Typ() != INTVEC_CMD || 1079 h->next == NULL || h->next->Typ() != INTVEC_CMD) 1079 h->next == NULL || h->next->Typ() != INTVEC_CMD) 1080 1080 { 1081 1081 WerrorS("system(\"walkAddIntVec\", intvec, intvec) expected"); … … 1091 1091 } 1092 1092 else 1093 #endif 1093 #endif 1094 1094 #ifdef MwaklNextWeight 1095 1095 if (strcmp(sys_cmd, "MwalkNextWeight") == 0) … … 1118 1118 res->rtyp = INTVEC_CMD; 1119 1119 res->data = result; 1120 1120 1121 1121 return FALSE; 1122 1122 } … … 1137 1137 } 1138 1138 int arg1 = (int) h->Data(); 1139 1139 1140 1140 intvec* result = (intvec*) Mivdp(arg1); 1141 1141 1142 1142 res->rtyp = INTVEC_CMD; 1143 1143 res->data = result; 1144 1145 return FALSE; 1146 } 1144 1145 return FALSE; 1146 } 1147 1147 1148 1148 else if(strcmp(sys_cmd, "Mivlp") == 0) … … 1160 1160 } 1161 1161 int arg1 = (int) h->Data(); 1162 1162 1163 1163 intvec* result = (intvec*) Mivlp(arg1); 1164 1164 1165 1165 res->rtyp = INTVEC_CMD; 1166 1166 res->data = result; 1167 1167 1168 1168 return FALSE; 1169 1169 } … … 1171 1171 #ifdef MpDiv 1172 1172 if(strcmp(sys_cmd, "MpDiv") == 0) 1173 { 1173 { 1174 1174 if(h==NULL || h->Typ() != POLY_CMD || 1175 1175 h->next == NULL || h->next->Typ() != POLY_CMD) … … 1180 1180 poly arg1 = (poly) h->Data(); 1181 1181 poly arg2 = (poly) h->next->Data(); 1182 1182 1183 1183 poly result = MpDiv(arg1, arg2); 1184 1184 … … 1191 1191 #ifdef MpMult 1192 1192 if(strcmp(sys_cmd, "MpMult") == 0) 1193 { 1193 { 1194 1194 if(h==NULL || h->Typ() != POLY_CMD || 1195 1195 h->next == NULL || h->next->Typ() != POLY_CMD) … … 1200 1200 poly arg1 = (poly) h->Data(); 1201 1201 poly arg2 = (poly) h->next->Data(); 1202 1202 1203 1203 poly result = MpMult(arg1, arg2); 1204 1204 res->rtyp = POLY_CMD; … … 1217 1217 } 1218 1218 /* 1219 if (((intvec*) h->Data())->length() != currRing->N || 1220 ((intvec*) h->next->Data())->length() != currRing->N) 1221 { 1222 Werror("system(\"MivSame\" ...) intvecs not of length %d\n", 1223 currRing->N); 1224 return TRUE; 1225 } 1219 if (((intvec*) h->Data())->length() != currRing->N || 1220 ((intvec*) h->next->Data())->length() != currRing->N) 1221 { 1222 Werror("system(\"MivSame\" ...) intvecs not of length %d\n", 1223 currRing->N); 1224 return TRUE; 1225 } 1226 1226 */ 1227 1227 intvec* arg1 = (intvec*) h->Data(); 1228 1228 intvec* arg2 = (intvec*) h->next->Data(); 1229 /* 1229 /* 1230 1230 poly result = (poly) MivSame(arg1, arg2); 1231 1231 … … 1241 1241 if(h == NULL || h->Typ() != INTVEC_CMD || 1242 1242 h->next == NULL || h->next->Typ() != INTVEC_CMD || 1243 1243 h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ) 1244 1244 { 1245 1245 Werror("system(\"M3ivSame\", intvec, intvec, intvec) expected"); … … 1247 1247 } 1248 1248 /* 1249 if (((intvec*) h->Data())->length() != currRing->N || 1249 if (((intvec*) h->Data())->length() != currRing->N || 1250 1250 ((intvec*) h->next->Data())->length() != currRing->N || 1251 ((intvec*) h->next->next->Data())->length() != currRing->N ) 1252 { 1253 Werror("system(\"M3ivSame\" ...) intvecs not of length %d\n", 1254 currRing->N); 1255 return TRUE; 1256 } 1251 ((intvec*) h->next->next->Data())->length() != currRing->N ) 1252 { 1253 Werror("system(\"M3ivSame\" ...) intvecs not of length %d\n", 1254 currRing->N); 1255 return TRUE; 1256 } 1257 1257 */ 1258 1258 intvec* arg1 = (intvec*) h->Data(); 1259 1259 intvec* arg2 = (intvec*) h->next->Data(); 1260 1260 intvec* arg3 = (intvec*) h->next->next->Data(); 1261 /* 1261 /* 1262 1262 poly result = (poly) M3ivSame(arg1, arg2, arg3); 1263 1263 … … 1294 1294 /************** Perturbation walk **********/ 1295 1295 if(strcmp(sys_cmd, "MivMatrixOrder") == 0) 1296 { 1296 { 1297 1297 if(h==NULL || h->Typ() != INTVEC_CMD) 1298 1298 { … … 1310 1310 else 1311 1311 if(strcmp(sys_cmd, "MivMatrixOrderdp") == 0) 1312 { 1312 { 1313 1313 if(h==NULL || h->Typ() != INT_CMD) 1314 1314 { … … 1317 1317 } 1318 1318 int arg1 = (int) h->Data(); 1319 1319 1320 1320 intvec* result = (intvec*) MivMatrixOrderdp(arg1); 1321 1321 … … 1327 1327 if(strcmp(sys_cmd, "MPertVectors") == 0) 1328 1328 { 1329 1329 1330 1330 if(h==NULL || h->Typ() != IDEAL_CMD || 1331 1331 h->next == NULL || h->next->Typ() != INTVEC_CMD || … … 1335 1335 return TRUE; 1336 1336 } 1337 1337 1338 1338 ideal arg1 = (ideal) h->Data(); 1339 1339 intvec* arg2 = (intvec*) h->next->Data(); 1340 1340 int arg3 = (int) h->next->next->Data(); 1341 1341 1342 1342 intvec* result = (intvec*) MPertVectors(arg1, arg2, arg3); 1343 1343 … … 1349 1349 if(strcmp(sys_cmd, "MPertVectorslp") == 0) 1350 1350 { 1351 1351 1352 1352 if(h==NULL || h->Typ() != IDEAL_CMD || 1353 1353 h->next == NULL || h->next->Typ() != INTVEC_CMD || … … 1357 1357 return TRUE; 1358 1358 } 1359 1359 1360 1360 ideal arg1 = (ideal) h->Data(); 1361 1361 intvec* arg2 = (intvec*) h->next->Data(); 1362 1362 int arg3 = (int) h->next->next->Data(); 1363 1363 1364 1364 intvec* result = (intvec*) MPertVectorslp(arg1, arg2, arg3); 1365 1365 … … 1379 1379 } 1380 1380 ideal arg1 = (ideal) h->Data(); 1381 intvec* arg2 = (intvec*) h->next->Data(); 1381 intvec* arg2 = (intvec*) h->next->Data(); 1382 1382 intvec* result = Mfpertvector(arg1, arg2); 1383 1383 1384 1384 res->rtyp = INTVEC_CMD; 1385 1385 res->data = result; … … 1388 1388 else 1389 1389 if(strcmp(sys_cmd, "MivUnit") == 0) 1390 { 1390 { 1391 1391 int arg1 = (int) h->Data(); 1392 1392 1393 1393 intvec* result = (intvec*) MivUnit(arg1); 1394 1394 … … 1396 1396 res->data = result; 1397 1397 return FALSE; 1398 } 1398 } 1399 1399 else 1400 1400 if(strcmp(sys_cmd, "MivWeightOrderlp") == 0) … … 1407 1407 intvec* arg1 = (intvec*) h->Data(); 1408 1408 intvec* result = MivWeightOrderlp(arg1); 1409 1409 1410 1410 res->rtyp = INTVEC_CMD; 1411 1411 res->data = result; … … 1422 1422 intvec* arg1 = (intvec*) h->Data(); 1423 1423 //int arg2 = (int) h->next->Data(); 1424 1424 1425 1425 intvec* result = MivWeightOrderdp(arg1); 1426 1426 1427 1427 res->rtyp = INTVEC_CMD; 1428 1428 res->data = result; 1429 1429 return FALSE; 1430 1430 } 1431 else 1431 else 1432 1432 if(strcmp(sys_cmd, "MivMatrixOrderlp") == 0) 1433 { 1433 { 1434 1434 if(h==NULL || h->Typ() != INT_CMD) 1435 1435 { … … 1438 1438 } 1439 1439 int arg1 = (int) h->Data(); 1440 1440 1441 1441 intvec* result = (intvec*) MivMatrixOrderlp(arg1); 1442 1442 … … 1471 1471 res->rtyp = INTVEC_CMD; 1472 1472 res->data = result; 1473 1473 1474 1474 return FALSE; 1475 1475 } … … 1500 1500 res->rtyp = INTVEC_CMD; 1501 1501 res->data = result; 1502 1502 1503 1503 return FALSE; 1504 1504 } … … 1522 1522 res->rtyp = INTVEC_CMD; 1523 1523 res->data = result; 1524 1524 1525 1525 return FALSE; 1526 1526 } … … 1538 1538 1539 1539 if (((intvec*) h->next->Data())->length() != currRing->N && 1540 1540 ((intvec*) h->next->next->Data())->length() != currRing->N ) 1541 1541 { 1542 1542 Werror("system(\"Mwalk\" ...) intvecs not of length %d\n", … … 1553 1553 res->rtyp = IDEAL_CMD; 1554 1554 res->data = result; 1555 1555 1556 1556 return FALSE; 1557 1557 } … … 1563 1563 h->next == NULL || h->next->Typ() != INT_CMD || 1564 1564 h->next->next == NULL || h->next->next->Typ() != INT_CMD || 1565 h->next->next->next == NULL || 1566 1567 h->next->next->next->next == NULL || 1568 1565 h->next->next->next == NULL || 1566 h->next->next->next->Typ() != INTVEC_CMD || 1567 h->next->next->next->next == NULL || 1568 h->next->next->next->next->Typ() != INTVEC_CMD) 1569 1569 { 1570 1570 Werror("system(\"Mpwalk\", ideal, int, int, intvec, intvec) expected"); … … 1573 1573 1574 1574 if (((intvec*) h->next->next->next->Data())->length() != currRing->N && 1575 1575 ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N) 1576 1576 { 1577 1577 Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n", … … 1590 1590 res->rtyp = IDEAL_CMD; 1591 1591 res->data = result; 1592 1592 1593 1593 return FALSE; 1594 1594 } … … 1600 1600 h->next == NULL || h->next->Typ() != INT_CMD || 1601 1601 h->next->next == NULL || h->next->next->Typ() != INT_CMD || 1602 h->next->next->next == NULL || 1603 1604 h->next->next->next->next == NULL || 1605 1606 h->next->next->next->next->next == NULL || 1607 1602 h->next->next->next == NULL || 1603 h->next->next->next->Typ() != INTVEC_CMD || 1604 h->next->next->next->next == NULL || 1605 h->next->next->next->next->Typ() != INTVEC_CMD|| 1606 h->next->next->next->next->next == NULL || 1607 h->next->next->next->next->next->Typ() != INT_CMD) 1608 1608 { 1609 1609 Werror("system(\"Mpwalk\", ideal, int, int, intvec, intvec, int) expected"); … … 1612 1612 1613 1613 if (((intvec*) h->next->next->next->Data())->length() != currRing->N && 1614 1614 ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N) 1615 1615 { 1616 1616 Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n", … … 1630 1630 res->rtyp = IDEAL_CMD; 1631 1631 res->data = result; 1632 1632 1633 1633 return FALSE; 1634 1634 } … … 1639 1639 h->next == NULL || h->next->Typ() != INT_CMD || 1640 1640 h->next->next == NULL || h->next->next->Typ() != INT_CMD || 1641 h->next->next->next == NULL || 1642 1643 h->next->next->next->next == NULL || 1644 1641 h->next->next->next == NULL || 1642 h->next->next->next->Typ() != INTVEC_CMD || 1643 h->next->next->next->next == NULL || 1644 h->next->next->next->next->Typ() != INTVEC_CMD) 1645 1645 { 1646 1646 Werror("system(\"MAltwalk1\", ideal, int, int, intvec, intvec) expected"); … … 1649 1649 1650 1650 if (((intvec*) h->next->next->next->Data())->length() != currRing->N && 1651 1651 ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N) 1652 1652 { 1653 1653 Werror("system(\"MAltwalk1\" ...) intvecs not of length %d\n", … … 1666 1666 res->rtyp = IDEAL_CMD; 1667 1667 res->data = result; 1668 1668 1669 1669 return FALSE; 1670 1670 } … … 1683 1683 1684 1684 if (((intvec*) h->next->Data())->length() != currRing->N && 1685 1685 ((intvec*) h->next->next->Data())->length() != currRing->N ) 1686 1686 { 1687 1687 Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n", … … 1698 1698 res->rtyp = IDEAL_CMD; 1699 1699 res->data = result; 1700 1700 1701 1701 return FALSE; 1702 1702 } … … 1714 1714 1715 1715 if (((intvec*) h->next->Data())->length() != currRing->N && 1716 1716 ((intvec*) h->next->next->Data())->length() != currRing->N ) 1717 1717 { 1718 1718 Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n", … … 1728 1728 res->rtyp = IDEAL_CMD; 1729 1729 res->data = result; 1730 1731 return FALSE; 1732 } 1733 else 1734 1730 1731 return FALSE; 1732 } 1733 else 1734 1735 1735 #ifdef TRAN_Orig 1736 1736 if (strcmp(sys_cmd, "TranMImprovwalk") == 0) … … 1745 1745 1746 1746 if (((intvec*) h->next->Data())->length() != currRing->N && 1747 1747 ((intvec*) h->next->next->Data())->length() != currRing->N ) 1748 1748 { 1749 1749 Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n", … … 1760 1760 res->rtyp = IDEAL_CMD; 1761 1761 res->data = result; 1762 1762 1763 1763 return FALSE; 1764 1764 } … … 1776 1776 1777 1777 if (((intvec*) h->next->Data())->length() != currRing->N && 1778 1778 ((intvec*) h->next->next->Data())->length() != currRing->N ) 1779 1779 { 1780 1780 Werror("system(\"MAltwalk2\" ...) intvecs not of length %d\n", … … 1791 1791 res->rtyp = IDEAL_CMD; 1792 1792 res->data = result; 1793 1793 1794 1794 return FALSE; 1795 1795 } … … 1807 1807 1808 1808 if (((intvec*) h->next->Data())->length() != currRing->N && 1809 1809 ((intvec*) h->next->next->Data())->length() != currRing->N ) 1810 1810 { 1811 1811 Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n", … … 1822 1822 res->rtyp = IDEAL_CMD; 1823 1823 res->data = result; 1824 1824 1825 1825 return FALSE; 1826 1826 } … … 2479 2479 #endif 2480 2480 /*==================== t-rep-GB ==================================*/ 2481 if (strcmp(sys_cmd, "trepgb")==0) 2482 { 2483 ring r = currRing; 2484 ideal i = (ideal)h->Data(); 2485 h=h->next; 2486 if(h) 2487 { 2488 2489 BOOLEAN b=(BOOLEAN) h->Data(); 2490 res->data=t_rep_gb(r,i,b); 2491 } 2492 else 2493 res->data=t_rep_gb(r,i); 2494 res->rtyp=IDEAL_CMD; 2495 setFlag(res,FLAG_STD); 2496 return(FALSE); 2497 } 2498 else 2499 if (strcmp(sys_cmd, "unifastmult")==0) 2481 if (strcmp(sys_cmd, "unifastmult")==0) 2500 2482 { 2501 2483 ring r = currRing; … … 2508 2490 } 2509 2491 else 2510 2492 if (strcmp(sys_cmd, "multifastmult")==0) 2511 2493 { 2512 2494 ring r = currRing; … … 2518 2500 return(FALSE); 2519 2501 } 2520 else 2521 2522 if (strcmp(sys_cmd, "mults")==0) 2523 { 2524 2502 else 2503 if (strcmp(sys_cmd, "mults")==0) 2504 { 2525 2505 res->rtyp=INT_CMD ; 2526 2506 res->data=(void*) Mults(); 2527 2507 return(FALSE); 2528 2508 } 2529 2530 2509 else 2510 if (strcmp(sys_cmd, "fastpower")==0) 2531 2511 { 2532 2512 ring r = currRing; … … 2538 2518 return(FALSE); 2539 2519 } 2540 2541 2520 else 2521 if (strcmp(sys_cmd, "normalpower")==0) 2542 2522 { 2543 2523 ring r = currRing; … … 2550 2530 } 2551 2531 else 2552 2553 if (strcmp(sys_cmd, "MCpower")==0) 2532 if (strcmp(sys_cmd, "MCpower")==0) 2554 2533 { 2555 2534 ring r = currRing; … … 2562 2541 } 2563 2542 else 2564 2565 if (strcmp(sys_cmd, "bit_subst")==0) 2543 if (strcmp(sys_cmd, "bit_subst")==0) 2566 2544 { 2567 2545 ring r = currRing;
Note: See TracChangeset
for help on using the changeset viewer.