File: mixedvolume.cpp

package info (click to toggle)
gfan 0.5%2Bdfsg-5
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,296 kB
  • ctags: 5,612
  • sloc: cpp: 39,675; makefile: 453; sh: 1
file content (31 lines) | stat: -rw-r--r-- 734 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "mixedvolume.h"

#include "tropical_weildivisor.h"
#include "multiplicity.h"

int64 mixedVolume(PolynomialSet const &g_)
{
  PolynomialSet g=idealWithSameMultiplicity(g_);
  g.simplestPolynomialsFirst();
  int n=g.getRing().getNumberOfVariables();

	assert(g.size()<=n);

	PolyhedralFan f=PolyhedralFan::fullSpace(n);

	for(PolynomialSet::const_iterator i=g.begin();i!=g.end();i++)
	{
	    PolyhedralFan f2=PolyhedralFan::normalFanOfNewtonPolytope(*i);
	    if(f.size()==0)return 0;
	    f=weilDivisor(f,f2);
	}
	if(f.size()==0)return 0;
	assert(f.size()==1);
	return f.conesBegin()->getMultiplicity();
}

#include "halfopencone.h"
bool mixedVolumePositive(PolynomialSet const &g)
{
  return nonEmptyStableIntersection(g);
}