我使用的是Ruby 1.9.2-p290和RubyMine。我尝试使用矩阵(需要'矩阵')。所以,我有几个问题。在RubyMine和Matrix中使用Ruby 1.9.2
- 如何更改矩阵的任何值?
例如:
require 'matrix'
matrix = Matrix[[1, -2, 3], [3, 4, -5], [2, 4, 1]]
matrix[0, 0] = 5
p matrix
给出了未来:
in `<top (required)>': private method `[]=' called for Matrix[[1, -2, 3], [3, 4, -5], [2, 4, 1]]:Matrix (NoMethodError)
from -e:1:in `load'
from -e:1:in `<main>'
- 是否可以给我显示矩阵通过代码完成的RubyMine IDE的方法呢?
- 我应该使用什么库作为矩阵?矩阵? Mathn?还有别的吗?
该文档在哪里说'[] ='是公开的? –
它在“公共实例方法”一节中列出。 –
啊,的确如此。看起来像一个rdoc的bug。不知道我什么时候能够调查... –