MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / toOffset

Function toOffset

src/backend/common/ArrayInfo.cpp:195–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195dim4 toOffset(const vector<af_seq> &seqs, const dim4 &parentDims) {
196 dim4 outOffsets(0, 0, 0, 0);
197 for (unsigned i = 0; i < seqs.size(); i++) {
198 if (seqs[i].step != 0 && seqs[i].begin >= 0) {
199 outOffsets[i] = seqs[i].begin;
200 } else if (seqs[i].begin <= -1) {
201 outOffsets[i] = parentDims[i] + seqs[i].begin;
202 } else {
203 outOffsets[i] = 0;
204 }
205
206 if (outOffsets[i] >= parentDims[i]) {
207 AF_ERROR("Index out of range", AF_ERR_SIZE);
208 }
209 }
210 return outOffsets;
211}
212
213dim4 toStride(const vector<af_seq> &seqs, const af::dim4 &parentDims) {
214 dim4 out(calcStrides(parentDims));

Callers 12

indexFunction · 0.85
createSubArrayFunction · 0.85
assignFunction · 0.85
indexFunction · 0.85
createSubArrayFunction · 0.85
assignFunction · 0.85
createSubArrayFunction · 0.85
indexFunction · 0.85
assignFunction · 0.85
indexFunction · 0.85
createSubArrayFunction · 0.85
assignFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected