Class: Charty::VectorAdapters::NMatrixAdapter
- Inherits:
-
BaseAdapter
- Object
- BaseAdapter
- Charty::VectorAdapters::NMatrixAdapter
- Extended by:
- Forwardable
- Includes:
- IndexSupport, NameSupport, Enumerable
- Defined in:
- lib/charty/vector_adapters/nmatrix_adapter.rb
Instance Attribute Summary
Attributes included from IndexSupport
Attributes included from NameSupport
Attributes inherited from BaseAdapter
Class Method Summary collapse
Instance Method Summary collapse
- #compare_data_equality(other) ⇒ Object
-
#initialize(data) ⇒ NMatrixAdapter
constructor
A new instance of NMatrixAdapter.
Methods included from IndexSupport
Methods inherited from BaseAdapter
#==, adapter_name, #mean, #stdev, #where_in_array
Methods included from MissingValueSupport
Constructor Details
#initialize(data) ⇒ NMatrixAdapter
Returns a new instance of NMatrixAdapter.
13 14 15 16 |
# File 'lib/charty/vector_adapters/nmatrix_adapter.rb', line 13 def initialize(data) @data = check_data(data) self.index = index || RangeIndex.new(0 ... length) end |
Class Method Details
.supported?(data) ⇒ Boolean
9 10 11 |
# File 'lib/charty/vector_adapters/nmatrix_adapter.rb', line 9 def self.supported?(data) defined?(NMatrix) && data.is_a?(NMatrix) end |
Instance Method Details
#compare_data_equality(other) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/charty/vector_adapters/nmatrix_adapter.rb', line 18 def compare_data_equality(other) case other when NMatrixAdapter data == other.data when ArrayAdapter, DaruVectorAdapter data.to_a == other.data.to_a when NArrayAdapter, NumpyAdapter, PandasSeriesAdapter other.compare_data_equality(self) else data == other.data.to_a end end |