kaz:blas

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
最新のリビジョン両方とも次のリビジョン
kaz:blas [2014/02/16 03:21] – [vect Object and its Operations] kazkaz:blas [2014/02/17 16:00] – [Level1 BLAS Interfaces] kaz
行 1: 行 1:
 +====== BLAS Interface for Racket ======
 +[[.:|Go back]]
  
 +|''(require math/blas)''|package: blas|
 +|Author: K. Hishinuma||
 +
 +The ''math/blas'' library ([[https://github.com/kazh98/blas|git://github.com/kazh98/blas]] package) provides BLAS interfaces for Racket using a ''libcblas'' or ''libgslcblas'' FFI.
 +To install ''math/blas'' library, enter the following command in terminal.
 +<code>
 +% raco pkg install github://github.com/kazh98/blas/master
 +</code>
 +If your operating system isn't MacOS X, you are required to install [[https://www.gnu.org/software/gsl/|GNU Scientific Library]] in your computer to use this library.
 +===== "vect" Object and its Operations =====
 +<code scheme>
 +; [PROCEDURE] exact-nonnegative-integer? -> vect?
 +(make-vect len)
 +
 +; [PROCEDURE] real? ... -> vect?
 +(vect val ...)
 +
 +; [PROCEDURE] any/c -> boolean?
 +(vect? v)
 +
 +; [PROCEDURE] vect? -> exact-nonnegative-integer?
 +(vect-length vec)
 +
 +; [PROCEDURE] vect? exact-nonnegative-integer? -> real?
 +(vect-ref vec k)
 +
 +; [PROCEDURE] vect? exact-nonnegative-integer? real? -> void?
 +(vect-set! vec k val)
 +
 +; [PROCEDURE] (listof real?) -> vect?
 +(list->vect lst)
 +
 +; [PROCEDURE] vect? -> (listof real?)
 +(vect->list vec)
 +</code>
 +They are like [[http://docs.racket-lang.org/reference/vectors.html#%28def._%28%28quote._~23~25kernel%29._make-vector%29%29|make-vector]], etc.
 +
 +===== Level1 BLAS (Vector-Vector Operations) Interfaces =====
 +<code scheme>
 +; [PROCEDURE] vect? vect? -> void?
 +(SWAP x y)
 +</code>
 +$x\in\mathbb{R}^n,y\in\mathbb{R}^n,$\\
 +$$x \leftrightarrow y.$$
 +
 +<code scheme>
 +; [PROCEDURE] real? vect? -> void?
 +(SCAL a x)
 +</code>
 +$a\in\mathbb{R},x\in\mathbb{R}^n,$\\
 +$$x \leftarrow ax.$$
 +
 +<code scheme>
 +; [PROCEDURE] vect? vect? -> void?
 +(COPY x y)
 +</code>
 +$x\in\mathbb{R}^n,y\in\mathbb{R}^n,$\\
 +$$y \leftarrow x.$$
 +
 +<code scheme>
 +; [PROCEDURE] real? vect? vect? -> void?
 +(AXPY a x y)
 +</code>
 +$a\in\mathbb{R},x\in\mathbb{R}^n,y\in\mathbb{R}^n,$\\
 +$$y \leftarrow ax+y.$$
 +
 +<code scheme>
 +; [PROCEDURE] vect? vect? -> real?
 +(DOT_ x y)
 +</code>
 +$x\in\mathbb{R}^n,y\in\mathbb{R}^n,$\\
 +$$\langle x,y \rangle=\sum_{i=1}^nx_iy_i.$$
 +
 +<code scheme>
 +; [PROCEDURE] vect? -> (and/c real? (not/c negative?))
 +(NRM2 x)
 +</code>
 +$x\in\mathbb{R}^n,$\\
 +$$\|x\|_2=\sqrt{\langle x,x \rangle}.$$
 +
 +<code scheme>
 +; [PROCEDURE] vect? -> (and/c real? (not/c negative?))
 +(ASUM x)
 +</code>
 +$x\in\mathbb{R}^n,$\\
 +$$\|x\|_1=\sum_{i=1}^n\left|x_i\right|.$$
 +
 +<code scheme>
 +; [PROCEDURE] vect? -> exact-nonnegative-integer?
 +(IAMX x)
 +</code>
 +$x\in\mathbb{R}^n,$\\
 +$$k\in\mathbb{N}:\left|x_k\right|\ge{}\left|x_i\right|\hspace{1em}(\forall{}i\in\mathbb{Z}:0\le{}i<n).$$
 +
 +===== References =====
 +  - Numerical Algorithms Group Ltd.: [[http://www.netlib.org/blas/blasqr.pdf|Basic Linear Algebra Subprograms: A Quick Reference Guide]]. Oak Ridge National Laboratory, University of Tennessee: (1997).