From 6131f25d602a97e877fb40645bf28421f5afbf3e Mon Sep 17 00:00:00 2001 From: Sacha Verweij Date: Wed, 13 Dec 2017 16:17:55 -0800 Subject: [PATCH] Strip defs involving RowVector from base/sparse/higherorderfns.jl, give behaviors to Adjoint/Transpose. --- base/deprecated.jl | 6 ++++++ base/sparse/higherorderfns.jl | 3 ++- test/sparse/higherorderfns.jl | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/base/deprecated.jl b/base/deprecated.jl index d13104087ee1a..d9ef2d22ab20b 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -3074,6 +3074,12 @@ end \(A::Transpose{<:Any,<:Factorization{<:Real}}, B::RowVector) = transpose(A.parent) \ B end +# methods involving RowVector from base/sparse/higherorderfns.jl, to deprecate +@eval Base.SparseArrays.HigherOrderFns begin + BroadcastStyle(::Type{<:Base.RowVector{T,<:Vector}}) where T = Broadcast.MatrixStyle() +end + + # issue #24822 @deprecate_binding Display AbstractDisplay diff --git a/base/sparse/higherorderfns.jl b/base/sparse/higherorderfns.jl index 3b4b3744b60bb..eb58e93cf7e11 100644 --- a/base/sparse/higherorderfns.jl +++ b/base/sparse/higherorderfns.jl @@ -993,7 +993,8 @@ Broadcast.BroadcastStyle(::PromoteToSparse, ::Broadcast.Style{Tuple}) = Broadcas # Broadcast.BroadcastStyle(::SPVM, ::Broadcast.DefaultArrayStyle{0}) = PromoteToSparse() # Broadcast.BroadcastStyle(::SPVM, ::Broadcast.DefaultArrayStyle{1}) = PromoteToSparse() # Broadcast.BroadcastStyle(::SPVM, ::Broadcast.DefaultArrayStyle{2}) = PromoteToSparse() -BroadcastStyle(::Type{<:Base.RowVector{T,<:Vector}}) where T = Broadcast.MatrixStyle() # RowVector not yet defined when broadcast.jl loaded +BroadcastStyle(::Type{<:Base.Adjoint{T,<:Vector}}) where T = Broadcast.MatrixStyle() # Adjoint not yet defined when broadcast.jl loaded +BroadcastStyle(::Type{<:Base.Transpose{T,<:Vector}}) where T = Broadcast.MatrixStyle() # Transpose not yet defined when broadcast.jl loaded Broadcast.BroadcastStyle(::SPVM, ::Broadcast.VectorStyle) = PromoteToSparse() Broadcast.BroadcastStyle(::SPVM, ::Broadcast.MatrixStyle) = PromoteToSparse() Broadcast.BroadcastStyle(::SparseVecStyle, ::Broadcast.DefaultArrayStyle{N}) where N = diff --git a/test/sparse/higherorderfns.jl b/test/sparse/higherorderfns.jl index e4dd960636ef6..d25b5eabd0ba6 100644 --- a/test/sparse/higherorderfns.jl +++ b/test/sparse/higherorderfns.jl @@ -414,7 +414,7 @@ end @test broadcast!(+, Z, V, A, X) == sparse(broadcast(+, fV, fA, X)) @test broadcast(*, s, V, A, X)::SparseMatrixCSC == sparse(broadcast(*, s, fV, fA, X)) @test broadcast!(*, Z, s, V, A, X) == sparse(broadcast(*, s, fV, fA, X)) - # Issue #20954 combinations of sparse arrays and RowVectors + # Issue #20954 combinations of sparse arrays and Adjoint/Transpose vectors @test broadcast(+, A, X')::SparseMatrixCSC == sparse(broadcast(+, fA, X')) @test broadcast(*, V, X')::SparseMatrixCSC == sparse(broadcast(*, fV, X')) end