From 9c8747d7287e281fa166673b58e1323b5cac2cd8 Mon Sep 17 00:00:00 2001 From: John Woods Date: Fri, 20 Oct 2017 10:55:29 -0500 Subject: [PATCH 1/5] Preparing for release of 0.2.4. --- Manifest.txt | 37 ++++++++++++----- Rakefile | 2 +- ext/nmatrix_java/README.md | 0 nmatrix.gemspec | 6 +-- scripts/mac-brew-gcc.sh | 50 ----------------------- scripts/mac-mavericks-brew-gcc.sh | 22 ---------- {ext/nmatrix => scripts}/ttable_helper.rb | 0 7 files changed, 30 insertions(+), 87 deletions(-) delete mode 100644 ext/nmatrix_java/README.md delete mode 100755 scripts/mac-brew-gcc.sh delete mode 100644 scripts/mac-mavericks-brew-gcc.sh rename {ext/nmatrix => scripts}/ttable_helper.rb (100%) 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/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 From f292447e978050f06e07d11781875e8ec3025c37 Mon Sep 17 00:00:00 2001 From: John Woods Date: Thu, 14 Dec 2017 13:18:37 -0600 Subject: [PATCH 2/5] Hopefully, fix to #591. --- lib/nmatrix/mkmf.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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") From 39a097d6c525bc6f9b98ee72ef1d9d2ed02bc0ed Mon Sep 17 00:00:00 2001 From: John Woods Date: Thu, 14 Dec 2017 13:35:56 -0600 Subject: [PATCH 3/5] Fixes #602, missing Array#sum in NMatrix#block_diagonal (MRI only, not JRuby) --- lib/nmatrix/shortcuts.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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| From d65bbf8ebe347db23ea847c46cecc1cba20ca2c4 Mon Sep 17 00:00:00 2001 From: John Woods Date: Thu, 14 Dec 2017 13:38:02 -0600 Subject: [PATCH 4/5] Removed some unneeded files as discussed in #601. --- ext/nmatrix_java/Rakefile | 68 ---------------------- ext/nmatrix_java/nmatrix/data/Complex.java | 0 2 files changed, 68 deletions(-) delete mode 100644 ext/nmatrix_java/Rakefile delete mode 100644 ext/nmatrix_java/nmatrix/data/Complex.java 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 From 0efe19a68b82b81af6af5748fbeeea828a571e98 Mon Sep 17 00:00:00 2001 From: John Woods Date: Thu, 14 Dec 2017 13:51:46 -0600 Subject: [PATCH 5/5] Final release preparations (hopefully). Updated history and added Ruby 2.4.2 to Travis config. --- .travis.yml | 1 + History.txt | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) 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)