[7bf145] | 1 | /*****************************************************************************\ |
---|
[806c18] | 2 | * Computer Algebra System SINGULAR |
---|
[7bf145] | 3 | \*****************************************************************************/ |
---|
| 4 | /** @file facFqFactorizeUtil.h |
---|
[806c18] | 5 | * |
---|
| 6 | * This file provides utility functions for multivariate factorization |
---|
[7bf145] | 7 | * |
---|
| 8 | * @author Martin Lee |
---|
| 9 | * |
---|
| 10 | * @internal @version \$Id$ |
---|
| 11 | * |
---|
| 12 | **/ |
---|
| 13 | /*****************************************************************************/ |
---|
| 14 | |
---|
| 15 | #ifndef FAC_FQ_FACTORIZE_UTIL_H |
---|
| 16 | #define FAC_FQ_FACTORIZE_UTIL_H |
---|
| 17 | |
---|
[e4fe2b] | 18 | // #include "config.h" |
---|
[7bf145] | 19 | #include "canonicalform.h" |
---|
[19b3c7] | 20 | #include "cf_map.h" |
---|
[7bf145] | 21 | |
---|
| 22 | /// append @a factors2 to @a factors1 and decompress |
---|
| 23 | /// |
---|
[806c18] | 24 | static inline |
---|
[7bf145] | 25 | void decompressAppend (CFList& factors1, ///< [in,out] a list of polys, |
---|
| 26 | ///< returns @a factors2 appended |
---|
[806c18] | 27 | ///< to it and everything is |
---|
[7bf145] | 28 | ///< decompressed |
---|
| 29 | const CFList& factors2, ///< [in] a list of polys |
---|
| 30 | const CFMap& N ///< [in] a map |
---|
[d52c12] | 31 | ) |
---|
| 32 | { |
---|
[806c18] | 33 | for (CFListIterator i= factors1; i.hasItem(); i++) |
---|
[d52c12] | 34 | i.getItem()= N (i.getItem()); |
---|
| 35 | for (CFListIterator i= factors2; i.hasItem(); i++) |
---|
| 36 | factors1.append (N (i.getItem())); |
---|
| 37 | } |
---|
| 38 | |
---|
[7bf145] | 39 | |
---|
| 40 | /// swap elements in @a factors2 and append them to @a factors1 |
---|
[806c18] | 41 | /// |
---|
[7bf145] | 42 | void appendSwap (CFList& factors1, ///< [in,out] a list of polys, |
---|
[806c18] | 43 | ///< returns swapped elements of @a |
---|
[7bf145] | 44 | ///< factors2 appended to it |
---|
| 45 | const CFList& factors2, ///< [in] a list of polys |
---|
[806c18] | 46 | const int swapLevel1, ///< [in] level of variable to be |
---|
[7bf145] | 47 | ///< swapped with x, 0 if no swapping |
---|
[806c18] | 48 | const int swapLevel2, ///< [in] level of variable to be |
---|
[7bf145] | 49 | ///< swapped with x, 0 if no swapping |
---|
| 50 | const Variable& x ///< [in] a variable |
---|
| 51 | ); |
---|
| 52 | |
---|
| 53 | /// swap elements in @a factors |
---|
[806c18] | 54 | void swap (CFList& factors, ///< [in] a list of polys, returns swapped |
---|
[7bf145] | 55 | ///< elements of factors |
---|
[806c18] | 56 | const int swapLevel1, ///< [in] level of variable to be |
---|
[7bf145] | 57 | ///< swapped with x, 0 if no swapping |
---|
[806c18] | 58 | const int swapLevel2, ///< [in] level of variable to be |
---|
[7bf145] | 59 | ///< swapped with x, 0 if no swapping |
---|
| 60 | const Variable& x ///< [in] a variable |
---|
| 61 | ); |
---|
| 62 | |
---|
| 63 | /// swap elements of @a factors2, append them to @a factors1 and decompress |
---|
[806c18] | 64 | void appendSwapDecompress ( |
---|
[7bf145] | 65 | CFList& factors1, ///< [in,out] a list of polys, |
---|
[806c18] | 66 | ///< returns swapped elements of @a |
---|
| 67 | ///< factors2 appended to it and |
---|
[7bf145] | 68 | ///< everything is decompressed |
---|
| 69 | const CFList& factors2, ///< [in] a list of polys |
---|
| 70 | const CFMap& N, ///< [in] a map |
---|
[806c18] | 71 | const int swapLevel, ///< [in] level of variable to be |
---|
[7bf145] | 72 | ///< swapped with x, 0 if no swapping |
---|
| 73 | const Variable& x ///< [in] a variable |
---|
| 74 | ); |
---|
| 75 | |
---|
| 76 | /// swap elements of @a factors2, append them to @a factors1 and decompress |
---|
| 77 | void appendSwapDecompress ( |
---|
| 78 | CFList& factors1, ///< [in,out] a list of polys, |
---|
[806c18] | 79 | ///< returns swapped elements of @a |
---|
| 80 | ///< factors2 appended to it and |
---|
[7bf145] | 81 | ///< everything is decompressed |
---|
| 82 | const CFList& factors2, ///< [in] a list of polys |
---|
| 83 | const CFMap& N, ///< [in] a map |
---|
[806c18] | 84 | const int swapLevel1, ///< [in] level of variable to be |
---|
[7bf145] | 85 | ///< swapped with x, 0 if no swapping |
---|
[806c18] | 86 | const int swapLevel2, ///< [in] level of variable to be |
---|
[7bf145] | 87 | ///< swapped with x, 0 if no swapping |
---|
| 88 | const Variable& x ///< [in] a variable |
---|
[806c18] | 89 | ); |
---|
[7bf145] | 90 | |
---|
| 91 | |
---|
| 92 | /// compute lifting bounds |
---|
| 93 | /// |
---|
[806c18] | 94 | /// @return @a liftingBounds returns an array containing the lift bounds for A |
---|
| 95 | int* liftingBounds (const CanonicalForm& A, ///< [in] a compressed poly |
---|
| 96 | const int& bivarLiftBound ///< [in] lift bound for |
---|
[7bf145] | 97 | ///< @a biFactorizer() |
---|
| 98 | ); |
---|
| 99 | |
---|
| 100 | /// shift evaluation point to zero |
---|
[806c18] | 101 | /// @return @a shift2Zero returns @a F shifted by @a evaluation s.t. 0 is a |
---|
[7bf145] | 102 | /// valid evaluation point |
---|
[806c18] | 103 | /// @sa evalPoints(), reverseShift() |
---|
[7bf145] | 104 | CanonicalForm |
---|
| 105 | shift2Zero (const CanonicalForm& F, ///< [in] a compressed poly |
---|
| 106 | CFList& Feval, ///< [in,out] an empty list, returns |
---|
| 107 | ///< @a F successively evaluated |
---|
| 108 | ///< at 0 |
---|
[6deedd] | 109 | const CFList& evaluation,///< [in] a valid evaluation point |
---|
| 110 | int l= 2 ///< [in] level at which the evaluation |
---|
| 111 | ///< starts |
---|
[7bf145] | 112 | ); |
---|
| 113 | |
---|
| 114 | /// reverse shifting the evaluation point to zero |
---|
| 115 | /// |
---|
| 116 | /// @return @a reverseShift returns a poly whose shift to zero is reversed |
---|
| 117 | /// @sa shift2Zero(), evalPoints() |
---|
| 118 | CanonicalForm reverseShift (const CanonicalForm& F, ///< [in] a compressed poly |
---|
[6deedd] | 119 | const CFList& evaluation,///< [in] a valid |
---|
[7bf145] | 120 | ///< evaluation point |
---|
[6deedd] | 121 | int l= 2 ///< [in] level at which |
---|
| 122 | ///< the evaluation starts |
---|
[7bf145] | 123 | ); |
---|
| 124 | |
---|
| 125 | #endif |
---|
| 126 | /* FAC_FQ_FACTORIZE_UTIL_H */ |
---|
| 127 | |
---|