Module: CArray::DataTypeNewConstructor
- Defined in:
- lib/carray/construct.rb,
lib/carray/construct.rb
Overview
Constructors added to every typed class (Float64, Int32, ...) so the
class itself names the element type. Each forwards to the CArray
equivalent with data_type: filled in.
Instance Method Summary collapse
-
#from_memory_view(obj) ⇒ CArray
Returns a fresh CArray interpreted as this typed subclass's
data_type, imported by copy from a MemoryView producer. -
#new(*shape) ⇒ CArray
Allocates a new CArray of this typed subclass with the given shape.
-
#wrap_memory_view(obj) ⇒ CAWrap
Returns a zero-copy CAWrap over
obj's MemoryView interpreted as this typed subclass'sdata_type.
Instance Method Details
#from_memory_view(obj) ⇒ CArray
325 326 327 |
# File 'lib/carray/construct.rb', line 325 def from_memory_view (obj) CArray.from_memory_view(obj, data_type: self::DataType) end |
#new(*shape) ⇒ CArray
313 314 315 |
# File 'lib/carray/construct.rb', line 313 def new (*shape) CArray.new(self::DataType, shape) end |
#wrap_memory_view(obj) ⇒ CAWrap
341 342 343 |
# File 'lib/carray/construct.rb', line 341 def wrap_memory_view (obj) CArray.wrap_memory_view(obj, data_type: self::DataType) end |