Fixed handling of singletons in CRSSparsity, enabled caching of scalars and empty matrices, #620 #575