Characterization and Optimization of ReRAM-based Analog Crossbar Arrays for Neuromorphic Computing