Hir*_*aki 2 julia elementwise-operations
我知道Julia可以在v0.6中通过f.(x)将元素方式参数应用于函数
x = [1, 2, 3]
f = x->3x
@assert f.(x) = [3, 6, 9]
Run Code Online (Sandbox Code Playgroud)
现在,我将f定义为Array {Function,1}.
f1(x) = 3x
f2(x) = 4x
f = [f1, f2]
x = 2
@assert isa(f, Array{Function,1}) == true
# f.(x) is unavailable
Run Code Online (Sandbox Code Playgroud)
我想将参数应用于元素方面的函数,如上面的语法,而不是使用map,[_f(x) for _f in f]
有人可以熟悉这个问题吗?
| 归档时间: |
|
| 查看次数: |
260 次 |
| 最近记录: |