moved promote_scalar all into math/matrix to deal with order-dependency of definitions