/* AUTO-GENERATED */
package jsci.maths.matrices;

import jsci.GlobalSettings;
import jsci.maths.ArrayMath;
import jsci.maths.Complex;
import jsci.maths.ComplexMapping;
import jsci.maths.LinearMath;
import jsci.maths.MaximumIterationsExceededException;
import jsci.maths.algebras.*;
import jsci.maths.fields.*;
import jsci.maths.groups.AbelianGroup;
import jsci.maths.vectors.AbstractComplexVector;

/**
* The AbstractComplexSquareMatrix class provides an object for encapsulating square matrices containing complex numbers.
* @version 2.2
* @author Mark Hale
*/
public abstract class AbstractComplexSquareMatrix extends AbstractComplexMatrix implements CStarAlgebra.Member, SquareMatrix {
        protected transient AbstractComplexSquareMatrix[] LU;
        protected transient int[] LUpivot;
        /**
        * Constructs a matrix.
        */
        protected AbstractComplexSquareMatrix(final int size) {
                super(size, size);
        }
        /**
        * Returns the real part of this complex matrix.
        * @return a double matrix
        */
        public AbstractDoubleMatrix real() {
                final double ans[][]=new double[numRows][numCols];
                for(int i=0;i* norm.
        */
        public double norm() {
                try {
                        return operatorNorm();
                } catch(MaximumIterationsExceededException e) {
                        throw new RuntimeException(e);
                }
        }
        /**
        * Returns the operator norm.
        * @exception MaximumIterationsExceededException If it takes more than 50 iterations to determine an eigenvalue.
        */
        public double operatorNorm() throws MaximumIterationsExceededException {
                return Math.sqrt(ArrayMath.max(LinearMath.eigenvalueSolveHermitian((AbstractComplexSquareMatrix)(this.hermitianAdjoint().multiply(this)))));
        }

//============
// OPERATIONS
//============

        /**
        * Returns the negative of this matrix.
        */
        public AbelianGroup.Member negate() {
                final double arrayRe[][]=new double[numRows][numCols];
                final double arrayIm[][]=new double[numRows][numCols];
                for(int i=0;imax) {
                                        max=tmp;
                                        pivotrow=i;
                                }
                        }
                // swap row j with pivotrow
                        if(pivotrow!=j) {
                                double[] tmprow = arrayURe[j];
                                arrayURe[j] = arrayURe[pivotrow];
                                arrayURe[pivotrow] = tmprow;
                                tmprow = arrayUIm[j];
                                arrayUIm[j] = arrayUIm[pivotrow];
                                arrayUIm[pivotrow] = tmprow;
                                int k=pivot[j];
                                pivot[j]=pivot[pivotrow];
                                pivot[pivotrow]=k;
                                // update parity
                                pivot[N]=-pivot[N];
                        }
                // divide by pivot
                        double tmpRe=arrayURe[j][j];
                        double tmpIm=arrayUIm[j][j];
                        if(Math.abs(tmpRe) 

Ads help maintain this website.