Sampling points#

To numerically evaluate integrals, e.g. to compute the volume, we use a Monte Carlo approximation. We thus need to generate samples that lie on the manifold and have a known distribution. One straight-forward way of generating points on the \(d\) dimensional manifold is to sample \(d-1\) random complex numbers and solve the defining equation for the last coordinate value. However, we do not apriori know the distribution of these points. Instead, we can sample points as intersections with a line in ambient projective space. The distribution of these points is known.

Complex and projective coordinates#

Some care needs to be taken when sampling complex coordinates. If complex values are generated by sampling real and imaginary parts uniformly, points will lie on a square in the complex plane. Uniformly sampling the radius in \([0, 1]\) and the complex angle in \([0, 2\pi]\) will ensure points lie on the unit disk, however the distribution does not have uniform density. Instead, one should sample uniformly from the disk in \(\mathbb{R}^2\) and interpret the coordinates as real and imaginary parts.

In order to generate uniformly distributed samples on \(\mathbb{P}^n\), we can first sample uniform points on the real sphere \(S^{2n+1}\) represented by \(2n+2\) real numbers. By pairing these up into \(n+1\) complex values we obtain homogeneous coordinates on the projective space. This construction corresponds to \(\mathbb{P}^n \cong S^{2n+1} / U(1)\). Generating uniform points on the real sphere \(S^{2n+1}\) can be done efficiently by independently sampling \(2n+2\) real numbers from the unit-covariance normal distribution and dividing by their vector norm. Since the normal distribution factorizes as \(p(z) \propto \exp(- \sum_i z_i^2)=\prod_i \exp(-z_i^2)\), we can efficiently draw from the joint distribution by sampling each component \(z_i\) independently. The exponent \(\sum_i z_i^2\) is manifestly invariant under \(SO(2n+2)\) rotations, as desired for a uniform distribution, but the norm \(|z|\) is not yet fixed to 1. Dividing the sampled points by their norm puts them on the unit sphere while preserving the \(SO(2n+2)\) symmetry, which therefore gives us a uniform distribution on \(S^{2n+1}\).

Functions implementing the above are grouped in the cyjax.random submodule:

random.uniform_components(key, shape)

Complex values with uniform real and imaginary parts.

random.uniform_angle(key, shape[, minrad, ...])

Complex values individually uniform on complex disk.

random.uniform_angle_unit(key, shape)

Complex values with unit modulus and uniform angle.

random.real_sphere(key, shape)

Random points on real unit sphere.

random.complex_sphere(key, shape)

Sample uniform points on the unit sphere in complex space..

random.uniform_projective(key, count, dim[, ...])

Uniformly distributed points in complex projective space.

random.projective_overlap(key, count, dim, ...)

Sample points lying in overlap region of two affine patches.

Points on varieties#

To numerically estimate integrals, we make use of the Monte Carlo approximation

\[ \int_X f d\mathrm{vol} = \int_X f \frac{d\mathrm{vol}}{dA} dA \approx \frac{1}{N} \sum_{a=1}^{N} f(x_a) w(x_a) \,. \]
Here, \(x_a \sim a\) are drawn using some (pseud-) probabilistic procedure with known density measure \(dA\). The weights \(w(x_a)\) in the final step are required to correct for the difference in measure.

The sampling method we use here is described in (Douglas et al. 2008). After uniformly sampling two points \(p, q \in \mathbb{P}^{d+1}\), we can define a line \(p + t q\) with \(t\in\mathbb{C}\). Samples on the variety are then given by the intersection of this line with the variety, i.e. by solutions for \(t\) such that \(Q(p+tq)=0\). The density of samples generated in this way is known and given via the Fubini-Study metric.

VarietySingle.sample_intersect(key, params, ...)

Sample points on the variety using the intersection method.

VarietySingle.sample_intersect_weights(zs, ...)

Compute weights dVolCy / dA.

VarietySingle.compute_vol(key, params[, ...])

Compute CY (top-form) volume of manifold.