jsci.maths.matrices
Class AbstractIntegerMatrix
- java.lang.Object
-
- jsci.maths.matrices.Matrix
-
- jsci.maths.matrices.AbstractIntegerMatrix
-
- All Implemented Interfaces:
- java.io.Serializable, Algebra.Member, Module.Member, VectorSpace.Member, Ring.Member, AbelianGroup.Member, Member
- Direct Known Subclasses:
- AbstractIntegerSquareMatrix, IntegerMatrix
public abstract class AbstractIntegerMatrix extends Matrix
The AbstractIntegerMatrix class provides an object for encapsulating integer matrices.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description AbelianGroup.Memberadd(AbelianGroup.Member m)Returns the addition of this matrix and another.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)Compares two ${nativeTyp} matrices for equality.booleanequals(AbstractIntegerMatrix m, double tol)booleanequals(java.lang.Object obj)Compares two ${nativeTyp} matrices for equality.doublefrobeniusNorm()Returns the Frobenius or Hilbert-Schmidt (l2) norm.abstract intgetElement(int i, int j)Returns an element of the matrix.java.lang.ObjectgetSet()inthashCode()Returns a hashcode for this 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.Ring.Membermultiply(Ring.Member m)Returns the multiplication of this matrix and another.AbelianGroup.Membernegate()Returns the negative of this matrix.VectorSpace.MemberscalarDivide(Field.Member x)Returns the division of this matrix by a scalar.AbstractIntegerMatrixscalarMultiply(int x)Returns the multiplication of this matrix by a scalar.Module.MemberscalarMultiply(Ring.Member x)Returns the multiplication of this matrix by a scalar.intscalarProduct(AbstractIntegerMatrix m)Returns the scalar product of this matrix and another.abstract voidsetElement(int i, int j, int x)Sets the value of an element of the matrix.AbelianGroup.Membersubtract(AbelianGroup.Member m)Returns the subtraction of this matrix by another.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.
-
-
-
Method Detail
-
equals
public final boolean equals(java.lang.Object obj)
Compares two ${nativeTyp} matrices for equality.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- a int matrix
-
equals
public final boolean equals(AbstractIntegerMatrix m)
Compares two ${nativeTyp} matrices for equality. Two matrices are considered to be equal if the Frobenius norm of their difference is within the zero tolerance.- Parameters:
m- a int matrix
-
equals
public boolean equals(AbstractIntegerMatrix m, double tol)
-
toString
public java.lang.String toString()
Returns a string representing this matrix.- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
Returns a hashcode for this matrix.- Overrides:
hashCodein classjava.lang.Object
-
toDoubleMatrix
public AbstractDoubleMatrix toDoubleMatrix()
Converts this matrix to a double matrix.- Returns:
- a double matrix
-
toComplexMatrix
public AbstractComplexMatrix toComplexMatrix()
Converts this matrix to a complex matrix.- Returns:
- a complex matrix
-
getElement
public abstract int getElement(int i, int j)Returns an element of the matrix.- Parameters:
i- row index of the elementj- column index of the element- Throws:
MatrixDimensionException- If attempting to access an invalid element.
-
setElement
public abstract 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.- Parameters:
i- row index of the elementj- column index of the elementx- a number- Throws:
MatrixDimensionException- If attempting to access an invalid element.
-
getSet
public final java.lang.Object getSet()
-
infNorm
public int infNorm()
Returns the l
-norm.
-
frobeniusNorm
public double frobeniusNorm()
Returns the Frobenius or Hilbert-Schmidt (l2) norm.
-
negate
public AbelianGroup.Member negate()
Returns the negative of this matrix.
-
add
public final AbelianGroup.Member add(AbelianGroup.Member m)
Returns the addition of this matrix and another.- Parameters:
m- a group member
-
add
public AbstractIntegerMatrix add(AbstractIntegerMatrix m)
Returns the addition of this matrix and another.- Parameters:
m- a int matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
subtract
public final AbelianGroup.Member subtract(AbelianGroup.Member m)
Returns the subtraction of this matrix by another.- Parameters:
m- a group member
-
subtract
public AbstractIntegerMatrix subtract(AbstractIntegerMatrix m)
Returns the subtraction of this matrix by another.- Parameters:
m- a int matrix- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
scalarMultiply
public final Module.Member scalarMultiply(Ring.Member x)
Returns the multiplication of this matrix by a scalar.- Parameters:
x- a ring member
-
scalarMultiply
public AbstractIntegerMatrix scalarMultiply(int x)
Returns the multiplication of this matrix by a scalar.- Parameters:
x- a int.- Returns:
- a int matrix.
-
scalarDivide
public final VectorSpace.Member scalarDivide(Field.Member x)
Returns the division of this matrix by a scalar. Always throws an exception.- Parameters:
x- a field member
-
scalarProduct
public int scalarProduct(AbstractIntegerMatrix m)
Returns the scalar product of this matrix and another.- Parameters:
m- a int matrix.- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
multiply
public AbstractIntegerVector multiply(AbstractIntegerVector v)
Returns the multiplication of a vector by this matrix.- Parameters:
v- a int vector.- Throws:
DimensionException- If the matrix and vector are incompatible.
-
multiply
public final Ring.Member multiply(Ring.Member m)
Returns the multiplication of this matrix and another.- Parameters:
m- a ring member
-
multiply
public AbstractIntegerMatrix multiply(AbstractIntegerMatrix m)
Returns the multiplication of this matrix and another.- Parameters:
m- a int matrix- Returns:
- a AbstractIntegerMatrix or a AbstractIntegerSquareMatrix as appropriate
- Throws:
MatrixDimensionException- If the matrices are incompatible.
-
directSum
public AbstractIntegerMatrix directSum(AbstractIntegerMatrix m)
Returns the direct sum of this matrix and another.
-
tensor
public AbstractIntegerMatrix tensor(AbstractIntegerMatrix m)
Returns the tensor product of this matrix and another.
-
-
DMelt 3.0 © DataMelt by jWork.ORG