All Downloads are FREE. Search and download functionalities are using the official Maven repository.

JSci.maths.matrices.IntegerDiagonalMatrix Maven / Gradle / Ivy

Go to download

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.ExtraMath;
import JSci.maths.Mapping;
import JSci.maths.DimensionException;
import JSci.maths.MaximumIterationsExceededException;
import JSci.maths.vectors.AbstractIntegerVector;
import JSci.maths.vectors.IntegerVector;
import JSci.maths.groups.AbelianGroup;
import JSci.maths.algebras.*;
import JSci.maths.fields.*;

/**
* The IntegerDiagonalMatrix class provides an object for encapsulating integer diagonal matrices.
* @version 2.3
* @author Mark Hale
*/
public class IntegerDiagonalMatrix extends AbstractIntegerSquareMatrix implements DiagonalMatrix {
        /**
        * Diagonal data.
        */
        protected final int diag[];
        /**
        * Constructs an empty matrix.
        * @param size the number of rows/columns
        */
        public IntegerDiagonalMatrix(final int size) {
                this(new int[size]);
        }
        /**
        * Constructs a matrix from an array.
        * Any non-diagonal elements in the array are ignored.
        * @param array an assigned value
        * @exception MatrixDimensionException If the array is not square.
        */
        public IntegerDiagonalMatrix(final int array[][]) {
                this(array.length);
                for(int i=0;i=0 && i=0 && j=0 && i=0 && jinfinity-norm.
        * @author Taber Smith
        */
        public int infNorm() {
                int result=Math.abs(diag[0]);
                int tmpResult;
                for(int i=1;iresult)
                                result=tmpResult;
                }
                return result;
        }
        /**
        * Returns the Frobenius (l2) norm.
        * @author Taber Smith
        */
        public double frobeniusNorm() {
                double result=diag[0];
                for(int i=1;irows()+1
        * to hold the pivot information (null if not interested).
        * The last array element will contain the parity.
        * @return an array with [0] containing the L-matrix
        * and [1] containing the U-matrix.
        */
        public AbstractDoubleSquareMatrix[] luDecompose(int pivot[]) {
                AbstractDoubleSquareMatrix[] LU = luDecompose_cache(pivot);
                if(LU != null)
                    return LU;
                if(pivot==null)
                        pivot=new int[numRows+1];
                for(int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy