matrix index creation via map