Skip to content

Commit

Permalink
Rewrite broadcast/broadcast! over a pair of (input) sparse matrices w…
Browse files Browse the repository at this point in the history
…ith new (JuliaLang#19372) semantics / less pessimistic allocation behavior and optimize a few inefficiently handled common cases. Also provide a broadcast/broadcast! implementation capable of (relatively) efficiently handling an arbitrary number of (input) sparse matrices. Integrate with the map/map! implementation, and touch up a few rough edges of the map/map! implementation. Test.
  • Loading branch information
Sacha0 committed Dec 7, 2016
1 parent be9198c commit 6e38631
Show file tree
Hide file tree
Showing 3 changed files with 583 additions and 336 deletions.
4 changes: 2 additions & 2 deletions base/sparse/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ function norm(A::SparseMatrixCSC,p::Real=2)
nA::Tsum = 0
for j=1:n
colSum::Tsum = 0
for i = A.colptr[j]:A.colptr[j+1]-1
for i in nzrange(A, j)
colSum += abs(A.nzval[i])
end
nA = max(nA, colSum)
Expand All @@ -517,7 +517,7 @@ function norm(A::SparseMatrixCSC,p::Real=2)
throw(ArgumentError("2-norm not yet implemented for sparse matrices. Try norm(Array(A)) or norm(A, p) where p=1 or Inf."))
elseif p==Inf
rowSum = zeros(Tsum,m)
for i=1:length(A.nzval)
for i in 1:nnz(A)
rowSum[A.rowval[i]] += abs(A.nzval[i])
end
return convert(Tnorm, maximum(rowSum))
Expand Down
Loading

0 comments on commit 6e38631

Please sign in to comment.