public class PhaseVector extends BaseVector<PhaseVector> implements java.io.Serializable, IArchive
.Modifier and Type | Class and Description |
---|---|
static class |
PhaseVector.IND
Enumeration for the element position indices for homogeneous
phase space objects.
|
ATTR_DATA
Constructor and Description |
---|
PhaseVector()
Creates a new instance of PhaseVector with zero initial value.
|
PhaseVector(DataAdaptor daSource)
Create a new
PhaseVector object and initialize it with the
data behind the DataAdaptor data source. |
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 object which is a deep copy of the
given 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.
|
Modifier and Type | Method and Description |
---|---|
void |
assignZero()
We need to redefine this method in order to set the
homogeneous coordinate back to unity.
|
PhaseVector |
clone()
Creates and returns a deep copy of this vector.
|
static PhaseVector |
copy(PhaseVector vecParent)
Creates a deep copy of the given
PhaseVector
object. |
static PhaseVector |
embed(R4 vecCoords)
Embeds the given vector z ∈ R4 into
homogeneous phase space.
|
static PhaseVector |
embed(R6 vecCoords)
Embeds the given vector z ∈ R6 into
homogeneous phase space.
|
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
|
double |
innerProd(PhaseVector v)
Must override to account for the homogeneous coordinate.
|
static void |
main(java.lang.String[] arrArgs)
Test driver
|
PhaseVector |
minus(PhaseVector vecSub)
Must override to protect the homogeneous coordinate.
|
void |
minusEquals(PhaseVector vecSub)
Must override to protect the homogeneous coordinate.
|
PhaseVector |
negate()
Must override to protect the homogeneous coordinate.
|
void |
negateEquals()
Must override to protect the homogeneous coordinate.
|
protected PhaseVector |
newInstance()
Handles object creation required by the base class.
|
static PhaseVector |
newZero()
Create a new instance of a zero phase vector.
|
double |
norm1()
Return the l1 norm of the vector.
|
double |
norm2()
Return the l2 norm of the vector.
|
double |
normInf()
Return the l∞ 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 vecAdd)
Must override to protect the homogeneous coordinate.
|
void |
plusEquals(PhaseVector vecAdd)
Must override to protect the homogeneous coordinate.
|
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 |
setElem(PhaseIndex i,
double dblVal)
Set the element at index.
|
void |
setVector(double[] arrVector)
Must override this method to ignore any missing homogeneous coordinate
since it is understood that this value is always there and unchanging.
|
void |
setVector(java.lang.String strValues)
Must override this method to ignore any missing homogeneous coordinate
since it is understood that this value is always there and unchanging.
|
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)
Must override to protect the homogeneous coordinate.
|
void |
timesEquals(double s)
Must override to protect the homogeneous coordinate.
|
assignUnity, copyVector, embedIn, getArrayCopy, getElem, getElem, getSize, hashCode, isEquivalentTo, leftMultiply, load, print, projectOnto, rightMultiply, save, setElem, setElem, setVector, toString
public PhaseVector()
public PhaseVector(double x, double xp, double y, double yp, double z, double zp)
PhaseVector
with specified initial value.x
- x-plane positionxp
- x-plane momentumy
- y-plane positionyp
- y-plane momentumz
- z-plane positionzp
- z-plane momentumpublic PhaseVector(PhaseVector vecInit)
PhaseVector
object which is a deep copy of the
given argument.vecInit
- initial valuepublic PhaseVector(double[] arrVal)
arrVal
- length 6 array of initial valuesjava.lang.ArrayIndexOutOfBoundsException
- argument must be a length-six arraypublic PhaseVector(R3 vecPos, R3 vecMom)
vecPos
- position vector (x,y,z) in R3vecMom
- momentum vector (xp, yp, zp) in R3public PhaseVector(DataAdaptor daSource) throws DataFormatException
PhaseVector
object and initialize it with the
data behind the DataAdaptor
data source.daSource
- data source containing initialization dataDataFormatException
- malformed dataIArchive.load(xal.tools.data.DataAdaptor)
public PhaseVector(java.lang.String strTokens) throws java.lang.NumberFormatException, java.lang.IllegalArgumentException
strTokens
- token string representing values phase coordinatesjava.lang.IllegalArgumentException
- wrong number of tokens in argument (must be 6 or 7)java.lang.NumberFormatException
- bad numeric value, un-parseablesetVector(java.lang.String)
public static PhaseVector newZero()
public static PhaseVector copy(PhaseVector vecParent)
PhaseVector
object. Thus, the argument is unmodified and unreferenced.vecParent
- vector object to clonepublic static PhaseVector parse(java.lang.String strTokens) throws java.lang.NumberFormatException, java.lang.IllegalArgumentException
strTokens
- six-token string representing values phase coordinatesjava.lang.IllegalArgumentException
- wrong number of tokens in argument (must be 6)java.lang.NumberFormatException
- bad numeric value, unparseablepublic static PhaseVector embed(R6 vecCoords)
PhaseVector
object. The last element of
the returned phase vector has value 1, as do all phase vectors.vecCoords
- vector z containing the first 6 element
values of the returned phase vectorpublic static PhaseVector embed(R4 vecCoords)
PhaseVector
object. The vector elements corresonding
to the longitudinal phase space coordinates z and z' are
both set to zero. The last element of
the returned phase vector has value 1, as do all phase vectors.vecCoords
- vector z containing the first 6 element
values of the returned phase vectorpublic void setVector(java.lang.String strValues)
setVector
in class BaseVector<PhaseVector>
strValues
- token vector of SIZE2 numeric valuesBaseVector.setVector(java.lang.String)
public void setVector(double[] arrVector) throws java.lang.ArrayIndexOutOfBoundsException
setVector
in class BaseVector<PhaseVector>
arrVector
- Java primitive array containing new vector valuesjava.lang.ArrayIndexOutOfBoundsException
- the argument must have the same dimensions as this matrixBaseVector.setVector(double[])
public void setElem(PhaseIndex i, double dblVal)
i
- index of new element valuepublic 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 getx()
public double getxp()
public double gety()
public double getyp()
public double getz()
public double getzp()
public R3 getPosition()
public R3 getMomentum()
public PhaseMatrix outerProd(PhaseVector vec)
PhaseMatrix
objectvec
- second argument to tensor productprotected PhaseVector newInstance()
newInstance
in class BaseVector<PhaseVector>
V
BaseVector.newInstance()
public void assignZero()
assignZero
in class BaseVector<PhaseVector>
BaseVector.assignZero()
public PhaseVector negate()
negate
in class BaseVector<PhaseVector>
BaseVector.negate()
public void negateEquals()
negateEquals
in class BaseVector<PhaseVector>
BaseVector.negateEquals()
public void plusEquals(PhaseVector vecAdd)
plusEquals
in class BaseVector<PhaseVector>
vecAdd
- Vector to add to this vector (addend)BaseVector.plusEquals(xal.tools.math.BaseVector)
public PhaseVector plus(PhaseVector vecAdd)
plus
in class BaseVector<PhaseVector>
vecAdd
- vector added to this one (addend)BaseVector.plus(xal.tools.math.BaseVector)
public void minusEquals(PhaseVector vecSub)
minusEquals
in class BaseVector<PhaseVector>
vecSub
- Vector to subtract from this vector (subtrahend)BaseVector.minusEquals(xal.tools.math.BaseVector)
public PhaseVector minus(PhaseVector vecSub)
minus
in class BaseVector<PhaseVector>
vecSub
- vector subtracted from this one (subtrahend)BaseVector.minus(xal.tools.math.BaseVector)
public PhaseVector times(double s)
times
in class BaseVector<PhaseVector>
s
- scalar valueBaseVector.times(double)
public void timesEquals(double s)
timesEquals
in class BaseVector<PhaseVector>
s
- scalarBaseVector.timesEquals(double)
public double innerProd(PhaseVector v) throws java.lang.IllegalArgumentException
innerProd
in class BaseVector<PhaseVector>
v
- second vectorjava.lang.IllegalArgumentException
- dimensions must agreeBaseVector.innerProd(xal.tools.math.BaseVector)
public double norm1()
norm1
in class BaseVector<PhaseVector>
BaseVector.norm1()
public double norm2()
norm2
in class BaseVector<PhaseVector>
BaseVector.norm2()
public double normInf()
normInf
in class BaseVector<PhaseVector>
BaseVector.normInf()
public PhaseVector clone()
clone
in class BaseVector<PhaseVector>
BaseVector.clone()
public void print(java.io.PrintWriter os)
print
in class BaseVector<PhaseVector>
os
- output stream objectpublic void println(java.io.PrintWriter os)
println
in class BaseVector<PhaseVector>
os
- output stream objectpublic java.lang.String printString()
public static void main(java.lang.String[] arrArgs)