Loading...
Searching...
No Matches
tropicalStrategy.h
Go to the documentation of this file.
#ifndef GFANLIB_TROPICALSTRATEGY_H
#define GFANLIB_TROPICALSTRATEGY_H
#include "gfanlib/gfanlib_vector.h"
#include "gfanlib/gfanlib_zcone.h"
#include "polys/simpleideals.h"
#include "kernel/ideals.h" // for idElem
#include "callgfanlib_conversion.h"
#include "containsMonomial.h"
#include "flip.h"
#include "initial.h"
#include "witness.h"
#ifndef SING_NDEBUG
#include "Singular/ipshell.h" // for isPrime(int i)
#include "adjustWeights.h"
#include "ppinitialReduction.h"
#endif
/** \file
* implementation of the class tropicalStrategy
*
* tropicalStrategy is a class that contains information relevant for
* computing tropical varieties that is dependent on the valuation of the coefficient field.
* It represents the mutable part of an overall framework that is capable of
* computing tropical varieties both over coefficient fields without valuation and
* with valuation (currently: only p-adic valuation over rational numbers)
*/
typedef gfan::ZVector (*wAdjAlg1)(gfan::ZVector);
typedef gfan::ZVector (*wAdjAlg2)(gfan::ZVector,gfan::ZVector);
typedef bool (*redAlg)(ideal,ring,number);
class tropicalStrategy
{
private:
/**
* polynomial ring over a field with valuation
*/
ring originalRing;
/**
* input ideal, assumed to be a homogeneous prime ideal
*/
ideal originalIdeal;
/**
* the expected Dimension of the polyhedral output,
* i.e. the dimension of the ideal if valuation trivial
* or the dimension of the ideal plus one if valuation non-trivial
* (as the output is supposed to be intersected with a hyperplane)
*/
int expectedDimension;
/**
* the homogeneity space of the Grobner fan
*/
gfan::ZCone linealitySpace;
/**
* polynomial ring over the valuation ring extended by one extra variable t
*/
ring startingRing;
/**
* preimage of the input ideal under the map that sends t to the uniformizing parameter
*/
ideal startingIdeal;
/**
* uniformizing parameter in the valuation ring
*/
number uniformizingParameter;
/**
* polynomial ring over the residue field
*/
ring shortcutRing;
/**
* true if valuation non-trivial, false otherwise
*/
bool onlyLowerHalfSpace;
/**
* A function such that:
* Given weight w, returns a strictly positive weight u such that an ideal satisfying
* the valuation-sepcific homogeneity conditions is weighted homogeneous with respect to w
* if and only if it is homogeneous with respect to u
*/
gfan::ZVector (*weightAdjustingAlgorithm1) (const gfan::ZVector &w);
/**
* A function such that:
* Given strictly positive weight w and weight v,
* returns a strictly positive weight u such that on an ideal that is weighted homogeneous
* with respect to w the weights u and v coincide
*/
gfan::ZVector (*weightAdjustingAlgorithm2) (const gfan::ZVector &v, const gfan::ZVector &w);
/**
* A function that reduces the generators of an ideal I so that
* the inequalities and equations of the Groebner cone can be read off.
*/
bool (*extraReductionAlgorithm) (ideal I, ring r, number p);
ring copyAndChangeCoefficientRing(const ring r) const;
ring copyAndChangeOrderingWP(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const;
ring copyAndChangeOrderingLS(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const;
/**
* if valuation non-trivial, checks whether the generating system contains p-t
* otherwise returns true
*/
bool checkForUniformizingBinomial(const ideal I, const ring r) const;
/**
* if valuation non-trivial, checks whether the genearting system contains p
* otherwise returns true
*/
bool checkForUniformizingParameter(const ideal inI, const ring r) const;
int findPositionOfUniformizingBinomial(const ideal I, const ring r) const;
void putUniformizingBinomialInFront(ideal I, const ring r, const number q) const;
public:
/**
* Constructor for the trivial valuation case
*/
tropicalStrategy(const ideal I, const ring r, const bool completelyHomogeneous=true, const bool completeSpace=true);
/**
* Constructor for the non-trivial valuation case
* p is the uniformizing parameter of the valuation
*/
tropicalStrategy(const ideal J, const number p, const ring s);
/**
* copy constructor
*/
tropicalStrategy(const tropicalStrategy& currentStrategy);
/**
* destructor
*/
~tropicalStrategy();
/**
* assignment operator
**/
tropicalStrategy& operator=(const tropicalStrategy& currentStrategy);
bool isValuationTrivial() const
{
bool b = (uniformizingParameter==NULL);
return b;
}
bool isValuationNonTrivial() const
{
bool b = (uniformizingParameter!=NULL);
return b;
}
/**
* returns the polynomial ring over the field with valuation
*/
ring getOriginalRing() const
{
rTest(originalRing);
return originalRing;
}
/**
* returns the input ideal over the field with valuation
*/
ideal getOriginalIdeal() const
{
if (originalIdeal) id_Test(originalIdeal,originalRing);
return originalIdeal;
}
/**
* returns the polynomial ring over the valuation ring
*/
ring getStartingRing() const
{
if (startingRing) rTest(startingRing);
return startingRing;
}
/**
* returns the input ideal
*/
ideal getStartingIdeal() const
{
if (startingIdeal) id_Test(startingIdeal,startingRing);
return startingIdeal;
}
int getExpectedAmbientDimension() const
{
return rVar(startingRing);
}
/**
* returns the expected Dimension of the polyhedral output
*/
int getExpectedDimension() const
{
return expectedDimension;
}
/**
* returns the uniformizing parameter in the valuation ring
*/
number getUniformizingParameter() const
{
if (uniformizingParameter) n_Test(uniformizingParameter,startingRing->cf);
return uniformizingParameter;
}
ring getShortcutRing() const
{
if (shortcutRing) rTest(shortcutRing);
return shortcutRing;
}
/**
* returns the homogeneity space of the preimage ideal
*/
gfan::ZCone getHomogeneitySpace() const
{
return linealitySpace;
}
/**
* returns true, if v is contained in the homogeneity space; false otherwise
*/
bool homogeneitySpaceContains(const gfan::ZVector &v) const
{
return linealitySpace.contains(v);
}
/**
* returns true, if valuation non-trivial, false otherwise
*/
bool restrictToLowerHalfSpace() const
{
return onlyLowerHalfSpace;
}
/**
* Given weight w, returns a strictly positive weight u such that an ideal satisfying
* the valuation-sepcific homogeneity conditions is weighted homogeneous with respect to w
* if and only if it is homogeneous with respect to u
*/
gfan::ZVector adjustWeightForHomogeneity(gfan::ZVector w) const
{
return this->weightAdjustingAlgorithm1(w);
}
/**
* Given strictly positive weight w and weight v,
* returns a strictly positive weight u such that on an ideal that is weighted homogeneous
* with respect to w the weights u and v coincide
*/
gfan::ZVector adjustWeightUnderHomogeneity(gfan::ZVector v, gfan::ZVector w) const
{
return this->weightAdjustingAlgorithm2(v,w);
}
gfan::ZVector negateWeight(const gfan::ZVector &w) const
{
gfan::ZVector wNeg(w.size());
if (this->isValuationNonTrivial())
{
wNeg[0]=w[0];
for (unsigned i=1; i<w.size(); i++)
wNeg[i]=w[i];
}
else
wNeg = -w;
return wNeg;
}
/**
* If valuation trivial, returns a copy of r with a positive weight prepended,
* such that any ideal homogeneous with respect to w is homogeneous with respect to that weight.
* If valuation non-trivial, changes the coefficient ring to the residue field.
*/
ring getShortcutRingPrependingWeight(const ring r, const gfan::ZVector &w) const;
/**
* reduces the generators of an ideal I so that
* the inequalities and equations of the Groebner cone can be read off.
*/
bool reduce(ideal I, const ring r) const;
void pReduce(ideal I, const ring r) const;
/**
* If given w, assuming w is in the Groebner cone of the ordering on r
* and I is a standard basis with respect to that ordering,
* checks whether the initial ideal of I with respect to w contains a monomial.
* If no w is given, assuming that I is already an initial form of some ideal,
* checks whether I contains a monomial.
* In both cases returns a monomial, if it contains one, returns NULL otherwise.
**/
std::pair<poly,int> checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector &w=0) const;
/**
* given generators of the initial ideal, computes its standard basis
*/
ideal computeStdOfInitialIdeal(const ideal inI, const ring r) const;
/**
* suppose w a weight in maximal groebner cone of >
* suppose I (initially) reduced standard basis w.r.t. > and inI initial forms of its elements w.r.t. w
* suppose inJ elements of initial ideal that are homogeneous w.r.t w
* returns J elements of ideal whose initial form w.r.t. w are inI
* in particular, if w lies also inthe maximal groebner cone of another ordering >'
* and inJ is a standard basis of the initial ideal w.r.t. >'
* then the returned J will be a standard baiss of the ideal w.r.t. >'
*/
ideal computeWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const;
ideal computeLift(const ideal inJs, const ring s, const ideal inIr, const ideal Ir, const ring r) const;
/**
* given an interior point of a groebner cone
* computes the groebner cone adjacent to it
*/
std::pair<ideal,ring> computeFlip(const ideal Ir, const ring r, const gfan::ZVector &interiorPoint, const gfan::ZVector &facetNormal) const;
};
#endif
adjustWeights.h
callgfanlib_conversion.h
i
int i
Definition cfEzgcd.cc:132
p
int p
Definition cfModGcd.cc:4086
b
CanonicalForm b
Definition cfModGcd.cc:4111
tropicalStrategy::expectedDimension
int expectedDimension
the expected Dimension of the polyhedral output, i.e.
Definition tropicalStrategy.h:53
tropicalStrategy::homogeneitySpaceContains
bool homogeneitySpaceContains(const gfan::ZVector &v) const
returns true, if v is contained in the homogeneity space; false otherwise
Definition tropicalStrategy.h:230
tropicalStrategy::isValuationTrivial
bool isValuationTrivial() const
Definition tropicalStrategy.h:144
tropicalStrategy::getOriginalIdeal
ideal getOriginalIdeal() const
returns the input ideal over the field with valuation
Definition tropicalStrategy.h:167
tropicalStrategy::tropicalStrategy
tropicalStrategy(const ideal I, const ring r, const bool completelyHomogeneous=true, const bool completeSpace=true)
Constructor for the trivial valuation case.
Definition tropicalStrategy.cc:136
tropicalStrategy::isValuationNonTrivial
bool isValuationNonTrivial() const
Definition tropicalStrategy.h:149
tropicalStrategy::computeFlip
std::pair< ideal, ring > computeFlip(const ideal Ir, const ring r, const gfan::ZVector &interiorPoint, const gfan::ZVector &facetNormal) const
given an interior point of a groebner cone computes the groebner cone adjacent to it
Definition tropicalStrategy.cc:760
tropicalStrategy::operator=
tropicalStrategy & operator=(const tropicalStrategy &currentStrategy)
assignment operator
Definition tropicalStrategy.cc:361
tropicalStrategy::copyAndChangeOrderingLS
ring copyAndChangeOrderingLS(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const
Definition tropicalStrategy.cc:732
tropicalStrategy::putUniformizingBinomialInFront
void putUniformizingBinomialInFront(ideal I, const ring r, const number q) const
Definition tropicalStrategy.cc:385
tropicalStrategy::adjustWeightUnderHomogeneity
gfan::ZVector adjustWeightUnderHomogeneity(gfan::ZVector v, gfan::ZVector w) const
Given strictly positive weight w and weight v, returns a strictly positive weight u such that on an i...
Definition tropicalStrategy.h:258
tropicalStrategy::reduce
bool reduce(ideal I, const ring r) const
reduces the generators of an ideal I so that the inequalities and equations of the Groebner cone can ...
Definition tropicalStrategy.cc:414
tropicalStrategy::getHomogeneitySpace
gfan::ZCone getHomogeneitySpace() const
returns the homogeneity space of the preimage ideal
Definition tropicalStrategy.h:222
tropicalStrategy::onlyLowerHalfSpace
bool onlyLowerHalfSpace
true if valuation non-trivial, false otherwise
Definition tropicalStrategy.h:78
tropicalStrategy::linealitySpace
gfan::ZCone linealitySpace
the homogeneity space of the Grobner fan
Definition tropicalStrategy.h:57
tropicalStrategy::getExpectedDimension
int getExpectedDimension() const
returns the expected Dimension of the polyhedral output
Definition tropicalStrategy.h:199
tropicalStrategy::startingRing
ring startingRing
polynomial ring over the valuation ring extended by one extra variable t
Definition tropicalStrategy.h:61
tropicalStrategy::originalIdeal
ideal originalIdeal
input ideal, assumed to be a homogeneous prime ideal
Definition tropicalStrategy.h:46
tropicalStrategy::weightAdjustingAlgorithm1
gfan::ZVector(* weightAdjustingAlgorithm1)(const gfan::ZVector &w)
A function such that: Given weight w, returns a strictly positive weight u such that an ideal satisfy...
Definition tropicalStrategy.h:86
tropicalStrategy::pReduce
void pReduce(ideal I, const ring r) const
Definition tropicalStrategy.cc:430
tropicalStrategy::~tropicalStrategy
~tropicalStrategy()
destructor
Definition tropicalStrategy.cc:344
tropicalStrategy::findPositionOfUniformizingBinomial
int findPositionOfUniformizingBinomial(const ideal I, const ring r) const
Definition tropicalStrategy.cc:840
tropicalStrategy::computeWitness
ideal computeWitness(const ideal inJ, const ideal inI, const ideal I, const ring r) const
suppose w a weight in maximal groebner cone of > suppose I (initially) reduced standard basis w....
Definition tropicalStrategy.cc:572
tropicalStrategy::shortcutRing
ring shortcutRing
polynomial ring over the residue field
Definition tropicalStrategy.h:73
tropicalStrategy::extraReductionAlgorithm
bool(* extraReductionAlgorithm)(ideal I, ring r, number p)
A function that reduces the generators of an ideal I so that the inequalities and equations of the Gr...
Definition tropicalStrategy.h:98
tropicalStrategy::getStartingRing
ring getStartingRing() const
returns the polynomial ring over the valuation ring
Definition tropicalStrategy.h:176
tropicalStrategy::adjustWeightForHomogeneity
gfan::ZVector adjustWeightForHomogeneity(gfan::ZVector w) const
Given weight w, returns a strictly positive weight u such that an ideal satisfying the valuation-sepc...
Definition tropicalStrategy.h:248
tropicalStrategy::getShortcutRingPrependingWeight
ring getShortcutRingPrependingWeight(const ring r, const gfan::ZVector &w) const
If valuation trivial, returns a copy of r with a positive weight prepended, such that any ideal homog...
Definition tropicalStrategy.cc:446
tropicalStrategy::negateWeight
gfan::ZVector negateWeight(const gfan::ZVector &w) const
Definition tropicalStrategy.h:263
tropicalStrategy::uniformizingParameter
number uniformizingParameter
uniformizing parameter in the valuation ring
Definition tropicalStrategy.h:69
tropicalStrategy::copyAndChangeCoefficientRing
ring copyAndChangeCoefficientRing(const ring r) const
Definition tropicalStrategy.cc:562
tropicalStrategy::copyAndChangeOrderingWP
ring copyAndChangeOrderingWP(const ring r, const gfan::ZVector &w, const gfan::ZVector &v) const
Definition tropicalStrategy.cc:702
tropicalStrategy::computeLift
ideal computeLift(const ideal inJs, const ring s, const ideal inIr, const ideal Ir, const ring r) const
Definition tropicalStrategy.cc:686
tropicalStrategy::startingIdeal
ideal startingIdeal
preimage of the input ideal under the map that sends t to the uniformizing parameter
Definition tropicalStrategy.h:65
tropicalStrategy::checkForUniformizingParameter
bool checkForUniformizingParameter(const ideal inI, const ring r) const
if valuation non-trivial, checks whether the genearting system contains p otherwise returns true
Definition tropicalStrategy.cc:865
tropicalStrategy::getStartingIdeal
ideal getStartingIdeal() const
returns the input ideal
Definition tropicalStrategy.h:185
tropicalStrategy::restrictToLowerHalfSpace
bool restrictToLowerHalfSpace() const
returns true, if valuation non-trivial, false otherwise
Definition tropicalStrategy.h:238
tropicalStrategy::weightAdjustingAlgorithm2
gfan::ZVector(* weightAdjustingAlgorithm2)(const gfan::ZVector &v, const gfan::ZVector &w)
A function such that: Given strictly positive weight w and weight v, returns a strictly positive weig...
Definition tropicalStrategy.h:93
tropicalStrategy::computeStdOfInitialIdeal
ideal computeStdOfInitialIdeal(const ideal inI, const ring r) const
given generators of the initial ideal, computes its standard basis
Definition tropicalStrategy.cc:654
tropicalStrategy::getOriginalRing
ring getOriginalRing() const
returns the polynomial ring over the field with valuation
Definition tropicalStrategy.h:158
tropicalStrategy::getUniformizingParameter
number getUniformizingParameter() const
returns the uniformizing parameter in the valuation ring
Definition tropicalStrategy.h:207
tropicalStrategy::checkInitialIdealForMonomial
std::pair< poly, int > checkInitialIdealForMonomial(const ideal I, const ring r, const gfan::ZVector &w=0) const
If given w, assuming w is in the Groebner cone of the ordering on r and I is a standard basis with re...
Definition tropicalStrategy.cc:494
tropicalStrategy::checkForUniformizingBinomial
bool checkForUniformizingBinomial(const ideal I, const ring r) const
if valuation non-trivial, checks whether the generating system contains p-t otherwise returns true
Definition tropicalStrategy.cc:812
tropicalStrategy::getShortcutRing
ring getShortcutRing() const
Definition tropicalStrategy.h:213
tropicalStrategy::getExpectedAmbientDimension
int getExpectedAmbientDimension() const
Definition tropicalStrategy.h:191
tropicalStrategy::originalRing
ring originalRing
polynomial ring over a field with valuation
Definition tropicalStrategy.h:42
n_Test
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r).
Definition coeffs.h:715
containsMonomial.h
s
const CanonicalForm int s
Definition facAbsFact.cc:51
w
const CanonicalForm & w
Definition facAbsFact.cc:51
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
flip.h
ideals.h
initial.h
ipshell.h
NULL
#define NULL
Definition omList.c:12
ppinitialReduction.h
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598
rTest
#define rTest(r)
Definition ring.h:794
simpleideals.h
id_Test
#define id_Test(A, lR)
Definition simpleideals.h:89
wAdjAlg2
gfan::ZVector(* wAdjAlg2)(gfan::ZVector, gfan::ZVector)
Definition tropicalStrategy.h:33
wAdjAlg1
gfan::ZVector(* wAdjAlg1)(gfan::ZVector)
Definition tropicalStrategy.h:32
redAlg
bool(* redAlg)(ideal, ring, number)
Definition tropicalStrategy.h:34
witness.h