home *** CD-ROM | disk | FTP | other *** search
/ Math Solutions 1995 October / Math_Solutions_CD-ROM_Walnut_Creek_October_1995.iso / pc / mac / discrete / lib / matring.g < prev    next >
Encoding:
Text File  |  1993-05-05  |  3.7 KB  |  136 lines

  1. #############################################################################
  2. ##
  3. #A  matring.g                   GAP library                  Martin Schoenert
  4. ##
  5. #A  @(#)$Id: matring.g,v 3.1 1992/04/05 15:11:03 martin Rel $
  6. ##
  7. #Y  Copyright 1990-1992,  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany
  8. ##
  9. ##  This file contains  those  functions that mainly deal with matrix  rings.
  10. ##
  11. #H  $Log: matring.g,v $
  12. #H  Revision 3.1  1992/04/05  15:11:03  martin
  13. #H  added 'MatrixRingOps.Quotient'
  14. #H
  15. #H  Revision 3.0  1991/11/08  15:17:00  martin
  16. #H  initial revision under RCS
  17. #H
  18. ##
  19.  
  20.  
  21. #############################################################################
  22. ##
  23. #F  IsMatrixRing(<obj>) . . . . . . . . .  test if an object is a matrix ring
  24. ##
  25. IsMatrixRing := function ( obj )
  26.     return IsRec( obj )
  27.        and IsBound( obj.isMatrixRing )  and obj.isMatrixRing;
  28. end;
  29.  
  30.  
  31. #############################################################################
  32. ##
  33. #F  MatricesOps.Ring(<gens>)  . . . . . . . . . . . . .  create a matrix ring
  34. ##
  35. MatricesOps.Ring := function ( gens )
  36.     local   R;
  37.  
  38.     # make the ring record
  39.     R := rec(
  40.         isDomain                := true,
  41.         isRing                  := true,
  42.         isMatrixRing            := true,
  43.  
  44.         generators              := gens,
  45.         one                     := gens[1]^0,
  46.         zero                    := gens[1] - gens[1],
  47.  
  48.         dimension               := Length( gens[1] ),
  49.         field                   := Field( Flat( gens ) ),
  50.  
  51.         operations              := MatrixRingOps
  52.     );
  53.  
  54.     # return the ring record
  55.     return R;
  56. end;
  57.  
  58.  
  59. #############################################################################
  60. ##
  61. #F  MatricesOps.DefaultRing(<gens>) . . . . .  create the default matrix ring
  62. ##
  63. MatricesOps.DefaultRing := MatricesOps.Ring;
  64.  
  65.  
  66. #############################################################################
  67. ##
  68. #V  MatrixRingOps . . . . . . . . . operation record for matrix ring category
  69. ##
  70. ##  'MatrixRingOps' is the  operation record for  matrix  rings.  It contains
  71. ##  the domain functions,  e.g., 'Size'  and   'Intersection', and the   ring
  72. ##  functions, e.g., 'IsUnit' and 'Factors'.
  73. ##
  74. ##  'MatrixRingOps' is initially a copy  of 'RingOps', and thus inherits  the
  75. ##  default ring  functions.    Currently  we  overlay   very few   of  those
  76. ##  functions.
  77. ##
  78. MatrixRingOps := Copy( RingOps );
  79.  
  80.  
  81. #############################################################################
  82. ##
  83. #F  MatrixRingOps.IsFinite(<R>) . . . . . . . test if a matrix ring is finite
  84. ##
  85. MatrixRingOps.IsFinite := function ( R )
  86.     if IsFinite( R.field )  then
  87.         return true;
  88.     else
  89.         return RingOps.IsFinite( R );
  90.     fi;
  91. end;
  92.  
  93.  
  94. #############################################################################
  95. ##
  96. #F  MatrixRingOps.IsUnit(<R>,<m>) . . . . . . . .  test if a matrix is a unit
  97. ##
  98. MatrixRingOps.IsUnit := function ( R, m )
  99.     return DeterminantMat( m ) <> 0
  100.        and m^-1 in R;
  101. end;
  102.  
  103.  
  104. #############################################################################
  105. ##
  106. #F  MatrixRingOps.Quotient := function ( R, m, n )
  107. ##
  108. MatrixRingOps.Quotient := function ( R, m, n )
  109.     if IsFinite( R )  then
  110.         if RankMat( n ) = Length( n )  then
  111.             return m / n;
  112.         else
  113.             Error("<n> must be invertable");
  114.         fi;
  115.     else
  116.         Error("sorry, cannot compute the quotient of <m> and <n>");
  117.     fi;
  118. end;
  119.  
  120.  
  121. #############################################################################
  122. ##
  123. #E  Emacs . . . . . . . . . . . . . . . . . . . . . . . local emacs variables
  124. ##
  125. ##  Local Variables:
  126. ##  mode:               outline
  127. ##  outline-regexp:     "#F\\|#V\\|#E"
  128. ##  fill-column:        73
  129. ##  fill-prefix:        "##  "
  130. ##  eval:               (hide-body)
  131. ##  End:
  132. ##
  133.  
  134.  
  135.  
  136.