USE quaternions
QUATERNION a,b,c
a=(1.,2,3,4); b=(2.,-1,5,6); c=(3.,-4,8,9)
WRITE (a*b)*c,a*(b*c)
WRITE a*b/b
WRITE a*a,a^2
R=rotation(c)
a=(0.,1,2,3)
c=c/ABS(c)
WRITE R*a(1..3)
! a rotation of the vector composed of the last three elements of a 
WRITE c*a*CONJG(c) ! the same rotation in quaternion notation