# Instantiating a SharedArray with a Vector{Float64}

**URL:** <https://discourse.julialang.org/t/instantiating-a-sharedarray-with-a-vector-float64/746>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 5, 2016, 5:51pm UTC](https://discourse.julialang.org/t/instantiating-a-sharedarray-with-a-vector-float64/746 "2016-12-05T17:51:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CorbinFoucart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/corbinfoucart/32/14729_2.png) [@CorbinFoucart](https://discourse.julialang.org/u/CorbinFoucart)\
**Post date:** [December 5, 2016, 5:51pm UTC](https://discourse.julialang.org/t/instantiating-a-sharedarray-with-a-vector-float64/746/1 "2016-12-05T17:51:37Z")

</div>

I can initialize a SharedArray the usual way

`SharedArray(Float64, (180, 1))`

and get an empty shared array. However, I would like to initialize the array by casting an already existing vector to the shared array. Is this possible?

---

<div class="post-metadata">

**Author:** ![usefulhyun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/usefulhyun/32/1770_2.png) [@usefulhyun](https://discourse.julialang.org/u/usefulhyun)\
**Post date:** [November 16, 2017, 7:30am UTC](https://discourse.julialang.org/t/instantiating-a-sharedarray-with-a-vector-float64/746/2 "2017-11-16T07:30:42Z")

</div>

Did you find an answer?  
I also wonder the answer of this question.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [November 16, 2017, 9:24am UTC](https://discourse.julialang.org/t/instantiating-a-sharedarray-with-a-vector-float64/746/3 "2017-11-16T09:24:34Z")

</div>

Can’t you just do:

```julia
julia> x = rand(10);

julia> y = SharedArray{Float64}(length(x));

julia> y .= x
10-element SharedArray{Float64,1}:
 0.785796
 0.656855
 0.428733
 0.873864
 0.703221
 0.371945
 0.460474
 0.493993
 0.974941
 0.0194398

```

?

---

<div class="post-metadata">

**Author:** ![usefulhyun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/usefulhyun/32/1770_2.png) [@usefulhyun](https://discourse.julialang.org/u/usefulhyun)\
**Post date:** [November 16, 2017, 12:03pm UTC](https://discourse.julialang.org/t/instantiating-a-sharedarray-with-a-vector-float64/746/4 "2017-11-16T12:03:10Z")

</div>

@rdeits, thank you for your answer.  
But I do not know whether the constructor of SharedArray always generates an array filled with zeros.
