JRuby port of NMatrix #558

merged 168 commits into from Feb 3, 2017


None yet

4 participants


rake spec leads to no failure

prasunanand and others added some commits May 30, 2016
@prasunanand prasunanand created nmatrix_java directory structure and added rake tasks b11df50
@prasunanand prasunanand dense and storage type of nmatrix c96a0e7
@prasunanand prasunanand NMatrix for arbitrary dimension double dtype using Apache CommonsMath f0dca82
@prasunanand prasunanand test init 086472d
@prasunanand prasunanand gitignore classes and jars b1a45ef
@prasunanand prasunanand jruby: frontend tasks running 163e393
@prasunanand prasunanand imported nmatrix.jar and 2 tests succeded a5e0812
@prasunanand prasunanand 2Dnmatrix.jar and elementwise operations ab51565
@prasunanand prasunanand jruby: refactoring the code. nmatrix_java.rb is not in lib/nnatrix di…
…rectory. It gets added in the next commit. nmatrix_test.rb has been deleted permanently. We use existing tests.
@prasunanand prasunanand jruby: modified jnmatrix.java to store shape as an array and worked o…
…n nmatrix class methods shape, dim , slice ,[] , []= , effective_dimension, is_symmetric, etc.
@prasunanand prasunanand jruby: == operator implemented that checks whether two nmatrices are …
@prasunanand prasunanand jruby: modified initialize parameters for nmatrix shortcuts ff0af2f
@prasunanand prasunanand jruby: run tests and require_relative ffc392a
@prasunanand prasunanand jruby: change java? method to jruby? and loading jars using nmatrix_j…
@prasunanand prasunanand jruby: is_Symmetric implemented and twoDMatrix initialized when shape==2 8c50dd3
@prasunanand prasunanand jruby: Block matrix for matrix multiplication and loop correction 9421496
@prasunanand prasunanand jruby: shape compatibility correction 9a9e183
@prasunanand prasunanand jruby:initialise of nmatrix changed to improve performance; addition,…
… subtraction, multiplication and division modified accordingly
@prasunanand prasunanand jruby: performance=> inequality operators modified e1b4406
@prasunanand prasunanand jruby: performance=> unary operators modified f6d772f
@prasunanand prasunanand jruby: performance=> [] and []= implemented, range not supported 47b83c5
@prasunanand prasunanand jruby: performace => implemented dot for matrix and is_symmetric 041af32
@prasunanand prasunanand jruby: all elementwise inequality operators implemented; return as ru…
…by array object
@prasunanand prasunanand jruby: implemented matrix multiplication or dot() f371830
@prasunanand prasunanand jruby: implemented det_exact and inverse of a matrix 3a661a3
@prasunanand prasunanand jruby: require_relative for tests 8b02667
@prasunanand prasunanand jruby: implemented []= operator c70da69
@prasunanand prasunanand jruby: Implemented [] for range 2c13eb5
@prasunanand prasunanand jruby: [] for range slicing 124ed72
@prasunanand prasunanand jruby: nmatrix indexing implemented for a single element position 3701e94
@prasunanand prasunanand jruby: elementwise operators functionality implemented except binary …
…modulo and few unary operators
@prasunanand prasunanand jruby: implemented sin() unary operator using Univariate function 3c75d97
@prasunanand prasunanand jruby: implemented add(+) operator for nmatrix b60390a
@prasunanand prasunanand jruby: getting modular 7cf35be
@prasunanand prasunanand jruby: dot dimension correction c9b92ab
@prasunanand prasunanand jruby: preety print implemented => shape initialisation for xslice re…
@prasunanand prasunanand jruby: implemented factorize_cholesky and hermitian? ffcdc17
@prasunanand prasunanand jruby: scale and scale! implemented 676be2c
@prasunanand prasunanand jruby: det_exact alias to det bc23587
@prasunanand prasunanand jruby: inverse,invert and invert! implemented b0a0e78
@prasunanand prasunanand jruby: implemented each_stored_with_indices and adjugate/adjoint of a…
… matrix
@prasunanand prasunanand jruby: solve options 6041be1
@prasunanand prasunanand jruby: initialization when element is not an array b6e2cad
@prasunanand prasunanand jruby: initialise dtype and stype 36e8e24
@prasunanand prasunanand jruby: correct exception message ffb19e7
@prasunanand prasunanand jruby: shape correction 8575172
@prasunanand prasunanand jruby: __dense_each__ yields value 1b3ab41
@prasunanand prasunanand jruby: test modify for jruby for [] method 9824951
@prasunanand prasunanand jruby: entries of a nmatrix c027279
@prasunanand prasunanand jruby: implemented factorize_lu, factorize_qr, potrf, ipiv and alias …
…of dim and effective_dim
@prasunanand prasunanand jruby: correction of dense_each 917a689
@prasunanand prasunanand jruby: nrm2 and scale operator implemented 3cb4fc6
@prasunanand prasunanand jruby: [] implemented for negative indeces 49776a7
@prasunanand prasunanand jruby: diagonal operator implemented bfb766c
@prasunanand prasunanand jruby: block for __dense_each__ and transpose of a matrix 9036d91
@prasunanand prasunanand jruby: casting for jruby 9a92e6d
@prasunanand prasunanand jruby: []= implemented for range fbe0da9
@prasunanand prasunanand jruby: get_twoDArray helper 8e3df90
@prasunanand prasunanand jruby: shape correction cfeeb81
@prasunanand prasunanand jruby: return row as nmatrix d4e2a13
@prasunanand prasunanand jruby: slice when :* as arg 21ab7f1
@prasunanand prasunanand jruby: implemented cast full e712819
@prasunanand prasunanand jruby: implemented supershape and offset add3330
@prasunanand prasunanand jruby: implemented reshape_bang and interpret_shape 75d5324
@prasunanand prasunanand jruby: enums=> yield if block_given? 0695c04
@prasunanand prasunanand jruby: slices=> dense storage access by reference and get 9542433
@prasunanand prasunanand jruby: modularize slicing methods 232faff
@prasunanand prasunanand jruby: return rows, cols and layers as nmatrix 8b33fb1
@prasunanand prasunanand jruby: slice set when right arg is a nmatrix 2d7052d
@prasunanand prasunanand jruby: singleton method guess dtype for nmatrix shortcuts 11684bd
@prasunanand prasunanand jruby: elements array length bug e315006
@prasunanand prasunanand jruby: pretty print completely functional a5f33ee
@prasunanand prasunanand jruby: modularizing linear and binary math operators 8fa9012
@prasunanand prasunanand jruby: inject_rank shape duplication and add dimension for + operator 5ef7f7b
@prasunanand prasunanand jruby: add dimension for allmath operators 90183da
@prasunanand prasunanand jruby: implemented solve using LUDecomposition 2ab1a5b
@prasunanand prasunanand jruby: implemented solve using CholeskyDecomposition 4dd57f7
@prasunanand prasunanand jruby: solve when the rhs is of type n * p 079f3b9
@prasunanand prasunanand jruby: correct NMatrix#solve e99b161
@prasunanand prasunanand jruby: NMatrix#initialize for dtype = object a1ffe24
@prasunanand prasunanand jruby: [], slice and xslice implemented for ruby objects 71d1391
@prasunanand prasunanand jruby: pretty print implemented for ruby objects 6ea4b95
@prasunanand prasunanand jruby: #each_with_indices and #each_stored_with_indices implemented f…
…or ruby objects
@prasunanand prasunanand jruby: #elementwise_inequlity matrices return NMatrix 751d042
@prasunanand prasunanand jruby: #== implemented for ruby objects b051372
@prasunanand prasunanand jruby: slicing by reference 821754c
@prasunanand prasunanand jruby: elementwise binary and unary operators don't modify the origin…
…al NMatrix@s by @s.copy
@prasunanand prasunanand jruby: Exponentiation NMatrix#** operator implemented 3d7a1f2
@prasunanand prasunanand jruby: NMatrix#clone implemented as @s.clone is private 893a817
@prasunanand prasunanand jruby: NMatrix equality method correction 02b40d7
@prasunanand prasunanand jruby: implemented NMatrix#[]= for ruby objects e59e1d3
@prasunanand prasunanand jruby: added ArrayGenerator and MatrixGenerator class for fast conver…
@prasunanand prasunanand jruby: covertArrayFloatFromDouble correction e7a0b6d
@prasunanand prasunanand jruby: get Matrix from java method 1867f9d
@prasunanand prasunanand jruby: correct NMatrix#scale method 1972007
@prasunanand prasunanand jruby: NMatrx#cast returns self 66df67d
@prasunanand prasunanand jruby: NMatrix#create_dummy_nmatrix, protected method 09bcfa5
@prasunanand prasunanand jruby: NMatrix#atan2 implemented which takes two arguments 9f2c138
@prasunanand prasunanand jruby: implemented log with arbitrary base def71a4
@prasunanand prasunanand jruby: corrected matrix transpose and used java_method to store flat_…
@prasunanand prasunanand jruby: stype accessor added 43775ea
@prasunanand prasunanand jruby: check equality with delta = 1e-3 1d208b8
@prasunanand prasunanand jruby: implemented erf and erfc operators 0f28632
@prasunanand prasunanand jruby: NMatrix#-@, elementwise negation and NMatrix#gamma implemented 3d32200
@prasunanand prasunanand jruby: round determinant to 3 decimal places 2b64e2d
@prasunanand prasunanand jruby: potrf correction 1fdd310
@prasunanand prasunanand jruby: cholesky_factorization correction 8ea115f
@prasunanand prasunanand jruby: NMatrix#round implemented for double matrices 592c7e7
@prasunanand prasunanand jruby: implemented NMatrix#ldexp edef600
@prasunanand prasunanand jruby: implemented NMatrix#hypot 7399104
@prasunanand prasunanand jruby: hypot for scalar implemented f8e20d6
@prasunanand prasunanand jruby: NMatrix#hypot for scalar implemented 3e1c5c6
@prasunanand prasunanand jruby: NMatrix#hypot detects nmatrix or scalar when second argument n…
…ot provided
@prasunanand prasunanand jruby: NMatrix#ldexp detects nmatrix or scalar when second argument n…
…ot provided
@prasunanand prasunanand jruby: NMatrix#log default is natural log 42cbed5
@prasunanand prasunanand jruby: NMatrix#atan2 implemented 9d05e74
@prasunanand prasunanand jruby: NMatrix#atan2 implemented for scalar c7fb093
@prasunanand prasunanand jruby: dtype set to integer type when using Floor, ceil and round a4d14cc
@prasunanand prasunanand jruby: NMatrix#__dense_map__ implemented and qr_factorization set up …
@prasunanand prasunanand jruby: Hessenberg Transformer not implemented currently b04482d
@prasunanand prasunanand jruby: cast in abs 3a8f502
@prasunanand prasunanand jruby: DataTypeError initialized fce6d93
@prasunanand prasunanand jruby: singleton methods min_dtype and upcast added 7fe6d54
@prasunanand prasunanand NMatrix #solve correction for different options 091c594
@prasunanand prasunanand jruby: move nmatrix_java.rb to lib/jruby/ 7d52167
@prasunanand prasunanand jruby: Remove java files which are not required 9822c2c
@prasunanand prasunanand jruby: single-line format for class definitions with no body d88fe1f
@prasunanand prasunanand jruby: rename lib/jruby/math.rb to operators.rb 9cac5a9
@prasunanand prasunanand jruby: separate jruby math logic from MRI bb0cfda
@prasunanand prasunanand jruby: load math.rb form nmatrix.rb instead of monkeys.rb 911cb9c
@prasunanand prasunanand jruby: restore lib/nmatrix/math.rb to its original state 9e38ad4
@prasunanand prasunanand jruby: change if-else to one-liner b8321aa
@prasunanand prasunanand jruby: Improve NMatrix#matrix_solve method c04ba3c
@prasunanand prasunanand jruby: make exeception checking as one-liners 8dfcab4
@prasunanand prasunanand jruby: correct indentation 1f13bf7
@prasunanand prasunanand jruby: remove commented out code 717ce19
@prasunanand prasunanand jruby: why create_dummy_matrix 4b9d5a5
@prasunanand prasunanand jruby: create_dummy_matrix for NMatrix#methods ed17445
@prasunanand prasunanand jruby: chain dot result to java_method 128e0a4
@prasunanand prasunanand jruby: chain NMatrix#inverse result to java_method e9efaec
@prasunanand prasunanand jruby: chain NMatrix#qr_factorization and NMatrix#lu_factorization to…
… java methods
@prasunanand prasunanand jruby: remove #get_oneDArray and #twoDArray 41da577
@prasunanand prasunanand jruby: rename twoDMat2 to twoDMat and change attribute accessor to me…
@prasunanand prasunanand jruby: correct exceptions to be raised 766e1e5
@prasunanand prasunanand jruby: remove unnecessary comments in nmatrix_jruby.rb f00d28f
@prasunanand prasunanand jruby: comments in nmatrix_jruby and clean code 215548d
@prasunanand prasunanand jruby: add Enumerable#sum supported by backports gem for MRI b553f36
@prasunanand prasunanand jruby_port: Add Readme dc088a0
@prasunanand John Woods Cleaned up JRuby instructions in README a bit 871e060
@prasunanand prasunanand jruby_port: run rake tasks from project root directory 7780d0e
@prasunanand prasunanand Merge remote-tracking branch 'upstream/master' into jruby_test_rebase 787e74c
@prasunanand prasunanand jruby_port: make tests pending for 00_nmatrix_spec.rb 803075f
@prasunanand prasunanand jruby_port: make tests pending for 01_enum'_spec.rb 291f293
@prasunanand prasunanand jruby_port: make tests pending for 02_slice_spec.rb 455a975
@prasunanand prasunanand jruby_port: make tests pending for 03_nmatrix_monkeys_spec.rb 84e50e8
@prasunanand prasunanand jruby_port: make tests pending for elementwise_spec.rb eec5f23
@prasunanand prasunanand jruby_port: make tests pending for homogeneous_spec.rb f326962
@prasunanand prasunanand jruby_port: make tests pending for io_spec.rb a674aac
@prasunanand prasunanand jruby_port: make tests pending for stat_spec.rb 7324442
@prasunanand prasunanand jruby_port: make tests pending for slice_set_spec.rb a3e0a81
@prasunanand prasunanand jruby_port: make tests pending for shortcuts_spec.rb cfd6c41
@prasunanand prasunanand jruby_port: make tests pending for rspec_spec.rb f1ab4c9
@prasunanand prasunanand jruby_port: improve tests pending for math_spec.rb 3f53f51
@prasunanand prasunanand jruby_port: rake tests for jruby f446674
@prasunanand prasunanand referenced this pull request Dec 16, 2016

Jruby master #545

prasunanand added some commits Dec 17, 2016
@prasunanand @prasunanand prasunanand jruby_port: travis script for jruby
jruby_port: travis script2 for jruby

	jruby_port: travis script3 for jruby

jruby_port: remove jruby env from allowed failures
@prasunanand prasunanand jruby_port: test only for no external libs in JRuby 36a1cf5

Travis tests for JRuby pass and removed from "allowed failures" :) . Please review.

wlevine commented Jan 17, 2017

One concern: the dtype argument is totally ignored. I understand that currently only doubles are supported, but an error should be thrown if I try to create a matrix with an unsupported dtype. The same with stype. You should refuse to create a matrix if someone specifies an stype other than :dense.

+ @dtype = hash[:dtype]
+ @stype = hash[:stype]
+ else
+ @dtype = :double
wlevine Jan 17, 2017

This should be :float64 not :double

prasunanand Jan 20, 2017

Yeah. I will correct it.

prasunanand Jan 20, 2017

I am not throwing any error here because a lot of tests will fail in that case. And I assure you that this feature will be properly implemented in next PR.

wlevine commented Jan 17, 2017

It seems like rake package is broken on your branch.

+ tar zxvf commons-math3-3.6.1-bin.tar.gz
+ mkdir ext/nmatrix_java/vendor/
+ cp commons-math3-3.6.1/commons-math3-3.6.1.jar ext/nmatrix_java/vendor/
wlevine Jan 17, 2017

Are all these steps still required? It seems like this is already done by the rake task.

Also is this the standard way of dealing with Java libraries (just downloading them and sticking the jar in a random directory)? It seems a little unfortunate.

Are you planning to get this to work with a simple gem install?

Also, you should probably add a small note to the README, noting the limited features of the JRuby version.

prasunanand Jan 20, 2017

Are all these steps still required? It seems like this is already done by the rake task.
=> These steps are not done by rake task. And, a rake task can be added to achieve this.

Also is this the standard way of dealing with Java libraries (just downloading them and sticking the jar in a random directory)? It seems a little unfortunate.
=> AFAIK, this is the only way.

Are you planning to get this to work with a simple gem install?
=>Yes, It works with gem install

Also, you should probably add a small note to the README, noting the limited features of the JRuby version.

prasunanand Jan 20, 2017 edited

There is some error with json-version. I will correct it. I left it earlier, because there was no error with travis tests. So, I thought that the error was limited to my machine only.

@mohawkjohn mohawkjohn merged commit f5c87a1 into SciRuby:master Feb 3, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
v0dro commented Feb 9, 2017

Finally this is merged! Congratulations @prasunanand =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment