marcandre
eda970cfe2
lib/matrix.rb: Make Matrix & Vector mutable. Add #[]=, #map!.
...
Adapted from patch by Grzegorz Jakubiak. [#14151 ] [Fix GH-1769] [Fix GH-1905]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:51 +00:00
marcandre
1a6c27346e
lib/matrix: Fix potential bug of Vector#angle_with
...
Could happen for some linearly dependent vectors.
Patch by Vasiliy Petrov. [Fix GH-1803]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-16 04:18:50 +00:00
marcandre
b1152fab0f
lib/matrix: Add hadamard_product/entrywise_product.
...
Based on a patch by Charley Hutchison. [GH-674]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-20 02:18:43 +00:00
marcandre
980c0dd360
lib/matrix: Add Matrix{.|#}combine
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-20 02:18:34 +00:00
marcandre
62646c8d67
lib/matrix: accept vectors in {h|v}stack
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-20 02:18:23 +00:00
marcandre
aa95a42190
lib/matrix: Add explicit coercion #to_matrix
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-20 02:18:12 +00:00
marcandre
666df14594
* lib/matrix.rb: Add Vector.zero and Vector#zero?
...
Patch by Chia-sheng Chen [#13208 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-14 20:09:30 +00:00
naruse
3e92b635fb
Add frozen_string_literal: false for all files
...
When you change this to true, you may need to add more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
svn
4f9ded5cdd
* remove trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23 02:09:16 +00:00
shugo
d07ce082a6
* lib/matrix/eigenvalue_decomposition.rb (tridiagonalize): fix
...
indentation to avoid a warning when the command line option -w of
ruby is specified.
* lib/matrix/eigenvalue_decomposition.rb (hessenberg_to_real_schur):
change the name of a block parameter to avoid a warning when the
command line option -w of ruby is specified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23 02:09:03 +00:00
nobu
fb684ba4c2
test_matrix.rb: Refactor on Matrix#determinant
...
* test/matrix/test_matrix.rb (test_determinant): refactor test on
Matrix#determinant, by merging with test_det for an alias method
det. [Fix GH-897]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-08 13:57:27 +00:00
marcandre
b81950f480
* lib/matrix.rb: Add Vector#round. Patch by Jordan Stephens.
...
[Fixes GH-802]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-05 23:45:42 +00:00
nobu
1bfee27795
test_vector.rb: fix exception class
...
* test/matrix/test_vector.rb (test_independent): fix exception
class path, Vector does not have its own TypeError. [#10451 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-19 23:57:56 +00:00
marcandre
387e0dbe3f
* lib/matrix.rb: Vector#independent? and associated class method
...
patch by gogo tanaka [#10451 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-19 17:44:46 +00:00
marcandre
4da89e192a
* lib/matrix.rb: Add Vector#angle_with
...
Patch by Egunov Dmitriy [#10442 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-19 17:32:58 +00:00
marcandre
aa87ea9915
* lib/matrix.rb: Generalize Vector#cross_product to arbitrary dimensions
...
based on a patch by gogo tanaka [#10074 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-29 02:43:52 +00:00
marcandre
764524f65b
* lib/matrix.rb: Add Matrix#adjucate
...
patch by gogo tanaka [#10056 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-29 02:43:28 +00:00
marcandre
dc38c87779
* lib/matrix.rb: Add aliases for Vector#cross & dot
...
patch by gogo tanaka [#10352 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-29 02:42:56 +00:00
marcandre
a2ae7bccf8
* lib/matrix.rb: Add @- and @+ for Matrix and Vector.
...
patch by gogo tanaka [#10068 ] [#10069 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-07 20:18:35 +00:00
marcandre
56d5728589
* lib/matrix.rb: Add Matrix#laplace_expansion.
...
patch by gogo tanaka [#10073 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-07 19:30:48 +00:00
marcandre
eb9c3e7120
* lib/matrix.rb: Add Vector.basis.
...
Based on patch by gogo tanaka [#10072 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-07 19:29:53 +00:00
marcandre
5b46b07bf3
* lib/matrix.rb: Add hstack & vstack methods.
...
Based on a patch by creasywuqiong. [Fix GH-344]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-03 03:44:20 +00:00
marcandre
f59098d118
* lib/matrix.rb: Fix Matrix.rows copy bug.
...
Patch by Arron Mabrey. [Fix GH-707]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-03 03:38:06 +00:00
hsbt
b794145222
* test/matrix/test_matrix.rb: Add tests for Matrix class.
...
[Feature #10057 ][ruby-core:63809]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-18 08:48:05 +00:00
marcandre
72d0536606
* lib/matrix.rb: Fix sign for cross_product [ #9499 ]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-11 05:19:33 +00:00
marcandre
d11d87c362
* lib/matrix.rb: Add Matrix#cofactor [fix GH-568]
...
Patch by gogotanaka
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-06 17:46:16 +00:00
marcandre
b8ba202301
* lib/matrix.rb: Add first_minor [fix GH-568]
...
Patch by gogotanaka
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-06 17:45:54 +00:00
marcandre
1657d516e9
* test/matrix/test_matrix: Add tests for trivial cases [fix GH-576]
...
Patch by gogotanaka
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-06 17:45:28 +00:00
marcandre
bcf8dd1096
* lib/matrix: Handle empty diagonal matrix case [fix GH-576]
...
Patch by gogotanaka
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-06 17:45:07 +00:00
nobu
7c2230bd8c
matrix.rb: complex vector
...
* lib/matrix.rb (Vector#magnitude): accumulate squares of absolute
values to fix for complex vector. [ruby-dev:46100] [Bug #6966 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-03 05:49:06 +00:00
marcandre
d1999f393f
* test/matrix/test_matrix.rb: remove obsolete test [ruby-core:37714]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-01 22:25:32 +00:00
marcandre
0a3c78face
* lib/matrix.rb: Improve algorithm for Matrix#determinant and Matrix#rank
...
{determinant,det,rank}_e are now deprecated. [ruby-core:28273]
Also fixes a bug in Determinant#rank (e.g. [[0,1][0,1][0,1]])
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-29 18:19:12 +00:00
marcandre
521f4a4beb
* lib/matrix.rb: Deprecate Vector#elements_to{i/f/r}
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-11 18:50:51 +00:00
marcandre
634616d7f3
* test/matrix/test_vector.rb: Oups, removed another obsolete test
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-05 15:30:18 +00:00
marcandre
daad4e2433
* test/matrix/test_matrix.rb (class): Cleanup tests
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-04 15:10:44 +00:00
mame
5f7f5098a6
* test/matrix/test_matrix.rb, test/matrix/test_vector.rb: add some
...
tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-27 14:34:03 +00:00
nobu
655cb34f17
* lib/matrix.rb (Matrix#inverse_from): use #quo. backported r9490.
...
* lib/matrix.rb (Matrix#determinant): ditto. [ruby-core:27507]
* lib/matrix.rb (Matrix#rank): ditto.
* lib/matrix.rb (Matrix::Scalar#initialize): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-09 20:35:28 +00:00
yugui
c33d5a80c7
* test/matrix/test_matrix.rb (TestMatrix#test_rank):
...
added a test method for r24969.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-10 17:18:31 +00:00
yugui
1cda105886
* test/matrix/test_matrix.rb (setup): typo.
...
(test_equality): misdefinition of the expected working.
Reported by an anonymous user.
(test_hash): added.
* test/matrix/test_vector.rb: ditto.
Mon Sep 15 03:33:10 2008 Tanaka Akira <akr@fsij.org>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 01:33:43 +00:00
yugui
406500cc8b
* lib/matrix.rb (Vector#eql?): typo of the method name as "eqn?".
...
(Vector#eqn?): removed. Defined by mistake.
Fixes [ruby-dev:36294]. Reported by weda <weda AT
issp.u-tokyo.ac.jp> and an anonymous user.
* test/matrix/test_matrix.rb: added.
* test/matrix/test_vector.rb: added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-14 07:15:55 +00:00