Set and Get

The Set- procedures allow the user to attach values to certain internal variables which control system or global features. The Get- functions enable one to obtain the current values of these variables.

SetAssertions(b) : RngIntElt ->
GetAssertions() : -> RngIntElt
Controls the checking of assertions (see the assert statement and related statements in the chapter on the language). Default is SetAssertions(1). The relevant values are 0 for no checking at all, 1 for normal checks, 2 for debug checks and 3 for extremely stringent checking.
SetAutoColumns(b) : BoolElt ->
GetAutoColumns() : -> BoolElt
If enabled, the IO system will try to determine the number of columns in the window by using ioctl(); when a window change or a stop/cont occurs, the Columns variable (below) will be automatically updated. If disabled, the Columns variable will only be changed when explicitly done so by SetColumns. Default is SetAutoColumns(true).
SetAutoCompact(b) : BoolElt ->
GetAutoCompact() : -> BoolElt
Control whether automatic compaction is performed. Normally the memory manager of Magma will compact all of its memory between each statement at the top level. This removes fragmentation and reduces excessive memory usage. In some very rare situations, the compactions may become very slow (one symptom is that an inordinate pause occurs between prompts when only a trivial operation or nothing is done). In such cases, turning the automatic compaction off may help (at the cost of possibly more use of memory). Default is SetAutoCompact(true).
SetBeep(b) : BoolElt ->
GetBeep() : -> BoolElt
Controls `beeps'. Default is SetBeep(true).
SetColumns(n) : RngIntElt ->
GetColumns() : -> RngIntElt
Controls the number of columns used by the IO system. This affects the line editor and the output system. (As explained above, if AutoColumns is on, this variable will be automatically determined.) The number of columns will determine how words are wrapped. If set to 0, word wrap is not performed. The default value is SetColumns(80) (unless SetAutoColumns(true)).
GetCurrentDirectory() : ->
Returns the current directory as a string. (Use ChangeDirectory(s) to change the working directory.)
SetEchoInput(b) : BoolElt ->
GetEchoInput() : ->
Set to true or false according to whether or not input from external files should also be sent to standard output.
GetEnvironmentValue(s) : MonStgElt -> MonStgElt
GetEnv(s) : MonStgElt -> MonStgElt
Returns the value of the external environment variable s as a string.
SetGPU(b) : BoolElt ->
GetGPU() : -> BoolElt
Set the NVIDIA GPU mode to b; this determines whether Magma should use NVIDIA GPUs via CUDA when present. This is only relevant to a CUDA-enabled executable (typically downloaded as magma.cuda.exe) and is {true} by default in that case (so the GPU is used by default); for a non-CUDA-enabled executable, the procedure has no effect. Currently, a GPU is exploited in matrix multiplication over GF(2) and small prime finite fields and consequently anything which depends on such multiplication, such as the dense F4 Gröbner basis algorithm over such fields.
SetHistorySize(n) : RngIntElt ->
GetHistorySize() : ->
Controls the number of lines saved in the history. If the number is set to 0, no history is preserved.
SetIgnorePrompt(b) : BoolElt ->
GetIgnorePrompt() : -> BoolElt
Controls the option to ignore the prompt to allow the pasting of input lines back in. If enabled, any leading '>' characters (possibly separated by white space) are ignored by the history system when the input file is a terminal, unless the line consists of the '>' character alone (without a following space), which could not come from a prompt since in a prompt a space or another character follows a '>'. Default is SetIgnorePrompt(false).
SetIgnoreSpaces(b) : BoolElt ->
GetIgnoreSpaces() : -> BoolElt
Controls the option to ignore spaces when searching in the line editor. If the user moves up or down in the line editor using <Ctrl>-P or <Ctrl>-N (see the line editor key descriptions) and if the cursor is not at the beginning of the line, a search is made forwards or backwards, respectively, to the first line which starts with the same string as the string consisting of all the characters before the cursor. While doing the search, spaces are ignored if and only if this option is on (value true). Default is SetIgnoreSpaces(true).
SetIndent(n) : RngIntElt ->
GetIndent() : -> RngIntElt
Controls the indentation level for formatting output. The default is SetIndent(4).
SetLibraries(s) : MonStgElt ->
GetLibraries() : -> MonStgElt
Controls the Magma library directories via environment variable MAGMA_LIBRARIES. The procedure SetLibraries takes a string, which will be taken as the (colon-separated) list of sub-directories in the library root directory for the libraries; the function GetLibraryRoot returns the current value as a string. These directories will be searched when you try to load a file; note however that first the directories indicated by the current value of your path environment variable MAGMA_PATH will be searched. See SetLibraryRoot for the root directory.
SetLibraryRoot(s) : MonStgElt ->
GetLibraryRoot() : -> MonStgElt
Controls the root directory for the Magma libraries, via the environment variable MAGMA_LIBRARY_ROOT. The procedure SetLibraryRoot takes a string, which will be the absolute pathname for the root of the libraries; the function GetLibraryRoot returns the current value as a string. See also SetLibraries.
SetLineEditor(b) : BoolElt ->
GetLineEditor() : -> BoolElt
Controls the line editor. Default is SetLineEditor(true).
SetLogFile(F) : MonStgElt ->
    Overwrite: BoolElt                  Default: false
UnsetLogFile() : ->
Procedure. Set the log file to be the file specified by the string F: all input and output will be sent to this log file as well as to the terminal. If a log file is already in use, it is closed and F is used instead. The parameter Overwrite can be used to indicate that the file should be truncated before writing input and output on it; by default the file is appended.
SetMemoryLimit(n) : RngIntElt ->
GetMemoryLimit() : -> RngIntElt
Set the limit (in bytes) of the memory which the memory manager will allocate (no limit if 0). Default is SetMemoryLimit(0).
SetNthreads(n) : RngIntElt ->
GetNthreads() : -> RngIntElt
Set the number of threads to be used in multi-threaded algorithms to be n, if POSIX threads are enabled in this version of Magma. Currently, this affects the coding theory minimum weight algorithm (MinimumWeight) and the F4 Gröbner basis algorithm for medium-sized primes (Groebner).
SetOutputFile(F) : MonStgElt ->
    Overwrite: BoolElt                  Default: false
UnsetOutputFile() : ->
Start/stop redirecting all Magma output to a file (specified by the string F). The parameter Overwrite can be used to indicate that the file should be truncated before writing output on it.
SetPath(s) : MonStgElt ->
GetPath() : -> MonStgElt
Controls the path by which the searching of files is done. The path consists of a colon separated list of directories which are searched in order ("." implicitly assumed at the front). Tilde expansion is done on each directory. (May be overridden by the environment variable MAGMA_PATH.)
SetPrintLevel(l) : MonStgElt ->
GetPrintLevel() : -> MonStgElt
Controls the global printing level, which is one of "Minimal", "Magma", "Maximal", "Default". Default is SetPrintLevel("Default").
SetPrompt(s) : MonStgElt ->
GetPrompt() : -> MonStgElt
Controls the terminal prompt (a string). Expansion of the following % escapes occurs:
%%
The character %
%h
The current history line number.
%S
The parser `state': when a new line is about to be read while the parser has only seen incomplete statements, the state consists of a stack of words like "if", "while", indicating the incomplete statements.
%s
Like %S except that only the topmost word is displayed.

Default is SetPrompt("%S> ").

SetQuitOnError(b) : BoolElt ->
Set whether Magma should quit on any error to b. If b is true, Magma will completely quit when any error (syntax, runtime, etc.) occurs. Default is SetQuitOnError(false).
SetRows(n) : RngIntElt ->
GetRows() : -> RngIntElt
Controls the number of rows in a page used by the IO system. This affects the output system. If set to 0, paging is not performed. Otherwise a prompt is given after the given number of rows for a new page. The default value is SetRows(0).
GetTempDir() : -> MonStgElt
Returns the directory Magma uses for storing temporary files. May be influenced on startup via the MAGMA_TEMP_DIR environment variable (see Section Environment Variables).
SetTraceback(n) : BoolElt ->
GetTraceback() : -> BoolElt
Controls whether Magma should produce a traceback of user function calls before each error message. The default value is SetTraceback(true).
SetSeed(s, c) : RngIntElt ->
GetSeed() : -> RngIntElt, RngIntElt
Controls the initialization seed and step number for pseudo-random number generation. For details, see the section on random object generation in the chapter on statements and expressions.
GetVersion() : -> RngIntElt, RngIntElt, RngIntElt
Return integers x, y and z such the current version of Magma is Vx.y--z.
SetViMode(b) : BoolElt ->
GetViMode() : -> BoolElt
Controls the type of line editor used: Emacs (false) or VI style. Default is SetViMode(false).
V2.28, 13 July 2023