check_symmetric Function

public function check_symmetric(matrix)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: matrix(:,:)

Return Value logical


Contents

Source Code


Source Code

    logical function check_symmetric(matrix)
        ! function to check if a given matrix is symmetric
        ! for a square matrix!
        real(dp), intent(in) :: matrix(:,:)

        real(dp) :: diff(size(matrix,1),size(matrix,2))

        diff = matrix - transpose(matrix)

        check_symmetric = .false.

        if (near_zero(sum(abs(diff)))) check_symmetric = .true.

    end function check_symmetric