Changeset 1f5565d in git for libpolys/polys/nc/ncSAFormula.cc
- Timestamp:
- Feb 22, 2012, 7:59:06 PM (12 years ago)
- Branches:
- (u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 {
Note: See TracChangeset
for help on using the changeset viewer.