@@ -15,11 +15,15 @@ import LinearAlgebra: BlasFloat, matprod, mul!
15
15
@inline * (A:: StaticArray{Tuple{N,1},<:Any,2} , B:: Adjoint{<:Any,<:StaticVector} ) where {N} = vec (A) * B
16
16
@inline * (A:: StaticArray{Tuple{N,1},<:Any,2} , B:: Transpose{<:Any,<:StaticVector} ) where {N} = vec (A) * B
17
17
18
+ # Avoid LinearAlgebra._quad_matmul's order calculation on equal sizes
19
+ @inline * (A:: StaticMatrix{N,N} , B:: StaticMatrix{N,N} , C:: StaticMatrix{N,N} ) where {N} = (A* B)* C
20
+ @inline * (A:: StaticMatrix{N,N} , B:: StaticMatrix{N,N} , C:: StaticMatrix{N,N} , D:: StaticMatrix{N,N} ) where {N} = ((A* B)* C)* D
21
+
18
22
"""
19
23
mul_result_structure(a::Type, b::Type)
20
24
21
25
Get a structure wrapper that should be applied to the result of multiplication of matrices
22
- of given types (a*b).
26
+ of given types (a*b).
23
27
"""
24
28
function mul_result_structure (a, b)
25
29
return identity
114
118
b:: Union{Transpose{Tb, <:StaticVector}, Adjoint{Tb, <:StaticVector}} ) where {sa, sb, Ta, Tb}
115
119
newsize = (sa[1 ], sb[2 ])
116
120
exprs = [:(a[$ i]* b[$ j]) for i = 1 : sa[1 ], j = 1 : sb[2 ]]
117
-
118
121
return quote
119
122
@_inline_meta
120
123
T = promote_op (* , Ta, Tb)
209
212
while m < M
210
213
mu = min (M, m + M_r)
211
214
mrange = m+ 1 : mu
212
-
215
+
213
216
atemps_init = [:($ (atemps[k1]) = a[$ k1]) for k1 = mrange]
214
217
exprs_init = [:($ (tmps[k1,k2]) = $ (atemps[k1]) * b[$ (1 + (k2- 1 ) * sb[1 ])]) for k1 = mrange, k2 = nrange]
215
218
atemps_loop_init = [:($ (atemps[k1]) = a[$ (k1- sa[1 ]) + $ (sa[1 ])* j]) for k1 = mrange]
0 commit comments