edu.jas.vector
Class GenMatrix<C extends RingElem<C>>

java.lang.Object
  extended by 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.Cloneable, 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.

Author:
Heinz Kredel
See Also:
Serialized Form

Field Summary
 java.util.ArrayList<java.util.ArrayList<C>> matrix
           
 GenMatrixRing<C> ring
           
 java.util.List<C> val
           
 
Constructor Summary
  GenMatrix(GenMatrixRing<C> r)
          Constructors for GenMatrix.
protected GenMatrix(GenMatrixRing<C> r, java.util.ArrayList<java.util.ArrayList<C>> m)
           
 
Method Summary
 GenMatrix<C> abs()
          Absolute value of this matrix.
 GenMatrix<C> clone()
          clone method.
 int compareTo(GenMatrix<C> b)
          compareTo, lexicogaphical comparison.
 GenMatrix<C> divide(GenMatrix<C> S)
          Divide this by S.
 GenMatrix<C>[] egcd(GenMatrix<C> b)
          Extended greatest common divisor.
 boolean equals(java.lang.Object other)
          equals method.
 GenMatrix<C> gcd(GenMatrix<C> b)
          Greatest common divisor.
 int hashCode()
          Hash code for this GenMatrix.
 GenMatrix<C> inverse()
          Inverse of this.
 boolean isONE()
          Test if this is one.
 boolean isUnit()
          Test if this is a unit.
 boolean isZERO()
          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 compination 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 compination 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> remainder(GenMatrix<C> S)
          Remainder after division of this by S.
 GenMatrix<C> scalarMultiply(C s)
          Product of this matrix with scalar.
 int signum()
          sign of matrix.
 GenMatrix<C> subtract(GenMatrix<C> b)
          Difference of matrices.
 GenMatrix<C> sum(GenMatrix<C> b)
          Sum of matrices.
 java.lang.String toString()
          toString method.
 GenMatrix<C> transpose(GenMatrixRing<C> tr)
          Transposed matrix.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ring

public final GenMatrixRing<C extends RingElem<C>> ring

val

public final java.util.List<C extends RingElem<C>> val

matrix

public final java.util.ArrayList<java.util.ArrayList<C extends RingElem<C>>> matrix
Constructor Detail

GenMatrix

public GenMatrix(GenMatrixRing<C> r)
Constructors for GenMatrix.


GenMatrix

protected GenMatrix(GenMatrixRing<C> r,
                    java.util.ArrayList<java.util.ArrayList<C>> m)
Method Detail

toString

public java.lang.String toString()
toString method.

Overrides:
toString in class java.lang.Object

clone

public GenMatrix<C> clone()
clone method.

Specified by:
clone in interface Element<GenMatrix<C extends RingElem<C>>>
Overrides:
clone in class java.lang.Object
Returns:
Creates and returns a copy of this Elemnt.

isZERO

public boolean isZERO()
test if this is equal to a zero matrix.

Specified by:
isZERO in interface AbelianGroupElem<GenMatrix<C extends RingElem<C>>>
Returns:
true if this is 0, else false.

isONE

public boolean isONE()
Test if this is one.

Specified by:
isONE in interface MonoidElem<GenMatrix<C extends RingElem<C>>>
Returns:
true if this is 1, else false.

equals

public boolean equals(java.lang.Object other)
equals method.

Specified by:
equals in interface Element<GenMatrix<C extends RingElem<C>>>
Overrides:
equals in class java.lang.Object
Returns:
true if this is equal to b, else false.

hashCode

public int hashCode()
Hash code for this GenMatrix.

Specified by:
hashCode in interface Element<GenMatrix<C extends RingElem<C>>>
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()
Returns:
the hashCode.

compareTo

public int compareTo(GenMatrix<C> b)
compareTo, lexicogaphical comparison.

Specified by:
compareTo in interface Element<GenMatrix<C extends RingElem<C>>>
Specified by:
compareTo in interface java.lang.Comparable<GenMatrix<C extends RingElem<C>>>
Parameters:
b - other
Returns:
1 if (this < b), 0 if (this == b) or -1 if (this > b).

isUnit

public boolean isUnit()
Test if this is a unit. I.e. there exists x with this.multiply(x).isONE() == true.

Specified by:
isUnit in interface MonoidElem<GenMatrix<C extends RingElem<C>>>
Returns:
true if this is a unit, else false.

signum

public int signum()
sign of matrix.

Specified by:
signum in interface AbelianGroupElem<GenMatrix<C extends RingElem<C>>>
Returns:
1 if (this < 0), 0 if (this == 0) or -1 if (this > 0).

sum

public GenMatrix<C> sum(GenMatrix<C> b)
Sum of matrices.

Specified by:
sum in interface AbelianGroupElem<GenMatrix<C extends RingElem<C>>>
Returns:
this+b

subtract

public GenMatrix<C> subtract(GenMatrix<C> b)
Difference of matrices.

Specified by:
subtract in interface AbelianGroupElem<GenMatrix<C extends RingElem<C>>>
Returns:
this-b

negate

public GenMatrix<C> negate()
Negative of this matrix.

Specified by:
negate in interface AbelianGroupElem<GenMatrix<C extends RingElem<C>>>
Returns:
-this

abs

public GenMatrix<C> abs()
Absolute value of this matrix.

Specified by:
abs in interface AbelianGroupElem<GenMatrix<C extends RingElem<C>>>
Returns:
abs(this)

scalarMultiply

public GenMatrix<C> scalarMultiply(C s)
Product of this matrix with scalar.

Specified by:
scalarMultiply in interface AlgebraElem<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:
linearCombination in interface AlgebraElem<GenMatrix<C extends RingElem<C>>,C extends RingElem<C>>
Parameters:
s - scalar
b - algebra element
t - scalar
Returns:
this*s+b*t

linearCombination

public GenMatrix<C> linearCombination(GenMatrix<C> b,
                                      C t)
Linear compination of this matrix with scalar multiple of other matrix.

Specified by:
linearCombination in interface AlgebraElem<GenMatrix<C extends RingElem<C>>,C extends RingElem<C>>
Parameters:
b - algebra element
t - scalar
Returns:
this+b*t

linearCombination

public GenMatrix<C> linearCombination(C t,
                                      GenMatrix<C> b)
Left linear compination 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)

multiply

public GenMatrix<C> multiply(GenMatrix<C> S)
Multiply this with S.

Specified by:
multiply in interface MonoidElem<GenMatrix<C extends RingElem<C>>>
Parameters:
S -
Returns:
this * S.

multiplySimple

public GenMatrix<C> multiplySimple(GenMatrix<C> S)
Multiply this with S. Simple unblocked algorithm.

Parameters:
S -
Returns:
this * S.

divide

public GenMatrix<C> divide(GenMatrix<C> S)
Divide this by S.

Specified by:
divide in interface MonoidElem<GenMatrix<C extends RingElem<C>>>
Parameters:
S -
Returns:
this / S.

remainder

public GenMatrix<C> remainder(GenMatrix<C> S)
Remainder after division of this by S.

Specified by:
remainder in interface MonoidElem<GenMatrix<C extends RingElem<C>>>
Parameters:
S -
Returns:
this - (this / S) * S.

inverse

public GenMatrix<C> inverse()
Inverse of this.

Specified by:
inverse in interface MonoidElem<GenMatrix<C extends RingElem<C>>>
Returns:
x with this * x = 1, if it exists.

gcd

public GenMatrix<C> gcd(GenMatrix<C> b)
Greatest common divisor.

Specified by:
gcd in interface RingElem<GenMatrix<C extends RingElem<C>>>
Parameters:
b - other element.
Returns:
gcd(this,b).

egcd

public GenMatrix<C>[] egcd(GenMatrix<C> b)
Extended greatest common divisor.

Specified by:
egcd in interface RingElem<GenMatrix<C extends RingElem<C>>>
Parameters:
b - other element.
Returns:
[ gcd(this,b), c1, c2 ] with c1*this + c2*b = gcd(this,b).