From 5941921cb2c88e933196de363b3c8bd007287be0 Mon Sep 17 00:00:00 2001 From: DSVarga Date: Thu, 24 Oct 2024 11:36:44 +0200 Subject: [PATCH] Load ApproxFun in tests. --- Project.toml | 3 ++- src/psfutils.jl | 2 ++ test/test_pmutils.jl | 2 +- test/test_pschur.jl | 7 ++++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index 2a664e5..662a2e2 100644 --- a/Project.toml +++ b/Project.toml @@ -23,6 +23,7 @@ ApproxFun = "28f2ccd6-bb30-5033-b560-165f7b14dc2f" FourierApproxExt = "ApproxFun" [extras] +ApproxFun = "28f2ccd6-bb30-5033-b560-165f7b14dc2f" Bessels = "0e736298-9ec6-45e8-9647-e4fc86a2fe38" MatrixPencils = "48965c70-4690-11ea-1f13-43a2532b2fa8" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" @@ -46,4 +47,4 @@ julia = "1.10" [targets] -test = ["Bessels","MatrixPencils","Test"] +test = ["ApproxFun","Bessels","MatrixPencils","Test"] diff --git a/src/psfutils.jl b/src/psfutils.jl index f631773..b1034c1 100644 --- a/src/psfutils.jl +++ b/src/psfutils.jl @@ -1154,6 +1154,7 @@ function psordschur!(S::AbstractVector{Matrix{Float64}}, Z::AbstractVector{Matri rev || (reverse!(m); reverse!(n)) ldq = rev ? n : [m[end];m[1:end-1]] nc = minimum(n) + nc == length(select) || throw(ArgumentError("Dimension of select must be equal to the number of core eigenvalues $nc")) kschur = rev ? schurindex : k-schurindex+1 ni = zeros(Int,k) s = ones(Int,k) @@ -1195,6 +1196,7 @@ function psordschur1!(S::AbstractVector{Matrix{Float64}}, Z::AbstractVector{Matr (all(m .== nc) && all(n .== nc)) || error("all elements of S must be square matrices of same dimension") k == length(Z) || error("S and Z must have the same length") (all(size.(Z,1) .== nc) && all(size.(Z,2) .== nc)) || error("all elements of Z must be square matrices of same dimension as S") + nc == length(select) || throw(ArgumentError("Dimension of select must be equal to the number of core eigenvalues $nc")) kschur = rev ? schurindex : k-schurindex+1 ni = zeros(Int,k) s = ones(Int,k) diff --git a/test/test_pmutils.jl b/test/test_pmutils.jl index 838e73b..a0eb12d 100644 --- a/test/test_pmutils.jl +++ b/test/test_pmutils.jl @@ -1,8 +1,8 @@ module Test_pmutils +using PeriodicMatrices using ApproxFun using Symbolics -using PeriodicMatrices using Test using LinearAlgebra using MatrixPencils diff --git a/test/test_pschur.jl b/test/test_pschur.jl index e2562cc..e41815a 100644 --- a/test/test_pschur.jl +++ b/test/test_pschur.jl @@ -1,6 +1,7 @@ module Test_pschur using PeriodicMatrices +using ApproxFun using Test using LinearAlgebra using LinearAlgebra: BlasInt @@ -452,17 +453,17 @@ A3 = [-4 3 5 2 2; 2 -5 -2 0 2; -1 -2 5 3 0; 0 1 -3 -5 0; 0 0 4 -4 3]; A = [A1, A2, A3]; @time S, Z, eigs, ischur, α, γ = pschur(A; rev = true); -select = (real(eigs) .< 0)[1:3] +select = (real(eigs) .< 0) @time psordschur!(S,Z,select; schurindex=ischur, rev = true) @test check_psim(A,Z,S; rev = true) ev=MatrixPencils.ordeigvals(S[3]*S[2]*S[1]) @time S, Z, eigs, ischur, α, γ = pschur(A; rev = true); -select = (real(eigs) .< 0)[1:3] +select = (real(eigs) .< 0) @time psordschur1!(S,Z,select; schurindex=ischur, rev = true) @test check_psim(A,Z,S; rev = true) ev1=MatrixPencils.ordeigvals(S[3]*S[2]*S[1]) -@test ev ≈ ev1 +@test sort(ev) ≈ sort(ev1) # Example Hench & Laub IEETAC 1994