Skip to content

Commit

Permalink
fix 5-arg mul! signature
Browse files Browse the repository at this point in the history
delete Manifest.toml
  • Loading branch information
pablosanjose committed Jul 5, 2020
1 parent 3957a66 commit 26f1b4b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
13 changes: 13 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name = "MKLSparse"
uuid = "0c723cd3-b8cd-5d40-b370-ba682dde9aae"
version = "1.0.0"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
10 changes: 4 additions & 6 deletions src/BLAS/level_2_3/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ for (tchar, ttype) in (('N', :()),
('T', :Transpose))
AT = tchar == 'N' ? :(SparseMatrixCSC{$T,BlasInt}) : :($ttype{$T,SparseMatrixCSC{$T,BlasInt}})
@eval begin
function mul!::$T, adjA::$AT,
B::$mat{$T}, β::$T, C::$mat{$T})
function mul!(C::$mat{$T}, adjA::$AT, B::$mat{$T}, α::$T, β::$T)
A = _unwrap_adj(adjA)
if isa(B, AbstractVector)
return cscmv!($tchar, α, matdescra(A), A, B, β, C)
Expand All @@ -34,7 +33,7 @@ for (tchar, ttype) in (('N', :()),
end
end

mul!(C::$mat{$T}, adjA::$AT, B::$mat{$T}) = mul!(one($T), adjA, B, zero($T), C)
mul!(C::$mat{$T}, adjA::$AT, B::$mat{$T}) = mul!(C, adjA, B, one($T), zero($T))

function (*)(adjA::$AT, B::$mat{$T})
A = _unwrap_adj(adjA)
Expand All @@ -51,8 +50,7 @@ for (tchar, ttype) in (('N', :()),
:($w{$T,SparseMatrixCSC{$T,BlasInt}}) :
:($ttype{$T,$w{$T,SparseMatrixCSC{$T,BlasInt}}})
@eval begin
function mul!::$T, adjA::$AT,
B::$mat{$T}, β::$T, C::$mat{$T})
function mul!(C::$mat{$T}, adjA::$AT, B::$mat{$T}, α::$T, β::$T)
A = _unwrap_adj(adjA)
if isa(B,AbstractVector)
return cscmv!($tchar, α, matdescra(A), _get_data(A), B, β, C)
Expand All @@ -61,7 +59,7 @@ for (tchar, ttype) in (('N', :()),
end
end

mul!(C::$mat{$T}, adjA::$AT, B::$mat{$T}) = mul!(one($T), adjA, B, zero($T), C)
mul!(C::$mat{$T}, adjA::$AT, B::$mat{$T}) = mul!(C, adjA, B, one($T), zero($T))

function (*)(adjA::$AT, B::$mat{$T})
A = _unwrap_adj(adjA)
Expand Down
3 changes: 3 additions & 0 deletions test/test_BLAS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ end
@test_blas (maximum(abs.(mul!(similar(c), a, c) - Array(a)*c)) < 100*eps())
@test_blas (maximum(abs.(mul!(similar(b), transpose(a), b) - transpose(Array(a))*b)) < 100*eps())
@test_blas (maximum(abs.(mul!(similar(c), transpose(a), c) - transpose(Array(a))*c)) < 100*eps())
@test_blas (maximum(abs.(mul!(copy(b), a, b, α, β) -*(Array(a)*b) + β*b))) < 100*eps())
@test_blas (maximum(abs.(mul!(copy(b), transpose(a), b, α, β) -*(transpose(Array(a))*b) + β*b))) < 100*eps())
@test_blas (maximum(abs.(mul!(copy(c), transpose(a), c, α, β) -*(transpose(Array(a))*c) + β*c))) < 100*eps())

c = randn(6) + im*randn(6)
@test_throws DimensionMismatch transpose(a)*c
Expand Down

0 comments on commit 26f1b4b

Please sign in to comment.