【问题标题】:Using boost::multiprecision as data type for blitz++使用 boost::multiprecision 作为 blitz++ 的数据类型
【发布时间】:2013-12-04 19:38:49
【问题描述】:

我正在尝试结合 blitz++ 的漂亮数组语法进行任意精度算术。我的问题是,cosexp 等通用数学函数不起作用:

#include <blitz/array.h>
#include <boost/multiprecision/float128.hpp>

using namespace boost::multiprecision;
using namespace blitz;

int main() {

    float128 a = 1;
    a = cos(a);
    cout << a << endl;

    Array<float128,3> myarray(2,3,4);
    myarray = 1;
    myarray = cos(myarray);
    cout << myarray;

}

g++ test.cpp -lquadmath -o test

第一个块,仅使用 float128 而不是 blitz,工作正常。然而,闪电战的第二个区块不会执行cos(myarray)。编译器看似计算出迭代,但找不到执行实际 cos(x) 值的函数:Compiler error log

我也想使用boost::multiprecision::mpfr,但一次只做一件事。我希望有人可以提供帮助。

【问题讨论】:

    标签: boost blitz++


    【解决方案1】:

    我找到了解决方案,但它涉及修补闪电战。我已经为 blitz-0.10 编写了this 补丁,并且通过修改后的 blitz,上面的代码可以正常工作。

    【讨论】:

      猜你喜欢
      • 2015-06-24
      • 1970-01-01
      • 1970-01-01
      • 2017-03-17
      • 1970-01-01
      • 2013-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多