XLPack 5.2 API

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 can call C programs, such as Python, C#, F#, etc., can also be used
  • The program developed by using XLPack API can run on the personal computers in which XLPack (or XLPack Lite) is installed

Further, LAPACKE/CBLAS library for XLPack API is provided.

Notes

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.

Download

The necessary software (XLPack SDK) can be downloaded from here.

XLPack API reference manuals

C/C++ function reference manual (open in a separate tab)
C/C++ function reference manual (for XLPack Lite) (open in a separate tab)

How to use XLPack API

Examples calling XLPack functions from C/C++

Example problem

Solve the following system of linear equations.

  Ax = b
             ( 10  -7   0 )       (  0 )       ( 7 )
  where, A = ( -3   2   6 ),  x = ( -1 ),  b = ( 4 )
             (  5  -1   5 )       (  1 )       ( 6 )

C example program (Visual C)

#include <stdio.h>
#include "cnumlib.h"

int main(void)
{
    double a[9] = { 10.0, -3.0, 5.0, -7.0, 2.0, -1.0, 0.0, 6.0, 5.0 };
    double b[3] = { 7.0, 4.0, 6.0 };
    int n = 3, nrhs = 1, lda = 3, ldb = 3, ipiv[3], info;

    dgesv(n, nrhs, lda, a, ipiv, ldb, b, &info);
    printf("info = %d\n", info);
    printf("x = %f  %f  %f\n", b[0], b[1], b[2]);
    return 0;
}

Result

info = 0
x = 0.000000  -1.000000  1.000000

The header file cnumlib.h (cnumlib_lite.h for XLPack Lite) is used. XLPack.lib (XLPack_32.lib for 32 bit programs) or XLPack_Lite.lib (XLPack_Lite_32.lib for 32 bit programs) for XLPack Lite) should be linked. A matrix should be stored in column major order (same as VBA and Fortran).

C example program (Clang)

#include <stdio.h>
#include "cnumlib.h"

int main(void)
{
    double a[3][3], b[3];
    int n = 3, nrhs = 1, lda = 3, ldb = 3, ipiv[10], info;

    a[0][0] = 10.0; a[1][0] = -7.0; a[2][0] = 0.0;
    a[0][1] = -3.0; a[1][1] = 2.0;  a[2][1] = 6.0;
    a[0][2] = 5.0;  a[1][2] = -1.0; a[2][2] = 5.0;
    b[0] = 7.0;
    b[1] = 4.0;
    b[2] = 6.0;

    dgesv(n, nrhs, lda, a, ipiv, ldb, (double (*)[ldb])b, &info);
    printf("info = %d\n", info);
    printf("x = %f  %f  %f\n", b[0], b[1], b[2]);
    return 0;
}

Variable-length two-dimensional array is used for the matrix for Clang compiler (Windows LLVM Clang and macOS Xcode) which supports C99 standard.

Note – Please note that the notation of matrix in the reference manual follows the Clang case (variable-length two-dimensional array). Please replace it to the one-dimensional array in the case of Visual C.

C++ case

cnumlib (cnumlib_lite for XLPack Lite) may be used as the header file. A matrix is stored in one-dimensional array even in the case of Clang.

How to use complex number

A data type of complex number is written as “doublecomplex” in the manual. However, _Dcomplex (Visual C), double _Complex (Clang) or complex<double> (C++) is used for an actual program. To supplement the lack of complex operators in Visual C, complex arithmetic functions in category A4 are provided. Functions which return complex function value are not supported in C++ (such as zdotu, cgam, etc.). For those functions, the alternative subroutines are provided (such as zdotu_sub, cgam_sub, etc.)

Example problem

Solve the following system of linear equations.

  Ax = b
               (  1.66+0.6i   0.44-0.11i    0.82-0.56i )       (  0.59-0.28i )       (  0.9774-0.6426i )
    where, A = (  0.47+i      1.23-0.47i   -1.72+0.07i ),  x = ( -0.20-0.04i ),  b = ( -0.0860+1.3628i )
               ( -1.32-0.61i  1.42-0.4i     1.62+0.41i )       (  0.24-0.49i )       ( -0.6599-0.6625i )

C example program (Visual C)

#include <stdio.h>
#include <complex.h>
#include "cnumlib.h"

int main(void)
{
    _Dcomplex a[9] = {
        cmplx(1.66, 0.6), cmplx(0.47, 1.0), cmplx(-1.32, -0.61),
        cmplx(0.44, -0.11), cmplx(1.23, -0.47), cmplx(1.42, -0.4),
        cmplx(0.82, -0.56), cmplx(-1.72, 0.07), cmplx(1.62, 0.41) };
    _Dcomplex b[3] = {
        cmplx(0.9774, -0.6426), cmplx(-0.086, 1.3628), cmplx(-0.6599, -0.6625) };
    int n = 3, nrhs = 1, lda = 3, ldb = 3, ipiv[3], info;

    zgesv(n, nrhs, lda, a, ipiv, ldb, b, &info);
    printf("info = %d\n", info);
    printf("x = ");
    printf("(%f, %f) ", creal(b[0]), cimag(b[0]));
    printf("(%f, %f) ", creal(b[1]), cimag(b[1]));
    printf("(%f, %f)\n", creal(b[2]), cimag(b[2]));
    return 0;
}

Result

info = 0
x = (0.590000, -0.280000) (-0.200000, -0.040000) (0.240000, -0.490000)

C++ example program

#include <iostream>
#include <complex>
#include "cnumlib"

using namespace std;

int main(void)
{
    complex<double> a[3][3], b[3], i(0.0, 1.0);
    int n = 3, nrhs = 1, lda = 3, ldb = 3, ipiv[3], info;

    a[0][0] = 1.66+0.6*i;   a[1][0] = 0.44-0.11*i; a[2][0] = 0.82-0.56*i;
    a[0][1] = 0.47+i;       a[1][1] = 1.23-0.47*i; a[2][1] = -1.72+0.07*i;
    a[0][2] = -1.32-0.61*i; a[1][2] = 1.42-0.4*i;  a[2][2] = 1.62+0.41*i;
    b[0] = 0.9774-0.6426*i;
    b[1] = -0.086+1.3628*i;
    b[2] = -0.6599-0.6625*i;

    zgesv(n, nrhs, lda, (complex<double> *)a, ipiv, ldb, b, info);
    cout << "info = " << info << endl;
    cout << "x = " << b[0] << " " << b[1]  << " "  << b[2] << endl;
    return 0;
}

Result

info = 0
x = (0.59,-0.28) (-0.2,-0.04) (0.24,-0.49)
Examples calling XLPack functions from other programming languages

Calling from other programming languages

C/C++ program can call numerical calculation function modules of XLPack (or XLPack Lite) through XLPack API. Other programming languages can also be used if those languages are capable of calling external C programs.

Please refer to the sample programs for all functions of XLPack Lite for major programming languages (Python, C#, F#, VB.NET and Delphi(Pascal)) included in the XLPack SDK. Simple example programs of those languages extracted from SDK are shown below.

Example problem

Solve the following system of linear equations.

  Ax = b
             ( 10  -7   0 )       (  0 )       ( 7 )
  where, A = ( -3   2   6 ),  x = ( -1 ),  b = ( 4 )
             (  5  -1   5 )       (  1 )       ( 6 )

Example programs are written by separating the example program part and the interface part (which contains all the necessary codes to interface to XLPack). The library information necessary for the interface part is summarized at the last of this section.

Python example program

There are several ways to call C functions from Python, but here we use ctypes. Matrices are defined by numpy.array.

import numpy as np
from XLPack import *

def TestDgesv():
    n = 3
    nrhs = 1
    a = np.array([
        [10.0, -3.0, 5.0],
        [-7.0, 2.0, -1.0],
        [0.0, 6.0, 5.0]])
    b = np.array([7.0, 4.0, 6.0])
    ipiv = np.empty(n)
    info = Dgesv(n, nrhs, a, ipiv, b)
    print(b, info)

# -----------------

TestDgesv()

Interface part.

from ctypes import *

dll1 = CDLL("XLPackLite.dll")

def Dgesv(n, nrhs, a, ipiv, b):
    dll1.dgesv.argtype = [c_int, c_int, c_int, POINTER(c_double), POINTER(c_int), c_int, POINTER(c_double),
        POINTER(c_int)]
    if a.ndim <= 1:
        lda = n
    else:
        lda = a.shape[1]
    ldb = b.shape[0]
    info = c_int()
    dll1.dgesv(c_int(n), c_int(nrhs), c_int(lda), a.ctypes.data_as(POINTER(c_double)),
        ipiv.ctypes.data_as(POINTER(c_int)), c_int(ldb), b.ctypes.data_as(POINTER(c_double)), byref(info))
    return info.value

. . . 

Result.

[ 0. -1.  1.] 0

C# example program

using System;
using System.IO;
using static XLPack;

public class Test
{

static void Test_dgesv()
{
    double[] a = new double[9], b = new double[3];
    int[] ipiv = new int[3];
    int n, nrhs, lda, ldb, info;

    n = 3; nrhs = 1; lda = 3; ldb = 3;
    a[0] = 10.0; a[3] = -7.0; a[6] = 0.0;
    a[1] = -3.0; a[4] = 2.0; a[7] = 6.0;
    a[2] = 5.0; a[5] = -1.0; a[8] = 5.0;
    b[0] = 7.0; b[1] = 4.0; b[2] = 6.0;

    dgesv(n, nrhs, lda, a, ipiv, ldb, b, out info);
    Console.Write("info = {0}\n", info);
    Console.Write("x = {0}  {1}  {2}\n", b[0], b[1], b[2]);
}

public static int Main(string[] args)
{
    Test_dgesv();
    return 0;
}

}

Interface part.

using System.Runtime.InteropServices;

public static class XLPack
{
    const string DLL1 = "XLPackLite.dll";

    [DllImport(DLL1, CallingConvention = CallingConvention.Cdecl)]
    public extern static void dgesv(int n, int nrhs, int lda, double[] a, int[] ipiv, int ldb, double[] b, out int info);

    . . .

}

Result.

info = 0
x = 0  -1  1

F# example program

open XLPack.F

module TestDgesv =

    let n = 3
    let nrhs = 1
    let lda = 3
    let a = [| 10.0; -3.0; 5.0; -7.0; 2.0; -1.0; 0.0; 6.0; 5.0 |]
    let ldb = 3
    let b = [| 7.0; 4.0; 6.0 |]
    let ipiv = Array.create n 0
    let mutable info = 0
    dgesv(n, nrhs, lda, a, ipiv, ldb, b, &info)
    printfn "info = %d" info
    printfn "x = %A" b

Interface part.

namespace XLPack

module F =

    open System.Runtime.InteropServices

    [<Literal>]
    let Dll1 = "XLPackLite.dll"

    [<DllImport(Dll1, CallingConvention = CallingConvention.Cdecl, EntryPoint="dgesv")>]
    extern void dgesv(int n, int nrhs, int lda, double[] a, int[] ipiv, int ldb, double[] b, int& info)

    . . .

Result.

info = 0
x = [|0.0; -1.0; 1.0|]

VB.NET example program

Imports XLPack

Class Test

Shared Sub TestDgesv
	Dim A(8) As Double, LdA As Integer, B(2) As Double, LdB As Integer
	Dim IPiv(2) As Integer
	Dim N As Integer, Info As Integer

	N = 3: LdA = 3: LdB = 3
	A(0) = 10.0: A(3) = -7.0: A(6) = 0.0
	A(1) = -3.0: A(4) = 2.0: A(7) = 6.0
	A(2) = 5.0: A(5) = -1.0: A(8) = 5.0
	B(0) = 7.0: B(1) = 4.0: B(2) = 6.0

	Call Dgesv(N, LdA, A, IPiv, LdB, B, Info)
	Console.WriteLine("Info = {0}", Info)
	Console.WriteLine("X = {0}  {1}  {2}", B(0), B(1), B(2))
End Sub

Public Shared Sub Main(ByVal args() As String)
	Call TestDgesv
End Sub

End Class

Interface part.

Imports System.Runtime.InteropServices

Class XLPack

    Const DLL1 = "XLPackLite.dll"

    <DllImport(DLL1, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="dgesv")>
    Private Shared Sub XL_dgesv(N As Integer, Nrhs As Integer, LdA As Integer, A() As Double, IPiv() As Integer, LdB As Integer, B() As Double, ByRef Info As Integer)
    End Sub

    Public Shared Sub Dgesv(N As Integer, LdA As Integer, A() As Double, IPiv() As Integer, LdB As Integer, B() As Double, ByRef Info As Integer, Optional Nrhs As Integer = 1)
        Call XL_dgesv(N, Nrhs, LdA, A, IPiv, LdB, B, Info)
    End Sub

    . . .

End Class

Result.

info = 0
x = 0  -1  1

Delphi (Pascal) example program

program test_xlpack;

uses XLPack;

procedure test_dgesv;
var
    a: array[1..9] of Double; b: array[1..3] of Double;
    n, nrhs, lda, ldb: Integer;
    ipiv: array[1..3] of Integer;
    info: Integer;
begin
    n := 3; nrhs := 1; lda := 3; ldb := 3;
    a[1] := 10.0; a[4] := -7.0; a[7] := 0.0;
    a[2] := -3.0; a[5] := 2.0; a[8] := 6.0;
    a[3] := 5.0; a[6] := -1.0; a[9] := 5.0;
    b[1] := 7.0; b[2] := 4.0; b[3] := 6.0;
    Dgesv(n, nrhs, lda, a, ipiv, ldb, b, info);
    Writeln('info = ', info);
    Writeln('x =');
    Writeln(b[1], '  ', b[2], '  ', b[3]);
end;

begin
    test_dgesv;
end.

Interface part.

unit XLPack;

interface

const
    dll1 = 'XLPackLite.dll';

procedure Dgesv(n, nrhs, lda: Integer; var a: array of Double; var ipiv: array of Integer; ldb: Integer;
    var b: array of Double; var info: Integer);

{****************}

implementation

procedure XL_Dgesv(n, nrhs, lda: Integer; var a: Double; var ipiv: Integer; ldb: Integer; var b: Double;
    var info: Integer); cdecl; external dll1 name 'dgesv';

procedure Dgesv(n, nrhs, lda: Integer; var a: array of Double; var ipiv: array of Integer; ldb: Integer;
    var b: array of Double; var info: Integer);
begin
    XL_Dgesv(n, nrhs, lda, a[0], ipiv[0], ldb, b[0], info);
end;

end.

Result.

info = 0
x =
 0.00000000000000E+0000  -1.00000000000000E+0000   1.00000000000000E+0000

Library modules

To use numerical calculation functions of XLPack, it is necessary to call an appropriate library module with valid interface. The appropriate library module must be chosen as listed below. The calling convention of library module must be cdecl. For an entry name and parameter definitions, please refer to the details of functions described in function reference manual.

Function to be calledOSBit versionLibrary module to be used
XLPack module 1 functionsWindows64 bitXLPack1.dll
XLPack module 2 functionsWindows64 bitXLPack2.dll
XLPack module 3 functionsWindows64 bitXLPack3.dll
XLPack module 4 functionsWindows64 bitXLPack4.dll
XLPack module 1 to 4 common functionsWindows64 bitXLPack0.dll
XLPack Lite functionsWindows64 bitXLPackLite.dll
XLPack module 1 functionsWindows32 bitXLPack1_32.dll
XLPack module 2 functionsWindows32 bitXLPack2_32.dll
XLPack module 3 functionsWindows32 bitXLPack3_32.dll
XLPack module 4 functionsWindows32 bitXLPack4_32.dll
XLPack module 1 to 4 common functionsWindows32 bitXLPack0_32.dll
XLPack Lite functionsWindows32 bitXLPackLite_32.dll
XLPack module 1 functionsmacOS64 bitXLPack1.dylib
XLPack module 2 functionsmacOS64 bitXLPack2.dylib
XLPack module 3 functionsmacOS64 bitXLPack3.dylib
XLPack module 4 functionsmacOS64 bitXLPack4.dylib
XLPack module 1 to 4 common functionsmacOS64 bitXLPack0.dylib
XLPack Lite functionsmacOS64 bitXLPackLite.dylib
How to use LAPACKE/CBLAS

LAPACKE/CBLAS library software for XLPack API is included in XLPack SDK.

LAPACKE/CBLAS is the interface conversion program for LAPACK/BLAS which is written in Fortran. LAPACKE/CBLAS allows you to call LAPACK/BLAS routines directly from C/C++, and can be regraded as the C/C++ version of LAPACK/BLAS. The differences from Fortran version are as follows.

  • Prefix LAPACKE_ or cblas_ is added to the subroutine/function name
  • Temporary work storage will be automatically allocated in the routine (It is also possible to allocate externally like original Fortran version. In that case, suffix _work is added to the name.)
  • It can be specified whether the two-dimensional arrays are stored in row-major or column-major order. When row-major is specified, the storage order is conveniently same as the original C/C++ array order. However, in this case, the arrays are transposed and copied before and after calculation. Then the overhead may be significant if the matrix is large.

In addition to C interface library, Lapacke.lib (or Lapacke_32.lib if 32 bit program) must be linked. The header files lapacke.h and cblas.h are used. For XLPack Lite, Lapacke_Lite.lib (or Lapacke_Lite_32.lib) and lapacke_lite.h are used.

LAPACKE and CBLAS routines corresponding to LAPACK and BLAS routines included in XLPack are supported.

List of supported LAPACKE/CBLAS routines

(*) shows the routines supported by XLPack Lite.

cblas_drotg cblas_drotmg cblas_drot cblas_drotm cblas_dswap cblas_dscal
cblas_dcopy cblas_daxpy cblas_ddot cblas_dsdot cblas_dnrm2 cblas_dasum
cblas_idamax
cblas_dgemv cblas_dgbmv cblas_dger cblas_dsbmv cblas_dspmv cblas_dspr
cblas_dspr2 cblas_dsymv cblas_dsyr cblas_dsyr2 cblas_dtbmv cblas_dtbsv
cblas_dtpmv cblas_dtpsv cblas_dtrmv cblas_dtrsv
cblas_dgemm cblas_dsymm cblas_dsyrk cblas_dsyr2k cblas_dtrmm cblas_dtrsm

cblas_zswap cblas_zscal cblas_zdscal cblas_zcopy cblas_zaxpy cblas_zdotu_sub
cblas_zdotc_sub cblas_dznrm2 cblas_dzasum cblas_izamax
cblas_zgemv cblas_zgbmv cblas_zhemv cblas_zhbmv cblas_zhpmv cblas_ztrmv
cblas_ztbmv cblas_ztpmv cblas_ztrsv cblas_ztbsv cblas_ztpsv cblas_zgeru
cblas_zgerc cblas_zher cblas_zher2 cblas_zhpr cblas_zhpr2
cblas_zgemm cblas_zsymm cblas_zhemm cblas_zherk cblas_zher2k cblas_ztrmm
cblas_ztrsm cblas_zsyrk cblas_zsyr2k

LAPACKE_ddisna LAPACKE_dgbcon LAPACKE_dgbsv LAPACKE_dgbsvx LAPACKE_dgbtrf
LAPACKE_dgbtrs LAPACKE_dgecon(*) LAPACKE_dgees LAPACKE_dgeesx LAPACKE_dgeev
LAPACKE_dgeevx LAPACKE_dgejsv LAPACKE_dgelqf LAPACKE_dgels(*) LAPACKE_dgelss
LAPACKE_dgelsy LAPACKE_dgeqp3 LAPACKE_dgeqrf LAPACKE_dgesv(*) LAPACKE_dgesvd
LAPACKE_dgesvdx LAPACKE_dgesvj LAPACKE_dgesvx LAPACKE_dgetrf LAPACKE_dgetri
LAPACKE_dgetrs LAPACKE_dgges LAPACKE_dggesx LAPACKE_dggev LAPACKE_dggevx
LAPACKE_dggglm LAPACKE_dgglse LAPACKE_dggsvd3 LAPACKE_dgtcon LAPACKE_dgtsv
LAPACKE_dgtsvx LAPACKE_dgttrf LAPACKE_dgttrs LAPACKE_dlamch(*) LAPACKE_dlange(*)
LAPACKE_dlansy(*) LAPACKE_dlantr LAPACKE_dorglq LAPACKE_dorgqr LAPACKE_dormlq
LAPACKE_dormqr LAPACKE_dpbcon LAPACKE_dpbsv LAPACKE_dpbsvx LAPACKE_dpbtrf
LAPACKE_dpbtrs LAPACKE_dpocon(*) LAPACKE_dposv(*) LAPACKE_dposvx LAPACKE_dpotrf
LAPACKE_dpotri LAPACKE_dpotrs LAPACKE_dppcon LAPACKE_dppsv LAPACKE_dppsvx
LAPACKE_dpptrf LAPACKE_dpptri LAPACKE_dpptrs LAPACKE_dptcon LAPACKE_dptsv
LAPACKE_dptsvx LAPACKE_dpttrf LAPACKE_dpttrs LAPACKE_dsbev LAPACKE_dsbevx
LAPACKE_dsbgv LAPACKE_dsbgvx LAPACKE_dsgesv LAPACKE_dspcon LAPACKE_dspev
LAPACKE_dspevx LAPACKE_dspgv LAPACKE_dspgvx LAPACKE_dsposv LAPACKE_dspsv
LAPACKE_dspsvx LAPACKE_dsptrf LAPACKE_dsptri LAPACKE_dsptrs LAPACKE_dstev
LAPACKE_dstevx LAPACKE_dsycon LAPACKE_dsyev(*) LAPACKE_dsyevx LAPACKE_dsygv
LAPACKE_dsygvx LAPACKE_dsysv LAPACKE_dsysvx LAPACKE_dsytrf LAPACKE_dsytri
LAPACKE_dsytrs LAPACKE_dtbcon LAPACKE_dtbtrs LAPACKE_dtpcon LAPACKE_dtptri
LAPACKE_dtptrs LAPACKE_dtrcon LAPACKE_dtrtri LAPACKE_dtrtrs LAPACKE_dtrttf
LAPACKE_dlatms

LAPACKE_slamch

LAPACKE_zcgesv LAPACKE_zcposv LAPACKE_zgbcon LAPACKE_zgbsv LAPACKE_zgbsvx
LAPACKE_zgbtrf LAPACKE_zgbtrs LAPACKE_zgecon LAPACKE_zgees LAPACKE_zgeesx
LAPACKE_zgeev LAPACKE_zgeevx LAPACKE_zgejsv LAPACKE_zgelqf LAPACKE_zgels
LAPACKE_zgelss LAPACKE_zgelsy LAPACKE_zgeqp3 LAPACKE_zgeqrf LAPACKE_zgesv
LAPACKE_zgesvd LAPACKE_zgesvdx LAPACKE_zgesvj LAPACKE_zgesvx LAPACKE_zgetrf
LAPACKE_zgetri LAPACKE_zgetrs LAPACKE_zgges LAPACKE_zggesx LAPACKE_zggev
LAPACKE_zggevx LAPACKE_zggglm LAPACKE_zgglse LAPACKE_zggsvd3 LAPACKE_zgtcon
LAPACKE_zgtsv LAPACKE_zgtsvx LAPACKE_zgttrf LAPACKE_zgttrs LAPACKE_zhbev
LAPACKE_zhbevx LAPACKE_zhbgv LAPACKE_zhbgvx LAPACKE_zhecon LAPACKE_zheev
LAPACKE_zheevx LAPACKE_zhegv LAPACKE_zhegvx LAPACKE_zhesv LAPACKE_zhesvx
LAPACKE_zhetrf LAPACKE_zhetri LAPACKE_zhetrs LAPACKE_zhpcon LAPACKE_zhpev
LAPACKE_zhpevx LAPACKE_zhpgv LAPACKE_zhpgvx LAPACKE_zhpsv LAPACKE_zhpsvx
LAPACKE_zhptrf LAPACKE_zhptri LAPACKE_zhptrs LAPACKE_zlange LAPACKE_zlanhe
LAPACKE_zlansy LAPACKE_zlantr LAPACKE_zpbcon LAPACKE_zpbsv LAPACKE_zpbsvx
LAPACKE_zpbtrf LAPACKE_zpbtrs LAPACKE_zpocon LAPACKE_zposv LAPACKE_zposvx
LAPACKE_zpotrf LAPACKE_zpotri LAPACKE_zpotrs LAPACKE_zppcon LAPACKE_zppsv
LAPACKE_zppsvx LAPACKE_zpptrf LAPACKE_zpptri LAPACKE_zpptrs LAPACKE_zptcon
LAPACKE_zptsv LAPACKE_zptsvx LAPACKE_zpttrf LAPACKE_zpttrs LAPACKE_zspcon
LAPACKE_zspsv LAPACKE_zspsvx LAPACKE_zsptrf LAPACKE_zsptri LAPACKE_zsptrs
LAPACKE_zsycon LAPACKE_zsyr LAPACKE_zsysv LAPACKE_zsysvx LAPACKE_zsytrf
LAPACKE_zsytri LAPACKE_zsytrs LAPACKE_ztbcon LAPACKE_ztbtrs LAPACKE_ztpcon
LAPACKE_ztptri LAPACKE_ztptrs LAPACKE_ztpttf LAPACKE_ztrcon LAPACKE_ztrtri
LAPACKE_ztrtrs LAPACKE_ztrttf LAPACKE_zunglq LAPACKE_zungqr LAPACKE_zunmlq
LAPACKE_zunmqr LAPACKE_zlatms

In the current version, there are some differences on the run-time error handling from the original software as follows.

  • For some errors, error messages are output by the LAPACK/BLAS base routines instead of LAPACKE/CBLAS routines. In those cases, the displayed argument number may be different from LAPACKE/CBLAS.

Please refer to the following original sites for more details.

Description of LAPACKE
LAPACK function reference manual including LAPACKE and CBLAS functions

C example program (Viausl C) which has been modified by using LAPACKE is shown below. A matrix is stored in column major order (C language original notation).

#include <stdio.h>
#include "lapacke.h"

int main(void)
{
    double a[3][3], b[3];
    int n = 3, nrhs = 1, lda = 3, ldb = 1, ipiv[3], info;

    a[0][0] = 10.0; a[0][1] = -7.0; a[0][2] = 0.0;
    a[1][0] = -3.0; a[1][1] = 2.0;  a[1][2] = 6.0;
    a[2][0] = 5.0;  a[2][1] = -1.0; a[2][2] = 5.0;
    b[0] = 7.0;
    b[1] = 4.0;
    b[2] = 6.0;

    info = LAPACKE_dgesv(LAPACK_ROW_MAJOR, n, nrhs, (double *)a, lda, ipiv, b, ldb);
    printf("info = %d\n", info);
    printf("x = %f  %f  %f\n", b[0], b[1], b[2]);
    return 0;
}

Source libraries

LAPACK: http://www.netlib.org/lapack/
SLATEC: http://www.netlib.org/slatec/
MINPACK: http://www.netlib.org/minpack/
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
FFTPACK5: http://www2.cisl.ucar.edu/resources/legacy/fftpack5
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

References

D. Kahaner, C. Moler, S. Nash, “Numerical Methods and Software”, Prentice-Hall (1989)
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

Top