Skip to content

Commit

Permalink
Change deprecated Array(T, dims...) to Array{T}(dims...) in /base/spa…
Browse files Browse the repository at this point in the history
…rse/.
  • Loading branch information
pkofod committed May 2, 2016
1 parent b9d913b commit f2bf484
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 178 deletions.
22 changes: 11 additions & 11 deletions base/sparse/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const CHOLMOD_MIN_VERSION = v"2.1.1"
### These offsets are defined in SuiteSparse_wrapper.c
const common_size = ccall((:jl_cholmod_common_size,:libsuitesparse_wrapper),Int,())

const cholmod_com_offsets = Array(Csize_t, 19)
const cholmod_com_offsets = Array{Csize_t}(19)
ccall((:jl_cholmod_common_offsets, :libsuitesparse_wrapper),
Void, (Ptr{Csize_t},), cholmod_com_offsets)

Expand All @@ -56,15 +56,15 @@ end

common() = commonStruct

const build_version_array = Array(Cint, 3)
const build_version_array = Array{Cint}(3)
ccall((:jl_cholmod_version, :libsuitesparse_wrapper), Cint, (Ptr{Cint},), build_version_array)
const build_version = VersionNumber(build_version_array...)

function __init__()
try
### Check if the linked library is compatible with the Julia code
if Libdl.dlsym_e(Libdl.dlopen("libcholmod"), :cholmod_version) != C_NULL
current_version_array = Array(Cint, 3)
current_version_array = Array{Cint}(3)
ccall((:cholmod_version, :libcholmod), Cint, (Ptr{Cint},), current_version_array)
current_version = VersionNumber(current_version_array...)
else # CHOLMOD < 2.1.1 does not include cholmod_version()
Expand Down Expand Up @@ -703,10 +703,10 @@ function vertcat{Tv<:VRealTypes}(A::Sparse{Tv}, B::Sparse{Tv}, values::Bool)
end

function symmetry{Tv<:VTypes}(A::Sparse{Tv}, option::Integer)
xmatched = Array(SuiteSparse_long, 1)
pmatched = Array(SuiteSparse_long, 1)
nzoffdiag = Array(SuiteSparse_long, 1)
nzdiag = Array(SuiteSparse_long, 1)
xmatched = Array{SuiteSparse_long}(1)
pmatched = Array{SuiteSparse_long}(1)
nzoffdiag = Array{SuiteSparse_long}(1)
nzdiag = Array{SuiteSparse_long}(1)
rv = ccall((@cholmod_name("symmetry", SuiteSparse_long), :libcholmod), Cint,
(Ptr{C_Sparse{Tv}}, Cint, Ptr{SuiteSparse_long}, Ptr{SuiteSparse_long},
Ptr{SuiteSparse_long}, Ptr{SuiteSparse_long}, Ptr{UInt8}),
Expand Down Expand Up @@ -955,7 +955,7 @@ end
## convertion back to base Julia types
function convert{T}(::Type{Matrix{T}}, D::Dense{T})
s = unsafe_load(D.p)
a = Array(T, s.nrow, s.ncol)
a = Array{T}(s.nrow, s.ncol)
copy!(a, D)
end
function Base.copy!(dest::AbstractArray, D::Dense)
Expand All @@ -979,7 +979,7 @@ function convert{T}(::Type{Vector{T}}, D::Dense{T})
if size(D, 2) > 1
throw(DimensionMismatch("input must be a vector but had $(size(D, 2)) columns"))
end
copy!(Array(T, size(D, 1)), D)
copy!(Array{T}(size(D, 1)), D)
end
convert{T}(::Type{Vector}, D::Dense{T}) = convert(Vector{T}, D)

Expand Down Expand Up @@ -1031,7 +1031,7 @@ function sparse(F::Factor)
SparseArrays.sortSparseMatrixCSC!(A)
p = get_perm(F)
if p != [1:s.n;]
pinv = Array(Int, length(p))
pinv = Array{Int}(length(p))
for k = 1:length(p)
pinv[p[k]] = k
end
Expand Down Expand Up @@ -1153,7 +1153,7 @@ function getindex(F::Factor, sym::Symbol)
end

function getLd!(S::SparseMatrixCSC)
d = Array(eltype(S), size(S, 1))
d = Array{eltype(S)}(size(S, 1))
fill!(d, 0)
col = 1
for k = 1:length(S.nzval)
Expand Down
42 changes: 21 additions & 21 deletions base/sparse/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ function spmatmul{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, B::SparseMatrixCSC{Tv,Ti};
colptrB = B.colptr; rowvalB = B.rowval; nzvalB = B.nzval
# TODO: Need better estimation of result space
nnzC = min(mA*nB, length(nzvalA) + length(nzvalB))
colptrC = Array(Ti, nB+1)
rowvalC = Array(Ti, nnzC)
nzvalC = Array(Tv, nnzC)
colptrC = Array{Ti}(nB+1)
rowvalC = Array{Ti}(nnzC)
nzvalC = Array{Tv}(nnzC)

@inbounds begin
ip = 1
Expand Down Expand Up @@ -302,7 +302,7 @@ function triu{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti}, k::Integer=0)
if (k > 0 && k > n) || (k < 0 && -k > m)
throw(BoundsError())
end
colptr = Array(Ti, n+1)
colptr = Array{Ti}(n+1)
nnz = 0
for col = 1 : min(max(k+1,1), n+1)
colptr[col] = 1
Expand All @@ -314,8 +314,8 @@ function triu{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti}, k::Integer=0)
end
colptr[col+1] = nnz+1
end
rowval = Array(Ti, nnz)
nzval = Array(Tv, nnz)
rowval = Array{Ti}(nnz)
nzval = Array{Tv}(nnz)
A = SparseMatrixCSC(m, n, colptr, rowval, nzval)
for col = max(k+1,1) : n
c1 = S.colptr[col]
Expand All @@ -333,7 +333,7 @@ function tril{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti}, k::Integer=0)
if (k > 0 && k > n) || (k < 0 && -k > m)
throw(BoundsError())
end
colptr = Array(Ti, n+1)
colptr = Array{Ti}(n+1)
nnz = 0
colptr[1] = 1
for col = 1 : min(n, m+k)
Expand All @@ -347,8 +347,8 @@ function tril{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti}, k::Integer=0)
for col = max(min(n, m+k)+2,1) : n+1
colptr[col] = nnz+1
end
rowval = Array(Ti, nnz)
nzval = Array(Tv, nnz)
rowval = Array{Ti}(nnz)
nzval = Array{Tv}(nnz)
A = SparseMatrixCSC(m, n, colptr, rowval, nzval)
for col = 1 : min(n, m+k)
c1 = S.colptr[col+1]-1
Expand All @@ -367,10 +367,10 @@ end
function sparse_diff1{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti})
m,n = size(S)
m > 1 || return SparseMatrixCSC(0, n, ones(Ti,n+1), Ti[], Tv[])
colptr = Array(Ti, n+1)
colptr = Array{Ti}(n+1)
numnz = 2 * nnz(S) # upper bound; will shrink later
rowval = Array(Ti, numnz)
nzval = Array(Tv, numnz)
rowval = Array{Ti}(numnz)
nzval = Array{Tv}(numnz)
numnz = 0
colptr[1] = 1
for col = 1 : n
Expand Down Expand Up @@ -406,10 +406,10 @@ end

function sparse_diff2{Tv,Ti}(a::SparseMatrixCSC{Tv,Ti})
m,n = size(a)
colptr = Array(Ti, max(n,1))
colptr = Array{Ti}(max(n,1))
numnz = 2 * nnz(a) # upper bound; will shrink later
rowval = Array(Ti, numnz)
nzval = Array(Tv, numnz)
rowval = Array{Ti}(numnz)
nzval = Array{Tv}(numnz)

z = zero(Tv)

Expand Down Expand Up @@ -561,8 +561,8 @@ function normestinv{T}(A::SparseMatrixCSC{T}, t::Integer = min(2,maximum(size(A)
if t > n
throw(ArgumentError("number of blocks must not be greater than $n"))
end
ind = Array(Int64, n)
ind_hist = Array(Int64, maxiter * t)
ind = Array{Int64}(n)
ind_hist = Array{Int64}(maxiter * t)

Ti = typeof(float(zero(T)))

Expand All @@ -584,7 +584,7 @@ function normestinv{T}(A::SparseMatrixCSC{T}, t::Integer = min(2,maximum(size(A)
end

# Generate the block matrix
X = Array(Ti, n, t)
X = Array{Ti}(n, t)
X[1:n,1] = 1
for j = 2:t
while true
Expand Down Expand Up @@ -734,9 +734,9 @@ function kron{Tv,Ti}(a::SparseMatrixCSC{Tv,Ti}, b::SparseMatrixCSC{Tv,Ti})

m,n = mA*mB, nA*nB

colptr = Array(Ti, n+1)
rowval = Array(Ti, numnz)
nzval = Array(Tv, numnz)
colptr = Array{Ti}(n+1)
rowval = Array{Ti}(numnz)
nzval = Array{Tv}(numnz)

colptr[1] = 1

Expand Down
Loading

0 comments on commit f2bf484

Please sign in to comment.