|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--gov.sns.tools.beam.PhaseVector
Represents a vector of homogeneous phase space coordinates for three spatial dimensions. Thus, each phase vector is an element of R7, the set of real 7-tuples.
The coordinates 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 the class
PhaseMatrix. Thus, PhaseVector's are not intended to support
vector addition.
Matrix,
Vector,
PhaseMatrix,
Serialized Form| Field Summary | |
static java.lang.String |
ATTR_DATA
attribute marker for data |
| Constructor Summary | |
PhaseVector()
Creates a new instance of PhaseVector with zero initial value. |
|
PhaseVector(double[] arrVal)
Create a new instance of PhaseVector with specified initial value. |
|
PhaseVector(double x,
double xp,
double y,
double yp,
double z,
double zp)
Create a new instance of PhaseVector with specified initial value. |
|
PhaseVector(PhaseVector vecInit)
Copy Constructor Creates new PhaseVector initialized to argument |
|
PhaseVector(R3 vecPos,
R3 vecMom)
Create a new instance of PhaseVector with specified initial value. |
|
PhaseVector(java.lang.String strTokens)
Create a new instance of PhaseVector with specified initial value specified by the formatted string argument. |
|
| Method Summary | |
boolean |
equals(java.lang.Object o)
Return false - the object is not a PhaseVector. |
boolean |
equals(PhaseVector pv)
Return true if the PhaseVectors are equal, false otherwise. |
double |
getElem(int i)
Return the element at index. |
R3 |
getMomentum()
Get momentum coordinate in R3. |
R3 |
getPosition()
Get position coordinates in R3. |
double |
getx()
Return the x position coordinate |
double |
getxp()
Return the x momentum coordinate |
double |
gety()
Return the y position coordinate |
double |
getyp()
Return the y momentum coordinate |
double |
getz()
Return the z momentum coordinate |
double |
getzp()
Return the z momentum coordinate |
int |
hashCode()
"Borrowed" implementation from AffineTransform, since it is based on double attribute values. |
double |
innerProd(PhaseVector vec)
Vector inner product operation using ONLY the phase coordinates. |
void |
load(DataAdaptor daptArchive)
Restore the value of the this PhaseVector from the
contents of a data archive. |
static void |
main(java.lang.String[] arrArgs)
|
double |
norm1()
Return the l1 norm of the vector's phase components. |
double |
norm2()
Return the l2 norm of the vector. |
double |
normInf()
Return the l-infinity norm of the vector. |
PhaseMatrix |
outerProd(PhaseVector vec)
Vector outer product operation. |
static PhaseVector |
parse(java.lang.String strTokens)
Create a new instance of PhaseVector with initial value determined by the formatted string argument. |
PhaseVector |
plus(PhaseVector vec)
Vector nondestructive addition. |
void |
plusEquals(PhaseVector vec)
Vector in-place addition. |
void |
print(java.io.PrintWriter os)
Print the vector contents to an output stream, does not add new line. |
void |
println(java.io.PrintWriter os)
Print the vector contents to an output stream, add new line character. |
java.lang.String |
printString()
Print the vector contents to a String. |
void |
save(DataAdaptor daptArchive)
Save the value of this PhaseVector to disk. |
void |
setElem(int i,
double dblVal)
Set the element at index. |
void |
setVector(java.lang.String strValues)
Create a new instance of PhaseVector with specified initial value specified by the formatted string argument. |
void |
setx(double dblVal)
Set the x position coordinate |
void |
setxp(double dblVal)
Set the x momentum coordinate |
void |
sety(double dblVal)
Set the y position coordinate |
void |
setyp(double dblVal)
Set the y momentum coordinate |
void |
setz(double dblVal)
Set the z position coordinate |
void |
setzp(double dblVal)
Set the z momentum coordinate |
PhaseVector |
times(double s)
Nondestructive scalar multiplication |
PhaseVector |
times(PhaseMatrix mat)
Premultiply PhaseVector by a PhaseMatrix. |
void |
timesEquals(double s)
In-place scalar multiplication |
java.lang.String |
toString()
Convert the vector contents to a string. |
static PhaseVector |
zero()
Create a new instance of a zero phase vector. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String ATTR_DATA
| Constructor Detail |
public PhaseVector()
public PhaseVector(double x,
double xp,
double y,
double yp,
double z,
double zp)
x - x-plane positionxp - x-plane momentumy - y-plane positionyp - y-plane momentumz - z-plane positionzp - z-plane momentumpublic PhaseVector(PhaseVector vecInit)
vecInit - initial valuepublic PhaseVector(double[] arrVal)
arrVal - length 6 array of initial values
java.lang.ArrayIndexOutOfBoundsException - argument must be a length-six array
public PhaseVector(R3 vecPos,
R3 vecMom)
vecPos - position vector (x,y,z) in R3vecMom - momemtum vector (xp, yp, zp) in R3
public PhaseVector(java.lang.String strTokens)
throws java.lang.NumberFormatException,
java.lang.IllegalArgumentException
strTokens - token string representing values phase coordinates
java.lang.IllegalArgumentException - wrong number of tokens in argument (must be 6 or 7)
java.lang.NumberFormatException - bad numeric value, unparseablesetVector(java.lang.String)| Method Detail |
public static PhaseVector zero()
public static PhaseVector parse(java.lang.String strTokens)
throws java.lang.NumberFormatException,
java.lang.IllegalArgumentException
strTokens - six-token string representing values phase coordinates
java.lang.IllegalArgumentException - wrong number of tokens in argument (must be 6)
java.lang.NumberFormatException - bad numeric value, unparseable
public void setVector(java.lang.String strValues)
throws DataFormatException,
java.lang.IllegalArgumentException
strValues - token string representing values phase coordinates
java.lang.IllegalArgumentException - wrong number of tokens in argument (must be 6 or 7)
java.lang.NumberFormatException - bad numeric value, unparseable
DataFormatException
public void setElem(int i,
double dblVal)
throws java.lang.ArrayIndexOutOfBoundsException
i - index of new element value
java.lang.ArrayIndexOutOfBoundsException - index must be in {0,1,2,3,4,5}public void setx(double dblVal)
public void setxp(double dblVal)
public void sety(double dblVal)
public void setyp(double dblVal)
public void setz(double dblVal)
public void setzp(double dblVal)
public double getElem(int i)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException - index must be in {0,1,2,3,4,5,6}public double getx()
public double getxp()
public double gety()
public double getyp()
public double getz()
public double getzp()
public R3 getPosition()
public R3 getMomentum()
public void save(DataAdaptor daptArchive)
PhaseVector to disk.
save in interface IArchivedaptArchive - interface to data sinkIArchive.save(gov.sns.tools.data.DataAdaptor)
public void load(DataAdaptor daptArchive)
throws DataFormatException
PhaseVector 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 java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic boolean equals(PhaseVector pv)
public int hashCode()
Object.
hashCode in class java.lang.Objectpublic PhaseVector plus(PhaseVector vec)
vec - vector to be added
public void plusEquals(PhaseVector vec)
vec - vector to be addedpublic PhaseVector times(double s)
s - scalar
public void timesEquals(double s)
s - scalarpublic PhaseVector times(PhaseMatrix mat)
mat - matrix operator
public double innerProd(PhaseVector vec)
vec - second argument to inner product operation
public PhaseMatrix outerProd(PhaseVector vec)
PhaseMatrix object
vec - second argument to tensor product
public double norm1()
public double norm2()
public double normInf()
public void print(java.io.PrintWriter os)
os - output stream objectpublic void println(java.io.PrintWriter os)
os - output stream objectpublic java.lang.String printString()
public static void main(java.lang.String[] arrArgs)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||