Marc-Andre Lafortune
a7dccd08e7
[ruby/matrix] Make frozen matrices Ractor shareable
2020-12-09 02:15:41 -05:00
Marc-Andre Lafortune
a83a51932d
[ruby/matrix] Optimize **
...
Avoiding recursive call would imply iterating bits starting from
most significant, which is not easy to do efficiently.
Any saving would be dwarfed by the multiplications anyways.
[Feature #15233 ]
2020-12-05 00:56:58 -05:00
Marc-Andre Lafortune
9b5675b325
[ruby/matrix] Add Matrix#adjoint [ #14 ]
...
Patch adapted from Alessandro Minali
2020-05-01 03:25:15 -04:00
Marc-Andre Lafortune
07fd6dc49b
[ruby/matrix] Optimize Matrix#*
2020-05-01 03:25:13 -04:00
Marc-Andre Lafortune
3cb038cc7a
[ruby/matrix] Fix Matrix#orthogonal?
2020-05-01 03:25:11 -04:00
Marc-Andre Lafortune
7d360efe92
[ruby/matrix] Fix Matrix#unitary? [ #14 ]
2020-05-01 03:25:05 -04:00
zverok
c925cc01c5
[ruby-matrix] Update docs (nicer rendering, undocumented method)
2020-05-01 03:13:24 -04:00
Kazuhiro NISHIYAMA
e077a910b6
Fix message of ExceptionForMatrix::ErrOperationNotDefined
...
```
% RBENV_VERSION=2.6.5 ruby -r matrix -e 'Vector[1]*Vector[2] rescue p($!)'
#<ExceptionForMatrix::ErrOperationNotDefined: Operation(*) can't be defined: Vector op Vector>
% RBENV_VERSION=2.7.0 ruby -r matrix -e 'Vector[1]*Vector[2] rescue p($!)'
#<ExceptionForMatrix::ErrOperationNotDefined: Operation(*) can\'t be defined: Vector op Vector>
% RBENV_VERSION=master ruby -r matrix -e 'Vector[1]*Vector[2] rescue p($!)'
#<ExceptionForMatrix::ErrOperationNotDefined: Operation(*) can't be defined: Vector op Vector>
```
2020-02-09 13:39:24 +09:00
Hiroshi SHIBATA
c50d30f659
Simplified ErrDimensionMismatch class
2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
2f66c443d7
Support argument for ErrNotRegular
2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
c1059e99d3
Support existence usecase for the custom exception classes
2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
5044260dcd
replace raise method from e2mmap on Scalar class
2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
9b950310be
raise method accepts 3 argument with exception class
2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
04511b994e
Remove re-define embedded error classes and extract argument on custom error classes
2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
d82c541ae4
Use simple exception classes instead of e2mmap
2019-11-30 08:00:40 +09:00
Fernando Wolf Bona
8d804e41a0
Add abs to Matrix ( #2199 )
2019-08-21 16:36:39 -04:00
Marcus Stollsteimer
423feb53a2
[ruby/matrix] Add Matrix::VERSION constant
...
Add Matrix::VERSION for the gem version, use it in the gemspec,
and make it also available for library users.
https://github.com/ruby/matrix/commit/65c2bb1fa1
2019-07-15 00:32:00 +09:00
nobu
9f1fb0a17f
proc.c: proc without block
...
* proc.c (proc_new): promoted lambda/proc/Proc.new with no block
in a method called with a block to a warning/error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10 08:19:14 +00:00
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
c8c66bcf92
lib/matrix: Use consistent style
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:20 +00:00
marcandre
5ba9a9505d
lib/matrix: use consistent style
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:12 +00:00
marcandre
a1f22c4f1c
lib/matrix.rb: Alias antisymmetric? with skew_symmetric?
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:05 +00:00
marcandre
55961ac9d7
Revert "Matrix: Add #reflexive? method. [Fix GH-1730]"
...
This reverts commit 19fe6552c4
.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:51:56 +00:00
marcandre
19fe6552c4
Matrix: Add #reflexive? method. [Fix GH-1730]
...
Adapted from a patch by Yilo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-20 18:24:16 +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
hsbt
54a48b979c
Removed needless extension for require.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-08 08:46:52 +00:00
marcandre
d3513d313e
lib/matrix.rb: Document deprecated methods [ #12032 ] [doc] [ci-skip]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-06 23:47:49 +00:00
stomar
3b51e3a11f
matrix.rb: add Matrix#antisymmetric?
...
* lib/matrix.rb: add Matrix#antisymmetric?.
Proposed by Yilo (@yiloo). Patch by Marcus Stollsteimer (@stomar).
[Fix GH-1788]
* spec/ruby/library/matrix/antisymmetric_spec.rb: add specs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-11 19:36:30 +00:00
shyouhei
f2a91397fd
Add uplevel keyword to Kernel#warn and use it
...
If uplevel keyword is given, the warning message is prepended
with caller file and line information and the string "warning: ".
The use of the uplevel keyword makes Kernel#warn format output
similar to how rb_warn formats output.
This patch modifies net/ftp and net/imap to use Kernel#warn
instead of $stderr.puts or $stderr.printf, since they are used
for printing warnings.
This makes lib/cgi/core and tempfile use $stderr.puts instead of
warn for debug logging, since they are used for debug printing
and not for warning.
This does not modify bundler, rubygems, or rdoc, as those are
maintained outside of ruby and probably wish to remain backwards
compatible with older ruby versions.
rb_warn_m code is originally from nobu, but I've changed it
so that it only includes the path and lineno from uplevel
(not the method), and also prepends the string "warning: ",
to make it more similar to rb_warn.
From: Jeremy Evans code@jeremyevans.net
Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 11:56:25 +00:00
kazu
0e7c83e374
[DOC] Fix example result [ci skip]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-20 12:57:08 +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
3527c863be
lib/matrix: Remove method catalog [doc] [ci-skip]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-09 22:05:44 +00:00
kazu
dabdec31e4
Use caller with length to reduce unused strings
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:40:03 +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
usa
40c9f1f328
get rid of test failures on CI introduced at r56927
...
* lib/matrix.rb: now ruby warns ambiguous parentheses after a space in method definitions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-29 15:23:12 +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
hsbt
e398e64ad7
* lib/matrix.rb: added documentation for Matrix#empty and Matrix#/
...
[Feature #10070 ][ruby-dev:48433] Patch by @gogotanaka
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-21 08:29:32 +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
marcandre
ecf33043b8
* lib/matrix.rb: [Doc] Fix Vector multiplication documentation [ci-skip]
...
[Fixes GH-837]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-22 20:22:31 +00:00
marcandre
969057c95a
* lib.matrix.rb: Fix typo. Patch by Dimitrios Zorbas. [GH-772]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-27 01:03:46 +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