|
1 | 1 | # diff from CosSpace -> SinSpace
|
2 | 2 |
|
3 | 3 | function cosspacediff(v::AbstractVector{T}) where T<:Number
|
| 4 | + Base.require_one_based_indexing(v) |
4 | 5 | if length(v)==1
|
5 | 6 | w = zeros(T,1)
|
6 | 7 | else
|
|
16 | 17 | # diff from SinSpace -> CosSpace
|
17 | 18 |
|
18 | 19 | function sinspacediff(v::AbstractVector{T}) where T<:Number
|
| 20 | + Base.require_one_based_indexing(v) |
19 | 21 | w = Array{T}(undef, length(v)+1)
|
20 | 22 | w[1] = zero(T)
|
21 | 23 | for k=1:length(v)
|
|
28 | 30 | # diff from Fourier -> Fourier
|
29 | 31 |
|
30 | 32 | function fourierdiff(v::AbstractVector{T}) where T<:Number
|
| 33 | + Base.require_one_based_indexing(v) |
31 | 34 | n = 2(length(v)÷2)+1
|
32 | 35 | w = Array{T}(undef, n)
|
33 | 36 | w[1] = zero(T)
|
|
44 | 47 | # diff from Taylor -> Taylor
|
45 | 48 |
|
46 | 49 | function taylor_diff(v::AbstractVector{T}) where T<:Number
|
| 50 | + Base.require_one_based_indexing(v) |
47 | 51 | w = Array{T}(undef, length(v))
|
48 |
| - for k=1:length(v) |
| 52 | + for k in eachindex(v, w) |
49 | 53 | @inbounds w[k] = (k-1)*v[k]
|
50 | 54 | end
|
51 | 55 |
|
|
55 | 59 | # diff from Hardy{false} -> Hardy{false}
|
56 | 60 |
|
57 | 61 | function hardyfalse_diff(v::AbstractVector{T}) where T<:Number
|
| 62 | + Base.require_one_based_indexing(v) |
58 | 63 | w = Array{T}(undef, length(v))
|
59 |
| - for k=1:length(v) |
| 64 | + for k in eachindex(v, w) |
60 | 65 | @inbounds w[k] = -k*v[k]
|
61 | 66 | end
|
62 | 67 |
|
|
66 | 71 | # diff from Laurent -> Laurent
|
67 | 72 |
|
68 | 73 | function laurentdiff(v::AbstractVector{T}) where T<:Number
|
| 74 | + Base.require_one_based_indexing(v) |
69 | 75 | n = length(v)
|
70 | 76 | w = Array{T}(undef, n)
|
71 | 77 | w[1] = zero(T)
|
72 |
| - n=length(v) |
73 | 78 |
|
74 | 79 | for k=1:(isodd(n) ? n÷2 : n÷2-1)
|
75 | 80 | @inbounds w[2k] = -k*v[2k]
|
|
0 commit comments