I am trying to facilitate automatic vectorization by the compiler in the blitz ++ array library. For this reason, I would like to introduce a representation of array data that is in pieces of fixed-length vectors that are already well-vectorized. However, I cannot understand what type alias rules mean in combination with dynamically allocated arrays.
Here is an idea. The array currently consists of
T_numtype* restrict data_;
Operations are performed by cyclizing this data. What I would like to do is present an alternative view of this array as an array TinyVector<T_numtype, N>, which is a fixed-length vector whose operations are fully vectorized using expression template machines. The idea would be that an array of length L should be either T_numtype[L]or TinyVector<T_numtype, N>[L/N]. Is there a way to accomplish this without applying type smoothing rules?
For a statically allocated array, one could do
union {
T_numtype data_[L];
TinyVector<T_numtype, N>[L/N];
};
The closest I could think of is the definition
typedef union {
T_numtype data_[N];
TinyVector<T_numtype, N>;
} u;
u* data_;
and then select it
data_ = new u[L/N];
But it seems to me that now I have waived the right to the entire array in the form of a flat array T_numtype, so in order to access a specific element I will need to do data_[i/N].data_[i%N]that much more complicated.
, T_numtype data_[L] TinyVector<T_numtype, N>[L/N], L - ?
( , , .. N , TinyVector, ).