align Subroutine

public subroutine align(v, old, new, valigned)

Rotates vectors such that a set of mutually orthogonal unit vectors aligns with another set of mutually orthogonal unit vectors.

The vectors v are rotated using a rotation matrix that, when applied to the unit vectors old, aligns them in the direction of the unit vectors new.

Arguments

Type IntentOptional Attributes Name
real(kind=rp), intent(in), dimension(:,:) :: v

(3,n). Vectors to align.

real(kind=rp), intent(in), dimension(:,:) :: old

(3,m). A set of at most three mutually orthogonal unit vectors. m must be one of 1, 2 or 3.

real(kind=rp), intent(in), dimension(:,:) :: new

(3,m). Another set of mutually orthogonal unit vectors of the same shape as old. The angles between the vectors must be the same as those of old.

real(kind=rp), intent(out), dimension(:,:) :: valigned

(3,n). Aligned vectors, of the same shape as v.