title: Fortran ASSOCIATE syntax to allow indexed access?
body: <p>Is there a nice way to write a Fortran ASSOCIATE statement to turn this</p>
  
  <pre><code>FORALL (i = 2:n-2)
      v(:,i) = v(:,i) + MATMUL(A, &amp;
               c(2)*u(:,i-2) + c(1)*u(:,i-1) + c(0)*u(:,i) + c(1)*u(:,i+1) + c(2)*u(:,i+2))
  END FORALL
  </code></pre>
  
  <p>into something like the following</p>
  
  <pre><code>ASSOCIATE ( U =&gt; ..., V =&gt; ...)
      FORALL (i = 2:n-2)
          V(i) = V(i) + MATMUL(A, &amp;
                 c(2)*U(i-2) + c(1)*U(i-1) + c(0)*U(i) + c(1)*U(i+1) + c(2)*U(i+2))
      END FORALL
  END ASSOCIATE
  </code></pre>
  
  <p>I'm staring at Adams et al's <em>The Fortran 2003 Handbook</em> section 8.2, but I can't see how to write the <code>associate-name =&gt; selector</code> construct to allow for indexed access into the <code>associate-name</code>.</p>
  
  <p>Obviously what I'm going for is overkill for a couple of lines.  I've got a bunch of 'em that I'd like to condense.</p>