Parma Polyhedra库:顶点枚举和浮点算术
Parma Polyhedra Library: Vertex Enumeration and Floating-Point Arithmetic
我正在使用Parma Polyhedra库(PPL(进行给定的多面体的顶点枚举。这已经在这里讨论。但是,我不知道如何在计算中使用有理数而不是整数。
下面的代码生成一个线段[0.3,3.7](凸在1个维度中(,PPL返回两个整数{0,3},但我想要有理数{0.3,3.7}。我如何建议PPL使用有理数(浮点算术(?
#include <cstddef>
#include <stdio.h>
#include "ppl.hh"
using namespace Parma_Polyhedra_Library;
int main() {
Variable x(0);
C_Polyhedron ph(1);
ph.refine_with_constraint( x <= 3.7);
ph.refine_with_constraint( x >= 0.3);
Generator_System gs = ph.generators();
for(Generator_System::const_iterator it = gs.begin(); it != gs.end(); it++) {
const Generator& g = *it;
std::cout << g.coefficient(x) << std::endl;
}
return 0;
}
ppl期望整数在其相反的定义中。您将必须使用共同点扩展您的不平等。
相关文章:
- 不带大括号的枚举形式
- 枚举环境变量的惯用C++14/C++17方法
- 类似枚举的计算常量
- 如何正确实现和访问运算符的各种自定义枚举器
- 错误:从"int"到枚举c++的转换无效
- C++中构造函数中的枚举
- 访问在 C++ 结构中声明的枚举变量
- 枚举类'classname'的多重定义
- 强枚举类型定义:Clang Bug 还是 C++11 标准不确定性?
- typedef 枚举和枚举类有什么区别?
- 为什么我的开关/机箱在使用枚举时默认?
- 标准::可选枚举的比较运算符
- C++两个源文件之间共享的枚举的静态实例
- 打印没有铸件的枚举可以在C++中吗?
- 枚举成员与静态 int 成员?
- C++:枚举:错误:应使用标识符而不是"}"
- 带有 c++ 的枚举(输入检查)
- 在 qml 中使用 Q_ENUM 和 Q_PROPERTY 作为枚举类
- Parma Polyhedra库:顶点枚举和浮点算术
- Parma Polyhedra库:顶点枚举