initialize Subroutine

private impure subroutine initialize(this, matrix, npc, method)

Type Bound

tpca

Arguments

Type IntentOptional Attributes Name
class(tpca), intent(inout) :: this
real(kind=rk), intent(in), dimension(:,:) :: matrix
integer, intent(in), optional :: npc
character(len=*), intent(in), optional :: method

Called by

proc~~initialize~~CalledByGraph proc~initialize forpca::tpca%initialize proc~pca forpca::tpca%pca proc~pca->proc~initialize program~benchmark benchmark program~benchmark->proc~pca program~test1 test1 program~test1->proc~pca

Source Code

   impure subroutine initialize(this, matrix, npc, method)
#else
   pure subroutine initialize(this, matrix, npc, method)
#endif
      class(tpca),              intent(inout)        :: this
      real(rk), dimension(:,:), intent(in)           :: matrix
      integer,                  intent(in), optional :: npc
      character(*),             intent(in), optional :: method


      allocate(this%matrix(size(matrix,1),size(matrix,2)))

#if defined(USE_COARRAY)
      if (this_image() == 1) then
#endif
         this%matrix = matrix
         this%nrow = size(matrix,1)
         this%ncol = size(matrix,2)

         if (.not.present(npc)) then
            this%npc = this%ncol
         else
            this%npc = npc
         end if
#if defined(USE_COARRAY)
      end if
#endif

      if (.not.present(method)) then
         this%method = 'svd'
      else
         this%method = method
      end if

#if defined(USE_COARRAY)
      call co_broadcast(this%matrix, source_image=1)
      call co_broadcast(this%nrow, source_image=1)
      call co_broadcast(this%ncol, source_image=1)
      call co_broadcast(this%npc, source_image=1)
#endif
   end subroutine initialize