make sure Q'*Q hits the fast path for IntervalMatrices

This commit is contained in:
Marek Kaluba 2024-02-19 18:20:35 +01:00
parent cd90e072c4
commit c7491f37f9
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
1 changed files with 8 additions and 3 deletions

View File

@ -8,7 +8,7 @@ function augment_columns!(Q::AbstractMatrix)
return Q
end
function __sos_via_sqr!(
function __sos_via_square!(
res::SA.AlgebraElement,
P::AbstractMatrix;
augmented::Bool,
@ -50,14 +50,19 @@ function __sos_via_cnstr!(
return res
end
__square(Q::AbstractMatrix) = Q' * Q
function __square(Q::IntervalMatrices.IntervalMatrix)
return *(IntervalMatrices.MultiplicationType{:fast}(), Q', Q)
end
function compute_sos(
A::SA.StarAlgebra,
Q::AbstractMatrix;
augmented::Bool,
)
= Q' * Q
= __square(Q)
res = SA.AlgebraElement(zeros(eltype(), length(SA.basis(A))), A)
res = __sos_via_sqr!(res, ; augmented = augmented)
res = __sos_via_square!(res, ; augmented = augmented)
return res
end