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

java.lang.Object
  extended by edu.jas.vector.GenMatrixRing<C>
All Implemented Interfaces:
AbelianGroupFactory<GenMatrix<C>>, AlgebraFactory<GenMatrix<C>,C>, ElemFactory<GenMatrix<C>>, MonoidFactory<GenMatrix<C>>, RingFactory<GenMatrix<C>>, java.io.Serializable

public class GenMatrixRing<C extends RingElem<C>>
extends java.lang.Object
implements AlgebraFactory<GenMatrix<C>,C>

GenMatrixRing implements a generic matrix algebra factory with RingFactory. Matrices of n rows and m columns over C.

Author:
Heinz Kredel
See Also:
Serialized Form

Field Summary
 int blocksize
           
 RingFactory<C> coFac
           
 int cols
           
static int DEFAULT_BSIZE
           
static float DEFAULT_DENSITY
           
 GenMatrix<C> ONE
           
 int rows
           
 GenMatrix<C> ZERO
           
 
Constructor Summary
GenMatrixRing(RingFactory<C> b, int r, int c)
          Constructors for GenMatrixRing.
GenMatrixRing(RingFactory<C> b, int r, int c, int s)
          Constructors for GenMatrixRing.
 
Method Summary
 java.math.BigInteger characteristic()
          Characteristic of this ring.
 GenMatrix<C> copy(GenMatrix<C> c)
          copy matrix.
 boolean equals(java.lang.Object other)
          Comparison with any other object.
 GenMatrix<C> fromInteger(java.math.BigInteger a)
          Get the matrix for a.
 GenMatrix<C> fromInteger(long a)
          Get the matrix for a.
 GenMatrix<C> fromList(java.util.List<java.util.List<C>> om)
          From List of coefficients.
 java.util.List<GenMatrix<C>> generators()
          Get a list of the generating elements.
 GenMatrix<C> getONE()
          Get the constant one for the GenMatrix.
 GenMatrix<C> getZERO()
          Get the constant one for the GenMatrix.
 int hashCode()
          Hash code for this matrix ring.
 boolean isAssociative()
          Query if this ring is associative.
 boolean isCommutative()
          Query if this monoid is commutative.
 boolean isField()
          Query if this ring is a field.
 boolean isFinite()
          Is this structure finite or infinite.
 GenMatrix<C> parse(java.io.Reader r)
          parse a matrix from a Reader.
 GenMatrix<C> parse(java.lang.String s)
          parse a matrix from a String.
 GenMatrixRing<C> product(GenMatrixRing<C> other)
          Product matrix ring for multiplication.
 GenMatrix<C> random(int k)
          Random matrix.
 GenMatrix<C> random(int k, float q)
          Random matrix.
 GenMatrix<C> random(int k, float q, java.util.Random random)
          Random matrix.
 GenMatrix<C> random(int k, java.util.Random random)
          Random matrix.
 GenMatrix<C> randomLower(int k, float q)
          Random lower triangular matrix.
 GenMatrix<C> randomLower(int k, float q, java.util.Random random)
          Random lower triangular matrix.
 GenMatrix<C> randomUpper(int k, float q)
          Random upper triangular matrix.
 GenMatrix<C> randomUpper(int k, float q, java.util.Random random)
          Random upper triangular matrix.
 java.lang.String toScript()
          Get a scripting compatible string representation.
 java.lang.String toString()
          Get the String representation as RingElem.
 GenMatrixRing<C> transpose()
          Transposed matrix ring.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

coFac

public final RingFactory<C extends RingElem<C>> coFac

rows

public final int rows

cols

public final int cols

blocksize

public final int blocksize

DEFAULT_BSIZE

public static final int DEFAULT_BSIZE
See Also:
Constant Field Values

ZERO

public final GenMatrix<C extends RingElem<C>> ZERO

ONE

public final GenMatrix<C extends RingElem<C>> ONE

DEFAULT_DENSITY

public static final float DEFAULT_DENSITY
See Also:
Constant Field Values
Constructor Detail

GenMatrixRing

public GenMatrixRing(RingFactory<C> b,
                     int r,
                     int c)
Constructors for GenMatrixRing.

Parameters:
b - coefficient factory.
r - number of rows.
c - number of colums.

GenMatrixRing

public GenMatrixRing(RingFactory<C> b,
                     int r,
                     int c,
                     int s)
Constructors for GenMatrixRing.

Parameters:
b - coefficient factory.
r - number of rows.
c - number of colums.
s - block size for blocked operations.
Method Detail

toString

public java.lang.String toString()
Get the String representation as RingElem.

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

toScript

public java.lang.String toScript()
Get a scripting compatible string representation.

Specified by:
toScript in interface ElemFactory<GenMatrix<C extends RingElem<C>>>
Returns:
script compatible representation for this ElemFactory.
See Also:
ElemFactory.toScript()

getZERO

public GenMatrix<C> getZERO()
Get the constant one for the GenMatrix.

Specified by:
getZERO in interface AbelianGroupFactory<GenMatrix<C extends RingElem<C>>>
Returns:
ZERO.

getONE

public GenMatrix<C> getONE()
Get the constant one for the GenMatrix.

Specified by:
getONE in interface MonoidFactory<GenMatrix<C extends RingElem<C>>>
Returns:
1.

generators

public java.util.List<GenMatrix<C>> generators()
Get a list of the generating elements.

Specified by:
generators in interface ElemFactory<GenMatrix<C extends RingElem<C>>>
Returns:
list of generators for the algebraic structure.
See Also:
ElemFactory.generators()

isFinite

public boolean isFinite()
Is this structure finite or infinite.

Specified by:
isFinite in interface ElemFactory<GenMatrix<C extends RingElem<C>>>
Returns:
true if this structure is finite, else false.
See Also:
ElemFactory.isFinite()

equals

public boolean equals(java.lang.Object other)
Comparison with any other object.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Hash code for this matrix ring.

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

isField

public boolean isField()
Query if this ring is a field. May return false if it is to hard to determine if this ring is a field.

Specified by:
isField in interface RingFactory<GenMatrix<C extends RingElem<C>>>
Returns:
true if it is known that this ring is a field, else false.

isCommutative

public boolean isCommutative()
Query if this monoid is commutative.

Specified by:
isCommutative in interface MonoidFactory<GenMatrix<C extends RingElem<C>>>
Returns:
true if this monoid is commutative, else false.

isAssociative

public boolean isAssociative()
Query if this ring is associative.

Specified by:
isAssociative in interface MonoidFactory<GenMatrix<C extends RingElem<C>>>
Returns:
true if this monoid is associative, else false.

characteristic

public java.math.BigInteger characteristic()
Characteristic of this ring.

Specified by:
characteristic in interface RingFactory<GenMatrix<C extends RingElem<C>>>
Returns:
characteristic of this ring.

transpose

public GenMatrixRing<C> transpose()
Transposed matrix ring.

Returns:
transposed ring factory.

product

public GenMatrixRing<C> product(GenMatrixRing<C> other)
Product matrix ring for multiplication.

Parameters:
other - matrix ring factory.
Returns:
product ring factory.

fromInteger

public GenMatrix<C> fromInteger(long a)
Get the matrix for a.

Specified by:
fromInteger in interface ElemFactory<GenMatrix<C extends RingElem<C>>>
Parameters:
a - long
Returns:
matrix corresponding to a.

fromInteger

public GenMatrix<C> fromInteger(java.math.BigInteger a)
Get the matrix for a.

Specified by:
fromInteger in interface ElemFactory<GenMatrix<C extends RingElem<C>>>
Parameters:
a - long
Returns:
matrix corresponding to a.

fromList

public GenMatrix<C> fromList(java.util.List<java.util.List<C>> om)
From List of coefficients.

Specified by:
fromList in interface AlgebraFactory<GenMatrix<C extends RingElem<C>>,C extends RingElem<C>>
Parameters:
om - list of list of coefficients.
Returns:
a matrix with the elements from m.

random

public GenMatrix<C> random(int k)
Random matrix.

Specified by:
random in interface ElemFactory<GenMatrix<C extends RingElem<C>>>
Parameters:
k - size of random coefficients.
Returns:
a random element.

random

public GenMatrix<C> random(int k,
                           float q)
Random matrix.

Specified by:
random in interface AlgebraFactory<GenMatrix<C extends RingElem<C>>,C extends RingElem<C>>
Parameters:
k - size of random coefficients.
q - density of nozero coefficients.
Returns:
a random matrix.

random

public GenMatrix<C> random(int k,
                           java.util.Random random)
Random matrix.

Specified by:
random in interface ElemFactory<GenMatrix<C extends RingElem<C>>>
Parameters:
k - size of random coefficients.
random - is a source for random bits.
Returns:
a random element.

random

public GenMatrix<C> random(int k,
                           float q,
                           java.util.Random random)
Random matrix.

Parameters:
k - size of random coefficients.
q - density of nozero coefficients.
random - is a source for random bits.
Returns:
a random element.

randomUpper

public GenMatrix<C> randomUpper(int k,
                                float q)
Random upper triangular matrix.

Parameters:
k - size of random coefficients.
q - density of nozero coefficients.

randomUpper

public GenMatrix<C> randomUpper(int k,
                                float q,
                                java.util.Random random)
Random upper triangular matrix.

Parameters:
k - size of random coefficients.
q - density of nozero coefficients.
random - is a source for random bits.
Returns:
a random element.

randomLower

public GenMatrix<C> randomLower(int k,
                                float q)
Random lower triangular matrix.

Parameters:
k - size of random coefficients.
q - density of nozero coefficients.

randomLower

public GenMatrix<C> randomLower(int k,
                                float q,
                                java.util.Random random)
Random lower triangular matrix.

Parameters:
k - size of random coefficients.
q - density of nozero coefficients.
random - is a source for random bits.
Returns:
a random element.

copy

public GenMatrix<C> copy(GenMatrix<C> c)
copy matrix.

Specified by:
copy in interface ElemFactory<GenMatrix<C extends RingElem<C>>>
Returns:
a copy of c.

parse

public GenMatrix<C> parse(java.lang.String s)
parse a matrix from a String. Syntax: [ [ c, ..., c ], ..., [ c, ..., c ] ]

Specified by:
parse in interface ElemFactory<GenMatrix<C extends RingElem<C>>>
Parameters:
s - String.
Returns:
a Element corresponding to s.

parse

public GenMatrix<C> parse(java.io.Reader r)
parse a matrix from a Reader.

Specified by:
parse in interface ElemFactory<GenMatrix<C extends RingElem<C>>>
Parameters:
r - Reader.
Returns:
the next Element found on r.