Matching storage and recall: constructing optimal rate and phase-coded autoassociative memories