I know now. You should not use SGSparseMatrix of type Scalar but only one of the simple types like float64_t etc