File: testmatrix3.rb

package info (click to toggle)
ruby-narray 0.6.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 468 kB
  • sloc: ansic: 4,498; ruby: 1,329; python: 91; makefile: 7
file content (19 lines) | stat: -rw-r--r-- 232 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'narray'
require 'rational'

#class Rational
#  def inspect
#    @numerator.to_s+"/"+@denominator.to_s
#  end
#end

srand(1)
n=5

m = NMatrix.object(n,n).collect{Rational(rand(10))}

puts 'm  #=>'
p m

puts 'm/m  #=>'
p m/m