Skip to content

A package for generating and analyzing Aztec diamonds

License

Notifications You must be signed in to change notification settings

JuliaLabs/AztecDiamonds.jl

Repository files navigation

AztecDiamonds

Stable Dev Build Status GPU Build status Coverage

A package for generating and analyzing Aztec diamonds

Getting Started

To generate an order-n Aztec diamond, simply call diamond(n)

julia> D = diamond(10)
Order-10 Tiling{Matrix{AztecDiamonds.Edge}}
                  🬇🬋🬋🬃
                🬇🬋🬋🬃🬇🬋🬋🬃
              🬇🬋🬋🬃🬇🬋🬋🬃🬇🬋🬋🬃
            🬇🬋🬋🬃🬇🬋🬋🬃🬦🬓🬦🬓🬇🬋🬋🬃
          🬇🬋🬋🬃🬇🬋🬋🬃🬦🬓🬉🬄🬉🬄🬦🬓🬇🬋🬋🬃
        🬇🬋🬋🬃🬦🬓🬇🬋🬋🬃🬉🬄🬦🬓🬦🬓🬉🬄🬦🬓🬇🬋🬋🬃
      🬦🬓🬇🬋🬋🬃🬉🬄🬦🬓🬇🬋🬋🬃🬉🬄🬉🬄🬦🬓🬉🬄🬦🬓🬇🬋🬋🬃
    🬦🬓🬉🬄🬦🬓🬇🬋🬋🬃🬉🬄🬦🬓🬦🬓🬇🬋🬋🬃🬉🬄🬦🬓🬉🬄🬦🬓🬦🬓🬦🬓
  🬦🬓🬉🬄🬦🬓🬉🬄🬦🬓🬦🬓🬦🬓🬉🬄🬉🬄🬦🬓🬦🬓🬦🬓🬉🬄🬦🬓🬉🬄🬉🬄🬉🬄🬦🬓
🬦🬓🬉🬄🬦🬓🬉🬄🬦🬓🬉🬄🬉🬄🬉🬄🬇🬋🬋🬃🬉🬄🬉🬄🬉🬄🬦🬓🬉🬄🬇🬋🬋🬃🬦🬓🬉🬄🬦🬓
🬉🬄🬦🬓🬉🬄🬦🬓🬉🬄🬦🬓🬇🬋🬋🬃🬦🬓🬇🬋🬋🬃🬇🬋🬋🬃🬉🬄🬇🬋🬋🬃🬦🬓🬉🬄🬦🬓🬉🬄
  🬉🬄🬦🬓🬉🬄🬦🬓🬉🬄🬦🬓🬦🬓🬉🬄🬦🬓🬦🬓🬦🬓🬦🬓🬇🬋🬋🬃🬦🬓🬉🬄🬦🬓🬉🬄
    🬉🬄🬦🬓🬉🬄🬦🬓🬉🬄🬉🬄🬦🬓🬉🬄🬉🬄🬉🬄🬉🬄🬇🬋🬋🬃🬉🬄🬦🬓🬉🬄
      🬉🬄🬦🬓🬉🬄🬇🬋🬋🬃🬉🬄🬇🬋🬋🬃🬇🬋🬋🬃🬦🬓🬇🬋🬋🬃🬉🬄
        🬉🬄🬦🬓🬦🬓🬦🬓🬇🬋🬋🬃🬇🬋🬋🬃🬦🬓🬉🬄🬇🬋🬋🬃
          🬉🬄🬉🬄🬉🬄🬦🬓🬦🬓🬇🬋🬋🬃🬉🬄🬇🬋🬋🬃
            🬇🬋🬋🬃🬉🬄🬉🬄🬇🬋🬋🬃🬇🬋🬋🬃
              🬇🬋🬋🬃🬇🬋🬋🬃🬇🬋🬋🬃
                🬇🬋🬋🬃🬇🬋🬋🬃
                  🬇🬋🬋🬃

It is recommended that you use an interactive enviroment like Pluto, VS Code or IJulia to be able to view larger diamond tilings in all their glory. Alternatively, you can also view them in a separate window using the ImageView package as follows:

julia> using ImageView

julia> imshow(AztecDiamonds.to_img(D))
[...]

It is possible to take advantage of GPU acceleration via KernelAbstractions.jl on supported backends, e.g. CUDA:

julia> using CUDA

julia> ka_diamond(200, CuArray)
[...]

You can extract the DR-path separating the northern arctic region from the rest of the diamond using the dr_path function.

julia> dr_path(D)
21-element OffsetArray(::Vector{Float64}, -10:10) with eltype Float64 with indices -10:10:
 -0.5
  0.5
  1.5
  2.5
  3.5
  4.5
  5.5
  4.5
  5.5
  6.5
  5.5
  5.5
  5.5
  4.5
  3.5
  3.5
  3.5
  2.5
  1.5
  0.5
 -0.5

To get the other DR-paths the tiling can be rotated first using the functions rotr90, rotl90 or rot180.