Ruby-LAPACK is a Ruby wrapper of LAPACK.
the latest version is 1.8.2 [05 Nov 2021]
# gem install ruby-lapack
ruby-lapack-1.8.2.tar.gz
You can also get from git repository
% git clone http://ruby.gfd-dennou.org/products/ruby-lapack/ruby-lapack.git
You need require numru/lapack to use Ruby-LAPACK
require 'numru/lapack'
Each subroutine/function is defined as module function of NumRu::Lapack.
returns = NumRu::Lapack.method_name(args)
NumRu::Lapack.method_name(:help => true) NumRu::Lapack.method_name(:usage => true)
Documents for individual methods are here
DSYEVR: Compultes selected eigenvalues, and optinally, eigenvectors of a real symmetric matrix.
The following script calculats the leading eigenvalue and corresponding eigenvector of the matrix (x_11 = 1, x_12 = x_21 = 2, x_22 = 3).
Ruby method is NumRu::Lapack.dsyevr.
jobz = "V" range = "I" uplo = "U" a = NArray[[1,2],[2,3]] vl = vu = 0 # not be used in this example il = 1 iu = 2 abstol = 0.0 m, w, z, isuppz, work, iwork, info, a = NumRu::Lapack.dsyevr(jobz, range, uplo, a, vl, vu, il, iu, abstol)The corresponding FORTRAN subroutine is DSYEVR.
SUBROUTINE DSYEVR(JOBZ, RANGE, UPLO, N, A, LDA, VL, IL, IU, ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK, IWORK, LIWORK, INFO) # JOBZ(input), RANGE(input), UPLO(input) # N(input), A(input/output), LDA(input) # VL(input), IL(input), IU(input), ABSTOL(input) # M(output), W(output), Z(output), LDZ(input), ISUPPZ(output) # WORK(workspace/output), LWORK(input), IWORK(workspace/output), LIWORK(input) # INFO(output)N is order of the matrix A, LDA is size of the leading dimension of the array A, LDZ is size of the leading dimension of the array Z, LWORK is size of the array WORK, and LIWORK is size of the array IWORK.