edu.jas.vector
Class GenMatrix<C extends RingElem<C>>
- java.lang.Object
-
- edu.jas.vector.GenMatrix<C>
-
- All Implemented Interfaces:
- AbelianGroupElem<GenMatrix<C>>, AlgebraElem<GenMatrix<C>,C>, Element<GenMatrix<C>>, MonoidElem<GenMatrix<C>>, RingElem<GenMatrix<C>>, java.io.Serializable, java.lang.Comparable<GenMatrix<C>>
public class GenMatrix<C extends RingElem<C>> extends java.lang.Object implements AlgebraElem<GenMatrix<C>,C>
GenMatrix implements a generic matrix algebra over RingElem entries. Matrix has n columns and m rows over C.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description java.util.ArrayList<java.util.ArrayList<C>>matrixGenMatrixRing<C>ring
-
Constructor Summary
Constructors Constructor and Description GenMatrix(GenMatrixRing<C> r)Constructor for zero GenMatrix.GenMatrix(GenMatrixRing<C> r, java.util.ArrayList<java.util.ArrayList<C>> m)Constructor for GenMatrix.GenMatrix(GenMatrixRing<C> r, java.util.List<java.util.List<C>> m)Constructor for GenMatrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description GenMatrix<C>abs()Absolute value of this matrix.intcompareTo(GenMatrix<C> b)compareTo, lexicogaphical comparison.GenMatrix<C>copy()clone method.GenMatrix<C>divide(GenMatrix<C> S)Divide this by S.GenMatrix<C>[]egcd(GenMatrix<C> b)Extended greatest common divisor.booleanequals(java.lang.Object other)Comparison with any other object.GenMatrixRing<C>factory()Get the corresponding element factory.GenMatrix<C>gcd(GenMatrix<C> b)Greatest common divisor.Cget(int i, int j)Get element at row i, column j.inthashCode()Hash code for this GenMatrix.GenMatrix<C>inverse()Inverse of this.booleanisONE()Test if this is one.booleanisUnit()Test if this is a unit.booleanisZERO()Test if this is equal to a zero matrix.GenMatrix<C>leftLinearCombination(C s, C t, GenMatrix<C> b)left linear compination of this matrix with scalar multiple of other matrix.GenMatrix<C>leftScalarMultiply(C s)Left product of this matrix with scalar.GenMatrix<C>linearCombination(C t, GenMatrix<C> b)Left linear combination of this matrix with scalar multiple of other matrix.GenMatrix<C>linearCombination(C s, GenMatrix<C> b, C t)Linear compination of this matrix with scalar multiple of other matrix.GenMatrix<C>linearCombination(GenMatrix<C> b, C t)Linear combination of this matrix with scalar multiple of other matrix.GenMatrix<C>multiply(GenMatrix<C> S)Multiply this with S.GenMatrix<C>multiplySimple(GenMatrix<C> S)Multiply this with S.GenMatrix<C>negate()Negative of this matrix.GenMatrix<C>[]quotientRemainder(GenMatrix<C> S)Quotient and remainder by division of this by S.GenMatrix<C>remainder(GenMatrix<C> S)Remainder after division of this by S.GenMatrix<C>scalarMultiply(C s)Product of this matrix with scalar.GenMatrix<C>set(int i, int j, C el)Set element at row i, column j.voidsetMutate(int i, int j, C el)Set element at row i, column j.intsignum()sign of matrix.GenMatrix<C>subtract(GenMatrix<C> b)Difference of matrices.GenMatrix<C>sum(GenMatrix<C> b)Sum of matrices.java.lang.StringtoScript()Get a scripting compatible string representation.java.lang.StringtoScriptFactory()Get a scripting compatible string representation of the factory.java.lang.StringtoString()Get the String representation as RingElem.GenMatrix<C>transpose(GenMatrixRing<C> tr)Transposed matrix.
-
-
-
Field Detail
-
ring
public final GenMatrixRing<C extends RingElem<C>> ring
-
-
Constructor Detail
-
GenMatrix
public GenMatrix(GenMatrixRing<C> r)
Constructor for zero GenMatrix.- Parameters:
r- matrix ring
-
GenMatrix
public GenMatrix(GenMatrixRing<C> r, java.util.List<java.util.List<C>> m)
Constructor for GenMatrix.- Parameters:
r- matrix ringm- matrix
-
GenMatrix
public GenMatrix(GenMatrixRing<C> r, java.util.ArrayList<java.util.ArrayList<C>> m)
Constructor for GenMatrix.- Parameters:
r- matrix ringm- matrix
-
-
Method Detail
-
get
public C get(int i, int j)
Get element at row i, column j.- Parameters:
i- row index.j- column index.- Returns:
- this(i,j).
-
setMutate
public void setMutate(int i, int j, C el)Set element at row i, column j. Mutates this matrix.- Parameters:
i- row index.j- column index.el- element to set.
-
set
public GenMatrix<C> set(int i, int j, C el)
Set element at row i, column j.- Parameters:
i- row index.j- column index.el- element to set.- Returns:
- new matrix m, with m(i,j) == el.
-
toString
public java.lang.String toString()
Get the String representation as RingElem.- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.
-
toScriptFactory
public java.lang.String toScriptFactory()
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactoryin interfaceElement<GenMatrix<C extends RingElem<C>>>- Returns:
- script compatible representation for this ElemFactory.
- See Also:
Element.toScriptFactory()
-
factory
public GenMatrixRing<C> factory()
Get the corresponding element factory.
-
isZERO
public boolean isZERO()
Test if this is equal to a zero matrix.
-
isONE
public boolean isONE()
Test if this is one.
-
equals
public boolean equals(java.lang.Object other)
Comparison with any other object.
-
hashCode
public int hashCode()
Hash code for this GenMatrix.
-
isUnit
public boolean isUnit()
Test if this is a unit. I.e. there exists x with this.multiply(x).isONE() == true. Tests if all diagonal elements are units and all other elements are zero.
-
signum
public int signum()
sign of matrix.
-
scalarMultiply
public GenMatrix<C> scalarMultiply(C s)
Product of this matrix with scalar.- Specified by:
scalarMultiplyin interfaceAlgebraElem<GenMatrix<C extends RingElem<C>>,C extends RingElem<C>>- Parameters:
s- scalar- Returns:
- this*s
-
leftScalarMultiply
public GenMatrix<C> leftScalarMultiply(C s)
Left product of this matrix with scalar.- Returns:
- s*this
-
linearCombination
public GenMatrix<C> linearCombination(C s, GenMatrix<C> b, C t)
Linear compination of this matrix with scalar multiple of other matrix.- Specified by:
linearCombinationin interfaceAlgebraElem<GenMatrix<C extends RingElem<C>>,C extends RingElem<C>>- Parameters:
s- scalarb- algebra elementt- scalar- Returns:
- this*s+b*t
-
linearCombination
public GenMatrix<C> linearCombination(GenMatrix<C> b, C t)
Linear combination of this matrix with scalar multiple of other matrix.- Specified by:
linearCombinationin interfaceAlgebraElem<GenMatrix<C extends RingElem<C>>,C extends RingElem<C>>- Parameters:
b- algebra elementt- scalar- Returns:
- this+b*t
-
linearCombination
public GenMatrix<C> linearCombination(C t, GenMatrix<C> b)
Left linear combination of this matrix with scalar multiple of other matrix.- Returns:
- this+t*b
-
leftLinearCombination
public GenMatrix<C> leftLinearCombination(C s, C t, GenMatrix<C> b)
left linear compination of this matrix with scalar multiple of other matrix.- Returns:
- s*this+t*b
-
transpose
public GenMatrix<C> transpose(GenMatrixRing<C> tr)
Transposed matrix.- Returns:
- transpose(this)
-
multiplySimple
public GenMatrix<C> multiplySimple(GenMatrix<C> S)
Multiply this with S. Simple unblocked algorithm.- Parameters:
S-- Returns:
- this * S.
-
quotientRemainder
public GenMatrix<C>[] quotientRemainder(GenMatrix<C> S)
Quotient and remainder by division of this by S.- Parameters:
S- a GenMatrix- Returns:
- [this/S, this - (this/S)*S].
-
-
DMelt 3.0 © DataMelt by jWork.ORG