  
  [1X3 [33X[0;0YAlgorithms for unitary representations[133X[101X
  
  
  [1X3.1 [33X[0;0YUnitarising representations[133X[101X
  
  [1X3.1-1 UnitaryRepresentation[101X
  
  [33X[1;0Y[29X[2XUnitaryRepresentation[102X( [3Xrho[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA record with fields basis_change and unitary_rep such that [3Xrho[103X is
            isomorphic   to  unitary_rep,  differing  by  a  change  of  basis
            basis_change.  Meaning  if  [23XL[123X  is  basis_change  and [23X\rho_u[123X is the
            unitarised  [3Xrho[103X,  then  [23X\forall  g  \in G: \; L \rho_u(g) L^{-1} =
            \rho(g)[123X.[133X
  
  [33X[0;0YUnitarises  the given representation quickly, summing over the group using a
  base  and  strong  generating  set  and  unitarising  with  [2XLDLDecomposition[102X
  ([14X3.1-3[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := SymmetricGroup(3);;[127X[104X
    [4X[25Xgap>[125X [27Xirreps := IrreducibleRepresentations(G);;[127X[104X
    [4X[25Xgap>[125X [27X# It happens that we are given unitary irreps, so[127X[104X
    [4X[25X>[125X [27X# rho is also unitary (its blocks are unitary)[127X[104X
    [4X[25X>[125X [27Xrho := DirectSumOfRepresentations([irreps[1], irreps[2]]);;[127X[104X
    [4X[25Xgap>[125X [27XIsUnitaryRepresentation(rho);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27X# Arbitrary change of basis[127X[104X
    [4X[25X>[125X [27XA := [ [ -1, 1 ], [ -2, -1 ] ];;[127X[104X
    [4X[25Xgap>[125X [27Xtau := ComposeHomFunction(rho, x -> A^-1 * x * A);;[127X[104X
    [4X[25Xgap>[125X [27X# Not unitary, but still isomorphic to rho[127X[104X
    [4X[25X>[125X [27XIsUnitaryRepresentation(tau);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XAreRepsIsomorphic(rho, tau);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27X# Now we unitarise tau[127X[104X
    [4X[25X>[125X [27Xtau_u := UnitaryRepresentation(tau);;[127X[104X
    [4X[25Xgap>[125X [27X# We get a record with the unitarised rep:[127X[104X
    [4X[25X>[125X [27XAreRepsIsomorphic(tau, tau_u.unitary_rep);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XAreRepsIsomorphic(rho, tau_u.unitary_rep);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27X# The basis change is also in the record:[127X[104X
    [4X[25X>[125X [27XForAll(G, g -> tau_u.basis_change * Image(tau_u.unitary_rep, g) = Image(tau, g) * tau_u.basis_change);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X3.1-2 IsUnitaryRepresentation[101X
  
  [33X[1;0Y[29X[2XIsUnitaryRepresentation[102X( [3Xrho[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YWhether  [3Xrho[103X  is  unitary,  i.e.  for  all [23Xg \in G[123X, [23X\rho(g^{-1}) =
            \rho(g)^*[123X (where [23X^*[123X denotes the conjugate transpose).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27X# TODO: this example[127X[104X
  [4X[32X[104X
  
  [1X3.1-3 LDLDecomposition[101X
  
  [33X[1;0Y[29X[2XLDLDecomposition[102X( [3XA[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10Ya   record   with   two   fields,   L   and   D   such  that  [23XA  =
            L\mbox{diag}(D)L^*[123X.  [23XD[123X  is  the  [23X1 \times n[123X vector which gives the
            diagonal matrix [23X\mbox{diag}(D)[123X (where [3XA[103X is an [23Xn \times n[123X matrix).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA := [ [ 3, 2*E(3)+E(3)^2, -3 ], [ E(3)+2*E(3)^2, -3, 3 ], [ -3, 3, -6 ] ];;[127X[104X
    [4X[25Xgap>[125X [27X# A is a conjugate symmetric matrix[127X[104X
    [4X[25X>[125X [27XA = ConjugateTranspose@RepnDecomp(A);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27X# Note that A is not symmetric - the LDL decomposition works for any[127X[104X
    [4X[25X>[125X [27X# conjugate symmetric matrix.[127X[104X
    [4X[25X>[125X [27XA = TransposedMat(A);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27Xdecomp := LDLDecomposition(A);;[127X[104X
    [4X[25Xgap>[125X [27X# The LDL decomposition is such that A = LDL^*, D diagonal, and L lower triangular.[127X[104X
    [4X[25X>[125X [27XA = decomp.L * DiagonalMat(decomp.D) * ConjugateTranspose@RepnDecomp(decomp.L);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xdecomp.L[1][2] = 0 and decomp.L[1][3] = 0 and decomp.L[2][3] = 0;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  
  [1X3.2 [33X[0;0YDecomposing unitary representations[133X[101X
  
  [1X3.2-1 IrreducibleDecompositionDixon[101X
  
  [33X[1;0Y[29X[2XIrreducibleDecompositionDixon[102X( [3Xrho[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10Ya list of irreps in the decomposition of [3Xrho[103X[133X
  
  [33X[0;0YNOTE:  this  is not implemented yet. Assumes that [3Xrho[103X is unitary and uses an
  algorithm due to Dixon to decompose it into unitary irreps.[133X
  
