Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix #6036

  • Loading branch information...
commit 40fdf3eb6d49e30cdd3c47e1184a467cc1fc04ab 1 parent d36bb08
@timholy timholy authored
Showing with 12 additions and 4 deletions.
  1. +4 −4 base/sparse/sparsematrix.jl
  2. +8 −0 test/sparse.jl
View
8 base/sparse/sparsematrix.jl
@@ -641,14 +641,14 @@ function reducedim{Tv,Ti}(f::Function, A::SparseMatrixCSC{Tv,Ti}, region, v0)
end
maximum{T}(A::SparseMatrixCSC{T}) =
- isempty(A) ? throw(ArgumentError("argument must not be empty")) : reducedim(scalarmax,A,(1,2),typemin(T))
+ isempty(A) ? throw(ArgumentError("argument must not be empty")) : reducedim(Base.scalarmax,A,(1,2),typemin(T))
maximum{T}(A::SparseMatrixCSC{T}, region) =
- isempty(A) ? similar(A, reduced_dims0(A,region)) : reducedim(scalarmax,A,region,typemin(T))
+ isempty(A) ? similar(A, reduced_dims0(A,region)) : reducedim(Base.scalarmax,A,region,typemin(T))
minimum{T}(A::SparseMatrixCSC{T}) =
- isempty(A) ? throw(ArgumentError("argument must not be empty")) : reducedim(scalarmin,A,(1,2),typemax(T))
+ isempty(A) ? throw(ArgumentError("argument must not be empty")) : reducedim(Base.scalarmin,A,(1,2),typemax(T))
minimum{T}(A::SparseMatrixCSC{T}, region) =
- isempty(A) ? similar(A, reduced_dims0(A,region)) : reducedim(scalarmin,A,region,typemax(T))
+ isempty(A) ? similar(A, reduced_dims0(A,region)) : reducedim(Base.scalarmin,A,region,typemax(T))
sum{T}(A::SparseMatrixCSC{T}) = reducedim(+,A,(1,2),zero(T))
sum{T}(A::SparseMatrixCSC{T}, region) = reducedim(+,A,region,zero(T))
View
8 test/sparse.jl
@@ -211,3 +211,11 @@ end
# test for "access to undefined error" types that initially allocate elements as #undef
@test all(sparse(1:2, 1:2, Any[1,2])^2 == sparse(1:2, 1:2, [1,4]))
sd1 = diff(sparse([1,1,1], [1,2,3], Any[1,2,3]), 1)
+
+# issue #6036
+P = spzeros(Float64, 3, 3)
+for i = 1:3
+ P[i,i] = i
+end
+@test minimum(P) == [0]
+@test maximum(P) == [3]
Please sign in to comment.
Something went wrong with that request. Please try again.