1 package JSci.maths.algebras; 2 3 import JSci.maths.*; 4 import JSci.maths.matrices.AbstractComplexMatrix; 5 import JSci.maths.matrices.AbstractComplexSquareMatrix; 6 import JSci.maths.matrices.ComplexSquareMatrix; 7 import JSci.maths.vectors.AbstractDoubleVector; 8 import JSci.maths.vectors.Double3Vector; 9 import JSci.maths.vectors.VectorDimensionException; 10 import JSci.maths.fields.ComplexField; 11 12 19 public final class sp2_RDim2 extends LieAlgebra { 20 private final static Complex t1[][]={ 21 {Complex.ZERO,ComplexField.HALF}, 22 {ComplexField.HALF,Complex.ZERO} 23 }; 24 private final static Complex t2[][]={ 25 {Complex.ZERO,ComplexField.HALF}, 26 {ComplexField.MINUS_HALF,Complex.ZERO} 27 }; 28 private final static Complex t3[][]={ 29 {ComplexField.HALF,Complex.ZERO}, 30 {Complex.ZERO,ComplexField.MINUS_HALF} 31 }; 32 35 private final static AbstractComplexSquareMatrix basisMatrices[]={ 36 new ComplexSquareMatrix(t1), 37 new ComplexSquareMatrix(t2), 38 new ComplexSquareMatrix(t3) 39 }; 40 41 private final static sp2_RDim2 _instance = new sp2_RDim2(); 42 45 private sp2_RDim2() { 46 super("sp(2,R) [2]"); 47 } 48 51 public static final sp2_RDim2 getInstance() { 52 return _instance; 53 } 54 57 public AbstractComplexSquareMatrix getElement(final AbstractDoubleVector v) { 58 AbstractComplexMatrix m=basisMatrices[0].scalarMultiply(v.getComponent(0)); 59 m=m.add(basisMatrices[1].scalarMultiply(v.getComponent(1))); 60 m=m.add(basisMatrices[2].scalarMultiply(v.getComponent(2))); 61 return (AbstractComplexSquareMatrix)m.scalarMultiply(Complex.I); 62 } 63 67 public AbstractDoubleVector multiply(final AbstractDoubleVector a, final AbstractDoubleVector b) { 68 if(!(a instanceof Double3Vector) || !(b instanceof Double3Vector)) 69 throw new VectorDimensionException("Vectors must be 3-vectors."); 70 return new Double3Vector( 71 a.getComponent(2)*b.getComponent(1)-a.getComponent(1)*b.getComponent(2), 72 a.getComponent(2)*b.getComponent(0)-a.getComponent(0)*b.getComponent(2), 73 a.getComponent(1)*b.getComponent(0)-a.getComponent(0)*b.getComponent(1) 74 ); 75 } 76 79 public AbstractComplexSquareMatrix[] basis() { 80 return basisMatrices; 81 } 82 } 83 84
| Popular Tags
|