KickJava   Java API By Example, From Geeks To Geeks.

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


1 package JSci.maths.groups;
2
3 import JSci.maths.Complex;
4 import JSci.maths.matrices.AbstractComplexSquareMatrix;
5 import JSci.maths.matrices.ComplexDiagonalMatrix;
6
7 /**
8 * The U1 class provides an encapsulation for U(1) groups.
9 * Unlike the parent LieGroup class, elements are not limited to
10 * being near the identity.
11 * The methods in this class assume a complex number representation
12 * for convenience.
13 * The LieGroup methods still provide a matrix representation.
14 * @version 1.3
15 * @author Mark Hale
16 */

17 public final class U1 extends LieGroup {
18         private static final AbstractComplexSquareMatrix U1gens[]={ComplexDiagonalMatrix.identity(1)};
19
20         private static final U1 _instance = new U1();
21         /**
22         * Constructs a U(1) group.
23         */

24         private U1() {
25                 super(U1gens);
26         }
27         /**
28         * Constructs a U(1) group.
29         * Singleton.
30         */

31         public static final U1 getInstance() {
32                 return _instance;
33         }
34         /**
35         * Returns a string representing this group.
36         */

37         public String JavaDoc toString() {
38                 return "U(1)";
39         }
40         /**
41         * Returns an element from within the group.
42         * @param param parameter to specify the group element
43         */

44         public Complex getElement(double param) {
45                 return Complex.polar(1.0,param);
46         }
47         /**
48         * Returns true if the element is the identity element of this group.
49         * @param a a group element
50         */

51         public boolean isIdentity(Complex a) {
52                 return Complex.ONE.equals(a);
53         }
54         /**
55         * Returns true if one element is the inverse of the other.
56         * @param a a group element
57         * @param b a group element
58         */

59         public boolean isInverse(Complex a,Complex b) {
60                 return Complex.ONE.equals(a.multiply(b));
61         }
62 }
63
64
Popular Tags