Class: ArrowFormat::Org::Apache::Arrow::Flatbuf::SparseMatrixIndexCSX
- Inherits:
-
FlatBuffers::Table
- Object
- FlatBuffers::Table
- ArrowFormat::Org::Apache::Arrow::Flatbuf::SparseMatrixIndexCSX
- Defined in:
- lib/arrow-format/org/apache/arrow/flatbuf/sparse_matrix_index_csx.rb
Overview
Compressed Sparse format, that is matrix-specific.
Constant Summary collapse
- FIELDS =
{ compressed_axis: ::FlatBuffers::Field.new(:compressed_axis, 0, 4, :short, 0), indptr_type: ::FlatBuffers::Field.new(:indptr_type, 1, 6, "::ArrowFormat::Org::Apache::Arrow::Flatbuf::Int", 0), indptr_buffer: ::FlatBuffers::Field.new(:indptr_buffer, 2, 8, "::ArrowFormat::Org::Apache::Arrow::Flatbuf::Buffer", 0), indices_type: ::FlatBuffers::Field.new(:indices_type, 3, 10, "::ArrowFormat::Org::Apache::Arrow::Flatbuf::Int", 0), indices_buffer: ::FlatBuffers::Field.new(:indices_buffer, 4, 12, "::ArrowFormat::Org::Apache::Arrow::Flatbuf::Buffer", 0), }
- Data =
define_data_class
Instance Method Summary collapse
-
#compressed_axis ⇒ Object
Which axis, row or column, is compressed.
-
#indices_buffer ⇒ Object
indicesBuffer stores the location and size of the array that contains the column indices of the corresponding non-zero values.
-
#indices_type ⇒ Object
The type of values in indicesBuffer.
-
#indptr_buffer ⇒ Object
indptrBuffer stores the location and size of indptr array that represents the range of the rows.
-
#indptr_type ⇒ Object
The type of values in indptrBuffer.
Instance Method Details
#compressed_axis ⇒ Object
Which axis, row or column, is compressed
30 31 32 33 34 35 36 37 38 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/sparse_matrix_index_csx.rb', line 30 def compressed_axis field_offset = @view.unpack_virtual_offset(4) if field_offset.zero? enum_value = 0 else enum_value = @view.unpack_short(field_offset) end ::ArrowFormat::Org::Apache::Arrow::Flatbuf::SparseMatrixCompressedAxis.try_convert(enum_value) || enum_value end |
#indices_buffer ⇒ Object
indicesBuffer stores the location and size of the array that contains the column indices of the corresponding non-zero values. The type of index value is long.
For example, the indices of the above X are: “‘text
indices(X) = [1, 2, 2, 1, 3, 0, 2, 3, 1].
“‘ Note that the indices are sorted in lexicographical order for each row.
49 50 51 52 53 54 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/sparse_matrix_index_csx.rb', line 49 def indices_buffer field_offset = @view.unpack_virtual_offset(12) return nil if field_offset.zero? @view.unpack_struct(::ArrowFormat::Org::Apache::Arrow::Flatbuf::Buffer, field_offset) end |
#indices_type ⇒ Object
The type of values in indicesBuffer
57 58 59 60 61 62 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/sparse_matrix_index_csx.rb', line 57 def indices_type field_offset = @view.unpack_virtual_offset(10) return nil if field_offset.zero? @view.unpack_table(::ArrowFormat::Org::Apache::Arrow::Flatbuf::Int, field_offset) end |
#indptr_buffer ⇒ Object
indptrBuffer stores the location and size of indptr array that represents the range of the rows. The i-th row spans from ‘indptr` to `indptr` in the data. The length of this array is 1 + (the number of rows), and the type of index value is long.
For example, let X be the following 6x4 matrix: “‘text
X := [[0, 1, 2, 0],
[0, 0, 3, 0],
[0, 4, 0, 5],
[0, 0, 0, 0],
[6, 0, 7, 8],
[0, 9, 0, 0]].
“‘ The array of non-zero values in X is: “`text
values(X) = [1, 2, 3, 4, 5, 6, 7, 8, 9].
“‘ And the indptr of X is: “`text
indptr(X) = [0, 2, 3, 5, 5, 8, 10].
“‘
87 88 89 90 91 92 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/sparse_matrix_index_csx.rb', line 87 def indptr_buffer field_offset = @view.unpack_virtual_offset(8) return nil if field_offset.zero? @view.unpack_struct(::ArrowFormat::Org::Apache::Arrow::Flatbuf::Buffer, field_offset) end |
#indptr_type ⇒ Object
The type of values in indptrBuffer
95 96 97 98 99 100 |
# File 'lib/arrow-format/org/apache/arrow/flatbuf/sparse_matrix_index_csx.rb', line 95 def indptr_type field_offset = @view.unpack_virtual_offset(6) return nil if field_offset.zero? @view.unpack_table(::ArrowFormat::Org::Apache::Arrow::Flatbuf::Int, field_offset) end |