Representations

class emlp.reps.Rep[source]

The base Representation class. Representation objects formalize the vector space V on which the group acts, the group representation matrix ρ(g), and the Lie Algebra representation dρ(A) in a single object. Representations act as types for vectors coming from V. These types can be manipulated and transformed with the built in operators ⊕,⊗,dual, as well as incorporating custom representations. Rep objects should be immutable.

At minimum, new representations need to implement size, rho, __eq__, and __hash__.

size()[source]

Dimension dim(V) of the representation

rho(M)[source]

Group representation of the matrix M of shape (d,d)

drho(A)[source]

Lie Algebra representation of the matrix A of shape (d,d)

rho_dense(M)[source]

A convenience function which returns rho(M) as a dense matrix.

drho_dense(A)[source]

A convenience function which returns drho(A) as a dense matrix.

equivariant_basis()[source]

Computes the equivariant solution basis for the given representation of size N. Canonicalizes problems and caches solutions for reuse. Output [Q (N,r)]

equivariant_projector()[source]

Computes the (lazy) projection matrix P=QQᵀ that projects to the equivariant basis.

emlp.reps.T(p, q=0, G=None)[source]

A convenience function for creating rank (p,q) tensors.

emlp.reps.sparsify_basis(Q, lr=0.01)[source]

Convenience function to attempt to sparsify a given basis by applying an orthogonal transformation W, Q’ = QW where Q’ has only 1s, 0s and -1s. Notably this method does not have the same convergence gauruntees of krylov_constraint_solve and can fail (even silently). Intended to be used only for visualization purposes, use at your own risk.

emlp.reps.vis(repin, repout, cluster=True)[source]

A function to visualize the basis of equivariant maps repin>>repout as an image. Only use cluster=True if you know Pv will only have r distinct values (true for G<S(n) but not true for many continuous groups).

emlp.reps.equivariance_error(W, repin, repout, G)[source]

Computes the equivariance relative error rel_err(Wρ₁(g),ρ₂(g)W) of the matrix W (dim(repout),dim(repin)) [or basis Q: (dim(repout)xdim(repin), r)] according to the input and output representations and group G.