<HTML> <BODY BGCOLOR=#ccccdd LINK=#0000aa VLINK=#0000ff ALINK=#ff0000 ><BASE TARGET="bottom_target"><PRE>
<A NAME='DA_GEN_EIGEN'><A href='../../html_code/setup_structures/da_gen_eigen.inc.html#DA_GEN_EIGEN' TARGET='top_target'><IMG SRC="../../gif/bar_red.gif" border=0></A>

Subroutine da_gen_eigen(kz, covm, eve, val) 4,2

  implicit none

  integer, intent(in) :: kz
  real   , dimension(1:kz,1:kz), intent(inout) :: covm
  real   , dimension(1:kz,1:kz), intent(out)   :: eve
  real   , dimension(1:kz)     , intent(out)   :: val

  integer  :: k1, k2

!
      call da_1d_eigendecomposition( covm, eve, val )

      do k1 = 1, kz
        if ( val(k1) &lt; 0.0 ) val(k1) = 0.0
      end do

      do k1 = 1, kz
        do k2 = k1, kz
          covm(k1,k2) = SUM( eve(k1,:) * val(:) * eve(k2,:) )
        end do
      end do
   
      do k1 = 2, kz
        do k2 = 1, k1-1
          covm(k1,k2) = covm(k2,k1)
        end do
      end do

      call da_1d_eigendecomposition( covm, eve, val )

      do k1 = 1, kz
        if ( val(k1) &lt; 0.0 ) val(k1) = 0.0
      end do
!
end Subroutine da_gen_eigen