Class: Charty::VectorAdapters::NMatrixAdapter
Instance Attribute Summary
Attributes included from IndexSupport
#index
Attributes included from NameSupport
#name
Attributes inherited from BaseAdapter
#data
Class Method Summary
collapse
Instance Method Summary
collapse
#[], #[]=
Methods inherited from BaseAdapter
#==, adapter_name, #inverse_log_scale, #log_scale, #mean, #percentile, #stdev, #values_at, #where_in_array
Constructor Details
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
|
# File 'lib/charty/vector_adapters/nmatrix_adapter.rb', line 18
def compare_data_equality(other)
case other
when NMatrixAdapter
data == other.data
else
data.to_a == other.data.to_a
end
end
|