Skip to content

Commit

Permalink
Fixing type piracy
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasvarga committed Jan 21, 2024
1 parent 33d6a3f commit fb0bb06
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MatrixEquations"
uuid = "99c1a7ee-ab34-5fd5-8076-27c950a045f4"
authors = ["Andreas Varga <varga.andreas@gmail.com>"]
version = "2.4.1"
version = "2.4.2"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
3 changes: 3 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes

## Version 2.4.2
Version bump to fix type piracy detected by Aqua.

## Version 2.4.1
Patch release which implements a new structure exploiting scaling option for all Riccati equation solvers.
This scaling preserves the Hamiltonian/symplectic matrix structures and is based on a symmetric matrix
Expand Down
1 change: 0 additions & 1 deletion src/MatrixEquations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export sylvckr, sylvdkr, gsylvkr, sylvsyskr, dsylvsyskr,
export opnorm1, opnorm1est, oprcondest, opsepest
export lyapop, invlyapop, sylvop, invsylvop, sylvsysop, invsylvsysop, trmatop, eliminationop, duplicationop
export tulyaplikeop, hulyaplikeop, lyaplikeop, gsylvop
#export tulyapop, hulyapop

include("meutil.jl")
include("sylvester.jl")
Expand Down
10 changes: 6 additions & 4 deletions src/riccati.jl
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ function arec(A::AbstractMatrix, B::AbstractVecOrMat, G::Union{AbstractMatrix,Un
return garec(A, I, B, G, R, Q, S; scaling, nrm, pow2, as, rtol)
end
end
Base.complex(A::UniformScaling) = Base.complex(A.λ)*I
tocomplex(A::LinearAlgebra.UniformScaling) = complex(A.λ)*I
tocomplex(A::AbstractArray) = complex(A)
tocomplex(A::Number) = complex(A)
"""
garec(A, E, G, Q = 0; scaling = 'B', pow2 = false, as = false, rtol::Real = nϵ, nrm = 1) -> (X, EVALS, Z, scalinfo)
Expand Down Expand Up @@ -458,7 +460,7 @@ function garec(A::AbstractMatrix, E::Union{AbstractMatrix,UniformScaling}, G::Un

# use complex version because the generalized Schur form decomposition available only for complex data
if !(T <: BlasFloat || T <: Complex)
sol = garec(complex(A),complex(E),complex(G),complex(Q); scaling, nrm, pow2, as, rtol)
sol = garec(tocomplex(A),tocomplex(E),tocomplex(G),tocomplex(Q); scaling, nrm, pow2, as, rtol)
return real(sol[1]), sol[2], Matrix(qr([real(sol[3]) imag(sol[3])]).Q)[:,1:size(A,1)], sol[4]
end

Expand Down Expand Up @@ -674,7 +676,7 @@ function garec(A::AbstractMatrix, E::Union{AbstractMatrix,UniformScaling}, B::Ab

# use complex version because the generalized Schur form decomposition available only for complex data
if !(T <: BlasFloat || T <: Complex)
sol = garec(complex(A),complex(E),complex(B),complex(G),complex(R),complex(Q),complex(S); scaling, pow2, as, rtol, nrm)
sol = garec(tocomplex(A),tocomplex(E),tocomplex(B),tocomplex(G),tocomplex(R),tocomplex(Q),tocomplex(S); scaling, pow2, as, rtol, nrm)
return real(sol[1]), isreal(sol[2]) ? real(sol[2]) : sol[2], real(sol[3]), Matrix(qr([real(sol[4]) imag(sol[4])]).Q)[:,1:size(A,1)], sol[5]
end

Expand Down Expand Up @@ -973,7 +975,7 @@ function gared(A::AbstractMatrix, E::Union{AbstractMatrix,UniformScaling}, B::Ab
T <: BlasFloat || (T = promote_type(Float64,T))
# use complex version because the generalized Schur form decomposition available only for complex data
if !(T <: BlasFloat || T <: Complex)
sol = gared(complex(A),complex(E),complex(B),complex(R),complex(Q),complex(S); scaling, nrm, pow2, as, rtol)
sol = gared(tocomplex(A),tocomplex(E),tocomplex(B),tocomplex(R),tocomplex(Q),tocomplex(S); scaling, nrm, pow2, as, rtol)
return real(sol[1]), sol[2], real(sol[3]), Matrix(qr([real(sol[4]) imag(sol[4])]).Q)[:,1:size(A,1)], sol[5]
end

Expand Down

2 comments on commit fb0bb06

@andreasvarga
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/99263

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.4.2 -m "<description of version>" fb0bb067586b8f9df39a24111c19aedcf8becf50
git push origin v2.4.2

Please sign in to comment.