streamlined G matrix building