sign_array Module Function

module function sign_array(scalar, array) result(c)

Add a scalar sign to an autodiff array

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: scalar
class(array_type), intent(in), target :: array

Return Value real(kind=real32), dimension(:,:), allocatable


Source Code

  module function sign_array(scalar, array) result(c)
    !! Add a scalar sign to an autodiff array
    real(real32), intent(in) :: scalar
    class(array_type), intent(in), target :: array
    real(real32), dimension(:,:), allocatable :: c
    ! type(array_type), pointer :: c

    allocate(c(size(array%val,1), size(array%val,2)))
    c = sign(scalar, array%val)
    ! allocate(c)
    ! call c%allocate(array_shape=array%shape)
    ! c%val = sign(scalar, array%val)

    ! if(array%requires_grad) then
    !    c%requires_grad = .true.
    !    c%operation = 'sign'
    !    c%left_operand => array
    !    c%owns_left_operand = array%is_temporary
    ! end if
  end function sign_array