In this particular case, it means the transpose operation doesn’t actually do anything at the time it is called, except to return the array wrapped in a Transpose object.
However, when you index into the returned transpose object, it will transparently reverse the order of the indexes, making it appear as though the underlying array has been transposed.
It is essentially a ‘view’ into the underlying array where the indices have been swapped.
So it is called lazy because it doesn’t do anything until you actually index into the result: it waits till the last minute.
The ‘eager’ alternative here is permutedims
. This will allocate an entirely new array and transpose the values. It’s the opposite of lazy because it does all the work up front, at the expense of memory allocations and copies.
Which one is right for you? It’s really a question of performance and as always benchmark. But as a rule of thumb: if you find yourself accessing the transposed array more than a few times it’s probably best to use the eager alternative, permutedims
.