KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > maths > groups > LieGroup


1 package JSci.maths.groups;
2
3 import JSci.maths.*;
4 import JSci.maths.vectors.AbstractDoubleVector;
5 import JSci.maths.matrices.AbstractComplexMatrix;
6 import JSci.maths.matrices.AbstractComplexSquareMatrix;
7 import JSci.maths.matrices.ComplexDiagonalMatrix;
8
9 /**
10 * The LieGroup class provides an encapsulation for Lie groups.
11 * Elements are represented by complex matrices, and are limited
12 * to being near the identity.
13 * @jsci.planetmath LieGroup
14 * @version 1.3
15 * @author Mark Hale
16 */

17 public class LieGroup extends Object JavaDoc {
18         private AbstractComplexSquareMatrix generators[];
19         private AbstractComplexSquareMatrix identityMatrix;
20         /**
21         * Constructs a Lie group from a Lie algebra.
22         * @param gens the group generators
23         */

24         public LieGroup(AbstractComplexSquareMatrix gens[]) {
25                 generators=gens;
26                 identityMatrix=ComplexDiagonalMatrix.identity(generators[0].rows());
27         }
28         /**
29         * Returns the dimension of the group.
30         */

31         public final int dimension() {
32                 return generators.length;
33         }
34         /**
35         * Returns an element near the identity.
36         * @param v a small element from the Lie algebra
37         */

38         public AbstractComplexSquareMatrix getElement(AbstractDoubleVector v) {
39                 if(generators.length!=v.dimension())
40                         throw new IllegalArgumentException JavaDoc("The vector should match the generators.");
41                 AbstractComplexMatrix phase=generators[0].scalarMultiply(v.getComponent(0));
42                 for(int i=1;i<generators.length;i++)
43                         phase=phase.add(generators[i].scalarMultiply(v.getComponent(i)));
44                 return (AbstractComplexSquareMatrix)identityMatrix.add(phase.scalarMultiply(Complex.I));
45         }
46         /**
47         * Returns the identity element.
48         */

49         public AbstractComplexSquareMatrix identity() {
50                 return identityMatrix;
51         }
52         /**
53         * Returns true if the element is the identity element of this group.
54         * @param a a group element
55         */

56         public final boolean isIdentity(AbstractComplexSquareMatrix a) {
57                 return identityMatrix.equals(a);
58         }
59         /**
60         * Returns true if one element is the inverse of the other.
61         * @param a a group element
62         * @param b a group element
63         */

64         public final boolean isInverse(AbstractComplexSquareMatrix a,AbstractComplexSquareMatrix b) {
65                 return isIdentity(a.multiply(b));
66         }
67 }
68
69
Popular Tags