title: Selecting a subset of an array given logical vector in Fortran
body: <p>In Fortran, is it possible to select certain parts of the an array by using some vector of logical values instead of the indices? For example like this:</p>
  
  <pre><code>iszero(1) = 0
  iszero(2) = 1
  iszero(3) = 0
  sum0 = sum(iszero) !was  sum0 = sum(iszero==0)
  !mymatrix is arbitary is 3 times 3 array
  mysubmatrix(1:sum0,1:sum0) = mymatrix(iszero==0,iszero==0)
  call dtrmv('l','n','u',sum0,mysubmatrix(1:sum0,1:sum0),sum0,x(1:sum0)),1)
  </code></pre>
  
  <p>If this is not possible directly, is there an easy (fast) way to find the indices where iszero=0? </p>
  
  <p>edit: I changed the example to present a more realistic case, in previous case I just changed some values to 100.0d0, where the elementwise handling would have been ok..</p>
  
  <p>edit2: had one type on the fourth row of the code</p>