code: def corr_flat_und(a1, a2):
      '''
      Returns the correlation coefficient between two flattened adjacency
      matrices.  Only the upper triangular part is used to avoid double counting
      undirected matrices.  Similarity metric for weighted matrices.
  
      Parameters
      ----------
      A1 : NxN np.ndarray
          undirected matrix 1
      A2 : NxN np.ndarray
          undirected matrix 2
  
      Returns
      -------
      r : float
          Correlation coefficient describing edgewise similarity of a1 and a2
      '''
      n = len(a1)
      if len(a2) != n:
          raise BCTParamError("Cannot calculate flattened correlation on "
                              "matrices of different size")
      triu_ix = np.where(np.triu(np.ones((n, n)), 1))
      return np.corrcoef(a1[triu_ix].flat, a2[triu_ix].flat)[0][1f corr_flat_und(a1, a2):
      '''
      Returns the correlation coefficient between two flattened adjacency
      matrices.  Only the upper triangular part is used to avoid double counting
      undirected matrices.  Similarity metric for weighted matrices.
  
      Parameters
      ----------
      A1 : NxN np.ndarray
          undirected matrix 1
      A2 : NxN np.ndarray
          undirected matrix 2
  
      Returns
      -------
      r : float
          Correlation coefficient describing edgewise similarity of a1 and a2
      '''
      n = len(a1)
      if len(a2) != n:
          raise BCTParamError("Cannot calculate flattened correlation on "
                              "matrices of different size")
      triu_ix = np.where(np.triu(np.ones((n, n)), 1))
      return np.corrcoef(a1[triu_ix].flat, a2[triu_ix].flat)[0][1]
docs: Returns the correlation coefficient between two flattened adjacency
      matrices.  Only the upper triangular part is used to avoid double counting
      undirected matrices.  Similarity metric for weighted matrices.
  
      Parameters
      ----------
      A1 : NxN np.ndarray
          undirected matrix 1
      A2 : NxN np.ndarray
          undirected matrix 2
  
      Returns
      -------
      r : float
          Correlation coefficient describing edgewise similarity of a1 and a2