Java source code of 'hephysics.matrix.SymmetricMatrix'

package hephysics.matrix;

import 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).
 * @author tonyj
 * @version $Id: SymmetricMatrix.java 9205 2006-10-24 06:06:07Z tonyj $
 */
public class SymmetricMatrix implements MutableMatrix, Serializable
{
   static final long serialVersionUID = -7824887420997633477L;
   private final double[] values;
   private final int[] startIndex;
   private final int size;
   
   /** 
    * Creates a new instance of SymmetricMatrix with all elements 
    * set to zero. 
    * @param size The rank of the matrix
    */
   public SymmetricMatrix(int size)
   {
      this.size = size;
      startIndex = new int[size];
      int ii = 0;
      for (int i=0; i=y ? startIndex[x]+y : startIndex[y]+x;
   } 
 
   public double det()
   {
      return MatrixOp.det(this);
   }
   
   public String toString()
   {
      return MatrixOp.toString(this);
   }

   public void invert() throws MatrixOp.IndeterminateMatrixException
   {
      MatrixOp.inverse(this,this);
   }

   public void transpose()
   {
      // Noop for symmetric matrix
   }
}