File: testrandom.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 (23 lines) | stat: -rw-r--r-- 354 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'narray'

def test a
  print a," #=> "
  p eval(a)
  print "\n"
end

test "NArray.float(5).random(10)"

test "NArray.float(5).random"

test "NArray.int(5).random(10)"

test "NArray.int(1000).random(10)"

a = NArray.int(1000).random(10)

idx = (a.eq 0).where
print "a.eq 0  :: n=", idx.size, "\n"

idx = (a.eq 10).where
print "a.eq 10 :: "; p idx