Skip to content

Commit

Permalink
spzeros now requires both, rows and columns.
Browse files Browse the repository at this point in the history
Fix #5436
  • Loading branch information
ViralBShah committed Jan 18, 2014
1 parent 296e917 commit c3e3329
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -380,5 +380,8 @@ eval(Sys, :(@deprecate shlib_list dllist))
@deprecate degrees2radians deg2rad
@deprecate radians2degrees rad2deg

@deprecate spzeros(m::Integer) spzeros(m, m)
@deprecate spzeros(Tv::Type, m::Integer) spzeros(Tv, m, m)

# 0.3 discontinued functions

4 changes: 1 addition & 3 deletions base/sparse/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ copy(S::SparseMatrixCSC) =
similar(S::SparseMatrixCSC, Tv::NonTupleType) =
SparseMatrixCSC(S.m, S.n, similar(S.colptr), similar(S.rowval), Array(Tv, length(S.rowval)))

similar(S::SparseMatrixCSC, Tv::Type, d::(Int,Int)) = spzeros(Tv, d[1], d[2])
similar(S::SparseMatrixCSC, Tv::Type, d::(Integer,Integer)) = spzeros(Tv, d[1], d[2])

function similar(A::SparseMatrixCSC, Tv::Type, Ti::Type)
colptrA = A.colptr; rowvalA = A.rowval; nzvalA = A.nzval
Expand Down Expand Up @@ -404,9 +404,7 @@ sprandbool(m::Integer, n::Integer, density::FloatingPoint) = sprand(m,n,density,
spones{T}(S::SparseMatrixCSC{T}) =
SparseMatrixCSC(S.m, S.n, copy(S.colptr), copy(S.rowval), ones(T, S.colptr[end]-1))

spzeros(m::Integer) = spzeros(m, m)
spzeros(m::Integer, n::Integer) = spzeros(Float64, m, n)
spzeros(Tv::Type, m::Integer) = spzeros(Tv, m, m)
spzeros(Tv::Type, m::Integer, n::Integer) =
SparseMatrixCSC(m, n, ones(Int, n+1), Array(Int, 0), Array(Tv, 0))
spzeros(Tv::Type, Ti::Type, m::Integer, n::Integer) =
Expand Down
2 changes: 1 addition & 1 deletion test/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ se33_i32 = speye(Int32, 3, 3)
@test all([se44 sz42 sz41_f32; sz34 se33_i32] == se77)

# check mixed sparse-dense concatenation
sz33 = spzeros(3)
sz33 = spzeros(3, 3)
de33 = eye(3)
@test all([se33 de33; sz33 se33] == full([se33 se33; sz33 se33 ]))

Expand Down

0 comments on commit c3e3329

Please sign in to comment.