1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
17 // Code generated by the FlatBuffers compiler. DO NOT EDIT.
22 flatbuffers "github.com/google/flatbuffers/go"
25 /// Compressed Sparse Row format, that is matrix-specific.
26 type SparseMatrixIndexCSR struct {
27 _tab flatbuffers.Table
30 func GetRootAsSparseMatrixIndexCSR(buf []byte, offset flatbuffers.UOffsetT) *SparseMatrixIndexCSR {
31 n := flatbuffers.GetUOffsetT(buf[offset:])
32 x := &SparseMatrixIndexCSR{}
37 func (rcv *SparseMatrixIndexCSR) Init(buf []byte, i flatbuffers.UOffsetT) {
42 func (rcv *SparseMatrixIndexCSR) Table() flatbuffers.Table {
46 /// The type of values in indptrBuffer
47 func (rcv *SparseMatrixIndexCSR) IndptrType(obj *Int) *Int {
48 o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
50 x := rcv._tab.Indirect(o + rcv._tab.Pos)
54 obj.Init(rcv._tab.Bytes, x)
60 /// The type of values in indptrBuffer
61 /// indptrBuffer stores the location and size of indptr array that
62 /// represents the range of the rows.
63 /// The i-th row spans from indptr[i] to indptr[i+1] in the data.
64 /// The length of this array is 1 + (the number of rows), and the type
65 /// of index value is long.
67 /// For example, let X be the following 6x4 matrix:
69 /// X := [[0, 1, 2, 0],
76 /// The array of non-zero values in X is:
78 /// values(X) = [1, 2, 3, 4, 5, 6, 7, 8, 9].
80 /// And the indptr of X is:
82 /// indptr(X) = [0, 2, 3, 5, 5, 8, 10].
83 func (rcv *SparseMatrixIndexCSR) IndptrBuffer(obj *Buffer) *Buffer {
84 o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
90 obj.Init(rcv._tab.Bytes, x)
96 /// indptrBuffer stores the location and size of indptr array that
97 /// represents the range of the rows.
98 /// The i-th row spans from indptr[i] to indptr[i+1] in the data.
99 /// The length of this array is 1 + (the number of rows), and the type
100 /// of index value is long.
102 /// For example, let X be the following 6x4 matrix:
104 /// X := [[0, 1, 2, 0],
111 /// The array of non-zero values in X is:
113 /// values(X) = [1, 2, 3, 4, 5, 6, 7, 8, 9].
115 /// And the indptr of X is:
117 /// indptr(X) = [0, 2, 3, 5, 5, 8, 10].
118 /// The type of values in indicesBuffer
119 func (rcv *SparseMatrixIndexCSR) IndicesType(obj *Int) *Int {
120 o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
122 x := rcv._tab.Indirect(o + rcv._tab.Pos)
126 obj.Init(rcv._tab.Bytes, x)
132 /// The type of values in indicesBuffer
133 /// indicesBuffer stores the location and size of the array that
134 /// contains the column indices of the corresponding non-zero values.
135 /// The type of index value is long.
137 /// For example, the indices of the above X is:
139 /// indices(X) = [1, 2, 2, 1, 3, 0, 2, 3, 1].
141 /// Note that the indices are sorted in lexicographical order for each row.
142 func (rcv *SparseMatrixIndexCSR) IndicesBuffer(obj *Buffer) *Buffer {
143 o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
145 x := o + rcv._tab.Pos
149 obj.Init(rcv._tab.Bytes, x)
155 /// indicesBuffer stores the location and size of the array that
156 /// contains the column indices of the corresponding non-zero values.
157 /// The type of index value is long.
159 /// For example, the indices of the above X is:
161 /// indices(X) = [1, 2, 2, 1, 3, 0, 2, 3, 1].
163 /// Note that the indices are sorted in lexicographical order for each row.
164 func SparseMatrixIndexCSRStart(builder *flatbuffers.Builder) {
165 builder.StartObject(4)
167 func SparseMatrixIndexCSRAddIndptrType(builder *flatbuffers.Builder, indptrType flatbuffers.UOffsetT) {
168 builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(indptrType), 0)
170 func SparseMatrixIndexCSRAddIndptrBuffer(builder *flatbuffers.Builder, indptrBuffer flatbuffers.UOffsetT) {
171 builder.PrependStructSlot(1, flatbuffers.UOffsetT(indptrBuffer), 0)
173 func SparseMatrixIndexCSRAddIndicesType(builder *flatbuffers.Builder, indicesType flatbuffers.UOffsetT) {
174 builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(indicesType), 0)
176 func SparseMatrixIndexCSRAddIndicesBuffer(builder *flatbuffers.Builder, indicesBuffer flatbuffers.UOffsetT) {
177 builder.PrependStructSlot(3, flatbuffers.UOffsetT(indicesBuffer), 0)
179 func SparseMatrixIndexCSREnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
180 return builder.EndObject()