JSci.maths.matrices.ComplexDiagonalMatrix.vm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsci Show documentation
Show all versions of jsci Show documentation
JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software.
It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ...
Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).
The newest version!
/* 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.3
* @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