Skip to content

Commit

Permalink
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/givens.jl …
Browse files Browse the repository at this point in the history
…with de-jazzed passthroughs.
  • Loading branch information
Sacha0 committed Dec 7, 2017
1 parent e3fc8e8 commit 651b754
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
11 changes: 11 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2812,6 +2812,17 @@ end
A_mul_Bt(mat::AbstractMatrix, rowvec::RowVector) = *(mat, Transpose(rowvec))
end

# A[ct]_(mul|ldiv|rdiv)_B[ct][!] methods from base/linalg/givens.jl, to deprecate
@eval Base.LinAlg begin
A_mul_Bc!(A::AbstractMatrix, R::Rotation) = mul!(A, Adjoint(R))
A_mul_B!(R::Rotation, A::AbstractMatrix) = mul!(R, A)
A_mul_B!(G::Givens, R::Rotation) = mul!(G, R)
A_mul_Bc!(A::AbstractMatrix, G::Givens) = mul!(A, Adjoint(G))
A_mul_B!(G::Givens, A::AbstractVecOrMat) = mul!(G, A)
A_mul_B!(G1::Givens, G2::Givens) = mul!(G1, G2)
A_mul_Bc(A::AbstractVecOrMat{T}, R::AbstractRotation{S}) where {T,S} = *(A, Adjoint(R))
end

# issue #24822
@deprecate_binding Display AbstractDisplay

Expand Down
17 changes: 10 additions & 7 deletions base/linalg/givens.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ function *(R::AbstractRotation{T}, A::AbstractVecOrMat{S}) where {T,S}
TS = typeof(zero(T)*zero(S) + zero(T)*zero(S))
A_mul_B!(convert(AbstractRotation{TS}, R), TS == S ? copy(A) : convert(AbstractArray{TS}, A))
end
function A_mul_Bc(A::AbstractVecOrMat{T}, R::AbstractRotation{S}) where {T,S}
function *(A::AbstractVecOrMat{T}, adjR::Adjoint{<:Any,<:AbstractRotation{S}}) where {T,S}
R = adjR.parent
TS = typeof(zero(T)*zero(S) + zero(T)*zero(S))
A_mul_Bc!(TS == T ? copy(A) : convert(AbstractArray{TS}, A), convert(AbstractRotation{TS}, R))
end
Expand Down Expand Up @@ -318,9 +319,9 @@ function getindex(G::Givens, i::Integer, j::Integer)
end


A_mul_B!(G1::Givens, G2::Givens) = error("Operation not supported. Consider *")
mul!(G1::Givens, G2::Givens) = error("Operation not supported. Consider *")

function A_mul_B!(G::Givens, A::AbstractVecOrMat)
function mul!(G::Givens, A::AbstractVecOrMat)
m, n = size(A, 1), size(A, 2)
if G.i2 > m
throw(DimensionMismatch("column indices for rotation are outside the matrix"))
Expand All @@ -332,7 +333,8 @@ function A_mul_B!(G::Givens, A::AbstractVecOrMat)
end
return A
end
function A_mul_Bc!(A::AbstractMatrix, G::Givens)
function mul!(A::AbstractMatrix, adjG::Adjoint{<:Any,<:Givens})
G = adjG.parent
m, n = size(A, 1), size(A, 2)
if G.i2 > n
throw(DimensionMismatch("column indices for rotation are outside the matrix"))
Expand All @@ -344,17 +346,18 @@ function A_mul_Bc!(A::AbstractMatrix, G::Givens)
end
return A
end
function A_mul_B!(G::Givens, R::Rotation)
function mul!(G::Givens, R::Rotation)
push!(R.rotations, G)
return R
end
function A_mul_B!(R::Rotation, A::AbstractMatrix)
function mul!(R::Rotation, A::AbstractMatrix)
@inbounds for i = 1:length(R.rotations)
A_mul_B!(R.rotations[i], A)
end
return A
end
function A_mul_Bc!(A::AbstractMatrix, R::Rotation)
function mul!(A::AbstractMatrix, adjR::Adjoint{<:Any,<:Rotation})
R = adjR.parent
@inbounds for i = 1:length(R.rotations)
A_mul_Bc!(A, R.rotations[i])
end
Expand Down
1 change: 1 addition & 0 deletions base/linalg/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ function char_uplo(uplo::Symbol)
end

# shims to maintain existence of names in A_mul_B deprecation process
function A_mul_B! end
function Ac_mul_B! end
function Ac_mul_B! end
function At_mul_B! end
Expand Down

0 comments on commit 651b754

Please sign in to comment.