我要加入 登录
声振论坛 返回首页

impulse的个人空间 http://home.vibunion.com/?41382 [收藏] [复制] [分享] [RSS]

日志

Linear Algebra in Java

已有 428 次阅读2013-4-25 12:54 | Java

本文对Java环境下的数值算法库进行了简单介绍。
Many scientific applications require optimized matrix and linear algebra operations. There are a two standard suites of routines. First, BLAS (basic linear algebra subprograms) includes matrix and vector algebra routines. Second is LAPACK (linear algebra package) which includes more sophisticated linear algebra routines such such as solving linear systems of equations, eigenvalue decomposition, singular value decomposition, QR decomposition, etc. The Netlib Repository contains the fortran reference implementations for these libraries, but you really want to use optimized versions for your specific architecture. AMD and Intel both have proprietary implementations: ACML for AMD and IMKL for intel. Alternatively the open source project ATLAS (Automatically Tuned Linear Algebra Package) provides BLAS and LAPACK libraries that are automatically optimized for you system (if you compile it yourself). However the process of tuning and compiling ATLAS takes several hours (at least when I tried it a few years ago in Gentoo). If you don't need the absolutely best performance you can instead download pre-compiled ATLAS libraries for your architecture.

There are many interfaces to these libraries: Matlab and R use optimized libraries by default. In C++ you can use Boost uBLAS and link to the proper libraries. There are quite a few math packages for Java that include bindings to BLAS/LAPACK such as COLT, Parallel Colt, JAMA, EJML, JBLAS,MTJ, and lastly the specific library I use (actually it's for Scala) is Scalala which is heavily based on MTJ. Almost all these libraries leverage netlib-java to actually perform the operations (JBLAS and maybe some others provide their own interfaces). Netlib-java includes both pure-java implementations of BLAS and LAPACK, as well as the option to make JNI calls to the optimized libraries (e.g. ACML, IMKL, or ATLAS). However, binary JNI libraries are not usually included with these packages and as a result the linear algebra operations will be slow. I've found countless complaints on forums comparing these Java libraries to Matlab/R/Python/C etc. and finding it is an order of magnitude slower but this is only because they are not using the bindings to optimized libraries.

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 我要加入

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-9 00:28 , Processed in 0.032631 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部