    PROGRAM nag_mv_rotation_ex01

      ! Example Program Text for nag_mv_rotation
      ! NAG fl90, Release 4. NAG Copyright 2000.

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_in, nag_std_out
      USE nag_write_mat, ONLY : nag_write_gen_mat
      USE nag_mv_rotation, ONLY : nag_orthomax
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: i, k, p
      REAL (wp) :: gamma
      ! .. Local Arrays ..
      REAL (wp), ALLOCATABLE :: loading(:,:), rotated_loading(:,:), &
       rotation(:,:)
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_mv_rotation_ex01'

      READ (nag_std_in,*)          ! Skip heading in data file
      READ (nag_std_in,*) p, k, gamma

      ALLOCATE (loading(p,k),rotated_loading(p,k), &
       rotation(k,k))              ! Allocate storage

      READ (nag_std_in,*) (loading(i,:),i=1,p)

      CALL nag_orthomax(loading,rotated_loading,rotation=rotation, &
       row_std=.FALSE.,gamma=gamma)

      WRITE (nag_std_out,*)

      CALL nag_write_gen_mat(rotated_loading,format='f9.3', &
       title='Rotated factor loading')

      WRITE (nag_std_out,*)

      CALL nag_write_gen_mat(rotation,format='f9.3',title='Rotation matrix')

      DEALLOCATE (rotation,rotated_loading,loading) ! Deallocate storage

    END PROGRAM nag_mv_rotation_ex01
