将Ruby 1.9.2与RubyMine和Matrix一起使用 [英] Using Ruby 1.9.2 with RubyMine and Matrix

查看:120
本文介绍了将Ruby 1.9.2与RubyMine和Matrix一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ruby 1.9.2-p290和RubyMine.而且我尝试使用矩阵(需要矩阵").所以,我有几个问题.

I am using ruby 1.9.2-p290 and RubyMine. And i try to use Matrix (require 'matrix'). So, i have few questions.

  • 如何更改矩阵的任何值?

例如:

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>'

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆