inline typename Eigen::MatrixBase<Derived>::CoeffReturnType static as_scalar(const Eigen::MatrixBase<Derived>& mat) { return mat.value(); }