Skip to content

Commit ef00b65

Browse files
authored
convert to Array since copy leaves immutable (#151)
* convert to Array since copy leaves immutable * Update ci.yml
1 parent bc83208 commit ef00b65

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

.github/workflows/ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ jobs:
1010
matrix:
1111
version:
1212
- '1.3'
13-
- '1.5'
13+
- '1'
14+
- '^1.7.0-0'
1415
os:
1516
- ubuntu-latest
1617
- macOS-latest

Project.toml

+1-1
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.12.5"
3+
version = "0.12.6"
44

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

src/chebyshevtransform.jl

+8-8
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function *(P::ChebyshevTransformPlan{T,2,true}, x::AbstractVector{T}) where T
7373
end
7474

7575
*(P::ChebyshevTransformPlan{T,k,false}, x::AbstractVector{T}) where {T,k} =
76-
ChebyshevTransformPlan{T,k,true}(P)*copy(x)
76+
ChebyshevTransformPlan{T,k,true}(P)*Array(x)
7777

7878
chebyshevtransform!(x::AbstractVector{T}, kind=Val(1)) where T =
7979
plan_chebyshevtransform!(x, kind)*x
@@ -85,7 +85,7 @@ chebyshevtransform!(x::AbstractVector{T}, kind=Val(1)) where T =
8585
transforms from values on a Chebyshev grid of the first or second kind to Chebyshev
8686
coefficients.
8787
"""
88-
chebyshevtransform(x, kind=Val(1)) = chebyshevtransform!(copy(x), kind)
88+
chebyshevtransform(x, kind=Val(1)) = chebyshevtransform!(Array(x), kind)
8989

9090

9191
## Inverse transforms take Chebyshev coefficients and produce values at Chebyshev points of the first and second kinds
@@ -165,12 +165,12 @@ function *(P::IChebyshevTransformPlan{T,2, true}, x::AbstractVector{T}) where T<
165165
end
166166

167167
*(P::IChebyshevTransformPlan{T,k,false},x::AbstractVector{T}) where {T,k} =
168-
IChebyshevTransformPlan{T,k,true}(P)*copy(x)
168+
IChebyshevTransformPlan{T,k,true}(P)*Array(x)
169169

170170
ichebyshevtransform!(x::AbstractVector{T}, kind=Val(1)) where T =
171171
plan_ichebyshevtransform!(x, kind)*x
172172

173-
ichebyshevtransform(x, kind=Val(1)) = ichebyshevtransform!(copy(x), kind)
173+
ichebyshevtransform(x, kind=Val(1)) = ichebyshevtransform!(Array(x), kind)
174174

175175
# Matrix inputs
176176
#
@@ -296,9 +296,9 @@ chebyshevutransform!(x::AbstractVector{T}, kind=Val(1)) where {T<:fftwNumber} =
296296
transforms from values on a Chebyshev grid of the first or second kind to Chebyshev
297297
coefficients of the 2nd kind (Chebyshev U expansion).
298298
"""
299-
chebyshevutransform(x, kind=Val(1)) = chebyshevutransform!(copy(x), kind)
299+
chebyshevutransform(x, kind=Val(1)) = chebyshevutransform!(Array(x), kind)
300300

301-
*(P::ChebyshevUTransformPlan{T,k,false}, x::AbstractVector{T}) where {T,k} = ChebyshevUTransformPlan{T,k,true}(P)*copy(x)
301+
*(P::ChebyshevUTransformPlan{T,k,false}, x::AbstractVector{T}) where {T,k} = ChebyshevUTransformPlan{T,k,true}(P)*Array(x)
302302

303303
## Inverse transforms take ChebyshevU coefficients and produce values at ChebyshevU points of the first and second kinds
304304

@@ -374,10 +374,10 @@ end
374374
ichebyshevutransform!(x::AbstractVector{T}, kind=Val(1)) where {T<:fftwNumber} =
375375
plan_ichebyshevutransform!(x, kind)*x
376376

377-
ichebyshevutransform(x, kind=Val(1)) = ichebyshevutransform!(copy(x), kind)
377+
ichebyshevutransform(x, kind=Val(1)) = ichebyshevutransform!(Array(x), kind)
378378

379379
*(P::IChebyshevUTransformPlan{T,k,false},x::AbstractVector{T}) where {T,k} =
380-
IChebyshevUTransformPlan{T,k,true}(P)*copy(x)
380+
IChebyshevUTransformPlan{T,k,true}(P)*Array(x)
381381

382382

383383
## Code generation for integer inputs

test/chebyshevtests.jl

+5
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,9 @@ using FastTransforms, Test
224224
@test plan_chebyshevtransform!(x)copy(x) chebyshevtransform(x)
225225
@test plan_ichebyshevtransform!(x)copy(x) ichebyshevtransform(x)
226226
end
227+
228+
@testset "immutable vectors" begin
229+
F = plan_chebyshevtransform([1.,2,3])
230+
@test chebyshevtransform(1.0:3) == F * (1:3)
231+
end
227232
end

0 commit comments

Comments
 (0)