Joint beamforming optimization in RIS-aided MIMO wireless systems under mutual coupling and multiple reflections