A novel stacked memristor architecture performs Euclidean distance calculations directly within memory, enabling energy-efficient self-organizing maps without external arithmetic circuits.