Computing the weighted geometric mean of two large-scale matrices and its inverse times a vector