File: testminmax.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 (46 lines) | stat: -rw-r--r-- 651 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require 'narray'

def test a
  print "a = "
  p a
  print "a.min = "
  p a.min
  print "a.max = "
  p a.max
  print "a.sum = "
  p a.sum
  print "a.mean = "
  p a.mean
  print "a.stddev = "
  p a.stddev
end

a = NArray[0,2,-2.5,3,1.4]

test a

a = NArray.float(5,1).indgen!(1)
b = NArray.float(1,3).indgen!(1)
a *= b
test a

print "a.min(0) = "
p a.min(0)
print "a.max(0) = "
p a.max(0)
print "a.min(1) = "
p a.min(1)
print "a.max(1) = "
p a.max(1)
print "a.sum(0) = "
p a.sum(0)
print "a.sum(1) = "
p a.sum(1)
print "a.mean(0) = "
p a.mean(0)
print "a.mean(1) = "
p a.mean(1)
print "a.stddev(0) = "
p a.stddev(0)
print "a.stddev(1) = "
p a.stddev(1)