diff --git a/.travis.yml b/.travis.yml index 947353ab..a81c0fbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ rvm: - 2.1.8 - 2.2.4 - 2.3.0 + - 2.4.2 - ruby-head # The latest stable and head versions built by clang - 2.3.0-clang diff --git a/History.txt b/History.txt index f6462d19..fe50df54 100644 --- a/History.txt +++ b/History.txt @@ -888,3 +888,22 @@ * Fixed gem installation problem caused by mkmf abstraction (by @mrkn) +=== 0.2.4 / 2017-12-14 + +* No major enhancements. + +* 2 minor enhancements: + + * Eliminated code reuse in math.rb between JRuby and MRI + versions of library (by @prasunanand) + + * Slightly simplified #positive_definite? (by + @prasunanand) + +* 2 bug fixes: + + * Fixed compilation problem on Mac OS X High Sierra (by + @mohawkjohn) + + * Fixed failing #block_diagonal spec (due to missing + Array#sum) (by @mohawkjohn) diff --git a/Manifest.txt b/Manifest.txt index c173c684..ed443c2c 100644 --- a/Manifest.txt +++ b/Manifest.txt @@ -13,6 +13,16 @@ travis.sh .travis.yml lib/nmatrix.rb lib/nmatrix/atlas.rb +lib/nmatrix/blas.rb +lib/nmatrix/enumerate.rb +lib/nmatrix/homogeneous.rb +lib/nmatrix/math.rb +lib/nmatrix/mkmf.rb +lib/nmatrix/monkeys.rb +lib/nmatrix/nmatrix.rb +lib/nmatrix/shortcuts.rb +lib/nmatrix/version.rb +lib/nmatrix/yale_functions.rb lib/nmatrix/fftw.rb lib/nmatrix/lapack_core.rb lib/nmatrix/lapack_ext_common.rb @@ -25,17 +35,14 @@ lib/nmatrix/io/mat_reader.rb lib/nmatrix/io/point_cloud.rb lib/nmatrix/io/fortran_format.rb lib/nmatrix/io/harwell_boeing.rb -lib/nmatrix/blas.rb -lib/nmatrix/enumerate.rb -lib/nmatrix/homogeneous.rb -lib/nmatrix/math.rb -lib/nmatrix/mkmf.rb -lib/nmatrix/monkeys.rb -lib/nmatrix/nmatrix.rb -lib/nmatrix/rspec.rb -lib/nmatrix/shortcuts.rb -lib/nmatrix/version.rb -lib/nmatrix/yale_functions.rb +lib/nmatrix/cruby/math.rb +lib/nmatrix/jruby/decomposition.rb +lib/nmatrix/jruby/enumerable.rb +lib/nmatrix/jruby/error.rb +lib/nmatrix/jruby/math.rb +lib/nmatrix/jruby/nmatrix_java.rb +lib/nmatrix/jruby/operators.rb +lib/nmatrix/jruby/slice.rb ext/nmatrix/math/cblas_enums.h ext/nmatrix/math/cblas_templates_core.h ext/nmatrix/math/util.h @@ -49,6 +56,14 @@ ext/nmatrix_atlas/math_atlas/gesdd.h ext/nmatrix_atlas/math_atlas/gesvd.h ext/nmatrix_atlas/math_atlas/inc.h ext/nmatrix_atlas/nmatrix_atlas.cpp +ext/nmatrix_java/nmatrix/data/Complex.java +ext/nmatrix_java/nmatrix/math/MathHelper.java +ext/nmatrix_java/nmatrix/storage/dense/ArrayComparator.java +ext/nmatrix_java/nmatrix/util/ArrayGenerator.java +ext/nmatrix_java/nmatrix/util/MatrixGenerator.java +ext/nmatrix_java/nmatrix/util/WrapperType.java +ext/nmatrix_java/test/AssertTests.java +ext/nmatrix_java/test/TestRunner.java ext/nmatrix_lapacke/extconf.rb ext/nmatrix_lapacke/lapacke.cpp ext/nmatrix_lapacke/lapacke/include/lapacke.h diff --git a/Rakefile b/Rakefile index d6a7152f..b7e36b7b 100644 --- a/Rakefile +++ b/Rakefile @@ -240,7 +240,7 @@ task :check_manifest do |task| manifest_files = File.read("Manifest.txt").split git_files = `git ls-files |grep -v 'spec/'`.split - ignore_files = %w{.gitignore .rspec ext/nmatrix/binary_format.txt ext/nmatrix/ttable_helper.rb scripts/mac-brew-gcc.sh} + ignore_files = %w{.gitignore .rspec ext/nmatrix/binary_format.txt scripts/ttable_helper.rb} possible_files = git_files - ignore_files diff --git a/ext/nmatrix_java/README.md b/ext/nmatrix_java/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/ext/nmatrix_java/Rakefile b/ext/nmatrix_java/Rakefile deleted file mode 100644 index 749578eb..00000000 --- a/ext/nmatrix_java/Rakefile +++ /dev/null @@ -1,68 +0,0 @@ -PROJECT_DIR = File.expand_path(".",Dir.pwd) -# puts PROJECT_DIR - -BUILD_DIR = "build" -CLASSES_DIR = "../build/classes" -TEST_CLASSES_DIR = "build/testClasses" - -VENDOR_DIR = "#{PROJECT_DIR}/vendor" -TARGET_DIR = "#{PROJECT_DIR}/target" -# puts VENDOR_DIR - -jars = Dir["#{VENDOR_DIR}/*.jar"] -# puts jars - -unless RUBY_PLATFORM == 'java' - abort 'Please run with JRuby' -end - -#----------------------------------------------------------------------------------------- - -desc 'Compile java classes' -task :javac do - - Dir.chdir("nmatrix") - classes = Dir['**/*.java'] - sh "javac -classpath #{jars.join(':')} -d #{CLASSES_DIR} #{classes.join(' ')}" - # sh "javac -d #{CLASSES_DIR} #{classes.join(' ')}" - -end - -#----------------------------------------------------------------------------------------- -desc 'Make jar file' -task :jar do - - Dir.chdir("build/classes") - classes = Dir['**/*.class'] - # p classes - sh "jar -cf #{TARGET_DIR}/nmatrix.jar #{classes.join(' ')}" - -end - -#----------------------------------------------------------------------------------------- - - -desc 'Compile test classes' -task :compileTest do - - classes = Dir['**/*.java'] - sh "javac -classpath #{jars.join(':')} -d #{TEST_CLASSES_DIR} #{classes.join(' ')}" - # sh "javac -d #{CLASSES_DIR} #{classes.join(' ')}" - -end - -#----------------------------------------------------------------------------------------- - -desc 'Run junit tests' -task :test do - - Dir.chdir("build/classes") - classes = Dir['**/*.class'] - # p classes - sh "javac -classpath #{TARGET_DIR}/nmatrix.jar -d #{classes.join(' ')}" - -end - -#----------------------------------------------------------------------------------------- - -task :default => :javac diff --git a/ext/nmatrix_java/nmatrix/data/Complex.java b/ext/nmatrix_java/nmatrix/data/Complex.java deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/nmatrix/mkmf.rb b/lib/nmatrix/mkmf.rb index 2e2d0cd4..8c5d0526 100644 --- a/lib/nmatrix/mkmf.rb +++ b/lib/nmatrix/mkmf.rb @@ -91,8 +91,10 @@ def gplusplus_version $CXXFLAGS += " -O3 -std=#{$CXX_STANDARD} " #-fmax-errors=10 -save-temps #$CXXFLAGS += " -static -O0 -g -std=#{$CXX_STANDARD} " -CONFIG['warnflags'].gsub!('-Wshorten-64-to-32', '') # doesn't work except in Mac-patched gcc (4.2) -CONFIG['warnflags'].gsub!('-Wdeclaration-after-statement', '') -CONFIG['warnflags'].gsub!('-Wimplicit-function-declaration', '') - +if CONFIG.has_key?('warnflags') + CONFIG['warnflags'].gsub!('-Wshorten-64-to-32', '') # doesn't work except in Mac-patched gcc (4.2) + CONFIG['warnflags'].gsub!('-Wdeclaration-after-statement', '') + CONFIG['warnflags'].gsub!('-Wimplicit-function-declaration', '') +end + have_func("rb_array_const_ptr", "ruby.h") diff --git a/lib/nmatrix/shortcuts.rb b/lib/nmatrix/shortcuts.rb index 4400dcaa..07ff50fd 100644 --- a/lib/nmatrix/shortcuts.rb +++ b/lib/nmatrix/shortcuts.rb @@ -494,11 +494,11 @@ def block_diagonal(*params) block_sizes << b.shape[0] end - block_diag_mat = NMatrix.zeros(block_sizes.sum, options) + block_diag_mat = NMatrix.zeros(block_sizes.inject(0,:+), options) (0...params.length).each do |n| # First determine the size and position of the n'th block in the block-diagonal matrix block_size = block_sizes[n] - block_pos = block_sizes[0...n].sum + block_pos = block_sizes[0...n].inject(0,:+) # populate the n'th block in the block-diagonal matrix (0...block_size).each do |i| (0...block_size).each do |j| diff --git a/nmatrix.gemspec b/nmatrix.gemspec index e22f35dc..19ac5ad6 100644 --- a/nmatrix.gemspec +++ b/nmatrix.gemspec @@ -24,9 +24,9 @@ Gem::Specification.new do |gem| *********************************************************** Welcome to SciRuby: Tools for Scientific Computing in Ruby! -NMatrix requires a C compiler, and has been tested only -with GCC 4.6+. We are happy to accept contributions -which improve the portability of this project. +NMatrix requires a C/C++ compiler. Clang and GCC are +recommended. JRuby support is experimental, and requires +Java. If you are upgrading from NMatrix 0.1.0 and rely on ATLAS features, please check the README. diff --git a/scripts/mac-brew-gcc.sh b/scripts/mac-brew-gcc.sh deleted file mode 100755 index 68888c9d..00000000 --- a/scripts/mac-brew-gcc.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Script will not work for GCC 4.8 or 4.9. For those, please see -# mac-mavericks-brew-gcc.sh - -VERSION="4.7.2" # Script should also work with GCC 4.7.1. -PREFIX="/usr/gcc-${VERSION}" -LANGUAGES="c,c++,fortran" -MAKE="make -j 4" - -brew-path() { brew info $1 | head -n3 | tail -n1 | cut -d' ' -f1; } - -# Prerequisites - -brew install gmp mpfr libmpc - -# Next, download & install the latest GCC: - -mkdir -p $PREFIX -mkdir temp-gcc -cd temp-gcc -wget ftp://ftp.gnu.org/gnu/gcc/gcc-$VERSION/gcc-$VERSION.tar.gz -tar xfz gcc-$VERSION.tar.gz -rm gcc-$VERSION.tar.gz -cd gcc-$VERSION - -mkdir build -cd build - -# Older versions of brew need brew-path instead of brew --prefix. -../configure \ - --prefix=$PREFIX \ - --with-gmp=$(brew --prefix gmp) \ - --with-mpfr=$(brew --prefix mpfr) \ - --with-mpc=$(brew --prefix libmpc) \ - --program-suffix=-$VERSION \ - --enable-languages=$LANGUAGES \ - --with-system-zlib \ - --enable-stage1-checking \ - --enable-plugin \ - --enable-lto \ - --disable-multilib - -$MAKE bootstrap - -make install - -# Uncomment for cleanup … -# cd ../../.. -# rm -r temp-gcc diff --git a/scripts/mac-mavericks-brew-gcc.sh b/scripts/mac-mavericks-brew-gcc.sh deleted file mode 100644 index 867d050a..00000000 --- a/scripts/mac-mavericks-brew-gcc.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -brew-path() { brew info $1 | head -n3 | tail -n1 | cut -d' ' -f1; } - -# Try using the following for GCC 4.9: -# -# brew install gmp4 mpfr2 libmpc08 isl011 cloog018 -# -# - -brew install gcc49 --enable-fortran -# Source for this is: http://stackoverflow.com/questions/19535422/os-x-10-9-gcc-links-to-clang - - -# You may wish to re-install your Ruby if you're using rbenv. To do -# so, make sure you've installed openssl, readline, and libyaml. -# -# The commands for this are: -# -# CC=gcc-4.8 RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline` --with-gcc=gcc-4.8 --enable-shared" rbenv install --keep 2.0.0-p247 -# -# \ No newline at end of file diff --git a/ext/nmatrix/ttable_helper.rb b/scripts/ttable_helper.rb similarity index 100% rename from ext/nmatrix/ttable_helper.rb rename to scripts/ttable_helper.rb