KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > physics > quantum > SpinOperator


1 package JSci.physics.quantum;
2
3 import JSci.maths.*;
4 import JSci.maths.matrices.AbstractComplexSquareMatrix;
5 import JSci.maths.algebras.*;
6
7 /**
8 * The SpinOperator class provides an object for encapsulating spin operators.
9 * @version 2.0
10 * @author Mark Hale
11 */

12 public final class SpinOperator extends Operator {
13         private static final LieAlgebra spin1_2=su2Dim2.getInstance();
14         private static final LieAlgebra spin1=su2Dim3.getInstance();
15         /**
16         * Spin 1/2 operator (x).
17         */

18         public static final SpinOperator X1_2=new SpinOperator(spin1_2.basis()[0]);
19         /**
20         * Spin 1/2 operator (y).
21         */

22         public static final SpinOperator Y1_2=new SpinOperator(spin1_2.basis()[1]);
23         /**
24         * Spin 1/2 operator (z).
25         */

26         public static final SpinOperator Z1_2=new SpinOperator(spin1_2.basis()[2]);
27         /**
28         * Spin 1 operator (x).
29         */

30         public static final SpinOperator X1=new SpinOperator(spin1.basis()[0]);
31         /**
32         * Spin 1 operator (y).
33         */

34         public static final SpinOperator Y1=new SpinOperator(spin1.basis()[1]);
35         /**
36         * Spin 1 operator (z).
37         */

38         public static final SpinOperator Z1=new SpinOperator(spin1.basis()[2]);
39         /**
40         * Constructs a spin operator.
41         */

42         private SpinOperator(AbstractComplexSquareMatrix spinMatrix) {
43                 super(spinMatrix);
44         }
45         /**
46         * Returns true if this operator is self-adjoint.
47         */

48         public boolean isSelfAdjoint() {
49                 return true;
50         }
51         /**
52         * Returns true if this operator is unitary.
53         */

54         public boolean isUnitary() {
55                 return true;
56         }
57         /**
58         * Returns the trace.
59         */

60         public Complex trace() {
61                 return Complex.ZERO;
62         }
63 }
64
65
Popular Tags