Граф коммитов

87 Коммитов

Автор SHA1 Сообщение Дата
marcandre 59a3d59496 * lib/matrix.rb: Allow non integer exponents for Matrix#**
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-01 06:21:24 +00:00
marcandre 004c34f9de * lib/matrix: Add Eigenvalue Decomposition
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-01 06:13:35 +00:00
marcandre 376b825127 * lib/matrix: Add Matrix#round
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-01 06:10:40 +00:00
marcandre 54bbc098fa * lib/matrix.rb: Matrix.zero can build rectangular matrices.
Vector#r should be called #magnitude

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-29 01:13:22 +00:00
marcandre de97e946f0 * lib/matrix.rb: Add Matrix#diagonal?, hermitian?, normal?, orthogonal?
permutation?, symmetric?, {lower|upper}triangular?, unitary?, zero?

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-29 01:11:19 +00:00
marcandre 22ffae4009 * lib/matrix.rb: Specialize Matrix#find_index to return [row, col]
and accept the same optional argument as #each

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-29 01:09:46 +00:00
marcandre dfc6bf9da8 * lib/matrix.rb: Matrix#each{_with_index} can iterate over a subset of the Matrix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-29 01:08:02 +00:00
naruse 0de2d84af8 Clean warnings: unused variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-23 05:32:46 +00:00
marcandre 159fd9ee6c * lib/matrix.rb (eql?, ==, minor): Fix bugs when comparing/returning
some empty matrices.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 04:18:08 +00:00
marcandre 87c1da091c * lib/matrix.rb: trivial optimizations
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 04:17:44 +00:00
marcandre ef83d7a928 * lib/matrix.rb (determinant): Trivial optimization (thanks to Benoit Daloze)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:09:31 +00:00
marcandre ec8b5d0625 * NEWS: List all changes to lib/matrix
* lib/matrix.rb: Improve doc and style. Trivial optimizations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-02 05:43:29 +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 a3a4542fb4 * lib/matrix.rb (Matrix#singular?, Matrix#regular?): raise on rectangular
matrices, and use determinant instead of rank.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-29 18:18:58 +00:00
marcandre 17fa2ce73a * lib/matrix.rb: New method Matrix.build [ruby-core:28272]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-11 20:10:43 +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 3f64c83eb1 * lib/matrix.rb: Deprecate elements_to_{f/i/r}
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-11 18:45:58 +00:00
marcandre e0cfb13c32 * lib/matrix.rb: Handle coercion errors by raising TypeErrors [ruby-core:26736]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-11 18:30:58 +00:00
kazu 4900daa4a3 fix rdoc. see r27156
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-07 08:50:36 +00:00
marcandre 5ef335319e * lib/matrix.rb: Matrix.determinant: raise on rectangular matrices
[ruby-core:28271]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 18:06:08 +00:00
marcandre 729941da39 * lib/matrix.rb: New Complex instance methods:
conjugate, conj, imaginary, imag, real, real?, rectangular, rect
    [ruby-core:26285]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 18:05:11 +00:00
marcandre 277cb36b21 * lib/matrix.rb: New methods Matrix#each, #each_with_index, and
include Enumerable [ruby-core:28400]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 18:04:14 +00:00
marcandre af6e31b344 * lib/matrix.rb (empty): Reject negative sizes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 18:03:15 +00:00
marcandre fac245828b * lib/matrix.rb: New method #empty? [ruby-core:26284]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 18:02:27 +00:00
marcandre 39aad8fa83 * lib/matrix.rb: removed compare_by*, inspect_org, cf [ruby-core:26268]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 18:01:45 +00:00
keiju cd492563f8 * lib/matrix.rb(Vector#each2, Vector#collect2): add type check for
Integer[Bug #2495].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-29 11:27:03 +00:00
marcandre b81e045712 * lib/matrix.rb (Vector#each): Return self and optimization [ruby-core:28405]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-03 14:07:53 +00:00
matz 800dda6c28 * lib/matrix.rb (Vector#each2, collect2): small refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-03 07:21:21 +00:00
matz 2cfb894d2a * lib/matrix.rb (Vector#each): make Vector enumerable.
[ruby-core:28405]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-03 07:19:21 +00:00
mame 9f714e35ec * lib/matrix.rb (Vector#each2): returns a self. [ruby-dev:40241]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-01 12:27:46 +00:00
keiju afc9fce01f * lib/matrix.rb: add exception Matrix::ErrOperationNotImplemented
[ruby-dev:40149].
 * lib/matrix.rb: change message of exception
   Matrix::ErrOperationNotDefined [ruby-dev:40150], [ruby-dev:40176].
 * lib/matrix.rb: add method Vector#/ [ruby-dev:40151].
 * lib/matrix.rb(Matrix::Scalar#+,-,/): delete meaningless when
   switch. [ruby-dev:40149]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-27 14:28:47 +00:00
mame a817c0b089 * lib/matrix.rb (determinant): fix name error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-27 13:49:58 +00:00
akr a967f738c8 * lib/matrix.rb: suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 22:08:29 +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
marcandre fad1e8c761 * lib/matrix.rb (each2,collect2,map2): Fix enumerator [ruby-core:27225]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-19 02:07:00 +00:00
marcandre c038e9003c * lib/matrix.rb (**): Optimization (up to 45% faster)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-24 20:55:40 +00:00
marcandre 66ed25f633 * lib/matrix (transpose): bug fix for Matrix.empty(0,42).t
cf [ruby-core:23598]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-24 06:05:10 +00:00
marcandre 90d244aded * lib/matrix (column): handle negative arguments. cf [ruby-core:23598]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-24 06:04:56 +00:00
marcandre e5af8e940b * lib/matrix (minor): Also handle negative arguments like Array#[]
cf [ruby-core:23598]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-24 06:04:41 +00:00
marcandre 86a81951b1 * lib/matrix.rb (transpose, inspect): Bug fix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 19:01:44 +00:00
marcandre 439a1e64d1 * lib/matrix.rb (empty): Improved rdoc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 19:01:31 +00:00
keiju 9eebf6bf48 * lib/matrix.rb: Bug fix. See detail [ruby-core:23598].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-20 13:35:15 +00:00
marcandre 6023a79deb * lib/matrix.rb (Matrix#rank): Two bug fixes. One made Matrix[[0,0],[0,0],[1,0]].rank raise a NoMethodError while the other one had Matrix[[0,1],[0,0],[1,0]].rank raise a TypeError.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-16 21:04:07 +00:00
marcandre d09cde1861 * lib/matrix.rb: Optimizations
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-16 21:02:54 +00:00
marcandre 405cfda0d2 * lib/matrix.rb (Matrix#/): Fix obvious bug
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-16 08:24:15 +00:00
marcandre 193a7db4e2 * lib/matrix.rb: fix previous optimization
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-16 07:17:22 +00:00
marcandre 52c3721af3 * lib/matrix.rb (determinant): Bug fix where determinant failed on some matrices [ruby-core:23597]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-16 04:39:51 +00:00
marcandre c3db24a4dc * lib/matrix.rb: Fix typos in doc and indent
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-16 04:39:37 +00:00
marcandre 9d3638448e * lib/matrix.rb: trivial optimizations
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-16 04:36:37 +00:00
wanabe abc20ed0f4 * lib/matrix.rb (Matrix#rank): revert a part of r20859 to avoid
infinite loop.  [Bug #1020]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-20 03:53:19 +00:00