HLIBpro
1.2
|
To access HLIBpro functions and classes, we have to include the corresponding header files. Although each file can be included individually, a general header file is provided:
All HLIBpro functions and classes, except the functions in the C language interface (see [HLIBpro_C]}), are encapsulated in the namespace HLIB
. To simplify the calling of these functions, they are made visible in the current namespace by the {using} command.
hlib.hh
all header files in HLIBpro are included in the current source, compilation times may be increased significantly.Before any HLIBpro function can be used, the library has to be initialised with the INIT function:
To use the HLIBpro error handling, which is based on exceptions, all functions are inside a try-catch block. Otherwise, the application would simply stop in case of an error.
The counterpart to this is the finalisation and the error handling:
Between INIT and DONE all HLIBpro function calls and class instantiations may be placed as is illustrated in the following examples.
The code, assumed to be stored in file init.cc
, is compiled with a standard C++ compiler via:
$ c++ -o init -I<path to hlibpro>/include init.cc -L<path to hlibpro>/lib -lhpro -llapack -lblas
For convenience, a special script is shipped with HLIBpro, which provides the correct settings for compiling and linking, with which the last command simplifies to:
$ c++ -o init init.cc `<path to hlibpro>/bin/hlib-config --cflags --lflags`