Skip to content

Commit b78b96c

Browse files
New timings for asymptotic methods
- Reinsch is sped up by caching divisions - many types in plans are immutable - use c₂ as a SubArray for the DST, and use c₂.parent where necessary
1 parent 9a0fff4 commit b78b96c

13 files changed

+168
-166
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ julia> using FastTransforms
1919
julia> c = rand(10001);
2020

2121
julia> @time norm(icjt(cjt(c,0.1,-0.2),0.1,-0.2)-c,Inf)
22-
0.435853 seconds (507 allocations: 5.366 MB)
22+
0.258390 seconds (431 allocations: 6.278 MB)
2323
1.4830359162942841e-12
2424

2525
julia> p1 = plan_cjt(c,0.1,-0.2);
2626

2727
julia> p2 = plan_icjt(c,0.1,-0.2);
2828

2929
julia> @time norm(p2*(p1*c)-c,Inf)
30-
0.396803 seconds (101 allocations: 473.281 KB)
30+
0.244842 seconds (17 allocations: 469.344 KB)
3131
1.4830359162942841e-12
3232

3333
```

docs/api/FastTransforms.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See also [`icjt`](#method__icjt.1) and [`jjt`](#method__jjt.1).
1313

1414

1515
*source:*
16-
[FastTransforms/src/cjt.jl:127](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/cjt.jl#L127)
16+
[FastTransforms/src/cjt.jl:121](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/cjt.jl#L121)
1717

1818
---
1919

@@ -23,7 +23,7 @@ Calculates the Gaunt coefficients in 64-bit floating-point arithmetic.
2323

2424

2525
*source:*
26-
[FastTransforms/src/gaunt.jl:24](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/gaunt.jl#L24)
26+
[FastTransforms/src/gaunt.jl:24](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/gaunt.jl#L24)
2727

2828
---
2929

@@ -43,7 +43,7 @@ This is a Julia implementation of the stable recurrence described in:
4343

4444

4545
*source:*
46-
[FastTransforms/src/gaunt.jl:14](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/gaunt.jl#L14)
46+
[FastTransforms/src/gaunt.jl:14](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/gaunt.jl#L14)
4747

4848
---
4949

@@ -56,7 +56,7 @@ See also [`cjt`](#method__cjt.1) and [`jjt`](#method__jjt.1).
5656

5757

5858
*source:*
59-
[FastTransforms/src/cjt.jl:135](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/cjt.jl#L135)
59+
[FastTransforms/src/cjt.jl:129](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/cjt.jl#L129)
6060

6161
---
6262

@@ -69,7 +69,7 @@ See also [`cjt`](#method__cjt.1) and [`icjt`](#method__icjt.1).
6969

7070

7171
*source:*
72-
[FastTransforms/src/cjt.jl:143](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/cjt.jl#L143)
72+
[FastTransforms/src/cjt.jl:137](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/cjt.jl#L137)
7373

7474
---
7575

@@ -88,7 +88,7 @@ Optionally:
8888

8989

9090
*source:*
91-
[FastTransforms/src/cjt.jl:157](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/cjt.jl#L157)
91+
[FastTransforms/src/cjt.jl:158](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/cjt.jl#L158)
9292

9393
---
9494

@@ -107,7 +107,7 @@ Optionally:
107107

108108

109109
*source:*
110-
[FastTransforms/src/cjt.jl:176](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/cjt.jl#L176)
110+
[FastTransforms/src/cjt.jl:172](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/cjt.jl#L172)
111111

112112
## Internal
113113

@@ -122,7 +122,7 @@ Modified Chebyshev moments of the first kind with respect to the Jacobi weight:
122122

123123

124124
*source:*
125-
[FastTransforms/src/specialfunctions.jl:399](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L399)
125+
[FastTransforms/src/specialfunctions.jl:399](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L399)
126126

127127
---
128128

@@ -135,7 +135,7 @@ Modified Chebyshev moments of the second kind with respect to the Jacobi weight:
135135

136136

137137
*source:*
138-
[FastTransforms/src/specialfunctions.jl:417](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L417)
138+
[FastTransforms/src/specialfunctions.jl:417](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L417)
139139

140140
---
141141

@@ -145,7 +145,7 @@ Compute weights of the Clenshaw—Curtis quadrature rule with a Jacobi weight.
145145

146146

147147
*source:*
148-
[FastTransforms/src/clenshawcurtis.jl:12](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/clenshawcurtis.jl#L12)
148+
[FastTransforms/src/clenshawcurtis.jl:12](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/clenshawcurtis.jl#L12)
149149

150150
---
151151

@@ -155,7 +155,7 @@ Compute nodes and weights of the Clenshaw—Curtis quadrature rule with a Jacobi
155155

156156

157157
*source:*
158-
[FastTransforms/src/clenshawcurtis.jl:6](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/clenshawcurtis.jl#L6)
158+
[FastTransforms/src/clenshawcurtis.jl:6](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/clenshawcurtis.jl#L6)
159159

160160
---
161161

@@ -165,7 +165,7 @@ Compute Jacobi expansion coefficients in Pₙ^(α-1,β) given Jacobi expansion c
165165

166166

167167
*source:*
168-
[FastTransforms/src/specialfunctions.jl:467](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L467)
168+
[FastTransforms/src/specialfunctions.jl:467](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L467)
169169

170170
---
171171

@@ -175,7 +175,7 @@ Compute Jacobi expansion coefficients in Pₙ^(α-1,α-1) given Jacobi expansion
175175

176176

177177
*source:*
178-
[FastTransforms/src/specialfunctions.jl:489](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L489)
178+
[FastTransforms/src/specialfunctions.jl:489](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L489)
179179

180180
---
181181

@@ -185,7 +185,7 @@ Compute Jacobi expansion coefficients in Pₙ^(α,β-1) given Jacobi expansion c
185185

186186

187187
*source:*
188-
[FastTransforms/src/specialfunctions.jl:478](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L478)
188+
[FastTransforms/src/specialfunctions.jl:478](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L478)
189189

190190
---
191191

@@ -195,7 +195,7 @@ Compute nodes and weights of Fejer's first quadrature rule with a Jacobi weight.
195195

196196

197197
*source:*
198-
[FastTransforms/src/fejer.jl:7](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/fejer.jl#L7)
198+
[FastTransforms/src/fejer.jl:7](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/fejer.jl#L7)
199199

200200
---
201201

@@ -205,7 +205,7 @@ Compute nodes and weights of Fejer's second quadrature rule with a Jacobi weight
205205

206206

207207
*source:*
208-
[FastTransforms/src/fejer.jl:12](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/fejer.jl#L12)
208+
[FastTransforms/src/fejer.jl:12](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/fejer.jl#L12)
209209

210210
---
211211

@@ -215,7 +215,7 @@ Compute weights of Fejer's first quadrature rule with a Jacobi weight.
215215

216216

217217
*source:*
218-
[FastTransforms/src/fejer.jl:21](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/fejer.jl#L21)
218+
[FastTransforms/src/fejer.jl:21](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/fejer.jl#L21)
219219

220220
---
221221

@@ -225,7 +225,7 @@ Compute weights of Fejer's second quadrature rule with a Jacobi weight.
225225

226226

227227
*source:*
228-
[FastTransforms/src/fejer.jl:26](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/fejer.jl#L26)
228+
[FastTransforms/src/fejer.jl:26](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/fejer.jl#L26)
229229

230230
---
231231

@@ -235,7 +235,7 @@ Compute a typed 0.5.
235235

236236

237237
*source:*
238-
[FastTransforms/src/specialfunctions.jl:12](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L12)
238+
[FastTransforms/src/specialfunctions.jl:12](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L12)
239239

240240
---
241241

@@ -245,7 +245,7 @@ Compute Jacobi expansion coefficients in Pₙ^(α+1,β) given Jacobi expansion c
245245

246246

247247
*source:*
248-
[FastTransforms/src/specialfunctions.jl:432](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L432)
248+
[FastTransforms/src/specialfunctions.jl:432](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L432)
249249

250250
---
251251

@@ -255,7 +255,7 @@ Compute Jacobi expansion coefficients in Pₙ^(α+1,α+1) given Jacobi expansion
255255

256256

257257
*source:*
258-
[FastTransforms/src/specialfunctions.jl:454](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L454)
258+
[FastTransforms/src/specialfunctions.jl:454](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L454)
259259

260260
---
261261

@@ -265,7 +265,7 @@ Compute Jacobi expansion coefficients in Pₙ^(α,β+1) given Jacobi expansion c
265265

266266

267267
*source:*
268-
[FastTransforms/src/specialfunctions.jl:443](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L443)
268+
[FastTransforms/src/specialfunctions.jl:443](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L443)
269269

270270
---
271271

@@ -275,7 +275,7 @@ Pochhammer symbol (x)_n = Γ(x+n)/Γ(x) for the rising factorial.
275275

276276

277277
*source:*
278-
[FastTransforms/src/specialfunctions.jl:32](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L32)
278+
[FastTransforms/src/specialfunctions.jl:32](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L32)
279279

280280
---
281281

@@ -285,7 +285,7 @@ Stirling series for Γ(z).
285285

286286

287287
*source:*
288-
[FastTransforms/src/specialfunctions.jl:63](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L63)
288+
[FastTransforms/src/specialfunctions.jl:63](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L63)
289289

290290
---
291291

@@ -295,7 +295,7 @@ Compute a typed 2.
295295

296296

297297
*source:*
298-
[FastTransforms/src/specialfunctions.jl:20](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L20)
298+
[FastTransforms/src/specialfunctions.jl:20](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L20)
299299

300300
---
301301

@@ -307,7 +307,7 @@ For 64-bit floating-point arithmetic, the Lambda function uses the asymptotic se
307307

308308

309309
*source:*
310-
[FastTransforms/src/specialfunctions.jl:147](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L147)
310+
[FastTransforms/src/specialfunctions.jl:147](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L147)
311311

312312
---
313313

@@ -317,7 +317,7 @@ The Lambda function Λ(z) = Γ(z+½)/Γ(z+1) for the ratio of gamma functions.
317317

318318

319319
*source:*
320-
[FastTransforms/src/specialfunctions.jl:141](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L141)
320+
[FastTransforms/src/specialfunctions.jl:141](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L141)
321321

322322
---
323323

@@ -327,7 +327,7 @@ The Lambda function Λ(z,λ₁,λ₂) = Γ(z+λ₁)/Γ(z+λ₂) for the ratio of
327327

328328

329329
*source:*
330-
[FastTransforms/src/specialfunctions.jl:160](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L160)
330+
[FastTransforms/src/specialfunctions.jl:160](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L160)
331331

332332
---
333333

@@ -337,7 +337,7 @@ The Kronecker δ function.
337337

338338

339339
*source:*
340-
[FastTransforms/src/specialfunctions.jl:26](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/specialfunctions.jl#L26)
340+
[FastTransforms/src/specialfunctions.jl:26](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/specialfunctions.jl#L26)
341341

342342
---
343343

@@ -351,5 +351,5 @@ where the Hankel matrix `H` is non-negative definite. This allows a Cholesky dec
351351

352352

353353
*source:*
354-
[FastTransforms/src/toeplitzhankel.jl:8](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/35eb1797c25b8a1956daf4a7227003faba0c3c25/src/toeplitzhankel.jl#L8)
354+
[FastTransforms/src/toeplitzhankel.jl:8](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/9a0fff4d389746d63718883170537e95ad849e76/src/toeplitzhankel.jl#L8)
355355

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ julia> using FastTransforms
1919
julia> c = rand(10001);
2020

2121
julia> @time norm(icjt(cjt(c,0.1,-0.2),0.1,-0.2)-c,Inf)
22-
0.435853 seconds (507 allocations: 5.366 MB)
22+
0.258390 seconds (431 allocations: 6.278 MB)
2323
1.4830359162942841e-12
2424

2525
julia> p1 = plan_cjt(c,0.1,-0.2);
2626

2727
julia> p2 = plan_icjt(c,0.1,-0.2);
2828

2929
julia> @time norm(p2*(p1*c)-c,Inf)
30-
0.396803 seconds (101 allocations: 473.281 KB)
30+
0.244842 seconds (17 allocations: 469.344 KB)
3131
1.4830359162942841e-12
3232

3333
```

0 commit comments

Comments
 (0)