NAG Library Manual, Mark 27.2
Interfaces:  FL   CL   CPP   AD 

NAG AD Library Introduction
Example description
    Program f06ya_p0w_fe

!     F06YA_P0W_F Example Program Text

!     Mark 27.2 Release. NAG Copyright 2021.

!     .. Use Statements ..
      Use iso_c_binding, Only: c_ptr
      Use nagad_library, Only: f06ya_p0w_f
      Use nag_library, Only: nag_wp, x04caf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Type (c_ptr)                     :: ad_handle
      Real (Kind=nag_wp)               :: alpha, beta
      Integer                          :: i, ifail, k, lda, ldb, ldc, m, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:,:), b(:,:), c(:,:)
!     .. Executable Statements ..
      Write (nout,*) 'F06YA_P0W_F Example Program Results'
      Write (nout,*)
      Flush (nout)

!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) m, n, k
      Read (nin,*) alpha, beta

      lda = k
      ldb = n
      ldc = m

!     Allocate required memory
      Allocate (a(lda,m))
      Allocate (b(ldb,k))
      Allocate (c(ldc,n))

!     Read A from data file
      Read (nin,*)(a(i,1:m),i=1,k)

!     Read B from data file
      Read (nin,*)(b(i,1:k),i=1,n)

      c = 1.0_nag_wp

!     Compute C = beta*C + alpha*A^T*B^T
      ifail = 0
      Call f06ya_p0w_f(ad_handle,'T','T',m,n,k,alpha,a,lda,b,ldb,beta,c,ldc,   &
        ifail)

!     Print solution
      ifail = 0
      Call x04caf('G','N',m,n,c,ldc,'updated C',ifail)

    End Program f06ya_p0w_fe