Add a real array to an autodiff array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in), | target | :: | a | ||
| real(kind=real32), | intent(in), | dimension(:) | :: | b |
module function add_real1d(a, b) result(c) !! Add a real array to an autodiff array implicit none class(array_type), intent(in), target :: a real(real32), dimension(:), intent(in) :: b type(array_type), pointer :: c integer :: s c => a%create_result() do concurrent(s=1:size(a%val,2)) c%val(:,s) = a%val(:,s) + b(:) end do c%get_partial_left => get_partial_add c%get_partial_left_val => get_partial_add_val if(a%requires_grad)then c%requires_grad = .true. c%is_forward = a%is_forward c%operation = 'add' c%left_operand => a c%owns_left_operand = a%is_temporary end if end function add_real1d