A deterministic approach to the synthesis of sparse arrays with far-field and near-field constraints