title: Is there an intrinsic function for initializing arrays to zero in Fortran?
body: <p>Is there a way to set an array (vector, or matrix, or even a scalar) to zero yet in Fortran? 2003/2008 seem to be taking Fortran to a very modern level, and I have to wonder if they have included an easy way to set array values to zero without having to do</p>
  
  <pre><code>do i = 1,X
  
          do j = 1,Y
  
              A(i,j) = 0
  
          enddo
  
  enddo
  </code></pre>
  
  <p>Where X is the number of rows and Y is the number of columns in a 2-d matrix. This could be generalized to as many dimensions as you like, but the principle is the same.</p>
  
  <p>In Matlab this is easily done with the zeros function, i.e., </p>
  
  <pre><code>A = zeros(X,Y)
  </code></pre>
  
  <p>Modern Fortran seems to be incorporating a lot of the things people like about Matlab and other languages into it's repertoire, so I am just curious if they have an intrinsic for this simple and basic task yet.</p>
  
  <p>Or maybe in modern Fortran it isn't necessary to clear out any previously stored values in the memory by initializing arrays?</p>
  
  <p>I guess a shorter way would be to just go</p>
  
  <pre><code>real, dimension(X,Y)        :: A
  
  A = A*0.0 ! Set all elements to zero by multiplying matrix by scalar value 0
  </code></pre>
  
  <p>But the question about an intrinsic still stands.</p>