Skip to content

Commit 93701b5

Browse files
authored
Merge pull request #456 from JuliaArrays/fe/uniform-with-base
deprecate zeros and ones on instances
2 parents 496c294 + f9f3051 commit 93701b5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/arraymath.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@inline zeros(::SA) where {SA <: StaticArray} = zeros(SA)
1+
@deprecate zeros(A::StaticArray) zeros(typeof(A))
22
@inline zeros(::Type{SA}) where {SA <: StaticArray} = _zeros(Size(SA), SA)
33
@generated function _zeros(::Size{s}, ::Type{SA}) where {s, SA <: StaticArray}
44
T = eltype(SA)
@@ -12,7 +12,7 @@
1212
end
1313
end
1414

15-
@inline ones(::SA) where {SA <: StaticArray} = ones(SA)
15+
@deprecate ones(A::StaticArray) ones(typeof(A))
1616
@inline ones(::Type{SA}) where {SA <: StaticArray} = _ones(Size(SA), SA)
1717
@generated function _ones(::Size{s}, ::Type{SA}) where {s, SA <: StaticArray}
1818
T = eltype(SA)

src/lu.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function __lu(A::StaticMatrix{M,1}, ::Val{Pivot}) where {M,Pivot}
8585
Akkinv = inv(A[kp,1])
8686
Ls = A[ps,1] * Akkinv
8787
if !isfinite(Akkinv)
88-
Ls = zeros(Ls)
88+
Ls = zeros(typeof(Ls))
8989
end
9090
L = [SVector{1}(one(eltype(Ls))); Ls]
9191
p = [SVector{1,Int}(kp); ps]
@@ -115,15 +115,15 @@ function __lu(A::StaticMatrix{M,N,T}, ::Val{Pivot}) where {M,N,T,Pivot}
115115
Akkinv = inv(A[kp,1])
116116
Ls = A[ps,1] * Akkinv
117117
if !isfinite(Akkinv)
118-
Ls = zeros(Ls)
118+
Ls = zeros(typeof(Ls))
119119
end
120120

121121
# Update the rest
122122
Arest = A[ps,tailindices(Val{N})] - Ls*Ufirst[:,tailindices(Val{N})]
123123
Lrest, Urest, prest = __lu(Arest, Val(Pivot))
124124
p = [SVector{1,Int}(kp); ps[prest]]
125-
L = [[SVector{1}(one(eltype(Ls))); Ls[prest]] [zeros(SMatrix{1}(Lrest[1,:])); Lrest]]
126-
U = [Ufirst; [zeros(Urest[:,1]) Urest]]
125+
L = [[SVector{1}(one(eltype(Ls))); Ls[prest]] [zeros(typeof(SMatrix{1}(Lrest[1,:]))); Lrest]]
126+
U = [Ufirst; [zeros(typeof(Urest[:,1])) Urest]]
127127
end
128128
return (L, U, p)
129129
end

0 commit comments

Comments
 (0)