Changeset 806c18 in git for factory/facFqFactorizeUtil.cc
- Timestamp:
- Nov 15, 2010, 4:34:57 PM (13 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ba3e3ef698fa0b7c5867199959cc83330073d3cb')
- Children:
- 7c3bca08c96331a56864c1d35b8c2e8ff2e0be89
- Parents:
- c840d97af622b4e4da8761738b540e21144f716b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facFqFactorizeUtil.cc
rc840d9 r806c18 1 1 /*****************************************************************************\ 2 * Computer Algebra System SINGULAR 2 * Computer Algebra System SINGULAR 3 3 \*****************************************************************************/ 4 4 /** @file facFqFactorizeUtil.cc 5 * 5 * 6 6 * This file provides utility functions for multivariate factorization 7 7 * … … 18 18 #include "cf_map.h" 19 19 20 static inline 20 static inline 21 21 void appendSwap (CFList& factors1, const CFList& factors2, const int 22 swapLevel1, const int swapLevel2, const Variable& x) 22 swapLevel1, const int swapLevel2, const Variable& x) 23 23 { 24 for (CFListIterator i= factors2; i.hasItem(); i++) 25 { 26 if (swapLevel1) 24 for (CFListIterator i= factors2; i.hasItem(); i++) 25 { 26 if (swapLevel1) 27 27 { 28 28 if (swapLevel2) 29 factors1.append (swapvar (swapvar (i.getItem(), x, 29 factors1.append (swapvar (swapvar (i.getItem(), x, 30 30 Variable (swapLevel2)), Variable (swapLevel1), x)); 31 31 else 32 32 factors1.append (swapvar (i.getItem(), Variable (swapLevel1), x)); 33 33 } 34 else 34 else 35 35 { 36 36 if (swapLevel2) 37 38 else 39 37 factors1.append (swapvar (i.getItem(), x, Variable (swapLevel2))); 38 else 39 factors1.append (i.getItem()); 40 40 } 41 41 } … … 45 45 46 46 void swap (CFList& factors, const int swapLevel1, const int swapLevel2, const 47 Variable& x) 47 Variable& x) 48 48 { 49 for (CFListIterator i= factors; i.hasItem(); i++) 50 { 51 if (swapLevel1) 49 for (CFListIterator i= factors; i.hasItem(); i++) 50 { 51 if (swapLevel1) 52 52 { 53 53 if (swapLevel2) 54 54 i.getItem()= swapvar (swapvar (i.getItem(), x, Variable (swapLevel2)), 55 55 Variable (swapLevel1), x); 56 56 else 57 57 i.getItem()= swapvar (i.getItem(), Variable (swapLevel1), x); 58 58 } 59 else 59 else 60 60 { 61 61 if (swapLevel2) 62 62 i.getItem()= swapvar (i.getItem(), x, Variable (swapLevel2)); 63 63 } 64 64 } … … 66 66 } 67 67 68 void appendSwapDecompress (CFList& factors1, const CFList& factors2, 68 void appendSwapDecompress (CFList& factors1, const CFList& factors2, 69 69 const CFMap& N, const int swapLevel, const 70 Variable& x) 70 Variable& x) 71 71 { 72 for (CFListIterator i= factors1; i.hasItem(); i++) 72 for (CFListIterator i= factors1; i.hasItem(); i++) 73 73 { 74 if (swapLevel) 74 if (swapLevel) 75 75 i.getItem()= swapvar (i.getItem(), Variable (swapLevel), x); 76 76 i.getItem()= N(i.getItem()); 77 77 } 78 for (CFListIterator i= factors2; i.hasItem(); i++) 78 for (CFListIterator i= factors2; i.hasItem(); i++) 79 79 { 80 if (!i.getItem().inCoeffDomain()) 80 if (!i.getItem().inCoeffDomain()) 81 81 factors1.append (N (i.getItem())); 82 82 } … … 84 84 } 85 85 86 void appendSwapDecompress (CFList& factors1, const CFList& factors2, 87 const CFMap& N, const int swapLevel1, 88 const int swapLevel2, const Variable& x) 86 void appendSwapDecompress (CFList& factors1, const CFList& factors2, 87 const CFMap& N, const int swapLevel1, 88 const int swapLevel2, const Variable& x) 89 89 { 90 for (CFListIterator i= factors1; i.hasItem(); i++) 90 for (CFListIterator i= factors1; i.hasItem(); i++) 91 91 { 92 if (swapLevel1) 92 if (swapLevel1) 93 93 { 94 if (swapLevel2) 94 if (swapLevel2) 95 95 i.getItem()= 96 96 N (swapvar (swapvar (i.getItem(), Variable (swapLevel2), x), x, 97 97 Variable (swapLevel1))); 98 else 98 else 99 99 i.getItem()= N (swapvar (i.getItem(), x, Variable (swapLevel1))); 100 100 } 101 else 101 else 102 102 { 103 103 if (swapLevel2) … … 107 107 } 108 108 } 109 for (CFListIterator i= factors2; i.hasItem(); i++) 110 { 111 if (!i.getItem().inCoeffDomain()) 109 for (CFListIterator i= factors2; i.hasItem(); i++) 110 { 111 if (!i.getItem().inCoeffDomain()) 112 112 factors1.append (N (i.getItem())); 113 113 } … … 115 115 } 116 116 117 int* liftingBounds (const CanonicalForm& A, const int& bivarLiftBound) 117 int* liftingBounds (const CanonicalForm& A, const int& bivarLiftBound) 118 118 { 119 119 int j= A.level() - 1; 120 120 int* liftBounds= new int [j]; 121 121 liftBounds[0]= bivarLiftBound; 122 for (int i= 1; i < j; i++) 122 for (int i= 1; i < j; i++) 123 123 { 124 liftBounds[i]= degree (A, Variable (i + 2)) + 1 + 124 liftBounds[i]= degree (A, Variable (i + 2)) + 1 + 125 125 degree (LC (A, 1), Variable (i + 2)); 126 126 }
Note: See TracChangeset
for help on using the changeset viewer.