This transform returns a 1-D reference array that corresponds to the main diagonal of the array. More...
#include <array.hpp>
Public Member Functions | |
LITE_INLINE | diagonal (const diagonal &) |
LITE_INLINE diagonal & | operator= (const diagonal &) |
This transform returns a 1-D reference array that corresponds to the main diagonal of the array.
array<float[6][4][5]> a; // a 6x4x5 array a[diagonal()] = -1; // left hand side is a float[4] reference array // the above line is equivalent to: const int n = std::min(a.size().i0, std::min(a.size().i1, a.size().i2)); // n will be 4 for (int i=0; i<n; i++) a(i, i, i) = -1;