我使用pycddlib(Komei Fukuda的cddlib的Python包装器)生成由线性不等式给出的多面体的所有顶点。为了防止由浮点运算引起的计算不准确,我想使用精确运算。在cddlib中,据说
When some strange behavior is observed, it is always wise to create a rational approximation of the input (for example, one can replace 0.3333333 with 1/3) and to compute it with cddlib compiled with GMP Rational to see what a correct behavior should be. Whenever the time is not important, it is safer to use GMP rational arithmetic.
通过定义不等式,可以选择分数而不是浮点:mat = cdd.Matrix([[2,-1,-1,0],[0,1,0,0],[0,0,1,0]], number_type='fraction')
但是我怎么知道ccdlib现在是否是用GMP Rational编译的呢
目前没有回答
相关问题 更多 >
编程相关推荐