jsci.maths.matrices
Class AbstractDoubleMatrix
- java.lang.Object
-
- jsci.maths.matrices.Matrix
-
- jsci.maths.matrices.AbstractDoubleMatrix
-
- All Implemented Interfaces:
- java.io.Serializable, Algebra.Member, Module.Member, VectorSpace.Member, Ring.Member, AbelianGroup.Member, Member
- Direct Known Subclasses:
- AbstractDoubleSquareMatrix, DoubleMatrix, DoubleSparseMatrix
public abstract class AbstractDoubleMatrix extends Matrix
The AbstractDoubleMatrix class provides an object for encapsulating double 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.AbstractDoubleMatrixadd(AbstractDoubleMatrix m)Returns the addition of this matrix and another.AbstractDoubleMatrixdirectSum(AbstractDoubleMatrix m)Returns the direct sum of this matrix and another.booleanequals(AbstractDoubleMatrix m)Compares two ${nativeTyp} matrices for equality.booleanequals(AbstractDoubleMatrix m, double tol)booleanequals(java.lang.Object obj)Compares two ${nativeTyp} matrices for equality.doublefrobeniusNorm()Returns the Frobenius or Hilbert-Schmidt (l2) norm.abstract doublegetElement(int i, int j)Returns an element of the matrix.java.lang.ObjectgetSet()inthashCode()Returns a hashcode for this matrix.doubleinfNorm()Returns the l
-norm.AbstractDoubleMatrixmapElements(Mapping f)Applies a function on all the matrix elements.AbstractDoubleMatrixmultiply(AbstractDoubleMatrix m)Returns the multiplication of this matrix and another.AbstractDoubleVectormultiply(AbstractDoubleVector 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.AbstractDoubleMatrixscalarDivide(double x)Returns the division of this matrix by a scalar.VectorSpace.MemberscalarDivide(Field.Member x)Returns the division of this matrix by a scalar.AbstractDoubleMatrixscalarMultiply(double x)Returns the multiplication of this matrix by a scalar.Module.MemberscalarMultiply(Ring.Member x)Returns the multiplication of this matrix by a scalar.doublescalarProduct(AbstractDoubleMatrix m)Returns the scalar product of this matrix and another.abstract voidsetElement(int i, int j, double x)Sets the value of an element of the matrix.AbelianGroup.Membersubtract(AbelianGroup.Member m)Returns the subtraction of this matrix by another.AbstractDoubleMatrixsubtract(AbstractDoubleMatrix m)Returns the subtraction of this matrix by another.AbstractDoubleMatrixtensor(AbstractDoubleMatrix m)Returns the tensor product of this matrix and another.AbstractComplexMatrixtoComplexMatrix()Converts this matrix to a complex matrix.AbstractIntegerMatrixtoIntegerMatrix()Converts this matrix to an integer 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 double matrix
-
equals
public final boolean equals(AbstractDoubleMatrix 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 double matrix
-
equals
public boolean equals(AbstractDoubleMatrix 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
-
toIntegerMatrix
public AbstractIntegerMatrix toIntegerMatrix()
Converts this matrix to an integer matrix.- Returns:
- an integer matrix
-
toComplexMatrix
public AbstractComplexMatrix toComplexMatrix()
Converts this matrix to a complex matrix.- Returns:
- a complex matrix
-
getElement
public abstract double 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, double 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 double 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 AbstractDoubleMatrix add(AbstractDoubleMatrix m)
Returns the addition of this matrix and another.- Parameters:
m- a double 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 AbstractDoubleMatrix subtract(AbstractDoubleMatrix m)
Returns the subtraction of this matrix by another.- Parameters:
m- a double 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 AbstractDoubleMatrix scalarMultiply(double x)
Returns the multiplication of this matrix by a scalar.- Parameters:
x- a double.- Returns:
- a double 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
-
scalarDivide
public AbstractDoubleMatrix scalarDivide(double x)
Returns the division of this matrix by a scalar.- Parameters:
x- a double.- Returns:
- a double matrix.
-
scalarProduct
public double scalarProduct(AbstractDoubleMatrix m)
Returns the scalar product of this matrix and another.- Parameters:
m- a double matrix.- Throws:
MatrixDimensionException- If the matrices are different sizes.
-
multiply
public AbstractDoubleVector multiply(AbstractDoubleVector v)
Returns the multiplication of a vector by this matrix.- Parameters:
v- a double 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 AbstractDoubleMatrix multiply(AbstractDoubleMatrix m)
Returns the multiplication of this matrix and another.- Parameters:
m- a double matrix- Returns:
- a AbstractDoubleMatrix or a AbstractDoubleSquareMatrix as appropriate
- Throws:
MatrixDimensionException- If the matrices are incompatible.
-
directSum
public AbstractDoubleMatrix directSum(AbstractDoubleMatrix m)
Returns the direct sum of this matrix and another.
-
tensor
public AbstractDoubleMatrix tensor(AbstractDoubleMatrix m)
Returns the tensor product of this matrix and another.
-
transpose
public Matrix transpose()
Returns the transpose of this matrix.
-
mapElements
public AbstractDoubleMatrix mapElements(Mapping f)
Applies a function on all the matrix elements.- Parameters:
f- a user-defined function- Returns:
- a double matrix
-
-
DMelt 3.0 © DataMelt by jWork.ORG