Skip to content

Commit 35a3542

Browse files
committed
debug leftovers removed, throw errors explicitly , removed sparseArray test
1 parent 093e0ff commit 35a3542

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/array_partition.jl

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,27 @@ function LinearAlgebra._swap_rows!(B::ArrayPartition, i::Integer, j::Integer)
372372
end
373373

374374
# linalg mul! overloads for ArrayPartition
375-
function LinearAlgebra.mul!(C::T, A::T, B::AbstractArray) where T<:ArrayPartition
376-
@assert length(C.x) == length(A.x)
375+
function LinearAlgebra.mul!(C::ArrayPartition, A::ArrayPartition, B::AbstractArray)
376+
if length(C.x) != length(A.x)
377+
throw(DimensionMismatch("Length of C, $(length(C.x)), does not match length of A, $(length(A.x))"))
378+
end
379+
377380
for index = 1:length(C.x)
378381
mul!(C.x[index], A.x[index], B)
379382
end
383+
return C
380384
end
381385

382-
function LinearAlgebra.mul!(C::T, A::T, B::T) where T<:ArrayPartition
383-
@assert length(C.x) == length(A.x) == length(B.x)
386+
function LinearAlgebra.mul!(C::ArrayPartition, A::ArrayPartition, B::ArrayPartition)
387+
if length(C.x) != length(A.x)
388+
throw(DimensionMismatch("Length of C, $(length(C.x)), does not match length of A, $(length(B.x))"))
389+
end
390+
if length(A.x) != length(B.x)
391+
throw(DimensionMismatch("Length of A, $(length(A.x)), does not match length of B, $(length(B.x))"))
392+
end
393+
384394
for index = 1:length(C.x)
385395
mul!(C.x[index], A.x[index], B.x[index])
386396
end
397+
return C
387398
end

test/linalg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using RecursiveArrayTools, Test, Random
2-
using LinearAlgebra, SparseArrays
2+
using LinearAlgebra
33

44
n, m = 5, 6
55
bb = rand(n), rand(m)
@@ -36,7 +36,7 @@ b = ArrayPartition(bb)
3636
c = ArrayPartition(cc)
3737
d = ArrayPartition(dd)
3838
A = rand(n)
39-
for T in (Array{Float64}, Array{ComplexF64}, sparse, )
39+
for T in (Array{Float64}, Array{ComplexF64},)
4040
B = T(A)
4141
mul!(d, b, A)
4242
for i = 1:length(c.x)

0 commit comments

Comments
 (0)