jsci.maths.matrices
Class IntegerMatrix
- java.lang.Object
-
- jsci.maths.matrices.Matrix
-
- jsci.maths.matrices.AbstractIntegerMatrix
-
- jsci.maths.matrices.IntegerMatrix
-
- All Implemented Interfaces:
- java.io.Serializable, Algebra.Member, Module.Member, VectorSpace.Member, Ring.Member, AbelianGroup.Member, Member
public class IntegerMatrix extends AbstractIntegerMatrix
The IntegerMatrix class provides an object for encapsulating integer matrices.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description IntegerMatrix(AbstractIntegerVector[] array)Constructs a matrix from an array of vectors (columns).IntegerMatrix(int[][] array)Constructs a matrix by wrapping an array.IntegerMatrix(int rows, int cols)Constructs an empty matrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description AbstractIntegerMatrixadd(AbstractIntegerMatrix m)Returns the addition of this matrix and another.AbstractIntegerMatrixdirectSum(AbstractIntegerMatrix m)Returns the direct sum of this matrix and another.booleanequals(AbstractIntegerMatrix m, double tol)Compares two ${nativeTyp} matrices for equality.doublefrobeniusNorm()Returns the Frobenius or Hilbert-Schmidt (l2) norm.intgetElement(int i, int j)Returns an element of the matrix.intinfNorm()Returns the l
-norm.AbstractIntegerMatrixmultiply(AbstractIntegerMatrix m)Returns the multiplication of this matrix and another.AbstractIntegerVectormultiply(AbstractIntegerVector v)Returns the multiplication of a vector by this matrix.AbstractIntegerMatrixmultiply(IntegerMatrix m)AbelianGroup.Membernegate()Returns the negative of this matrix.AbstractIntegerMatrixscalarMultiply(int x)Returns the multiplication of this matrix by a scalar.intscalarProduct(AbstractIntegerMatrix m)Returns the scalar product of this matrix and another.intscalarProduct(IntegerMatrix m)voidsetElement(int i, int j, int x)Sets the value of an element of the matrix.AbstractIntegerMatrixsubtract(AbstractIntegerMatrix m)Returns the subtraction of this matrix by another.AbstractIntegerMatrixtensor(AbstractIntegerMatrix m)Returns the tensor product of this matrix and another.AbstractComplexMatrixtoComplexMatrix()Converts this matrix to a complex matrix.AbstractDoubleMatrixtoDoubleMatrix()Converts this matrix to a double matrix.java.lang.StringtoString()Returns a string representing this matrix.Matrixtranspose()Returns the transpose of this matrix.-
Methods inherited from class jsci.maths.matrices.AbstractIntegerMatrix
add, equals, equals, getSet, hashCode, multiply, scalarDivide, scalarMultiply, subtract
-
-
-
-
Constructor Detail
-
IntegerMatrix
public IntegerMatrix(int[][] array)
Constructs a matrix by wrapping an array.- Parameters:
array- an assigned value
-
IntegerMatrix
public IntegerMatrix(int rows, int cols)Constructs an empty matrix.
-
IntegerMatrix
public IntegerMatrix(AbstractIntegerVector[] array)
Constructs a matrix from an array of vectors (columns).- Parameters:
array- an assigned value
-
-
Method Detail
-
equals
public boolean equals(AbstractIntegerMatrix m, double tol)
Compares two ${nativeTyp} matrices for equality.- Overrides:
equalsin classAbstractIntegerMatrix- Parameters:
m- a int matrix
-
toString
public java.lang.String toString()
Returns a string representing this matrix.- Overrides:
toStringin classAbstractIntegerMatrix
-
toDoubleMatrix
public AbstractDoubleMatrix toDoubleMatrix()
Converts this matrix to a double matrix.- Overrides:
toDoubleMatrixin classAbstractIntegerMatrix- Returns:
- a double matrix
-
toComplexMatrix
public AbstractComplexMatrix toComplexMatrix()
Converts this matrix to a complex matrix.- Overrides:
toComplexMatrixin classAbstractIntegerMatrix- Returns:
- a complex matrix
-
getElement
public int getElement(int i, int j)Returns an element of the matrix.- Specified by:
getElementin classAbstractIntegerMatrix- Parameters:
i- row index of the elementj- column index of the element- Throws:
MatrixDimensionException- If attempting to access an invalid element.
-
setElement
public void setElement(int i, int j, int x)Sets the value of an element of the matrix. Should only be used to initialise this matrix.- Specified by:
setElementin classAbstractIntegerMatrix- Parameters:
i- row index of the elementj- column index of the elementx- a number- Throws:
MatrixDimensionException- If attempting to access an invalid element.
-
infNorm
public int infNorm()
Returns the l
-norm.- Overrides:
infNormin classAbstractIntegerMatrix
-
frobeniusNorm
public double frobeniusNorm()
Returns the Frobenius or Hilbert-Schmidt (l2) norm.- Overrides:
frobeniusNormin classAbstractIntegerMatrix
-
negate
public AbelianGroup.Member negate()
Returns the negative of this matrix.- Specified by:
negatein interfaceAbelianGroup.Member- Overrides:
negatein classAbstractIntegerMatrix
-
add
public AbstractIntegerMatrix add(AbstractIntegerMatrix m)
Returns the addition of this matrix and another.- Overrides:
addin classAbstractIntegerMatrix- Parameters:
m- a int matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
subtract
public AbstractIntegerMatrix subtract(AbstractIntegerMatrix m)
Returns the subtraction of this matrix by another.- Overrides:
subtractin classAbstractIntegerMatrix- Parameters:
m- a int matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
scalarMultiply
public AbstractIntegerMatrix scalarMultiply(int x)
Returns the multiplication of this matrix by a scalar.- Overrides:
scalarMultiplyin classAbstractIntegerMatrix- Parameters:
x- a int.- Returns:
- a int matrix.
-
scalarProduct
public int scalarProduct(AbstractIntegerMatrix m)
Returns the scalar product of this matrix and another.- Overrides:
scalarProductin classAbstractIntegerMatrix- Parameters:
m- a int matrix.- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
scalarProduct
public int scalarProduct(IntegerMatrix m)
-
multiply
public AbstractIntegerVector multiply(AbstractIntegerVector v)
Returns the multiplication of a vector by this matrix.- Overrides:
multiplyin classAbstractIntegerMatrix- Parameters:
v- a int vector.- Throws:
DimensionException- If the matrix and vector are incompatible.
-
multiply
public AbstractIntegerMatrix multiply(AbstractIntegerMatrix m)
Returns the multiplication of this matrix and another.- Overrides:
multiplyin classAbstractIntegerMatrix- Parameters:
m- a int matrix- Returns:
- a AbstractIntegerMatrix or a AbstractIntegerSquareMatrix as appropriate
- Throws:
MatrixDimensionException- If the matrices are incompatible.
-
multiply
public AbstractIntegerMatrix multiply(IntegerMatrix m)
-
directSum
public AbstractIntegerMatrix directSum(AbstractIntegerMatrix m)
Returns the direct sum of this matrix and another.- Overrides:
directSumin classAbstractIntegerMatrix
-
tensor
public AbstractIntegerMatrix tensor(AbstractIntegerMatrix m)
Returns the tensor product of this matrix and another.- Overrides:
tensorin classAbstractIntegerMatrix
-
transpose
public Matrix transpose()
Returns the transpose of this matrix.- Overrides:
transposein classAbstractIntegerMatrix- Returns:
- a int matrix
-
-
DMelt 3.0 © DataMelt by jWork.ORG