Skip to content

Commit da42be3

Browse files
committed
Make diagsize() pure rather than generated
1 parent 8139d32 commit da42be3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/svd.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ SVD(U::AbstractArray{T}, S::AbstractVector, Vt::AbstractArray{T}) where {T} = SV
1111

1212
getindex(::SVD, ::Symbol) = error("In order to avoid type instability, StaticArrays.SVD doesn't support indexing the output of svdfact with a symbol. Instead, you can access the fields of the factorization directly as f.U, f.S, and f.Vt")
1313

14-
# Return the "diagonal size" of a matrix - the minimum of the two dimensions
15-
@generated function diagsize(A::StaticMatrix{N,M}) where {N,M}
16-
:($(min(N,M)))
17-
end
18-
1914
function svdvals!(A::StaticMatrix)
2015
sv = svdvals!(Matrix(A))
2116
similar_type(A, eltype(sv), Size(diagsize(A)))(sv)

src/traits.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,7 @@ end
123123
@noinline function _throw_size_mismatch(as...)
124124
throw(DimensionMismatch("Sizes $(map(_size, as)) of input arrays do not match"))
125125
end
126+
127+
# Return the "diagonal size" of a matrix - the minimum of the two dimensions
128+
diagsize(A::StaticMatrix) = diagsize(Size(A))
129+
@pure diagsize(::Size{S}) where {S} = min(S...)

0 commit comments

Comments
 (0)