There are two bald claims here:
- The columns of the contravariant metric tensor are the vector magnitudes of the facets expressed in the bcc coordinates.
- The vector facets sum to zero
This code lends evidence to these claims.
Routine pt takes a permutation, generates a random set of ds2’s, computes both forms of metric tensor.
The contravariant metric tensor is ‘augmented’ with an extra row and column so as to represent all facets equally.
This is done by relying on the fact that the facets, as vectors, sum to 0.
pt then permutes the random ds2’s, repeats the calculation which causes a different choice of origin.
The first augmented matrix is likewise permuted and shown to agree with the augmented matrix produced from the permuted ds2’s.
This is a fairly strong test of the above two claims.
In more detail:
- pa
- permutes the rows and columns of a given matrix with the given permutation.
- ds2a
- is the original random choice of ds2’s.
Note that the triangle inequality is not enforced.
- ds2b
- is the permuted ds2’s.
- g
- This routine computes the covariant metric tensor from a set of ds2’s.
It uses vertex n as origin.
The permutation generally changes which vertex this is.
- ga and gb
- are the two covariant metric tensors
- gia and gib
- are the respective contravariant metric tensors
- aug
- augments a matrix so the rows and columns sum to 0.
- agia
- is the augmented contravariant metric tensor
- pagia
- is the permuted augmented contravariant metric tensor
The printed value is the maximum of the discrepancies of pagia and aigb.