|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--gov.sns.tools.beam.PhaseMatrix
Represents a two-tensor on the space of homogeneous phase space coordinates
in three spatial dimensions. Thus, each PhaseMatrix is an element of R7x7,
the set of real 7x7 matrices.
The coordinates in homogeneous phase space are as follows: (x, xp, y, yp, z, zp, 1)' where the prime indicates transposition and x = x-plane position xp = x-plane momentum y = y-plane position yp = y-plane momentum z = z-plane position zp = z-plane momentum
Homogeneous coordinates are parameterizations of the projective spaces Pn. They are
useful here to allow vector transpositions, normally produced by vector addition, to
be represented as matrix multiplications. These operations can be embodied by
PhaseMatrix. Thus, PhaseMatrix objects can represent any
linear operation, including translation, on PhaseVector objects.
Matrix,
PhaseVector,
CorrelationMatrix,
Serialized Form| Field Summary | |
static java.lang.String |
ATTR_DATA
attribute marker for data |
static int |
DIM
number of dimensions (DIM=7) |
static int |
IND_HOM
index of homogeneous coordinate |
static int |
IND_X
index of x position |
static int |
IND_XP
index of x' position |
static int |
IND_Y
index of y position |
static int |
IND_YP
index of y' position |
static int |
IND_Z
index of z position |
static int |
IND_ZP
index of z' position |
| Constructor Summary | |
PhaseMatrix()
Creates a new instance of PhaseMatrix initialized to zero. |
|
PhaseMatrix(Jama.Matrix matInit)
Construct a PhaseMatrix from a suitable Jama.Matrix. |
|
PhaseMatrix(PhaseMatrix matInit)
Copy Constructor - create a deep copy of the target phase matrix. |
|
PhaseMatrix(java.lang.String strValues)
Parsing Constructor - create a PhaseMatrix instance and initialize it according to a token string of element values. |
|
| Method Summary | |
R3 |
compPhaseAdvance(Twiss[] twissOld,
Twiss[] twissNew)
Compute and return the betatron phase advance for a particle produced by this matrix when used as a transfer matrix. |
PhaseMatrix |
conjugateInv(PhaseMatrix matPhi)
Function for inverse conjugation of this matrix by the argument matrix. |
PhaseMatrix |
conjugateTrans(PhaseMatrix matPhi)
Function for transpose conjugation of this matrix by the argument matrix. |
double |
det()
Matrix determinant function. |
boolean |
equals(java.lang.Object o)
Return true if this object is equal to o, false otherwise. |
double |
getElem(int i,
int j)
Return matrix element value. |
int |
hashCode()
"Borrowed" implementation from AffineTransform, since it is based on double attribute values. |
static PhaseMatrix |
identity()
Create an identity phase matrix |
PhaseMatrix |
inverse()
Nondestructive inverse of this matrix. |
void |
load(DataAdaptor daptArchive)
Restore the value of the this PhaseMatrix from the
contents of a data archive. |
static void |
main(java.lang.String[] arrArgs)
Testing Driver |
PhaseMatrix |
minus(PhaseMatrix mat)
Nondestructive matrix subtraction. |
void |
minusEquals(PhaseMatrix mat)
In-place matrix subtraction. |
double |
norm1()
Return the l1 norm of this matrix. |
double |
norm2()
Return the l2 norm of this matrix |
double |
normInf()
Return the l-infinity norm of this matrix |
static PhaseMatrix |
parse(java.lang.String strTokens)
Create a PhaseMatrix instance and initialize it according to a token string of element values. |
PhaseMatrix |
plus(PhaseMatrix mat)
Nondestructive matrix addition. |
void |
plusEquals(PhaseMatrix mat)
In-place matrix addition. |
void |
print(java.io.PrintWriter os)
Print out the contents of the PhaseMatrix in text format. |
void |
save(DataAdaptor daptArchive)
Save the value of this PhaseMatrix to a data sink
represented by the DataAdaptor interface. |
void |
setElem(int i,
int j,
double s)
Element assignment - assigns matrix element to the specified value |
void |
setMatrix(java.lang.String strValues)
Parsing assigment - set the PhaseMatrix value
according to a token string of element values. |
void |
setSubMatrix(int i0,
int i1,
int j0,
int j1,
double[][] arrSub)
Set a submatrix within the phase matrix. |
PhaseMatrix |
times(double s)
Nondestructive scalar multiplication. |
PhaseMatrix |
times(PhaseMatrix matRight)
Matrix multiplication. |
PhaseVector |
times(PhaseVector vec)
Nondestructive Matrix-Vector multiplication. |
void |
timesEquals(double s)
In-place scalar multiplication. |
void |
timesEquals(PhaseMatrix matRight)
In-place matrix multiplication. |
java.lang.String |
toString()
Convert the contents of the matrix to a string representation. |
PhaseMatrix |
transpose()
Nondestructive transpose of this matrix. |
static PhaseMatrix |
zero()
Create a new instance of a zero phase matrix. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int IND_X
public static final int IND_XP
public static final int IND_Y
public static final int IND_YP
public static final int IND_Z
public static final int IND_ZP
public static final int IND_HOM
public static final int DIM
public static final java.lang.String ATTR_DATA
| Constructor Detail |
public PhaseMatrix()
public PhaseMatrix(PhaseMatrix matInit)
matInit - initial value
public PhaseMatrix(java.lang.String strValues)
throws java.lang.IllegalArgumentException,
java.lang.NumberFormatException
strValues - token vector of 7x7=49 numeric values
java.lang.IllegalArgumentException - wrong number of token strings
java.lang.NumberFormatException - bad number format, unparseablesetMatrix(java.lang.String)public PhaseMatrix(Jama.Matrix matInit)
matInit - a 7x7 Jama.Matrix object| Method Detail |
public static PhaseMatrix zero()
public static PhaseMatrix identity()
public static PhaseMatrix parse(java.lang.String strTokens)
throws java.lang.IllegalArgumentException,
java.lang.NumberFormatException
strTokens - token vector of 7x7=49 numeric values
java.lang.IllegalArgumentException - wrong number of token strings
java.lang.NumberFormatException - bad number format, unparseable
public double getElem(int i,
int j)
throws java.lang.ArrayIndexOutOfBoundsException
i - row indexj - column index
java.lang.ArrayIndexOutOfBoundsException - index must be in {0,1,2,3,4,5,6}
public void setMatrix(java.lang.String strValues)
throws DataFormatException,
java.lang.IllegalArgumentException
PhaseMatrix value
according to a token string of element values.
The token string argument is assumed to be one-dimensional and packed by
column (ala FORTRAN).
strValues - token vector of 7x7=49 numeric values
java.lang.IllegalArgumentException - wrong number of token strings
java.lang.NumberFormatException - bad number format, unparseable
DataFormatException
public void setElem(int i,
int j,
double s)
throws java.lang.ArrayIndexOutOfBoundsException
i - row indexj - column index
java.lang.ArrayIndexOutOfBoundsException - index must be in {0,1,2,3,4,5,6}
public void setSubMatrix(int i0,
int i1,
int j0,
int j1,
double[][] arrSub)
throws java.lang.ArrayIndexOutOfBoundsException
i0 - row index of upper left blocki1 - row index of lower right blockj0 - column index of upper left blockj1 - column index of lower right blockarrSub - two-dimensional sub element array
java.lang.ArrayIndexOutOfBoundsException - submatrix does not fit into 7x7 phase matrixpublic void save(DataAdaptor daptArchive)
PhaseMatrix to a data sink
represented by the DataAdaptor interface.
save in interface IArchivedaptArchive - interface to data sinkIArchive.save(gov.sns.tools.data.DataAdaptor)
public void load(DataAdaptor daptArchive)
throws DataFormatException
PhaseMatrix from the
contents of a data archive.
load in interface IArchivedaptArchive - interface to data source
DataFormatException - malformed data
java.lang.IllegalArgumentException - wrong number of string tokensIArchive.load(gov.sns.tools.data.DataAdaptor)public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
Object.
hashCode in class java.lang.Object
public R3 compPhaseAdvance(Twiss[] twissOld,
Twiss[] twissNew)
public double det()
public PhaseMatrix transpose()
public PhaseMatrix inverse()
public PhaseMatrix plus(PhaseMatrix mat)
mat - matrix to be added to this
public void plusEquals(PhaseMatrix mat)
mat - matrix to be added to this (result replaces this)public PhaseMatrix minus(PhaseMatrix mat)
mat - matrix to be subtracted from this
public void minusEquals(PhaseMatrix mat)
mat - matrix to be subtracted from this (result replaces this)public PhaseMatrix times(double s)
s - scalar value to multiply this matrix
public void timesEquals(double s)
s - scalar value to multiply this matrix (result replaces this)public PhaseVector times(PhaseVector vec)
public PhaseMatrix times(PhaseMatrix matRight)
matRight - right operand of matrix multiplication operator
public void timesEquals(PhaseMatrix matRight)
matRight - right operand of matrix multiplication operator
public PhaseMatrix conjugateTrans(PhaseMatrix matPhi)
matPhi - conjugating matrix (typically a tranfer matrix)
public PhaseMatrix conjugateInv(PhaseMatrix matPhi)
matPhi - conjugating matrix (typically a tranfer matrix)
public double norm1()
public double norm2()
public double normInf()
public java.lang.String toString()
toString in class java.lang.Objectpublic void print(java.io.PrintWriter os)
os - output stream to receive text dumppublic static void main(java.lang.String[] arrArgs)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||