From bbe387f1956d94ac211dea46eb60a1b9174bacda Mon Sep 17 00:00:00 2001 From: Sacha Verweij Date: Sat, 4 Nov 2017 10:29:27 -0700 Subject: [PATCH] Remove SparseMatrixCSC[{Tv,T}](s::UniformScaling, n::Integer) convenience constructors. --- base/sparse/sparsematrix.jl | 5 ----- test/sparse/sparse.jl | 3 --- 2 files changed, 8 deletions(-) diff --git a/base/sparse/sparsematrix.jl b/base/sparse/sparsematrix.jl index 32c242a7a19841..b4dc046c48f86f 100644 --- a/base/sparse/sparsematrix.jl +++ b/base/sparse/sparsematrix.jl @@ -1555,11 +1555,6 @@ function SparseMatrixCSC{Tv,Ti}(s::UniformScaling, dims::Dims{2}) where {Tv,Ti} for i in (k + 2):(n + 1) colptr[i] = (k + 1) end SparseMatrixCSC{Tv,Ti}(dims..., colptr, rowval, nzval) end -# convenience variations that accept a single integer to specify dims -SparseMatrixCSC{Tv,Ti}(s::UniformScaling, m::Integer) where {Tv,Ti} = SparseMatrixCSC{Tv,Ti}(s, m, m) -SparseMatrixCSC{Tv}(s::UniformScaling, m::Integer) where {Tv} = SparseMatrixCSC{Tv}(s, m, m) -SparseMatrixCSC(s::UniformScaling, m::Integer) = SparseMatrixCSC(s, m, m) - Base.iszero(A::SparseMatrixCSC) = iszero(view(A.nzval, 1:(A.colptr[size(A, 2) + 1] - 1))) diff --git a/test/sparse/sparse.jl b/test/sparse/sparse.jl index 29a611454affaf..33ca9e4bda53ee 100644 --- a/test/sparse/sparse.jl +++ b/test/sparse/sparse.jl @@ -37,15 +37,12 @@ end end @testset "SparseMatrixCSC construction from UniformScaling" begin - @test_throws ArgumentError SparseMatrixCSC(I, -1) @test_throws ArgumentError SparseMatrixCSC(I, -1, 3) @test_throws ArgumentError SparseMatrixCSC(I, 3, -1) - @test SparseMatrixCSC(2I, 3)::SparseMatrixCSC{Int,Int} == 2*eye(3) @test SparseMatrixCSC(2I, 3, 3)::SparseMatrixCSC{Int,Int} == 2*eye(3) @test SparseMatrixCSC(2I, 3, 4)::SparseMatrixCSC{Int,Int} == 2*eye(3, 4) @test SparseMatrixCSC(2I, 4, 3)::SparseMatrixCSC{Int,Int} == 2*eye(4, 3) @test SparseMatrixCSC(2.0I, 3, 3)::SparseMatrixCSC{Float64,Int} == 2*eye(3) - @test SparseMatrixCSC{Real}(2I, 3)::SparseMatrixCSC{Real,Int} == 2*eye(3) @test SparseMatrixCSC{Real}(2I, 3, 3)::SparseMatrixCSC{Real,Int} == 2*eye(3) @test SparseMatrixCSC{Float64}(2I, 3, 3)::SparseMatrixCSC{Float64,Int} == 2*eye(3) @test SparseMatrixCSC{Float64,Int32}(2I, 3, 3)::SparseMatrixCSC{Float64,Int32} == 2*eye(3)