Skip to content

Commit

Permalink
Add types to method signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Aug 20, 2024
1 parent 1d0c840 commit 093b565
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions stdlib/LinearAlgebra/src/LinearAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,8 @@ _droplast!(A) = deleteat!(A, lastindex(A))

# destination type for matmul
matprod_dest(A::StructuredMatrix, B::StructuredMatrix, TS) = similar(B, TS, size(B))
matprod_dest(A, B::StructuredMatrix, TS) = similar(A, TS, size(A))
matprod_dest(A::StructuredMatrix, B, TS) = similar(B, TS, size(B))
matprod_dest(A::AbstractArray, B::StructuredMatrix, TS) = similar(A, TS, size(A))
matprod_dest(A::StructuredMatrix, B::AbstractArray, TS) = similar(B, TS, size(B))
# diagonal is special, as it does not change the structure of the other matrix
# we call similar without a size to preserve the type of the matrix wherever possible
# reroute through _matprod_dest_diag to allow speicalizing on the type of the StructuredMatrix
Expand Down
6 changes: 4 additions & 2 deletions stdlib/LinearAlgebra/src/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ end
"""
matprod_dest(A::AbstractArray, B::AbstractArray, T::Type)
Return an appropriate `AbstractArray` of size `(size(A,1), size(B,2))` and element type `T`,
that may be used to store the result of `A * B`.
Return an appropriate `AbstractArray` with element type `T` that may be used to store the result of `A * B`.
!!! compat
This function requires at least Julia 1.11
"""
matprod_dest(A::AbstractArray, B::AbstractArray, T::Type) = similar(B, T, (size(A, 1), size(B, 2)))

Expand Down

0 comments on commit 093b565

Please sign in to comment.