Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazier, less-jazzy linalg internals #24969

Merged
merged 65 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
b0429ff
Basic definitions and tests for Adjoint and Transpose types.
Sacha0 Dec 4, 2017
06bf431
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/bidiag wit…
Sacha0 Dec 4, 2017
2208762
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/tridiag.jl…
Sacha0 Dec 4, 2017
39cc5cc
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/diagonal.j…
Sacha0 Dec 4, 2017
badadbf
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/special.jl…
Sacha0 Dec 4, 2017
03057a9
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/bunchkaufm…
Sacha0 Dec 4, 2017
89cc4e7
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/cholesky.j…
Sacha0 Dec 4, 2017
c138fdc
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/factorizat…
Sacha0 Dec 5, 2017
4642c3e
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/hessenberg…
Sacha0 Dec 5, 2017
e7f2125
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/ldlt.jl wi…
Sacha0 Dec 5, 2017
5c45fef
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/svd.jl wit…
Sacha0 Dec 5, 2017
f5f77a5
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/symmetric.…
Sacha0 Dec 5, 2017
6fdb961
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/lu.jl with…
Sacha0 Dec 5, 2017
79a2ce2
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/lq.jl with…
Sacha0 Dec 5, 2017
096fc67
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/qr.jl with…
Sacha0 Dec 5, 2017
2a29a50
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/matmul.jl …
Sacha0 Dec 5, 2017
e41efab
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/triangular…
Sacha0 Dec 6, 2017
57183d2
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/sparse/linalg.jl …
Sacha0 Dec 6, 2017
ae76f0d
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/sparse/sparsevect…
Sacha0 Dec 6, 2017
2edbb1c
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/rowvector.…
Sacha0 Dec 6, 2017
5163363
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/givens.jl …
Sacha0 Dec 7, 2017
e524a32
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in stdlib/IterativeEigenS…
Sacha0 Dec 9, 2017
8d20c31
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in stdlib/SuiteSparse/CHO…
Sacha0 Dec 10, 2017
0d4f196
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in stdlib/SuiteSparse/UMF…
Sacha0 Dec 10, 2017
d062298
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in stdlib/SuiteSparse/SPQ…
Sacha0 Dec 10, 2017
ce5ee65
Disambiguate *, /, and \ methods.
Sacha0 Dec 9, 2017
6fb85f0
Disambiguate mul!, ldiv!, and rdiv! methods.
Sacha0 Dec 10, 2017
e80697d
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/operators.jl with…
Sacha0 Dec 8, 2017
3f2d810
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/deprecated.jl as…
Sacha0 Dec 11, 2017
233175d
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/bidiag.jl…
Sacha0 Dec 11, 2017
c1aa72c
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/bunchkauf…
Sacha0 Dec 11, 2017
ecd0253
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/cholesky.…
Sacha0 Dec 11, 2017
fc0accd
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/dense.jl …
Sacha0 Dec 11, 2017
5673e1a
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/diagonal.…
Sacha0 Dec 11, 2017
c98439d
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/factoriza…
Sacha0 Dec 11, 2017
a12f57e
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/generic.j…
Sacha0 Dec 11, 2017
16c5ce7
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/givens.jl…
Sacha0 Dec 11, 2017
9e9afcf
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/hessenber…
Sacha0 Dec 11, 2017
aa56327
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/lq.jl as …
Sacha0 Dec 11, 2017
2883770
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/lu.jl as …
Sacha0 Dec 11, 2017
5226436
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/matmul.jl…
Sacha0 Dec 11, 2017
e1db456
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/qr.jl as …
Sacha0 Dec 11, 2017
d2a4b16
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/special.j…
Sacha0 Dec 11, 2017
591d226
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/sparse/linalg.jl…
Sacha0 Dec 11, 2017
be73121
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/statistics.jl as…
Sacha0 Dec 11, 2017
bdba40b
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/sparse/sparsevec…
Sacha0 Dec 11, 2017
9b387f9
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/triangula…
Sacha0 Dec 11, 2017
5147f52
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in base/linalg/rowvector…
Sacha0 Dec 11, 2017
364a144
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/diagonal.…
Sacha0 Dec 11, 2017
8626205
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/bidiag.jl…
Sacha0 Dec 11, 2017
116b951
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/givens.jl…
Sacha0 Dec 11, 2017
8b773fe
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/lq.jl as …
Sacha0 Dec 11, 2017
613f320
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/lu.jl as …
Sacha0 Dec 11, 2017
306d1dd
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/matmul.jl…
Sacha0 Dec 11, 2017
cf4988e
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/qr.jl as …
Sacha0 Dec 11, 2017
5e9a327
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/special.j…
Sacha0 Dec 11, 2017
6e0f0ae
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/symmetric…
Sacha0 Dec 11, 2017
df92f58
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/triangula…
Sacha0 Dec 11, 2017
25f36af
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/tridiag.j…
Sacha0 Dec 11, 2017
061c6bb
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/linalg/uniformsc…
Sacha0 Dec 11, 2017
b306292
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/perf/* as *, /, …
Sacha0 Dec 11, 2017
2b91b2f
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/sparse/sparse.jl…
Sacha0 Dec 11, 2017
fa97d9c
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in test/sparse/sparsevec…
Sacha0 Dec 11, 2017
a11cbe5
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in stdlib/IterativeEigen…
Sacha0 Dec 12, 2017
a05e85f
Rewrite A[ct]_(mul|ldiv|rdiv)_B[ct][!] calls in stdlib/SuiteSparse as…
Sacha0 Dec 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace A[ct]_(mul|ldiv|rdiv)_B[ct][!] defs in base/linalg/symmetric.…
…jl with de-jazzed passthroughs.
  • Loading branch information
Sacha0 committed Dec 9, 2017
commit f5f77a523402519a32317b70c8f95f31f4d86872
25 changes: 25 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2302,6 +2302,31 @@ end
A_ldiv_B!(A::SVD{T}, B::StridedVecOrMat) where {T} = ldiv!(A, B)
end

# A[ct]_(mul|ldiv|rdiv)_B[ct][!] methods from base/linalg/symmetric.jl, to deprecate
@eval Base.LinAlg begin
A_mul_B!(y::StridedVector{T}, A::Symmetric{T,<:StridedMatrix}, x::StridedVector{T}) where {T<:BlasFloat} = mul!(y, A, x)
A_mul_B!(y::StridedVector{T}, A::Hermitian{T,<:StridedMatrix}, x::StridedVector{T}) where {T<:BlasReal} = mul!(y, A, x)
A_mul_B!(y::StridedVector{T}, A::Hermitian{T,<:StridedMatrix}, x::StridedVector{T}) where {T<:BlasComplex} = mul!(y, A, x)
A_mul_B!(C::StridedMatrix{T}, A::Symmetric{T,<:StridedMatrix}, B::StridedMatrix{T}) where {T<:BlasFloat} = mul!(C, A, B)
A_mul_B!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Symmetric{T,<:StridedMatrix}) where {T<:BlasFloat} = mul!(C, A, B)
A_mul_B!(C::StridedMatrix{T}, A::Hermitian{T,<:StridedMatrix}, B::StridedMatrix{T}) where {T<:BlasReal} = mul!(C, A, B)
A_mul_B!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Hermitian{T,<:StridedMatrix}) where {T<:BlasReal} = mul!(C, A, B)
A_mul_B!(C::StridedMatrix{T}, A::Hermitian{T,<:StridedMatrix}, B::StridedMatrix{T}) where {T<:BlasComplex} = mul!(C, A, B)
A_mul_B!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Hermitian{T,<:StridedMatrix}) where {T<:BlasComplex} = mul!(C, A, B)
At_mul_B(A::RealHermSymComplexSym, B::AbstractVector) = *(Transpose(A), B)
At_mul_B(A::RealHermSymComplexSym, B::AbstractMatrix) = *(Transpose(A), B)
A_mul_Bt(A::AbstractMatrix, B::RealHermSymComplexSym) = *(A, Transpose(B))
Ac_mul_B(A::RealHermSymComplexHerm, B::AbstractVector) = *(Adjoint(A), B)
Ac_mul_B(A::RealHermSymComplexHerm, B::AbstractMatrix) = *(Adjoint(A), B)
A_mul_Bc(A::AbstractMatrix, B::RealHermSymComplexHerm) = *(A, Adjoint(B))
A_mul_Bt(A::RowVector, B::RealHermSymComplexSym) = *(A, Transpose(B))
A_mul_Bc(A::RowVector, B::RealHermSymComplexHerm) = *(A, Adjoint(B))
At_mul_B(A::RealHermSymComplexSym, B::AbstractTriangular) = *(Transpose(A), B)
A_mul_Bt(A::AbstractTriangular, B::RealHermSymComplexSym) = *(A, Transpose(B))
Ac_mul_B(A::RealHermSymComplexHerm, B::AbstractTriangular) = *(Adjoint(A), B)
A_mul_Bc(A::AbstractTriangular, B::RealHermSymComplexHerm) = *(A, Adjoint(B))
end

# issue #24822
@deprecate_binding Display AbstractDisplay

Expand Down
42 changes: 21 additions & 21 deletions base/linalg/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -299,46 +299,46 @@ end
(-)(A::Hermitian{Tv,S}) where {Tv,S} = Hermitian{Tv,S}(-A.data, A.uplo)

## Matvec
A_mul_B!(y::StridedVector{T}, A::Symmetric{T,<:StridedMatrix}, x::StridedVector{T}) where {T<:BlasFloat} =
mul!(y::StridedVector{T}, A::Symmetric{T,<:StridedMatrix}, x::StridedVector{T}) where {T<:BlasFloat} =
BLAS.symv!(A.uplo, one(T), A.data, x, zero(T), y)
A_mul_B!(y::StridedVector{T}, A::Hermitian{T,<:StridedMatrix}, x::StridedVector{T}) where {T<:BlasReal} =
mul!(y::StridedVector{T}, A::Hermitian{T,<:StridedMatrix}, x::StridedVector{T}) where {T<:BlasReal} =
BLAS.symv!(A.uplo, one(T), A.data, x, zero(T), y)
A_mul_B!(y::StridedVector{T}, A::Hermitian{T,<:StridedMatrix}, x::StridedVector{T}) where {T<:BlasComplex} =
mul!(y::StridedVector{T}, A::Hermitian{T,<:StridedMatrix}, x::StridedVector{T}) where {T<:BlasComplex} =
BLAS.hemv!(A.uplo, one(T), A.data, x, zero(T), y)
## Matmat
A_mul_B!(C::StridedMatrix{T}, A::Symmetric{T,<:StridedMatrix}, B::StridedMatrix{T}) where {T<:BlasFloat} =
mul!(C::StridedMatrix{T}, A::Symmetric{T,<:StridedMatrix}, B::StridedMatrix{T}) where {T<:BlasFloat} =
BLAS.symm!('L', A.uplo, one(T), A.data, B, zero(T), C)
A_mul_B!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Symmetric{T,<:StridedMatrix}) where {T<:BlasFloat} =
mul!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Symmetric{T,<:StridedMatrix}) where {T<:BlasFloat} =
BLAS.symm!('R', B.uplo, one(T), B.data, A, zero(T), C)
A_mul_B!(C::StridedMatrix{T}, A::Hermitian{T,<:StridedMatrix}, B::StridedMatrix{T}) where {T<:BlasReal} =
mul!(C::StridedMatrix{T}, A::Hermitian{T,<:StridedMatrix}, B::StridedMatrix{T}) where {T<:BlasReal} =
BLAS.symm!('L', A.uplo, one(T), A.data, B, zero(T), C)
A_mul_B!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Hermitian{T,<:StridedMatrix}) where {T<:BlasReal} =
mul!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Hermitian{T,<:StridedMatrix}) where {T<:BlasReal} =
BLAS.symm!('R', B.uplo, one(T), B.data, A, zero(T), C)
A_mul_B!(C::StridedMatrix{T}, A::Hermitian{T,<:StridedMatrix}, B::StridedMatrix{T}) where {T<:BlasComplex} =
mul!(C::StridedMatrix{T}, A::Hermitian{T,<:StridedMatrix}, B::StridedMatrix{T}) where {T<:BlasComplex} =
BLAS.hemm!('L', A.uplo, one(T), A.data, B, zero(T), C)
A_mul_B!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Hermitian{T,<:StridedMatrix}) where {T<:BlasComplex} =
mul!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Hermitian{T,<:StridedMatrix}) where {T<:BlasComplex} =
BLAS.hemm!('R', B.uplo, one(T), B.data, A, zero(T), C)

*(A::HermOrSym, B::HermOrSym) = A * copy!(similar(parent(B)), B)

# Fallbacks to avoid generic_matvecmul!/generic_matmatmul!
## Symmetric{<:Number} and Hermitian{<:Real} are invariant to transpose; peel off the t
At_mul_B(A::RealHermSymComplexSym, B::AbstractVector) = A*B
At_mul_B(A::RealHermSymComplexSym, B::AbstractMatrix) = A*B
A_mul_Bt(A::AbstractMatrix, B::RealHermSymComplexSym) = A*B
*(transA::Transpose{<:Any,<:RealHermSymComplexSym}, B::AbstractVector) = transA.parent * B
*(transA::Transpose{<:Any,<:RealHermSymComplexSym}, B::AbstractMatrix) = transA.parent * B
*(A::AbstractMatrix, transB::Transpose{<:Any,<:RealHermSymComplexSym}) = A * transB.parent
## Hermitian{<:Number} and Symmetric{<:Real} are invariant to adjoint; peel off the c
Ac_mul_B(A::RealHermSymComplexHerm, B::AbstractVector) = A*B
Ac_mul_B(A::RealHermSymComplexHerm, B::AbstractMatrix) = A*B
A_mul_Bc(A::AbstractMatrix, B::RealHermSymComplexHerm) = A*B
*(adjA::Adjoint{<:Any,<:RealHermSymComplexHerm}, B::AbstractVector) = adjA.parent * B
*(adjA::Adjoint{<:Any,<:RealHermSymComplexHerm}, B::AbstractMatrix) = adjA.parent * B
*(A::AbstractMatrix, adjB::Adjoint{<:Any,<:RealHermSymComplexHerm}) = A * adjB.parent

# ambiguities with RowVector
A_mul_Bt(A::RowVector, B::RealHermSymComplexSym) = A*B
A_mul_Bc(A::RowVector, B::RealHermSymComplexHerm) = A*B
*(A::RowVector, transB::Transpose{<:Any,<:RealHermSymComplexSym}) = A * transB.parent
*(A::RowVector, adjB::Adjoint{<:Any,<:RealHermSymComplexHerm}) = A * adjB.parent
# ambiguities with AbstractTriangular
At_mul_B(A::RealHermSymComplexSym, B::AbstractTriangular) = A*B
A_mul_Bt(A::AbstractTriangular, B::RealHermSymComplexSym) = A*B
Ac_mul_B(A::RealHermSymComplexHerm, B::AbstractTriangular) = A*B
A_mul_Bc(A::AbstractTriangular, B::RealHermSymComplexHerm) = A*B
*(transA::Transpose{<:Any,<:RealHermSymComplexSym}, B::AbstractTriangular) = transA.parent * B
*(A::AbstractTriangular, transB::Transpose{<:Any,<:RealHermSymComplexSym}) = A * transB.parent
*(adjA::Adjoint{<:Any,<:RealHermSymComplexHerm}, B::AbstractTriangular) = adjA.parent * B
*(A::AbstractTriangular, adjB::Adjoint{<:Any,<:RealHermSymComplexHerm}) = A * adjB.parent

for T in (:Symmetric, :Hermitian), op in (:*, :/)
# Deal with an ambiguous case
Expand Down