compute_gram_block_diagonal function

Compute Gram Matrix for Block Diagonal Structure