Class PhaseMatrix
- All Implemented Interfaces:
Serializable
,IArchive
- Direct Known Subclasses:
CovarianceMatrix
,FieldMapIntegrator
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
translations, 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.
- Since:
- March, 2003
- Version:
- Oct, 2013
- Author:
- Christopher Allen
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumeration for the element position indices of a homogeneous phase space objects. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
index of homogeneous coordinatestatic final int
index of x positionstatic final int
index of x' positionstatic final int
index of y positionstatic final int
index of y' positionstatic final int
index of z positionstatic final int
index of z' positionstatic final int
number of dimensions (DIM=7)Fields inherited from class xal.tools.math.BaseMatrix
ATTR_DATA, DBL_EPS, ULPS_BRACKET
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of PhaseMatrix initialized to zero.PhaseMatrix
(double[][] arrValues) Initializing constructor for classPhaseMatrix
.PhaseMatrix
(String strValues) Parsing Constructor - create a PhaseMatrix instance and initialize it according to a token string of element values.PhaseMatrix
(PhaseMatrix matInit) Copy Constructor - create a deep copy of the target phase matrix.PhaseMatrix
(DataAdaptor daSource) Create a newPhaseMatrix
object and initialize with the data source behind theDataAdaptor
interface. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Creates and returns a deep copy of this matrix.void
Explicitly enforce the homogeneous nature of this matrix.static PhaseMatrix
identity()
Create an identity phase matrixstatic PhaseMatrix
loadFrom
(DataAdaptor daSource) Create a newPhaseMatrix
object and initialize with the data source behind the givenDataAdaptor
interface.double
max()
We must redefine the norm of any matrix on projective space to eliminate the homogeneous coordinate.minus
(PhaseMatrix matSub) Non-destructive matrix subtraction.void
minusEquals
(PhaseMatrix matSub) In-place matrix subtraction.protected PhaseMatrix
newInstance
(int row, int cnt) Handles object creation required by the base class.double
norm1()
We must redefine the norm of any matrix on projective space to eliminate the homogeneous coordinate.double
norm2()
We must redefine the norm of any matrix on projective space to eliminate the homogeneous coordinate.double
normF()
We must redefine the norm of any matrix on projective space to eliminate the homogeneous coordinate.double
normInf()
We must redefine the norm of any matrix on projective space to eliminate the homogeneous coordinate.static PhaseMatrix
Create a PhaseMatrix instance and initialize it according to a token string of element values.plus
(PhaseMatrix matAddend) Non-destructive matrix addition.void
plusEquals
(PhaseMatrix matAddend) In-place matrix addition.projectColumn
(int j) Projects the jth column onto R6.Projects the jth column onto R6.Projects thePhaseMatrix
onto the space of 4×4 matrices.Projects thePhaseMatrix
onto the space of 6×6 matrices.projectRow
(int i) Projects the ith row onto R6.Projects the ith row onto R6.static PhaseMatrix
rotationProduct
(R3x3 matSO3) Compute the rotation matrix in phase space that is essentially the Cartesian product of the given rotation matrix in SO(3).static PhaseMatrix
spatialTranslation
(R3 vecDispl) Create a phase matrix representing a linear translation operator on homogeneous phase space that only affects the spatial coordinates.static PhaseMatrix
translation
(PhaseVector vecTrans) Create a phase matrix representing a linear translation operator on homogeneous phase space.static PhaseMatrix
zero()
Create a new instance of a zero phase matrix.Methods inherited from class xal.tools.math.SquareMatrix
conjugateInv, conjugateTrans, det, getSize, isSymmetric, solve, solveInPlace, timesEquals, trace
Methods inherited from class xal.tools.math.BaseMatrix
assignIdentity, assignMatrix, assignZero, conditionNumber, copy, equals, getArrayCopy, getColCnt, getElem, getElem, getMatrix, getRowCnt, hashCode, inverse, isApproxEqual, isApproxEqual, isEquivalentTo, isSquare, load, newInstance, print, rank, save, setElem, setElem, setMatrix, setMatrix, setSubMatrix, times, times, times, timesEquals, toString, toStringMatrix, toStringMatrix, toStringMatrix, transpose
-
Field Details
-
IND_X
public static final int IND_Xindex of x position- See Also:
-
IND_XP
public static final int IND_XPindex of x' position- See Also:
-
IND_Y
public static final int IND_Yindex of y position- See Also:
-
IND_YP
public static final int IND_YPindex of y' position- See Also:
-
IND_Z
public static final int IND_Zindex of z position- See Also:
-
IND_ZP
public static final int IND_ZPindex of z' position- See Also:
-
IND_HOM
public static final int IND_HOMindex of homogeneous coordinate- See Also:
-
INT_SIZE
public static final int INT_SIZEnumber of dimensions (DIM=7)- See Also:
-
-
Constructor Details
-
PhaseMatrix
public PhaseMatrix()Creates a new instance of PhaseMatrix initialized to zero. -
PhaseMatrix
Copy Constructor - create a deep copy of the target phase matrix.- Parameters:
matInit
- initial value
-
PhaseMatrix
Create a newPhaseMatrix
object and initialize with the data source behind theDataAdaptor
interface.- Parameters:
daSource
- data source containing initialization data- Throws:
DataFormatException
- malformed data- See Also:
-
PhaseMatrix
Parsing Constructor - create a PhaseMatrix instance and initialize it according to a token string of element values. The token string argument is assumed to be one-dimensional and packed by column (ala FORTRAN).- Parameters:
strValues
- token vector of 7x7=49 numeric values- Throws:
IllegalArgumentException
- wrong number of token stringsNumberFormatException
- bad number format, unparseable- See Also:
-
PhaseMatrix
Initializing constructor for classPhaseMatrix
. The values of the new matrix object are set to the given Java primitive type array (the array is not modified).- Parameters:
arrValues
- initial values for the new matrix- Throws:
ArrayIndexOutOfBoundsException
- the argument must have dimensions 7×7- Since:
- Oct 7, 2013
-
-
Method Details
-
zero
Create a new instance of a zero phase matrix.- Returns:
- zero vector
-
identity
Create an identity phase matrix- Returns:
- 7x7 real identity matrix
-
translation
Create a phase matrix representing a linear translation operator on homogeneous phase space. Multiplication by the returned
PhaseMatrix
object is equivalent to translation by the givenPhaseVector
argument. Specifically, if the argument Δ has coordinates
Δ = (Δx, Δx', Δdy, Δdy', Δdz, Δdz', 1)T
then the returned matrix T(Δ) has the form|1 0 0 0 0 0 Δx | |0 1 0 0 0 0 Δx'| T(Δ) = |0 0 1 0 0 0 Δy | |0 0 0 1 0 0 Δy'| |0 0 0 0 1 0 Δz | |0 0 0 0 0 1 Δz'| |0 0 0 0 0 0 1 |
Consequently, given a phase vector v of the form|x | |x'| v = |y | |y'| |z | |z'| |1 |
Then operation on v by T(Δ) has the result|x + Δx | |x'+ Δx'| T(Δ)v = |y + Δy | |y'+ Δy'| |z + Δz | |z'+ Δz'| | 1 |
which we see is equivalent to the simple vector addition v + Δ.- Parameters:
vecTrans
- translation vector Δ- Returns:
- translation operator T(Δ) as a phase matrix
-
spatialTranslation
Create a phase matrix representing a linear translation operator on homogeneous phase space that only affects the spatial coordinates. Multiplication by the returned
PhaseMatrix
object is equivalent to translation by the givenR3
argument projected into phase space. Specifically, if the argument Δ has coordinates
Δ = (Δx, Δdy, Δdz)T
then the returned matrix T(dv) has the form|1 0 0 0 0 0 Δx| |0 1 0 0 0 0 0 | T(dv) = |0 0 1 0 0 0 Δy| |0 0 0 1 0 0 0 | |0 0 0 0 1 0 Δz| |0 0 0 0 0 1 0 | |0 0 0 0 0 0 1|
which is the translation operator in phase space restricted to the spatial coordinates.See
for further discussion of translation operators and their representation by homogeneous phase-space matrices.translation(PhaseVector)
- Parameters:
vecDispl
- the spatial displacement vector Δ- Returns:
- the translation operator matrix representation T(Δ)
- Since:
- Aug 25, 2011
- See Also:
-
rotationProduct
Compute the rotation matrix in phase space that is essentially the Cartesian product of the given rotation matrix in SO(3). That is, if the given argument is the rotation O, the returned matrix, denoted M, is the M = O×O×I embedding into homogeneous phase space R6×6×{1}. Thus, M ∈ SO(6) ⊂ R6×6×{1}.
Viewing phase-space as a 6D manifold built as the tangent bundle over R3 configuration space, then the fibers of 3D configuration space at a point (x,y,z) are represented by the Cartesian planes (x',y',z'). The returned phase matrix rotates these fibers in the same manner as their base point (x,y,z).
This is a convenience method to build the above rotation matrix in SO(7).
- Parameters:
matSO3
- a rotation matrix in three dimensions, i.e., a member of SO(3) ⊂ R3×3- Returns:
- rotation matrix in S0(7) which is direct product of rotations in S0(3)
-
parse
public static PhaseMatrix parse(String strTokens) throws IllegalArgumentException, NumberFormatException Create a PhaseMatrix instance and initialize it according to a token string of element values. The token string argument is assumed to be one-dimensional and packed by column (ala FORTRAN).- Parameters:
strTokens
- token vector of 7x7=49 numeric values- Returns:
- phase matrix with elements initialized by the given numeric tokens
- Throws:
IllegalArgumentException
- wrong number of token stringsNumberFormatException
- bad number format, unparseable
-
loadFrom
Create a newPhaseMatrix
object and initialize with the data source behind the givenDataAdaptor
interface.- Parameters:
daSource
- data source containing initialization data- Throws:
DataFormatException
- malformed data- Since:
- Jan 4, 2016, Christopher K. Allen
- See Also:
-
clone
Creates and returns a deep copy of this matrix.- Specified by:
clone
in classBaseMatrix<PhaseMatrix>
- Since:
- Jul 3, 2014
- See Also:
-
newInstance
Handles object creation required by the base class.- Specified by:
newInstance
in classBaseMatrix<PhaseMatrix>
- Parameters:
row
- Number of rows.cnt
- Number of columns.- Returns:
- uninitialized matrix object of type
M
- Since:
- Jun 17, 2014
- See Also:
-
xal.tools.math.BaseMatrix#newInstance()
-
homogenize
public void homogenize()Explicitly enforce the homogeneous nature of this matrix. That is, make sure that it is can represent a linear operator on 6D projective space which does not translate vectors. The condition is that the last row and last column consist of all zeros, except for the diagonal element, which is 1.- Since:
- Oct 10, 2013
-
projectR6x6
Projects the
PhaseMatrix
onto the space of 6×6 matrices. The projective dimension of this phase matrix is lost in the projection, that is, the homogeneous coordinate and all the actions associated with it (primarily translations).This method is useful when the phase matrix represents the statistics of a centered beam, or when it represents a transfer map without any translation.
- Returns:
- the top 6×6 diagonal block of this matrix
- Since:
- Oct 16, 2013
-
projectR4x4
Projects the
PhaseMatrix
onto the space of 4×4 matrices. The projective dimension of this phase matrix is lost in the projection, as is the longitudinal components of the matrix. that is, the last three columns and the last three rows are truncated.This method is useful when the phase matrix represents the transverse properties of a beam, or when it represents a transverse action on a beam.
- Returns:
- the top 6×6 diagonal block of this matrix
- Since:
- Oct 16, 2013
-
projectRow
Projects the ith row onto R6. Specifically, the projective element (the 7th element in this case) is dropped and that part of the ith row in the 6 dimensional phase space is returned.- Parameters:
i
- index of the matrix row to be returned, i ∈ {0,...,5}- Returns:
- matrix row at the above index, less the final projective element
- Since:
- Oct 16, 2013
- See Also:
-
projectRow
Projects the ith row onto R6. Specifically, the projective element (the 7th element in this case) is dropped and that part of the ith row in the 6 dimensional phase space is returned.- Parameters:
i
- index of the matrix row to be returned, i ∈ {0,...,5}- Returns:
- matrix row at the above index, less the final projective element
- Since:
- Oct 16, 2013
-
projectColumn
Projects the jth column onto R6. Specifically, the projective element (the 7th element in this case) is dropped and that part of the jth column in the 6 dimensional phase space is returned.- Parameters:
j
- index of the matrix column to be returned, j ∈ {0,...,5}- Returns:
- matrix row at the above index, less the final projective element
- Since:
- Oct 16, 2013
- See Also:
-
projectColumn
Projects the jth column onto R6. Specifically, the projective element (the 7th element in this case) is dropped and that part of the jth column in the 6 dimensional phase space is returned.- Parameters:
j
- index of the matrix column to be returned, j ∈ {0,...,5}- Returns:
- matrix row at the above index, less the final projective element
- Since:
- Oct 16, 2013
-
plus
Non-destructive matrix addition. The homogeneous pivot element on the diagonal is unchanged at value 1.
NOTE:
BE VERY CAREFUL when using this function. The homogeneous coordinates are not meant for addition operations.
- Overrides:
plus
in classBaseMatrix<PhaseMatrix>
- Parameters:
matAddend
- matrix to be added to this- Returns:
- element wise sum of two matrices
-
plusEquals
In-place matrix addition. The homogeneous pivot element on the diagonal is unchanged at value 1.
NOTE:
BE VERY CAREFUL when using this function. The homogeneous coordinates are not meant for addition operations.
- Overrides:
plusEquals
in classBaseMatrix<PhaseMatrix>
- Parameters:
matAddend
- matrix to be added to this (result replaces this)
-
minus
Non-destructive matrix subtraction. The homogeneous pivot element on the diagonal is unchanged at value 1.
NOTE:
BE VERY CAREFUL when using this function. The homogeneous coordinates are not meant for subtraction operations.
- Overrides:
minus
in classBaseMatrix<PhaseMatrix>
- Parameters:
matSub
- matrix to be subtracted from this one (subtrahend)- Returns:
- difference of this matrix and the given one
-
minusEquals
In-place matrix subtraction. The homogeneous pivot element on the diagonal is unchanged at value 1.
NOTE:
BE VERY CAREFUL when using this function. The homogeneous coordinates are not meant for addition operations.
- Overrides:
minusEquals
in classBaseMatrix<PhaseMatrix>
- Parameters:
matSub
- matrix to be subtracted from this matrix (result replaces this)
-
max
public double max()We must redefine the norm of any matrix on projective space to eliminate the homogeneous coordinate. See the base class
for information on the specific norm.BaseMatrix
- Overrides:
max
in classBaseMatrix<PhaseMatrix>
- Returns:
- maxi,j | Ai,j |
- Since:
- Nov 21, 2013
- See Also:
-
normInf
public double normInf()We must redefine the norm of any matrix on projective space to eliminate the homogeneous coordinate. See the base class
for information on the specific norm.BaseMatrix
- Overrides:
normInf
in classBaseMatrix<PhaseMatrix>
- Returns:
- ||M||1 = maxi Σj |Mi,j|
- Since:
- Nov 21, 2013
- See Also:
-
norm1
public double norm1()We must redefine the norm of any matrix on projective space to eliminate the homogeneous coordinate. See the base class
for information on the specific norm.BaseMatrix
- Overrides:
norm1
in classBaseMatrix<PhaseMatrix>
- Returns:
- ||M||1 = maxi Σj |Mi,j|
- Since:
- Nov 21, 2013
- See Also:
-
norm2
public double norm2()We must redefine the norm of any matrix on projective space to eliminate the homogeneous coordinate. See the base class
for information on the specific norm.BaseMatrix
- Overrides:
norm2
in classBaseMatrix<PhaseMatrix>
- Returns:
- the maximum singular value of this matrix
- Since:
- Nov 21, 2013
- See Also:
-
normF
public double normF()We must redefine the norm of any matrix on projective space to eliminate the homogeneous coordinate. See the base class
for information on the specific norm.BaseMatrix
- Overrides:
normF
in classBaseMatrix<PhaseMatrix>
- Returns:
- ||A||F = [ Σi,j Aij2 ]1/2
- Since:
- Nov 21, 2013
- See Also:
-