Electronic structure and optical spectra of LuInCu4 and YbMCu4 (M=Cu, Ag, Au, Pd, and In)