The Geometry of Memory