Of course, I could create them using view1 = view(myvector, 1:3) and view2 = view(myvector, 4:6), but this creates SubArrays, which are not statically sized and end up creating non-static vectors when used in LinearAlgebra operations.
If I where using Svectors instead of MVectors, I could solve this with reinterpret; but it doesn’t work in this case beacuse MVectors are not isbits types.
I summary, my requirements are:
Define a structure with fields myvector, view1, and view2.
view1 and view2 must use the same underlying data as myvector, so that changes in any of the six elements are automatically seen in both fields that reference that element.
myvector, view1, and view2 must all be static arrays, so that operations with them also produce static arrays.
Thanks for the answer, I guess this is as good as we can get… but I am not convinced this meets my requirements because linalg operations with these views give SizedVectors instead of MVectors: