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

Function compressArray

src/backend/common/jit/Node.hpp:359–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357
358template<typename ArrayT>
359inline std::array<int, 4> compressArray(ArrayT dims) {
360 std::array<int, 4> shifts{0, 1, 2, 3};
361 bool changed;
362 do {
363 changed = false;
364 for (int i = 0; i < AF_MAX_DIMS - 1; i++) {
365 if (dims[i] == 1 && dims[i + 1] != 1) {
366 std::swap(dims[i], dims[i + 1]);
367 std::swap(shifts[i], shifts[i + 1]);
368 changed = true;
369 }
370 }
371 } while (changed);
372 return shifts;
373}
374
375/// Removes empty columns from output and the other node pointers in \p nodes
376template<typename ParamT, typename BufferNodeT, typename ShiftNodeT>

Callers 1

removeEmptyDimensionsFunction · 0.85

Calls 1

swapFunction · 0.85

Tested by

no test coverage detected