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

def test a,b
  print a," #=> "
  p b
end

a = NArray.int(4,3,2).indgen!
test "a",a

print "\n# transpose first and second...\n"
test "a.transpose(1,0)",a.transpose(1,0)

print "\n# transpose first and last...\n"
test "a.transpose(-1,1..-2,0)",a.transpose(-1,1..-2,0)

print "\n# transpose shift forward ...\n"
test "a.transpose(1..-1,0)",a.transpose(1..-1,0)