support for undefined cmat
support for pvalues input