code: public static void symmRankTranA_sub(DMatrixRMaj a , DMatrixRMaj c ,
                                           int startIndexC )
      {
          // TODO update so that it doesn't modify/read parts that it shouldn't
          final double dataA[] = a.data;
          final double dataC[] = c.data;
  
  //        for( int i = 0; i < a.numCols; i++ ) {
  //            for( int k = 0; k < a.numRows; k++ ) {
  //                double valA = dataA[k*a.numCols+i];
  //
  //                for( int j = i; j < a.numCols; j++ ) {
  //                    dataC[startIndexC+i*c.numCols+j] -= valA * dataA[k*a.numCols+j];
  //                }
  //            }
  //        }
  
          final int strideC = c.numCols + 1;
          for( int i = 0; i < a.numCols; i++ ) {
              int indexA = i;
              int endR = a.numCols;
  
              for( int k = 0; k < a.numRows; k++ , indexA += a.numCols , endR += a.numCols) {
                  int indexC = startIndexC;
                  final double valA = dataA[indexA];
                  int indexR = indexA;
  
                  while( indexR < endR ) {
                      dataC[indexC++] -= valA * dataA[indexR++];
                  }
              }
              startIndexC += strideC;
          }
  
      }
docs: <p>
  Performs this operation:<br>
  <br>
  c = c - a<sup>T</sup>a <br>
  where c is a submatrix.
  </p>
  
  Only the upper triangle is updated.
  
  @param a A matrix.
  @param c A matrix.
  @param startIndexC start of the submatrix in c.