Skip to content

Commit

Permalink
remove STPH and fix normest
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelSlevinsky committed Nov 1, 2024
1 parent 7f46265 commit 1e05dd6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 276 deletions.
215 changes: 0 additions & 215 deletions src/SymmetricToeplitzPlusHankel.jl

This file was deleted.

16 changes: 6 additions & 10 deletions src/ToeplitzPlusHankel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ function normest(A::ToeplitzPlusHankel{T}) where T
for i = 2:n-m
ret1 += m*abs2(tr[i])
end
for i = n-m+1:n
ret1 += (n-i)*abs2(tr[i])
for i = max(n-m+1, 2):n
ret1 += (n+1-i)*abs2(tr[i])
end
for i = 1:m
ret2 += i*abs2(h[i])
Expand All @@ -294,8 +294,8 @@ function normest(A::ToeplitzPlusHankel{T}) where T
for i = 2:m-n
ret1 += n*abs2(tc[i])
end
for i = m-n+1:m
ret1 += (m-i)*abs2(tc[i])
for i = max(m-n+1, 2):m
ret1 += (m+1-i)*abs2(tc[i])
end
for i = 1:n
ret2 += i*abs2(h[i])
Expand All @@ -310,10 +310,6 @@ function normest(A::ToeplitzPlusHankel{T}) where T
sqrt(ret1) + sqrt(ret2)
end

normest(A::Symmetric{T, <: ToeplitzPlusHankel{T}}) where T = normest(parent(A))
normest(A::Symmetric{T, <: ToeplitzPlusHankel{T}}) where T = normest(parent(A))+1
normest(A::Hermitian{T, <: ToeplitzPlusHankel{T}}) where T = normest(parent(A))

function normest(A::ChebyshevGramMatrix{T}) where T
n = size(A, 1)
normest(A[1:n, 1:n])
end
normest(A::ChebyshevGramMatrix{T}) where T = normest(ToeplitzPlusHankel(A))
51 changes: 0 additions & 51 deletions test/symmetrictoeplitzplushankeltests.jl

This file was deleted.

4 changes: 4 additions & 0 deletions test/toeplitzplushankeltests.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using FastTransforms, LinearAlgebra, Test

import FastTransforms: normest

@testset "ToeplitzPlusHankel" begin
n = 128
for T in (Float32, Float64)
μ = FastTransforms.chebyshevmoments1(T, 2n-1)
G = ChebyshevGramMatrix(μ)
TpH = ToeplitzPlusHankel(G)
@test TpH G
@test norm(TpH) normest(TpH)
@test normest(TpH) == normest(G)
end
end

0 comments on commit 1e05dd6

Please sign in to comment.