Lattices

We work on regular square lattices.

Currently we focus on the 1+1 model.

class supervillain.lattice.Lattice2D(n)[source]

A two-dimensional square lattice is a collection of sites, links, and plaquettes arranged in the obvious cartesian grid. We specialize to lattices with an equal number of sites in both directions.

We impose periodic boundary conditions to ensure translational invariance.

It is helpful to establish some conventions about coordinates.

As shown in the picture below, sites live on integer coordinates, links connect two integer coordinates, and plaquettes are centered on half-integer coordinates. 0-forms are defined on sites, 1-forms on links, and 2-forms on plaquettes. You can get a correctly-sized array to hold a p-form using form().

(Source code, png, hires.png, pdf)

../_images/layout.png

Links that emanate from sites at the edge of the lattice connect to those on the opposite edge. Similarly, plaquettes are always bounded by 4 links, even if some of those links are on the opposite edge. This ensures periodic boundary conditions.

It is much easier to index into arrays using integers. A site can be specified by 2 integers, the coordinates. A link requires 3 integers, first the direction (0 or 1) and then the coordinates of the site from which the link emanates. A plaquette requires 2 integers, the coordinates of the plaquette both rounded down. In the figure above, a 0-, 1-, and 2-form are 0 everywhere except for those elements whose integer spatial coordinates are (0, 0), which are 1.

L = supervillain.Lattice2D(args.N)

site = L.form(0)      # automatically 0 everywhere on creation.
site[0,0] = 1

link = L.form(1)      # automatically 0 everywhere on creation.
link[:, 0, 0] = 1

plaquette = L.form(2) # automatically 0 everywhere on creation.
plaquette[0, 0] = 1
Parameters

n (int) – The number of sites on a side.

dims

The dimension sizes in order.

>>> lattice = Lattice2D(5)
>>> lattice.dims
(5, 5)
sites

The total number of sites.

>>> lattice = Lattice2D(5)
>>> lattice.sites
25
t

The coordinates in the t direction.

>>> lattice = Lattice2D(5)
>>> lattice.t
array([ 0,  1,  2, -2, -1])
x

The coordinates in the x direction.

>>> lattice = Lattice2D(5)
>>> lattice.x
array([ 0,  1,  2, -2, -1])
T

An array of size dims with the t coordinate as a value.

>>> lattice = Lattice(5)
>>> lattice.T
array([[ 0,  0,  0,  0,  0],
       [ 1,  1,  1,  1,  1],
       [ 2,  2,  2,  2,  2],
       [-2, -2, -2, -2, -2],
       [-1, -1, -1, -1, -1]])
X

An array of size dims with the y coordinate as a value.

>>> lattice = Lattice(5)
>>> lattice.X
array([[ 0,  1,  2, -2, -1],
       [ 0,  1,  2, -2, -1],
       [ 0,  1,  2, -2, -1],
       [ 0,  1,  2, -2, -1],
       [ 0,  1,  2, -2, -1]])
R_squared

An array of size dims which gives the square of the distance from the origin for each site.

>>> lattice = Lattice(5)
>>> lattice.R_squared
array([[ 0,  1,  4,  4,  1],
       [ 1,  2,  5,  5,  2],
       [ 4,  5,  8,  8,  5],
       [ 4,  5,  8,  8,  5],
       [ 1,  2,  5,  5,  2]])
coordinates

An array of size [sites, len(dims)]. Each row contains a pair of coordinates. The order matches {T,X}.flatten().

>>> lattice = Lattice(5)
>>> lattice.coordinates
>>> lattice.coordinates
array([[ 0,  0],
       [ 0,  1],
       [ 0,  2],
       [ 0, -2],
       [ 0, -1],
       [ 1,  0],
       [ 1,  1],
       [ 1,  2],
       [ 1, -2],
       [ 1, -1],
       [ 2,  0],
       [ 2,  1],
       [ 2,  2],
       [ 2, -2],
       [ 2, -1],
       [-2,  0],
       [-2,  1],
       [-2,  2],
       [-2, -2],
       [-2, -1],
       [-1,  0],
       [-1,  1],
       [-1,  2],
       [-1, -2],
       [-1, -1]])
mod(x)[source]

Mod integer coordinates into values on the lattice.

Parameters

x (np.ndarray) – Either one coordinate pair of .shape==(2,) or a set of pairs .shape==(*,2) The last dimension should be of size 2.

Returns

Each x is identified with an entry of coordinates by periodic boundary conditions. The output is the same shape as the input.

Return type

np.ndarray

distance_squared(a, b)[source]
\[\texttt{distance_squared}(a,b) = \left| \texttt{mod}(a - b)\right|^2\]
Parameters
  • a (np.ndarray) – coordinates that need not be on the lattice

  • b (np.ndarray) – coordinates that need not be on the lattice

Returns

The distance between a and b on the lattice accounting for the fact that, because of periodic boundary conditions, the distance may shorter than naively expected. Either a and b both hold the same number of coordinate pairs, or one is a singleton.

Return type

np.ndarray

roll(data, shift, axes=(-2, -1))[source]
coordinatize(v, dims=(-1,), center_origin=False)[source]

Unflattens all the dims from a linear superindex to one index for each dimension in .dims.

Parameters
  • v (np.ndarray) – An array with at least one dimension linearized in space.

  • dims (tuple of integers) – The directions you wish to unflatten into a meaningful shape that matches the lattice.

  • center_origin (boolean) – If true, each coordinatized dimension is rolled so that the origin is in the center of the two slices. This is primarily good for making pictures. linearize() does not provide an inverse of this, because you really should not do it in the middle of a calculation!

Returns

v but with more, shorter dimensions. Dimensions specified by dims are unflattened.

Return type

np.ndarray

linearize(v, dims=(-1,))[source]

Flattens adjacent dimensions of v with shape .dims into a dimension of size .sites.

Parameters
  • v (np.ndarray)

  • dims (tuples of integers that specify that dimensions *in the result that come from flattening.*) – Modded by the dimension of the resulting array so that any dimension is legal. However, one should take care to ensure that no two are the SAME index of the result; this causes a RuntimeError.

Returns

v but with fewer, larger dimensions

Return type

np.ndarray

Note

The dims parameter may be a bit confusing. This perhaps-peculiar convention is to make it easier to combine with coordinatize. linearize and coordinatize are inverses when they get the same dims arguments.

>>> import numpy as np
>>> import supervillain
>>> nx = 5
>>> dims = (0, -1)
>>> lattice = supervillain.lattice.Lattice2D(5)
>>> v = np.arange(nx**(2*3)).reshape(nx**2, nx**2, nx**2)
>>> u = lattice.coordinatize(v, dims)
>>> u.shape
(5, 5, 25, 5, 5)
>>> w = lattice.linearize(u, dims) # dims indexes into the dimensions of w, not u!
>>> w.shape
(25, 25, 25)
>>> (v == w).all()
True
form(p, count=None, dtype=<class 'float'>)[source]
Parameters
  • p (integer) – A 2D lattice supports {0, 1, 2}-forms.

  • count – How many forms to return.

  • dtype – Data type (float, int, etc.)

Returns

If count is none, return an array full of zeros that can hold a p-form. If count is not none, return an array that can hold that many p-forms, batch dimension first.

For example, if we needed to hold 7 forms of each kind for a 3×3 lattice,

>>> L = Lattice2D(3)
>>> L.form(0, 7).shape
(7, 3, 3)
>>> L.form(1, 7).shape
(7, 2, 3, 3)
>>> L.form(2, 7).shape
(7, 3, 3)

Notice that the 1-form has an extra dimension compared to the 0 form (because there are 2 links per site in 2 dimensions) and the 2-form has the same shape as sites (which is special to 2D). The spacetime dependence is last because coordinatize() and linearize() default to the last dimension.

Return type

np.ndarray

Note

These are normal arrays indexed by integers, even though, for example, plaquettes live on half-integers. To see a visual clarification see the very first figure above.

d(p, form)[source]

The (lattice) exterior derivative.

The derivative operates differently depending on the degree of the form p.

As an operator the derivative is translationally invariant, so we focus on simple examples which may then be scaled and composed by superposition.

First we consider a 0-form that vanishes everywhere (white vertices) except the origin, where it is unity (black). Its exterior derivative is a 1-form which vanishes on links that do not touch the origin (gray), is –1 (blue) when the origin is at the tail of the links, and is +1 (red) when the origin is at the head of the links.

(Source code, png, hires.png, pdf)

../_images/d0.png

Next we consider the exterior derivative’s action on 1-forms. We start with a 1-form which vanishes everywhere (white links) but for the horizontal link starting from (-1, -1) and the vertical link starting from (+1, +1), where it is unity (black). Its exterior derivative is a 2-form which vanishes on (gray) plaquettes that do not touch those links, or is –1 (blue) or +1 (red) on plaquettes whose boundary contains those links.

(Source code, png, hires.png, pdf)

../_images/d1.png

For a two-dimensional lattice the exterior derivative of a 2-form is 0.

Parameters
  • p (int) – The rank of the form.

  • form (np.ndarray) – The data the form.

Returns

d(0-form) = 1-form, d(1-form) = 2-form, d(2-form) = 0.

Return type

np.ndarray

delta(p, form)[source]

The (lattice) interior derivative / divergence of the p-form.

The divergence operates differently depending on the degree of the form.

As an operator the divergence is translationally invariant, so we focus on simple examples which may then be scaled and composed by superposition.

The divergence of a 0-form is 0.

First we consider a 1-form that vanishes everywhere (white links) except where it is unity (black links). Its divergence is a 0-form which vanishes on (gray) sites that do not touch the nonzero links, is –1 (blue) at the tail of the link and is +1 (red) at the head of the link.

(Source code, png, hires.png, pdf)

../_images/delta1.png

Next we consider a 2-form that vanishes on every (white) plaquettes except where it is unity (black plaquette, whose lower-left corner is the origin). Its divergence is a 1-form which vanishes on links that do not touch that plaquette (gray), or is –1 (blue) or +1 (red) on links on that plaquette’s boundary.

(Source code, png, hires.png, pdf)

../_images/delta2.png
Parameters
  • p (int) – The rank of the form.

  • form (np.ndarray) – The data the form.

Returns

δ(2-form) = 1-form, δ(1-form) = 0-form, δ(0-form) = 0.

Return type

np.ndarray

δ(p, form)

Alias for delta.

property checkerboarding

On a square lattice of even size both the sites and plaquettes can bipartitioned so that no simplex of one color has a neighbor of the same color. In the left panel of the figure below, that’s shown as grey and green plaquettes, and no plaquette shares an edge with a plaquette of the same color.

(Source code, png, hires.png, pdf)

../_images/checkerboarding.png

On an odd-sized lattice the periodic boundary conditions makes it impossible to accomplish this partitioning with only 2 colors. But, as shown in the right panel of the figure, a similar construction where no plaquette has a neighbor of the same color is possible with 4 colors.

The checkerboarding is a tuple of index arrays which correspond to the coloring. For each color you get 2 arrays which give the t- and x- indices, respectively. But, because numpy arrays have fancy indexing, you can use each pair very straightforwardly, as in the above example

    L = supervillain.lattice.Lattice2D(N)
    x = L.form(2)
    for i, color in enumerate(L.checkerboarding):
        x[color] = i

Warning

No promise is made about the future behavior of the partitioning. For example, it might be wiser for performance to split the 4 colors less evenly. All that is promised is that within each color no site (or plaquette) will have a neighbor of the same color.

t_fft(form, axis=-2)[source]

Fourier transforms the form in the time direction,

\[F_\nu = \frac{1}{\sqrt{N}} \sum_{t=0}^{N-1} e^{-2\pi i \nu t / N} f_t\]

where \(\nu\) is the integer frequency, \(t\) the integer time coordinate and \(N\) is the temporal extent of the lattice.

Parameters
  • form (np.array) – The data to transform

  • axis (int) – The axis which is the time direction.

Returns

The form is transformed to the frequency domain along the axis.

Return type

np.array

t_ifft(form, axis=-2)[source]

Inverse transforms the form in the time direction,

\[f_t = \frac{1}{\sqrt{N}} \sum_{\nu=0}^{N-1} e^{+2\pi i \nu t / N} F_\nu\]

where \(\nu\) is the integer frequency, \(t\) the integer time coordinate and \(N\) is the temporal extent of the lattice.

Parameters
  • form (np.array) – The data to transform

  • axis (int) – The axis which is the frequency direction.

Returns

The form is transformed to the time domain along the axis.

Return type

np.array

t_convolution(f, g, axis=-2)[source]

The convolution is given by

\[\texttt{t_convolution(f, g)}(t) = (f * g)(t) = \sum_\tau f(\tau) g(t-\tau)\]
The convolution is Fourier accelerated.
\[\begin{split}\begin{align} (f * g)(t) &= \sum_\tau f(\tau ) g(t-\tau ) \\ &= \sum_{\tau } \left( \frac{1}{\sqrt{N}} \sum_\nu e^{2\pi i \nu \tau / N} F_\nu \right)\left( \frac{1}{\sqrt{N}} \sum_{\nu'} e^{2\pi i \nu' (t-\tau ) / N} G_{\nu'} \right) \\ &= \sum_{\nu\nu'} e^{2\pi i \nu' t / N} F_\nu G_{\nu'} \left(\frac{1}{N} \sum_{\tau} e^{2\pi i (\nu-\nu') \tau / N} \right) \\ &= \sum_{\nu} e^{2\pi i \nu t / N} F_\nu G_\nu \\ \texttt{t_convolution(f, g)} &= \sqrt{N} \times \texttt{t_ifft(t_fft(f)t_fft(g))} \end{align}\end{split}\]
Parameters
  • f (np.array) – A form whose axis is a temporal direction.

  • g (np.array) – A form whose axis is a temporal direction.

  • axis (int) – The common spatial dimension along which to convolve.

Returns

The convolution of f and g along the axis.

Return type

np.array

t_correlation(f, g, axis=-1)[source]

The temporal cross-correlation is given by

\[\texttt{t_correlation(f, g)}(t) = (f ⋆ g)(t) = \frac{1}{N} \sum_\tau f(\tau)^* g(\tau-t)\]

where \(f^*\) is the complex conjugate of \(f\).

The temporal cross-correlation is Fourier accelerated.
\[\begin{split}\begin{align} (f ⋆ g)(t) &= \frac{1}{N} \sum_\tau f(\tau )^* g(\tau -t) \\ &= \frac{1}{N} \sum_{\tau } \left( \frac{1}{\sqrt{N}} \sum_\nu e^{2\pi i \nu \tau / N} F_\nu \right)^* \left( \frac{1}{\sqrt{N}} \sum_{\nu'} e^{2\pi i \nu' (\tau -t) / N} G_{\nu'} \right) \\ &= \frac{1}{N} \sum_{\nu\nu'} e^{-2\pi i \nu' t / N} F_\nu^* G_{\nu'} \; \left(\frac{1}{N}\sum_\tau e^{2\pi i (\nu'-\nu) \tau / N} = \delta_{\nu'\nu} \right) \\ &= \frac{1}{N} \sum_{\nu} e^{-2\pi i \nu t / N} F_\nu^* G_\nu \\ &= \frac{1}{\sqrt{N}} \left( \frac{1}{\sqrt{N}} \sum_{\nu} e^{-2\pi i \nu t / N} F_\nu^* G_\nu \right) \\ \texttt{t_correlation(f, g)} &= \texttt{t_fft(conj(t_fft(f))t_fft(g))} / \sqrt{N} \end{align}\end{split}\]

Warning

We have \(g(\tau-t)\) whereas Wikipedia has \(g(\tau+t)\). The difference is just the sign on the relative coordinates.

Warning

We normalize by the number of time slices, Wikipedia does not.

Parameters
  • f (np.array) – A form whose axis is a temporal direction.

  • g (np.array) – A form whose axis is a temporl direction.

  • axis (int) – The common temporal dimension along which to correlate.

Returns

The correlation of f and g along the axis, which is now the relative coordinate.

Return type

np.array

x_fft(form, axis=-1)[source]

Fourier transforms the form in the space direction,

\[F_k = \frac{1}{\sqrt{N}} \sum_{x=0}^{N-1} e^{-2\pi i k x / N} f_x\]

where \(k\) is the integer wavenumber, \(x\) the integer space coordinate and \(N\) is the spatial volume of the lattice.

Parameters
  • form (np.array) – The data to transform

  • axis (int) – The axis which is the space direction.

Returns

The form is transformed to the wavenumber domain along the axis.

Return type

np.array

x_ifft(form, axis=-1)[source]

Inverse transforms the form in the space direction,

\[f_x = \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} e^{+2\pi i k x / N} F_k\]

where \(k\) is the integer wavenumber, \(x\) the integer space coordinate and \(N\) is the spatial volume of the lattice.

Parameters
  • form (np.array) – The data to transform

  • axis (int) – The axis which is the wavenumber direction.

Returns

The form is transformed to the space domain along the axis.

Return type

np.array

x_convolution(f, g, axis=-1)[source]

The convolution

\[(f * g)(x) = \int dy\; f(y) g(x-y)\]

on the discretized lattice is given by

\[\texttt{x_convolution(f, g)}(x) = (f * g)(x) = \sum_y f(y) g(x-y)\]
The convolution is Fourier accelerated.
\[\begin{split}\begin{align} (f * g)(x) &= \sum_y f(y) g(x-y) \\ &= \sum_{y} \left( \frac{1}{\sqrt{N}} \sum_k e^{2\pi i k y / N} F_k \right)\left( \frac{1}{\sqrt{N}} \sum_q e^{2\pi i q (x-y) / N} G_q \right) \\ &= \sum_{kq} e^{2\pi i q x / N} F_k G_q \left(\frac{1}{N} \sum_y e^{2\pi i (k-q) y / N} = \delta_{kq} \right) \\ &= \sum_{k} e^{2\pi i k x / N} F_k G_k \\ \texttt{x_convolution(f, g)} &= \sqrt{N} \times \texttt{x_ifft(x_fft(f)x_fft(g))} \end{align}\end{split}\]
Parameters
  • f (np.array) – A form whose axis is a spatial direction.

  • g (np.array) – A form whose axis is a spatial direction.

  • axis (int) – The common spatial dimension along which to convolve.

Returns

The convolution of f and g along the axis.

Return type

np.array

x_correlation(f, g, axis=-1)[source]

The spatial cross-correlation is given by

\[\texttt{x_correlation(f, g)}(x) = (f ⋆ g)(x) = \frac{1}{N} \sum_y f(y)^* g(y-x)\]

where \(f^*\) is the complex conjugate of \(f\).

The spatial cross-correlation is Fourier accelerated.
\[\begin{split}\begin{align} (f ⋆ g)(x) &= \frac{1}{N} \sum_y f(y)^* g(y-x) \\ &= \frac{1}{N} \sum_{y} \left( \frac{1}{\sqrt{N}} \sum_k e^{2\pi i k y / N} F_k \right)^* \left( \frac{1}{\sqrt{N}} \sum_q e^{2\pi i q (y-x) / N} G_q \right) \\ &= \frac{1}{N} \sum_{kq} e^{-2\pi i q x / N} F_k^* G_q \; \left(\frac{1}{N}\sum_y e^{2\pi i (q-k) y / N} = \delta_{qk} \right) \\ &= \frac{1}{N} \sum_{k} e^{-2\pi i k x / N} F_k^* G_k \\ &= \frac{1}{\sqrt{N}} \left( \frac{1}{\sqrt{N}} \sum_{k} e^{-2\pi i k x / N} F_k^* G_k \right) \\ \texttt{x_correlation(f, g)} &= \texttt{x_fft(conj(x_fft(f))x_fft(g))} / \sqrt{N} \end{align}\end{split}\]

Warning

We have \(g(y-x)\) whereas Wikipedia has \(g(y+x)\). The difference is just the sign on the relative coordinates.

Warning

We normalize by the spatial volume, Wikipedia does not.

Parameters
  • f (np.array) – A form whose axis is a spatial direction.

  • g (np.array) – A form whose axis is a spatial direction.

  • axis (int) – The common spatial dimension along which to correlate.

Returns

The correlation of f and g along the axis, which is now the relative coordinate.

Return type

np.array

fft(form, axes=(-2, -1))[source]

Fourier transforms the form in the space and time directions,

\[F_{\nu,k} = \frac{1}{N} \sum_{x,t=0}^{N-1} e^{-2\pi i (\nu t +k x) / N} f_{t,x}\]

where \(\nu, k\) are the integer frequency and wavenumber, \(t, x\) are the integer time adn space coordinates and \(N\) is the linear extent of the lattice.

Parameters
  • form (np.array) – The data to transform

  • axes ((int, int)) – The axes which are the (time, space) directions.

Returns

The form is transformed to the (frequency, wavenumber) domain along the axis.

Return type

np.array

ifft(form, axes=(-2, -1))[source]

Inverse Fourier transforms the form in the space and time directions,

\[f_{t,x} = \frac{1}{N} \sum_{\nu,k=0}^{N-1} e^{-2\pi i (\nu t +k x) / N} F_{\nu,k}\]

where \(\nu, k\) are the integer frequency and wavenumber, \(t, x\) are the integer time adn space coordinates and \(N\) is the linear extent of the lattice.

Parameters
  • form (np.array) – The data to transform

  • axes ((int, int)) – The axes which are the (frequency, wavenumber) directions.

Returns

The form is transformed to the (time, space) domain along the axis.

Return type

np.array

convolution(f, g, axes=(-2, -1))[source]

The convolution is given by

\[\texttt{convolution(f, g)}(t, x) = (f * g)(t, x) = \sum_{\tau y} f(\tau,y) g(t-\tau, x-y)\]

where \(f^*\) is the complex-conjugate of \(f\).

The convolution is Fourier accelerated.
\[\begin{split}\begin{align} (f * g)(t,x) &= \sum_{\tau y} f(\tau,y) g(t-\tau, x-y) \\ &= \sum_{\tau y} \left(\frac{1}{N} \sum_{\nu,k} e^{-2\pi i (\nu \tau +k y) / N} F_{\nu,k}\right) \left(\frac{1}{N} \sum_{\nu',q} e^{-2\pi i (\nu' (t-\tau) +q (x-y)) / N} G_{\nu',q}\right) \\ &= \sum_{\nu, k, \nu', q} e^{-2\pi i (\nu' t + q x) / N} F_{\nu,k}G_{\nu',q} \left(\frac{1}{N^2}\sum_{\tau y}e^{-2\pi i [\tau(\nu-\nu') + y(k-q)] / N} = \delta_{kq} \delta_{\nu\nu'}\right) \\ &= N \times \frac{1}{N} \sum_{\nu, k} e^{-2\pi i (\nu t + k x) / N} F_{\nu,k}G_{\nu,k} \\ \texttt{convolution(f, g)} &= N \times \texttt{ifft(fft(f)fft(g))} \end{align}\end{split}\]
Parameters
  • f (np.array) – A form whose axes are temporal and spatial directions.

  • g (np.array) – A form whose axes are temporal and spatial directions.

  • axes ((int, int)) – The common temporal and spatial dimensions along which to convolve.

Returns

The convolution of f and g along the axes, which represent the (time, space) separation.

Return type

np.array

correlation(f, g, axes=(-2, -1))[source]

The cross-correlation is given by

\[\texttt{correlation(f, g)}(t, x) = (f ⋆ g)(t, x) = \frac{1}{N^2} \sum_{\tau y} f(\tau,y)^* g(\tau-t, y-x)\]

where \(f^*\) is the complex-conjugate of \(f\).

The cross-correlation is Fourier accelerated.
\[\begin{split}\begin{align} (f ⋆ g)(t,x) &= \frac{1}{N^2} \sum_{\tau y} f(\tau,y)^* g(\tau-t, y-x) \\ &= \frac{1}{N^2} \sum_{\tau y} \left(\frac{1}{N} \sum_{\nu,k} e^{-2\pi i (\nu \tau +k y) / N} F_{\nu,k}\right)^* \left(\frac{1}{N} \sum_{\nu',q} e^{-2\pi i (\nu' (\tau-t) +q (y-x)) / N} G_{\nu',q}\right) \\ &= \frac{1}{N^2} \sum_{\nu, k, \nu', q} e^{+2\pi i (\nu' t + q x) / N} F_{\nu,k}^*G_{\nu',q} \left(\frac{1}{N^2}\sum_{\tau y}e^{2\pi i [\tau(\nu-\nu') + y(k-q)] / N} = \delta_{kq} \delta_{\nu\nu'}\right) \\ &= \frac{1}{N}\times \frac{1}{N} \sum_{\nu, k} e^{+2\pi i (\nu t + k x) / N} F_{\nu,k}^*G_{\nu,k} \\ \texttt{correlation(f, g)} &= \texttt{fft(conj(fft(f))fft(g))} / N \end{align}\end{split}\]

Warning

We have \(g(\tau-t, y-x)\) whereas Wikipedia has \(g(\tau+t, y+x)\). The difference is just the sign on the relative coordinates.

Warning

We normalize by the spacetime volume, Wikipedia does not.

Parameters
  • f (np.array) – A form whose axes are temporal and spatial directions.

  • g (np.array) – A form whose axes are temporal and spatial directions.

  • axes ((int, int)) – The common temporal and spatial dimensions along which to correlate.

Returns

The correlation of f and g along the axes, which represent the (time, space) separation.

Return type

np.array

plot_form(p, form, axis, label=None, zorder=None, cmap=None, cbar_kw={}, norm=<matplotlib.colors.CenteredNorm object>, pointsize=200, linkwidth=0.025, background='white', markerstyle='o')[source]

Plots the p-form on the axis.

The following figure shows a 0-form plotted on sites, a 1-form on links, and a 2-form on plaquettes. See the source for details.

(Source code, png, hires.png, pdf)

../_images/forms.png
Parameters
  • p (int) – The kind of form.

  • form (np.array) – The data constituting form.

  • axis (matplotlib.pyplot.axis) – The axis on which to plot.

Returns

A handle for the data-sensitive part of the plot.

Return type

matplotlib.image.AxesImage

Other Parameters
  • label (string) – If specified, show a colorbar with the title given by the label.

  • zorder (float) – If None defaults to zorder=-p to layer plaquettes, links, and sites well.

  • cmap (string or matplotlib.colors.Colormap) – If a string, it should name a colormap known to matplotlib.

  • cbar_kw (dict) – A dictionary of keyword arguments forwarded to the colorbar constructor.

  • norm (matplotlib.colors.Normalize) – A matplotlib color normalization.

x_even(form, axis=-1)[source]

Returns the form symmetrized along the spatial axis.

x_odd(form, axis=-1)[source]

Returns the form antisymmetrized along the spatial axis.

t_even(form, axis=-2)[source]

Returns the form symmetrized along the temporal axis.

t_odd(form, axis=-2)[source]

Returns the form antisymmetrized along the temporal axis.

property point_group_permutations

Lists of permutations of sites that correspond to the geometric transformations in point_group_operations. The starting order is the order in coordinates.

irrep(correlator, irrep='A1', conjugate=False, dims=(-1,))[source]

The point group of a 2D lattice is \(D_4\) and the structure and irreps are detailed in https://two-dimensional-gasses.readthedocs.io/en/latest/computational-narrative/D4.html, where the spatial lattice is 2D.

(Source code, png, hires.png, pdf)

../_images/D4-irreps.png

Note

Currently we only know how project scalar correlators that depend on a single spatial separation.

Parameters
  • data (np.ndarray) – Data whose axes should be symmetrized.

  • irrep (one of .point_group_irreps) – The irrep to project to.

  • conjugate (True or False) – The weights are conjugated, which only affects the E representations.

  • dims – The latter of an adjacent time/space pair of dimensions. The dimensions will be linearized and therefore must be adjacent.

Return type

A complex-valued torch.tensor of the same shape as data, but with the axis projected to the requested irrep.