GALAHAD CONVERT package#

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.

parametric real type T#

Below, the symbol T refers to a parametric real type that may be Float32 (single precision) or Float64 (double precision). Calable functions as described are with T as Float64, but variants (with the additional suffix _s, e.g., convert_initialize_s) are available with T as Float32.

callable functions#

    function convert_initialize(data, control, status)

Set default control values and initialize private data

Parameters:

data

holds private internal data

control

is a structure containing control information (see convert_control_type)

status

is a scalar variable of type Int32 that gives the exit status from the package. Possible values are (currently):

  • 0

    The initialization was successful.

    function convert_information(data, inform, status)

Provides output information

Parameters:

data

holds private internal data

inform

is a structure containing output information (see convert_inform_type)

status

is a scalar variable of type Int32 that gives the exit status from the package. Possible values are (currently):

  • 0

    The values were recorded successfully

    function convert_terminate(data, control, inform)

Deallocate all internal private storage

Parameters:

data

holds private internal data

control

is a structure containing control information (see convert_control_type)

inform

is a structure containing output information (see convert_inform_type)

available structures#

convert_control_type structure#

    struct convert_control_type
      f_indexing::Bool
      error::Int32
      out::Int32
      print_level::Int32
      transpose::Bool
      sum_duplicates::Bool
      order::Bool
      space_critical::Bool
      deallocate_error_fatal::Bool
      prefix::NTuple{31,Cchar}

detailed documentation#

control derived type as a Julia structure

components#

Bool f_indexing

use C or Fortran sparse matrix indexing

Int32 error

unit for error messages

Int32 out

unit for monitor output

Int32 print_level

controls level of diagnostic output

Bool transpose

obtain the transpose of the input matrix?

Bool sum_duplicates

add the values of entries in duplicate positions?

Bool order

order row or column data by increasing index?

Bool space_critical

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

Bool deallocate_error_fatal

exit if any deallocation fails

NTuple{31,Cchar} prefix

all output lines will be prefixed by prefix(2:LEN(TRIM(.prefix))-1) where prefix contains the required string enclosed in quotes, e.g. “string” or ‘string’

convert_time_type structure#

    struct convert_time_type{T}
      total::T
      clock_total::T

detailed documentation#

time derived type as a Julia structure

components#

T total

total cpu time spent in the package

T clock_total

total clock time spent in the package

convert_inform_type structure#

    struct convert_inform_type{T}
      status::Int32
      alloc_status::Int32
      duplicates::Int32
      bad_alloc::NTuple{81,Cchar}
      time::convert_time_type{T}

detailed documentation#

inform derived type as a Julia structure

components#

Int32 status

the return status. Possible values are:

  • 0

    a successful conversion.

  • -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.

Int32 alloc_status

the status of the last attempted allocation/deallocation.

Int32 duplicates

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

NTuple{81,Cchar} bad_alloc

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

struct convert_time_type time

timings (see above).