/* AUTO-GENERATED */
package jsci.maths.matrices;
import jsci.maths.Complex;
import jsci.maths.ComplexMapping;
import jsci.maths.DimensionException;
import jsci.maths.vectors.AbstractComplexVector;
import jsci.maths.vectors.ComplexVector;
/**
* The ComplexDiagonalMatrix class provides an object for encapsulating diagonal matrices containing complex numbers.
* Uses compressed diagonal storage.
* @version 2.2
* @author Mark Hale
*/
public class ComplexDiagonalMatrix extends AbstractComplexSquareMatrix implements DiagonalMatrix {
/**
* Arrays containing the elements of the matrix.
*/
protected final double diagRe[],diagIm[];
/**
* Constructs a matrix by wrapping two arrays containing the diagonal elements.
* @param arrayRe an array of real values
* @param arrayIm an array of imaginary values
*/
public ComplexDiagonalMatrix(final double arrayRe[],final double arrayIm[]) {
super(arrayRe.length);
diagRe=arrayRe;
diagIm=arrayIm;
}
/**
* Constructs an empty matrix.
* @param size the number of rows/columns
*/
public ComplexDiagonalMatrix(final int size) {
this(new double[size], new double[size]);
}
/**
* Constructs a matrix from an array.
* @param array an assigned value
* @exception MatrixDimensionException If the array is not square.
*/
public ComplexDiagonalMatrix(final Complex array[][]) {
this(array.length);
for(int i=0;i=0 && i=0 && j=0 && i=0 && j=0 && i=0 && j=0 && i=0 && j=0 && i=0 && j
-norm.
* @author Taber Smith
*/
public double infNorm() {
double result=diagRe[0]*diagRe[0]+diagIm[0]*diagIm[0];
double tmpResult;
for(int i=1;iresult)
result=tmpResult;
}
return Math.sqrt(result);
}
/**
* Returns the Frobenius (l2) norm.
* @author Taber Smith
*/
public double frobeniusNorm() {
double result=diagRe[0]*diagRe[0]+diagIm[0]*diagIm[0];
for(int i=1;i
Ads help maintain this website.