Skip to content

Commit 324c223

Browse files
add absolute value moments
1 parent 7ca43ce commit 324c223

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "FastTransforms"
22
uuid = "057dd010-8810-581a-b7be-e3fc3b93f78c"
3-
version = "0.16.0"
3+
version = "0.16.1"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/specialfunctions.jl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,23 @@ function chebyshevlogmoments1(::Type{T}, N::Int) where T
307307
μ
308308
end
309309

310+
"""
311+
Modified Chebyshev moments of the first kind with respect to the absolute value weight:
312+
313+
```math
314+
\\int_{-1}^{+1} T_n(x) |x|{\\rm\\,d}x.
315+
```
316+
"""
317+
function chebyshevabsmoments1(::Type{T}, N::Int) where T
318+
μ = zeros(T, N)
319+
if N > 0
320+
for i=0:4:N-1
321+
@inbounds μ[i+1] = -T(1)/T((i÷2)^2-1)
322+
end
323+
end
324+
μ
325+
end
326+
310327
"""
311328
Modified Chebyshev moments of the second kind:
312329
@@ -359,6 +376,23 @@ function chebyshevlogmoments2(::Type{T}, N::Int) where T
359376
μ
360377
end
361378

379+
"""
380+
Modified Chebyshev moments of the second kind with respect to the absolute value weight:
381+
382+
```math
383+
\\int_{-1}^{+1} U_n(x) |x|{\\rm\\,d}x.
384+
```
385+
"""
386+
function chebyshevabsmoments2(::Type{T}, N::Int) where T
387+
μ = chebyshevabsmoments1(T, N)
388+
if N > 1
389+
μ[2] *= two(T)
390+
for i=1:N-2
391+
@inbounds μ[i+2] = 2μ[i+2] + μ[i]
392+
end
393+
end
394+
μ
395+
end
362396

363397
function sphrand(::Type{T}, m::Int, n::Int) where T
364398
A = zeros(T, m, n)

0 commit comments

Comments
 (0)