Package org.scictrl.mp.orbitcorrect
Class DBMath
java.lang.Object
org.scictrl.mp.orbitcorrect.DBMath
This class was generated by a SmartGuide.
- Author:
- igor@scictrl.com
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Tells to assamble whole matrix.static final double
Speed of light in vacum.static final double
Charge of electron in As.static byte
ConstantK_CONVENTION=K_MAD
static final int
ConstantK_MAD=-1
static final int
ConstantK_WILLE=1
static final double
m*DBMath.C^2 where m is mass of electron.static final int
Tells to assamble matrix only elements concerning X axis.static final int
Tells to assamble matrix only elements concerning Z axis. -
Method Summary
Modifier and TypeMethodDescriptionstatic final void
checkDimension
(double[][] matrix) checkDimension.static double[][]
clone
(double[][] m) Returns copy ofdouble[][]
matrix.static double
cosh
(double a) Returns the hyperbolic cosine ofdouble
value.static void
defocussing
(double k, double length, double[][] m, int how) Assembles defocusing transfere matrix for magnet with quadrupole field.static void
focussing
(double k, double length, double[][] m, int how) Assambles focusing matrix for magnet with quadrupole momentum.static double[][]
identity()
Returns 5x5 dimensional identity matrix.static double[][]
identity
(double[][] m) Returns identity matrix.static double[][]
makeBetaMatrix
(double betaX, double betaZ, double alphaX, double alphaZ) Creates 5x5 matrix with beta function.static double[][]
makeBetaMatrix
(double betaX, double betaZ, double alphaX, double alphaZ, double[][] m) Creates 5x5 matrix with beta function.static double[][]
makeBetaMatrix
(PositionedData beta, PositionedData alpha) Creates 5x5 matrix with beta function.static double[][]
makeDipole
(double r, double length) Creates matrix representing bending magnet.static double[][]
makeDipole
(double r, double k, double length) Creates matrix representing bending magnet.static double[][]
makeDipole
(double r, double length, double[][] m) Creates matrix representing bending magnet.static double[][]
makeDipole
(double r, double k, double length, double[][] matrix) Creates matrix representing bending magnet.static double[]
makeDispersionVector
(double d, double dp) Creates 5x5 matrix with beta function.static double[]
Creates 5x5 matrix with beta function.static double[][]
makeDrift
(double length) Creates matrix representing enpty drift space.static double[][]
makeDrift
(double length, double[][] matrix) Creates matrix representing enpty drift space.static double[][]
makeQuadrupole
(double k, double length) Creates matrix representing quadrupole magnet.static double[][]
makeQuadrupole
(double k, double length, double[][] matrix) Creates matrix representing quadrupole magnet.static double[][]
makeWedge
(double angle, double r) Creates 5x5 matrix representing wedge foccusing correction on rectangular bending magnet.static double
matrixPhase
(double[][] m, double beta, double alpha, int which) Return calculated phase shift of transfer matrix.static double[]
multiply
(double[][] a, double[] x) Multiplies matrix and vector.static double[][]
multiply
(double[][] b, double[][] a) Multiplies two matrices.static double[][]
multiply
(double[][] b, double[][] a, double[][] c) Multiplies two matrices.static double
sinh
(double a) Returns the hyperbolic sinus ofdouble
value.static double
sqr
(double a) Returns the sqare ofdouble
value.static double[][]
transpond
(double[][] m) Returns transpnder matrix.
-
Field Details
-
X_PART
public static final int X_PARTTells to assamble matrix only elements concerning X axis.- See Also:
-
Z_PART
public static final int Z_PARTTells to assamble matrix only elements concerning Z axis.- See Also:
-
BOTH
public static final int BOTHTells to assamble whole matrix.- See Also:
-
CHARGE
public static final double CHARGECharge of electron in As.- See Also:
-
MC2
public static final double MC2m*DBMath.C^2 where m is mass of electron.- See Also:
-
C
public static final double CSpeed of light in vacum.- See Also:
-
K_MAD
public static final int K_MADConstantK_MAD=-1
- See Also:
-
K_WILLE
public static final int K_WILLEConstantK_WILLE=1
- See Also:
-
K_CONVENTION
public static byte K_CONVENTIONConstantK_CONVENTION=K_MAD
-
-
Method Details
-
checkDimension
checkDimension.
- Parameters:
matrix
- an array ofinvalid reference
double
- Throws:
ArrayIndexOutOfBoundsException
- if any.
-
clone
public static double[][] clone(double[][] m) Returns copy ofdouble[][]
matrix. All sub-arrays must be the same length.- Parameters:
m
- adouble[][]
matrix- Returns:
- the copy of argument
-
cosh
public static double cosh(double a) Returns the hyperbolic cosine ofdouble
value.- Parameters:
a
-double
value- Returns:
- the hyperbolic cosine of argument
-
defocussing
public static void defocussing(double k, double length, double[][] m, int how) Assembles defocusing transfere matrix for magnet with quadrupole field. Defocussing part is in upper left corner and focussing in bottom right.- Parameters:
k
- thedouble
quadrupole stength of magnetlength
- thedouble
length of magnetm
- thedouble[][]
matrix to be editedhow
- it specifies which part of quadrupole matrix is to be assembeled: RingMath.X_PART, RingMath.Z_PART, RingMath.BOTH
-
focussing
public static void focussing(double k, double length, double[][] m, int how) Assambles focusing matrix for magnet with quadrupole momentum. Docussing part is in upper left corner and defocussing in bottom right.- Parameters:
k
- thedouble
quadrupole stength of magnetlength
- thedouble
length of magnetm
- thedouble[5][5]
matrix to be editedhow
- it specifies which part of quadrupole matrix is to be assambeled: RingMath.X_PART, RingMath.Z_PART, RingMath.BOTH.
-
identity
public static double[][] identity()Returns 5x5 dimensional identity matrix.- Returns:
- the
double[5][5]
identity matrix
-
identity
public static double[][] identity(double[][] m) Returns identity matrix.- Parameters:
m
- an array ofinvalid reference
double
- Returns:
- the identity matrix
-
makeBetaMatrix
public static double[][] makeBetaMatrix(double betaX, double betaZ, double alphaX, double alphaZ) Creates 5x5 matrix with beta function. Its used to transfer beta values throu system.- Parameters:
betaX
- a doublebetaZ
- a doublealphaX
- a doublealphaZ
- a double- Returns:
- the
double[5][5]
beta matrix
-
makeBetaMatrix
public static double[][] makeBetaMatrix(double betaX, double betaZ, double alphaX, double alphaZ, double[][] m) Creates 5x5 matrix with beta function. Its used to transfer beta values throu system.- Parameters:
betaX
- a doublebetaZ
- a doublealphaX
- a doublealphaZ
- a doublem
- an array ofinvalid reference
double
- Returns:
- the
double[5][5]
beta matrix
-
makeBetaMatrix
Creates 5x5 matrix with beta function. Its used to transfer beta values throu system.- Parameters:
beta
- aPositionedData
objectalpha
- aPositionedData
object- Returns:
- the
double[5][5]
beta matrix
-
makeDipole
public static double[][] makeDipole(double r, double length) Creates matrix representing bending magnet.- Parameters:
r
- a doublelength
- a double- Returns:
- the
double[5][5]
bending matrix
-
makeDipole
public static double[][] makeDipole(double r, double length, double[][] m) Creates matrix representing bending magnet.- Parameters:
r
- a doublelength
- a doublem
- an array ofinvalid reference
double
- Returns:
- the
double[5][5]
bending matrix
-
makeDipole
public static double[][] makeDipole(double r, double k, double length) Creates matrix representing bending magnet.- Parameters:
r
- a doublek
- a doublelength
- a double- Returns:
- the
double[5][5]
bending matrix
-
makeDipole
public static double[][] makeDipole(double r, double k, double length, double[][] matrix) Creates matrix representing bending magnet.- Parameters:
r
- a doublek
- a doublelength
- a doublematrix
- an array ofinvalid reference
double
- Returns:
- the
double[5][5]
bending matrix
-
makeDispersionVector
public static double[] makeDispersionVector(double d, double dp) Creates 5x5 matrix with beta function. Its used to transfer beta values throu system.- Parameters:
d
- a doubledp
- a double- Returns:
- the
double[5][5]
beta matrix
-
makeDispersionVector
Creates 5x5 matrix with beta function. Its used to transfer beta values throu system.- Parameters:
d
- aDispersionData
object- Returns:
- the
double[5][5]
beta matrix
-
makeDrift
public static double[][] makeDrift(double length) Creates matrix representing enpty drift space.- Parameters:
length
- a double- Returns:
- the
double[5][5]
drift matrix
-
makeDrift
public static double[][] makeDrift(double length, double[][] matrix) Creates matrix representing enpty drift space.- Parameters:
length
- a doublematrix
- an array ofinvalid reference
double
- Returns:
- the
double[5][5]
drift matrix
-
makeQuadrupole
public static double[][] makeQuadrupole(double k, double length) Creates matrix representing quadrupole magnet.- Parameters:
k
- a doublelength
- a double- Returns:
- the
double[5][5]
quadrupole matrix
-
makeQuadrupole
public static double[][] makeQuadrupole(double k, double length, double[][] matrix) Creates matrix representing quadrupole magnet.- Parameters:
k
- a doublelength
- a doublematrix
- an array ofinvalid reference
double
- Returns:
- the
double[5][5]
quadrupole matrix
-
makeWedge
public static double[][] makeWedge(double angle, double r) Creates 5x5 matrix representing wedge foccusing correction on rectangular bending magnet. If dipole magnet is rectangular, it's matrix is multiplyed from left and right with this matrix.- Parameters:
angle
- a doubler
- a double- Returns:
- the
double[5][5]
wedge focussing matrix
-
matrixPhase
public static double matrixPhase(double[][] m, double beta, double alpha, int which) Return calculated phase shift of transfer matrix.which
tells wich space axsis to calculate. Valid values areX_PART
andZ_PART
.- Parameters:
m
-double[5][5]
transfer matrixbeta
-double
beta functionalpha
-double
optical functionwhich
- axsis to be calculated- Returns:
double
calculated phase shift
-
multiply
public static double[][] multiply(double[][] b, double[][] a) Multiplies two matrices.b
matrix is multiplied witha
matrix from right. Dimensions of matrices are not important, except the width ofb
must be the same as height ofa
matrix.- Parameters:
b
- the leftdouble[][]
matrixa
- the rightdouble[][]
matrix- Returns:
double[][]
product of b*a
-
multiply
public static double[][] multiply(double[][] b, double[][] a, double[][] c) Multiplies two matrices.b
matrix is multiplied witha
matrix from right. Dimensions of matrices are not important, except the width ofb
must be the same as height ofa
matrix.- Parameters:
b
- the leftdouble[][]
matrixa
- the rightdouble[][]
matrixc
- resultdouble[][]
matrix- Returns:
double[][]
product of c=b*a
-
multiply
public static double[] multiply(double[][] a, double[] x) Multiplies matrix and vector.b
matrix is multiplied witha
vector from right. The width ofb
must be the same as length ofa
vector. Returned vector has the same length asb
matrix height.- Parameters:
a
- the rightdouble[]
vectorx
- an array ofinvalid reference
double
- Returns:
double[]
vector product of b*a
-
sinh
public static double sinh(double a) Returns the hyperbolic sinus ofdouble
value.- Parameters:
a
-double
value- Returns:
- the hyperbolic sinus of argument
-
sqr
public static double sqr(double a) Returns the sqare ofdouble
value.- Parameters:
a
-double
value- Returns:
- the square of argument
-
transpond
public static double[][] transpond(double[][] m) Returns transpnder matrix.- Parameters:
m
-double[][]
argument matrix- Returns:
double[][]
transponded matrix
-