Karhunen-Loève expansion with reference to singular-value decomposition and separation of variables