tpca Derived Type

type, public :: tpca


Components

Type Visibility Attributes Name Initial
integer, public :: ncol
integer, public :: nrow
integer, public :: npc
character(len=:), public, allocatable :: method
real(kind=rk), public, dimension(:,:), allocatable :: matrix
real(kind=rk), public, dimension(:,:), allocatable :: coeff
real(kind=rk), public, dimension(:,:), allocatable :: score
real(kind=rk), public, dimension(:,:), allocatable :: matrix_app
real(kind=rk), public, dimension(:,:), allocatable :: mean_data
real(kind=rk), public, dimension(:), allocatable :: latent
real(kind=rk), public, dimension(:), allocatable :: explained_variance

Type-Bound Procedures

procedure, public :: initialize

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

    Author
    Seyed Ali Ghasemi

    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

procedure, public :: compute_coeff

  • private impure subroutine compute_coeff(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, public :: compute_score

  • private impure subroutine compute_score(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, public :: reconstruct_data

  • private impure subroutine reconstruct_data(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, public :: cmp_explained_variance

  • private impure subroutine cmp_explained_variance(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

procedure, public :: pca

  • private impure subroutine pca(this, matrix, npc, method, coeff, score, latent, explained, matrix_app)

    Author
    Seyed Ali Ghasemi

    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
    real(kind=rk), intent(out), dimension(:,:), allocatable :: coeff
    real(kind=rk), intent(out), optional, dimension(:,:), allocatable :: score
    real(kind=rk), intent(out), optional, dimension(:), allocatable :: latent
    real(kind=rk), intent(out), optional, dimension(:), allocatable :: explained
    real(kind=rk), intent(out), optional, dimension(:,:), allocatable :: matrix_app

procedure, public :: finalize => deallocate_tpca

  • private pure elemental subroutine deallocate_tpca(this)

    Author
    Seyed Ali Ghasemi

    Arguments

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

Source Code

   type tpca
      integer                               :: ncol, nrow, npc
      character(:),             allocatable :: method
      real(rk), dimension(:,:), allocatable :: matrix
      real(rk), dimension(:,:), allocatable :: coeff
      real(rk), dimension(:,:), allocatable :: score
      real(rk), dimension(:,:), allocatable :: matrix_app
      real(rk), dimension(:,:), allocatable :: mean_data
      real(rk), dimension(:),   allocatable :: latent
      real(rk), dimension(:),   allocatable :: explained_variance
   contains
      procedure :: initialize
      procedure :: compute_coeff
      procedure :: compute_score
      procedure :: reconstruct_data
      procedure :: cmp_explained_variance
      procedure :: pca
      procedure :: finalize => deallocate_tpca
   end type tpca