XLPack 6.0 API Guide
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 from your C/C++ program
- The other programming languages which have the interface to C/C++ can also be used. The XLPack wrapper (interface) program examples for Python, Julia, C#, F#, VB.NET and Pascal (Delphi or Free Pascal) are provided
- LAPACKE/CBLAS library for XLPack API can be used for C/C++
- 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. See more details in the document attached to XLPack SDK.
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 Pascal. Using interface programs included in SDK, it is possible to call XLPack from C/C++ and to call XLPack basic functions from other languages. Example programs 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++, Python and Julia are available from the following links.
C/C++ numerical library reference manual (open in a separate tab)
C/C++ numerical library reference manual (basic functions) (open in a separate tab)
Python numerical library reference manual (basic functions) (open in a separate tab)
Julia numerical library reference manual (basic functions) (open in a separate tab)
C/C++ programs can call XLPack just by linking the following library included in SDK.
For Windows, link XLPack.lib (64 bit program) or XLPack_32.lib (32 bit program).
Header files cnumlib.h or cnumlib (for C++) can be used.
The Python extension module which is used to call XLPack basic functions is included in SDK.
XLPack.pyd is used for 64 bit Python, and XLPack_32.pyd is used for 32 bit Python. These modules have to be placed in the same directory with calling script or the directory given by the variable PYTHONPATH. These modules are designed to work with Python 3.7 or later. However, depending on the software environments, these modules may not work well. In such case, please try XLPack.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.
Other languages call DLL directly. The interface program examples are included in SDK.
The interface to call DLL directly is same with C/C++ library (see C/C++ numerical reference reference manual) except some functions described below.
The interface of functions which may set errno such as special functions and BLAS 2 and 3 functions is different from C/C++ library. Underbar (_) is added in front of the name of function and errno is added as the last 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 (for 64 bit XLPack) or Lapacke_32.lib (for 32 bit XLPack). Header files lapacke.h and cblas.h can be used.
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 each function, please refer to the original site below.
Description of LAPACKE/CBLAS
LAPACK function reference manual including LAPACKE/CBLAS
The following 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 (using dgesv and qk15) are described below. 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]
Source libraries and references
Refer to "Main Page" tab of each reference manual.