Utility functions for libGAP

class sage.libs.gap.util.ObjWrapper

Bases: object

Wrapper for GAP master pointers

EXAMPLES:

sage: from sage.libs.gap.util import ObjWrapper
sage: x = ObjWrapper()
sage: y = ObjWrapper()
sage: x == y
True
sage.libs.gap.util.command(command_string)

Playground for accessing Gap via libGap.

You should not use this function in your own programs. This is just here for convenience if you want to play with the libgap libray code.

EXAMPLES:

sage: from sage.libs.gap.util import command
sage: command('1')
Output follows...
1

sage: command('1/0')
Traceback (most recent call last):
...
ValueError: libGAP: Error, Rational operations: <divisor> must not be zero

sage: command('NormalSubgroups')
Output follows...
<Attribute "NormalSubgroups">

sage: command('rec(a:=1, b:=2)')
Output follows...
rec( a := 1, b := 2 )
sage.libs.gap.util.error_enter_libgap_block_twice()

Demonstrate that we catch errors from entering a block twice.

EXAMPLES:

sage: from sage.libs.gap.util import error_enter_libgap_block_twice
sage: error_enter_libgap_block_twice()
Traceback (most recent call last):
...
RuntimeError: Entered a critical block twice
sage.libs.gap.util.error_exit_libgap_block_without_enter()

Demonstrate that we catch errors from omitting libgap_enter.

EXAMPLES:

sage: from sage.libs.gap.util import error_exit_libgap_block_without_enter
sage: error_exit_libgap_block_without_enter()
Traceback (most recent call last):
...
RuntimeError: Called libgap_exit without previous libgap_enter
sage.libs.gap.util.gap_root()

Find the location of the GAP root install which is stored in the gap startup script.

EXAMPLES:

sage: from sage.libs.gap.util import gap_root
sage: gap_root()   # random output
'/home/vbraun/opt/sage-5.3.rc0/local/gap/latest'
sage.libs.gap.util.get_owned_objects()

Helper to access the refcount dictionary from Python code

sage.libs.gap.util.memory_usage()

Return information about the memory useage.

See mem() for details.