Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/FillArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ for (Typ, funcs, func) in ((:Zeros, :zeros, :zero), (:Ones, :ones, :one))
@inline $Typ{T,N}(A::AbstractArray{V,N}) where{T,V,N} = $Typ{T,N}(size(A))
@inline $Typ{T}(A::AbstractArray) where{T} = $Typ{T}(size(A))
@inline $Typ(A::AbstractArray) = $Typ{eltype(A)}(A)
@inline $Typ(::Type{T}, m...) where T = $Typ{T}(m...)

@inline axes(Z::$Typ) = Z.axes
@inline size(Z::$Typ) = length.(Z.axes)
Expand Down
1 change: 0 additions & 1 deletion src/fillalgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ end
*(a::ZerosMatrix, b::AbstractMatrix) = mult_zeros(a, b)
*(a::AbstractMatrix, b::ZerosVector) = mult_zeros(a, b)
*(a::AbstractMatrix, b::ZerosMatrix) = mult_zeros(a, b)
*(a::ZerosVector, b::AbstractVector) = mult_zeros(a, b)
*(a::ZerosMatrix, b::AbstractVector) = mult_zeros(a, b)
*(a::AbstractVector, b::ZerosMatrix) = mult_zeros(a, b)

Expand Down
8 changes: 5 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ include("infinitearrays.jl")

for T in (Int, Float64)
Z = $Typ{T}(5)
@test $Typ(T, 5) ≡ Z
@test eltype(Z) == T
@test Array(Z) == $funcs(T,5)
@test Array{T}(Z) == $funcs(T,5)
Expand All @@ -34,6 +35,7 @@ include("infinitearrays.jl")
@test $Typ(2ones(T,5)) == Z

Z = $Typ{T}(5, 5)
@test $Typ(T, 5, 5) ≡ Z
@test eltype(Z) == T
@test Array(Z) == $funcs(T,5,5)
@test Array{T}(Z) == $funcs(T,5,5)
Expand Down Expand Up @@ -508,9 +510,9 @@ end
@test_throws MethodError [1,2,3]*Zeros(3) # Not defined for [1,2,3]*[0,0,0] either

@testset "Check multiplication by Adjoint vectors works as expected." begin
@test randn(4, 3)' * Zeros(4) === Zeros(3)
@test randn(4)' * Zeros(4) === zero(Float64)
@test [1, 2, 3]' * Zeros{Int}(3) === zero(Int)
@test randn(4, 3)' * Zeros(4) Zeros(3)
@test randn(4)' * Zeros(4) ≡ transpose(randn(4)) * Zeros(4) ≡ zero(Float64)
@test [1, 2, 3]' * Zeros{Int}(3) zero(Int)
@test [SVector(1,2)', SVector(2,3)', SVector(3,4)']' * Zeros{Int}(3) === SVector(0,0)
@test_throws DimensionMismatch randn(4)' * Zeros(3)
@test Zeros(5)' * randn(5,3) ≡ Zeros(5)'*Zeros(5,3) ≡ Zeros(5)'*Ones(5,3) ≡ Zeros(3)'
Expand Down