Skip to content

Commit 1e05dd6

Browse files
remove STPH and fix normest
1 parent 7f46265 commit 1e05dd6

File tree

4 files changed

+10
-276
lines changed

4 files changed

+10
-276
lines changed

src/SymmetricToeplitzPlusHankel.jl

Lines changed: 0 additions & 215 deletions
This file was deleted.

src/ToeplitzPlusHankel.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ function normest(A::ToeplitzPlusHankel{T}) where T
275275
for i = 2:n-m
276276
ret1 += m*abs2(tr[i])
277277
end
278-
for i = n-m+1:n
279-
ret1 += (n-i)*abs2(tr[i])
278+
for i = max(n-m+1, 2):n
279+
ret1 += (n+1-i)*abs2(tr[i])
280280
end
281281
for i = 1:m
282282
ret2 += i*abs2(h[i])
@@ -294,8 +294,8 @@ function normest(A::ToeplitzPlusHankel{T}) where T
294294
for i = 2:m-n
295295
ret1 += n*abs2(tc[i])
296296
end
297-
for i = m-n+1:m
298-
ret1 += (m-i)*abs2(tc[i])
297+
for i = max(m-n+1, 2):m
298+
ret1 += (m+1-i)*abs2(tc[i])
299299
end
300300
for i = 1:n
301301
ret2 += i*abs2(h[i])
@@ -310,10 +310,6 @@ function normest(A::ToeplitzPlusHankel{T}) where T
310310
sqrt(ret1) + sqrt(ret2)
311311
end
312312

313-
normest(A::Symmetric{T, <: ToeplitzPlusHankel{T}}) where T = normest(parent(A))
313+
normest(A::Symmetric{T, <: ToeplitzPlusHankel{T}}) where T = normest(parent(A))+1
314314
normest(A::Hermitian{T, <: ToeplitzPlusHankel{T}}) where T = normest(parent(A))
315-
316-
function normest(A::ChebyshevGramMatrix{T}) where T
317-
n = size(A, 1)
318-
normest(A[1:n, 1:n])
319-
end
315+
normest(A::ChebyshevGramMatrix{T}) where T = normest(ToeplitzPlusHankel(A))

test/symmetrictoeplitzplushankeltests.jl

Lines changed: 0 additions & 51 deletions
This file was deleted.

test/toeplitzplushankeltests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
using FastTransforms, LinearAlgebra, Test
22

3+
import FastTransforms: normest
4+
35
@testset "ToeplitzPlusHankel" begin
46
n = 128
57
for T in (Float32, Float64)
68
μ = FastTransforms.chebyshevmoments1(T, 2n-1)
79
G = ChebyshevGramMatrix(μ)
810
TpH = ToeplitzPlusHankel(G)
911
@test TpH G
12+
@test norm(TpH) normest(TpH)
13+
@test normest(TpH) == normest(G)
1014
end
1115
end

0 commit comments

Comments
 (0)