File: testarray.rb

package info (click to toggle)
libnarray-ruby 0.5.9p7-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 432 kB
  • ctags: 517
  • sloc: ansic: 4,412; ruby: 1,281; python: 91; makefile: 5
file content (20 lines) | stat: -rw-r--r-- 320 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
require 'narray'

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

p NArray[a,[100,101]]

b = NArray[ [ [ 0.0, 1.0, 2.0 ], 
              [ 3.0, 4.0, 5.0 ], 
              [ 6.0, 7.0, 8.0 ] ],
            [100,101] ]
p b

a = NArray.float(2,2).indgen

b = NArray[ a,[a] ]
p b

b = NArray[ [ 0.0, 1.0 ], 
            [ [ 0.0, 1.0 ] ] ]
p b