I wonder if this is correct to write even if nj has unik length for each variable, so for x it can be 12, but for y it can be 20 and for z it can be 40.

Also is it possible to convert it to something like:

I wonder if this is correct to write even if nj has unik length for each variable, so for x it can be 12, but for y it can be 20 and for z it can be 40.

Also is it possible to convert it to something like:

If the sizes of x, y, and z are different, then you can't just use $n_j$ in this way - you'd need three different $n_j$'s (i.e. $n_j^1, n_j^2, n_j^3$).
And the notation of the double sum you have below is confusing, I have no idea what you're trying to say.