4D vector

These are distinct from more general linear algebra libraries in other domains focussing on matrices of arbitrary size.

Such libraries sometimes support 3D vectors padded to 4D or loading 3D data into 4D registers, with arithmetic mapped efficiently to SIMD operations by per platform intrinsic function implementations.

There is choice between AOS and SOA approaches given the availability of 4 element registers, versus SIMD instructions that are usually tailored toward homogenous data.

Shading languages for graphics processing unit (GPU) programming usually have a 4D datatypes (along with 2D, 3D) with x-y-z-w accessors including permutes or swizzle access, e.g., allowing easy swapping of RGBA or ARGB formats, accessing two 2D vectors packed into one 4D vector, etc.

[9] Modern GPUs have since moved to scalar single instruction, multiple threads (SIMT) pipelines (for more efficiency in general-purpose computing on graphics processing units (GPGPU)) but still support this programming model.