MCPcopy Create free account
hub / github.com/apache/arrow / CalculateValueOffset

Function CalculateValueOffset

cpp/src/arrow/tensor.h:164–172  ·  view source on GitHub ↗

Return the offset of the given index on the given strides

Source from the content-addressed store, hash-verified

162
163 /// Return the offset of the given index on the given strides
164 static int64_t CalculateValueOffset(const std::vector<int64_t>& strides,
165 const std::vector<int64_t>& index) {
166 const int64_t n = static_cast<int64_t>(index.size());
167 int64_t offset = 0;
168 for (int64_t i = 0; i < n; ++i) {
169 offset += index[i] * strides[i];
170 }
171 return offset;
172 }
173
174 int64_t CalculateValueOffset(const std::vector<int64_t>& index) const {
175 return Tensor::CalculateValueOffset(strides_, index);

Callers 1

tensor.hFile · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected