title: Efficient Storage for Eigen's DiagonalMatrix type in C++
body: <p>I want to do matrix multiplication with a dense matrix and a diagonal matrix. The diagonal matrix is generated from a vector using <code>vec.asDiagonal()</code>.</p>
  
  <p>I am wondering if the DiagonalMatrix type stores just the diagonal, or is it a dense matrix full of zeroes, except for the diagonal? I imagine that a DiagonalMatrix should be a child of Eigen's SparseMatrix. I searched for documentation and found this </p>
  
  <p><a href="https://eigen.tuxfamily.org/index.php?title=SpecialMatrix#Diagonal_matrix" rel="nofollow noreferrer">https://eigen.tuxfamily.org/index.php?title=SpecialMatrix#Diagonal_matrix</a>, suggesting a DiagonalMatrix inherits from MatrixBase, and not SparseMatrix. Does this mean the memory storage is inefficient?</p>