This paper examines the applicability of hierarchical-matrices (H-matrices) to a computation of the demagnetizing field, which is the most time-consuming part in the micromagnetic simulation of spin torque oscillators (STO). Given that the kernel function of the convolution integral operator for the demagnetizing field has a second-order singularity, efficient approximation cannot be expected using conventional H-matrices employing adaptive cross approximation as the low-rank approximation. We introduce improved H-matrices to overcome this challenge. Furthermore, matrix sizes appearing in STO simulations are relatively small compared with the usual sizes of H-matrices. Through numerical experiments, we confirm the size conditions for memory usage and the computational time of H-matrix-vector products to demonstrate the advantages of using H-matrices.