julia - 如何在 Julia 1.0.0 中访问 conv 函数
问题描述
stackoverflow 上的这个问题使用 Julia 0.6.1,如下所示:
The convolution function in Julia has the following behaviour:
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.1 (2017-10-24 22:15 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu
julia> conv([1,2,NaN],[1])
3-element Array{Float64,1}:
NaN
NaN
NaN
Julia 1.0.0 中的相同内容会产生以下错误输出:
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.0.0 (2018-08-08)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> conv([1,2,NaN],[1])
ERROR: UndefVarError: conv not defined
Stacktrace:
[1] top-level scope at none:0
如何访问conv
Julia 1.0.0 中的函数?
解决方案
卷积函数已移至代表数字信号处理的包DSP.jl。
在尝试将 v0.7 之前的代码移植到 Julia v1.0 时,通常建议使用 Julia v0.7。事实上,这是 v0.7 存在的唯一原因。
在 v0.7 中调用conv
时,您将获得所需的所有信息:
julia> conv(rand(10))
ERROR: conv has been moved to the package DSP.jl.
Run `Pkg.add("DSP")` to install it, restart Julia,
and then run `using DSP` to load it.
如果您想避免在您的机器上运行 v0.7 只是为了找出某些东西已移动到哪里,您还可以在deprecated.jl中搜索旧函数的名称。搜索conv
我们发现:
for f in [:conv, :conv2, :deconv, :filt, :filt!, :xcorr]
@eval Base.@deprecate_moved $f "DSP"
end
虽然是源代码,我相信@deprecate_moved "DSP"
是可以理解的。
推荐阅读
- excel - 更换方法和改变格式?
- java - 如何使用 SAX 在 1 个班级一次解析 2 个 xml 文件
- z3 - SMT 上下文中的“无量词逻辑”是什么意思?
- python - 如何使用 hidden_markov 修复广播状态和发射概率的错误?
- python - 尝试使用棉花糖通过 data_key 加载数据时出现“缺少数据”
- .net - vb.net“传递给 C 运行时函数的无效参数”
- python - Pandas read_csv 错误标记来自 Gutenberg 项目的文本
- html - 如何用 rgba 覆盖父元素并覆盖子图像
- javascript - Vuejs:为什么我的数组结果包含__ob__:观察者?
- c# - 为什么加载区域控制器时我的 BaseController.User 值 == null?