Add mean and covariance computation for DMat.

This also fixes the transposition for rectangular DMat, and add scalar
addition/subtraction/multiplication/division for DMat.