[ruby-core:63870] [ruby-trunk - Feature #10069] [PATCH] Implement monadic operator for Matrix

From: matz@...
Date: 2014-07-19 11:16:04 UTC
List: ruby-core #63870
Issue #10069 has been updated by Yukihiro Matsumoto.

Related to Feature #10068: [PATCH] Implement monadic operator for Vector added

----------------------------------------
Feature #10069: [PATCH] Implement monadic operator for Matrix
https://bugs.ruby-lang.org/issues/10069#change-47894

* Author: gogo tanaka
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
Before

```
m = Matrix[[1,2,3], [4,5,6]]
 
+ m
NoMethodError: undefined method `+@' for Matrix[[1, 2, 3], [4, 5, 6]]:Matrix

- m
NoMethodError: undefined method `-@' for Matrix[[1, 2, 3], [4, 5, 6]]:Matrix
```

After

```
m = Matrix[[1,2,3], [4,5,6]]

+ m
=> Matrix[[1, 2, 3], [4, 5, 6]]

- m
=> Matrix[[-1, -2, -3], [-4, -5, -6]]
```

I think monadic operator for Matrix is important, when I use operator as block. like that

```
matrix_ary.inject(:+)
```

---Files--------------------------------
implement_uplus_for_matrix.patch (762 Bytes)
implement_negate_for_matrix.patch (1.21 KB)


-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next