code: public static void zeroTriangle( boolean upper , DMatrixRBlock A )
      {
          int blockLength = A.blockLength;
  
          if( upper ) {
              for( int i = 0; i < A.numRows; i += blockLength ) {
                  int h = Math.min(blockLength,A.numRows-i);
  
                  for( int j = i; j < A.numCols; j += blockLength ) {
                      int w = Math.min(blockLength,A.numCols-j);
  
                      int index = i*A.numCols + h*j;
  
                      if( j == i ) {
                          for( int k = 0; k < h; k++ ) {
                              for( int l = k+1; l < w; l++ ) {
                                  A.data[index + w*k+l ] = 0;
                              }
                          }
                      } else {
                          for( int k = 0; k < h; k++ ) {
                              for( int l = 0; l < w; l++ ) {
                                  A.data[index + w*k+l ] = 0;
                              }
                          }
                      }
                  }
              }
          } else {
              for( int i = 0; i < A.numRows; i += blockLength ) {
                  int h = Math.min(blockLength,A.numRows-i);
  
                  for( int j = 0; j <= i; j += blockLength ) {
                      int w = Math.min(blockLength,A.numCols-j);
  
                      int index = i*A.numCols + h*j;
  
                      if( j == i ) {
                          for( int k = 0; k < h; k++ ) {
                              int z = Math.min(k,w);
                              for( int l = 0; l < z; l++ ) {
                                  A.data[index + w*k+l ] = 0;
                              }
                          }
                      } else {
                          for( int k = 0; k < h; k++ ) {
                              for( int l = 0; l < w; l++ ) {
                                  A.data[index + w*k+l ] = 0;
                              }
                          }
                      }
                  }
              }
          }
      }
docs: Sets either the upper or low triangle of a matrix to zero