Cross-relaxation of electronic excitation in lanthanide-doped crystals and glasses