@@ -566,22 +566,6 @@ function rmul!(B::Bidiagonal, D::Diagonal)
566566 return B
567567end
568568
569- @noinline function check_A_mul_B!_sizes ((mC, nC):: NTuple{2,Integer} , (mA, nA):: NTuple{2,Integer} , (mB, nB):: NTuple{2,Integer} )
570- # check for matching sizes in one column of B and C
571- check_A_mul_B!_sizes ((mC,), (mA, nA), (mB,))
572- # ensure that the number of columns in B and C match
573- if nB != nC
574- throw (DimensionMismatch (lazy " second dimension of output C, $nC, and second dimension of B, $nB, must match" ))
575- end
576- end
577- @noinline function check_A_mul_B!_sizes ((mC,):: Tuple{Integer} , (mA, nA):: NTuple{2,Integer} , (mB,):: Tuple{Integer} )
578- if mA != mC
579- throw (DimensionMismatch (lazy " first dimension of A, $mA, and first dimension of output C, $mC, must match" ))
580- elseif nA != mB
581- throw (DimensionMismatch (lazy " second dimension of A, $nA, and first dimension of B, $mB, must match" ))
582- end
583- end
584-
585569# function to get the internally stored vectors for Bidiagonal and [Sym]Tridiagonal
586570# to avoid allocations in _mul! below (#24324, #24578)
587571_diag (A:: Tridiagonal , k) = k == - 1 ? A. dl : k == 0 ? A. d : A. du
@@ -603,7 +587,7 @@ _mul!(C::AbstractMatrix, A::BiTriSym, B::Bidiagonal, _add::MulAddMul) =
603587 _bibimul! (C, A, B, _add)
604588function _bibimul! (C, A, B, _add)
605589 require_one_based_indexing (C)
606- check_A_mul_B!_sizes (size (C), size (A), size (B))
590+ matmul_size_check (size (C), size (A), size (B))
607591 n = size (A,1 )
608592 iszero (n) && return C
609593 # We use `_rmul_or_fill!` instead of `_modify!` here since using
@@ -851,7 +835,7 @@ _mul!(C::AbstractMatrix, A::BiTriSym, B::Diagonal, alpha::Number, beta::Number)
851835 @stable_muladdmul _mul! (C, A, B, MulAddMul (alpha, beta))
852836function _mul! (C:: AbstractMatrix , A:: BiTriSym , B:: Diagonal , _add:: MulAddMul )
853837 require_one_based_indexing (C)
854- check_A_mul_B!_sizes (size (C), size (A), size (B))
838+ matmul_size_check (size (C), size (A), size (B))
855839 n = size (A,1 )
856840 iszero (n) && return C
857841 _rmul_or_fill! (C, _add. beta) # see the same use above
894878
895879function _mul! (C:: AbstractMatrix , A:: Bidiagonal , B:: Diagonal , _add:: MulAddMul )
896880 require_one_based_indexing (C)
897- check_A_mul_B!_sizes (size (C), size (A), size (B))
881+ matmul_size_check (size (C), size (A), size (B))
898882 n = size (A,1 )
899883 iszero (n) && return C
900884 _rmul_or_fill! (C, _add. beta) # see the same use above
@@ -924,7 +908,7 @@ function _mul!(C::AbstractMatrix, A::Bidiagonal, B::Diagonal, _add::MulAddMul)
924908end
925909
926910function _mul! (C:: Bidiagonal , A:: Bidiagonal , B:: Diagonal , _add:: MulAddMul )
927- check_A_mul_B!_sizes (size (C), size (A), size (B))
911+ matmul_size_check (size (C), size (A), size (B))
928912 n = size (A,1 )
929913 iszero (n) && return C
930914 iszero (_add. alpha) && return _rmul_or_fill! (C, _add. beta)
957941
958942function _mul! (C:: AbstractVecOrMat , A:: BiTriSym , B:: AbstractVecOrMat , _add:: MulAddMul )
959943 require_one_based_indexing (C, B)
960- check_A_mul_B!_sizes (size (C), size (A), size (B))
944+ matmul_size_check (size (C), size (A), size (B))
961945 nA = size (A,1 )
962946 nB = size (B,2 )
963947 (iszero (nA) || iszero (nB)) && return C
@@ -1027,7 +1011,7 @@ end
10271011
10281012function _mul! (C:: AbstractMatrix , A:: AbstractMatrix , B:: TriSym , _add:: MulAddMul )
10291013 require_one_based_indexing (C, A)
1030- check_A_mul_B!_sizes (size (C), size (A), size (B))
1014+ matmul_size_check (size (C), size (A), size (B))
10311015 n = size (A,1 )
10321016 m = size (B,2 )
10331017 (iszero (_add. alpha) || iszero (m)) && return _rmul_or_fill! (C, _add. beta)
@@ -1063,7 +1047,7 @@ end
10631047
10641048function _mul! (C:: AbstractMatrix , A:: AbstractMatrix , B:: Bidiagonal , _add:: MulAddMul )
10651049 require_one_based_indexing (C, A)
1066- check_A_mul_B!_sizes (size (C), size (A), size (B))
1050+ matmul_size_check (size (C), size (A), size (B))
10671051 m, n = size (A)
10681052 (iszero (m) || iszero (n)) && return C
10691053 iszero (_add. alpha) && return _rmul_or_fill! (C, _add. beta)
@@ -1093,7 +1077,7 @@ _mul!(C::AbstractMatrix, A::Diagonal, B::TriSym, _add::MulAddMul) =
10931077 _dibimul! (C, A, B, _add)
10941078function _dibimul! (C, A, B, _add)
10951079 require_one_based_indexing (C)
1096- check_A_mul_B!_sizes (size (C), size (A), size (B))
1080+ matmul_size_check (size (C), size (A), size (B))
10971081 n = size (A,1 )
10981082 iszero (n) && return C
10991083 # ensure that we fill off-band elements in the destination
@@ -1137,7 +1121,7 @@ function _dibimul!(C, A, B, _add)
11371121end
11381122function _dibimul! (C:: AbstractMatrix , A:: Diagonal , B:: Bidiagonal , _add)
11391123 require_one_based_indexing (C)
1140- check_A_mul_B!_sizes (size (C), size (A), size (B))
1124+ matmul_size_check (size (C), size (A), size (B))
11411125 n = size (A,1 )
11421126 iszero (n) && return C
11431127 # ensure that we fill off-band elements in the destination
@@ -1168,7 +1152,7 @@ function _dibimul!(C::AbstractMatrix, A::Diagonal, B::Bidiagonal, _add)
11681152 C
11691153end
11701154function _dibimul! (C:: Bidiagonal , A:: Diagonal , B:: Bidiagonal , _add)
1171- check_A_mul_B!_sizes (size (C), size (A), size (B))
1155+ matmul_size_check (size (C), size (A), size (B))
11721156 n = size (A,1 )
11731157 n == 0 && return C
11741158 iszero (_add. alpha) && return _rmul_or_fill! (C, _add. beta)
0 commit comments