GALAHAD BSC package#
purpose#
The bsc
package takes given matrices \(A\) and (diagonal) \(D\), and
builds the Schur complement \(S = A D A^T\) in sparse co-ordinate
(and optionally sparse column) format(s). Full advantage is taken
of any zero coefficients in the matrix \(A\).
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/bsc.pdf for a brief description of the method employed and other details.
introduction to function calls#
To solve a given problem, functions from the bsc package must be called in the following order:
bsc_initialize - provide default control parameters and set up initial data structures
bsc_read_specfile (optional) - override control values by reading replacement values from a file
bsc_import - set up matrix data structures for \(A\).
bsc_reset_control (optional) - possibly change control parameters if a sequence of problems are being solved
bsc_form - form the Schur complement \(S\)
bsc_information (optional) - recover information about the process
bsc_terminate - deallocate data structures
See the examples section for illustrations of use.
callable functions#
overview of functions provided#
// namespaces namespace conf; // typedefs typedef float spc_; typedef double rpc_; typedef int ipc_; // structs struct bsc_control_type; struct bsc_inform_type; // global functions void bsc_initialize(void **data, struct bsc_control_type* control, ipc_ *status); void bsc_information(void **data, struct bsc_inform_type* inform, ipc_ *status); void bsc_terminate( void **data, struct bsc_control_type* control, struct bsc_inform_type* inform );
typedefs#
typedef float spc_
spc_
is real single precision
typedef double rpc_
rpc_
is the real working precision used, but may be changed to float
by
defining the preprocessor variable SINGLE
.
typedef int ipc_
ipc_
is the default integer word length used, but may be changed to
int64_t
by defining the preprocessor variable INTEGER_64
.
function calls#
void bsc_initialize(void **data, struct bsc_control_type* control, ipc_ *status)
Set default control values and initialize private data
Parameters:
data |
holds private internal data |
control |
is a struct containing control information (see bsc_control_type) |
status |
is a scalar variable of type ipc_, that gives the exit status from the package. Possible values are (currently):
|
void bsc_information(void **data, struct bsc_inform_type* inform, ipc_ *status)
Provides output information
Parameters:
data |
holds private internal data |
inform |
is a struct containing output information (see bsc_inform_type) |
status |
is a scalar variable of type ipc_, that gives the exit status from the package. Possible values are (currently):
|
void bsc_terminate( void **data, struct bsc_control_type* control, struct bsc_inform_type* inform )
Deallocate all internal private storage
Parameters:
data |
holds private internal data |
control |
is a struct containing control information (see bsc_control_type) |
inform |
is a struct containing output information (see bsc_inform_type) |
available structures#
bsc_control_type structure#
#include <galahad_bsc.h> struct bsc_control_type { // fields bool f_indexing; ipc_ error; ipc_ out; ipc_ print_level; ipc_ max_col; ipc_ new_a; ipc_ extra_space_s; bool s_also_by_column; bool space_critical; bool deallocate_error_fatal; char prefix[31]; };
detailed documentation#
control derived type as a C struct
components#
bool f_indexing
use C or Fortran sparse matrix indexing
ipc_ error
error and warning diagnostics occur on stream error
ipc_ out
general output occurs on stream out
ipc_ print_level
the level of output required is specified by print_level
ipc_ max_col
maximum permitted number of nonzeros in a column of \(A\); -ve means unlimit
ipc_ new_a
how much has \(A\) changed since it was last accessed:
0 = not changed,
1 = values changed,
2 = structure changed
3 = structure changed but values not required
ipc_ extra_space_s
how much extra space is to be allocated in \(S\) above that needed to hold the Schur complement
bool s_also_by_column
should s.ptr also be set to indicate the first entry in each column of \(S\)
bool space_critical
if .space_critical true, every effort will be made to use as little space as possible. This may result in longer computation time
bool deallocate_error_fatal
if .deallocate_error_fatal is true, any array/pointer deallocation error will terminate execution. Otherwise, computation will continue
char prefix[31]
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’
bsc_inform_type structure#
#include <galahad_bsc.h> struct bsc_inform_type { // fields ipc_ status; ipc_ alloc_status; char bad_alloc[81]; ipc_ max_col_a; ipc_ exceeds_max_col; rpc_ time; rpc_ clock_time; };
detailed documentation#
inform derived type as a C struct
components#
ipc_ status
the return status from the package. Possible values are:
0
The call was succcesful
-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 restrictions n > 0 or m > 0 or requirement that a type contains its relevant string ‘dense’, ‘coordinate’ or ‘sparse_by_rows’ has been violated.
ipc_ alloc_status
the status of the last attempted allocation/deallocation
char bad_alloc[81]
the name of the array for which an allocation/deallocation error occurred.
ipc_ max_col_a
the maximum number of entries in a column of \(A\)
ipc_ exceeds_max_col
the number of columns of \(A\) that have more than control.max_col entries
rpc_ time
the total CPU time spent in the package
rpc_ clock_time
the total clock time spent in the package