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

  1. #############################################################################
  2. ##
  3. #A  module.g                    GAP library                    J\"urgen Mnich
  4. ##
  5. #A  @(#)$Id: module.g,v 3.3 1992/03/17 12:31:20 jmnich Rel $
  6. ##
  7. #Y  Copyright 1990-1992,  Lehrstuhl D fuer Mathematik,  RWTH Aachen,  Germany
  8. ##
  9. ##  This file contains all polymorph functions for modules.
  10. ##
  11. #H  $Log: module.g,v $
  12. #H  Revision 3.3  1992/03/17  12:31:20  jmnich
  13. #H  minor style changes, more bug fixes
  14. #H
  15. #H  Revision 3.2  1992/02/29  13:25:11  jmnich
  16. #H  general library review, some bug fixes
  17. #H
  18. #H  Revision 3.1  1992/02/12  15:37:22  martin
  19. #H  initial revision under RCS
  20. #H
  21. ##
  22.  
  23.  
  24. #############################################################################
  25. ##
  26. #F  InfoModule1(...)  . . . . . . . . . . . . . . . . . . package information
  27. #F  InfoModule2(...)  . . . . . . . . . . . . . . . package debug information
  28. ##
  29. if not IsBound( InfoModule1 )  then  InfoModule1 := Ignore;  fi;
  30. if not IsBound( InfoModule2 )  then  InfoModule2 := Ignore;  fi;
  31.  
  32.  
  33. #############################################################################
  34. ##
  35. #V  ModuleOps . . . . . . . . . . . . . . . . . operations record for modules
  36. ##
  37. ModuleOps := ShallowCopy( DomainOps );
  38.  
  39.  
  40. #############################################################################
  41. ##
  42. #F  ModuleOps.Print( <obj> )  . . . . . . . . . . . . . . . .  print a module
  43. ##
  44. ModuleOps.Print := function( M )
  45.     if IsBound( M.name ) then
  46.         Print( M.name );
  47.     else
  48.         Print( "Module( ", M.ring, ", ", M.abelianGroup, " )" );
  49.     fi;
  50. end;
  51.  
  52.  
  53. #############################################################################
  54. ##
  55. #F  Module( <ring>, <abelianGroup> )  . . . . . . . . . . . . create a module
  56. ##
  57. ##  This function creates a module as \GAP object with <ring> acting from the
  58. ##  right  on  <abelianGroup>.   Recall  that  this  operation has to be well
  59. ##  defined,  i.e.  <abelianGroup> has to be closed under multiplication from
  60. ##  the right with elements of <ring>.
  61. ##
  62. Module := function( arg )
  63.     local   ring, group;
  64.  
  65.     if Length( arg ) = 2 then
  66.         ring  := arg[1];
  67.         group := arg[2];
  68.     else
  69.         Error( "usage: Module( <ring>, <abelianGroup> )" );
  70.     fi;
  71.  
  72.     # handle the (linear algebra) case where a ring acts on a row space
  73.  
  74.     if IsRowSpace( group ) then
  75.         return RowModule( ring, group );
  76.     fi;
  77.  
  78.     # setup the module record
  79.  
  80.     return rec(
  81.         abelianGroup := group,
  82.         ring         := ring,
  83.         isModule     := true,
  84.         isDomain     := true,
  85.         isFinite     := IsFinite( group ),
  86.         operations   := ModuleOps
  87.     );
  88. end;
  89.  
  90.  
  91. #############################################################################
  92. ##
  93. #F  IsModule( <obj> ) . . . . . . . . . . . . . test if an object is a module
  94. ##
  95. IsModule := function( obj )
  96.     return IsRec( obj )
  97.         and IsBound( obj.isModule ) and obj.IsModule;
  98. end;
  99.  
  100.  
  101. #############################################################################
  102. ##
  103. #E  Emacs . . . . . . . . . . . . . . . . . . . . . . . local emacs variables
  104. ##
  105. ##  Local Variables:
  106. ##  mode:               outline
  107. ##  outline-regexp:     "#F\\|#V\\|#E"
  108. ##  fill-column:        73
  109. ##  fill-prefix:        "##  "
  110. ##  eval:               (hide-body)
  111. ##  End:
  112. ##
  113.