Subtract an autodiff array from a scalar
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in) | :: | a | |||
| class(array_type), | intent(in), | target | :: | b |
module function scalar_subtract(a, b) result(c) !! Subtract an autodiff array from a scalar implicit none real(real32), intent(in) :: a class(array_type), intent(in), target :: b type(array_type), pointer :: c c => negate_array(b) c%val = a + c%val if(b%requires_grad)then c%operation = 'subtract_scalar' end if end function scalar_subtract