Class DBMath

java.lang.Object
org.scictrl.mp.orbitcorrect.DBMath

public final class DBMath extends Object
This class was generated by a SmartGuide.
Author:
igor@scictrl.com
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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
    Constant K_CONVENTION=K_MAD
    static final int
    Constant K_MAD=-1
    static final int
    Constant K_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 Type
    Method
    Description
    static final void
    checkDimension(double[][] matrix)
    checkDimension.
    static double[][]
    clone(double[][] m)
    Returns copy of double[][] matrix.
    static double
    cosh(double a)
    Returns the hyperbolic cosine of double 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[][]
    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[][]
    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 of double value.
    static double
    sqr(double a)
    Returns the sqare of double value.
    static double[][]
    transpond(double[][] m)
    Returns transpnder matrix.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • X_PART

      public static final int X_PART
      Tells to assamble matrix only elements concerning X axis.
      See Also:
    • Z_PART

      public static final int Z_PART
      Tells to assamble matrix only elements concerning Z axis.
      See Also:
    • BOTH

      public static final int BOTH
      Tells to assamble whole matrix.
      See Also:
    • CHARGE

      public static final double CHARGE
      Charge of electron in As.
      See Also:
    • MC2

      public static final double MC2
      m*DBMath.C^2 where m is mass of electron.
      See Also:
    • C

      public static final double C
      Speed of light in vacum.
      See Also:
    • K_MAD

      public static final int K_MAD
      Constant K_MAD=-1
      See Also:
    • K_WILLE

      public static final int K_WILLE
      Constant K_WILLE=1
      See Also:
    • K_CONVENTION

      public static byte K_CONVENTION
      Constant K_CONVENTION=K_MAD
  • Method Details

    • checkDimension

      public static final void checkDimension(double[][] matrix) throws ArrayIndexOutOfBoundsException

      checkDimension.

      Parameters:
      matrix - an array of
      invalid reference
      double
      objects
      Throws:
      ArrayIndexOutOfBoundsException - if any.
    • clone

      public static double[][] clone(double[][] m)
      Returns copy of double[][] matrix. All sub-arrays must be the same length.
      Parameters:
      m - a double[][] matrix
      Returns:
      the copy of argument
    • cosh

      public static double cosh(double a)
      Returns the hyperbolic cosine of double 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 - the double quadrupole stength of magnet
      length - the double length of magnet
      m - the double[][] matrix to be edited
      how - 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 - the double quadrupole stength of magnet
      length - the double length of magnet
      m - the double[5][5] matrix to be edited
      how - 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 of
      invalid reference
      double
      objects
      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 double
      betaZ - a double
      alphaX - a double
      alphaZ - 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 double
      betaZ - a double
      alphaX - a double
      alphaZ - a double
      m - an array of
      invalid reference
      double
      objects
      Returns:
      the double[5][5] beta matrix
    • makeBetaMatrix

      public static double[][] makeBetaMatrix(PositionedData beta, PositionedData alpha)
      Creates 5x5 matrix with beta function. Its used to transfer beta values throu system.
      Parameters:
      beta - a PositionedData object
      alpha - a PositionedData 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 double
      length - 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 double
      length - a double
      m - an array of
      invalid reference
      double
      objects
      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 double
      k - a double
      length - 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 double
      k - a double
      length - a double
      matrix - an array of
      invalid reference
      double
      objects
      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 double
      dp - a double
      Returns:
      the double[5][5] beta matrix
    • makeDispersionVector

      public static double[] makeDispersionVector(DispersionData d)
      Creates 5x5 matrix with beta function. Its used to transfer beta values throu system.
      Parameters:
      d - a DispersionData 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 double
      matrix - an array of
      invalid reference
      double
      objects
      Returns:
      the double[5][5] drift matrix
    • makeQuadrupole

      public static double[][] makeQuadrupole(double k, double length)
      Creates matrix representing quadrupole magnet.
      Parameters:
      k - a double
      length - 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 double
      length - a double
      matrix - an array of
      invalid reference
      double
      objects
      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 double
      r - 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 are X_PART and Z_PART.
      Parameters:
      m - double[5][5] transfer matrix
      beta - double beta function
      alpha - double optical function
      which - 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 with a matrix from right. Dimensions of matrices are not important, except the width of b must be the same as height of a matrix.
      Parameters:
      b - the left double[][] matrix
      a - the right double[][] 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 with a matrix from right. Dimensions of matrices are not important, except the width of b must be the same as height of a matrix.
      Parameters:
      b - the left double[][] matrix
      a - the right double[][] matrix
      c - result double[][] 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 with a vector from right. The width of b must be the same as length of a vector. Returned vector has the same length as b matrix height.
      Parameters:
      a - the right double[] vector
      x - an array of
      invalid reference
      double
      objects
      Returns:
      double[] vector product of b*a
    • sinh

      public static double sinh(double a)
      Returns the hyperbolic sinus of double value.
      Parameters:
      a - double value
      Returns:
      the hyperbolic sinus of argument
    • sqr

      public static double sqr(double a)
      Returns the sqare of double 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