XLPack API Manual
What is XLPack API
XLPack API (C/C++ interface) is the interface for other programs than Excel to use numerical calculation module of XLPack. With this interface you will be able to do the followings:
- You can use the numerical calculation function module of XLPack (or XLPack Lite) from your C/C++ program
- The other programming languages which have the interface to C/C++ can also be used. The XLPack Lite wrapper (interface) programs for Python, Julia, C#, F#, VB.Net and Delphi are provided
- The program developed by using XLPack API can run on the personal computers in which XLPack (or XLPack Lite) is installed
XLPack API provides the internal interface in as-is condition. It has not been thoroughly tested under all conditions. Therefore, the function, performance, or reliability of this software are not guaranteed. And specifications are subject to change without notice.
XLPack SDK can be downloaded from Download Page.
SDK includes the necessary software to use API with programming languages C/C++, Python, Julia, .Net languages (C#, F#, VB.Net) and Delphi (Pascal). Using interface programs included in SDK, it is possible to call XLPack/XLPack Lite from C/C++ and to call XLPack Lite from other languages. Example programs to use all functions of XLPack Lite are included, so that you can easily develop the application programs by referring those examples.
Please refer to the following online manuals for C/C++ and Python.
C/C++ numerical library reference manual (open in a separate tab)
C/C++ numerical library reference manual (XLPack Lite) (open in a separate tab)
Python numerical library reference manual (XLPack Lite) (open in a separate tab)
Julia numerical library reference manual (XLPack Lite) (open in a separate tab)
There are two methods to use API. One is to link with the library. The other is to call DLL directly.
C/C++ programs can call XLPack just by linking the following library included in SDK.
For Windows, link XLPack.lib (64 bit XLPack), XLPack_32.lib (32 bit XLPack), XLPackLite.lib (64 bit XLPack Lite) or XLPackLite_32.lib (32 bit XLPack Lite).
For macOS, link both XLPack.dylib and libXLPack.a (XLPack) or both XLPackLite.dylib and libXLPackLite.a (XLPack Lite).
Header files cnumlib.h or cnumlib (for C++) can be used for XLPack. cnumlib_lite.h or cnumlib_lite (C++) can be used for XLPack Lite.
Note – The interface have been changed from version 5.3 to set errno when error occurred for most of special functions and BLAS 2 and 3 functions.
The Python extension module which is used to call XLPack Lite is included in SDK.
For Windows, use XLPackLite.pyd (64 bit) or XLPackLite_32.pyd (32 bit). For macOS, use XLPackLite.so. These modules have to be placed in the same directory with calling script or the directory given by the variable PYTHONPATH. Depending on the software version and other environments, the extension module may not work. In such case, please try XLPackLite.py (ctypes version which provides equivalent functions with extension module).
Numpy ndarray is used in the Python extension module to handle matrices. Numpy must be installed in advance.
Calling DLL directly
Other languages do not link the library but call DLL directly. In that case, the calling interface is same with the case linking library (i.e. reference manual) except the special case below. However, DLL interface programs for each language are provided in SDK, so that it is possible to call XLPack without considering the details of DLL interface.
In the case of calling DLL directly, the calling interface of functions which may set errno such as special functions and BLAS 2 and 3 functions is different from the reference manual. Underbar (_) is added in front of the name of function and errno is added as the lase argument. For example,
func(double a1, double a2)
is changed as follows.
_func(double a1, double a2, errno_t *xerrno)
In the case of normal exit, 0 will be returned in xerrno. When error occurred, EDOM or ERANGE (the values of errno.h of C language) will be returned. In BLAS 2 and 3 functions, errno is not set in most implementation. However, as an extension, EDOM will be set if the argument error is found.
THe following functions may set errno.
How to use LAPACKE/CBLAS
LAPACKE/CBLAS library for XLPack API for C/C++ is included in SDK. For Windows, link Lapacke.lib (64 bit XLPack), Lapacke_32.lib (32 bit XLPack), Lapacke_Lite.lib (64 bit XLPack Lite) or Lapacke_Lite_32.lib (32 bit XLPack Lite). For macOS, link libLapack.a (XLPack) or libLapacke_Lite.a (XLPack Lite).
Header files lapacke.h and cblas.h can be used for XLPack. lapacke_lite.h can be used for XLPack Lite.
Using these libraries and header files, you can call LAPACK/BLAS through LAPACKE/CBLAS interface (standard C interface included in LAPACK/BLAS). For the details of how to use each function, please refer to the original site below:
Description of LAPACKE/CBLAS
LAPACK function reference manual including LAPACKE/CBLAS
LAPACKE and CBLAS routines corresponding to LAPACK and BLAS routines included in XLPack are supported.
The following functions which are not included in the original library are added as an extension.
Example programs using API
Example programs using API are described below.
The following two example problems are used to describe the usage of dgesv and qk15. For other functions, please refer to sample programs included in SDK.
Solve the system of linear equations Ax = B. Coefficient matrix A, right hand matrix B and solution x are as follows.
( 0.2 -0.11 -0.93 ) ( -0.3727 ) ( 0.86 ) A = ( -0.32 0.81 0.37 ), B = ( 0.4319 ), x = ( 0.64 ) ( -0.8 -0.92 -0.29 ) ( -1.4247 ) ( 0.51 )
Computes the following integral. The true analytic solution is atan(4) = 1.32581766366803.
∫ 1/(1 + x^2) dx [0, 4]
- C/C++ example programs
- Python example programs
- Julia example programs
- C# example programs
- F# example programs
- VB.Net example programs
- Delphi (Pascal) example programs
Note – MINPACK software is included with some modifications under the MINPACK Software License
Acknowledgment – This product includes software developed by the University of Chicago, as Operator of Argonne National Laboratory
CMLIB: Center for Computing and Applied Mathematics, NIST
Note – FFTPACK5 software is included with some modifications under the FFTPACK5 Software License
Mersenne Twister: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/mt.html
D. Kahaner, C. Moler, S. Nash, “Numerical Methods and Software”, Prentice-Hall (1989)
Masatake Mori “FORTRAN77 Numerical Calculation Programming (augmented edition)” Iwanami Shoten (1987) (Japanese book)
D. E. Knuth, “The Art of Computer Programming Third Edition, Vol. 2 / Seminumerical Algorithms”, Addison Wesley Longman (1998)
E. Hairer, et al., “Solving Ordinary Differential Equations I”, Springer-Verlag (1993) (Note)
E. Hairer, et al., “Solving Ordinary Differential Equations II”, Springer-Verlag (1996) (Note)
Note – E. Hairer’s software is included with some modifications under Ernst Hairer’s License