File: testindex.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 (11 lines) | stat: -rw-r--r-- 287 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
require 'narray'

a = NArray.float(3,3).indgen!

print "a #=> "; p a
print "a[1, -1] #=> "; p a[1, -1]
print "a[1, 2..0] #=> "; p a[1, 2..0]
print "a[1...2, 0..1] #=> "; p a[1...2, 0..1]  # without rank-reduce
print "a[true, 0..1] #=> "; p a[true, 0..1]
print "a[0..5] #=> "; p a[0..5]