Application of hierarchical matrices in spatial statistics