Changeset 1f5565d in git
- Timestamp:
- Feb 22, 2012, 7:59:06 PM (11 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 762407dfdd4ce18e60ae114357800624f0b09308
- Parents:
- f23ccea9a38ee5dfa1e6454e84dd4bd11cd5ce90
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-02-22 19:59:06+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-02-23 20:35:09+01:00
- Location:
- libpolys/polys/nc
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/nc/ncSACache.cc
rf23cce r1f5565d 23 23 24 24 #ifndef NDEBUG 25 #define OUTPUT 125 #define OUTPUT MYTEST 26 26 #else 27 27 #define OUTPUT 0 -
libpolys/polys/nc/ncSAFormula.cc
rf23cce r1f5565d 27 27 28 28 #ifndef NDEBUG 29 #define OUTPUT 129 #define OUTPUT MYTEST 30 30 #else 31 31 #define OUTPUT 0 … … 52 52 #if OUTPUT 53 53 Print("ncInitSpecialPowersMultiplication(ring), ring: \n"); 54 rWrite(r );54 rWrite(r, TRUE); 55 55 PrintLn(); 56 56 #endif … … 77 77 78 78 79 80 81 // TODO: return q-coeff? 82 static inline BOOLEAN AreCommutingVariables(const ring r, int i, int j/*, number *qq*/) 83 { 84 #if OUTPUT 85 Print("AreCommutingVariables(ring, k: %d, i: %d)!", j, i); 86 PrintLn(); 87 #endif 88 89 assume(i != j); 90 91 assume(i > 0); 92 assume(i <= r->N); 93 94 95 assume(j > 0); 96 assume(j <= r->N); 97 98 const BOOLEAN reverse = (i > j); 99 100 if (reverse) { int k = j; j = i; i = k; } 101 102 assume(i < j); 103 104 { 105 const poly d = GetD(r, i, j); 106 107 #if OUTPUT 108 Print("D_{%d, %d} = ", i, j); p_Write(d, r); 109 #endif 110 111 if( d != NULL) 112 return FALSE; 113 } 114 115 116 { 117 const number q = p_GetCoeff(GetC(r, i, j), r); 118 119 if( !n_IsOne(q, r) ) 120 return FALSE; 121 } 122 123 return TRUE; // [VAR(I), VAR(J)] = 0!! 124 125 /* 126 if (reverse) 127 *qq = n_Invers(q, r); 128 else 129 *qq = n_Copy(q, r); 130 return TRUE; 131 */ 132 } 133 79 134 static inline Enum_ncSAType AnalyzePairType(const ring r, int i, int j) 80 135 { 81 136 #if OUTPUT 82 Print("AnalyzePair(ring, i: %d, j: %d) !", i, j);137 Print("AnalyzePair(ring, i: %d, j: %d):", i, j); 83 138 PrintLn(); 84 139 #endif … … 91 146 92 147 93 const number q = p_GetCoeff(GetC(r, i, j), r); 148 const poly c = GetC(r, i, j); 149 const number q = p_GetCoeff(c, r); 94 150 const poly d = GetD(r, i, j); 95 151 96 #if OUTPUT97 Print("C_{%d, %d} = ", i, j); { number t = n_Copy(q, r); n_Write(t, r); n_Delete(&t, r); };152 #if 0 && OUTPUT 153 Print("C_{%d, %d} = ", i, j); p_Write(c, r); PrintLn(); 98 154 Print("D_{%d, %d} = ", i, j); p_Write(d, r); 99 155 #endif … … 107 163 return _ncSA_1xy0x0y0; 108 164 109 if( n_IsMOne(q, r) ) 165 if( n_IsMOne(q, r) ) // anti-commutative 110 166 return _ncSA_Mxy0x0y0; 111 167 112 return _ncSA_Qxy0x0y0; 168 return _ncSA_Qxy0x0y0; // quasi-commutative 113 169 } else 114 170 { 115 171 if( n_IsOne(q, r) ) // "Lie" case 116 172 { 117 if( pNext(d) == NULL ) // Our Main Special Case !173 if( pNext(d) == NULL ) // Our Main Special Case: d is only a term! 118 174 { 119 175 // const number g = p_GetCoeff(d, r); // not used for now 120 176 if( p_LmIsConstantComp(d, r) ) // Weyl 121 177 return _ncSA_1xy0x0yG; 122 178 123 179 const int k = p_IsPurePower(d, r); // k if not pure power 124 180 125 if( k > 0 ) 126 if( p_GetExp(d, k, r) == 1 ) 181 if( k > 0 ) // d = var(k)^?? 182 { 183 const int exp = p_GetExp(d, k, r); 184 185 if (exp == 1) 127 186 { 128 if(k == i) 187 if(k == i) // 2 -ubalgebra in var(i) & var(j), with linear relation...? 129 188 return _ncSA_1xyAx0y0; 130 189 131 190 if(k == j) 132 191 return _ncSA_1xy0xBy0; 192 } else if ( exp == 2 && k!= i && k != j) // Homogenized Weyl algebra [x, Dx] = t^2? 193 { 194 // number qi, qj; 195 if (AreCommutingVariables(r, k, i/*, &qi*/) && AreCommutingVariables(r, k, j/*, &qj*/) ) // [x, t] = [Dx, t] = 0? 196 { 197 const number g = p_GetCoeff(d, r); 198 199 if (n_IsOne(g, r)) 200 return _ncSA_1xy0x0yT2; // save k!?, G = LC(d) == qi == qj == 1!!! 201 } 133 202 } 203 } 134 204 } 135 205 } 136 } 206 // Hmm, what about a more general case of q != 1??? 207 } 208 #if OUTPUT 209 Print("C_{%d, %d} = ", i, j); p_Write(c, r); 210 Print("D_{%d, %d} = ", i, j); p_Write(d, r); 211 PrintS("====>>>>_ncSA_notImplemented\n"); 212 #endif 137 213 138 214 return _ncSA_notImplemented; 139 215 } 140 141 216 142 217 … … 371 446 /////////////////////////////////////////////////////////////////////////////////////////// 372 447 /////////////////////////////////////////////////////////////////////////////////////////// 448 static inline poly ncSA_1xy0x0yT2(const int i, const int j, const int n, const int m, const int m_k, const ring r) 449 { 450 #if OUTPUT 451 Print("ncSA_1xy0x0yT2(var(%d)^{%d}, var(%d)^{%d}, t: var(%d), r)!", j, m, i, n, m_k); 452 PrintLn(); 453 #endif 454 455 int kn = n; 456 int km = m; 457 458 // k == 0! 459 number c = n_Init(1, r); 460 461 poly p = p_One( r ); 462 463 p_SetExp(p, j, km--, r); // y ^ (m) 464 p_SetExp(p, i, kn--, r); // x ^ (n) 465 // p_SetExp(p, m_k, k << 1, r); // homogenization with var(m_k) ^ (2*k) 466 467 p_Setm(p, r); // pResult = x^n * y^m 468 469 470 poly pResult = p; 471 poly pLast = p; 472 473 int min = si_min(m, n); 474 475 int k = 1; 476 477 for(; k < min; k++ ) 478 { 479 number t = n_Init(km + 1, r); 480 // n_InpMult(t, m_g, r); // t = ((m - k) + 1) * gamma 481 n_InpMult(c, t, r); // c = c'* ((m - k) + 1) * gamma 482 n_Delete(&t, r); 483 484 t = n_Init(kn + 1, r); 485 n_InpMult(c, t, r); // c = (c'* ((m - k) + 1) * gamma) * ((n - k) + 1) 486 n_Delete(&t, r); 487 488 t = n_Init(k, r); 489 c = n_Div(c, t, r); 490 n_Delete(&t, r); 491 492 // // n_Normalize(c, r); 493 494 t = n_Copy(c, r); // not the last! 495 496 p = p_NSet(t, r); 497 498 p_SetExp(p, j, km--, r); // y ^ (m-k) 499 p_SetExp(p, i, kn--, r); // x ^ (n-k) 500 501 p_SetExp(p, m_k, k << 1, r); // homogenization with var(m_k) ^ (2*k) 502 503 p_Setm(p, r); // pResult = x^(n-k) * y^(m-k) 504 505 pNext(pLast) = p; 506 pLast = p; 507 } 508 509 assume(k == min); 510 assume((km == 0) || (kn == 0) ); 511 512 { 513 // n_InpMult(c, m_g, r); // c = c'* gamma 514 515 if( km > 0 ) 516 { 517 number t = n_Init(km + 1, r); 518 n_InpMult(c, t, r); // c = (c'* gamma) * (m - k + 1) 519 n_Delete(&t, r); 520 } 521 522 if( kn > 0 ) 523 { 524 number t = n_Init(kn + 1, r); 525 n_InpMult(c, t, r); // c = (c'* gamma) * (n - k + 1) 526 n_Delete(&t, r); 527 } 528 529 number t = n_Init(k, r); // c = ((c'* gamma) * ((n - k + 1) * (m - k + 1))) / k; 530 c = n_Div(c, t, r); 531 n_Delete(&t, r); 532 } 533 534 p = p_NSet(c, r); 535 536 p_SetExp(p, j, km, r); // y ^ (m-k) 537 p_SetExp(p, i, kn, r); // x ^ (n-k) 538 539 p_SetExp(p, m_k, k << 1, r); // homogenization with var(m_k) ^ (2*k) 540 541 p_Setm(p, r); // 542 543 pNext(pLast) = p; 544 545 CorrectPolyWRTOrdering(pResult, r); 546 547 return pResult; 548 } 549 /////////////////////////////////////////////////////////////////////////////////////////// 550 551 552 553 /////////////////////////////////////////////////////////////////////////////////////////// 373 554 static inline poly ncSA_ShiftAx(int i, int j, int n, int m, const number m_shiftCoef, const ring r) 374 555 { … … 501 682 } 502 683 503 const number g = p_GetCoeff(GetD(r, i, j), r); 684 const poly d = GetD(r, i, j); 685 const number g = p_GetCoeff(d, r); 504 686 505 687 if( type == _ncSA_1xy0x0yG ) // Weyl 506 688 return ::ncSA_1xy0x0yG(i, j, n, m, g, r); 507 689 690 if( type == _ncSA_1xy0x0yT2 ) // Homogenous Weyl... 691 return ::ncSA_1xy0x0yT2(i, j, n, m, p_IsPurePower(d, r), r); 692 508 693 if( type == _ncSA_1xyAx0y0 ) // Shift 1 509 694 return ::ncSA_1xyAx0y0(i, j, n, m, g, r); … … 557 742 } 558 743 744 poly CFormulaPowerMultiplier::ncSA_1xy0x0yT2(const int i, const int j, const int n, const int m, const int k, const ring r) 745 { 746 return ::ncSA_1xy0x0yT2(i, j, n, m, k, r); 747 } 748 559 749 poly CFormulaPowerMultiplier::ncSA_1xyAx0y0(const int i, const int j, const int n, const int m, const number m_shiftCoef, const ring r) 560 750 { -
libpolys/polys/nc/ncSAFormula.h
rf23cce r1f5565d 19 19 { 20 20 _ncSA_notImplemented = -1, 21 _ncSA_1xy0x0y0 = 0, // commutative 22 _ncSA_Mxy0x0y0 = 1, // anti-commutative 23 _ncSA_Qxy0x0y0 = 2, // quasi-commutative 24 _ncSA_1xyAx0y0 = 10, // shift 1 25 _ncSA_1xy0xBy0 = 20, // shift 2 26 _ncSA_1xy0x0yG = 30 // Weyl 21 _ncSA_1xy0x0y0 = 0x00, // commutative 22 _ncSA_Mxy0x0y0 = 0x01, // anti-commutative 23 _ncSA_Qxy0x0y0 = 0x02, // quasi-commutative 24 _ncSA_1xyAx0y0 = 0x10, // shift 1 25 _ncSA_1xy0xBy0 = 0x20, // shift 2 26 _ncSA_1xy0x0yG = 0x30, // Weyl 27 _ncSA_1xy0x0yT2 = 0x100 // homogenized Weyl algebra? 27 28 }; 28 29 … … 74 75 75 76 static poly ncSA_1xy0x0yG(const int i, const int j, const int n, const int m, const number m_g, const ring r); 77 static poly ncSA_1xy0x0yT2(const int i, const int j, const int n, const int m, const int k, const ring r); 76 78 77 79 static poly ncSA_1xyAx0y0(const int i, const int j, const int n, const int m, const number m_shiftCoef, const ring r); -
libpolys/polys/nc/ncSAMult.cc
rf23cce r1f5565d 26 26 27 27 #ifndef NDEBUG 28 #define OUTPUT 128 #define OUTPUT MYTEST 29 29 #else 30 30 #define OUTPUT 0 … … 248 248 #endif 249 249 250 if( p_Procs == NULL ) 251 p_Procs = rGR->p_Procs; 250 assume( p_Procs != NULL ); 252 251 253 252 // "commutative" … … 265 264 } 266 265 267 boolncInitSpecialPairMultiplication(ring r)266 BOOLEAN ncInitSpecialPairMultiplication(ring r) 268 267 { 269 268 #if OUTPUT 270 269 PrintS("ncInitSpecialPairMultiplication(ring), ring: \n"); 271 rWrite(r); 272 PrintLn(); 273 #endif 274 275 assume(rIsPluralRing(r)); 276 assume(!rIsSCA(r)); 270 rWrite(r, TRUE); 271 PrintLn(); 272 #endif 273 274 if(!rIsPluralRing(r)); 275 return TRUE; 276 277 if(rIsSCA(r)) 278 return TRUE; 277 279 278 280 if( r->GetNC()->GetGlobalMultiplier() != NULL ) 279 281 { 280 282 WarnS("Already defined!"); 281 return false;283 return TRUE; 282 284 } 283 285 284 286 r->GetNC()->GetGlobalMultiplier() = new CGlobalMultiplier(r); 285 287 286 ggnc_p_ProcsSet(r, NULL);287 return true;288 ggnc_p_ProcsSet(r, r->p_Procs); 289 return FALSE; // ok! 288 290 } 289 291 … … 654 656 } 655 657 658 /////////////////////////////////////////////////////////////////////////////////////////// 659 CHWeylSpecialPairMultiplier::CHWeylSpecialPairMultiplier(ring r, int i, int j, int k): 660 CSpecialPairMultiplier(r, i, j), m_k(k) 661 { 662 #if OUTPUT 663 Print("CHWeylSpecialPairMultiplier::CHWeylSpecialPairMultiplier(ring, i: %d, j: %d, k: %d)!", i, j, k); 664 PrintLn(); 665 #endif 666 } 667 668 669 CHWeylSpecialPairMultiplier::~CHWeylSpecialPairMultiplier() 670 { 671 #if OUTPUT 672 PrintS("CHWeylSpecialPairMultiplier::~CHWeylSpecialPairMultiplier()"); 673 PrintLn(); 674 #endif 675 } 676 677 // Exponent * Exponent 678 poly CHWeylSpecialPairMultiplier::MultiplyEE(const int expLeft, const int expRight) 679 { 680 #if OUTPUT 681 Print("CHWeylSpecialPairMultiplier::MultiplyEE(var(%d)^{%d}, var(%d)^{%d})!", GetJ(), expLeft, GetI(), expRight); 682 PrintLn(); 683 #endif 684 // Char == 0, otherwise - problem! 685 686 687 const ring r = GetBasering(); 688 689 assume( expLeft*expRight > 0 ); 690 691 return CFormulaPowerMultiplier::ncSA_1xy0x0yT2(GetI(), GetJ(), expRight, expLeft, m_k, r); 692 } 693 656 694 657 695 /////////////////////////////////////////////////////////////////////////////////////////// … … 781 819 if( type == _ncSA_1xy0xBy0 ) // Shift 2 782 820 return new CShiftSpecialPairMultiplier(r, i, j, j, g); 821 822 if( type == _ncSA_1xy0x0yT2 ) // simple homogenized Weyl algebra 823 return new CHWeylSpecialPairMultiplier(r, i, j, p_IsPurePower(d, r)); 783 824 784 825 } -
libpolys/polys/nc/ncSAMult.h
rf23cce r1f5565d 25 25 // 26 26 27 boolncInitSpecialPairMultiplication(ring r);27 BOOLEAN ncInitSpecialPairMultiplication(ring r); 28 28 29 29 … … 32 32 { 33 33 protected: 34 ring m_basering;35 int m_NVars; // N = number of variables34 const ring m_basering; 35 const int m_NVars; // N = number of variables 36 36 37 37 public: … … 100 100 { 101 101 private: 102 int m_i; 102 int m_i; // 2-gen subalgebra in these variables... 103 103 int m_j; 104 104 … … 557 557 }; 558 558 559 ////////////////////////////////////////////////////////////////////////// 560 class CHWeylSpecialPairMultiplier: public CSpecialPairMultiplier 561 { 562 private: 563 const int m_k; 564 // TODO: make cache for some 'good' powers!? 565 566 public: 567 CHWeylSpecialPairMultiplier(ring r, int i, int j, int k); 568 virtual ~CHWeylSpecialPairMultiplier(); 569 570 // Exponent * Exponent 571 virtual poly MultiplyEE(const int expLeft, const int expRight); 572 }; 573 559 574 560 575 //////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.