Skip to content

Commit 768625d

Browse files
authored
Use mutable copies in transform/itransform (#625)
* Use mutable copies in transform/itransform * Bump version to v0.9.22
1 parent 8cba884 commit 768625d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunBase"
22
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
3-
version = "0.9.21"
3+
version = "0.9.22"
44

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

src/Space.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@ plan_itransform!(sp::Space,v) = ICanonicalTransformPlan(sp, v, Val(true))
500500
# transform converts from values at points(S,n) to coefficients
501501
# itransform converts from coefficients to values at points(S,n)
502502

503+
# convert to strided arrays, as currently the inverse performs inplace scaling
504+
# ideally, this should not be needed if FastTransforms avoids modifying cfs
505+
_toStridedArray(cfs::StridedArray) = cfs
506+
_toStridedArray(cfs::AbstractArray) = convert(Array, cfs)
507+
503508
"""
504509
transform(s::Space, vals)
505510
@@ -529,7 +534,7 @@ julia> transform(Chebyshev(), v)
529534
0.0
530535
```
531536
"""
532-
transform(S::Space, vals) = plan_transform(S,vals)*vals
537+
transform(S::Space, vals) = plan_transform(S,vals)*_toStridedArray(vals)
533538

534539
"""
535540
itransform(s::Space,coefficients::AbstractVector)
@@ -551,7 +556,7 @@ julia> itransform(Chebyshev(), [0.5, 0, 0.5])
551556
0.75
552557
```
553558
"""
554-
itransform(S::Space, cfs) = plan_itransform(S,cfs)*cfs
559+
itransform(S::Space, cfs) = plan_itransform(S,cfs)*_toStridedArray(cfs)
555560

556561
itransform!(S::Space,cfs) = plan_itransform!(S,cfs)*cfs
557562
transform!(S::Space,cfs) = plan_transform!(S,cfs)*cfs

0 commit comments

Comments
 (0)