A Julia package for working with bases as quasi-arrays

The Basis interface

To add your own bases, subtype Basis and overload the following routines:

  1. axes(::MyBasis) = (Inclusion(mydomain), OneTo(mylength))
  2. grid(::MyBasis, ::Integer)
  3. getindex(::MyBasis, x, ::Integer)
  4. ==(::MyBasis, ::MyBasis)

Optional overloads are:

  1. plan_transform(::MyBasis, sizes::NTuple{N,Int}, region) to plan a transform, for a tensor

product of the specified sizes, similar to plan_fft.

  1. diff(::MyBasis, dims=1) to support differentiation and Derivative.
  2. grammatrix(::MyBasis) to support Q'Q.
  3. ContinuumArrays._sum(::MyBasis, dims) and ContinuumArrays._cumsum(::MyBasis, dims) to support definite and indefinite integeration.




represents the differentiation (or finite-differences) operator on the specified axis.

transform(A, f)

finds the coefficients of a function f expanded in a basis defined as the columns of a quasi matrix A. It is equivalent to

A \ f.(axes(A,1))
expand(A, f)

expands a function f im a basis defined as the columns of a quasi matrix A. It is equivalent to

A / A \ f.(axes(A,1))

finds a natural basis for a quasi-vector and expands in that basis.

grid(P, n...)

Creates a grid of points. if n is unspecified it will be sufficient number of points to determine size(P,2) coefficients. If n is an integer or Block its enough points to determine n coefficients. If n is a tuple then it returns a tuple of grids corresponding to a tensor-product. That is, a 5⨱6 2D transform would be

(x,y) = grid(P, (5,6))
plan_transform(P, (5,6)) * f.(x, y')

and a 5×6×7 3D transform would be

(x,y,z) = grid(P, (5,6,7))
plan_transform(P, (5,6,7)) * f.(x, y', reshape(z,1,1,:))

Interal Routines

TransformFactorization(grid, plan)

associates a planned transform with a grid. That is, if F is a TransformFactorization, then F \ f is equivalent to F.plan * f[F.grid].

MulPlan(matrix, dims)

Takes a matrix and supports it applied to different dimensions.


is an analogue of Basis that takes the union of the first axis, and the second axis is a blocked concatenatation of args. If there is overlap, it uses the first in order.

MappedFactorization(F, map)

remaps a factorization to a different domain. That is, if M is a MappedFactorization then M \ f is equivalent to F \ f[map]

InvPlan(factorization, dims)

Takes a factorization and supports it applied to different dimensions.

ProjectionFactorization(F, inds)

projects a factorization to a subset of coefficients. That is, if P is a ProjectionFactorization then P \ f is equivalent to (F \ f)[inds]