Skip to content

Commit

Permalink
Merge pull request #51 from JuliaStats/anj/is
Browse files Browse the repository at this point in the history
Use === instead of is
  • Loading branch information
andreasnoack committed Nov 3, 2016
2 parents bf05fe7 + 2d2ffc3 commit d596230
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/pdiagmat.jl
Expand Up @@ -28,7 +28,7 @@ diag(a::PDiagMat) = copy(a.diag)

function pdadd!(r::Matrix, a::Matrix, b::PDiagMat, c)
@check_argdims size(r) == size(a) == size(b)
if is(r, a)
if r === a
_adddiag!(r, b.diag, c)
else
_adddiag!(copy!(r, a), b.diag, c)
Expand Down
2 changes: 1 addition & 1 deletion src/scalmat.jl
Expand Up @@ -23,7 +23,7 @@ diag(a::ScalMat) = fill(a.value, a.dim)

function pdadd!(r::Matrix, a::Matrix, b::ScalMat, c)
@check_argdims size(r) == size(a) == size(b)
if is(r, a)
if r === a
_adddiag!(r, b.value * c)
else
_adddiag!(copy!(r, a), b.value * c)
Expand Down
2 changes: 1 addition & 1 deletion src/testutils.jl
Expand Up @@ -115,7 +115,7 @@ function pdtest_add(C::AbstractPDMat, Cmat::Matrix, verbose::Int)
_pdt(verbose, "add_scal!")
R = M + Cmat * convert(eltype(C),2)
Mr = pdadd!(M, C, convert(eltype(C),2))
@test is(Mr, M)
@test Mr === M
@test_approx_eq Mr R
end

Expand Down
2 changes: 1 addition & 1 deletion src/utils.jl
Expand Up @@ -7,7 +7,7 @@ macro check_argdims(cond)
end
end

_rcopy!(r::StridedVecOrMat, x::StridedVecOrMat) = (is(r, x) || copy!(r, x); r)
_rcopy!(r::StridedVecOrMat, x::StridedVecOrMat) = (r === x || copy!(r, x); r)


@compat function _addscal!(r::Matrix, a::Matrix, b::Union{Matrix, SparseMatrixCSC}, c::Real)
Expand Down

0 comments on commit d596230

Please sign in to comment.