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

NAG AD Library Introduction
Example description
    Program f06pa_p0w_fe

!     F06PA_P0W_F Example Program Text

!     Mark 28.5 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use iso_c_binding, Only: c_ptr
      Use nagad_library, Only: f06pa_p0w_f
      Use nag_library, Only: nag_wp
!     .. 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, lda, m, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:,:), b(:), y(:)
!     .. Executable Statements ..
      Write (nout,*) 'F06PA_P0W_F Example Program Results'
      Write (nout,*)
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) m, n
      Read (nin,*) alpha, beta
      lda = m
      Allocate (a(lda,n),b(m),y(n))

!     Read the m by n matrix A from data file
      Read (nin,*)(a(i,1:n),i=1,m)

!     Read the vector to be multiplied by A
      Read (nin,*) b(1:m)

      y = 1.0_nag_wp
      ifail = 0
      Call f06pa_p0w_f(ad_handle,'T',m,n,alpha,a,lda,b,1,beta,y,1,ifail)

      Write (nout,*)
      Write (nout,*) 'Product solution y = beta*y + alpha*A^T*b:'
      Write (nout,99999) y(1:n)

99999 Format (4X,F11.4)

    End Program f06pa_p0w_fe