Documentation of 'hephysics.matrix.SymmetricMatrix' Java class.
SymmetricMatrix
hephysics.matrix

Class SymmetricMatrix

  • All Implemented Interfaces:
    Matrix, MutableMatrix, java.io.Serializable


    public class SymmetricMatrix
    extends java.lang.Object
    implements MutableMatrix, java.io.Serializable
    A simple implementation of a symmetric matrix. A symmmetric matrix is a square matrix for which e(i,j) == e(j,i).
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      SymmetricMatrix(int size)
      Creates a new instance of SymmetricMatrix with all elements set to zero.
      SymmetricMatrix(int size, double[] initialValues, boolean isLower)
      Creates a new instance of SymmetricMatrix with the given initial values.
      SymmetricMatrix(Matrix mIn)
      Construct a SymmetricMatrix by copying an existing matrix.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      double[] asPackedArray(boolean isLower)
      Returns the matrix as a packed array
      double det() 
      double diagonal(int index)
      Returns the diagonal element for the given row/column
      double e(int x, int y)
      Returns a specific element
      int getNColumns()
      Returns the number of columns
      int getNRows()
      Returns the number of rows
      void incrementElement(int x, int y, double value)
      Increment a specific element
      void invert()
      Invert this matrix (into itself)
      void setElement(int x, int y, double value)
      Set a specific element
      java.lang.String toString() 
      void transpose()
      Tranpose this matrix (into itself)
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SymmetricMatrix

        public SymmetricMatrix(int size)
        Creates a new instance of SymmetricMatrix with all elements set to zero.
        Parameters:
        size - The rank of the matrix
      • SymmetricMatrix

        public SymmetricMatrix(Matrix mIn)
        Construct a SymmetricMatrix by copying an existing matrix. If the input matrix is a SymmetricMatrix it is copied exactly. Otherwise if the input matrix is square the lower left elements are copied If the matrix is not square an illegal argument exception is thrown.
      • SymmetricMatrix

        public SymmetricMatrix(int size,
                               double[] initialValues,
                               boolean isLower)
        Creates a new instance of SymmetricMatrix with the given initial values.
        Parameters:
        size - The rank of the matrix
        initialValues - The initial values for the matrix
        isLower - If true initial values must be m(0,0), m(1,0), m(1,1), ... otherwise m(0,0), m(0,1), m(0,2), ...
    • Method Detail

      • asPackedArray

        public double[] asPackedArray(boolean isLower)
        Returns the matrix as a packed array
        Parameters:
        isLower - if true array is packed m(0,0), m(1,0), m(1,1),... else m(0,0), m(0,1), m(0,2), ...
      • getNRows

        public int getNRows()
        Description copied from interface: Matrix
        Returns the number of rows
        Specified by:
        getNRows in interface Matrix
      • getNColumns

        public int getNColumns()
        Description copied from interface: Matrix
        Returns the number of columns
        Specified by:
        getNColumns in interface Matrix
      • diagonal

        public double diagonal(int index)
        Returns the diagonal element for the given row/column
      • e

        public double e(int x,
                        int y)
        Returns a specific element
        Specified by:
        e in interface Matrix
      • setElement

        public void setElement(int x,
                               int y,
                               double value)
        Set a specific element
        Specified by:
        setElement in interface MutableMatrix
      • incrementElement

        public void incrementElement(int x,
                                     int y,
                                     double value)
        Increment a specific element
      • det

        public double det()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object

DMelt 3.0 © DataMelt by jWork.ORG