Skip to content

Commit 3cc11e7

Browse files
authored
Add eltype for Dot (#34)
1 parent 0570de6 commit 3cc11e7

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ArrayLayouts"
22
uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.4.1"
4+
version = "0.4.2"
55

66
[deps]
77
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"

src/mul.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ end
233233
@inline materialize(d::Dot) = copy(instantiate(d))
234234
@inline Dot(M::Mul{<:DualLayout,<:Any,<:AbstractMatrix,<:AbstractVector}) = Dot(M.A', M.B)
235235
@inline mulreduce(M::Mul{<:DualLayout,<:Any,<:AbstractMatrix,<:AbstractVector}) = Dot(M)
236+
@inline eltype(D::Dot) = promote_type(eltype(D.A), eltype(D.B))
236237

237238
dot(a, b) = materialize(Dot(a, b))
238239
@inline LinearAlgebra.dot(a::LayoutArray, b::LayoutArray) = dot(a,b)

test/test_muladd.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,5 +636,6 @@ Random.seed!(0)
636636
a = randn(5)
637637
b = randn(5)
638638
@test ArrayLayouts.dot(a,b) == mul(a',b) == dot(a,b)
639+
@test eltype(Dot(a,1:5)) == Float64
639640
end
640641
end

0 commit comments

Comments
 (0)