【问题标题】:Using boost library in Julia with Cxx.jl on Windows在 Windows 上使用带有 Cxx.jl 的 Julia 中的 boost 库
【发布时间】:2020-10-01 17:50:27
【问题描述】:

我在 Julia 1.3.1 中使用 Cxx 来使用 boost 库的功能,安装此类库后它可以在 Linux 上正常工作,但在 Windows 中我从未让它工作。这是我写的模块:

module Airyzero

#Returns zeros of Airy's function

using Cxx;
export airyzero
cxx""" 
    #include<iostream>
    #include <boost/math/special_functions/airy.hpp>
    #include <boost/multiprecision/cpp_dec_float.hpp>
    typedef boost::multiprecision::cpp_dec_float_50 float_type;
    """

cxx"""
    double airyzero1(int y) {
    return boost::math::airy_ai_zero<double>(y);
    }
    """

    airyzero(ind) = @cxx airyzero1(ind)

end

所以我可以在我的代码中使用来自 boost 的函数 airy_ai_zero 作为 airyzero。我需要它在 Windows 中也能工作,因为我实验室的计算机都没有使用 Linux(我的同事也没有)。

【问题讨论】:

  • 我对特殊功能了解不多,但也许respective implementations in SpecialFunctions.jl就够了?
  • @phipsgabler 不,正是因为我想计算 Airy 函数的第 n 个零,最初我还检查了这个函数是否在 SpecialFunctions.jl 中实现,但事实并非如此,所以为了不重新发明轮子,我在 GSL.jl 或其他语言中寻找了一个实现,我在 boost 库中找到了该函数。

标签: c++ windows boost julia


【解决方案1】:

我在头目录中添加了boost的安装路径:

if Sys.iswindows()
   const pathboost = "C:\\boost_1_73_0";
   addHeaderDir(pathboost,kind=C_System);
end

【讨论】:

    猜你喜欢
    • 2013-07-14
    • 1970-01-01
    • 2018-06-04
    • 2011-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多