pax_global_header 0000666 0000000 0000000 00000000064 12106720513 0014507 g ustar 00root root 0000000 0000000 52 comment=2b66dd0ddf06d5a14424778c6e96189b9611d97d
jblas-1.2.3/ 0000775 0000000 0000000 00000000000 12106720513 0012605 5 ustar 00root root 0000000 0000000 jblas-1.2.3/.gitignore 0000664 0000000 0000000 00000000115 12106720513 0014572 0 ustar 00root root 0000000 0000000 # maven target repo
target/
# idea files
.idea/
*.ipr
*.iml
*.iws
jblas-1.2.3/.travis.yml 0000664 0000000 0000000 00000000237 12106720513 0014720 0 ustar 00root root 0000000 0000000 language: java
notifications:
email: mikiobraun@gmail.com
on_success: never
on_failure: always
before_install:
- sudo apt-get install -q libgfortran3
jblas-1.2.3/AUTHORS 0000664 0000000 0000000 00000000552 12106720513 0013657 0 ustar 00root root 0000000 0000000 Main Developer:
Mikio L. Braun
Additional Programming and Contributions:
Johannes Schaback
Jan Saputra Müller (exponential matrix multiplication, decomposition)
Matthias L. Jugel (packaging)
Nicolas Oury (generalized eigenvectors)
http://github.com/cheshirekow (fixed with range objects)
Quantisan (travis integration)
robbymckilliam (fixes with complex SVD) jblas-1.2.3/BUGS 0000664 0000000 0000000 00000000473 12106720513 0013274 0 ustar 00root root 0000000 0000000 Known Bugs:
- XERBLA handling under Mac OS X
Under Mac OS X, xerbla isn't properly handled, leading to an error message
and the exit of the program. The linker does not take our own version
of xerbla, but instead uses the one supplied by the BLAS library. I
still need to figure out what the right options are.
jblas-1.2.3/BUILDING_ATLAS 0000664 0000000 0000000 00000015375 12106720513 0014664 0 ustar 00root root 0000000 0000000 BUILDING_ATLAS
==============
In this file, I summarize the different configuration options for the
platforms. I keep this information mainly for my own reference, but
of course, you can try it out yourself ;)
I strongly suggest that you build ATLAS with the --with-netlib-lapack
option. This includes higher-level routines not covered in ATLAS from
the lapack libraries.
From my experience, I also found that the Core2 architectural defaults
work pretty well for both Intel and AMD chips. On 64bit, AMD64K10h is
a bit better, but not much. On the other hand, the AMD settings
perform too well on the Intel platform.
TABLE OF CONTENTS:
1. OBTAINING THE SOFTWARE
2. GENERAL REMARKS
3. LINUX
4. MAC OS X
5. WINDOWS
1. OBTAINING THE SOFTWARE
=========================
Getting lapack:
wget http://www.netlib.org/lapack/lapack-lite-3.1.1.tgz
Getting ATLAS:
wget http://sourceforge.net/projects/math-atlas/files/Stable/3.8.3/atlas3.8.3.tar.bz2/download
Getting jblas:
git clone git://github.com/mikiobraun/jblas.git
2. GENERAL REMARKS
==================
The general steps are as follows:
* Compile lapack. Lapack uses blas for its low-level
computations. ATLAS also implements a subset of Lapack, but not all
routines. But you can build ATLAS to include the Lapack routines it
does not implement, and this is what we're going to do.
* Compile ATLAS.
* Compile the native part of jblas with "make".
* Compile the java part of jblas with "ant" or maven.
The ATLAS build process is a bit, well, unusual, coming with compiled
(not scripted) configuration scripts. ATLAS has prebuilt
configurations which result in much faster compilation times. If it
doesn't find such a profile for your computer, it will perform a large
number of timing experiments to find the best combination (hence the
name "Automatically Tuned...").
Finally, some older processors don't support the SSE3 command
set. Some tweaking is necessary to compile ATLAS for SSE2, namely
configuring as for SSE3, and then going into the file "Make.inc", and
replacing SSE2 by SSE3 or removing -DATL_SSE3 from the compiler
directives.
For reference, here is a list of the main ATLAS options.
ATLAS OPTIONS
-------------
This chart may come in handy when you want ATLAS to build with some
predefined configurations.
ATLAS Architecture Options: (-A)
0 = 'UNKNOWN'
1 = 'POWER3'
2 = 'POWER4'
3 = 'POWER5'
4 = 'PPCG4'
5 = 'PPCG5'
6 = 'P5'
7 = 'P5MMX'
8 = 'PPRO'
9 = 'PII'
10 = 'PIII'
11 = 'PM'
12 = 'CoreSolo'
13 = 'CoreDuo'
14 = 'Core2Solo'
15 = 'Core2' <- used for 32 bit builds
16 = 'Corei7'
17 = 'P4'
18 = 'P4E'
19 = 'Efficeon'
20 = 'K7'
21 = 'HAMMER'
22 = 'AMD64K10h' <- used for 64 bit builds
23 = 'UNKNOWNx86'
24 = 'IA64Itan'
25 = 'IA64Itan2'
26 = 'USI'
27 = 'USII'
28 = 'USIII'
29 = 'USIV'
30 = 'UnknownUS'
31 = 'MIPSR1xK'
32 = 'MIPSICE9'
ATLAS Operating System Options: (-O)
0 = 'UNKNOWN'
1 = 'Linux'
2 = 'SunOS'
3 = 'SunOS4'
4 = 'OSF1'
5 = 'IRIX'
6 = 'AIX'
7 = 'Win9x'
8 = 'WinNT'
9 = 'HPUX'
10 = 'FreeBSD'
11 = 'OSX'
3. Linux
========
LAPACK
------
Copy make.inc.LINUX from INSTALL directory, update options in the file
like this:
FORTRAN = gfortran
OPTS = -O2 -fPIC
DRVOPTS = $(OPTS)
NOOPT = -fPIC
LOADER = gfortran
LOADOPTS = -fPIC
compile with "make -k blaslib lapacklib". "-k" (continue on error) is
needed because some files won't build otherwise.
ATLAS
-----
For 32 bit:
mkdir build
cd build
> ../configure -C if gfortran \
--with-netlib-lapack=$HOME/build/lapack-lite-3.1.1/liblapack_fortran.a \
-A 15 -Si cputhrchk 0 -b 32
make
make time
This sets the fortran compiler to gfortran, architecture Core2, 32
bit, and don't test for CPU throttling (not needed because we use
predefined configuration)
For 64 bit:
as above, but configure with
> ../configure \
--with-netlib-lapack=$HOME/build/lapack-lite-3.1.1/lapack_LINUX.a \
-A 21 -b 64 -Si cputhrchk 0 -Fa alg -fPIC
jblas
-----
> ./configure --static-libs --libpath=$HOME/build/ATLAS/build/lib/
4. Mac OS X
===========
If you install the gfortran with mac ports, you get gcc-mp-4.3 and
gfortran-mp-4.3. This means you have to redefine all the
compilers. Apart from that, it was pretty "smooth sailing ;)"
LAPACK
------
cp INSTALL/make.inc.LINUX make.inc
Update options to
FORTRAN = gfortran-mp-4.3
OPTS = -funroll-all-loops -O3 -fPIC
DRVOPTS = $(OPTS)
NOOPT = -fPIC
LOADER = gfortran-mp-4.3
LOADOPTS =
Run with "make -k"
ATLAS
-----
mkdir build_macosx
cd build_macosx
Execute the following script buil.sh:
CC=gcc-mp-4.3
F77=gfortran-mp-4.3
LAPACK=$HOME/Documents/lapack-lite-3.1.1
../configure -b 32 -C xc $CC -C gc $CC -C if $F77 -C ic $CC -C dm $CC -C sm $CC -C dk $CC -C sk $CC -Fa alg -fPIC --with-netlib-lapack=$LAPACK/liblapack_fortran.a
It's important to set the 32bit flag. Otherwise, it seems to construct
64 bit code.
5. Windows XP (32bit)
=====================
I'm describing here using cygwin. For some reason, the gcc4 version in
cygwin does not support compiling to mingw, but using the cygwin
version leads to some address spaces clashes with Java (at least, the
last time I checked), leading to a crash as soon as the cygwin
compiled code is loaded.
What all of this means is that you should use the old gcc3 "legacy"
compilers.
Also watch out for directory names with spaces in them, ATLAS does not
like them.
LAPACK
------
Compiling LAPACK just works as in Linux, but replace "gfortran" by "g77".
ATLAS
-----
Back in ATLAS 3.6, one needed to set architectures explicitly. With
3.8.3, there is no need to do so, but you have to set the fortran
compiler explicitly to "g77" (and the bit numbers to 32):
../configure --with-netlib-lapack=$HOME//build/lapack-lite-3.1.1/liblapack_fortran.a -A 15 -C if g77 -b 32
64-bit
------
Unfortunately, it is currently not possible to compile ATLAS for 64bit
under windows, mainly because cygwin is 32bit. There exists the
ming-w64 bit project (http://sourceforge.net/projects/mingw-w64/),
which provides 64bit compiler for the MINGW environment (a subset of
the UNIX- like environment cygwin provides, unfortunately insufficient
to build ATLAS).
What you can do, though,
Pure LAPACK-build on Windows 64 bit
-----------------------------------
Install the x86_64-w64-mingw32 compilers (just about everything except
for ada and objective C) ;)
In order to run fortran files, you might need to put
x86_64-w64-mingw32/sys-root/mingw/bin/
into your PATH.
Then, go into lapack-lite, and edit make.inc such that gfortran is
replaced by x86_64-w64-mingw32-gfortran everywhere. You should also
include the -funroll-all-loops -O3 options.
Compile using "make -k blaslib lapacklib" as usual, and rename the
results to libblas.a and liblapack.a. Then, do a normal lapack build.
jblas-1.2.3/COPYING 0000664 0000000 0000000 00000003037 12106720513 0013643 0 ustar 00root root 0000000 0000000 Copyright (c) 2009, Mikio L. Braun and contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the Technische Universität Berlin nor the
names of its contributors may be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
jblas-1.2.3/INSTALL 0000664 0000000 0000000 00000010657 12106720513 0013647 0 ustar 00root root 0000000 0000000 INSTALL Guide
Version 1.2.0, January 7, 2011
Version 1.0, December 22, 2009
Version 0.3, September 17, 2009
Version 0.2, May 8, 2009
Version 0.1, March 28, 2009
If you just want to get started, I recommend that you download the
multiplatform" jar file which already includes the required native
BLAS and LAPACK code based on lapack-lite
(http://www.netlib.org/lapack/lapack-lite-3.1.1.tgz) and ATLAS
(http://math-atlas.sourceforge.net/) for a number of operating
systems. Currently supported are:
- Windows
- Linux
- Mac OS X
both in 32 bit and 64 bit versions.
If you are only adding code on the Java side, then you can work with
the supplied build.xml ant script. Simply type "ant jar" to compile
the new jar file.
Starting with version 1.2.0, you can also use maven to compile the project.
Both alternatives exist in parallel.
If you want to access further functions from LAPACK, you need to
recompile the native part. This procedure is a bit more involved, see
below.
COMPILING JBLAS (JAVA PART)
===========================
Prerequisites:
- java JDK
- ant
- maven
- ruby
ANT BUILD
---------
Running "ant clean jar" should do the job ;)
"ant jar" collects all static JNI libraries. Other build targets are:
- ant dynamic-lean-jar
Build a jar file with the JNI libraries, but without the ATLAS libraries
built in for only the current platform.
- ant static-lean-jar
Build a jar file with the JNI and ATLAS libraries only for the current
platform.
- ant minimal-jar
Build a jar file without the JNI and ATLAS libraries. Both must be
installed in the usual library locations.
MAVEN BUILD
-----------
Just the usual "mvn clean install" builds everything and installs the jar
file in your local repository.
INSTALLING JBLAS
----------------
1. Add "jblas-1.2.0.jar" to your CLASSPATH
2. By default, the dynamic libraries are extracted from the jar file
to the default temporary directory and loaded from there. If you
don't want to do this, extract the dynamic library from jblas-1.2.0.jar
and copy it somewhere where it can be found.
For Linux, use LD_LIBRARY_PATH, for Windows, PATH
COMPILING THE NATIVE PART
=========================
I assume that you already have a built of lapack-lite or ATLAS based
on the lapack-lite libraries. That build process is quite
involved. You can find some information about it in
BUILDING_ATLAS. You can also use the atlas libraries which come with
your distribution.
The build goes like this:
- run ./configure with options (see below)
- run "make" to build the JNI library
- run "ant jar" to package the library into the jar file
BUILD OPTIONS
-------------
Dynamic vs. Static
Basically, you can build with "dynamic" binding or "static" binding,
which means that either the JNI library is dynamically loading the
lapack libraries, or they are already linked into it. The latter case
("static") is better for standalone cases, but the resulting jar file
is bigger.
The default is dynamic binding, otherwise pass the option
"--static-libs" to the configure script.
This option also affects what libraries "ant jar" packs into the jar file.
LAPACK build vs. ATLAS build
You can either build against LAPACK only, or against the ATLAS
libraries. LAPACK is somewhat slower, but probably easier to
compile. To compile against LAPACK, pass the "--lapack-build"
option. I also recommend to use the "--libpath" option to specify
exactly where the libraries are.
CONFIGURE FLAGS SUMMARY
The configure script understands the following options:
--lapack=DIR
Location where the LAPACK and BLAS sources can be found. Location of
the extracted lapack-lite files. Otherwise it is assumed that they
can be found in the jblas directory
--lapack-build
Build only against LAPACK and BLAS, not ATLAS. Note that depending on
your configuration, you might still get an ATLAS version (for example, when
you compile under debian and ATLAS is installed). Use --static-libs then.
--download-lapack
Download and unpack lapack-lite here if not found.
--static-libs
Searches for static libraries only. Resulting jblas will not depend on
shared LAPACK/BLAS/ATLAS libraries. Default for Windows XP.
--ptatlas
Uses multithreaded versions of the ATLAS libraries. AFAIK, these should
be compiled on the target computer to have the right number of threads.
This means you have to recompile ATLAS, but it is certainly worth
the effort, performance improvements are really huge!
--help
print help
jblas-1.2.3/Makefile 0000664 0000000 0000000 00000015340 12106720513 0014250 0 ustar 00root root 0000000 0000000 ## --- BEGIN LICENSE BLOCK ---
# Copyright (c) 2009, Mikio L. Braun
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# * Neither the name of the Technische Universität Berlin nor the
# names of its contributors may be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
## --- END LICENSE BLOCK ---
VERSION=1.2.1
######################################################################
#
# Load the output of the configuration files
#
ifneq ($(wildcard configure.out),)
include configure.out
else
$(error Please run "./configure" first...)
endif
ifneq ($(LAPACK_HOME),)
LAPACK=$(LAPACK_HOME)/SRC
BLAS=$(LAPACK_HOME)/BLAS/SRC
endif
PACKAGE=org.jblas
# generate path from package name
PACKAGE_PATH=$(subst .,/,$(PACKAGE))
SRC=src/main
SRC_JAVA=$(SRC)/java
SRC_C=$(SRC)/c
RESOURCES=$(SRC)/resources
TARGET_C=target/c
LIB_PATH=$(RESOURCES)/lib/$(LINKAGE_TYPE)/$(OS_NAME)/$(OS_ARCH)
FULL_LIB_PATH=$(RESOURCES)/lib/$(LINKAGE_TYPE)/$(OS_NAME)/$(OS_ARCH_WITH_FLAVOR)
GENERATED_SOURCES=$(SRC_JAVA)/$(PACKAGE_PATH)/NativeBlas.java $(SRC_C)/NativeBlas.c
GENERATED_HEADERS=$(SRC_C)/org_jblas_NativeBlas.h $(SRC_C)/org_jblas_util_ArchFlavor.h
SHARED_LIBS=$(FULL_LIB_PATH)/$(LIB)jblas.$(SO) $(LIB_PATH)/$(LIB)jblas_arch_flavor.$(SO)
#######################################################################
# Pattern rules
#
# The crazy thing is, with these rules, you ONLY need to specify which
# object files belong to a source file the rest is determined
# automatically by make.
#
# rule to compile files
%.o : %.c
$(CC) $(CFLAGS) $(INCDIRS) -c $< -o $@
# rule to generate shared library from object file
%.$(SO) : %.o
$(LD) $(LDFLAGS) -o $@ $^ $(LOADLIBES)
######################################################################
#
# Main section
#
# The default target
all : $(SHARED_LIBS)
# Generate the code for the wrapper (both Java and C)
generate-wrapper: $(GENERATED_SOURCES) $(GENERATED_HEADERS)
# Clean all object files
clean:
rm -f native/*.o native/*.$(SO) $(LIB_PATH)/*.$(SO) $(FULL_LIB_PATH)/*.$(SO) $(SRC_JAVA)/$(PACKAGE_PATH)/NativeBlas.java $(SRC_C)/NativeBlas.c generated-sources
# Full clean, including information extracted from the fortranwrappers.
# You will need the original fortran sources in order to rebuild
# the wrappers.
ifeq ($(LAPACK_HOME),)
realclean: clean
@echo "Since you don't have LAPACK sources, I cannot rebuild stubs and deleting the cached information is not a good idea."
@echo "(nothing deleted)"
else
realclean: clean
rm -f fortranwrapper.dump
endif
# Generating the stubs. This target requires that the blas sources can
# be found in the $(BLAS) and $(LAPACK) directories.
generated-sources: \
scripts/fortranwrapper.rb scripts/fortran/types.rb \
scripts/fortran/java.rb scripts/java-class.java scripts/java-impl.c \
$(SRC_JAVA)/org/jblas/util/ArchFlavor.java #src/org/jblas/NativeBlas.java
$(RUBY) scripts/fortranwrapper.rb --complexcc $(CCC) $(PACKAGE) NativeBlas \
$(BLAS)/[sdcz]copy.f \
$(BLAS)/[sdcz]swap.f \
$(BLAS)/[sdcz]axpy.f \
$(BLAS)/[sdcz]scal.f \
$(BLAS)/[cz][sd]scal.f \
$(BLAS)/[sdcz]dot*.f \
$(BLAS)/[sd]*nrm2.f \
$(BLAS)/[sd]*asum.f \
$(BLAS)/i[sdcz]amax.f \
$(BLAS)/[sdcz]gemv.f \
$(BLAS)/[sdcz]ger*.f \
$(BLAS)/[sdcz]gemm.f \
$(LAPACK)/[sd]gesv.f \
$(LAPACK)/[sd]sysv.f \
$(LAPACK)/[sd]syev.f \
$(LAPACK)/[sd]syev[rdx].f \
$(LAPACK)/[sd]posv.f \
$(LAPACK)/[sdcz]geev.f \
$(LAPACK)/[sd]getrf.f \
$(LAPACK)/[sd]potrf.f \
$(LAPACK)/[sdcz]gesvd.f \
$(LAPACK)/[sd]sygvd.f \
$(LAPACK)/[sd]gelsd.f \
$(LAPACK)/ilaenv.f \
$(LAPACK)/[sd]geqrf.f $(LAPACK)/[sd]ormqr.f
ant javah
touch $@
$(SRC_C)/NativeBlas.c: generated-sources
$(TARGET_C):
mkdir $(TARGET_C)
$(TARGET_C)/NativeBlas.o: $(SRC_C)/NativeBlas.c $(TARGET_C)
$(CC) $(CFLAGS) $(INCDIRS) -c $(SRC_C)/NativeBlas.c -o $@
$(TARGET_C)/jblas_arch_flavor.o: generated-sources
$(CC) $(CFLAGS) $(INCDIRS) -c $(SRC_C)/jblas_arch_flavor.c -o $@
# Move the compile library to the machine specific directory.
$(FULL_LIB_PATH)/$(LIB)jblas.$(SO) : $(TARGET_C)/NativeBlas.$(SO)
mkdir -p $(FULL_LIB_PATH)
mv "$<" "$@"
$(LIB_PATH)/$(LIB)jblas_arch_flavor.$(SO): $(SRC_C)/jblas_arch_flavor.$(SO)
mkdir -p $(LIB_PATH)
mv "$<" "$@"
######################################################################
#
# Testing etc.
#
# run org.jblas.util.SanityChecks
sanity-checks:
java -cp jblas-$(VERSION).jar org.jblas.util.SanityChecks
# Create a tar, extract in a directory, and rebuild from scratch.
test-dist:
make clean all
ant clean tar
rm -rf jblas-$(VERSION)
tar xzvf jblas-$(VERSION).tgz
(cd jblas-$(VERSION); ./configure; make -j3; ant jar; LD_LIBRARY_PATH=$(FULL_LIB_PATH):$(LIB_PATH) java -cp jblas-$(VERSION).jar org.jblas.util.SanityChecks)
######################################################################
#
# Packaging
#
# Build different kind of jars:
#
# * with dynamic libraries
# * with static libraries
# * a "fat" jar with everything
#
# FIXME: I think this build target assumes that the current configuration
# is "dynamic"
all-jars:
ant clean-jars
./configure --keep-options $$(cat configure.options)
ant jar
ant lean-jar
./configure --keep-options --static-libs $$(cat configure.options)
make
ant static-jar fat-jar
# Build static jars
all-static-jars:
./configure --keep-options --static-libs $$(cat configure.options)
make
for os_name in native-libs/*; do \
for os_arch in $$os_name/* ; do \
ant static-jar -Dos_name=$$(basename $$os_name) \
-Dos_arch=$$(basename $$os_arch); \
done; \
done
jblas-1.2.3/README.md 0000664 0000000 0000000 00000004544 12106720513 0014073 0 ustar 00root root 0000000 0000000 jblas is a matrix library for Java which uses existing high
performance BLAS and LAPACK libraries like ATLAS.
* Version 1.2.3, February 13, 2013
* Version 1.2.2, December 17, 2012
* Version 1.2.1
* Version 1.2.0, January 7, 2011
* Version 1.1.1
* Version 1.1, August 16, 2010
* Version 1.0.2, February 26, 2010
* Version 1.0.1, January 14, 2010
* Version 1.0, December 22, 2009
* Version 0.3, September 17, 2009
* Version 0.2, May 8, 2009
* Version 0.1, March 28, 2009
see also the file RELEASE_NOTES
Homepage: http://jblas.org

Travis Page: https://travis-ci.org/mikiobraun/jblas
INSTALL
-------
In principle, all you need is the jblas-1.2.0.jar in your
classpath. jblas-1.2.0.jar will then automagically extract your platform
dependent native library to a tempfile and load it from there. You can
also put that file somewhere in your load path ($LD_LIBRARY_PATH for
Linux, %PATH for Windows).
BUILDING
--------
If you only work on the java part, an ant build.xml is provided to
recompile the sources. In addition to that you need an installation of
ruby for some scripts which automaticall generate code. Then, you just
type "ant" on the command line.
If you want to build jblas from the sources including the native part,
you need to set up quite a few things:
You will need some implementation of blas and lapack. jblas is tested
with either plain lapack, or ATLAS
(http://math-atlas.sourceforge.net/). You also need the Fortran
sources for BLAS and LAPACK, available, for example from
http://www.netlib.org/lapack/lapack-lite-3.1.1.tgz.
If you still want to build the source your own, see INSTALL for
further details.
HOW TO GET STARTED
------------------
Have a look at javadoc/index.html and
javadoc/org/jblas/DoubleMatrix.html
If you want to validate your installation and get some performance
numbers, try "java -server -jar jblas-1.2.0.jar", or drop the server
in case, you only have the "client" JVM installed.
LICENSE
-------
jblas is distributed under a BSD-style license. See the file COPYING
for more information.
BUGS
----
If you encounter any bugs, feel free to go to http://jblas.org and
register a ticket for them. Make sure to include as much information
as possible. For configuration problems it would also be helpful to
include the file "configure.log".
CONTRIBUTORS
------------
see file AUTHORS jblas-1.2.3/RELEASE_NOTES 0000664 0000000 0000000 00000015224 12106720513 0014564 0 ustar 00root root 0000000 0000000 Release 1.2.3
New features
- LU decomposition for float
- Least squares and Pseudo-inverse to Solve.
- QR decomposition.
- Removed dependency on external libgfortran for Windows.
- Now also runs on CentOS and other Linux 2.6 distros out of the box.
Removed features
- Support for SSE2. I don't have access to such processors anymore. Sorry.
Bug fixes
- load and save didn't close the streams.
- Bug in maxi and mini.
- Recompiled on Linux 2.6.32 to resolve glibc version dependency
problems. Now also runs on centos.
Release 1.2.2
New features
- full SVD for complex matrices
- Added travis CI support on github
- recompiled ATLAS for Linux, moved to 3.10.0, lapack 3.4.2
- upload to central maven repo
Bug fixes
- More meaningful error messages for Linux/64 and Windows
when libraries are missing
- SingularValueDecomposition for complex matrices used transpose()
instead of hermitian()
Release 1.2.1
Bug fixes and code side changes.
- Fixed bugs with Range objects
- Moved test code to JUnit 4.
- Fixed configure script and code-generation to Ruby 1.9
Release 1.2.0 - January 7, 2011
- Added Generalized Eigenvalues for symmetric matrices (which you
need, for example, for Canoncial Correlation Analysis). See
org.jblas.Eigen.
- Added pure-LAPACK build to Windows 64. Not as nearly as fast as
ATLAS, but still 50% over pure Java implementation (for example, for
DGEMM).
- Changed build system to maven. Actually, the build.xml from the ant
file still exists and can also be used, but now you also have a
pom.xml.
- As a side effect of the change to maven, test suites are now
actually run during the build ;)
Some bugs:
- Fortran functions returning floats (e.g. SDOT) returned 0.0. Fixed
now.
- Bug in some complex numbers routines.
---------------------------------------------------------------------
Release 1.1.1
Mostly bug fixes
- remove spurious System.out.print in complex eigenvector routine.
- fixed get with ranges
- added some more variants of get with ranges
- added more functions to complex data types (in particular sqrt())
- added hermitian() to Complex matrices to compute conjugate transposes.
----------------------------------------------------------------------
Release 1.1 - August 16, 2010
Added Singular Value Decomposition, some bugfixes
- fixed bug with complex return values and gfortran vs. g77
- added --ptatlas flag for compiling against multithreaded ATLAS
- dropped support for 32bit Mac OS X
The main reason for dropping support for 32bit Mac OS X was that
the latest versions installs as 64bit by default, and the install
for the 32bit macports gcc seem to be broken -> no way to compile it.
----------------------------------------------------------------------
Release 1.0.2 - February 26, 2010
Mostly a bug-fix release for the build-process
- fixed utf-8 unicode issues with javadoc
- fixed issues with parallel make ("make -j3")
- fixed issues with SSE2/SSE3 config code
No changes to the libraries, you can keep on using the jar file for
1.0.1.
----------------------------------------------------------------------
Release 1.0.1 - January 14, 2010
Minor fixes, mostly to do with handling spaces in the configure
scripts under windows, and running also on older processor which do
not support SSE2 (older Athlon64 processors, for example).
Changes from 1.0:
- jar contains prebuilt ATLAS libraries for SSE2 and SSE3 and selects
based on what is supported.
Still no support for 64bit for Windows, mostly because cygwin/mingw
support for 64bit is quite experimental, and ATLAS doesn't support
64bit builds under Windows. If you have managed to compile the thing,
let me know ;)
You can still use the 32bit version on a 64bit Windows, of course.
----------------------------------------------------------------------
Release 1.0 - December 22, 2009
Leo (@thinkberg) conviced me to bump my version number to 1.0 because
the software itself is stable, and I now cover all platforms I
originally targeted.
Changes from 0.3:
- expm moved from DoubleMatrix to MatrixFunctions
- Build for Mac OS X
- configure script has been overhauled.
- Matrix classes are now serializable.
----------------------------------------------------------------------
Release v0.3 - September 17, 2009
Release v0.3 adds some features, in particular LU and Cholesky decomposition,
matrix exponentials, and random permutations.
Still no Mac OS X support, though :(
Changes from version v0.2:
- jar file can now contain dynamic as well as static files
- added LAPACK functions [sdcz]geev, [sd]getrf, [sd]potrf
- Added interfaces ConvertsToDoubleMatrix and ConverstToFloatMatrix
- Added class Decompose which provides LUDecomposition (based on getrf),
and Cholesky decomposition (based on potrf)
- Matrix classes:
- Added read-only AbstractList views for elements, rows, and
columns for better interfacing with Java's collection API.
- Added matrix exponentials based on Pade approximation provided
by Jan Saptra Müller. These should be pretty fast!
- Added prod() which returns the product of all elements.
- Added project() which projects one vector on another.
- Added diviRowVector().
- Added loadCSVFile().
- Added MatrixFunctions.min() and .max() for integers.
- Added Permutations class for generating random permutations and
subsets based on the algorithms from Knuth's "The Art of Computer
Programming", Vol. 2.
----------------------------------------------------------------------
Release v0.2 - May 8, 2009
Release v0.2 mostly adds features to the build process and renames some
packages and classes to make the structure simpler. No new significant
functionality has been added.
Changes from version v0.1:
- fixed a bug in DoubleMatrix.copy()
- Renamed packages to make structure simpler
org.jblas.la -> org.jblas
org.jblas.la.exceptions -> org.jblas.exceptions
org.jblas.la.ranges -> org.jblas.ranges
org.jblas.core -> moved content to org.jblas and org.jblas.util
- Renamed classes
Blas -> NativeBlas
- Build process can now generate different kinds of jar files, and also
generate shared libraries which are statically linked against BLAS,
LAPACK or ATLAS. You can also generate a multiplatform jar file which
contains shared libraries for different platforms.
- Generated wrapper code has been optimized a bit:
- in the lapack wrapper with automatic workspace allocation, only
small dummy arrays are passed in the workspace query, meaning that
the real arrays are only passed once, not twice.
- The wrapper now also parses information whether output variables
are input or output and releases the arrays with JNI_ABORT in case
they are not output variables. This should also reduce the amount
of copying.
jblas-1.2.3/ROADMAP 0000664 0000000 0000000 00000000714 12106720513 0013615 0 ustar 00root root 0000000 0000000 Roadmap to jblas 1.2.1
1. Linux / 32 bit / sse2
2. Linux / 32 bit / sse3
3. Linux / 64 bit / sse2
4. Linux / 64 bit / sse3
5. Mac OS X / 64 bit / sse3
6. Windows / 32 bit / sse2
7. Windows / 32 bit / sse3
8. Windows / 64 bit / lapack lite only
Roadmap to jblas-0.3.1
- collect static builds for Windows(32), Linux(32/64), MacOSX(32/64).
- create multiplatform jar (for all).
- little benchmarking and testing tool.
- update README, INSTALL, RELEASE_NOTES jblas-1.2.3/build.xml 0000664 0000000 0000000 00000031365 12106720513 0014436 0 ustar 00root root 0000000 0000000
This is the build script to compile and deploy the java-blas project.
It also generates JavaDoc from source in ../doc.
jblas - Linear Algebra for Java (version ${version}) ]]>
jblas-1.2.3/config/ 0000775 0000000 0000000 00000000000 12106720513 0014052 5 ustar 00root root 0000000 0000000 jblas-1.2.3/config/PrintProperty.java 0000664 0000000 0000000 00000000240 12106720513 0017552 0 ustar 00root root 0000000 0000000 public class PrintProperty {
public static void main(String[] args) {
for (String arg: args) {
System.out.println(System.getProperty(arg));
}
}
} jblas-1.2.3/config/arch_flavor.c 0000664 0000000 0000000 00000001710 12106720513 0016503 0 ustar 00root root 0000000 0000000 #include
/* Thanks to the following pages for helping me out on this.
*
* http://softpixel.com/~cwright/programming/simd/cpuid.php
* http://www.gentoo.org/proj/en/hardened/pic-fix-guide.xml
*/
#define cpuid(func,ax,bx,cx,dx) \
__asm__ __volatile__ (" \
movl %%ebx, %%edi; \
cpuid; \
movl %%ebx, %1; \
movl %%edi, %%ebx" \
: "=a" (ax), "=r" (bx), "=c" (cx), "=d" (dx) \
: "a" (func) \
: "edi");
/* in edx */
#define SSE (1L << 25)
#define SSE2 (1L << 26)
/* in ecx */
#define SSE3 (1L << 0)
int sse_level() {
int level = -1;
int a, b, c, d;
cpuid(1, a, b, c, d);
if (d & SSE) {
level = 1;
}
if (d & SSE2) {
level = 2;
}
if (c & SSE3) {
level = 3;
}
return level;
}
int main(int argc, char **argv) {
switch (sse_level()) {
case 1:
printf("sse\n");
break;
case 2:
printf("sse2\n");
break;
case 3:
printf("sse3\n");
break;
}
}
jblas-1.2.3/config/config.rb 0000664 0000000 0000000 00000016041 12106720513 0015646 0 ustar 00root root 0000000 0000000 ## --- BEGIN LICENSE BLOCK ---
# Copyright (c) 2009, Mikio L. Braun
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# * Neither the name of the Technische Universität Berlin nor the
# names of its contributors may be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
## --- END LICENSE BLOCK ---
require 'config/path'
module JblasConfig
class ConfigError < Exception
attr_reader :message
def initialize(msg)
@message = msg
end
end
# A class for collecting configuration information.
#
# Basically, this class is like a hash function and is able to output
# it's results in a format which cCan be read by Makefile.
#
# It basically looks like this
#
# KEY=VALUE
#
# However, you can also use "<<" on keys, or "+=" in the bulk update
# sections to add, for example, compile options.
class ConfigStore
# Create a new empty config object
def initialize
@config = Hash.new {|h,k| Array.new }
@xmlstuff = Array.new
end
# Lookup an existing key.
def [](k)
@config[k]
end
def add(k, v)
@config[k] = v
end
# Define a key.
def []=(k, v)
@config[k] = v
log "Setting #{k} to #{v}"
end
# Add stuff to the xml file.
def add_xml(str)
@xmlstuff << str
return
end
# Dump the xml configuration options to a file.
def dump_xml(io)
io.puts ""
io.puts(@xmlstuff.join("\n"))
io.puts ""
end
# Bulk add some keys.
#
# The format is lines of "KEY=VALUE".
def <<(str)
str.each_line do |line|
next if line.chomp.empty?
i = line.index /\A\s*([a-zA-Z_]+)\s*(\+?=)(.*)/
if i.nil?
puts "Warning: Cannot parse config definition '#{line}'"
next
end
var = $1
op = $2
val = $3.strip
if op == '='
self[var] = val
elsif op == '+='
if @config.has_key? var
self[var] = [self[var], val]
else
self[var] = [val]
end
end
end
return
end
# Dump the config to a file.
def dump(io)
@config.keys.select {|s| String === s}.sort.each do |k|
v = @config[k]
case v
when Array
io.puts "#{k}=#{v.join ' '}"
else
io.puts "#{k}=#{v}"
end
end
end
end
class AutomaticConfigStore < ConfigStore
def [](key)
ConfigureTask.run(key) unless @config.include? key
return super(key)
end
def []=(key, value)
super(key, value)
end
end
CONFIG = ConfigStore.new
class ConfigureTask
attr_reader :symbols
attr_reader :dependencies
def initialize(symbols, dependencies, &block)
@symbols = symbols
@dependencies = dependencies
@block = block
@has_run = false
@description = ConfigureTask.get_description
end
def run(*args)
unless @has_run
@dependencies.each {|d| ConfigureTask.run(d, *args) }
unless @description.nil?
print @description + '... '
$stdout.flush
end
@block.call(*args) unless @block.nil?
@has_run = true
end
end
def self.add(task)
@tasks ||= {}
task.symbols.each {|s| @tasks[s] = task}
end
def self.run(name, *args)
task = @tasks[name]
if task.nil?
puts "Error: Cannot find task '#{name}'"
else
task.run(*args)
end
end
def self.run_all(*args)
@tasks.values.each {|c| c.run(*args)}
end
def self.dump
p @tasks
end
def self.add_description(desc)
@desc = desc
end
def self.get_description
result = @desc
@desc = nil
return result
end
def self.log(msg)
@log ||= open('configure.log', 'w')
@log.puts(msg)
end
end
module_function
# Define a new configuration task.
#
# Syntax is similar to rake tasks:
#
# * configure :foobar do ... end - task without prerequisites
# * configure :foobar => :quux do ... end - task depend on quux
#
# The block is optional
def configure(*args, &block)
if Hash === args[-1]
syms = args[0...-1] + [args[-1].keys[0]]
deps = args[-1].values[0]
deps = [deps] unless Array === deps
else
syms = args
deps = []
end
task = ConfigureTask.new(syms, deps, &block)
ConfigureTask.add(task)
end
# Define the description for a task.
#
# This affects the next task defined. If a a description is given,
# it will be printed before the task is run. The task must then
# call +ok+ to finish the line.
def desc(description)
ConfigureTask.add_description(description)
end
# Print 'ok', potentially followed by a comment.
def ok(msg='')
if msg.empty?
puts "ok"
else
puts "ok (#{msg})"
end
end
# Print error message and raise a ConfigError.
def fail(msg='')
puts "*failed*"
raise ConfigError, msg
end
# Print a message on the screen.
def msg(m)
print m + "... "
$stdout.flush
if block_given?
msg = yield
if msg.nil?
ok
else
puts msg
end
end
end
# Print a log message.
def log(msg)
ConfigureTask.log(msg)
end
def run(target)
begin
ConfigureTask.run target
rescue ConfigError => e
puts
puts "Configuration failed!"
puts
puts "Reason: #{e.message}"
exit
end
end
end
if __FILE__ == $0
include JblasConfig
configure :say_hello do
puts "Hello"
CONFIG[:say_hello] = 42
end
configure :say_goodbye do
p CONFIG[:say_hello]
puts "Goodbye!"
end
configure :default => :say_goodbye
ConfigureTask.run :default
end jblas-1.2.3/config/config_cc.rb 0000664 0000000 0000000 00000007420 12106720513 0016314 0 ustar 00root root 0000000 0000000 ## --- BEGIN LICENSE BLOCK ---
# Copyright (c) 2009, Mikio L. Braun
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# * Neither the name of the Technische Universität Berlin nor the
# names of its contributors may be used to endorse or promote
# products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
## --- END LICENSE BLOCK ---
require 'config/path'
require 'config/config'
require 'config/config_java'
include JblasConfig
include Path
# Set up flags for different environments.
configure :cc => 'CC'
desc 'Setting up gcc and flags'
configure 'CC', 'CFLAGS' => ['OS_NAME', 'OS_ARCH', 'JAVA_HOME'] do
os_name = JblasConfig::CONFIG['OS_NAME']
java_home = JblasConfig::CONFIG['JAVA_HOME']
case os_name
when 'Linux'
Path.check_cmd('gcc', 'make', 'ld')
JblasConfig::CONFIG << <