Boost LA

diag_matrix

#include <boost/la/diag_matrix.hpp>

namespace
boost
    {
    namespace
    la
        {
        -unspecified-return-type- diag_matrix();
        }
    }

The expression v|diag_matrix returns a view proxy that accesses the vector v as a square matrix of the same dimensions in which the elements of v appear as the main diagonal and all other elements are zero.