rot_matrix Function

public function rot_matrix(rot_angle) result(mat)

Arguments

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

Return Value real(kind=dp), (2,2)


Contents

Source Code


Source Code

    function rot_matrix(rot_angle) result(mat)
        real(dp), intent(in) :: rot_angle
        real(dp) :: mat(2, 2)

        real(dp) :: angle

        angle = rot_angle * pi / 180.0
        mat = reshape([cos(angle), sin(angle), -sin(angle), cos(angle)], [2, 2])
!         mat(1,1) = cos(angle)
!         mat(1,2) = -sin(angle)
!         mat(2,1) = sin(angle)
!         mat(2,2) = cos(angle)

    end function rot_matrix