created FastMap and implemented ReducedMatrix