Fix optimization logger when used with sparse matrices (#28)