qcnn
Class ComplexMatrix

java.lang.Object
  extended by qcnn.ComplexMatrix

 class ComplexMatrix
extends java.lang.Object

Represents a 2x2 matrix of complex numbers. The implementation is such that instances of ComplexMatrix are immutable; operations should be combined through composition and cascading of method invokations.


Field Summary
protected  Complex a
           
protected  Complex b
           
protected  Complex c
           
protected  Complex d
           
static ComplexMatrix IDENTITY
           
 
Constructor Summary
ComplexMatrix()
          Creates a new identity matrix
ComplexMatrix(Complex a, Complex b, Complex c, Complex d)
          Creates a new complex matrix.
ComplexMatrix(double a, double b, double c, double d)
          Creates a real-valued complex matrix.
 
Method Summary
 ComplexMatrix multiply(ComplexMatrix m)
          Computes the product of two matrices.
 ComplexMatrix multiply(double v)
          Scales all entries in this matric by a real number
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

a

protected Complex a

b

protected Complex b

c

protected Complex c

d

protected Complex d

IDENTITY

public static final ComplexMatrix IDENTITY
Constructor Detail

ComplexMatrix

public ComplexMatrix(Complex a,
                     Complex b,
                     Complex c,
                     Complex d)
Creates a new complex matrix. Entries are as pictured:
                        / a b \
                        \ c d /
                


ComplexMatrix

public ComplexMatrix(double a,
                     double b,
                     double c,
                     double d)
Creates a real-valued complex matrix. Entries are as pictured:
                        / a b \
                        \ c d /
                


ComplexMatrix

public ComplexMatrix()
Creates a new identity matrix

Method Detail

multiply

public ComplexMatrix multiply(ComplexMatrix m)
Computes the product of two matrices. The product M = ABC should be coded as M = A.multiply(B.multiply(C)) or M = A.multiply(B).multiply(C); these are equivalent due to associativity.

Returns:
this*m

multiply

public ComplexMatrix multiply(double v)
Scales all entries in this matric by a real number

Parameters:
v - The scaling factor
Returns:
The scaled matrix

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
A string representation of this matrix, of the form (a,b,c,d)