Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
cff0128
add comments/docstrings
tpapp Aug 14, 2026
31a2747
rework transformations API
tpapp Aug 17, 2026
b9b29e6
start a changelog
tpapp Aug 17, 2026
a420ad9
rework chebyshev and levels
tpapp Aug 17, 2026
cf8540c
test adjustment code
tpapp Aug 17, 2026
5e90056
add back test for derivatives
tpapp Aug 17, 2026
c0955fd
minor test fixes
tpapp Aug 18, 2026
fab34de
rename grid_kind to kind, reenable what is needed
tpapp Aug 18, 2026
bf0dcf2
make Chebyshev iterator infinite
tpapp Aug 18, 2026
ec123d3
Clean up grid calculations, tighter testing.
tpapp Aug 18, 2026
357eb5d
reindex levels from 0
tpapp Aug 18, 2026
620df90
add KINDS variable to tests
tpapp Aug 19, 2026
98d254b
reimplement Smolyak traversal more flexibly
tpapp Aug 21, 2026
f4c7283
typo corrections
tpapp Aug 23, 2026
c2894fe
rework basics of Smolyak API
tpapp Aug 24, 2026
5ba39f5
make iterator allocation-free
tpapp Aug 25, 2026
6b7c0df
remove adjust_basis, rely on fields
tpapp Aug 26, 2026
86029c6
use type constructors instead of functions
tpapp Aug 26, 2026
db6f6c2
show method for UnivariateBasis, fix for SmolyakBasis
tpapp Aug 26, 2026
440b151
remove coordinate transformations (unneeded)
tpapp Aug 26, 2026
8e9feab
make boundedlinear use lower, upper; rework printing
tpapp Aug 26, 2026
363a9a0
remove support for broadcasting
tpapp Aug 26, 2026
5f3d9fd
implement index traversal
tpapp Aug 26, 2026
b65f774
BoundedLinear API, test adjust_coefficients, traversal
tpapp Aug 26, 2026
deadd78
add Enzyme integration tests
tpapp Aug 30, 2026
2d3b2d2
rework iteration to fix Enzyme inference
tpapp Aug 30, 2026
2457e5b
add ConstructionBase method for SmolyakLevel
tpapp Aug 31, 2026
0cb15ce
make file names consistent
tpapp Aug 31, 2026
4bd1062
decouple grid_level in univariate
tpapp Aug 31, 2026
a58ffd5
decouple grid_level from level in Smolyak
tpapp Sep 1, 2026
52883ae
make printing a bit nicer
tpapp Sep 1, 2026
5e3de58
add outside domain handling
tpapp Sep 2, 2026
20ede74
add getindex for smolyak
tpapp Sep 16, 2026
5820eb4
fix typo
tpapp Sep 16, 2026
54cb230
Tp/fix inf to pm1 nans (#72)
tpapp Oct 19, 2026
6b39282
batch duplication
tpapp Oct 21, 2026
de6f1bb
simplify signature
tpapp Oct 21, 2026
ec3bf00
correct typos
tpapp Nov 10, 2026
e1262ab
remove TransformedBasis
tpapp Nov 10, 2026
e9c6ae6
re-enable JET
tpapp Nov 10, 2026
b73eb2e
renable JET and Aqua
tpapp Nov 10, 2026
3fdaf7b
add constant coefficients to an API
tpapp Nov 10, 2026
5e0e9e8
expunge experimental parts
tpapp Nov 10, 2026
1ee9e76
derivatives now run, but result still incorrect
tpapp Nov 11, 2026
66623cc
re-enable tests for infinite derivatives
tpapp Nov 11, 2026
1cf1d1b
module docs from README, simplify README, plots will be in docs
tpapp Nov 12, 2026
6a56243
make tests compile cleanly
tpapp Nov 15, 2026
3106f22
minor docs fixes
tpapp Nov 15, 2026
6b6f294
remove old coordinate domains API
tpapp Nov 15, 2026
0a468dc
remove old starting page
tpapp Nov 15, 2026
3d26edd
minor fixes to make docs run
tpapp Nov 15, 2026
4378ef2
api details
tpapp Nov 15, 2026
03bb3b9
remove derivatives from public API
tpapp Nov 15, 2026
5ccded5
fix docs example
tpapp Nov 15, 2026
3fc0d4c
import derivative symbols explicitly
tpapp Nov 15, 2026
7e75213
expunge domain_kind
tpapp Nov 15, 2026
2c8d92d
fix docstrings
tpapp Nov 15, 2026
383b235
rename main page to index
tpapp Nov 15, 2026
3b8d6b4
version bump
tpapp Nov 15, 2026
562f176
no separate compat bounds for tests
tpapp Nov 15, 2026
c84bade
skip spurious method ambiguity check on Julia 1.10, 1.11
tpapp Nov 15, 2026
baf2f78
allow runtime activity in DD
tpapp Nov 16, 2026
c2fbe30
allow nothing as grid_level
tpapp Nov 16, 2026
255a3c7
prettify docs a bit
tpapp Nov 16, 2026
8f652f1
changelog
tpapp Nov 16, 2026
ff13ad0
fix docs gen
tpapp Nov 16, 2026
f07e974
mention breaking changes
tpapp Nov 16, 2026
2b10ddb
build docs on recent Julia
tpapp Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v7
- uses: julia-actions/setup-julia@latest
with:
version: '1.10'
version: '1.13'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
Expand Down
42 changes: 37 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
# Unreleased
# Changelog

# v0.4.0
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Added
### Changed
### Deprecated
### Removed
### Fixed
### Security

## v0.17.0

**Breaking API changes in the whole API, reread the docs.**

### Added

- change transformation interface, informatively named keyword arguments
- rename grid kinds
- cleaned up documentation

### Fixed

- fixed some numerical corner cases in transformations

## v0.16.2

No changelog kept between 0.4.0 and 0.16.2, sorry.

## v0.4.0

- add `linear_combination`, rename `evaluate` to `basis_function` [[#6](https://github.com/tpapp/SpectralKit.jl/pull/6)]

# v0.3.0
## v0.3.0

- API redesign: take `Order` & `OrdersTo`, return `SVector` [[#5](https://github.com/tpapp/SpectralKit.jl/pull/5)]

# v0.2.0
#3 v0.2.0

- re-enable 1.1 support, fix docs links [[#3](https://github.com/tpapp/SpectralKit.jl/pull/3)]
- add show methods and improve docs [[#2](https://github.com/tpapp/SpectralKit.jl/pull/2)]
- enable docs, add `is_function_family`, improve coverage [[#1](https://github.com/tpapp/SpectralKit.jl/pull/1)]
- Change indexing to 1-based from 0-based.

# v0.1.0
## v0.1.0

Initial release.
21 changes: 15 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
name = "SpectralKit"
uuid = "5c252ae7-b5b6-46ab-a016-b0e3d78320b7"
version = "0.16.2"
version = "0.17.0"
authors = ["Tamas K. Papp <tkpapp@gmail.com>"]

[workspace]
projects = ["test", "docs"]

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ConcreteStructs = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[weakdeps]
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"

[extensions]
SpectralKitEnzymeExt = "Enzyme"

[compat]
ArgCheck = "1, 2"
Compat = "4.18.0"
DocStringExtensions = "0.8, 0.9"
InverseFunctions = "0.1"
ChainRulesCore = "1.26.1"
ConcreteStructs = "0.2.7"
ConstructionBase = "1.6.0"
DocStringExtensions = "0.9, 0.10"
Enzyme = "0.12, 0.13"
OrderedCollections = "1, 2"
StaticArrays = "1"
julia = "1.10"
44 changes: 0 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,50 +24,6 @@ At the moment, the package API is experimental and subject to change.

Asking for help in [issues](https://github.com/tpapp/SpectralKit.jl/issues) is fine, you can also ping me as `@Tamas_Papp` on the [Discourse forum](https://discourse.julialang.org/)

## Pretty pictures

Some examples generated this library. **Circles mark values at the limit, shifted horizontally when this is needed to avoid overlap**. Infinite limits shown at finite values, so of course they don't match (this is a visual check of continuity, naturally it is unit tested).

### Chebyshev polynomials and their derivatives

<img src="docs/plots/chebyshev.png" width="50%">

<img src="docs/plots/chebyshev_deriv.png" width="50%">

### Chebyshev rational functions on [0,∞)

Up close, you can see the oscillation.

<img src="docs/plots/semiinf.png" width="50%">

Let's zoom out a bit to see convergence to 0 at ∞.

<img src="docs/plots/semiinf_birdseye.png" width="50%">

Derivatives die out faster.

<img src="docs/plots/semiinf_deriv.png" width="50%">

### Chebyshev rational functions on (-∞,∞)

Up close, you can see the oscillation.

<img src="docs/plots/inf.png" width="50%">

Let's zoom out a bit to see convergence at -∞ and ∞.

<img src="docs/plots/inf_birdseye.png" width="50%">

Derivatives die out slower than for the [0,∞) transformation.

<img src="docs/plots/inf_deriv.png" width="50%">

### A Smolyak grid

With `B = 3`.

<img src="docs/plots/smolyak_grid.png" width="50%">

## Bibliography

- Boyd, J. P. (2001). Chebyshev and fourier spectral methods. Courier Corporation.
Expand Down
4 changes: 4 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Miter = "e2c39885-2134-4813-a274-cbd32ca8996e"
SpectralKit = "5c252ae7-b5b6-46ab-a016-b0e3d78320b7"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
Expand Down
16 changes: 12 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
using Documenter, SpectralKit
DocMeta.setdocmeta!(SpectralKit, :DocTestSetup, :(using SpectralKit);
using Documenter, SpectralKit, Miter, Colors
DocMeta.setdocmeta!(SpectralKit, :DocTestSetup,
quote
using SpectralKit
using SpectralKit: 𝑑, ∂ # derivatives API currently not exposed
end,
recursive=true)

makedocs(
modules = [SpectralKit],
format = Documenter.HTML(; prettyurls = get(ENV, "CI", nothing) == "true"),
format = Documenter.HTML(; prettyurls = get(ENV, "CI", nothing) == "true",
assets = ["assets/html/custom.css"]),
authors = "Tamas K. Papp",
sitename = "SpectralKit.jl",
pages = Any["index.md", "experimental.md"],
pages = Any["index.md",
"smolyak.md",
"approximation.md",
"api.md"],
clean = true,
checkdocs = :exports,
)
Expand Down
1 change: 0 additions & 1 deletion docs/plots/README.md

This file was deleted.

Binary file removed docs/plots/chebyshev.png
Binary file not shown.
Binary file removed docs/plots/chebyshev_deriv.png
Binary file not shown.
Binary file removed docs/plots/inf.png
Binary file not shown.
Binary file removed docs/plots/inf_birdseye.png
Binary file not shown.
Binary file removed docs/plots/inf_deriv.png
Binary file not shown.
95 changes: 0 additions & 95 deletions docs/plots/plots.jl

This file was deleted.

Binary file removed docs/plots/semiinf.png
Binary file not shown.
Binary file removed docs/plots/semiinf_birdseye.png
Binary file not shown.
Binary file removed docs/plots/semiinf_deriv.png
Binary file not shown.
10 changes: 0 additions & 10 deletions docs/plots/smolyak_grid.jl

This file was deleted.

Binary file removed docs/plots/smolyak_grid.png
Binary file not shown.
53 changes: 53 additions & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# API

## Univariate bases

```@docs
UnivariateBasis
```

## Smolyak bases

```@docs
SmolyakBasis
SmolyakLevel
```

## Families and grid types

```@docs
Chebyshev
Interior
Endpoints
```

## Domain transformations

```@docs
BoundedLinear
SemiInfRational
InfRational
ErrorOutsideDomain
NearestInDomain
```

## API for all bases

```@docs
is_function_basis
dimension
domain
linear_combination
basis_at
grid
collocation_matrix
constant_coefficients
adjust_coefficients
```

## Transformations

```@docs
transform_to
transform_from
```
40 changes: 40 additions & 0 deletions docs/src/approximation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Approximation tools

The design of nested bases allows us to reuse an approximation for one basis as a starting point for another basis.

As a special case, we can always obtain an *initial approximation* for a constant in any basis:
```@example moving
using SpectralKit, Accessors
b1 = UnivariateBasis(Chebyshev(), Endpoints(), BoundedLinear(0, 1), 1)
θ1 = constant_coefficients(b1, 4.0)
```

Bases are immutable, so to change one thing about a basis it is recommended to use `@set` from [Accessors.jl](https://github.com/JuliaObjects/Accessors.jl). Then we adjust coefficients to the new basis:

```@example moving
b2 = @set b1.level = 2
adjust_coefficients(θ1, b1, b2)
```

Adjustment either pads with zeroes or truncates. It is useful as a starting point in iterative methods: for example, having solved a functional equation in a basis, one can use it as a starting point in a basis which nests the previous one.

An initial apprimation may also be obtained using a *collocation matrix*, ie the basis functions evaluated at gridpoints:

```@example sin
using SpectralKit
b_sin = UnivariateBasis(Chebyshev(), Endpoints(), BoundedLinear(0, 2*π), 2)
θ = collocation_matrix(b_sin) \ sin.(grid(b_sin))
```

(The choice of `level = 2` is deliberate, it does not give a very good approximation, but for `level = 3` the lines in the plot below would overlap.)

Note the near-zeros, `sin` is an [odd function](https://en.wikipedia.org/wiki/Even_and_odd_functions#Odd_functions). The approximation is exact at the gridpoints:

```@example sin
using Miter, Colors
let r = range(extrema(domain(b_sin))...; length = 100), f = linear_combination(b_sin, θ)
Plot(Lines((x, sin(x)) for x in r; color = colorant"blue"),
Lines((x, f(x)) for x in r; color = colorant"red"),
Scatter(MarkSymbol(:o), ((x, sin(x)) for x in grid(b_sin))))
end
```
Loading
Loading