C RELU — rectified linear unit activation, double-precision, C applied element-wise to a 1D vector. C C Reference: V. Nair and G. Hinton, "Rectified Linear Units C Improve Restricted Boltzmann Machines", ICML 2010. Standard C default activation in most modern feed-forward networks. C C Hand-written reference for the Dark Factory's Phase 3 inference C kernel ladder, 2026-05-24. Public domain. C C Mathematical definition (ReLU activation): C For every index I in 1..N: C Y(I) = max(0, X(I)) C C Shapes: C X is a vector of length N C Y is a vector of length N C C Note: in-place application (Y = X) is allowed at the call site; C the implementation reads X(I) once before writing Y(I). SUBROUTINE RELU (N, X, Y) C Inputs: C N — vector length (non-negative) C X — N-element input vector C Output: C Y — N-element output vector; Y(I) = max(0, X(I)) for each I INTEGER N DOUBLE PRECISION X(*), Y(*) INTEGER I DOUBLE PRECISION V DO 10 I = 1, N V = X(I) IF (V .GT. 0.0D0) THEN Y(I) = V ELSE Y(I) = 0.0D0 END IF 10 CONTINUE RETURN END