]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
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 | |
8 | // | |
9 | // http://www.apache.org/licenses/LICENSE-2.0 | |
10 | // | |
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. | |
16 | ||
17 | // Code generated by the FlatBuffers compiler. DO NOT EDIT. | |
18 | ||
19 | package flatbuf | |
20 | ||
21 | import ( | |
22 | flatbuffers "github.com/google/flatbuffers/go" | |
23 | ) | |
24 | ||
25 | /// Compressed Sparse format, that is matrix-specific. | |
26 | type SparseMatrixIndexCSX struct { | |
27 | _tab flatbuffers.Table | |
28 | } | |
29 | ||
30 | func GetRootAsSparseMatrixIndexCSX(buf []byte, offset flatbuffers.UOffsetT) *SparseMatrixIndexCSX { | |
31 | n := flatbuffers.GetUOffsetT(buf[offset:]) | |
32 | x := &SparseMatrixIndexCSX{} | |
33 | x.Init(buf, n+offset) | |
34 | return x | |
35 | } | |
36 | ||
37 | func (rcv *SparseMatrixIndexCSX) Init(buf []byte, i flatbuffers.UOffsetT) { | |
38 | rcv._tab.Bytes = buf | |
39 | rcv._tab.Pos = i | |
40 | } | |
41 | ||
42 | func (rcv *SparseMatrixIndexCSX) Table() flatbuffers.Table { | |
43 | return rcv._tab | |
44 | } | |
45 | ||
46 | /// Which axis, row or column, is compressed | |
47 | func (rcv *SparseMatrixIndexCSX) CompressedAxis() SparseMatrixCompressedAxis { | |
48 | o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) | |
49 | if o != 0 { | |
50 | return SparseMatrixCompressedAxis(rcv._tab.GetInt16(o + rcv._tab.Pos)) | |
51 | } | |
52 | return 0 | |
53 | } | |
54 | ||
55 | /// Which axis, row or column, is compressed | |
56 | func (rcv *SparseMatrixIndexCSX) MutateCompressedAxis(n SparseMatrixCompressedAxis) bool { | |
57 | return rcv._tab.MutateInt16Slot(4, int16(n)) | |
58 | } | |
59 | ||
60 | /// The type of values in indptrBuffer | |
61 | func (rcv *SparseMatrixIndexCSX) IndptrType(obj *Int) *Int { | |
62 | o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) | |
63 | if o != 0 { | |
64 | x := rcv._tab.Indirect(o + rcv._tab.Pos) | |
65 | if obj == nil { | |
66 | obj = new(Int) | |
67 | } | |
68 | obj.Init(rcv._tab.Bytes, x) | |
69 | return obj | |
70 | } | |
71 | return nil | |
72 | } | |
73 | ||
74 | /// The type of values in indptrBuffer | |
75 | /// indptrBuffer stores the location and size of indptr array that | |
76 | /// represents the range of the rows. | |
77 | /// The i-th row spans from `indptr[i]` to `indptr[i+1]` in the data. | |
78 | /// The length of this array is 1 + (the number of rows), and the type | |
79 | /// of index value is long. | |
80 | /// | |
81 | /// For example, let X be the following 6x4 matrix: | |
82 | /// ```text | |
83 | /// X := [[0, 1, 2, 0], | |
84 | /// [0, 0, 3, 0], | |
85 | /// [0, 4, 0, 5], | |
86 | /// [0, 0, 0, 0], | |
87 | /// [6, 0, 7, 8], | |
88 | /// [0, 9, 0, 0]]. | |
89 | /// ``` | |
90 | /// The array of non-zero values in X is: | |
91 | /// ```text | |
92 | /// values(X) = [1, 2, 3, 4, 5, 6, 7, 8, 9]. | |
93 | /// ``` | |
94 | /// And the indptr of X is: | |
95 | /// ```text | |
96 | /// indptr(X) = [0, 2, 3, 5, 5, 8, 10]. | |
97 | /// ``` | |
98 | func (rcv *SparseMatrixIndexCSX) IndptrBuffer(obj *Buffer) *Buffer { | |
99 | o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) | |
100 | if o != 0 { | |
101 | x := o + rcv._tab.Pos | |
102 | if obj == nil { | |
103 | obj = new(Buffer) | |
104 | } | |
105 | obj.Init(rcv._tab.Bytes, x) | |
106 | return obj | |
107 | } | |
108 | return nil | |
109 | } | |
110 | ||
111 | /// indptrBuffer stores the location and size of indptr array that | |
112 | /// represents the range of the rows. | |
113 | /// The i-th row spans from `indptr[i]` to `indptr[i+1]` in the data. | |
114 | /// The length of this array is 1 + (the number of rows), and the type | |
115 | /// of index value is long. | |
116 | /// | |
117 | /// For example, let X be the following 6x4 matrix: | |
118 | /// ```text | |
119 | /// X := [[0, 1, 2, 0], | |
120 | /// [0, 0, 3, 0], | |
121 | /// [0, 4, 0, 5], | |
122 | /// [0, 0, 0, 0], | |
123 | /// [6, 0, 7, 8], | |
124 | /// [0, 9, 0, 0]]. | |
125 | /// ``` | |
126 | /// The array of non-zero values in X is: | |
127 | /// ```text | |
128 | /// values(X) = [1, 2, 3, 4, 5, 6, 7, 8, 9]. | |
129 | /// ``` | |
130 | /// And the indptr of X is: | |
131 | /// ```text | |
132 | /// indptr(X) = [0, 2, 3, 5, 5, 8, 10]. | |
133 | /// ``` | |
134 | /// The type of values in indicesBuffer | |
135 | func (rcv *SparseMatrixIndexCSX) IndicesType(obj *Int) *Int { | |
136 | o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) | |
137 | if o != 0 { | |
138 | x := rcv._tab.Indirect(o + rcv._tab.Pos) | |
139 | if obj == nil { | |
140 | obj = new(Int) | |
141 | } | |
142 | obj.Init(rcv._tab.Bytes, x) | |
143 | return obj | |
144 | } | |
145 | return nil | |
146 | } | |
147 | ||
148 | /// The type of values in indicesBuffer | |
149 | /// indicesBuffer stores the location and size of the array that | |
150 | /// contains the column indices of the corresponding non-zero values. | |
151 | /// The type of index value is long. | |
152 | /// | |
153 | /// For example, the indices of the above X is: | |
154 | /// ```text | |
155 | /// indices(X) = [1, 2, 2, 1, 3, 0, 2, 3, 1]. | |
156 | /// ``` | |
157 | /// Note that the indices are sorted in lexicographical order for each row. | |
158 | func (rcv *SparseMatrixIndexCSX) IndicesBuffer(obj *Buffer) *Buffer { | |
159 | o := flatbuffers.UOffsetT(rcv._tab.Offset(12)) | |
160 | if o != 0 { | |
161 | x := o + rcv._tab.Pos | |
162 | if obj == nil { | |
163 | obj = new(Buffer) | |
164 | } | |
165 | obj.Init(rcv._tab.Bytes, x) | |
166 | return obj | |
167 | } | |
168 | return nil | |
169 | } | |
170 | ||
171 | /// indicesBuffer stores the location and size of the array that | |
172 | /// contains the column indices of the corresponding non-zero values. | |
173 | /// The type of index value is long. | |
174 | /// | |
175 | /// For example, the indices of the above X is: | |
176 | /// ```text | |
177 | /// indices(X) = [1, 2, 2, 1, 3, 0, 2, 3, 1]. | |
178 | /// ``` | |
179 | /// Note that the indices are sorted in lexicographical order for each row. | |
180 | func SparseMatrixIndexCSXStart(builder *flatbuffers.Builder) { | |
181 | builder.StartObject(5) | |
182 | } | |
183 | func SparseMatrixIndexCSXAddCompressedAxis(builder *flatbuffers.Builder, compressedAxis SparseMatrixCompressedAxis) { | |
184 | builder.PrependInt16Slot(0, int16(compressedAxis), 0) | |
185 | } | |
186 | func SparseMatrixIndexCSXAddIndptrType(builder *flatbuffers.Builder, indptrType flatbuffers.UOffsetT) { | |
187 | builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(indptrType), 0) | |
188 | } | |
189 | func SparseMatrixIndexCSXAddIndptrBuffer(builder *flatbuffers.Builder, indptrBuffer flatbuffers.UOffsetT) { | |
190 | builder.PrependStructSlot(2, flatbuffers.UOffsetT(indptrBuffer), 0) | |
191 | } | |
192 | func SparseMatrixIndexCSXAddIndicesType(builder *flatbuffers.Builder, indicesType flatbuffers.UOffsetT) { | |
193 | builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(indicesType), 0) | |
194 | } | |
195 | func SparseMatrixIndexCSXAddIndicesBuffer(builder *flatbuffers.Builder, indicesBuffer flatbuffers.UOffsetT) { | |
196 | builder.PrependStructSlot(4, flatbuffers.UOffsetT(indicesBuffer), 0) | |
197 | } | |
198 | func SparseMatrixIndexCSXEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { | |
199 | return builder.EndObject() | |
200 | } |