Class: NArray
- Inherits:
-
Object
- Object
- NArray
- Defined in:
- lib/numru/gphys/narray_ext.rb,
lib/numru/gdir_connect_ftp-like.rb
Constant Summary collapse
- @@dump_size_limit =
max len to allow dump / no limit if negative
-1 # max len to allow dump / no limit if negative
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
._load(o) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/numru/gphys/narray_ext.rb', line 26 def self._load(str) ary = Marshal.load(str) typecode, shape, endian, str = ary na = NArray.to_na(str, typecode, *shape) na = na.swap_byte unless endian == NArray.endian return na end |
.dump_size_limit ⇒ Object
9 10 11 |
# File 'lib/numru/gphys/narray_ext.rb', line 9 def self.dump_size_limit @@dump_size_limit end |
.dump_size_limit=(lmt) ⇒ Object
6 7 8 |
# File 'lib/numru/gphys/narray_ext.rb', line 6 def self.dump_size_limit=(lmt) @@dump_size_limit = lmt end |
.endian ⇒ Object
13 14 15 |
# File 'lib/numru/gphys/narray_ext.rb', line 13 def self.endian NArray[1].to_s[1] == 1 ? :little : :big end |
Instance Method Details
#_dump(limit) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/numru/gphys/narray_ext.rb', line 17 def _dump(limit) if (@@dump_size_limit <= 0) || (size <= @@dump_size_limit) Marshal.dump([typecode, shape, NArray.endian, to_s]) else raise "size of the NArray (#{size}) is too large to dump "+ "(limit: #{DUMP_SIZE_LIMIT})" end end |