Guide
Documentation may not be accurate as this is a beta stage package undergoing changes. Get started with tutorials which are more up to date.
Scalar & vector fields
Scalar & vector fields are represented as 2d/3d arrays of canonically scalars or vectors. Array values can alternatively be any type that Supports addition & multiplication.
Customizable grid
Main.EquivariantOperators.Grid — TypeGrid(cell, rmax::AbstractFloat)
Grid(
cell::AbstractMatrix,
sz::Union{AbstractVector,Tuple};
origin = (sz .+ 1) ./ 2,
)Grid is specified by its discrete cell vectors (column-wise matrix), overall size and origin. For a uniform Cartesian 5x5 grid discretized at 0.1 with a centered origin, we get cell = [0.1 0; 0 0.1] & origin = [3, 3]. Grid cell can in general be noncartesian.
Particle mesh placement and interpolation
Base.get — MethodBase.get(field::AbstractArray, grid::Grid, rvec::AbstractVector)
Base.put!(
field::AbstractArray,
grid::Grid,
rvec::AbstractVector,
val::AbstractVector,
)With grid info we can interpolate a scalar or vector field at any location. We can also place a scalar or vector point source anywhere with automatic normalization wrt discretization. Both work via a proximity weighted average of the closest grid points (in general up to 4 in 2d and 8 in 3d).
Finite difference equivariant operators
Main.EquivariantOperators.Op — TypeOp(radfunc, rmax, cell::Matrix; kw...)constructs equivariant operator
function (m::Op)(x::AbstractArray, )Main.EquivariantOperators.Del — Function" Del(cell; pad = :same, border = :smooth)
constructs gradient operator
Main.EquivariantOperators.Laplacian — FunctionLaplacian(cell; pad = :same, border = :smooth)constructs Laplacian operator
Main.EquivariantOperators.Gaussian — FunctionGaussian(cell, σ, rmax; kw...)constructs Gaussian diffusion operator
Lower level utilities
Convolutions
Feature rich convolution and cross correlation functions with options for padding, stride, boundary conditions, and custom products (tensor field convolutions).
Main.EquivariantOperators.cvconv — Functioncvconv(x, f; product = *, stride = 1, pad = 0)"convolution" in computer vision for any dimension, same as Cross correlation. For convolution in signal processing , use dspconv instead.
x input array f filter array product product in convolution, eg *, dot pad amount of padding or padding option
- any integer number of pixels on each boundary
:same: adds enough padding so output is same size as input:outer: output size issize(x) .+ size(f) .- 1
border type of padding
0value pixels:replicaterepeats edge values:circularperiodic BC:smoothcontinuous derivatives at boundaries useful for differential operators:reflectreflects interior across boundaries which are not repeated:symmetricsame as:reflectbut with boundaries repeated
Convolutions in other Julia packages, fewer features but perhaps more optimized for speed in their specific use cases
- ImageFiltering.imfilter. Its docs has excellent mathematical explaination of convolutions and correlation as well as padding/border options
DSP.convDSP.xcorFlux.conv
Main.EquivariantOperators.dspconv — Functiondspconv(x, f; product = *,pad = :outer,border=0)Convolution in signal processing. For "convolution" in computer vision, use cvconv instead. By default output size is size(x) .+ size(f) .- 1. See cvconv for its keyword options which also apply here