我们一直在用GSL求解多项式。然而,我们希望用任意精度来求解多项式。我查看了GMP和Boost多精度库,但是我找不到任何用浮点系数进行多项式求解的例程。
如果不清楚,请随时发表评论。
发布于 2016-01-27 18:07:35
- The computations can be done in integer, rational, and floating-point arbitrary precision.
- The coefficients of the polynomial and various other options are given as input through a file. One can rig the original code to directly call the function from their own program.
- The solutions can be reported in various formats, such as exponential, only real, etc.
- The solver has been verified for several standard polynomial test cases and checks out.
- The solver internally uses random number which is seeded through the `/dev/random` on a Linux machine. This causes a problem that the solver is slow on the subsequent runs as the [entropy](https://en.wikipedia.org/wiki/Entropy_%28computing%29) generated is not enough before the start of the future runs. This could be bypassed by replacing it with standard pseudo-random generators.
- An attempt was made to integrate the solver as a library. However, serious segmentation faults occur which were difficult to debug. Hence, the solver was being used by calling its executable. Note: this is just from my experience and hopefully it can be done in a better way.
- A new C++ version is being developed and, hopefully, shall resolve these issues.
Boost C++库为使用GMP和MPFR提供了包装器,使用起来可能非常方便。
发布于 2016-01-10 08:29:11
如果您知道一些求解多项式方程的算法(在许多教科书中都可以找到这些算法),您可以对其进行修改并编写代码以使用GMP。
因为GMP有一个看起来像C++类接口的operator + .等等,你可以复制和通过一些现有的C代码,然后使它适应GMP。
https://stackoverflow.com/questions/34703491
复制相似问题