A Novel Processing-In-Memory Architecture For Dense And Sparse Matrix Multiplications