如何为DArray的元素设置值? [英] How to set values to the elements of DArray?
本文介绍了如何为DArray的元素设置值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在探索Julia的并行计算,并尝试了以下方法:
I'm exploring the parallel computing of Julia and tried this:
a=dzeros(5);a[1]=5
但刚收到此错误:
setindex! not defined for DArray{{Float64, 1, Array{Float64, 1}}
好吧,我认为手册说setindex!
由DArray
完全实现.我错过了什么?
Well, I thought the manual said setindex!
is fully implemented by DArray
. What have I missed?
我在32位Windows操作系统上使用的是v0.2.1.
I was using v0.2.1 for Windows 32-bit.
推荐答案
I'm just an explorer too, but after reading Julia's Distributed Arrays Docs, I tried this which seemed to work.
$ ./julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" to list help topics
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.0-prerelease+2703 (2014-04-22 18:57 UTC)
_/ |\__'_|_|_|\__'_| | Commit 942ae42* (0 days old master)
|__/ | i686-redhat-linux
julia> versioninfo()
Julia Version 0.3.0-prerelease+2703
Commit 942ae42* (2014-04-22 18:57 UTC)
Platform Info:
System: Linux (i686-redhat-linux)
CPU: Genuine Intel(R) CPU T2250 @ 1.73GHz
WORD_SIZE: 32
BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY)
LAPACK: libopenblas
LIBM: libopenlibm
julia> a=dzeros(5)
5-element DArray{Float64,1,Array{Float64,1}}:
0.0
0.0
0.0
0.0
0.0
julia> localpart(a)[1]=5
5
julia> a
5-element DArray{Float64,1,Array{Float64,1}}:
5.0
0.0
0.0
0.0
0.0
julia>
在您将分布式数组设为本地"之前,似乎它们不是本地".
It seems that distributed arrays aren't "local" until you make them "local".
这篇关于如何为DArray的元素设置值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文