Deviations from Matthiessen's rule for dilute alloys of polyvalent and noble metals