@@ -190,7 +190,7 @@ function setindex!(D::Diagonal, v, i::Int, j::Int)
190190 if i == j
191191 @inbounds D. diag[i] = v
192192 elseif ! iszero (v)
193- throw (ArgumentError (" cannot set off-diagonal entry ($i , $j ) to a nonzero value ($v )" ))
193+ throw (ArgumentError (lazy " cannot set off-diagonal entry ($i, $j) to a nonzero value ($v)" ))
194194 end
195195 return v
196196end
@@ -279,13 +279,13 @@ Base.literal_pow(::typeof(^), D::Diagonal, ::Val{-1}) = inv(D) # for disambiguat
279279function _muldiag_size_check (A, B)
280280 nA = size (A, 2 )
281281 mB = size (B, 1 )
282- @noinline throw_dimerr (:: AbstractMatrix , nA, mB) = throw (DimensionMismatch (" second dimension of A, $nA , does not match first dimension of B, $mB " ))
283- @noinline throw_dimerr (:: AbstractVector , nA, mB) = throw (DimensionMismatch (" second dimension of D, $nA , does not match length of V, $mB " ))
282+ @noinline throw_dimerr (:: AbstractMatrix , nA, mB) = throw (DimensionMismatch (lazy " second dimension of A, $nA, does not match first dimension of B, $mB" ))
283+ @noinline throw_dimerr (:: AbstractVector , nA, mB) = throw (DimensionMismatch (lazy " second dimension of D, $nA, does not match length of V, $mB" ))
284284 nA == mB || throw_dimerr (B, nA, mB)
285285 return nothing
286286end
287287# the output matrix should have the same size as the non-diagonal input matrix or vector
288- @noinline throw_dimerr (szC, szA) = throw (DimensionMismatch (" output matrix has size: $szC , but should have size $szA " ))
288+ @noinline throw_dimerr (szC, szA) = throw (DimensionMismatch (lazy " output matrix has size: $szC, but should have size $szA" ))
289289_size_check_out (C, :: Diagonal , A) = _size_check_out (C, A)
290290_size_check_out (C, A, :: Diagonal ) = _size_check_out (C, A)
291291_size_check_out (C, A:: Diagonal , :: Diagonal ) = _size_check_out (C, A)
@@ -432,7 +432,7 @@ function _rdiv!(B::AbstractVecOrMat, A::AbstractVecOrMat, D::Diagonal)
432432 dd = D. diag
433433 m, n = size (A, 1 ), size (A, 2 )
434434 if (k = length (dd)) != n
435- throw (DimensionMismatch (" left hand side has $n columns but D is $k by $k " ))
435+ throw (DimensionMismatch (lazy " left hand side has $n columns but D is $k by $k" ))
436436 end
437437 @inbounds for j in 1 : n
438438 ddj = dd[j]
@@ -459,8 +459,8 @@ function ldiv!(B::AbstractVecOrMat, D::Diagonal, A::AbstractVecOrMat)
459459 d = length (dd)
460460 m, n = size (A, 1 ), size (A, 2 )
461461 m′, n′ = size (B, 1 ), size (B, 2 )
462- m == d || throw (DimensionMismatch (" right hand side has $m rows but D is $d by $d " ))
463- (m, n) == (m′, n′) || throw (DimensionMismatch (" expect output to be $m by $n , but got $m′ by $n′ " ))
462+ m == d || throw (DimensionMismatch (lazy " right hand side has $m rows but D is $d by $d" ))
463+ (m, n) == (m′, n′) || throw (DimensionMismatch (lazy " expect output to be $m by $n, but got $m′ by $n′" ))
464464 j = findfirst (iszero, D. diag)
465465 isnothing (j) || throw (SingularException (j))
466466 @inbounds for j = 1 : n, i = 1 : m
474474/ (A:: Diagonal , D:: Diagonal ) = _rdiv! (matprod_dest (A, D, promote_op (/ , eltype (A), eltype (D))), A, D)
475475function _rdiv! (Dc:: Diagonal , Db:: Diagonal , Da:: Diagonal )
476476 n, k = length (Db. diag), length (Da. diag)
477- n == k || throw (DimensionMismatch (" left hand side has $n columns but D is $k by $k " ))
477+ n == k || throw (DimensionMismatch (lazy " left hand side has $n columns but D is $k by $k" ))
478478 j = findfirst (iszero, Da. diag)
479479 isnothing (j) || throw (SingularException (j))
480480 Dc. diag .= Db. diag ./ Da. diag
@@ -502,10 +502,10 @@ function ldiv!(T::Tridiagonal, D::Diagonal, S::Union{SymTridiagonal,Tridiagonal}
502502 m = size (S, 1 )
503503 dd = D. diag
504504 if (k = length (dd)) != m
505- throw (DimensionMismatch (" diagonal matrix is $k by $k but right hand side has $m rows" ))
505+ throw (DimensionMismatch (lazy " diagonal matrix is $k by $k but right hand side has $m rows" ))
506506 end
507507 if length (T. d) != m
508- throw (DimensionMismatch (" target matrix size $(size (T)) does not match input matrix size $(size (S)) " ))
508+ throw (DimensionMismatch (lazy " target matrix size $(size(T)) does not match input matrix size $(size(S))" ))
509509 end
510510 m == 0 && return T
511511 j = findfirst (iszero, dd)
@@ -539,10 +539,10 @@ function _rdiv!(T::Tridiagonal, S::Union{SymTridiagonal,Tridiagonal}, D::Diagona
539539 n = size (S, 2 )
540540 dd = D. diag
541541 if (k = length (dd)) != n
542- throw (DimensionMismatch (" left hand side has $n columns but D is $k by $k " ))
542+ throw (DimensionMismatch (lazy " left hand side has $n columns but D is $k by $k" ))
543543 end
544544 if length (T. d) != n
545- throw (DimensionMismatch (" target matrix size $(size (T)) does not match input matrix size $(size (S)) " ))
545+ throw (DimensionMismatch (lazy " target matrix size $(size(T)) does not match input matrix size $(size(S))" ))
546546 end
547547 n == 0 && return T
548548 j = findfirst (iszero, dd)
612612 valB = B. diag; nB = length (valB)
613613 nC = checksquare (C)
614614 @boundscheck nC == nA* nB ||
615- throw (DimensionMismatch (" expect C to be a $(nA* nB) x$(nA* nB) matrix, got size $(nC) x$(nC) " ))
615+ throw (DimensionMismatch (lazy " expect C to be a $(nA*nB)x$(nA*nB) matrix, got size $(nC)x$(nC)" ))
616616 isempty (A) || isempty (B) || fill! (C, zero (A[1 ,1 ] * B[1 ,1 ]))
617617 @inbounds for i = 1 : nA, j = 1 : nB
618618 idx = (i- 1 )* nB+ j
643643 (mB, nB) = size (B)
644644 (mC, nC) = size (C)
645645 @boundscheck (mC, nC) == (mA * mB, nA * nB) ||
646- throw (DimensionMismatch (" expect C to be a $(mA * mB) x$(nA * nB) matrix, got size $(mC) x$(nC) " ))
646+ throw (DimensionMismatch (lazy " expect C to be a $(mA * mB)x$(nA * nB) matrix, got size $(mC)x$(nC)" ))
647647 isempty (A) || isempty (B) || fill! (C, zero (A[1 ,1 ] * B[1 ,1 ]))
648648 m = 1
649649 @inbounds for j = 1 : nA
666666 (mB, nB) = size (B)
667667 (mC, nC) = size (C)
668668 @boundscheck (mC, nC) == (mA * mB, nA * nB) ||
669- throw (DimensionMismatch (" expect C to be a $(mA * mB) x$(nA * nB) matrix, got size $(mC) x$(nC) " ))
669+ throw (DimensionMismatch (lazy " expect C to be a $(mA * mB)x$(nA * nB) matrix, got size $(mC)x$(nC)" ))
670670 isempty (A) || isempty (B) || fill! (C, zero (A[1 ,1 ] * B[1 ,1 ]))
671671 m = 1
672672 @inbounds for j = 1 : nA
@@ -879,15 +879,15 @@ dot(x::AbstractVector, D::Diagonal, y::AbstractVector) = _mapreduce_prod(dot, x,
879879
880880dot (A:: Diagonal , B:: Diagonal ) = dot (A. diag, B. diag)
881881function dot (D:: Diagonal , B:: AbstractMatrix )
882- size (D) == size (B) || throw (DimensionMismatch (" Matrix sizes $(size (D)) and $(size (B)) differ" ))
882+ size (D) == size (B) || throw (DimensionMismatch (lazy " Matrix sizes $(size(D)) and $(size(B)) differ" ))
883883 return dot (D. diag, view (B, diagind (B, IndexStyle (B))))
884884end
885885
886886dot (A:: AbstractMatrix , B:: Diagonal ) = conj (dot (B, A))
887887
888888function _mapreduce_prod (f, x, D:: Diagonal , y)
889889 if ! (length (x) == length (D. diag) == length (y))
890- throw (DimensionMismatch (" x has length $(length (x)) , D has size $(size (D)) , and y has $(length (y)) " ))
890+ throw (DimensionMismatch (lazy " x has length $(length(x)), D has size $(size(D)), and y has $(length(y))" ))
891891 end
892892 if isempty (x) && isempty (D) && isempty (y)
893893 return zero (promote_op (f, eltype (x), eltype (D), eltype (y)))
0 commit comments