diff options
author | Fernando Wolf Bona <[email protected]> | 2019-08-21 17:36:39 -0300 |
---|---|---|
committer | Marc-André Lafortune <[email protected]> | 2019-08-21 16:36:39 -0400 |
commit | 8d804e41a013ab1967a703a0ce388b579f735ac8 (patch) | |
tree | 79e7f24dd430bef8349da25ef0e7dc51c9ce65be /lib/matrix.rb | |
parent | 48fdc37ad52d9a59763da4c1c22683713b7ddea8 (diff) |
Add abs to Matrix (#2199)
Diffstat (limited to 'lib/matrix.rb')
-rw-r--r-- | lib/matrix.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb index b8139b547f..6b3a2becf4 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -1225,6 +1225,13 @@ class Matrix collect {|e| -e } end + # + # Returns the absolute value elementwise + # + def abs + collect(&:abs) + end + #-- # MATRIX FUNCTIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ |