com.perisic.ring
Class Matrix2x2Ring

java.lang.Object
  extended by com.perisic.ring.Ring
      extended by com.perisic.ring.Matrix2x2Ring

public class Matrix2x2Ring
extends Ring

The ring of 2 x 2 matrices {{a,b},{c,d}} with a,b,c and d in B, where B is any Ring.

Version:
0.5
Author:
Tendiefi P Nkellefack, Marc Conrad

Field Summary
 
Fields inherited from class com.perisic.ring.Ring
C, F2, Q, R, Z
 
Constructor Summary
Matrix2x2Ring(Ring BaseRing)
          construction of a new Matrix2x2Ring over B.
 
Method Summary
 RingElt a(RingElt m)
          Returns the first coefficient (element) of the matrix as an element of the base ring.
 RingElt add(RingElt m1, RingElt m2)
          Returns the sum of a 2*2 matrix, m1 + m2.
 RingElt b(RingElt m)
          Returns the second element of the matrix as an element of the base ring.
 RingElt c(RingElt m)
          Returns the third element of the matrix as an element of the base ring.
 RingElt construct(RingElt a, RingElt b, RingElt c, RingElt d)
          constructs the elements of a 2*2 matrix, a, b, c, and d.
 RingElt d(RingElt m)
          Returns the fourth element of the matrix as an element of the base ring.
 RingElt det(RingElt m1)
          Returns the determinant of m.
 java.lang.String eltToString(RingElt m)
          Returns the matrix m as a String.
 boolean equalZero(RingElt m1)
          Returns true if the matrix m1 == 0.
 Ring getbaseRing()
          Returns the ring of coefficients of the matrix.
 java.lang.String[] getMatrixFormat()
          returns the format of the matrices.
 RingElt inv(RingElt m1)
          Returns the inverse of a matrix m1.
 boolean isField()
          Returns false.
static void main(java.lang.String[] args)
          A simple test method.
 RingElt map(RingElt m)
          Maps a 2x2 matrix m into this.
 RingElt map(java.lang.String str)
          Maps a matrix of the form { { xxx, yyy } { uuu, vvv } } into this ring.
 RingElt mult(RingElt m1, RingElt m2)
          Return the product of two 2*2 matrices, m1 * m2.
 RingElt neg(RingElt m1)
          Returns the negation of a matrix, -m1.
 RingElt one()
          Returns the Identity matrix, I = {{ 1, 0 } { 0, 1}}.
 void setMatrixFormat(java.lang.String outerLeftDelimiter, java.lang.String innerLeftDelimiter, java.lang.String elementSeparator, java.lang.String innerRightDelimiter, java.lang.String outerRightDelimiter)
          Sets the format that is used to read and write matrices.
 java.lang.String toString()
          Returns M22(B) where B is the coefficient ring.
 RingElt trace(RingElt m1)
          Returns the trace of m.
 RingElt zero()
          Returns the zero matrix { { 0, 0 } { 0, 0 }}.
 
Methods inherited from class com.perisic.ring.Ring
div, ediv, equal, evaluatePolynomial, gcd, isEuclidian, isUFD, map, map, map, mod, pow, pow, sub, tdiv
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Matrix2x2Ring

public Matrix2x2Ring(Ring BaseRing)
construction of a new Matrix2x2Ring over B. The elements of this ring are matrices {{a, b}, {c, d}}, where a,b,c,d are elements of the BaseRing.

Parameters:
BaseRing - is the base ring
Method Detail

toString

public java.lang.String toString()
Returns M22(B) where B is the coefficient ring.

Overrides:
toString in class java.lang.Object

isField

public boolean isField()
Returns false.

Overrides:
isField in class Ring

getbaseRing

public Ring getbaseRing()
Returns the ring of coefficients of the matrix.


a

public RingElt a(RingElt m)
Returns the first coefficient (element) of the matrix as an element of the base ring.


b

public RingElt b(RingElt m)
Returns the second element of the matrix as an element of the base ring.


c

public RingElt c(RingElt m)
Returns the third element of the matrix as an element of the base ring.


d

public RingElt d(RingElt m)
Returns the fourth element of the matrix as an element of the base ring.


add

public RingElt add(RingElt m1,
                   RingElt m2)
Returns the sum of a 2*2 matrix, m1 + m2.

Specified by:
add in class Ring

mult

public RingElt mult(RingElt m1,
                    RingElt m2)
Return the product of two 2*2 matrices, m1 * m2.

Specified by:
mult in class Ring

det

public RingElt det(RingElt m1)
Returns the determinant of m.


trace

public RingElt trace(RingElt m1)
Returns the trace of m.


inv

public RingElt inv(RingElt m1)
Returns the inverse of a matrix m1.

Overrides:
inv in class Ring

one

public RingElt one()
Returns the Identity matrix, I = {{ 1, 0 } { 0, 1}}.

Overrides:
one in class Ring

zero

public RingElt zero()
Returns the zero matrix { { 0, 0 } { 0, 0 }}.

Specified by:
zero in class Ring

neg

public RingElt neg(RingElt m1)
Returns the negation of a matrix, -m1.

Specified by:
neg in class Ring

equalZero

public boolean equalZero(RingElt m1)
Returns true if the matrix m1 == 0. False otherwise. I.e. It tests for the zero matrix

Specified by:
equalZero in class Ring

construct

public RingElt construct(RingElt a,
                         RingElt b,
                         RingElt c,
                         RingElt d)
constructs the elements of a 2*2 matrix, a, b, c, and d.


setMatrixFormat

public void setMatrixFormat(java.lang.String outerLeftDelimiter,
                            java.lang.String innerLeftDelimiter,
                            java.lang.String elementSeparator,
                            java.lang.String innerRightDelimiter,
                            java.lang.String outerRightDelimiter)
Sets the format that is used to read and write matrices. E.g. a call setMatrixFormat("{", "{", ",", "}", "}" ); reads matrices in the format { { xxx, yyy } { uuu, www } }; This is the default. More examples:
setMatrixFormat("[", "(", ":", ")", "]" ); reads and writes matrices in the form [( xxx : yyy )( uuu : www ) ].
setMatrixFormat("","",",","\n",""); reads and writes matrices in a block structure, e.g. "2 3\n4 5".


getMatrixFormat

public java.lang.String[] getMatrixFormat()
returns the format of the matrices. See setMatrixFormat() for details.


map

public RingElt map(RingElt m)
Maps a 2x2 matrix m into this. If m is not a 2x2 matrix, it will be mapped first into B and then into the matrix {{w, 0} {0, w}}.

Overrides:
map in class Ring

map

public RingElt map(java.lang.String str)
Maps a matrix of the form { { xxx, yyy } { uuu, vvv } } into this ring. The input format of the matrix can be changed using the setMatrixFormat() methods.

Overrides:
map in class Ring

eltToString

public java.lang.String eltToString(RingElt m)
Returns the matrix m as a String. Default format is { { xxx, yyy } {uuu, vvv } } See the documentation of setMatrixFormat() for changing the output format.

Overrides:
eltToString in class Ring

main

public static void main(java.lang.String[] args)
A simple test method.