GALAHAD FIT package#
purpose#
The fit
package fits polynomials to function and derivative data.
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/fit.pdf for a brief description of the method employed and other details.
callable functions#
overview of functions provided#
// namespaces namespace conf; // typedefs typedef float spc_; typedef double rpc_; typedef int ipc_; // structs struct fit_control_type; struct fit_inform_type; // global functions void fit_initialize(void **data, struct fit_control_type* control, ipc_ *status); void fit_information(void **data, struct fit_inform_type* inform, ipc_ *status); void fit_terminate( void **data, struct fit_control_type* control, struct fit_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 REAL_32
or (if supported) to
__real128
using the variable REAL_128
.
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 fit_initialize(void **data, struct fit_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 fit_control_type) |
status |
is a scalar variable of type ipc_, that gives the exit status from the package. Possible values are (currently):
|
void fit_information(void **data, struct fit_inform_type* inform, ipc_ *status)
Provides output information
Parameters:
data |
holds private internal data |
inform |
is a struct containing output information (see fit_inform_type) |
status |
is a scalar variable of type ipc_, that gives the exit status from the package. Possible values are (currently):
|
void fit_terminate( void **data, struct fit_control_type* control, struct fit_inform_type* inform )
Deallocate all internal private storage
Parameters:
data |
holds private internal data |
control |
is a struct containing control information (see fit_control_type) |
inform |
is a struct containing output information (see fit_inform_type) |
available structures#
fit_control_type structure#
#include <galahad_fit.h> struct fit_control_type { // fields bool f_indexing; ipc_ error; ipc_ out; ipc_ print_level; 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
bool space_critical
if space_critical is true, every effort will be made to use as little space as possible. This may result in longer computation times
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’
fit_inform_type structure#
#include <galahad_fit.h> struct fit_inform_type { // fields ipc_ status; ipc_ alloc_status; char bad_alloc[81]; };
detailed documentation#
inform derived type as a C struct
components#
ipc_ status
return status. Possible values are:
0
Normal termination with the required fit.
-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 >= 1 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.