CONVERT#

purpose#

The convert package takes a sparse matrix \(A\) stored in one format and converts it into another.

Currently only the options and inform dictionaries are exposed; these are provided and used by other GALAHAD packages with Python interfaces. Please contact us if you would like full functionality!

See Section 4 of $GALAHAD/doc/convert.pdf for a brief description of the method employed and other details.

functions#

convert.initialize()#

Set default option values and initialize private data.

Returns:

optionsdict
dictionary containing default control options:
errorint

error and warning diagnostics occur on stream error.

outint

general output occurs on stream out.

print_levelint

controls level of diagnostic output.

transposebool

obtain the transpose of the input matrix?.

sum_duplicatesbool

add the values of entries in duplicate positions?.

orderbool

order row or column data by increasing index?.

space_criticalbool

if space is critical, ensure allocated arrays are no bigger than needed.

deallocate_error_fatalbool

exit if any deallocation fails.

prefixstr

all output lines will be prefixed by the string contained in quotes within prefix, e.g. ‘word’ (note the qutoes) will result in the prefix word.

[optional] convert.information()

Provide optional output information.

Returns:

informdict
dictionary containing output information:
statusint

the return status. Possible values are:

  • 0

    a successful conversion occurred.

  • -1

    An allocation error occurred. A message indicating the offending array is written on unit control.error, and the returned allocation status and a string containing the name of the offending array are held in inform[‘alloc_status’] and inform[‘bad_alloc’] respectively.

  • -2

    A deallocation error occurred. A message indicating the offending array is written on unit control.error and the returned allocation status and a string containing the name of the offending array are held in inform[‘alloc_status’] and inform[‘bad_alloc’] respectively.

  • -3

    The restriction n > 0 or m > 0 or requirement that a type contains its relevant string ‘coordinate’, ‘sparse_by_rows’, ‘sparse_by_columns’, ‘dense_by_rows’ or ‘dense_by_columns’ has been violated.

  • -32

    provided integer workspace is not large enough.

  • -33

    provided real workspace is not large enough.

  • -73

    an input matrix entry has been repeated.

  • -79

    there are missing optional arguments.

  • -90

    a requested output format is not recognised.

alloc_statusint

the status of the last attempted allocation/deallocation.

bad_allocstr

the name of the array for which an allocation/deallocation error occurred.

duplicatesint

the number of duplicates found (-ve = not checked).

timedict
dictionary containing timing information:
totalfloat

total cpu time spent in the package.

clock_totalfloat

total clock time spent in the package.

convert.finalize()#

Deallocate all internal private storage.