Subspace-Constrained Quadratic Matrix Factorization: Algorithm and Applications