small numpy matrix write optimization