LibSakura  5.2
Sakura Library API

Sakura Library is a high-performance, thread-safe library compatible with C and C++ that is optimized for data analysis of astronomy and astrophysics.

Introduction

Sakura Library (libsakura) is a data analysis library that aims at more efficient processing than ever. To improve a performance, Sakura Library vectorizes the operation
by making effective use of SIMD instructions. This is accomplished by implementing each function as compiler-friendly as possible so that the compiler produces highly vectorized object code. If the compiler fails to vectorize, or misses using desired SIMD instructions, in a certain function, we write manually vectorized code for that function using intrinsics.

The Sakura Library is written based on C++11 standard, but can be used from both C and C++ because its interface is compatible with C.

At the present time, the main application of the Sakura Library is the reduction of astronomical data taken by radio telescopes, especially single-dish radio telescopes. However, functions in Sakura Library are designed as generic as possible. Thus, Sakura Library should be applicable to any kind of data analysis.

Currently available functions are as follows:

  • interpolation
  • least-square fitting
  • non-linear Gaussian fitting
  • data filtering/masking
  • convolution (1- and 2-dimensional)
  • calculation of statistics
  • bit operation
  • specific functions for radio astronomical data analysis
  • miscellaneous utility functions

Getting Sakura Library

Main page of the Sakura Library is

http://alma-intweb.mtk.nao.ac.jp/~sakura/

Source code of the Sakura Library are distributed in gzip-compressed tarballs. Latest release can be downloaded from:

https://alma-dl.mtk.nao.ac.jp/ftp/sakura/releases/latest_src/

Name of the tarball follows the naming scheme below:

 libsakura-<major version>.<minor version>.<code revision>.tgz

How to build libsakura

Please see INSTALL.txt for detailed instruction on how to build libsakura. INSTALL.txt should also be included in the package.

How to link libsakura to your application

Include <libsakura/sakura.h> from your sources.

Sakura main header file.

Link your application with libsakura, for example, by

 cc/c++ -I<where libsakura resides>/include your sources -rdynamic -L<where libsakura resides>/lib -Wl,-rpath,<where libsakura resides>/lib -lsakura ...

For example:

$ cat <<EOF >sample.c
#include <stdio.h>
#include <libsakura/sakura.h>

int main() {
        sakura_Status status = sakura_Initialize(NULL, NULL);
        if (sakura_Status_kOK != status) return 1;
        printf("%zu\n", sakura_GetAlignment());
        sakura_CleanUp ();
        return 0;
}
EOF
$ cc -I<where libsakura resides>/include sample.c -rdynamic -L <where libsakura resides>/lib -Wl,-rpath,<where libsakura resides>/lib -lsakura
$ ./a.out

API

Public API of Sakura Library is available here. All parameters marked as 'must-be-aligned' must be aligned at vector operation word boundary. You can get required word size by calling sakura_GetAlignment. Functions marked as 'MT-safe' can safely be called from threads that are running in parallel. On the other hand, functions without 'MT-safe' sign must be called sequentially, i.e., you should not use those functions on multi-thread processing.

License

The Sakura Library is free software. It is distributed under LGPL version 3. See COPYING and COPYING.LESSER for details about terms and conditions. Those files should be included in the source distribution of the Sakura Library.

Contact us

Please send bug report to sakur.nosp@m.a@al.nosp@m.ma.mt.nosp@m.k.na.nosp@m.o.ac..nosp@m.jp if you find a bug.