changed implementation to eigen sparse type