Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e86e8bb
Added MemoryLayout, rewrote mul! to be based on memory layout
dlfivefifty Jan 14, 2018
1d80d44
MemoryLayout implemented for instances not types, improved mul! type …
dlfivefifty Jan 16, 2018
81c2f92
Added other memory layouts, updated triangular
dlfivefifty Jan 16, 2018
84fc2ee
fix ambiguity
dlfivefifty Jan 16, 2018
c65a568
fix UndefVar error
dlfivefifty Jan 17, 2018
f12129d
Merge branch 'master' of https://github.com/JuliaLang/julia into dl/a…
Jan 19, 2018
f467664
Merge branch 'master' of https://github.com/JuliaLang/julia into dl/a…
Jan 19, 2018
1387afc
Restore mapslices (for now)
Jan 19, 2018
4ff991d
order of generalized eigvals appears to be brittle, so sort before co…
Jan 19, 2018
9bbdc8f
merge
dlfivefifty Jan 19, 2018
c4d93e5
merge triangular
dlfivefifty Jan 19, 2018
9d23927
Fix mul2! usages
dlfivefifty Jan 20, 2018
cac81bc
Fix transpose/adjoint MemoryLayout, add tests, add DenseLayout
dlfivefifty Jan 20, 2018
c745821
dot, dotu dispatch, remove special * for Adjoint/Transpose
dlfivefifty Jan 21, 2018
fe55aad
Add MemoryLayout for symmetric, add docs
dlfivefifty Jan 21, 2018
807644d
Merge branch 'master' of https://github.com/JuliaLang/julia into dl/a…
dlfivefifty Jan 22, 2018
30d5ad8
Fix whitespace
dlfivefifty Jan 22, 2018
a67eebe
Fix symmetric ambiguities
dlfivefifty Jan 27, 2018
725ab0e
Merge master
dlfivefifty Jan 27, 2018
3f2528d
Override MemoryLayout for all DenseVector/Matrices (included SharedAr…
Jan 29, 2018
15238b6
Rename layouts to DenseColumnMajor, DenseColumnsStridedRows, DenseRow…
Jan 30, 2018
3e1e4c4
Add ConjLayout to replace ConjDenseColumns, and others
dlfivefifty Feb 4, 2018
64e8609
add strides for DenseRowMajor
dlfivefifty Feb 4, 2018
ce99b1b
strides for BitArray, conj of triangular layouts
dlfivefifty Feb 5, 2018
1a454fd
merge master
dlfivefifty Feb 5, 2018
33f4e48
mul1! -> rmul!, mul2! -> lmul!
dlfivefifty Feb 5, 2018
37c44d5
Redesign TriangularLayouts and Symmetric/HermitianLayout, add tests t…
dlfivefifty Feb 9, 2018
c5ddd01
Move MemoryLayout routines to Base
dlfivefifty Feb 14, 2018
8c4d4cd
merge master
dlfivefifty Feb 19, 2018
482939a
merge dense
dlfivefifty Feb 19, 2018
01047c8
Merge branch 'master' of https://github.com/JuliaLang/julia into dl/a…
dlfivefifty Feb 19, 2018
3618a39
DenseColumns -> AbstractColumnMajor
Feb 19, 2018
0b0eb44
Merge master
Feb 28, 2018
bad7814
MemoryLayout{T} -> MemoryLayout, as well as subtypes
Feb 28, 2018
6110ccb
Fix vecdot, be more conservative in dispatch for symmetriclayout, etc…
dlfivefifty Feb 28, 2018
dfcc856
Fix vecdot ambiguity
dlfivefifty Mar 1, 2018
8ad8a35
submemorylayout -> subarraylayout, MemoryLayout(::DenseArray) restore…
Mar 1, 2018
5d55e48
first attempt at arbitrary d
Mar 1, 2018
74c7f67
subarraylayout now works with arb d
dlfivefifty Mar 1, 2018
d723b1a
more ambiguities fixed
dlfivefifty Mar 2, 2018
a0cd467
add RowMajorArray tests, update memory layout docs for arbitrary dime…
Mar 2, 2018
681f73b
Add _mul(A, B, memlayA, memlayB) to simplify * overloads
Mar 2, 2018
9d0f50b
view(UpperTriangular(A), :, Base.OneTo(n)) (and similar) now conform …
Mar 2, 2018
3413fba
remove white space
dlfivefifty Mar 2, 2018
ed88786
merge master
dlfivefifty Mar 11, 2018
5535185
Add Increasing/DecreasingStrides
dlfivefifty Mar 11, 2018
53c2879
merge master
Mar 12, 2018
7b19e38
Add `Base.MemoryLayout(A)` as optional override, fix docs for MemoryL…
Mar 12, 2018
09aa094
Merge branch 'master' of https://github.com/JuliaLang/julia into dl/a…
Mar 26, 2018
f2f1b8f
Add NEWS item
Mar 26, 2018
e19f1a5
fixes for mbauman
dlfivefifty Apr 7, 2018
196b040
Merge branch 'dl/arraymemorylayout' of https://github.com/dlfivefifty…
dlfivefifty Apr 7, 2018
d386ef3
Merge branch 'master' of https://github.com/JuliaLang/julia into dl/a…
dlfivefifty Apr 7, 2018
f2bc361
Merge master
dlfivefifty May 18, 2018
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
18 changes: 14 additions & 4 deletions stdlib/LinearAlgebra/src/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,22 @@ function (*)(A::AbstractMatrix, B::AbstractMatrix)
mul!(similar(B, TS, (size(A,1), size(B,2))), A, B)
end


"""
mul1!(A, B)

Calculate the matrix-matrix product ``AB``, overwriting `A`, and return the result.
"""
mul1!(A, B) = _mul1!(A, B, MemoryLayout(A), MemoryLayout(B))


"""
mul!(A, B)
mul2!(A, B)

Calculate the matrix-matrix product ``AB``, overwriting one of `A` or `B` (but not both),
and return the result (the overwritten argument).
Calculate the matrix-matrix product ``AB``, overwriting `B`, and return the result.
"""
mul!(A, B) = _mul!(A, B, MemoryLayout(A), MemoryLayout(B))
mul2!(A, B) = _mul2!(A, B, MemoryLayout(A), MemoryLayout(B))


_mul!(C::AbstractMatrix, A::AbstractMatrix, B::AbstractMatrix, _1, _2, _3) = generic_matmatmul!(C, 'N', 'N', A, B)

Expand All @@ -191,6 +200,7 @@ _mul!(C::AbstractMatrix, transA::AbstractMatrix, B::AbstractMatrix, _, ::Transpo

_mul!(C::AbstractMatrix{T}, A::AbstractMatrix{T}, transB::AbstractMatrix{T}, ::StridedLayout, ::StridedLayout, ::TransposeLayout) where {T<:BlasFloat} =
(B = transpose(transB); A === B ? syrk_wrapper!(C, 'N', A) : gemm_wrapper!(C, 'N', 'T', A, B))

for elty in (Float32,Float64)
@eval begin
function _mul!(C::AbstractMatrix{Complex{$elty}}, A::AbstractMatrix{Complex{$elty}}, transB::AbstractMatrix{$elty}, ::StridedLayout, ::StridedLayout, ::TransposeLayout)
Expand Down
25 changes: 13 additions & 12 deletions stdlib/LinearAlgebra/src/triangular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ mul2!(A::Tridiagonal, B::AbstractTriangular) = A*full!(B) # is this necessary?

mul!(C::AbstractMatrix, A::AbstractTriangular, B::Tridiagonal) = mul!(C, copyto!(similar(parent(A)), A), B)
mul!(C::AbstractMatrix, A::Tridiagonal, B::AbstractTriangular) = mul!(C, A, copyto!(similar(parent(B)), B))
<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge/rebase error


for (t, memlay, uploc, isunitc) in ((:LowerTriangular, :LowerTriangularLayout, 'L', 'N'),
(:UnitLowerTriangular, :UnitLowerTriangularLayout, 'L', 'U'),
Expand All @@ -498,32 +499,32 @@ for (t, memlay, uploc, isunitc) in ((:LowerTriangular, :LowerTriangularLayout, '
_mul!(y::AbstractVector{T}, A::AbstractMatrix{T}, b::AbstractVector{T}, ::StridedLayout, ::$memlay, ::StridedLayout) where {T<:BlasFloat} =
mul!(A, copyto!(y, b))

_mul!(A::AbstractMatrix{T}, b::AbstractVector{T}, ::$memlay{'N'}, ::StridedLayout) where {T<:BlasFloat} =
_mul2!(A::AbstractMatrix{T}, b::AbstractVector{T}, ::$memlay{'N'}, ::StridedLayout) where {T<:BlasFloat} =
BLAS.trmv!($uploc, 'N', $isunitc, A.data, b)
_mul!(transA::AbstractMatrix{T}, b::AbstractVector{T}, ::$memlay{'T'}, ::StridedLayout) where {T<:BlasFloat} =
_mul2!(transA::AbstractMatrix{T}, b::AbstractVector{T}, ::$memlay{'T'}, ::StridedLayout) where {T<:BlasFloat} =
(A = transpose(transA); BLAS.trmv!($uploc, 'T', $isunitc, A.data, b))
_mul!(adjA::AbstractMatrix{T}, b::AbstractVector{T}, ::$memlay{'C'}, ::StridedLayout) where {T<:BlasComplex} =
_mul2!(adjA::AbstractMatrix{T}, b::AbstractVector{T}, ::$memlay{'C'}, ::StridedLayout) where {T<:BlasComplex} =
(A = adjoint(adjA); BLAS.trmv!($uploc, 'C', $isunitc, A.data, b))

# Matrix multiplication
_mul!(C::AbstractMatrix{T}, A::AbstractMatrix{T}, B::AbstractMatrix{T}, ::StridedLayout, ::$memlay, ::StridedLayout) where {T<:BlasFloat} =
mul!(A, copyto!(C, B))
_mul!(C::AbstractMatrix{T}, A::AbstractMatrix{T}, B::AbstractMatrix{T}, ::StridedLayout, ::StridedLayout, ::$memlay) where {T<:BlasFloat} =
mul!(A, copyto!(C, B))
mul2!(A, copyto!(C, B))
_mul2!(C::AbstractMatrix{T}, A::AbstractMatrix{T}, B::AbstractMatrix{T}, ::StridedLayout, ::StridedLayout, ::$memlay) where {T<:BlasFloat} =
mul1!(copyto!(C, A), B)

_mul!(A::AbstractMatrix{T}, B::AbstractMatrix{T}, ::$memlay{'N'}, ::StridedLayout) where {T<:BlasFloat} =
_mul2!(A::AbstractMatrix{T}, B::AbstractMatrix{T}, ::$memlay{'N'}, ::StridedLayout) where {T<:BlasFloat} =
BLAS.trmm!('L', $uploc, 'N', $isunitc, one(T), A.data, B)
_mul!(A::AbstractMatrix{T}, B::AbstractMatrix{T}, ::StridedLayout, ::$memlay{'N'}) where {T<:BlasFloat} =
_mul1!(A::AbstractMatrix{T}, B::AbstractMatrix{T}, ::StridedLayout, ::$memlay{'N'}) where {T<:BlasFloat} =
BLAS.trmm!('R', $uploc, 'N', $isunitc, one(T), B.data, A)

_mul!(transA::AbstractMatrix{T}, B::AbstractMatrix{T}, ::$memlay{'T'}, ::StridedLayout) where {T<:BlasFloat} =
_mul2!(transA::AbstractMatrix{T}, B::AbstractMatrix{T}, ::$memlay{'T'}, ::StridedLayout) where {T<:BlasFloat} =
(A = transpose(transA); BLAS.trmm!('L', $uploc, 'T', $isunitc, one(T), A.data, B))
_mul!(adjA::AbstractMatrix{T}, B::StridedMatrix{T}, ::$memlay{'C'}, ::StridedLayout) where {T<:BlasComplex} =
_mul2!(adjA::AbstractMatrix{T}, B::StridedMatrix{T}, ::$memlay{'C'}, ::StridedLayout) where {T<:BlasComplex} =
(A = adjoint(adjA); BLAS.trmm!('L', $uploc, 'C', $isunitc, one(T), A.data, B))

_mul!(A::AbstractMatrix{T}, transB::AbstractMatrix{T}, ::StridedLayout, ::$memlay{'T'}) where {T<:BlasFloat} =
_mul1!(A::AbstractMatrix{T}, transB::AbstractMatrix{T}, ::StridedLayout, ::$memlay{'T'}) where {T<:BlasFloat} =
(B = transpose(transB); BLAS.trmm!('R', $uploc, 'T', $isunitc, one(T), B.data, A))
_mul!(A::AbstractMatrix{T}, adjB::AbstractMatrix{T}, ::StridedLayout, ::$memlay{'C'}) where {T<:BlasComplex} =
_mul1!(A::AbstractMatrix{T}, adjB::AbstractMatrix{T}, ::StridedLayout, ::$memlay{'C'}) where {T<:BlasComplex} =
(B = adjoint(adjB); BLAS.trmm!('R', $uploc, 'C', $isunitc, one(T), B.data, A))

# Left division
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.