| // <auto-generated> |
| // automatically generated by the FlatBuffers compiler, do not modify |
| // </auto-generated> |
| |
| namespace Apache.Arrow.Flatbuf |
| { |
| |
| using global::System; |
| using global::System.Collections.Generic; |
| using global::Google.FlatBuffers; |
| |
| /// Compressed Sparse format, that is matrix-specific. |
| internal struct SparseMatrixIndexCSX : IFlatbufferObject |
| { |
| private Table __p; |
| public ByteBuffer ByteBuffer { get { return __p.bb; } } |
| public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_5_9(); } |
| public static SparseMatrixIndexCSX GetRootAsSparseMatrixIndexCSX(ByteBuffer _bb) { return GetRootAsSparseMatrixIndexCSX(_bb, new SparseMatrixIndexCSX()); } |
| public static SparseMatrixIndexCSX GetRootAsSparseMatrixIndexCSX(ByteBuffer _bb, SparseMatrixIndexCSX obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); } |
| public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); } |
| public SparseMatrixIndexCSX __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } |
| |
| /// Which axis, row or column, is compressed |
| public SparseMatrixCompressedAxis CompressedAxis { get { int o = __p.__offset(4); return o != 0 ? (SparseMatrixCompressedAxis)__p.bb.GetShort(o + __p.bb_pos) : SparseMatrixCompressedAxis.Row; } } |
| /// The type of values in indptrBuffer |
| public Int? IndptrType { get { int o = __p.__offset(6); return o != 0 ? (Int?)(new Int()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } |
| /// indptrBuffer stores the location and size of indptr array that |
| /// represents the range of the rows. |
| /// The i-th row spans from `indptr[i]` to `indptr[i+1]` 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]. |
| /// ``` |
| public Buffer? IndptrBuffer { get { int o = __p.__offset(8); return o != 0 ? (Buffer?)(new Buffer()).__assign(o + __p.bb_pos, __p.bb) : null; } } |
| /// The type of values in indicesBuffer |
| public Int? IndicesType { get { int o = __p.__offset(10); return o != 0 ? (Int?)(new Int()).__assign(__p.__indirect(o + __p.bb_pos), __p.bb) : null; } } |
| /// 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 is: |
| /// ```text |
| /// indices(X) = [1, 2, 2, 1, 3, 0, 2, 3, 1]. |
| /// ``` |
| /// Note that the indices are sorted in lexicographical order for each row. |
| public Buffer? IndicesBuffer { get { int o = __p.__offset(12); return o != 0 ? (Buffer?)(new Buffer()).__assign(o + __p.bb_pos, __p.bb) : null; } } |
| |
| public static void StartSparseMatrixIndexCSX(FlatBufferBuilder builder) { builder.StartTable(5); } |
| public static void AddCompressedAxis(FlatBufferBuilder builder, SparseMatrixCompressedAxis compressedAxis) { builder.AddShort(0, (short)compressedAxis, 0); } |
| public static void AddIndptrType(FlatBufferBuilder builder, Offset<Int> indptrTypeOffset) { builder.AddOffset(1, indptrTypeOffset.Value, 0); } |
| public static void AddIndptrBuffer(FlatBufferBuilder builder, Offset<Buffer> indptrBufferOffset) { builder.AddStruct(2, indptrBufferOffset.Value, 0); } |
| public static void AddIndicesType(FlatBufferBuilder builder, Offset<Int> indicesTypeOffset) { builder.AddOffset(3, indicesTypeOffset.Value, 0); } |
| public static void AddIndicesBuffer(FlatBufferBuilder builder, Offset<Buffer> indicesBufferOffset) { builder.AddStruct(4, indicesBufferOffset.Value, 0); } |
| public static Offset<SparseMatrixIndexCSX> EndSparseMatrixIndexCSX(FlatBufferBuilder builder) { |
| int o = builder.EndTable(); |
| builder.Required(o, 6); // indptrType |
| builder.Required(o, 8); // indptrBuffer |
| builder.Required(o, 10); // indicesType |
| builder.Required(o, 12); // indicesBuffer |
| return new Offset<SparseMatrixIndexCSX>(o); |
| } |
| } |
| |
| |
| static internal class SparseMatrixIndexCSXVerify |
| { |
| static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos) |
| { |
| return verifier.VerifyTableStart(tablePos) |
| && verifier.VerifyField(tablePos, 4 /*CompressedAxis*/, 2 /*SparseMatrixCompressedAxis*/, 2, false) |
| && verifier.VerifyTable(tablePos, 6 /*IndptrType*/, IntVerify.Verify, true) |
| && verifier.VerifyField(tablePos, 8 /*IndptrBuffer*/, 16 /*Buffer*/, 8, true) |
| && verifier.VerifyTable(tablePos, 10 /*IndicesType*/, IntVerify.Verify, true) |
| && verifier.VerifyField(tablePos, 12 /*IndicesBuffer*/, 16 /*Buffer*/, 8, true) |
| && verifier.VerifyTableEnd(tablePos); |
| } |
| } |
| |
| } |