1

I have extended the Matrix class in my rails app to add two new methods as described here:

Two extended classes - one works and the other doesn't

The above methods now work fine. Also some of the existing methods work fine such as

Matrix.column_vector([4,5,6])
Matrix.columns([[25, 93], [-1, 66]])

but

Matrix.build(2, 4) {|row, col| col - row }
Matrix.build(3) { rand }

do not work and give the error

undefined method `build' for Matrix:Class    

The methods are all defined in this page here:

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/matrix/rdoc/Matrix.html#method-c-build

What could be causing the build method to not work, when other Matrix methods do work? Am I missing an extra library or class?

EDIT 1: I realised it is because I have ruby 1.8.7 when the build method is defined in 1.9.3

Community
  • 1
  • 1
Zakoff
  • 12,665
  • 5
  • 22
  • 35

1 Answers1

0

I realised it is because I have ruby 1.8.7 when the build method is defined in 1.9.3

Zakoff
  • 12,665
  • 5
  • 22
  • 35