草庐IT

c++ - 如何在 boost::multiprecision::mpfr 中使用复数?

根据https://stackoverflow.com/a/17932632/1700939,应该可以在gcc-4.7中使用带有boost::multiprecision的复数。这确实适用于boost::multiprecision::float128:-----------test.cpp------------#include#includeusingnamespacestd;typedefboost::multiprecision::float128real_type_b;typedefcomplexnumeric_type_b;intmain(){numeric_type_ba

c++ - 具有 boost::multiprecision::mpfr_float 的 Eigen3 动态矩阵

我想制作矩阵并使用Eigen3库使用它们,我的数字类型是Boost.Multiprecision的mpfr_float包装器。我可以很好地制作矩阵,但是除了矩阵加法之外,我尝试过的所有操作都失败了。仅将两个单位矩阵相乘会产生垃圾结果!这是一个MWE:#include#include#include#includenamespaceEigen{usingboost::multiprecision::mpfr_float;templatestructNumTraits{typedefboost::multiprecision::mpfr_floatReal;typedefboost::mu

c++ - 我可以使用 `mpfr_t` 作为输入和输出参数吗?

问题很简单直接,但是我在documentation上找不到答案。.如果我有mpfr_ta,b;我可以做类似的事情吗mpfr_add(a,a,b,rnd);这将计算a和b的总和并将结果存储在a中。我不知道这是否会导致别名问题,可能使结果无效,或者这是否正常。 最佳答案 没关系,它在链接文档的第4.3节中。MPFRallowsyoutousethesamevariableforbothinputandoutputinthesameexpression.Forexample,themainfunctionforfloating-point