geometric_kernels.spaces.spd

This module provides the SymmetricPositiveDefiniteMatrices space.

Module Contents

class geometric_kernels.spaces.spd.SymmetricPositiveDefiniteMatrices(n)[source]

Bases: geometric_kernels.spaces.base.NoncompactSymmetricSpace, geomstats.geometry.spd_matrices.SPDMatrices

The GeometricKernels space representing the manifold of symmetric positive definite matrices \(SPD(n)\) with the affine-invariant Riemannian metric.

The elements of this space are represented by positive definite matrices of size n x n. Positive definite means _strictly_ positive definite here, not positive semi-definite.

The class inherits the interface of geomstats’s SPDMatrices.

Note

A tutorial on how to use this space is available in the SPD.ipynb notebook.

Parameters:

n – Size of the matrices, the \(n\) in \(SPD(n)\).

Note

As mentioned in this note, any symmetric space is a quotient G/H. For the manifold of symmetric positive definite matrices \(SPD(n)\), the group of symmetries \(G\) is the identity component \(GL(n)_+\) of the general linear group \(GL(n)\), while the isotropy subgroup \(H\) is the special orthogonal group \(SO(n)\). See the mathematical details in Azangulov et al. [2023].

Citation

If you use this GeometricKernels space in your research, please consider citing Azangulov et al. [2023].

property dimension: int[source]

Returns n(n+1)/2 where n was passed down to __init__.

Return type:

int

property element_shape[source]
Returns:

[n, n].

property num_axes[source]

Number of axes in an array representing a point in the space.

Returns:

property rho[source]

rho vector of dimension equal to the rank of the symmetric space.

Algebraically, weighted sum of roots, depends only on the space.

This is one of the computational primitives required to (approximately) compute the RandomPhaseFeatureMapNoncompact feature map and MaternFeatureMapKernel on top of it.

inv_harish_chandra(lam)[source]

Implements \(c^{-1}(\lambda)\), where \(c\) is the Harish-Chandra’s \(c\) function.

This is one of the computational primitives required to (approximately) compute the RandomPhaseFeatureMapNoncompact feature map and MaternFeatureMapKernel on top of it.

Parameters:

lam – A batch of frequencies, vectors of dimension equal to the rank of symmetric space.

Returns:

\(c^{-1}(\lambda)\) evaluated at every \(\lambda\) in the batch lam.

power_function(lam, g, h)[source]

Implements the power function \(p^{\lambda}(g, h)\), the integrand appearing in the definition of the zonal spherical function

\[\pi^{\lambda}(g) = \int_{H} \underbrace{p^{\lambda}(g, h)}_{= e^{(i \lambda + \rho) a(h \cdot g)}} d h,\]

where \(\lambda \in i \cdot \mathbb{R}^r\), with \(r\) denoting the rank of the symmetric space and \(i\) the imaginary unit, is a sort of frequency, \(g\) is an element of the group of symmetries \(G\), \(h\) is an element of its isotropy subgroup \(H\) (\(G\) and \(H\) are defined here), \(\rho \in \mathbb{R}^r\) is as in rho(), and the function \(a\) is a certain space-dependent algebraic operation.

This is one of the computational primitives required to (approximately) compute the RandomPhaseFeatureMapNoncompact feature map and MaternFeatureMapKernel on top of it.

Parameters:
  • lam

    A batch of L vectors of dimension rank, the rank of the symmetric space, representing the “sort of frequencies”.

    Typically of shape [1, L, rank].

  • g

    A batch of N elements of the space (these can always be thought of as elements of the group of symmetries \(G\) since the symmetric space \(G/H\) can be trivially embedded into the group \(G\)).

    Typically of shape [N, 1, <axes>], where <axes> is the shape of the elements of the space.

  • h

    A batch of L elements of the isotropy subgroup \(H\).

    Typically of shape [1, L, <axes_p>], where <axes_p> is the shape of arrays representing the elements of the isotropy subgroup \(H\).

Returns:

An array of shape [N, L] with complex number entries, representing the value of the values of \(p^{\lambda_l}(g_n, h_l)\) for all \(1 \leq n \leq N\) and \(1 \leq l \leq L\).

Note

Actually, \(a\) may be a more appropriate primitive than the power function \(p^{\lambda}\): everything but \(a\) in the definition of the latter is either standard or available as other primitives. Us using \(p^{\lambda}\) as a primitive is quite arbitrary.

random(key, number)[source]

Geomstats-based non-uniform random sampling.

Always returns [N, n, n] float64 array of the key’s backend.

Parameters:
  • key – Either np.random.RandomState, tf.random.Generator, torch.Generator or jax.tensor (representing random state).

  • number – Number of samples to draw.

Returns:

An array of number uniformly random samples on the space.

random_phases(key, num)[source]

Sample uniformly random points on the isotropy subgroup \(H\) (defined here).

This is one of the computational primitives required to (approximately) compute the RandomPhaseFeatureMapNoncompact feature map and MaternFeatureMapKernel on top of it.

Parameters:
  • key – Either np.random.RandomState, tf.random.Generator, torch.Generator or jax.tensor (representing random state).

  • num – Number of samples to draw.

Returns:

An array of num uniformly random samples in the isotropy subgroup \(H\).

Warning

This does not sample random points on the space itself. Since the space itself is non-compact, uniform sampling on it is in principle impossible. However, the isotropy subgroup \(H\) is always compact and thus allows uniform sampling needed to approximate the zonal spherical functions \(\pi^{\lambda}(\cdot)\) via Monte Carlo.