1. A method of comparing an input pattern with a memory pattern comprising the steps of: loading a representation of said input pattern into cells in an input layer; loading a representation of said memory pattern into cells in a memory layer; loading an initial value into cells in an intermediate layers between said input layer and said memory layer; comparing values of cells in said intermediate layers with values stored in cells of adjacent layers including calculating a minimum energy connection in curved space from said cell in said intermediate layer to said cells in said intermediate layers; updating values stored in cells in said intermediate layers based on said step of comparing; and mapping cells in said memory layer to cells in said input layer.