# Five-argument mul! C

**URL:** <https://discourse.julialang.org/t/five-argument-mul-c/33068>\
**Category:** General Usage\
**Created:** [January 7, 2020, 3:43pm UTC](https://discourse.julialang.org/t/five-argument-mul-c/33068 "2020-01-07T15:43:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [January 7, 2020, 3:43pm UTC](https://discourse.julialang.org/t/five-argument-mul-c/33068/1 "2020-01-07T15:43:49Z")

</div>

mul! on 1.3.1 does not update `x[:,:,1]` in

```julia
x = zeros(2,2,2)
mul!(x[:,:,1],[1,1],[1 2],1.0,1.0)

```

In contrast, it does update `x[1]` in

```julia
x = [zeros(2,2) for i=1:2]
mul!(x[1],[1,1],[1 2],1.0,1.0)

```

Is this difference obvious?

---

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [January 7, 2020, 3:46pm UTC](https://discourse.julialang.org/t/five-argument-mul-c/33068/2 "2020-01-07T15:46:46Z")

</div>

Julia slices make copies by default, not views. So the 5-argument mul in your first example is updating the copy.  
Try

```julia
x = zeros(2,2,2)
@views mul!(x[:,:,1],[1,1],[1 2],1.0,1.0)
x # updated

```

Or

```julia
x = zeros(2,2,2)
xsubsetcopy = x[:,:,1]
mul!(xsubsetcopy,[1,1],[1 2],1.0,1.0)
x # all zeros
xsubsetcopy # updated

```

---

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [January 7, 2020, 3:55pm UTC](https://discourse.julialang.org/t/five-argument-mul-c/33068/3 "2020-01-07T15:55:00Z")

</div>

Thanks. The slices/copy thing caught me (again). I guess your first example could also be

```julia
mul!(view(x,:,:,1),[1,1],[1 2],1.0,1.0)

```
