AztecDiamonds
Documentation for AztecDiamonds.
For an example notebook using this package, see here.
Here's a random diamond:
using AztecDiamonds
show(stdout, MIME("text/plain"), diamond(10))
Order-10 Tiling{Matrix{AztecDiamonds.Edge}}
🬇🬋🬋🬃
🬇🬋🬋🬃🬇🬋🬋🬃
🬇🬋🬋🬃🬇🬋🬋🬃🬇🬋🬋🬃
🬇🬋🬋🬃🬦🬓🬇🬋🬋🬃🬇🬋🬋🬃🬦🬓
🬦🬓🬦🬓🬦🬓🬉🬄🬇🬋🬋🬃🬇🬋🬋🬃🬉🬄🬦🬓
🬦🬓🬉🬄🬉🬄🬉🬄🬦🬓🬇🬋🬋🬃🬦🬓🬦🬓🬦🬓🬉🬄🬦🬓
🬦🬓🬉🬄🬇🬋🬋🬃🬦🬓🬉🬄🬇🬋🬋🬃🬉🬄🬉🬄🬉🬄🬦🬓🬉🬄🬦🬓
🬦🬓🬉🬄🬦🬓🬇🬋🬋🬃🬉🬄🬦🬓🬇🬋🬋🬃🬦🬓🬇🬋🬋🬃🬉🬄🬦🬓🬉🬄🬦🬓
🬦🬓🬉🬄🬦🬓🬉🬄🬇🬋🬋🬃🬦🬓🬉🬄🬇🬋🬋🬃🬉🬄🬦🬓🬇🬋🬋🬃🬉🬄🬦🬓🬉🬄🬦🬓
🬦🬓🬉🬄🬦🬓🬉🬄🬦🬓🬇🬋🬋🬃🬉🬄🬇🬋🬋🬃🬇🬋🬋🬃🬉🬄🬦🬓🬦🬓🬦🬓🬉🬄🬦🬓🬉🬄🬦🬓
🬉🬄🬦🬓🬉🬄🬦🬓🬉🬄🬦🬓🬦🬓🬦🬓🬇🬋🬋🬃🬦🬓🬦🬓🬦🬓🬉🬄🬉🬄🬉🬄🬦🬓🬉🬄🬦🬓🬉🬄
🬉🬄🬦🬓🬉🬄🬦🬓🬉🬄🬉🬄🬉🬄🬦🬓🬦🬓🬉🬄🬉🬄🬉🬄🬦🬓🬦🬓🬦🬓🬉🬄🬦🬓🬉🬄
🬉🬄🬦🬓🬉🬄🬦🬓🬇🬋🬋🬃🬉🬄🬉🬄🬦🬓🬦🬓🬦🬓🬉🬄🬉🬄🬉🬄🬦🬓🬉🬄
🬉🬄🬦🬓🬉🬄🬇🬋🬋🬃🬇🬋🬋🬃🬉🬄🬉🬄🬉🬄🬦🬓🬇🬋🬋🬃🬉🬄
🬉🬄🬦🬓🬦🬓🬇🬋🬋🬃🬦🬓🬦🬓🬇🬋🬋🬃🬉🬄🬇🬋🬋🬃
🬉🬄🬉🬄🬇🬋🬋🬃🬉🬄🬉🬄🬇🬋🬋🬃🬇🬋🬋🬃
🬇🬋🬋🬃🬇🬋🬋🬃🬇🬋🬋🬃🬇🬋🬋🬃
🬇🬋🬋🬃🬇🬋🬋🬃🬇🬋🬋🬃
🬇🬋🬋🬃🬇🬋🬋🬃
🬇🬋🬋🬃
AztecDiamonds.Tiling
— TypeTiling(N::Int[, x::OffsetMatrix{AztecDiamonds.Edge}]; sizehint::Int = N)
Represents an order N diamond-shaped tiling. If x
is not provided, it is initialized with NONE
representing an empty tiling. The sizehint
keyword argument may be used to preallocate a larger matrix for x
fitting a tiling of order sizehint
to avoid reallocations when the tiling grows.
The indices of x
represent the coordinates of the diamond-shaped tiling and run from 1-N to N (though x
is allowed to be larger as long as it contains these indices). The edges it contains can either be UP
, RIGHT
, or NONE
, where UP
represents a vertical tile covering one more tile to the top, RIGHT
represents a horizontal tile covering one more tile to the right. NONE
means the edge is either already covered by another tile to the bottom or left or the tiling is not fully filled yet.
julia> t = Tiling(1)
Order-1 Tiling{Matrix{AztecDiamonds.Edge}}
julia> t[0, 0] = t[1, 0] = AztecDiamonds.RIGHT;
julia> t
Order-1 Tiling{Matrix{AztecDiamonds.Edge}}
🬇🬋🬋🬃
🬇🬋🬋🬃
See diamond
and ka_diamond
for constructing a filled tiling.
AztecDiamonds.diamond
— Methoddiamond(N::Int) -> Tiling{Matrix{AztecDiamonds.Edge}}
Generates a uniformally random order N diamond tiling.
julia> using Random; Random.seed!(1);
julia> diamond(4)
Order-4 Tiling{Matrix{AztecDiamonds.Edge}}
🬇🬋🬋🬃
🬇🬋🬋🬃🬇🬋🬋🬃
🬦🬓🬦🬓🬦🬓🬦🬓🬇🬋🬋🬃
🬦🬓🬉🬄🬉🬄🬉🬄🬉🬄🬇🬋🬋🬃🬦🬓
🬉🬄🬦🬓🬦🬓🬇🬋🬋🬃🬦🬓🬦🬓🬉🬄
🬉🬄🬉🬄🬇🬋🬋🬃🬉🬄🬉🬄
🬇🬋🬋🬃🬇🬋🬋🬃
🬇🬋🬋🬃
See ka_diamond
for a version that can take advantage of GPU acceleration. ka_diamond(N, Array)
may also be faster for large N.
Ref Tiling
AztecDiamonds.ka_diamond
— Methodka_diamond(N::Int, ArrayT::Type{<:AbstractArray}) -> Tiling{ArrayT{Edge}}
Generate a uniformly random diamond tiling just like diamond
, but using KernelAbstractions.jl
to be able to take advantage of (GPU) parallelism. ArrayT
can either be Array
or any GPU array type.
Ref Tiling