codes for beamforming