# Multiplication broken upon upgrade to Julia 0.5.0

**URL:** https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604
**Category:** General Usage
**Created:** [January 20, 2017, 3:30am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604 "2017-01-20T03:30:16Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Stephen\_Peele](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@Stephen\_Peele](https://discourse.julialang.org/u/Stephen_Peele)
#### Post date: [January 20, 2017, 3:30am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604/1 "2017-01-20T03:30:16Z")

</div>

Hello. I have a script that contains the following line:

```julia
A[k+1:n,k+1:n] -= A[k+1:n,k] * A[k,k+1:n] 

```

where _k_ and _n_ are integers and the values in the two-dimensional array are floats. Previously, in Julia 0.4.6, this was no problem and I achieved the results I desired with no errors. However, in 0.5.0, I get an error

```julia
ERROR: MethodError: no method matching *(::Array{Float64,1}, ::Array{Float64,1})

```

along with a lot of text referencing closest candidates. Has something fundamentally changed in Julia 0.5.0 that no longer allows this? How may this be rectified?

Please let me know if my entire script is needed to understand the issue more fully.

Thank you.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [January 20, 2017, 3:50am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604/2 "2017-01-20T03:50:55Z")

</div>

Yes, this is [https://github.com/JuliaLang/julia/pull/13612](https://github.com/JuliaLang/julia/pull/13612) (which is listed under “breaking changes” in the [0.5 NEWS](https://github.com/JuliaLang/julia/blob/release-0.5/NEWS.md)).

In 0.5, you need to add an explicit transpose to get a row vector for the second term:

```julia
A[k+1:n,k+1:n] -= A[k+1:n,k] * A[k,k+1:n].'

```

In 0.6, you can do:

```julia
view(A,k+1:n,k+1:n) .-= view(A,k+1:n,k) .* view(A,k,k+1:n).'

```

and the whole operation occurs in-place, with a single fused loop, without allocating temporary matrices for the right-hand-side operations.

---

<div class="post-metadata">

### Author: ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)
#### Post date: [January 20, 2017, 3:54am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604/3 "2017-01-20T03:54:57Z")

</div>

Or in v0.5,

```julia
A[k+1:n,k+1:n] -= A[k+1:n,k] * A[k:k,k+1:n]

```

Indexing with range k:k preserves dimension as in v0.4

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [January 20, 2017, 4:41am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604/4 "2017-01-20T04:41:49Z")

</div>

> [@stevengj](#):
>
> and the whole operation occurs in-place, with a single fused loop, without allocating temporary matrices for the right-hand-side operations.

Is the view on the left-hand side necessary? I thought slicing was only on the right?

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [January 20, 2017, 4:49am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604/5 "2017-01-20T04:49:35Z")

</div>

> [@ChrisRackauckas](#):
>
> Is the view on the left-hand side necessary? I thought slicing was only on the right?

Yes, because it is the left-hand side of `.-=`. If you do `A[...] .-= X`, this is equivalent to `A[...] .= A[...] .- X`, in which case the slice `A[...] ` on the right-hand side makes a copy.

---

<div class="post-metadata">

### Author: ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)
#### Post date: [January 20, 2017, 9:35am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604/6 "2017-01-20T09:35:30Z")

</div>

```julia
julia> VERSION
v"0.6.0-dev.2199"

julia> A = eye(Int,4);

julia> k,n=1,4; view(A,k+1:n,k+1:n) .-= view(A,k+1:n,k) .* view(A,k,k+1:n).'
ERROR: syntax: invalid assignment location "view(A,+(k,1):n,+(k,1):n)"

```

---

<div class="post-metadata">

### Author: ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)
#### Post date: [January 20, 2017, 10:10am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604/7 "2017-01-20T10:10:31Z")

</div>

It’s not completely clear in the docs whether you should be able to assign to a view: [http://docs.julialang.org/en/stable/stdlib/arrays/#Base.view](http://docs.julialang.org/en/stable/stdlib/arrays/#Base.view)

You can assign like this: `view(A, ...)[:,:] = ...`, but that sort of ruins the rest of the idea.

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [January 20, 2017, 10:13am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604/8 "2017-01-20T10:13:00Z")

</div>

> Yes, because it is the left-hand side of .-=. If you do A[…] .-= X, this is equivalent to A[…] .= A[…] .- X, in which case the slice A[…] on the right-hand side makes a copy.

Isn’t this kind of unfortunate? It seems unnatural to have to add `view` here.

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [January 20, 2017, 10:30am UTC](https://discourse.julialang.org/t/multiplication-broken-upon-upgrade-to-julia-0-5-0/1604/9 "2017-01-20T10:30:38Z")

</div>

Yeah, I understand it after it’s explained, but it feels like a violation of the rule “indexing on the left is a view” which I thought was always true. I think this is a good reason to start pushing for “always a view again”, especially after views keep getting cheaper and cheaper.
