added gram matrix function