cos_array Function

private function cos_array(a) result(c)

Cosine function for autodiff arrays

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in), target :: a

Return Value type(array_type), pointer


Source Code

  function cos_array(a) result(c)
    !! Cosine function for autodiff arrays
    implicit none
    class(array_type), intent(in), target :: a
    type(array_type), pointer :: c

    c => a%create_result()
    c%val = cos(a%val)

    c%get_partial_left => get_partial_cos
    c%get_partial_left_val => get_partial_cos_val
    if(a%requires_grad) then
       c%requires_grad = .true.
       c%is_forward = a%is_forward
       c%operation = 'cos'
       c%left_operand => a
       c%owns_left_operand = a%is_temporary
    end if
  end function cos_array