Actions
Feature #10069
closed[PATCH] Implement monadic operator for Matrix
Description
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
Updated by matz (Yukihiro Matsumoto) over 10 years ago
- Related to Feature #10068: [PATCH] Implement monadic operator for Vector added
Updated by matz (Yukihiro Matsumoto) over 10 years ago
As #10068, I like the idea, but unary operator has nothing related to inject though.
Matz.
Updated by gogotanaka (Kazuki Tanaka) over 10 years ago
Yukihiro Matsumoto wrote:
unary operator has nothing related to inject though.
It's kind of my mistake, sorry to confuse you.
I think it not seldom happens that we want do this(term monadic). And this is based on custom in math.
Compared with some other numerical analysis software(MATLAB, mathematica, GNU Octave, R, NumPy),
They have term monadic for matrix, vector. (But you can say "this is ruby issue! this is no business of how other softwares are" )
thank you.
gogo.
Updated by hsbt (Hiroshi SHIBATA) over 10 years ago
- Assignee set to marcandre (Marc-Andre Lafortune)
- Category set to lib
- Status changed from Open to Assigned
- Target version set to 2.2.0
Updated by marcandre (Marc-Andre Lafortune) about 10 years ago
- Status changed from Assigned to Closed
Done.
Thanks for catching this omission, and for the patch.
Actions
Like0
Like0Like0Like0Like0Like0