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
285 286 287 |
# File 'lib/carray/construct.rb', line 285 def from_memory_view (obj) CArray.from_memory_view(obj, data_type: self::DataType) end |
#new(*shape) ⇒ CArray
273 274 275 |
# File 'lib/carray/construct.rb', line 273 def new (*shape) CArray.new(self::DataType, shape) end |
#wrap_memory_view(obj) ⇒ CAWrap
301 302 303 |
# File 'lib/carray/construct.rb', line 301 def wrap_memory_view (obj) CArray.wrap_memory_view(obj, data_type: self::DataType) end |