Skip to content

Commit ee7769a

Browse files
committed
Deprecate manually vectorized real methods in favor of compact broadcast syntax.
1 parent 155147e commit ee7769a

26 files changed

+60
-42
lines changed

base/abstractarraymath.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ squeeze(A::AbstractArray, dim::Integer) = squeeze(A, (Int(dim),))
8585
conj{T<:Real}(x::AbstractArray{T}) = x
8686
conj!{T<:Real}(x::AbstractArray{T}) = x
8787

88-
real{T<:Real}(x::AbstractArray{T}) = x
88+
broadcast{T<:Real}(::typeof(real), x::AbstractArray{T}) = x
8989
imag{T<:Real}(x::AbstractArray{T}) = zero(x)
9090

9191
+{T<:Number}(x::AbstractArray{T}) = x

base/arraymath.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ end
3030

3131
(-)(A::AbstractArray{Bool}) = reshape([ -A[i] for i in eachindex(A) ], size(A))
3232

33-
real(A::AbstractArray) = reshape([ real(x) for x in A ], size(A))
3433
imag(A::AbstractArray) = reshape([ imag(x) for x in A ], size(A))
3534

3635
function !(A::AbstractArray{Bool})

base/broadcast.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module Broadcast
55
using Base.Cartesian
66
using Base: promote_eltype_op, @get!, _msk_end, unsafe_bitgetindex, linearindices, tail, OneTo, to_shape
77
import Base: .+, .-, .*, ./, .\, .//, .==, .<, .!=, .<=, , .%, .<<, .>>, .^
8-
export broadcast, broadcast!, bitbroadcast, dotview
8+
import Base: broadcast
9+
export broadcast!, bitbroadcast, dotview
910
export broadcast_getindex, broadcast_setindex!
1011

1112
## Broadcasting utilities ##

base/deprecated.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,4 +1000,7 @@ macro vectorize_2arg(S,f)
10001000
end
10011001
export @vectorize_1arg, @vectorize_2arg
10021002

1003+
# Deprecate manually vectorized real methods in favor of compact broadcast syntax
1004+
@deprecate real(A::AbstractArray) real.(A)
1005+
10031006
# End deprecations scheduled for 0.6

base/dsp.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function conv2{T}(u::StridedVector{T}, v::StridedVector{T}, A::StridedMatrix{T})
161161
v = fft([v;zeros(T,n-length(v))])
162162
C = ifft(fft(B) .* (u * v.'))
163163
if T <: Real
164-
return real(C)
164+
return real.(C)
165165
end
166166
return C
167167
end
@@ -180,7 +180,7 @@ function conv2{T}(A::StridedMatrix{T}, B::StridedMatrix{T})
180180
p = plan_fft(At)
181181
C = ifft((p*At).*(p*Bt))
182182
if T <: Real
183-
return real(C)
183+
return real.(C)
184184
end
185185
return C
186186
end

base/linalg/arpack.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function eupd_wrapper(T, n::Integer, sym::Bool, cmplx::Bool, bmat::String,
120120
elseif which == "LR" || which == "LA" || which == "BE"
121121
dmap = real
122122
elseif which == "SR" || which == "SA"
123-
dmap = x->-real(x)
123+
dmap = x->-real.(x)
124124
elseif which == "LI"
125125
dmap = imag
126126
elseif which == "SI"

base/linalg/bidiag.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ function size(M::Bidiagonal, d::Integer)
189189
end
190190

191191
#Elementary operations
192-
for func in (:conj, :copy, :round, :trunc, :floor, :ceil, :real, :imag, :abs)
192+
broadcast(::typeof(real), M::Bidiagonal) = Bidiagonal(real.(M.dv), real.(M.ev), M.isupper)
193+
for func in (:conj, :copy, :round, :trunc, :floor, :ceil, :imag, :abs)
193194
@eval ($func)(M::Bidiagonal) = Bidiagonal(($func)(M.dv), ($func)(M.ev), M.isupper)
194195
end
195196
for func in (:round, :trunc, :floor, :ceil)

base/linalg/dense.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ function logm(A::StridedMatrix)
406406
end
407407

408408
if isreal(A) && ~np_real_eigs
409-
return real(retmat)
409+
return real.(retmat)
410410
else
411411
return retmat
412412
end

base/linalg/diagonal.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ end
7171
parent(D::Diagonal) = D.diag
7272

7373
ishermitian{T<:Real}(D::Diagonal{T}) = true
74-
ishermitian(D::Diagonal) = all(D.diag .== real(D.diag))
74+
ishermitian(D::Diagonal) = all(D.diag .== real.(D.diag))
7575
issymmetric(D::Diagonal) = true
7676
isposdef(D::Diagonal) = all(D.diag .> 0)
7777

7878
factorize(D::Diagonal) = D
7979

8080
abs(D::Diagonal) = Diagonal(abs(D.diag))
81-
real(D::Diagonal) = Diagonal(real(D.diag))
81+
broadcast(::typeof(real), D::Diagonal) = Diagonal(real.(D.diag))
8282
imag(D::Diagonal) = Diagonal(imag(D.diag))
8383

8484
istriu(D::Diagonal) = true

base/linalg/svd.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SVD{T,Tr}(U::AbstractArray{T}, S::Vector{Tr}, Vt::AbstractArray{T}) = SVD{T,Tr,t
1212
function svdfact!{T<:BlasFloat}(A::StridedMatrix{T}; thin::Bool=true)
1313
m,n = size(A)
1414
if m == 0 || n == 0
15-
u,s,vt = (eye(T, m, thin ? n : m), real(zeros(T,0)), eye(T,n,n))
15+
u,s,vt = (eye(T, m, thin ? n : m), real.(zeros(T,0)), eye(T,n,n)) # shuold real.(zeros(T,0)) be zeros(real(T),0)?
1616
else
1717
u,s,vt = LAPACK.gesdd!(thin ? 'S' : 'A', A)
1818
end

base/linalg/symmetric.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ function expm{T}(A::Hermitian{T})
250250
F = eigfact(A)
251251
retmat = (F.vectors * Diagonal(exp.(F.values))) * F.vectors'
252252
if T <: Real
253-
return real(Hermitian(retmat))
253+
return real.(Hermitian(retmat))
254254
else
255255
for i = 1:n
256256
retmat[i,i] = real(retmat[i,i])

base/linalg/triangular.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ for t in (:LowerTriangular, :UnitLowerTriangular, :UpperTriangular,
3434

3535
big(A::$t) = $t(big(A.data))
3636

37-
real{T<:Real}(A::$t{T}) = A
38-
real{T<:Complex}(A::$t{T}) = (B = real(A.data); $t(B))
37+
broadcast{T<:Real}(::typeof(real), A::$t{T}) = A
38+
broadcast{T<:Complex}(::typeof(real), A::$t{T}) = $t(real.(A.data))
3939
broadcast(::typeof(abs), A::$t) = $t(abs.(A.data))
4040
end
4141
end

base/linalg/tridiag.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ end
7171
similar{T}(S::SymTridiagonal, ::Type{T}) = SymTridiagonal{T}(similar(S.dv, T), similar(S.ev, T))
7272

7373
#Elementary operations
74-
for func in (:conj, :copy, :round, :trunc, :floor, :ceil, :abs, :real, :imag)
74+
broadcast(::typeof(real), M::SymTridiagonal) = SymTridiagonal(real.(M.dv), real.(M.ev))
75+
for func in (:conj, :copy, :round, :trunc, :floor, :ceil, :abs, :imag)
7576
@eval ($func)(M::SymTridiagonal) = SymTridiagonal(($func)(M.dv), ($func)(M.ev))
7677
end
7778
for func in (:round, :trunc, :floor, :ceil)
@@ -388,7 +389,8 @@ end
388389
copy!(dest::Tridiagonal, src::Tridiagonal) = Tridiagonal(copy!(dest.dl, src.dl), copy!(dest.d, src.d), copy!(dest.du, src.du), copy!(dest.du2, src.du2))
389390

390391
#Elementary operations
391-
for func in (:conj, :copy, :round, :trunc, :floor, :ceil, :abs, :real, :imag)
392+
broadcast(::typeof(real), M::Tridiagonal) = Tridiagonal(real.(M.dl), real.(M.d), real.(M.du), real.(M.du2))
393+
for func in (:conj, :copy, :round, :trunc, :floor, :ceil, :abs, :imag)
392394
@eval function ($func)(M::Tridiagonal)
393395
Tridiagonal(($func)(M.dl), ($func)(M.d), ($func)(M.du), ($func)(M.du2))
394396
end

base/sparse/cholmod.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ end
14851485
Ac_ldiv_B(L::FactorComponent, B) = ctranspose(L)\B
14861486

14871487
(\){T<:VTypes}(L::Factor{T}, B::Dense{T}) = solve(CHOLMOD_A, L, B)
1488-
(\)(L::Factor{Float64}, B::VecOrMat{Complex{Float64}}) = complex(L\real(B), L\imag(B))
1488+
(\)(L::Factor{Float64}, B::VecOrMat{Complex{Float64}}) = complex(L\real.(B), L\imag(B))
14891489
# First explicit TypeVars are necessary to avoid ambiguity errors with definition in
14901490
# linalg/factorizations.jl
14911491
(\){T<:VTypes}(L::Factor{T}, b::StridedVector) = Vector(L\convert(Dense{T}, b))

base/sparse/umfpack.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ for itype in UmfpackIndexTypes
213213
@isok ccall(($sym_c, :libumfpack), $itype,
214214
($itype, $itype, Ptr{$itype}, Ptr{$itype}, Ptr{Float64}, Ptr{Float64}, Ptr{Void},
215215
Ptr{Float64}, Ptr{Float64}),
216-
U.m, U.n, U.colptr, U.rowval, real(U.nzval), imag(U.nzval), tmp,
216+
U.m, U.n, U.colptr, U.rowval, real.(U.nzval), imag(U.nzval), tmp,
217217
umf_ctrl, umf_info)
218218
U.symbolic = tmp[1]
219219
return U
@@ -240,7 +240,7 @@ for itype in UmfpackIndexTypes
240240
status = ccall(($num_c, :libumfpack), $itype,
241241
(Ptr{$itype}, Ptr{$itype}, Ptr{Float64}, Ptr{Float64}, Ptr{Void}, Ptr{Void},
242242
Ptr{Float64}, Ptr{Float64}),
243-
U.colptr, U.rowval, real(U.nzval), imag(U.nzval), U.symbolic, tmp,
243+
U.colptr, U.rowval, real.(U.nzval), imag(U.nzval), U.symbolic, tmp,
244244
umf_ctrl, umf_info)
245245
if status != UMFPACK_WARNING_singular_matrix
246246
umferror(status)
@@ -395,7 +395,7 @@ for (f!, umfpack) in ((:A_ldiv_B!, :UMFPACK_A),
395395
# TODO: Optionally let user allocate these and pass in somehow
396396
r = similar(b, Float64)
397397
i = similar(b, Float64)
398-
solve!(r, lu, convert(Vector{Float64}, real(b)), $umfpack)
398+
solve!(r, lu, convert(Vector{Float64}, real.(b)), $umfpack)
399399
solve!(i, lu, convert(Vector{Float64}, imag(b)), $umfpack)
400400
# We have checked size in solve!
401401
@inbounds for k in eachindex(x)

test/bitarray.jl

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,30 @@ tc(r1,r2) = false
1010
bitcheck(b::BitArray) = length(b.chunks) == 0 || (b.chunks[end] == b.chunks[end] & Base._msk_end(b))
1111
bitcheck(x) = true
1212

13-
function check_bitop(ret_type, func, args...)
13+
function check_bitop_call(ret_type, func, args...)
1414
r1 = func(args...)
1515
r2 = func(map(x->(isa(x, BitArray) ? Array(x) : x), args)...)
16+
check_bitop_tests(ret_type, r1, r2)
17+
end
18+
function check_bitop_dotcall(ret_type, func, args...)
19+
r1 = func.(args...)
20+
r2 = func.(map(x->(isa(x, BitArray) ? Array(x) : x), args)...)
21+
check_bitop_tests(ret_type, r1, r2)
22+
end
23+
function check_bitop_tests(ret_type, r1, r2)
1624
@test isa(r1, ret_type)
1725
@test tc(r1, r2)
1826
@test isequal(r1, convert(ret_type, r2))
1927
@test bitcheck(r1)
2028
end
21-
2229
macro check_bit_operation(ex, ret_type)
23-
@assert Meta.isexpr(ex, :call)
24-
Expr(:call, :check_bitop, esc(ret_type), map(esc,ex.args)...)
30+
if Meta.isexpr(ex, :call)
31+
Expr(:call, :check_bitop_call, esc(ret_type), map(esc, ex.args)...)
32+
elseif Meta.isexpr(ex, :.)
33+
Expr(:call, :check_bitop_dotcall, esc(ret_type), esc(ex.args[1]), map(esc, ex.args[2].args)...)
34+
else
35+
throw(ArgumentError("first argument to @check_bit_operation must be an expression with head either :call or :. !"))
36+
end
2537
end
2638

2739
let t0 = time()
@@ -582,7 +594,7 @@ b1 = bitrand(n1, n2)
582594
@check_bit_operation (!)(b1) BitMatrix
583595
@check_bit_operation (-)(b1) Matrix{Int}
584596
@check_bit_operation sign(b1) BitMatrix
585-
@check_bit_operation real(b1) BitMatrix
597+
@check_bit_operation real.(b1) BitMatrix
586598
@check_bit_operation imag(b1) BitMatrix
587599
@check_bit_operation conj(b1) BitMatrix
588600

test/blas.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ for elty in [Float32, Float64, Complex64, Complex128]
106106
@test BLAS.asum(b) sum(abs.(b))
107107
@test BLAS.iamax(b) indmax(abs.(b))
108108
else
109-
@test BLAS.asum(b) sum(abs.(real(b))) + sum(abs.(imag(b)))
109+
@test BLAS.asum(b) sum(abs.(real.(b))) + sum(abs.(imag(b)))
110110
@test BLAS.iamax(b) == indmax(map(x -> abs(real(x)) + abs(imag(x)), b))
111111
end
112112

@@ -214,7 +214,7 @@ for elty in [Float32, Float64, Complex64, Complex128]
214214
fST[2,:] = ST.dv
215215
@test BLAS.sbmv('U',1,fST,x) ST*x
216216
else
217-
dv = real(rand(elty,n))
217+
dv = real.(rand(elty,n))
218218
ev = rand(elty,n-1)
219219
bH = zeros(elty,2,n)
220220
bH[1,2:n] = ev

test/linalg/arnoldi.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ let
134134
v=reshape(v,(50,50)) # reshape to matrix
135135
v/=trace(v) # factor out arbitrary phase
136136
@test isapprox(vecnorm(imag(v)),0.) # it should be real
137-
v=real(v)
137+
v=real.(v)
138138
# @test isapprox(vecnorm(v-v')/2,0.) # it should be Hermitian
139139
# Since this fails sometimes (numerical precision error),this test is commented out
140140
v=(v+v')/2

test/linalg/bidiag.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ for relty in (Int, Float32, Float64, BigFloat), elty in (relty, Complex{relty})
6666
@test Bidiagonal(full(T), isupper) == T
6767
@test big(T) == T
6868
@test full(abs.(T)) == abs.(diagm(dv)) + abs.(diagm(ev, isupper?1:-1))
69-
@test full(real(T)) == real(diagm(dv)) + real(diagm(ev, isupper?1:-1))
69+
@test full(real.(T)) == real.(diagm(dv)) + real.(diagm(ev, isupper?1:-1))
7070
@test full(imag(T)) == imag(diagm(dv)) + imag(diagm(ev, isupper?1:-1))
7171
z = zeros(elty, n)
7272

test/linalg/cholesky.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int)
114114
@test_throws Base.LinAlg.RankDeficientException Base.LinAlg.chkfullrank(cz)
115115
cpapd = cholfact(apd, :U, Val{true})
116116
@test rank(cpapd) == n
117-
@test all(diff(diag(real(cpapd.factors))).<=0.) # diagonal should be non-increasing
117+
@test all(diff(diag(real.(cpapd.factors))).<=0.) # diagonal should be non-increasing
118118
if isreal(apd)
119119
@test apd*inv(cpapd) eye(n)
120120
end

test/linalg/diagonal.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ for relty in (Float32, Float64, BigFloat), elty in (relty, Complex{relty})
2727
@test typeof(convert(Diagonal{Complex64},D)) == Diagonal{Complex64}
2828
@test typeof(convert(AbstractMatrix{Complex64},D)) == Diagonal{Complex64}
2929

30-
@test full(real(D)) == real(DM)
30+
@test full(real.(D)) == real.(DM)
3131
@test full(abs.(D)) == abs.(DM)
3232
@test full(imag(D)) == imag(DM)
3333

test/linalg/lapack.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ end
414414

415415
#ptsv
416416
for elty in (Float32, Float64, Complex64, Complex128)
417-
dv = real(ones(elty,10))
417+
dv = real.(ones(elty,10))
418418
ev = zeros(elty,9)
419419
A = SymTridiagonal(dv,ev)
420420
if elty <: Complex
@@ -429,7 +429,7 @@ end
429429

430430
#pttrf and pttrs
431431
for elty in (Float32, Float64, Complex64, Complex128)
432-
dv = real(ones(elty,10))
432+
dv = real.(ones(elty,10))
433433
ev = zeros(elty,9)
434434
A = SymTridiagonal(dv,ev)
435435
if elty <: Complex
@@ -453,7 +453,7 @@ end
453453
#posv and some errors for friends
454454
for elty in (Float32, Float64, Complex64, Complex128)
455455
A = 0.01*rand(elty,10,10)
456-
A += real(diagm(10*real(rand(elty,10))))
456+
A += real.(diagm(10*real.(rand(elty,10))))
457457
if elty <: Complex
458458
A = A + A'
459459
else

test/linalg/schur.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ for eltya in (Float32, Float64, Complex64, Complex128, Int)
3535
d,v = eig(a)
3636
f = schurfact(a)
3737
@test f[:vectors]*f[:Schur]*f[:vectors]' a
38-
@test sort(real(f[:values])) sort(real(d))
38+
@test sort(real.(f[:values])) sort(real.(d))
3939
@test sort(imag(f[:values])) sort(imag(d))
4040
@test istriu(f[:Schur]) || eltype(a)<:Real
4141
@test full(f) a

test/linalg/svd.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ for eltya in (Float32, Float64, Complex64, Complex128, Int)
4848
if eltya <: BlasFloat
4949
svdz = svdfact!(ones(eltya,0,0))
5050
@test svdz[:U] eye(eltya,0,0)
51-
@test svdz[:S] real(zeros(eltya,0))
51+
@test svdz[:S] real.(zeros(eltya,0))
5252
@test svdz[:Vt] eye(eltya,0,0)
5353
end
5454

test/linalg/triangular.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa
142142
@test diag(A1) == diag(full(A1))
143143

144144
# real
145-
@test full(real(A1)) == real(full(A1))
145+
@test full(real.(A1)) == real.(full(A1))
146146
@test full(imag(A1)) == imag(full(A1))
147147
@test full(abs.(A1)) == abs.(full(A1))
148148

@@ -302,7 +302,7 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa
302302
end
303303

304304
for eltyB in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloat})
305-
B = convert(Matrix{eltyB}, elty1 <: Complex ? real(A1)*ones(n, n) : A1*ones(n, n))
305+
B = convert(Matrix{eltyB}, elty1 <: Complex ? real.(A1)*ones(n, n) : A1*ones(n, n))
306306

307307
debug && println("elty1: $elty1, A1: $t1, B: $eltyB")
308308

@@ -402,7 +402,7 @@ for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int)
402402
debug && println("\ntype of A: ", eltya, " type of b: ", eltyb, "\n")
403403

404404
debug && println("Solve upper triangular system")
405-
Atri = UpperTriangular(lufact(A)[:U]) |> t -> eltya <: Complex && eltyb <: Real ? real(t) : t # Here the triangular matrix can't be too badly conditioned
405+
Atri = UpperTriangular(lufact(A)[:U]) |> t -> eltya <: Complex && eltyb <: Real ? real.(t) : t # Here the triangular matrix can't be too badly conditioned
406406
b = convert(Matrix{eltyb}, eltya <: Complex ? full(Atri)*ones(n, 2) : full(Atri)*ones(n, 2))
407407
x = full(Atri) \ b
408408

@@ -430,7 +430,7 @@ for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int)
430430
end
431431

432432
debug && println("Solve lower triangular system")
433-
Atri = UpperTriangular(lufact(A)[:U]) |> t -> eltya <: Complex && eltyb <: Real ? real(t) : t # Here the triangular matrix can't be too badly conditioned
433+
Atri = UpperTriangular(lufact(A)[:U]) |> t -> eltya <: Complex && eltyb <: Real ? real.(t) : t # Here the triangular matrix can't be too badly conditioned
434434
b = convert(Matrix{eltyb}, eltya <: Complex ? full(Atri)*ones(n, 2) : full(Atri)*ones(n, 2))
435435
x = full(Atri)\b
436436

test/linalg/tridiag.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ for elty in (Float32, Float64, Complex64, Complex128, Int)
5050
@test ctranspose(T) == Tridiagonal(conj(du), conj(d), conj(dl))
5151

5252
@test abs.(T) == Tridiagonal(abs.(dl),abs.(d),abs.(du))
53-
@test real(T) == Tridiagonal(real(dl),real(d),real(du))
53+
@test real.(T) == Tridiagonal(real.(dl),real.(d),real.(du))
5454
@test imag(T) == Tridiagonal(imag(dl),imag(d),imag(du))
5555
@test abs.(Ts) == SymTridiagonal(abs.(d),abs.(dl))
56-
@test real(Ts) == SymTridiagonal(real(d),real(dl))
56+
@test real.(Ts) == SymTridiagonal(real.(d),real.(dl))
5757
@test imag(Ts) == SymTridiagonal(imag(d),imag(dl))
5858

5959
# test interconversion of Tridiagonal and SymTridiagonal

0 commit comments

Comments
 (0)