reconstruct_data Subroutine

private impure subroutine reconstruct_data(this)

Uses

    • formatmul
  • proc~~reconstruct_data~~UsesGraph proc~reconstruct_data forpca::tpca%reconstruct_data formatmul formatmul proc~reconstruct_data->formatmul

Type Bound

tpca

Arguments

Type IntentOptional Attributes Name
class(tpca), intent(inout) :: this

Called by

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

Source Code

   impure subroutine reconstruct_data(this)
#else
   pure subroutine reconstruct_data(this)
#endif
      use formatmul, only: matmul

      class(tpca), intent(inout)             :: this
      real(rk), dimension(:, :), allocatable :: X_centered
      real(rk), dimension(:, :), allocatable :: pca_X
      real(rk), dimension(:, :), allocatable :: coeff_T
      integer                                :: i, j

      X_centered = this%matrix - this%mean_data

#if defined(USE_COARRAY)
      call co_broadcast(this%coeff, source_image=1)
      pca_X = matmul(X_centered, this%coeff,method='coarray', option='m2')
      call co_broadcast(pca_X, source_image=1)
      coeff_T = transpose(this%coeff)
      this%matrix_app = matmul(pca_X, coeff_T, method='coarray', option='m2') + this%mean_data
#else
      coeff_T = transpose(this%coeff)
      pca_X = matmul(X_centered, this%coeff, method='default', option='m2')
      this%matrix_app = matmul(pca_X, coeff_T, method='default', option='m2') + this%mean_data
#endif
   end subroutine reconstruct_data