Skip to content

Commit

Permalink
Use ldiv instead instead of rdiv in naivesub to avoid assuming commut…
Browse files Browse the repository at this point in the history
…ativity of multiplication
  • Loading branch information
andreasnoack committed Aug 20, 2014
1 parent 170ed36 commit 2c945d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/linalg/triangular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function naivesub!{T,S,UpLo,IsUnit}(A::Triangular{T,S,UpLo,IsUnit}, b::AbstractV
x[j] -= A[j,k] * x[k]
end
if !IsUnit
x[j]/= A[j,j]==0 ? throw(SingularException(j)) : A[j,j]
x[j] = A[j,j]==0 ? throw(SingularException(j)) : A[j,j]\x[j]
end
end
elseif UpLo == :U #do backward substitution
Expand All @@ -229,7 +229,7 @@ function naivesub!{T,S,UpLo,IsUnit}(A::Triangular{T,S,UpLo,IsUnit}, b::AbstractV
x[j] -= A[j,k] * x[k]
end
if !IsUnit
x[j]/= A[j,j]==0 ? throw(SingularException(j)) : A[j,j]
x[j] = A[j,j]==0 ? throw(SingularException(j)) : A[j,j]\x[j]
end
end
else
Expand Down

0 comments on commit 2c945d9

Please sign in to comment.