matrix_trace Function

public pure function matrix_trace(n, mat) result(trace)

Compute the matrix trace (sum of the diagonal elements).

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n

size of the matrix

real(kind=wp), intent(in), dimension(n,n) :: mat

the matrix

Return Value real(kind=wp)

the matrix trace


Called by

proc~~matrix_trace~~CalledByGraph proc~matrix_trace matrix_module::matrix_trace proc~compute_monodromy_matrix_eigenvalues halo_orbit_module::compute_monodromy_matrix_eigenvalues proc~compute_monodromy_matrix_eigenvalues->proc~matrix_trace

Source Code

    pure function matrix_trace(n,mat) result(trace)

    implicit none

    integer,intent(in)                 :: n     !! size of the matrix
    real(wp),dimension(n,n),intent(in) :: mat   !! the matrix
    real(wp)                           :: trace !! the matrix trace

    integer :: i !! counter

    trace = zero
    do i = 1, n
        trace = trace + mat(i,i)
    end do

    end function matrix_trace