576576# non-`<:Number` scalar elements, so we define some of these for
577577# `<:AbstractMutable` scalar elements here.
578578
579- function Base.:* (A:: Scaling , B:: _SparseMat{<:AbstractMutable} )
579+ function Base.:* (
580+ A:: LinearAlgebra.UniformScaling ,
581+ B:: _SparseMat{<:AbstractMutable} ,
582+ )
580583 return _SparseMat (
581584 B. m,
582585 B. n,
@@ -597,7 +600,10 @@ function Base.:*(A::Number, B::_SparseMat{<:AbstractMutable})
597600 )
598601end
599602
600- function Base.:* (A:: _SparseMat{<:AbstractMutable} , B:: Scaling )
603+ function Base.:* (
604+ A:: _SparseMat{<:AbstractMutable} ,
605+ B:: LinearAlgebra.UniformScaling ,
606+ )
601607 return _SparseMat (
602608 A. m,
603609 A. n,
@@ -638,7 +644,20 @@ function Base.:*(A::_SparseMat, B::AbstractMutable)
638644 )
639645end
640646
641- function Base.:/ (A:: _SparseMat{<:AbstractMutable} , B:: Scaling )
647+ function Base.:/ (
648+ A:: _SparseMat{<:AbstractMutable} ,
649+ B:: LinearAlgebra.UniformScaling ,
650+ )
651+ return _SparseMat (
652+ A. m,
653+ A. n,
654+ copy (A. colptr),
655+ copy (SparseArrays. rowvals (A)),
656+ SparseArrays. nonzeros (A) ./ B,
657+ )
658+ end
659+
660+ function Base.:/ (A:: _SparseMat{<:AbstractMutable} , B:: Number )
642661 return _SparseMat (
643662 A. m,
644663 A. n,
@@ -702,6 +721,14 @@ function Base.:*(α::Number, A::LinearAlgebra.Hermitian{<:AbstractMutable})
702721 )
703722end
704723
724+ # Fix ambiguity identified by Aqua.jl.
725+ function Base.:* (α:: Real , A:: LinearAlgebra.Hermitian{<:AbstractMutable} )
726+ return LinearAlgebra. Hermitian (
727+ α * parent (A),
728+ LinearAlgebra. sym_uplo (A. uplo),
729+ )
730+ end
731+
705732# These three have specific methods that just redirect to `Matrix{T}` which
706733# does not work, e.g. if `zero(T)` has a different type than `T`.
707734
0 commit comments